static __init void bad_srat(void) { int i; printk(KERN_ERR "SRAT: SRAT not used.\n"); acpi_numa = -1; found_add_area = 0; for (i = 0; i < MAX_LOCAL_APIC; i++) apicid_to_node[i] = NUMA_NO_NODE; for (i = 0; i < MAX_NUMNODES; i++) nodes_add[i].start = nodes[i].end = 0; remove_all_active_ranges(); }
int __init get_memcfg_from_srat(void) { struct acpi_table_header *header = NULL; struct acpi_table_rsdp *rsdp = NULL; struct acpi_table_rsdt *rsdt = NULL; acpi_native_uint rsdp_address = 0; struct acpi_static_rsdt saved_rsdt; int tables = 0; int i = 0; rsdp_address = acpi_find_rsdp(); if (!rsdp_address) { printk("%s: System description tables not found\n", __FUNCTION__); goto out_err; } printk("%s: assigning address to rsdp\n", __FUNCTION__); rsdp = (struct acpi_table_rsdp *)(u32)rsdp_address; if (!rsdp) { printk("%s: Didn't find ACPI root!\n", __FUNCTION__); goto out_err; } printk(KERN_INFO "%.8s v%d [%.6s]\n", rsdp->signature, rsdp->revision, rsdp->oem_id); if (strncmp(rsdp->signature, ACPI_SIG_RSDP,strlen(ACPI_SIG_RSDP))) { printk(KERN_WARNING "%s: RSDP table signature incorrect\n", __FUNCTION__); goto out_err; } rsdt = (struct acpi_table_rsdt *) boot_ioremap(rsdp->rsdt_physical_address, sizeof(struct acpi_table_rsdt)); if (!rsdt) { printk(KERN_WARNING "%s: ACPI: Invalid root system description tables (RSDT)\n", __FUNCTION__); goto out_err; } header = &rsdt->header; if (strncmp(header->signature, ACPI_SIG_RSDT, strlen(ACPI_SIG_RSDT))) { printk(KERN_WARNING "ACPI: RSDT signature incorrect\n"); goto out_err; } /* * The number of tables is computed by taking the * size of all entries (header size minus total * size of RSDT) divided by the size of each entry * (4-byte table pointers). */ tables = (header->length - sizeof(struct acpi_table_header)) / 4; if (!tables) goto out_err; memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt)); if (saved_rsdt.table.header.length > sizeof(saved_rsdt)) { printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n", saved_rsdt.table.header.length); goto out_err; } printk("Begin SRAT table scan....\n"); for (i = 0; i < tables; i++) { /* Map in header, then map in full table length. */ header = (struct acpi_table_header *) boot_ioremap(saved_rsdt.table.table_offset_entry[i], sizeof(struct acpi_table_header)); if (!header) break; header = (struct acpi_table_header *) boot_ioremap(saved_rsdt.table.table_offset_entry[i], header->length); if (!header) break; if (strncmp((char *) &header->signature, ACPI_SIG_SRAT, 4)) continue; /* we've found the srat table. don't need to look at any more tables */ return acpi20_parse_srat((struct acpi_table_srat *)header); } out_err: remove_all_active_ranges(); printk("failed to get NUMA memory information from SRAT table\n"); return 0; }