diff options
author | Adam Jackson <ajax@redhat.com> | 2011-05-10 18:04:10 -0400 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2011-09-22 13:52:45 -0400 |
commit | f94bd47e95d4a90fd6eb0cf1279f06f905ff931d (patch) | |
tree | 3e294ed0ecf5f94d7a4459b064e3570fd4b7bd8e | |
parent | 8f2f08455d3b013b27c55d1f3b8fc8b3dc38f686 (diff) |
int10: Use pciaccess rom fetch for !PC machines
... instead of rolling our own, badly.
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xfree86/int10/generic.c | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index beb90b580..040d999b2 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -62,62 +62,6 @@ static void UnmapVRam(xf86Int10InfoPtr pInt); static void *sysMem = NULL; -/** - * Read legacy VGA video BIOS associated with specified domain. - * - * Attempts to read up to 128KiB of legacy VGA video BIOS. - * - * \return - * The number of bytes read on success or -1 on failure. - * - * \bug - * PCI ROMs can contain multiple BIOS images (e.g., OpenFirmware, x86 VGA, - * etc.). How do we know that \c pci_device_read_rom will return the - * legacy VGA BIOS image? - */ -#ifndef _PC -static int -read_legacy_video_BIOS(struct pci_device *dev, unsigned char *Buf) -{ - const ADDRESS Base = 0xC0000; - const int Len = 0x10000 * 2; - const int pagemask = getpagesize() - 1; - const ADDRESS offset = Base & ~pagemask; - const unsigned long size = ((Base + Len + pagemask) & ~pagemask) - offset; - unsigned char *ptr, *src; - int len; - - - /* Try to use the civilized PCI interface first. - */ - if (pci_device_read_rom(dev, Buf) == 0) { - return dev->rom_size; - } - - ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, dev, offset, size); - - if (!ptr) - return -1; - - /* Using memcpy() here can hang the system */ - src = ptr + (Base - offset); - for (len = 0; len < (Len / 2); len++) { - Buf[len] = src[len]; - } - - if ((Buf[0] == 0x55) && (Buf[1] == 0xAA) && (Buf[2] > 0x80)) { - for ( /* empty */ ; len < Len; len++) { - Buf[len] = src[len]; - } - } - - xf86UnMapVidMem(-1, ptr, size); - - return Len; -} -#endif /* _PC */ - - xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags) { @@ -232,7 +176,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) */ vbiosMem = (char *)base + V_BIOS; memset(vbiosMem, 0, 2 * V_BIOS_SIZE); - if (read_legacy_video_BIOS(pInt->dev, vbiosMem) < V_BIOS_SIZE) { + if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) { xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x0C0000.\n"); } |