From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NLFXO-0006Sb-Cl for qemu-devel@nongnu.org; Thu, 17 Dec 2009 07:32:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NLFXK-0006Rk-Q3 for qemu-devel@nongnu.org; Thu, 17 Dec 2009 07:32:58 -0500 Received: from [199.232.76.173] (port=37122 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NLFXK-0006Rh-Jh for qemu-devel@nongnu.org; Thu, 17 Dec 2009 07:32:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55545) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NLFXK-0008EK-7Z for qemu-devel@nongnu.org; Thu, 17 Dec 2009 07:32:54 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBHCWqTg016156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 17 Dec 2009 07:32:52 -0500 From: Gerd Hoffmann Date: Thu, 17 Dec 2009 13:32:42 +0100 Message-Id: <1261053168-8079-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 0/6] option rom patches, next round List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 #include #include #include #include #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; }