e820.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /*
  2. * Handle the memory map.
  3. * The functions here do the job until bootmem takes over.
  4. * $Id: e820.c,v 1.4 2002/09/19 19:25:32 ak Exp $
  5. *
  6. * Getting sanitize_e820_map() in sync with i386 version by applying change:
  7. * - Provisions for empty E820 memory regions (reported by certain BIOSes).
  8. * Alex Achenbach <xela@slit.de>, December 2002.
  9. * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
  10. *
  11. */
  12. #include <linux/config.h>
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/init.h>
  16. #include <linux/bootmem.h>
  17. #include <linux/ioport.h>
  18. #include <linux/string.h>
  19. #include <linux/kexec.h>
  20. #include <linux/module.h>
  21. #include <asm/page.h>
  22. #include <asm/e820.h>
  23. #include <asm/proto.h>
  24. #include <asm/bootsetup.h>
  25. #include <asm/sections.h>
  26. /*
  27. * PFN of last memory page.
  28. */
  29. unsigned long end_pfn;
  30. EXPORT_SYMBOL(end_pfn);
  31. /*
  32. * end_pfn only includes RAM, while end_pfn_map includes all e820 entries.
  33. * The direct mapping extends to end_pfn_map, so that we can directly access
  34. * apertures, ACPI and other tables without having to play with fixmaps.
  35. */
  36. unsigned long end_pfn_map;
  37. /*
  38. * Last pfn which the user wants to use.
  39. */
  40. unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;
  41. extern struct resource code_resource, data_resource;
  42. /* Check for some hardcoded bad areas that early boot is not allowed to touch */
  43. static inline int bad_addr(unsigned long *addrp, unsigned long size)
  44. {
  45. unsigned long addr = *addrp, last = addr + size;
  46. /* various gunk below that needed for SMP startup */
  47. if (addr < 0x8000) {
  48. *addrp = 0x8000;
  49. return 1;
  50. }
  51. /* direct mapping tables of the kernel */
  52. if (last >= table_start<<PAGE_SHIFT && addr < table_end<<PAGE_SHIFT) {
  53. *addrp = table_end << PAGE_SHIFT;
  54. return 1;
  55. }
  56. /* initrd */
  57. #ifdef CONFIG_BLK_DEV_INITRD
  58. if (LOADER_TYPE && INITRD_START && last >= INITRD_START &&
  59. addr < INITRD_START+INITRD_SIZE) {
  60. *addrp = INITRD_START + INITRD_SIZE;
  61. return 1;
  62. }
  63. #endif
  64. /* kernel code + 640k memory hole (later should not be needed, but
  65. be paranoid for now) */
  66. if (last >= 640*1024 && addr < __pa_symbol(&_end)) {
  67. *addrp = __pa_symbol(&_end);
  68. return 1;
  69. }
  70. /* XXX ramdisk image here? */
  71. return 0;
  72. }
  73. /*
  74. * This function checks if any part of the range <start,end> is mapped
  75. * with type.
  76. */
  77. int __meminit
  78. e820_any_mapped(unsigned long start, unsigned long end, unsigned type)
  79. {
  80. int i;
  81. for (i = 0; i < e820.nr_map; i++) {
  82. struct e820entry *ei = &e820.map[i];
  83. if (type && ei->type != type)
  84. continue;
  85. if (ei->addr >= end || ei->addr + ei->size <= start)
  86. continue;
  87. return 1;
  88. }
  89. return 0;
  90. }
  91. /*
  92. * This function checks if the entire range <start,end> is mapped with type.
  93. *
  94. * Note: this function only works correct if the e820 table is sorted and
  95. * not-overlapping, which is the case
  96. */
  97. int __init e820_all_mapped(unsigned long start, unsigned long end, unsigned type)
  98. {
  99. int i;
  100. for (i = 0; i < e820.nr_map; i++) {
  101. struct e820entry *ei = &e820.map[i];
  102. if (type && ei->type != type)
  103. continue;
  104. /* is the region (part) in overlap with the current region ?*/
  105. if (ei->addr >= end || ei->addr + ei->size <= start)
  106. continue;
  107. /* if the region is at the beginning of <start,end> we move
  108. * start to the end of the region since it's ok until there
  109. */
  110. if (ei->addr <= start)
  111. start = ei->addr + ei->size;
  112. /* if start is now at or beyond end, we're done, full coverage */
  113. if (start >= end)
  114. return 1; /* we're done */
  115. }
  116. return 0;
  117. }
  118. /*
  119. * Find a free area in a specific range.
  120. */
  121. unsigned long __init find_e820_area(unsigned long start, unsigned long end, unsigned size)
  122. {
  123. int i;
  124. for (i = 0; i < e820.nr_map; i++) {
  125. struct e820entry *ei = &e820.map[i];
  126. unsigned long addr = ei->addr, last;
  127. if (ei->type != E820_RAM)
  128. continue;
  129. if (addr < start)
  130. addr = start;
  131. if (addr > ei->addr + ei->size)
  132. continue;
  133. while (bad_addr(&addr, size) && addr+size < ei->addr + ei->size)
  134. ;
  135. last = addr + size;
  136. if (last > ei->addr + ei->size)
  137. continue;
  138. if (last > end)
  139. continue;
  140. return addr;
  141. }
  142. return -1UL;
  143. }
  144. /*
  145. * Free bootmem based on the e820 table for a node.
  146. */
  147. void __init e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end)
  148. {
  149. int i;
  150. for (i = 0; i < e820.nr_map; i++) {
  151. struct e820entry *ei = &e820.map[i];
  152. unsigned long last, addr;
  153. if (ei->type != E820_RAM ||
  154. ei->addr+ei->size <= start ||
  155. ei->addr >= end)
  156. continue;
  157. addr = round_up(ei->addr, PAGE_SIZE);
  158. if (addr < start)
  159. addr = start;
  160. last = round_down(ei->addr + ei->size, PAGE_SIZE);
  161. if (last >= end)
  162. last = end;
  163. if (last > addr && last-addr >= PAGE_SIZE)
  164. free_bootmem_node(pgdat, addr, last-addr);
  165. }
  166. }
  167. /*
  168. * Find the highest page frame number we have available
  169. */
  170. unsigned long __init e820_end_of_ram(void)
  171. {
  172. int i;
  173. unsigned long end_pfn = 0;
  174. for (i = 0; i < e820.nr_map; i++) {
  175. struct e820entry *ei = &e820.map[i];
  176. unsigned long start, end;
  177. start = round_up(ei->addr, PAGE_SIZE);
  178. end = round_down(ei->addr + ei->size, PAGE_SIZE);
  179. if (start >= end)
  180. continue;
  181. if (ei->type == E820_RAM) {
  182. if (end > end_pfn<<PAGE_SHIFT)
  183. end_pfn = end>>PAGE_SHIFT;
  184. } else {
  185. if (end > end_pfn_map<<PAGE_SHIFT)
  186. end_pfn_map = end>>PAGE_SHIFT;
  187. }
  188. }
  189. if (end_pfn > end_pfn_map)
  190. end_pfn_map = end_pfn;
  191. if (end_pfn_map > MAXMEM>>PAGE_SHIFT)
  192. end_pfn_map = MAXMEM>>PAGE_SHIFT;
  193. if (end_pfn > end_user_pfn)
  194. end_pfn = end_user_pfn;
  195. if (end_pfn > end_pfn_map)
  196. end_pfn = end_pfn_map;
  197. return end_pfn;
  198. }
  199. /*
  200. * Compute how much memory is missing in a range.
  201. * Unlike the other functions in this file the arguments are in page numbers.
  202. */
  203. unsigned long __init
  204. e820_hole_size(unsigned long start_pfn, unsigned long end_pfn)
  205. {
  206. unsigned long ram = 0;
  207. unsigned long start = start_pfn << PAGE_SHIFT;
  208. unsigned long end = end_pfn << PAGE_SHIFT;
  209. int i;
  210. for (i = 0; i < e820.nr_map; i++) {
  211. struct e820entry *ei = &e820.map[i];
  212. unsigned long last, addr;
  213. if (ei->type != E820_RAM ||
  214. ei->addr+ei->size <= start ||
  215. ei->addr >= end)
  216. continue;
  217. addr = round_up(ei->addr, PAGE_SIZE);
  218. if (addr < start)
  219. addr = start;
  220. last = round_down(ei->addr + ei->size, PAGE_SIZE);
  221. if (last >= end)
  222. last = end;
  223. if (last > addr)
  224. ram += last - addr;
  225. }
  226. return ((end - start) - ram) >> PAGE_SHIFT;
  227. }
  228. /*
  229. * Mark e820 reserved areas as busy for the resource manager.
  230. */
  231. void __init e820_reserve_resources(void)
  232. {
  233. int i;
  234. for (i = 0; i < e820.nr_map; i++) {
  235. struct resource *res;
  236. res = alloc_bootmem_low(sizeof(struct resource));
  237. switch (e820.map[i].type) {
  238. case E820_RAM: res->name = "System RAM"; break;
  239. case E820_ACPI: res->name = "ACPI Tables"; break;
  240. case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
  241. default: res->name = "reserved";
  242. }
  243. res->start = e820.map[i].addr;
  244. res->end = res->start + e820.map[i].size - 1;
  245. res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
  246. request_resource(&iomem_resource, res);
  247. if (e820.map[i].type == E820_RAM) {
  248. /*
  249. * We don't know which RAM region contains kernel data,
  250. * so we try it repeatedly and let the resource manager
  251. * test it.
  252. */
  253. request_resource(res, &code_resource);
  254. request_resource(res, &data_resource);
  255. #ifdef CONFIG_KEXEC
  256. request_resource(res, &crashk_res);
  257. #endif
  258. }
  259. }
  260. }
  261. /*
  262. * Add a memory region to the kernel e820 map.
  263. */
  264. void __init add_memory_region(unsigned long start, unsigned long size, int type)
  265. {
  266. int x = e820.nr_map;
  267. if (x == E820MAX) {
  268. printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
  269. return;
  270. }
  271. e820.map[x].addr = start;
  272. e820.map[x].size = size;
  273. e820.map[x].type = type;
  274. e820.nr_map++;
  275. }
  276. void __init e820_print_map(char *who)
  277. {
  278. int i;
  279. for (i = 0; i < e820.nr_map; i++) {
  280. printk(" %s: %016Lx - %016Lx ", who,
  281. (unsigned long long) e820.map[i].addr,
  282. (unsigned long long) (e820.map[i].addr + e820.map[i].size));
  283. switch (e820.map[i].type) {
  284. case E820_RAM: printk("(usable)\n");
  285. break;
  286. case E820_RESERVED:
  287. printk("(reserved)\n");
  288. break;
  289. case E820_ACPI:
  290. printk("(ACPI data)\n");
  291. break;
  292. case E820_NVS:
  293. printk("(ACPI NVS)\n");
  294. break;
  295. default: printk("type %u\n", e820.map[i].type);
  296. break;
  297. }
  298. }
  299. }
  300. /*
  301. * Sanitize the BIOS e820 map.
  302. *
  303. * Some e820 responses include overlapping entries. The following
  304. * replaces the original e820 map with a new one, removing overlaps.
  305. *
  306. */
  307. static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
  308. {
  309. struct change_member {
  310. struct e820entry *pbios; /* pointer to original bios entry */
  311. unsigned long long addr; /* address for this change point */
  312. };
  313. static struct change_member change_point_list[2*E820MAX] __initdata;
  314. static struct change_member *change_point[2*E820MAX] __initdata;
  315. static struct e820entry *overlap_list[E820MAX] __initdata;
  316. static struct e820entry new_bios[E820MAX] __initdata;
  317. struct change_member *change_tmp;
  318. unsigned long current_type, last_type;
  319. unsigned long long last_addr;
  320. int chgidx, still_changing;
  321. int overlap_entries;
  322. int new_bios_entry;
  323. int old_nr, new_nr, chg_nr;
  324. int i;
  325. /*
  326. Visually we're performing the following (1,2,3,4 = memory types)...
  327. Sample memory map (w/overlaps):
  328. ____22__________________
  329. ______________________4_
  330. ____1111________________
  331. _44_____________________
  332. 11111111________________
  333. ____________________33__
  334. ___________44___________
  335. __________33333_________
  336. ______________22________
  337. ___________________2222_
  338. _________111111111______
  339. _____________________11_
  340. _________________4______
  341. Sanitized equivalent (no overlap):
  342. 1_______________________
  343. _44_____________________
  344. ___1____________________
  345. ____22__________________
  346. ______11________________
  347. _________1______________
  348. __________3_____________
  349. ___________44___________
  350. _____________33_________
  351. _______________2________
  352. ________________1_______
  353. _________________4______
  354. ___________________2____
  355. ____________________33__
  356. ______________________4_
  357. */
  358. /* if there's only one memory region, don't bother */
  359. if (*pnr_map < 2)
  360. return -1;
  361. old_nr = *pnr_map;
  362. /* bail out if we find any unreasonable addresses in bios map */
  363. for (i=0; i<old_nr; i++)
  364. if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr)
  365. return -1;
  366. /* create pointers for initial change-point information (for sorting) */
  367. for (i=0; i < 2*old_nr; i++)
  368. change_point[i] = &change_point_list[i];
  369. /* record all known change-points (starting and ending addresses),
  370. omitting those that are for empty memory regions */
  371. chgidx = 0;
  372. for (i=0; i < old_nr; i++) {
  373. if (biosmap[i].size != 0) {
  374. change_point[chgidx]->addr = biosmap[i].addr;
  375. change_point[chgidx++]->pbios = &biosmap[i];
  376. change_point[chgidx]->addr = biosmap[i].addr + biosmap[i].size;
  377. change_point[chgidx++]->pbios = &biosmap[i];
  378. }
  379. }
  380. chg_nr = chgidx;
  381. /* sort change-point list by memory addresses (low -> high) */
  382. still_changing = 1;
  383. while (still_changing) {
  384. still_changing = 0;
  385. for (i=1; i < chg_nr; i++) {
  386. /* if <current_addr> > <last_addr>, swap */
  387. /* or, if current=<start_addr> & last=<end_addr>, swap */
  388. if ((change_point[i]->addr < change_point[i-1]->addr) ||
  389. ((change_point[i]->addr == change_point[i-1]->addr) &&
  390. (change_point[i]->addr == change_point[i]->pbios->addr) &&
  391. (change_point[i-1]->addr != change_point[i-1]->pbios->addr))
  392. )
  393. {
  394. change_tmp = change_point[i];
  395. change_point[i] = change_point[i-1];
  396. change_point[i-1] = change_tmp;
  397. still_changing=1;
  398. }
  399. }
  400. }
  401. /* create a new bios memory map, removing overlaps */
  402. overlap_entries=0; /* number of entries in the overlap table */
  403. new_bios_entry=0; /* index for creating new bios map entries */
  404. last_type = 0; /* start with undefined memory type */
  405. last_addr = 0; /* start with 0 as last starting address */
  406. /* loop through change-points, determining affect on the new bios map */
  407. for (chgidx=0; chgidx < chg_nr; chgidx++)
  408. {
  409. /* keep track of all overlapping bios entries */
  410. if (change_point[chgidx]->addr == change_point[chgidx]->pbios->addr)
  411. {
  412. /* add map entry to overlap list (> 1 entry implies an overlap) */
  413. overlap_list[overlap_entries++]=change_point[chgidx]->pbios;
  414. }
  415. else
  416. {
  417. /* remove entry from list (order independent, so swap with last) */
  418. for (i=0; i<overlap_entries; i++)
  419. {
  420. if (overlap_list[i] == change_point[chgidx]->pbios)
  421. overlap_list[i] = overlap_list[overlap_entries-1];
  422. }
  423. overlap_entries--;
  424. }
  425. /* if there are overlapping entries, decide which "type" to use */
  426. /* (larger value takes precedence -- 1=usable, 2,3,4,4+=unusable) */
  427. current_type = 0;
  428. for (i=0; i<overlap_entries; i++)
  429. if (overlap_list[i]->type > current_type)
  430. current_type = overlap_list[i]->type;
  431. /* continue building up new bios map based on this information */
  432. if (current_type != last_type) {
  433. if (last_type != 0) {
  434. new_bios[new_bios_entry].size =
  435. change_point[chgidx]->addr - last_addr;
  436. /* move forward only if the new size was non-zero */
  437. if (new_bios[new_bios_entry].size != 0)
  438. if (++new_bios_entry >= E820MAX)
  439. break; /* no more space left for new bios entries */
  440. }
  441. if (current_type != 0) {
  442. new_bios[new_bios_entry].addr = change_point[chgidx]->addr;
  443. new_bios[new_bios_entry].type = current_type;
  444. last_addr=change_point[chgidx]->addr;
  445. }
  446. last_type = current_type;
  447. }
  448. }
  449. new_nr = new_bios_entry; /* retain count for new bios entries */
  450. /* copy new bios mapping into original location */
  451. memcpy(biosmap, new_bios, new_nr*sizeof(struct e820entry));
  452. *pnr_map = new_nr;
  453. return 0;
  454. }
  455. /*
  456. * Copy the BIOS e820 map into a safe place.
  457. *
  458. * Sanity-check it while we're at it..
  459. *
  460. * If we're lucky and live on a modern system, the setup code
  461. * will have given us a memory map that we can use to properly
  462. * set up memory. If we aren't, we'll fake a memory map.
  463. *
  464. * We check to see that the memory map contains at least 2 elements
  465. * before we'll use it, because the detection code in setup.S may
  466. * not be perfect and most every PC known to man has two memory
  467. * regions: one from 0 to 640k, and one from 1mb up. (The IBM
  468. * thinkpad 560x, for example, does not cooperate with the memory
  469. * detection code.)
  470. */
  471. static int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
  472. {
  473. /* Only one memory region (or negative)? Ignore it */
  474. if (nr_map < 2)
  475. return -1;
  476. do {
  477. unsigned long start = biosmap->addr;
  478. unsigned long size = biosmap->size;
  479. unsigned long end = start + size;
  480. unsigned long type = biosmap->type;
  481. /* Overflow in 64 bits? Ignore the memory map. */
  482. if (start > end)
  483. return -1;
  484. /*
  485. * Some BIOSes claim RAM in the 640k - 1M region.
  486. * Not right. Fix it up.
  487. *
  488. * This should be removed on Hammer which is supposed to not
  489. * have non e820 covered ISA mappings there, but I had some strange
  490. * problems so it stays for now. -AK
  491. */
  492. if (type == E820_RAM) {
  493. if (start < 0x100000ULL && end > 0xA0000ULL) {
  494. if (start < 0xA0000ULL)
  495. add_memory_region(start, 0xA0000ULL-start, type);
  496. if (end <= 0x100000ULL)
  497. continue;
  498. start = 0x100000ULL;
  499. size = end - start;
  500. }
  501. }
  502. add_memory_region(start, size, type);
  503. } while (biosmap++,--nr_map);
  504. return 0;
  505. }
  506. void __init setup_memory_region(void)
  507. {
  508. char *who = "BIOS-e820";
  509. /*
  510. * Try to copy the BIOS-supplied E820-map.
  511. *
  512. * Otherwise fake a memory map; one section from 0k->640k,
  513. * the next section from 1mb->appropriate_mem_k
  514. */
  515. sanitize_e820_map(E820_MAP, &E820_MAP_NR);
  516. if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
  517. unsigned long mem_size;
  518. /* compare results from other methods and take the greater */
  519. if (ALT_MEM_K < EXT_MEM_K) {
  520. mem_size = EXT_MEM_K;
  521. who = "BIOS-88";
  522. } else {
  523. mem_size = ALT_MEM_K;
  524. who = "BIOS-e801";
  525. }
  526. e820.nr_map = 0;
  527. add_memory_region(0, LOWMEMSIZE(), E820_RAM);
  528. add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
  529. }
  530. printk(KERN_INFO "BIOS-provided physical RAM map:\n");
  531. e820_print_map(who);
  532. }
  533. void __init parse_memopt(char *p, char **from)
  534. {
  535. end_user_pfn = memparse(p, from);
  536. end_user_pfn >>= PAGE_SHIFT;
  537. }
  538. void __init parse_memmapopt(char *p, char **from)
  539. {
  540. unsigned long long start_at, mem_size;
  541. mem_size = memparse(p, from);
  542. p = *from;
  543. if (*p == '@') {
  544. start_at = memparse(p+1, from);
  545. add_memory_region(start_at, mem_size, E820_RAM);
  546. } else if (*p == '#') {
  547. start_at = memparse(p+1, from);
  548. add_memory_region(start_at, mem_size, E820_ACPI);
  549. } else if (*p == '$') {
  550. start_at = memparse(p+1, from);
  551. add_memory_region(start_at, mem_size, E820_RESERVED);
  552. } else {
  553. end_user_pfn = (mem_size >> PAGE_SHIFT);
  554. }
  555. p = *from;
  556. }
  557. unsigned long pci_mem_start = 0xaeedbabe;
  558. /*
  559. * Search for the biggest gap in the low 32 bits of the e820
  560. * memory space. We pass this space to PCI to assign MMIO resources
  561. * for hotplug or unconfigured devices in.
  562. * Hopefully the BIOS let enough space left.
  563. */
  564. __init void e820_setup_gap(void)
  565. {
  566. unsigned long gapstart, gapsize, round;
  567. unsigned long last;
  568. int i;
  569. int found = 0;
  570. last = 0x100000000ull;
  571. gapstart = 0x10000000;
  572. gapsize = 0x400000;
  573. i = e820.nr_map;
  574. while (--i >= 0) {
  575. unsigned long long start = e820.map[i].addr;
  576. unsigned long long end = start + e820.map[i].size;
  577. /*
  578. * Since "last" is at most 4GB, we know we'll
  579. * fit in 32 bits if this condition is true
  580. */
  581. if (last > end) {
  582. unsigned long gap = last - end;
  583. if (gap > gapsize) {
  584. gapsize = gap;
  585. gapstart = end;
  586. found = 1;
  587. }
  588. }
  589. if (start < last)
  590. last = start;
  591. }
  592. if (!found) {
  593. gapstart = (end_pfn << PAGE_SHIFT) + 1024*1024;
  594. printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit address range\n"
  595. KERN_ERR "PCI: Unassigned devices with 32bit resource registers may break!\n");
  596. }
  597. /*
  598. * See how much we want to round up: start off with
  599. * rounding to the next 1MB area.
  600. */
  601. round = 0x100000;
  602. while ((gapsize >> 4) > round)
  603. round += round;
  604. /* Fun with two's complement */
  605. pci_mem_start = (gapstart + round) & -round;
  606. printk(KERN_INFO "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n",
  607. pci_mem_start, gapstart, gapsize);
  608. }