From: Gerd Hoffmann <kraxel@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 0/6] option rom patches, next round
Date: Thu, 17 Dec 2009 15:46:19 +0100 [thread overview]
Message-ID: <4B2A443B.6090407@redhat.com> (raw)
In-Reply-To: <1261053168-8079-1-git-send-email-kraxel@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On 12/17/09 13:32, Gerd Hoffmann wrote:
> Hi,
>
> All in one patch series for pci rom bar support and option rom loading
> via fw_cfg for the non-pci roms. This time the fw_cfg interface is
> actually tested with a little linux userspace app (attached below).
Now some seabios bits.
I got the naming of *both* vga and optionrom directories wrong, so there
is first an incremental fix for this patch series.
Also attached are two seabios patches (go on top of the two ones from
anthony) which implement the seabios side of the file interface.
'-kernel' and '-vga std' are working again ;)
cheers,
Gerd
[-- Attachment #2: 0001-loader-fix-dirname-tyops.patch --]
[-- Type: text/plain, Size: 1005 bytes --]
>From 517fd48fdddfe93b5ef4081c11e87b250892cd49 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 17 Dec 2009 15:32:03 +0100
Subject: [PATCH] loader: fix dirname tyops
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/loader.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index 451ee54..ccc0ccc 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -628,7 +628,7 @@ int rom_add_vga(const char *file)
{
if (!rom_enable_driver_roms)
return 0;
- return rom_add_file(file, "vgabios", file,
+ return rom_add_file(file, "vgaroms", file,
PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN);
}
@@ -636,7 +636,7 @@ int rom_add_option(const char *file)
{
if (!rom_enable_driver_roms)
return 0;
- return rom_add_file(file, "genrom", file,
+ return rom_add_file(file, "genroms", file,
PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN);
}
--
1.6.5.2
[-- Attachment #3: 0001-move-htonl-friends-to-util.h.patch --]
[-- Type: text/plain, Size: 1412 bytes --]
>From 9ec26264036ae620cccc9e69cfc75b1284a7f06b Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 17 Dec 2009 15:33:21 +0100
Subject: [PATCH 1/2] move htonl() + friends to util.h
---
src/coreboot.c | 5 -----
src/util.h | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/coreboot.c b/src/coreboot.c
index 7fa18e4..3dc6a7f 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -351,11 +351,6 @@ ulzma(u8 *dst, u32 maxlen, const u8 *src, u32 srclen)
* Coreboot flash format
****************************************************************/
-// XXX - optimize
-#define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \
- (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24))
-#define htonl(x) ntohl(x)
-
#define CBFS_HEADER_MAGIC 0x4F524243
#define CBFS_HEADPTR_ADDR 0xFFFFFFFc
#define CBFS_VERSION1 0x31313131
diff --git a/src/util.h b/src/util.h
index 1eafce0..24e39d1 100644
--- a/src/util.h
+++ b/src/util.h
@@ -367,4 +367,11 @@ extern u8 BiosChecksum;
// version (auto generated file out/version.c)
extern const char VERSION[];
+// XXX - optimize
+#define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \
+ (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24))
+#define htonl(x) ntohl(x)
+#define ntohs(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
+#define htons(x) ntohs(x)
+
#endif // util.h
--
1.6.5.2
[-- Attachment #4: 0002-qemu-add-rom-loading-via-fw_cfg.patch --]
[-- Type: text/plain, Size: 4004 bytes --]
>From 02e660e21d6db37d3ba6033215d2ddae6a8e1eb2 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 17 Dec 2009 15:34:02 +0100
Subject: [PATCH 2/2] qemu: add rom loading via fw_cfg
---
src/optionroms.c | 22 ++++++++++++++++++++++
src/paravirt.c | 37 +++++++++++++++++++++++++++++++++++++
src/paravirt.h | 11 +++++++++++
3 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/src/optionroms.c b/src/optionroms.c
index 27465ad..c5de1ad 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -247,6 +247,26 @@ run_cbfs_roms(const char *prefix, int isvga)
}
}
+static void
+run_qemu_roms(const char *prefix, int isvga)
+{
+ struct QemuCfgFile entry;
+ int plen = strlen(prefix);
+ int rc, dlen;
+
+ rc = qemu_cfg_first_file(&entry);
+ while (rc > 0) {
+ if (memcmp(prefix, entry.name, plen) == 0) {
+ dlen = qemu_cfg_read_file(&entry, (void*)RomEnd, max_rom() - RomEnd);
+ if (dlen > 0) {
+ dprintf(1, "init qemu rom: %s\n", entry.name);
+ init_optionrom((void*)RomEnd, 0, isvga);
+ }
+ }
+ rc = qemu_cfg_next_file(&entry);
+ }
+}
+
/****************************************************************
* PCI roms
@@ -375,6 +395,7 @@ optionrom_setup()
// Find and deploy CBFS roms not associated with a device.
run_cbfs_roms("genroms/", 0);
+ run_qemu_roms("genroms/", 0);
}
// All option roms found and deployed - now build BEV/BCV vectors.
@@ -434,6 +455,7 @@ vga_setup()
// Find and deploy CBFS vga-style roms not associated with a device.
run_cbfs_roms("vgaroms/", 1);
+ run_qemu_roms("vgaroms/", 1);
}
if (RomEnd == BUILD_ROM_START) {
diff --git a/src/paravirt.c b/src/paravirt.c
index 6f48d2e..7171bac 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -8,6 +8,7 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "config.h" // CONFIG_COREBOOT
+#include "util.h" // ntoh[ls]
#include "ioport.h" // outw
#include "paravirt.h" // qemu_cfg_port_probe
#include "smbios.h" // struct smbios_structure_header
@@ -287,3 +288,39 @@ u16 qemu_cfg_get_max_cpus(void)
return cnt;
}
+
+u16 qemu_cfg_first_file(QemuCfgFile *entry)
+{
+ memset(entry, 0, sizeof(*entry));
+ return qemu_cfg_next_file(entry);
+}
+
+u16 qemu_cfg_next_file(QemuCfgFile *entry)
+{
+ u16 last = ntohs(entry->select);
+ u32 e,count;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&count, QEMU_CFG_FILE_DIR, sizeof(count));
+ for (e = 0; e < ntohl(count); e++) {
+ qemu_cfg_read((void*)entry, sizeof(*entry));
+ if (ntohs(entry->select) > last) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+u32 qemu_cfg_read_file(QemuCfgFile *entry, void *dst, u32 maxlen)
+{
+ int len = ntohl(entry->size);
+
+ if (!qemu_cfg_present)
+ return 0;
+ if (len > maxlen)
+ return 0;
+ qemu_cfg_read_entry(dst, ntohs(entry->select), len);
+ return len;
+}
diff --git a/src/paravirt.h b/src/paravirt.h
index 29a2c04..d33e10d 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -31,6 +31,7 @@ static inline int kvm_para_available(void)
#define QEMU_CFG_NUMA 0x0d
#define QEMU_CFG_BOOT_MENU 0x0e
#define QEMU_CFG_MAX_CPUS 0x0f
+#define QEMU_CFG_FILE_DIR 0x19
#define QEMU_CFG_ARCH_LOCAL 0x8000
#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
@@ -53,4 +54,14 @@ int qemu_cfg_get_numa_nodes(void);
void qemu_cfg_get_numa_data(u64 *data, int n);
u16 qemu_cfg_get_max_cpus(void);
+typedef struct QemuCfgFile {
+ u32 size; /* file size */
+ u16 select; /* write this to 0x510 to read it */
+ u16 reserved;
+ char name[56];
+} QemuCfgFile;
+
+u16 qemu_cfg_first_file(QemuCfgFile *entry);
+u16 qemu_cfg_next_file(QemuCfgFile *entry);
+
#endif
--
1.6.5.2
next prev parent reply other threads:[~2009-12-17 14:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-17 12:32 [Qemu-devel] [PATCH 0/6] option rom patches, next round Gerd Hoffmann
2009-12-17 12:32 ` [Qemu-devel] [PATCH 1/6] patched seabios binary Gerd Hoffmann
2009-12-17 12:32 ` [Qemu-devel] [PATCH 2/6] Support PCI based option rom loading Gerd Hoffmann
2009-12-17 12:32 ` [Qemu-devel] [PATCH 3/6] pci romfiles: add property, add default to PCIDeviceInfo Gerd Hoffmann
2009-12-17 20:18 ` Anthony Liguori
2009-12-17 12:32 ` [Qemu-devel] [PATCH 4/6] fw_cfg: make calls typesafe Gerd Hoffmann
2009-12-17 12:32 ` [Qemu-devel] [PATCH 5/6] fw_cfg: add API for file transfer Gerd Hoffmann
2009-12-17 12:32 ` [Qemu-devel] [PATCH 6/6] roms: use fw_cfg file Gerd Hoffmann
2009-12-17 14:46 ` Gerd Hoffmann [this message]
2009-12-17 20:22 ` [Qemu-devel] Re: [PATCH 0/6] option rom patches, next round Anthony Liguori
2009-12-18 9:30 ` Gerd Hoffmann
2009-12-17 15:34 ` [Qemu-devel] " Anthony Liguori
2009-12-17 15:46 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B2A443B.6090407@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).