Revision 3459a625 hw/i386/pc.c
b/hw/i386/pc.c | ||
---|---|---|
989 | 989 |
} |
990 | 990 |
} |
991 | 991 |
|
992 |
typedef struct PcGuestInfoState { |
|
993 |
PcGuestInfo info; |
|
994 |
Notifier machine_done; |
|
995 |
} PcGuestInfoState; |
|
996 |
|
|
997 |
static |
|
998 |
void pc_guest_info_machine_done(Notifier *notifier, void *data) |
|
999 |
{ |
|
1000 |
PcGuestInfoState *guest_info_state = container_of(notifier, |
|
1001 |
PcGuestInfoState, |
|
1002 |
machine_done); |
|
1003 |
} |
|
1004 |
|
|
1005 |
PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, |
|
1006 |
ram_addr_t above_4g_mem_size) |
|
1007 |
{ |
|
1008 |
PcGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state); |
|
1009 |
PcGuestInfo *guest_info = &guest_info_state->info; |
|
1010 |
|
|
1011 |
guest_info->pci_info.w32.end = IO_APIC_DEFAULT_ADDRESS; |
|
1012 |
if (sizeof(hwaddr) == 4) { |
|
1013 |
guest_info->pci_info.w64.begin = 0; |
|
1014 |
guest_info->pci_info.w64.end = 0; |
|
1015 |
} else { |
|
1016 |
/* |
|
1017 |
* BIOS does not set MTRR entries for the 64 bit window, so no need to |
|
1018 |
* align address to power of two. Align address at 1G, this makes sure |
|
1019 |
* it can be exactly covered with a PAT entry even when using huge |
|
1020 |
* pages. |
|
1021 |
*/ |
|
1022 |
guest_info->pci_info.w64.begin = |
|
1023 |
ROUND_UP((0x1ULL << 32) + above_4g_mem_size, 0x1ULL << 30); |
|
1024 |
guest_info->pci_info.w64.end = guest_info->pci_info.w64.begin + |
|
1025 |
(0x1ULL << 62); |
|
1026 |
assert(guest_info->pci_info.w64.begin <= guest_info->pci_info.w64.end); |
|
1027 |
} |
|
1028 |
|
|
1029 |
guest_info_state->machine_done.notify = pc_guest_info_machine_done; |
|
1030 |
qemu_add_machine_init_done_notifier(&guest_info_state->machine_done); |
|
1031 |
return guest_info; |
|
1032 |
} |
|
1033 |
|
|
992 | 1034 |
void pc_acpi_init(const char *default_dsdt) |
993 | 1035 |
{ |
994 | 1036 |
char *filename; |
... | ... | |
1030 | 1072 |
ram_addr_t below_4g_mem_size, |
1031 | 1073 |
ram_addr_t above_4g_mem_size, |
1032 | 1074 |
MemoryRegion *rom_memory, |
1033 |
MemoryRegion **ram_memory) |
|
1075 |
MemoryRegion **ram_memory, |
|
1076 |
PcGuestInfo *guest_info) |
|
1034 | 1077 |
{ |
1035 | 1078 |
int linux_boot, i; |
1036 | 1079 |
MemoryRegion *ram, *option_rom_mr; |
... | ... | |
1082 | 1125 |
for (i = 0; i < nb_option_roms; i++) { |
1083 | 1126 |
rom_add_option(option_rom[i].name, option_rom[i].bootindex); |
1084 | 1127 |
} |
1128 |
guest_info->fw_cfg = fw_cfg; |
|
1085 | 1129 |
return fw_cfg; |
1086 | 1130 |
} |
1087 | 1131 |
|
Also available in: Unified diff