From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 0/6] option rom patches, next round
Date: Thu, 17 Dec 2009 13:32:42 +0100 [thread overview]
Message-ID: <1261053168-8079-1-git-send-email-kraxel@redhat.com> (raw)
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).
cheers,
Gerd
----- [ cut here ] -----
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <sys/io.h>
#include <arpa/inet.h>
#define FW_CFG_FILE_DIR 0x19
typedef struct FWCfgFile {
uint32_t size; /* file size */
uint16_t select; /* write this to 0x510 to read it */
uint16_t reserved;
char name[56];
} FWCfgFile;
void fw_read(void *ptr, int len)
{
uint8_t *data = ptr;
int i;
for (i = 0; i < len; i++) {
data[i] = inb(0x511);
}
}
int main(int argc, char *argv[])
{
uint8_t data[64];
FWCfgFile *entry;
uint32_t e, i, count;
fprintf(stderr, "fwtest - qemu files\n");
ioperm(0x510, 4, 1);
outw(FW_CFG_FILE_DIR, 0x510);
fw_read(&count, sizeof(count));
fprintf(stderr, "%d files\n", ntohl(count));
entry = malloc(sizeof(*entry) * ntohl(count));
fw_read(entry, sizeof(*entry) * ntohl(count));
for (e = 0; e < ntohl(count); e++) {
fprintf(stderr, " #%d: %s (%d bytes)\n", e,
entry[e].name, ntohl(entry[e].size));
outw(ntohs(entry[e].select), 0x510);
fw_read(data, sizeof(data));
for (i = 0; i < sizeof(data); i++) {
if (i % 16 == 0)
fprintf(stderr, " ");
if (i % 4 == 0)
fprintf(stderr, " ");
fprintf(stderr, " %02x", data[i]);
if (i % 16 == 15)
fprintf(stderr, "\n");
}
}
return 0;
}
next reply other threads:[~2009-12-17 12:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-17 12:32 Gerd Hoffmann [this message]
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 ` [Qemu-devel] Re: [PATCH 0/6] option rom patches, next round Gerd Hoffmann
2009-12-17 20:22 ` 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=1261053168-8079-1-git-send-email-kraxel@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).