From: Kevin O'Connor Date: Sun, 10 Feb 2013 01:09:22 +0000 (-0500) Subject: Integrate qemu_cfg_preinit() into qemu_romfile_init(). X-Git-Tag: rel-1.7.3~97 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b840ba996d9f90a213335ea18c9d620391b745d6;p=seabios.git Integrate qemu_cfg_preinit() into qemu_romfile_init(). Now that only qemu_romfile_init() uses the fw_cfg interface, it only needs to be detected in that function. Signed-off-by: Kevin O'Connor --- diff --git a/src/paravirt.c b/src/paravirt.c index 9b288ac..aa4a421 100644 --- a/src/paravirt.c +++ b/src/paravirt.c @@ -1,5 +1,6 @@ // Paravirtualization support. // +// Copyright (C) 2013 Kevin O'Connor // Copyright (C) 2009 Red Hat Inc. // // Authors: @@ -89,8 +90,8 @@ qemu_biostable_setup(void) * QEMU firmware config (fw_cfg) interface ****************************************************************/ -int qemu_cfg_present; - +// List of QEMU fw_cfg entries. DO NOT ADD MORE. (All new content +// should be passed via the fw_cfg "file" interface.) #define QEMU_CFG_SIGNATURE 0x00 #define QEMU_CFG_ID 0x01 #define QEMU_CFG_UUID 0x02 @@ -130,26 +131,6 @@ qemu_cfg_read_entry(void *buf, int e, int len) qemu_cfg_read(buf, len); } -void qemu_cfg_preinit(void) -{ - char *sig = "QEMU"; - int i; - - if (!CONFIG_QEMU) - return; - - qemu_cfg_present = 1; - - qemu_cfg_select(QEMU_CFG_SIGNATURE); - - for (i = 0; i < 4; i++) - if (inb(PORT_QEMU_CFG_DATA) != sig[i]) { - qemu_cfg_present = 0; - break; - } - dprintf(4, "qemu_cfg_present=%d\n", qemu_cfg_present); -} - static int qemu_cfg_read_file(struct romfile_s *file, void *dst, u32 maxlen) { @@ -273,11 +254,20 @@ struct QemuCfgFile { char name[56]; }; -void qemu_romfile_init(void) +void qemu_cfg_init(void) { - if (!CONFIG_QEMU || !qemu_cfg_present) + if (!CONFIG_QEMU) return; + // Detect fw_cfg interface. + qemu_cfg_select(QEMU_CFG_SIGNATURE); + char *sig = "QEMU"; + int i; + for (i = 0; i < 4; i++) + if (inb(PORT_QEMU_CFG_DATA) != sig[i]) + return; + dprintf(1, "Found QEMU fw_cfg\n"); + // Populate romfiles for legacy fw_cfg entries qemu_cfg_legacy(); diff --git a/src/paravirt.h b/src/paravirt.h index 1d06e58..4438273 100644 --- a/src/paravirt.h +++ b/src/paravirt.h @@ -25,7 +25,6 @@ static inline int runningOnKVM(void) { void qemu_ramsize_preinit(void); void qemu_biostable_setup(void); -void qemu_cfg_preinit(void); -void qemu_romfile_init(void); +void qemu_cfg_init(void); #endif diff --git a/src/post.c b/src/post.c index c77d2dd..3af3638 100644 --- a/src/post.c +++ b/src/post.c @@ -108,7 +108,7 @@ interface_init(void) malloc_fixupreloc_init(); // Setup romfile items. - qemu_romfile_init(); + qemu_cfg_init(); coreboot_cbfs_init(); // Setup ivt/bda/ebda @@ -314,7 +314,6 @@ void VISIBLE32INIT dopost(void) { // Detect ram and setup internal malloc. - qemu_cfg_preinit(); if (CONFIG_COREBOOT) coreboot_preinit(); else if (runningOnXen())