qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] option rom patches, next round
@ 2009-12-17 12:32 Gerd Hoffmann
  2009-12-17 12:32 ` [Qemu-devel] [PATCH 1/6] patched seabios binary Gerd Hoffmann
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2009-12-17 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  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;
}

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-12-18  9:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

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).