Commit bf483392e6806225a7a7e03c57bad35530522cb9

Authored by Alexander Graf
Committed by Anthony Liguori
1 parent 1d108d97

Expose fw_cfg v2

Multiboot passes options to the option rom using the fw_cfg device.
Right now, that device is local to the bochs_bios_init function.

Let's change that and expose it, so everyone may put data in there.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 6 additions and 2 deletions
@@ -448,7 +448,7 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) @@ -448,7 +448,7 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)
448 448
449 extern uint64_t node_cpumask[MAX_NODES]; 449 extern uint64_t node_cpumask[MAX_NODES];
450 450
451 -static void bochs_bios_init(void) 451 +static void *bochs_bios_init(void)
452 { 452 {
453 void *fw_cfg; 453 void *fw_cfg;
454 uint8_t *smbios_table; 454 uint8_t *smbios_table;
@@ -468,6 +468,7 @@ static void bochs_bios_init(void) @@ -468,6 +468,7 @@ static void bochs_bios_init(void)
468 register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL); 468 register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL);
469 469
470 fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); 470 fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
  471 +
471 fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); 472 fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
472 fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); 473 fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
473 fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, 474 fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,
@@ -497,6 +498,8 @@ static void bochs_bios_init(void) @@ -497,6 +498,8 @@ static void bochs_bios_init(void)
497 } 498 }
498 fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, 499 fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg,
499 (1 + smp_cpus + nb_numa_nodes) * 8); 500 (1 + smp_cpus + nb_numa_nodes) * 8);
  501 +
  502 + return fw_cfg;
500 } 503 }
501 504
502 /* Generate an initial boot sector which sets state and jump to 505 /* Generate an initial boot sector which sets state and jump to
@@ -851,6 +854,7 @@ static void pc_init1(ram_addr_t ram_size, @@ -851,6 +854,7 @@ static void pc_init1(ram_addr_t ram_size,
851 BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; 854 BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
852 BlockDriverState *fd[MAX_FD]; 855 BlockDriverState *fd[MAX_FD];
853 int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; 856 int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
  857 + void *fw_cfg;
854 858
855 if (ram_size >= 0xe0000000 ) { 859 if (ram_size >= 0xe0000000 ) {
856 above_4g_mem_size = ram_size - 0xe0000000; 860 above_4g_mem_size = ram_size - 0xe0000000;
@@ -971,7 +975,7 @@ static void pc_init1(ram_addr_t ram_size, @@ -971,7 +975,7 @@ static void pc_init1(ram_addr_t ram_size,
971 cpu_register_physical_memory((uint32_t)(-bios_size), 975 cpu_register_physical_memory((uint32_t)(-bios_size),
972 bios_size, bios_offset | IO_MEM_ROM); 976 bios_size, bios_offset | IO_MEM_ROM);
973 977
974 - bochs_bios_init(); 978 + fw_cfg = bochs_bios_init();
975 979
976 if (linux_boot) { 980 if (linux_boot) {
977 load_linux(0xc0000 + oprom_area_size, 981 load_linux(0xc0000 + oprom_area_size,