resource.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. /*
  2. * resource.c - Contains functions for registering and analyzing resource information
  3. *
  4. * based on isapnp.c resource management (c) Jaroslav Kysela <perex@perex.cz>
  5. * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
  6. * Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
  7. * Bjorn Helgaas <bjorn.helgaas@hp.com>
  8. */
  9. #include <linux/module.h>
  10. #include <linux/slab.h>
  11. #include <linux/errno.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/kernel.h>
  14. #include <asm/io.h>
  15. #include <asm/dma.h>
  16. #include <asm/irq.h>
  17. #include <linux/pci.h>
  18. #include <linux/ioport.h>
  19. #include <linux/init.h>
  20. #include <linux/pnp.h>
  21. #include "base.h"
  22. static int pnp_reserve_irq[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some IRQ */
  23. static int pnp_reserve_dma[8] = {[0 ... 7] = -1 }; /* reserve (don't use) some DMA */
  24. static int pnp_reserve_io[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some I/O region */
  25. static int pnp_reserve_mem[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some memory region */
  26. /*
  27. * option registration
  28. */
  29. struct pnp_option *pnp_build_option(struct pnp_dev *dev, unsigned long type,
  30. unsigned int option_flags)
  31. {
  32. struct pnp_option *option;
  33. option = kzalloc(sizeof(struct pnp_option), GFP_KERNEL);
  34. if (!option)
  35. return NULL;
  36. option->flags = option_flags;
  37. option->type = type;
  38. list_add_tail(&option->list, &dev->options);
  39. return option;
  40. }
  41. int pnp_register_irq_resource(struct pnp_dev *dev, unsigned int option_flags,
  42. pnp_irq_mask_t *map, unsigned char flags)
  43. {
  44. struct pnp_option *option;
  45. struct pnp_irq *irq;
  46. option = pnp_build_option(dev, IORESOURCE_IRQ, option_flags);
  47. if (!option)
  48. return -ENOMEM;
  49. irq = &option->u.irq;
  50. irq->map = *map;
  51. irq->flags = flags;
  52. #ifdef CONFIG_PCI
  53. {
  54. int i;
  55. for (i = 0; i < 16; i++)
  56. if (test_bit(i, irq->map.bits))
  57. pcibios_penalize_isa_irq(i, 0);
  58. }
  59. #endif
  60. dbg_pnp_show_option(dev, option);
  61. return 0;
  62. }
  63. int pnp_register_dma_resource(struct pnp_dev *dev, unsigned int option_flags,
  64. unsigned char map, unsigned char flags)
  65. {
  66. struct pnp_option *option;
  67. struct pnp_dma *dma;
  68. option = pnp_build_option(dev, IORESOURCE_DMA, option_flags);
  69. if (!option)
  70. return -ENOMEM;
  71. dma = &option->u.dma;
  72. dma->map = map;
  73. dma->flags = flags;
  74. dbg_pnp_show_option(dev, option);
  75. return 0;
  76. }
  77. int pnp_register_port_resource(struct pnp_dev *dev, unsigned int option_flags,
  78. resource_size_t min, resource_size_t max,
  79. resource_size_t align, resource_size_t size,
  80. unsigned char flags)
  81. {
  82. struct pnp_option *option;
  83. struct pnp_port *port;
  84. option = pnp_build_option(dev, IORESOURCE_IO, option_flags);
  85. if (!option)
  86. return -ENOMEM;
  87. port = &option->u.port;
  88. port->min = min;
  89. port->max = max;
  90. port->align = align;
  91. port->size = size;
  92. port->flags = flags;
  93. dbg_pnp_show_option(dev, option);
  94. return 0;
  95. }
  96. int pnp_register_mem_resource(struct pnp_dev *dev, unsigned int option_flags,
  97. resource_size_t min, resource_size_t max,
  98. resource_size_t align, resource_size_t size,
  99. unsigned char flags)
  100. {
  101. struct pnp_option *option;
  102. struct pnp_mem *mem;
  103. option = pnp_build_option(dev, IORESOURCE_MEM, option_flags);
  104. if (!option)
  105. return -ENOMEM;
  106. mem = &option->u.mem;
  107. mem->min = min;
  108. mem->max = max;
  109. mem->align = align;
  110. mem->size = size;
  111. mem->flags = flags;
  112. dbg_pnp_show_option(dev, option);
  113. return 0;
  114. }
  115. void pnp_free_options(struct pnp_dev *dev)
  116. {
  117. struct pnp_option *option, *tmp;
  118. list_for_each_entry_safe(option, tmp, &dev->options, list) {
  119. list_del(&option->list);
  120. kfree(option);
  121. }
  122. }
  123. /*
  124. * resource validity checking
  125. */
  126. #define length(start, end) (*(end) - *(start) + 1)
  127. /* Two ranges conflict if one doesn't end before the other starts */
  128. #define ranged_conflict(starta, enda, startb, endb) \
  129. !((*(enda) < *(startb)) || (*(endb) < *(starta)))
  130. #define cannot_compare(flags) \
  131. ((flags) & IORESOURCE_DISABLED)
  132. int pnp_check_port(struct pnp_dev *dev, struct resource *res)
  133. {
  134. int i;
  135. struct pnp_dev *tdev;
  136. struct resource *tres;
  137. resource_size_t *port, *end, *tport, *tend;
  138. port = &res->start;
  139. end = &res->end;
  140. /* if the resource doesn't exist, don't complain about it */
  141. if (cannot_compare(res->flags))
  142. return 1;
  143. /* check if the resource is already in use, skip if the
  144. * device is active because it itself may be in use */
  145. if (!dev->active) {
  146. if (__check_region(&ioport_resource, *port, length(port, end)))
  147. return 0;
  148. }
  149. /* check if the resource is reserved */
  150. for (i = 0; i < 8; i++) {
  151. int rport = pnp_reserve_io[i << 1];
  152. int rend = pnp_reserve_io[(i << 1) + 1] + rport - 1;
  153. if (ranged_conflict(port, end, &rport, &rend))
  154. return 0;
  155. }
  156. /* check for internal conflicts */
  157. for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) {
  158. if (tres != res && tres->flags & IORESOURCE_IO) {
  159. tport = &tres->start;
  160. tend = &tres->end;
  161. if (ranged_conflict(port, end, tport, tend))
  162. return 0;
  163. }
  164. }
  165. /* check for conflicts with other pnp devices */
  166. pnp_for_each_dev(tdev) {
  167. if (tdev == dev)
  168. continue;
  169. for (i = 0;
  170. (tres = pnp_get_resource(tdev, IORESOURCE_IO, i));
  171. i++) {
  172. if (tres->flags & IORESOURCE_IO) {
  173. if (cannot_compare(tres->flags))
  174. continue;
  175. tport = &tres->start;
  176. tend = &tres->end;
  177. if (ranged_conflict(port, end, tport, tend))
  178. return 0;
  179. }
  180. }
  181. }
  182. return 1;
  183. }
  184. int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
  185. {
  186. int i;
  187. struct pnp_dev *tdev;
  188. struct resource *tres;
  189. resource_size_t *addr, *end, *taddr, *tend;
  190. addr = &res->start;
  191. end = &res->end;
  192. /* if the resource doesn't exist, don't complain about it */
  193. if (cannot_compare(res->flags))
  194. return 1;
  195. /* check if the resource is already in use, skip if the
  196. * device is active because it itself may be in use */
  197. if (!dev->active) {
  198. if (check_mem_region(*addr, length(addr, end)))
  199. return 0;
  200. }
  201. /* check if the resource is reserved */
  202. for (i = 0; i < 8; i++) {
  203. int raddr = pnp_reserve_mem[i << 1];
  204. int rend = pnp_reserve_mem[(i << 1) + 1] + raddr - 1;
  205. if (ranged_conflict(addr, end, &raddr, &rend))
  206. return 0;
  207. }
  208. /* check for internal conflicts */
  209. for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
  210. if (tres != res && tres->flags & IORESOURCE_MEM) {
  211. taddr = &tres->start;
  212. tend = &tres->end;
  213. if (ranged_conflict(addr, end, taddr, tend))
  214. return 0;
  215. }
  216. }
  217. /* check for conflicts with other pnp devices */
  218. pnp_for_each_dev(tdev) {
  219. if (tdev == dev)
  220. continue;
  221. for (i = 0;
  222. (tres = pnp_get_resource(tdev, IORESOURCE_MEM, i));
  223. i++) {
  224. if (tres->flags & IORESOURCE_MEM) {
  225. if (cannot_compare(tres->flags))
  226. continue;
  227. taddr = &tres->start;
  228. tend = &tres->end;
  229. if (ranged_conflict(addr, end, taddr, tend))
  230. return 0;
  231. }
  232. }
  233. }
  234. return 1;
  235. }
  236. static irqreturn_t pnp_test_handler(int irq, void *dev_id)
  237. {
  238. return IRQ_HANDLED;
  239. }
  240. #ifdef CONFIG_PCI
  241. static int pci_dev_uses_irq(struct pnp_dev *pnp, struct pci_dev *pci,
  242. unsigned int irq)
  243. {
  244. u32 class;
  245. u8 progif;
  246. if (pci->irq == irq) {
  247. pnp_dbg(&pnp->dev, " device %s using irq %d\n",
  248. pci_name(pci), irq);
  249. return 1;
  250. }
  251. /*
  252. * See pci_setup_device() and ata_pci_sff_activate_host() for
  253. * similar IDE legacy detection.
  254. */
  255. pci_read_config_dword(pci, PCI_CLASS_REVISION, &class);
  256. class >>= 8; /* discard revision ID */
  257. progif = class & 0xff;
  258. class >>= 8;
  259. if (class == PCI_CLASS_STORAGE_IDE) {
  260. /*
  261. * Unless both channels are native-PCI mode only,
  262. * treat the compatibility IRQs as busy.
  263. */
  264. if ((progif & 0x5) != 0x5)
  265. if (pci_get_legacy_ide_irq(pci, 0) == irq ||
  266. pci_get_legacy_ide_irq(pci, 1) == irq) {
  267. pnp_dbg(&pnp->dev, " legacy IDE device %s "
  268. "using irq %d\n", pci_name(pci), irq);
  269. return 1;
  270. }
  271. }
  272. return 0;
  273. }
  274. #endif
  275. static int pci_uses_irq(struct pnp_dev *pnp, unsigned int irq)
  276. {
  277. #ifdef CONFIG_PCI
  278. struct pci_dev *pci = NULL;
  279. for_each_pci_dev(pci) {
  280. if (pci_dev_uses_irq(pnp, pci, irq)) {
  281. pci_dev_put(pci);
  282. return 1;
  283. }
  284. }
  285. #endif
  286. return 0;
  287. }
  288. int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
  289. {
  290. int i;
  291. struct pnp_dev *tdev;
  292. struct resource *tres;
  293. resource_size_t *irq;
  294. irq = &res->start;
  295. /* if the resource doesn't exist, don't complain about it */
  296. if (cannot_compare(res->flags))
  297. return 1;
  298. /* check if the resource is valid */
  299. if (*irq < 0 || *irq > 15)
  300. return 0;
  301. /* check if the resource is reserved */
  302. for (i = 0; i < 16; i++) {
  303. if (pnp_reserve_irq[i] == *irq)
  304. return 0;
  305. }
  306. /* check for internal conflicts */
  307. for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_IRQ, i)); i++) {
  308. if (tres != res && tres->flags & IORESOURCE_IRQ) {
  309. if (tres->start == *irq)
  310. return 0;
  311. }
  312. }
  313. /* check if the resource is being used by a pci device */
  314. if (pci_uses_irq(dev, *irq))
  315. return 0;
  316. /* check if the resource is already in use, skip if the
  317. * device is active because it itself may be in use */
  318. if (!dev->active) {
  319. if (request_irq(*irq, pnp_test_handler,
  320. IRQF_DISABLED | IRQF_PROBE_SHARED, "pnp", NULL))
  321. return 0;
  322. free_irq(*irq, NULL);
  323. }
  324. /* check for conflicts with other pnp devices */
  325. pnp_for_each_dev(tdev) {
  326. if (tdev == dev)
  327. continue;
  328. for (i = 0;
  329. (tres = pnp_get_resource(tdev, IORESOURCE_IRQ, i));
  330. i++) {
  331. if (tres->flags & IORESOURCE_IRQ) {
  332. if (cannot_compare(tres->flags))
  333. continue;
  334. if (tres->start == *irq)
  335. return 0;
  336. }
  337. }
  338. }
  339. return 1;
  340. }
  341. int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
  342. {
  343. #ifndef CONFIG_IA64
  344. int i;
  345. struct pnp_dev *tdev;
  346. struct resource *tres;
  347. resource_size_t *dma;
  348. dma = &res->start;
  349. /* if the resource doesn't exist, don't complain about it */
  350. if (cannot_compare(res->flags))
  351. return 1;
  352. /* check if the resource is valid */
  353. if (*dma < 0 || *dma == 4 || *dma > 7)
  354. return 0;
  355. /* check if the resource is reserved */
  356. for (i = 0; i < 8; i++) {
  357. if (pnp_reserve_dma[i] == *dma)
  358. return 0;
  359. }
  360. /* check for internal conflicts */
  361. for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_DMA, i)); i++) {
  362. if (tres != res && tres->flags & IORESOURCE_DMA) {
  363. if (tres->start == *dma)
  364. return 0;
  365. }
  366. }
  367. /* check if the resource is already in use, skip if the
  368. * device is active because it itself may be in use */
  369. if (!dev->active) {
  370. if (request_dma(*dma, "pnp"))
  371. return 0;
  372. free_dma(*dma);
  373. }
  374. /* check for conflicts with other pnp devices */
  375. pnp_for_each_dev(tdev) {
  376. if (tdev == dev)
  377. continue;
  378. for (i = 0;
  379. (tres = pnp_get_resource(tdev, IORESOURCE_DMA, i));
  380. i++) {
  381. if (tres->flags & IORESOURCE_DMA) {
  382. if (cannot_compare(tres->flags))
  383. continue;
  384. if (tres->start == *dma)
  385. return 0;
  386. }
  387. }
  388. }
  389. return 1;
  390. #else
  391. /* IA64 does not have legacy DMA */
  392. return 0;
  393. #endif
  394. }
  395. unsigned long pnp_resource_type(struct resource *res)
  396. {
  397. return res->flags & (IORESOURCE_IO | IORESOURCE_MEM |
  398. IORESOURCE_IRQ | IORESOURCE_DMA |
  399. IORESOURCE_BUS);
  400. }
  401. struct resource *pnp_get_resource(struct pnp_dev *dev,
  402. unsigned long type, unsigned int num)
  403. {
  404. struct pnp_resource *pnp_res;
  405. struct resource *res;
  406. list_for_each_entry(pnp_res, &dev->resources, list) {
  407. res = &pnp_res->res;
  408. if (pnp_resource_type(res) == type && num-- == 0)
  409. return res;
  410. }
  411. return NULL;
  412. }
  413. EXPORT_SYMBOL(pnp_get_resource);
  414. static struct pnp_resource *pnp_new_resource(struct pnp_dev *dev)
  415. {
  416. struct pnp_resource *pnp_res;
  417. pnp_res = kzalloc(sizeof(struct pnp_resource), GFP_KERNEL);
  418. if (!pnp_res)
  419. return NULL;
  420. list_add_tail(&pnp_res->list, &dev->resources);
  421. return pnp_res;
  422. }
  423. struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
  424. int flags)
  425. {
  426. struct pnp_resource *pnp_res;
  427. struct resource *res;
  428. pnp_res = pnp_new_resource(dev);
  429. if (!pnp_res) {
  430. dev_err(&dev->dev, "can't add resource for IRQ %d\n", irq);
  431. return NULL;
  432. }
  433. res = &pnp_res->res;
  434. res->flags = IORESOURCE_IRQ | flags;
  435. res->start = irq;
  436. res->end = irq;
  437. pnp_dbg(&dev->dev, " add %pr\n", res);
  438. return pnp_res;
  439. }
  440. struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma,
  441. int flags)
  442. {
  443. struct pnp_resource *pnp_res;
  444. struct resource *res;
  445. pnp_res = pnp_new_resource(dev);
  446. if (!pnp_res) {
  447. dev_err(&dev->dev, "can't add resource for DMA %d\n", dma);
  448. return NULL;
  449. }
  450. res = &pnp_res->res;
  451. res->flags = IORESOURCE_DMA | flags;
  452. res->start = dma;
  453. res->end = dma;
  454. pnp_dbg(&dev->dev, " add %pr\n", res);
  455. return pnp_res;
  456. }
  457. struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
  458. resource_size_t start,
  459. resource_size_t end, int flags)
  460. {
  461. struct pnp_resource *pnp_res;
  462. struct resource *res;
  463. pnp_res = pnp_new_resource(dev);
  464. if (!pnp_res) {
  465. dev_err(&dev->dev, "can't add resource for IO %#llx-%#llx\n",
  466. (unsigned long long) start,
  467. (unsigned long long) end);
  468. return NULL;
  469. }
  470. res = &pnp_res->res;
  471. res->flags = IORESOURCE_IO | flags;
  472. res->start = start;
  473. res->end = end;
  474. pnp_dbg(&dev->dev, " add %pr\n", res);
  475. return pnp_res;
  476. }
  477. struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
  478. resource_size_t start,
  479. resource_size_t end, int flags)
  480. {
  481. struct pnp_resource *pnp_res;
  482. struct resource *res;
  483. pnp_res = pnp_new_resource(dev);
  484. if (!pnp_res) {
  485. dev_err(&dev->dev, "can't add resource for MEM %#llx-%#llx\n",
  486. (unsigned long long) start,
  487. (unsigned long long) end);
  488. return NULL;
  489. }
  490. res = &pnp_res->res;
  491. res->flags = IORESOURCE_MEM | flags;
  492. res->start = start;
  493. res->end = end;
  494. pnp_dbg(&dev->dev, " add %pr\n", res);
  495. return pnp_res;
  496. }
  497. struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev,
  498. resource_size_t start,
  499. resource_size_t end)
  500. {
  501. struct pnp_resource *pnp_res;
  502. struct resource *res;
  503. pnp_res = pnp_new_resource(dev);
  504. if (!pnp_res) {
  505. dev_err(&dev->dev, "can't add resource for BUS %#llx-%#llx\n",
  506. (unsigned long long) start,
  507. (unsigned long long) end);
  508. return NULL;
  509. }
  510. res = &pnp_res->res;
  511. res->flags = IORESOURCE_BUS;
  512. res->start = start;
  513. res->end = end;
  514. pnp_dbg(&dev->dev, " add %pr\n", res);
  515. return pnp_res;
  516. }
  517. /*
  518. * Determine whether the specified resource is a possible configuration
  519. * for this device.
  520. */
  521. int pnp_possible_config(struct pnp_dev *dev, int type, resource_size_t start,
  522. resource_size_t size)
  523. {
  524. struct pnp_option *option;
  525. struct pnp_port *port;
  526. struct pnp_mem *mem;
  527. struct pnp_irq *irq;
  528. struct pnp_dma *dma;
  529. list_for_each_entry(option, &dev->options, list) {
  530. if (option->type != type)
  531. continue;
  532. switch (option->type) {
  533. case IORESOURCE_IO:
  534. port = &option->u.port;
  535. if (port->min == start && port->size == size)
  536. return 1;
  537. break;
  538. case IORESOURCE_MEM:
  539. mem = &option->u.mem;
  540. if (mem->min == start && mem->size == size)
  541. return 1;
  542. break;
  543. case IORESOURCE_IRQ:
  544. irq = &option->u.irq;
  545. if (start < PNP_IRQ_NR &&
  546. test_bit(start, irq->map.bits))
  547. return 1;
  548. break;
  549. case IORESOURCE_DMA:
  550. dma = &option->u.dma;
  551. if (dma->map & (1 << start))
  552. return 1;
  553. break;
  554. }
  555. }
  556. return 0;
  557. }
  558. EXPORT_SYMBOL(pnp_possible_config);
  559. int pnp_range_reserved(resource_size_t start, resource_size_t end)
  560. {
  561. struct pnp_dev *dev;
  562. struct pnp_resource *pnp_res;
  563. resource_size_t *dev_start, *dev_end;
  564. pnp_for_each_dev(dev) {
  565. list_for_each_entry(pnp_res, &dev->resources, list) {
  566. dev_start = &pnp_res->res.start;
  567. dev_end = &pnp_res->res.end;
  568. if (ranged_conflict(&start, &end, dev_start, dev_end))
  569. return 1;
  570. }
  571. }
  572. return 0;
  573. }
  574. EXPORT_SYMBOL(pnp_range_reserved);
  575. /* format is: pnp_reserve_irq=irq1[,irq2] .... */
  576. static int __init pnp_setup_reserve_irq(char *str)
  577. {
  578. int i;
  579. for (i = 0; i < 16; i++)
  580. if (get_option(&str, &pnp_reserve_irq[i]) != 2)
  581. break;
  582. return 1;
  583. }
  584. __setup("pnp_reserve_irq=", pnp_setup_reserve_irq);
  585. /* format is: pnp_reserve_dma=dma1[,dma2] .... */
  586. static int __init pnp_setup_reserve_dma(char *str)
  587. {
  588. int i;
  589. for (i = 0; i < 8; i++)
  590. if (get_option(&str, &pnp_reserve_dma[i]) != 2)
  591. break;
  592. return 1;
  593. }
  594. __setup("pnp_reserve_dma=", pnp_setup_reserve_dma);
  595. /* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */
  596. static int __init pnp_setup_reserve_io(char *str)
  597. {
  598. int i;
  599. for (i = 0; i < 16; i++)
  600. if (get_option(&str, &pnp_reserve_io[i]) != 2)
  601. break;
  602. return 1;
  603. }
  604. __setup("pnp_reserve_io=", pnp_setup_reserve_io);
  605. /* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */
  606. static int __init pnp_setup_reserve_mem(char *str)
  607. {
  608. int i;
  609. for (i = 0; i < 16; i++)
  610. if (get_option(&str, &pnp_reserve_mem[i]) != 2)
  611. break;
  612. return 1;
  613. }
  614. __setup("pnp_reserve_mem=", pnp_setup_reserve_mem);