diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:48:57 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:48:57 +0000 |
commit | 9508a382f8a9f241dab097d921b6d290c1c3a776 (patch) | |
tree | fa456480bae7040c3f971a70b390f2d091c680b5 /hw/xfree86/int10/pci.c | |
parent | ded6147bfb5d75ff1e67c858040a628b61bc17d1 (diff) |
Initial revision
Diffstat (limited to 'hw/xfree86/int10/pci.c')
-rw-r--r-- | hw/xfree86/int10/pci.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/hw/xfree86/int10/pci.c b/hw/xfree86/int10/pci.c new file mode 100644 index 000000000..debd842e7 --- /dev/null +++ b/hw/xfree86/int10/pci.c @@ -0,0 +1,51 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.12 2002/04/04 14:05:51 eich Exp $ */ + +/* + * XFree86 int10 module + * execute BIOS int 10h calls in x86 real mode environment + * Copyright 1999 Egbert Eich + */ +#include "xf86Pci.h" +#include "xf86.h" +#include "xf86_ansic.h" +#define _INT10_PRIVATE +#include "xf86int10.h" + +int +mapPciRom(int pciEntity, unsigned char * address) +{ + PCITAG tag; + unsigned char *mem, *ptr; + int length; + + pciVideoPtr pvp = xf86GetPciInfoForEntity(pciEntity); + + if (pvp == NULL) { +#ifdef DEBUG + ErrorF("mapPciRom: no PCI info\n"); +#endif + return 0; + } + + tag = pciTag(pvp->bus,pvp->device,pvp->func); + length = 1 << pvp->biosSize; + + /* Read in entire PCI ROM */ + mem = ptr = xnfcalloc(length, 1); + length = xf86ReadPciBIOS(0, tag, -1, ptr, length); + if (length > 0) + memcpy(address, ptr, length); + /* unmap/close/disable PCI bios mem */ + xfree(mem); + +#ifdef DEBUG + if (!length) + ErrorF("mapPciRom: no BIOS found\n"); +#ifdef PRINT_PCI + else + dprint(address,0x20); +#endif +#endif + + return length; +} |