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