Skip to content

option rom patches, next round

Gerd Hoffmann qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6patched seabios binarypc-bios/bios.bin+0 -00 replies
2/6Support PCI based option rom loadinghw/cirrus_vga.c hw/e1000.c hw/pci.c +3 more+44 -40 replies
3/6pci romfiles: add property, add default to PCIDeviceInfohw/cirrus_vga.c hw/e1000.c hw/pci.c +3 more+29 -321 reply
4/6fw_cfg: make calls typesafehw/fw_cfg.c hw/fw_cfg.h+21 -210 replies
5/6fw_cfg: add API for file transfer.hw/fw_cfg.c hw/fw_cfg.h+62 -20 replies
6/6roms: use fw_cfg file.hw/loader.c hw/loader.h hw/pc.c+27 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/6] option rom patches, next round

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