static bool __init memconsole_find(void) { phys_addr_t physaddr; if (!dmi_check_system(memconsole_dmi_table)) return false; if (coreboot_system) { physaddr = get_address_from_acpi(CBMEM_CONSOLE_ACPI_NAME); if (physaddr && memconsole_coreboot_init(physaddr)) return true; physaddr = check_cbmem(); if (physaddr && memconsole_coreboot_init(physaddr)) return true; } return memconsole_ebda_init(); }
/* * Search through the EBDA for the BIOS Memory Console, and * set the global variables to point to it. Return true if found. */ static bool found_memconsole(void) { unsigned int address; size_t length, cur; /* Is it communicated through CBMEM? */ if (coreboot_system && check_cbmem()) return true; address = get_bios_ebda(); if (!address) { printk(KERN_INFO "BIOS EBDA non-existent.\n"); return false; } /* EBDA length is byte 0 of EBDA (in KB) */ length = *(u8 *)phys_to_virt(address); length <<= 10; /* convert to bytes */ /* * Search through EBDA for BIOS memory console structure * note: signature is not necessarily dword-aligned */ for (cur = 0; cur < length; cur++) { struct biosmemcon_ebda *hdr = phys_to_virt(address + cur); /* memconsole v1 */ if (hdr->signature == BIOS_MEMCONSOLE_V1_MAGIC) { found_v1_header(hdr); return true; } /* memconsole v2 */ if (hdr->signature == BIOS_MEMCONSOLE_V2_MAGIC) { found_v2_header(hdr); return true; } } printk(KERN_INFO "BIOS console EBDA structure not found!\n"); return false; }