char saved_command_line[COMMAND_LINE_SIZE];
struct resource standard_io_resources[] = {
- { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
- { "pic1", 0x20, 0x21, IORESOURCE_BUSY },
- { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
- { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
- { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
- { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY },
- { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
- { "fpu", 0xf0, 0xff, IORESOURCE_BUSY }
+ { "dma1", 0x00, 0x1f, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "pic1", 0x20, 0x21, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "timer", 0x40, 0x5f, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY | IORESOURCE_IO },
+ { "fpu", 0xf0, 0xff, IORESOURCE_BUSY | IORESOURCE_IO }
};
-#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
+#define STANDARD_IO_RESOURCES \
+ (sizeof standard_io_resources / sizeof standard_io_resources[0])
-struct resource code_resource = { "Kernel code", 0x100000, 0 };
-struct resource data_resource = { "Kernel data", 0, 0 };
-struct resource vram_resource = { "Video RAM area", 0xa0000, 0xbffff, IORESOURCE_BUSY };
+struct resource code_resource = { "Kernel code", 0x100000, 0, IORESOURCE_MEM };
+struct resource data_resource = { "Kernel data", 0, 0, IORESOURCE_MEM };
+struct resource vram_resource = { "Video RAM area", 0xa0000, 0xbffff, IORESOURCE_BUSY | IORESOURCE_MEM };
-/* System ROM resources */
-#define MAXROMS 6
-static struct resource rom_resources[MAXROMS] = {
- { "System ROM", 0xF0000, 0xFFFFF, IORESOURCE_BUSY },
- { "Video ROM", 0xc0000, 0xc7fff, IORESOURCE_BUSY }
+#define IORESOURCE_ROM (IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM)
+
+static struct resource system_rom_resource = { "System ROM", 0xf0000, 0xfffff, IORESOURCE_ROM };
+static struct resource extension_rom_resource = { "Extension ROM", 0xe0000, 0xeffff, IORESOURCE_ROM };
+
+static struct resource adapter_rom_resources[] = {
+ { "Adapter ROM", 0xc8000, 0, IORESOURCE_ROM },
+ { "Adapter ROM", 0, 0, IORESOURCE_ROM },
+ { "Adapter ROM", 0, 0, IORESOURCE_ROM },
+ { "Adapter ROM", 0, 0, IORESOURCE_ROM },
+ { "Adapter ROM", 0, 0, IORESOURCE_ROM },
+ { "Adapter ROM", 0, 0, IORESOURCE_ROM }
};
+#define ADAPTER_ROM_RESOURCES \
+ (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0])
+
+static struct resource video_rom_resource = { "Video ROM", 0xc0000, 0xc7fff, IORESOURCE_ROM };
+
#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
-static void __init probe_roms(void)
+static int __init checksum(unsigned char *rom, unsigned long length)
{
- int roms = 1;
- unsigned long base;
- unsigned char *romstart;
+ unsigned char *p, sum = 0;
- request_resource(&iomem_resource, rom_resources+0);
+ for (p = rom; p < rom + length; p++)
+ sum += *p;
+ return sum == 0;
+}
- /* Video ROM is standard at C000:0000 - C7FF:0000, check signature */
- for (base = 0xC0000; base < 0xE0000; base += 2048) {
- romstart = isa_bus_to_virt(base);
- if (!romsignature(romstart))
+static void __init probe_roms(void)
+{
+ unsigned long start, length, upper;
+ unsigned char *rom;
+ int i;
+
+ /* video rom */
+ upper = adapter_rom_resources[0].start;
+ for (start = video_rom_resource.start; start < upper; start += 2048) {
+ rom = isa_bus_to_virt(start);
+ if (!romsignature(rom))
continue;
- request_resource(&iomem_resource, rom_resources + roms);
- roms++;
- break;
- }
- /* Extension roms at C800:0000 - DFFF:0000 */
- for (base = 0xC8000; base < 0xE0000; base += 2048) {
- unsigned long length;
+ video_rom_resource.start = start;
- romstart = isa_bus_to_virt(base);
- if (!romsignature(romstart))
- continue;
- length = romstart[2] * 512;
- if (length) {
- unsigned int i;
- unsigned char chksum;
-
- chksum = 0;
- for (i = 0; i < length; i++)
- chksum += romstart[i];
-
- /* Good checksum? */
- if (!chksum) {
- rom_resources[roms].start = base;
- rom_resources[roms].end = base + length - 1;
- rom_resources[roms].name = "Extension ROM";
- rom_resources[roms].flags = IORESOURCE_BUSY;
-
- request_resource(&iomem_resource, rom_resources + roms);
- roms++;
- if (roms >= MAXROMS)
- return;
+ /* 0 < length <= 0x7f * 512, historically */
+ length = rom[2] * 512;
+
+ /* if checksum okay, trust length byte */
+ if (length && checksum(rom, length))
+ video_rom_resource.end = start + length - 1;
+
+ request_resource(&iomem_resource, &video_rom_resource);
+ break;
}
+
+ start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
+ if (start < upper)
+ start = upper;
+
+ /* system rom */
+ request_resource(&iomem_resource, &system_rom_resource);
+ upper = system_rom_resource.start;
+
+ /* check for extension rom (ignore length byte!) */
+ rom = isa_bus_to_virt(extension_rom_resource.start);
+ if (romsignature(rom)) {
+ length = extension_rom_resource.end - extension_rom_resource.start + 1;
+ if (checksum(rom, length)) {
+ request_resource(&iomem_resource, &extension_rom_resource);
+ upper = extension_rom_resource.start;
}
}
- /* Final check for motherboard extension rom at E000:0000 */
- base = 0xE0000;
- romstart = isa_bus_to_virt(base);
+ /* check for adapter roms on 2k boundaries */
+ for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) {
+ rom = isa_bus_to_virt(start);
+ if (!romsignature(rom))
+ continue;
+
+ /* 0 < length <= 0x7f * 512, historically */
+ length = rom[2] * 512;
+
+ /* but accept any length that fits if checksum okay */
+ if (!length || start + length > upper || !checksum(rom, length))
+ continue;
- if (romsignature(romstart)) {
- rom_resources[roms].start = base;
- rom_resources[roms].end = base + 65535;
- rom_resources[roms].name = "Extension ROM";
- rom_resources[roms].flags = IORESOURCE_BUSY;
+ adapter_rom_resources[i].start = start;
+ adapter_rom_resources[i].end = start + length - 1;
+ request_resource(&iomem_resource, &adapter_rom_resources[i]);
- request_resource(&iomem_resource, rom_resources + roms);
+ start = adapter_rom_resources[i++].end & ~2047UL;
}
}
#include <linux/bootmem.h>
#include <linux/mmzone.h>
#include <linux/ctype.h>
+#include <linux/module.h>
#include <asm/e820.h>
#include <asm/proto.h>
#include <asm/dma.h>
int memnode_shift;
u8 memnodemap[NODEMAPSIZE];
+unsigned char cpu_to_node[NR_CPUS];
+cpumask_t node_to_cpumask[MAXNODE];
+
static int numa_off __initdata;
unsigned long nodes_present;
reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, bootmap_pages<<PAGE_SHIFT);
if (nodeid + 1 > numnodes)
numnodes = nodeid + 1;
- nodes_present |= (1UL << nodeid);
node_set_online(nodeid);
}
start_pfn, NULL);
}
-int fake_node;
+void __init numa_init_array(void)
+{
+ int rr, i;
+ /* There are unfortunately some poorly designed mainboards around
+ that only connect memory to a single CPU. This breaks the 1:1 cpu->node
+ mapping. To avoid this fill in the mapping for all possible
+ CPUs, as the number of CPUs is not known yet.
+ We round robin the existing nodes. */
+ rr = 0;
+ for (i = 0; i < MAXNODE; i++) {
+ if (node_online(i))
+ continue;
+ rr = find_next_bit(node_online_map, MAX_NUMNODES, rr);
+ if (rr == MAX_NUMNODES)
+ rr = find_first_bit(node_online_map, MAX_NUMNODES);
+ node_data[i] = node_data[rr];
+ cpu_to_node[i] = rr;
+ rr++;
+ }
+
+ set_bit(0, &node_to_cpumask[cpu_to_node(0)]);
+}
-int __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
+void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
{
+ int i;
+
#ifdef CONFIG_K8_NUMA
if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT))
- return 0;
+ return;
#endif
printk(KERN_INFO "%s\n",
numa_off ? "NUMA turned off" : "No NUMA configuration found");
start_pfn << PAGE_SHIFT,
end_pfn << PAGE_SHIFT);
/* setup dummy node covering all memory */
- fake_node = 1;
memnode_shift = 63;
memnodemap[0] = 0;
numnodes = 1;
+ for (i = 0; i < NR_CPUS; i++)
+ cpu_to_node[i] = 0;
+ node_to_cpumask[0] = 1;
setup_node_bootmem(0, start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
- return -1;
+}
+
+__init void numa_add_cpu(int cpu)
+{
+ /* BP is initialized elsewhere */
+ if (cpu)
+ set_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
}
unsigned long __init numa_free_all_bootmem(void)
return 1;
}
-
+EXPORT_SYMBOL(cpu_to_node);
+EXPORT_SYMBOL(node_to_cpumask);
+EXPORT_SYMBOL(memnode_shift);
+EXPORT_SYMBOL(memnodemap);
+EXPORT_SYMBOL(node_data);