[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 0/6] option rom patches, next round
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 0/6] option rom patches, next round |
Date: |
Thu, 17 Dec 2009 13:32:42 +0100 |
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;
}
- [Qemu-devel] [PATCH 0/6] option rom patches, next round,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 4/6] fw_cfg: make calls typesafe, Gerd Hoffmann, 2009/12/17
- [Qemu-devel] [PATCH 3/6] pci romfiles: add property, add default to PCIDeviceInfo, Gerd Hoffmann, 2009/12/17
- [Qemu-devel] [PATCH 2/6] Support PCI based option rom loading, Gerd Hoffmann, 2009/12/17
- [Qemu-devel] [PATCH 6/6] roms: use fw_cfg file., Gerd Hoffmann, 2009/12/17
- [Qemu-devel] [PATCH 5/6] fw_cfg: add API for file transfer., Gerd Hoffmann, 2009/12/17
- [Qemu-devel] [PATCH 1/6] patched seabios binary, Gerd Hoffmann, 2009/12/17
- [Qemu-devel] Re: [PATCH 0/6] option rom patches, next round, Gerd Hoffmann, 2009/12/17