void qemu_platform_setup(void) { if (!CONFIG_QEMU) return; if (runningOnXen()) { pci_probe_devices(); xen_hypercall_setup(); xen_biostable_setup(); return; } // Initialize pci pci_setup(); smm_device_setup(); smm_setup(); // Initialize mtrr and smp mtrr_setup(); smp_setup(); // Create bios tables pirtable_setup(); mptable_setup(); smbios_setup(); if (CONFIG_FW_ROMFILE_LOAD) { int loader_err; dprintf(3, "load ACPI tables\n"); loader_err = romfile_loader_execute("etc/table-loader"); RsdpAddr = find_acpi_rsdp(); if (RsdpAddr) return; /* If present, loader should have installed an RSDP. * Not installed? We might still be able to continue * using the builtin RSDP. */ if (!loader_err) warn_internalerror(); } acpi_setup(); }
/* Fill in hypercall transfer pages. */ void xen_hypercall_setup(void) { u32 eax, ebx, ecx, edx; xen_extraversion_t extraversion; unsigned long i; if (!runningOnXen()) return; cpuid(xen_cpuid_base + 2, &eax, &ebx, &ecx, &edx); xen_hypercall_page = (unsigned long)memalign_high(PAGE_SIZE, eax*PAGE_SIZE); if (!xen_hypercall_page) panic("unable to allocate Xen hypercall page\n"); dprintf(1, "Allocated Xen hypercall page at %lx\n", xen_hypercall_page); for ( i = 0; i < eax; i++ ) wrmsr(ebx, xen_hypercall_page + (i << 12) + i); /* Print version information. */ cpuid(xen_cpuid_base + 1, &eax, &ebx, &ecx, &edx); hypercall_xen_version(XENVER_extraversion, extraversion); dprintf(1, "Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion); }
void qemu_preinit(void) { qemu_detect(); if (!CONFIG_QEMU) return; if (runningOnXen()) { xen_ramsize_preinit(); return; } if (!runningOnQEMU()) { dprintf(1, "Warning: No QEMU Northbridge found (isapc?)\n"); PlatformRunningOn |= PF_QEMU; kvm_detect(); } // On emulators, get memory size from nvram. u32 rs = ((rtc_read(CMOS_MEM_EXTMEM2_LOW) << 16) | (rtc_read(CMOS_MEM_EXTMEM2_HIGH) << 24)); if (rs) rs += 16 * 1024 * 1024; else rs = (((rtc_read(CMOS_MEM_EXTMEM_LOW) << 10) | (rtc_read(CMOS_MEM_EXTMEM_HIGH) << 18)) + 1 * 1024 * 1024); RamSize = rs; add_e820(0, rs, E820_RAM); /* reserve 256KB BIOS area at the end of 4 GB */ add_e820(0xfffc0000, 256*1024, E820_RESERVED); dprintf(1, "RamSize: 0x%08x [cmos]\n", RamSize); }