Move qemu config port access functions into separate file.
PATCH v2 1/1 Move qemu config port access functions into separate file.
Move qemu config code from smbios.c to its own files. Add support for -boot menu=on|off qemu option.
--
v1->v2:
- move qemu_cfg_show_boot_menu() into interactive_bootmenu()
- don't check for qemu config port if coreboot enabled to prevent problems on real HW.
Makefile +1 -1
@@ -14,7 +14,7 @@ OUT=out/ SRCBOTH=output.c util.c block.c floppy.c ata.c misc.c mouse.c kbd.c pci.c \ serial.c clock.c pic.c cdrom.c ps2port.c smp.c resume.c \ pnpbios.c pirtable.c vgahooks.c pmm.c ramdisk.c \ - usb.c usb-uhci.c usb-hid.c + usb.c usb-uhci.c usb-hid.c pv.c SRC16=$(SRCBOTH) system.c disk.c apm.c pcibios.c font.c SRC32=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \ acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
src/boot.c +2 -1
@@ -12,6 +12,7 @@#include "bregs.h" // struct bregs #include "boot.h" // struct ipl_s #include "cmos.h" // inb_cmos +#include "pv.h" struct ipl_s IPL ;
@@ -206,7 +207,7 @@ menu_show_cbfs(struct ipl_entry_s *ie, int menupos)static void interactive_bootmenu () { -if (!CONFIG_BOOTMENU ) +if (!CONFIG_BOOTMENU || !qemu_cfg_show_boot_menu ())return ;while (get_keystroke (0 ) >=0 )
src/post.c +3 -0
@@ -20,6 +20,7 @@#include "mptable.h" // mptable_init #include "boot.h" // IPL #include "usb.h" // usb_setup +#include "pv.h" void __set_irq (int vector,void *loc)
@@ -184,6 +185,8 @@ post()serial_setup ();mouse_setup (); +qemu_cfg_port_probe (); +init_bios_tables ();boot_setup ();
src/pv.c new file +65 -0
65 lines not on this page · raw message
src/pv.h new file +44 -0
44 lines not on this page · raw message
src/smbios.c +2 -26
@@ -7,33 +7,12 @@#include "util.h" // dprintf #include "biosvar.h" // GET_EBDA - +#include "pv.h" /**************************************************************** * UUID probe ****************************************************************/ -#define QEMU_CFG_SIGNATURE 0x00 -#define QEMU_CFG_ID 0x01 -#define QEMU_CFG_UUID 0x02 - -static void -qemu_cfg_read (u8 *buf,u16 f,int len) -{ -outw (f,PORT_QEMU_CFG_CTL ); -while (len--) - *(buf++) =inb (PORT_QEMU_CFG_DATA ); -} - -static int -qemu_cfg_port_probe () -{ -u8 sig[4 ] ="QEMU" ; -u8 buf[4 ]; -qemu_cfg_read (buf,QEMU_CFG_SIGNATURE ,4 ); -return *(u32 *)buf == *(u32 *)sig; -} -static void uuid_probe (u8 *bios_uuid) {
@@ -44,11 +23,8 @@ uuid_probe(u8 *bios_uuid)return ;if (CONFIG_COREBOOT )return ; -if (!qemu_cfg_port_probe ()) -// Feature not available -return ; -qemu_cfg_read (bios_uuid,QEMU_CFG_UUID ,16 ); +qemu_cfg_get_uuid (bios_uuid); }
--
Gleb.
Quoted 3 lines · Gleb Natapov
Move qemu config code from
smbios.cto its own files. Add support for -boot menu=on|off qemu option.
Thanks Gleb.
Please rename the "pv" files - at a minimum to "paravirt", although I think "qemucfg" or "emucfg" is more appropriate.
The other thing is new ".c" files need a one line description and a copyright at the top. If you don't care about the copyright then just reuse Fabrice's from smbios.c.
If you wish, I can make these changes.
-Kevin
Quoted 10 lines · Kevin O'Connor
Quoted 3 lines · Gleb Natapov
Move qemu config code from
smbios.cto its own files. Add support for -boot menu=on|off qemu option.Thanks Gleb.
Please rename the "pv" files - at a minimum to "paravirt", although I think "qemucfg" or "emucfg" is more appropriate.
I want to put things like kvm_para_available() there too. qemucfg naming suggest that this is only qemu fw_cfg driver, but I want it to be more. I'll rename it to paravirt.[ch]
Quoted 6 lines
The other thing is new ".c" files need a one line description and a copyright at the top. If you don't care about the copyright then just reuse Fabrice's from
smbios.c.If you wish, I can make these changes.
I'll resend.
--
Gleb.