Make the various implementations of xf86ExtendedInitInt10 use the
libpciaccess interfaces. This eliminates all calls to mapPciRom, which in turn allows the elimination of hw/xfree86/int10/pci.c.
This commit is contained in:
parent
07ad92d2c4
commit
e18d34f423
@ -46,11 +46,19 @@
|
||||
|
||||
#include <pciaccess.h>
|
||||
|
||||
/*
|
||||
* memType is of the size of the addressable memory (machine size)
|
||||
* usually unsigned long.
|
||||
/**
|
||||
* Integer type that is of the size of the addressable memory (machine size).
|
||||
* On most platforms \c uintptr_t will suffice. However, on some mixed
|
||||
* 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
|
||||
* must be 64-bits.
|
||||
*/
|
||||
typedef unsigned long memType;
|
||||
#include <inttypes.h>
|
||||
#if defined(__powerpc__)
|
||||
typedef uint64_t memType;
|
||||
#else
|
||||
typedef uintptr_t memType;
|
||||
#endif
|
||||
|
||||
|
||||
/* Video mode flags */
|
||||
|
||||
|
@ -9,7 +9,6 @@ libint10_la_LDFLAGS = -avoid-version
|
||||
COMMON_SOURCES = \
|
||||
helper_exec.c \
|
||||
helper_mem.c \
|
||||
pci.c \
|
||||
xf86int10.c \
|
||||
xf86int10module.c
|
||||
|
||||
|
@ -57,8 +57,8 @@ int10MemRec genericMem = {
|
||||
static void MapVRam(xf86Int10InfoPtr pInt);
|
||||
static void UnmapVRam(xf86Int10InfoPtr pInt);
|
||||
#ifdef _PC
|
||||
#define GET_HIGH_BASE(x) (((V_BIOS + size + getpagesize() - 1)/getpagesize()) \
|
||||
* getpagesize())
|
||||
#define GET_HIGH_BASE(x) (((V_BIOS + (x) + getpagesize() - 1)/getpagesize()) \
|
||||
* getpagesize())
|
||||
#endif
|
||||
|
||||
static void *sysMem = NULL;
|
||||
@ -165,18 +165,22 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
|
||||
|
||||
switch (location_type) {
|
||||
case BUS_PCI: {
|
||||
const int pci_entity = (bios.bus == BUS_PCI)
|
||||
? xf86GetPciEntity(bios.location.pci.bus,
|
||||
bios.location.pci.dev,
|
||||
bios.location.pci.func)
|
||||
: pInt->entityIndex;
|
||||
int err;
|
||||
struct pci_device *rom_device = (bios.bus == BUS_PCI)
|
||||
? pci_device_find_by_slot(PCI_DOM_FROM_BUS(bios.location.pci.bus),
|
||||
PCI_BUS_NO_DOM(bios.location.pci.bus),
|
||||
bios.location.pci.dev,
|
||||
bios.location.pci.func)
|
||||
: xf86GetPciInfoForEntity(pInt->entityIndex);
|
||||
|
||||
vbiosMem = (unsigned char *)base + bios_location;
|
||||
if (!(size = mapPciRom(pci_entity,(unsigned char *)(vbiosMem)))) {
|
||||
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n");
|
||||
err = pci_device_read_rom(rom_device, vbiosMem);
|
||||
if (err) {
|
||||
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3) %s\n",
|
||||
strerror(err));
|
||||
goto error1;
|
||||
}
|
||||
INTPriv(pInt)->highMemory = GET_HIGH_BASE(size);
|
||||
INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
|
||||
break;
|
||||
}
|
||||
case BUS_ISA:
|
||||
@ -262,24 +266,21 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
|
||||
"No legacy BIOS found -- trying PCI\n");
|
||||
}
|
||||
if (!done) {
|
||||
int pci_entity;
|
||||
|
||||
if (bios.bus == BUS_PCI) {
|
||||
xf86DrvMsg(screen,X_CONFIG,"Looking for BIOS at PCI:%i%i%i\n",
|
||||
bios.location.pci.bus,bios.location.pci.dev,
|
||||
bios.location.pci.func);
|
||||
pci_entity = xf86GetPciEntity(bios.location.pci.bus,
|
||||
bios.location.pci.dev,
|
||||
bios.location.pci.func);
|
||||
} else
|
||||
pci_entity = pInt->entityIndex;
|
||||
int err;
|
||||
struct pci_device *rom_device = (bios.bus == BUS_PCI)
|
||||
? pci_device_find_by_slot(PCI_DOM_FROM_BUS(bios.location.pci.bus),
|
||||
PCI_BUS_NO_DOM(bios.location.pci.bus),
|
||||
bios.location.pci.dev,
|
||||
bios.location.pci.func)
|
||||
: xf86GetPciInfoForEntity(pInt->entityIndex);
|
||||
|
||||
if (!mapPciRom(pci_entity, vbiosMem)) {
|
||||
xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5)\n");
|
||||
goto error1;
|
||||
err = pci_device_read_rom(rom_device, vbiosMem);
|
||||
if (err) {
|
||||
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3) %s\n",
|
||||
strerror(err));
|
||||
goto error1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pInt->BIOSseg = V_BIOS >> 4;
|
||||
|
@ -1,45 +0,0 @@
|
||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.11 2001/10/01 13:44:13 eich Exp $ */
|
||||
|
||||
/*
|
||||
* XFree86 int10 module
|
||||
* execute BIOS int 10h calls in x86 real mode environment
|
||||
* Copyright 1999 Egbert Eich
|
||||
*/
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "xf86Pci.h"
|
||||
#include "xf86.h"
|
||||
#define _INT10_PRIVATE
|
||||
#include "xf86int10.h"
|
||||
|
||||
int
|
||||
mapPciRom(int pciEntity, unsigned char * address)
|
||||
{
|
||||
struct pci_device * pvp = xf86GetPciInfoForEntity(pciEntity);
|
||||
int err;
|
||||
|
||||
if (pvp == NULL) {
|
||||
#ifdef DEBUG
|
||||
ErrorF("mapPciRom: no PCI info\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read in entire PCI ROM */
|
||||
err = pci_device_read_rom( pvp, address );
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( err != 0 )
|
||||
ErrorF("mapPciRom: no BIOS found\n");
|
||||
#ifdef PRINT_PCI
|
||||
else
|
||||
dprint(address,0x20);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return pvp->rom_size;
|
||||
}
|
@ -196,8 +196,5 @@ Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
|
||||
void dprint(unsigned long start, unsigned long size);
|
||||
#endif
|
||||
|
||||
/* pci.c */
|
||||
int mapPciRom(int pciEntity, unsigned char *address);
|
||||
|
||||
#endif /* _INT10_PRIVATE */
|
||||
#endif /* _XF86INT10_H */
|
||||
|
@ -279,16 +279,21 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
|
||||
|
||||
switch (location_type) {
|
||||
case BUS_PCI: {
|
||||
const int pci_entity = (bios.bus == BUS_PCI)
|
||||
? xf86GetPciEntity(bios.location.pci.bus,
|
||||
bios.location.pci.dev,
|
||||
bios.location.pci.func)
|
||||
: pInt->entityIndex;
|
||||
|
||||
if (!mapPciRom(pci_entity, (unsigned char *)(V_BIOS))) {
|
||||
xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n");
|
||||
int err;
|
||||
struct pci_device *rom_device = (bios.bus == BUS_PCI)
|
||||
? pci_device_find_by_slot(PCI_DOM_FROM_BUS(bios.location.pci.bus),
|
||||
PCI_BUS_NO_DOM(bios.location.pci.bus),
|
||||
bios.location.pci.dev,
|
||||
bios.location.pci.func)
|
||||
: xf86GetPciInfoForEntity(pInt->entityIndex);
|
||||
|
||||
err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
|
||||
if (err) {
|
||||
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",
|
||||
strerror(err));
|
||||
goto error3;
|
||||
}
|
||||
|
||||
pInt->BIOSseg = V_BIOS >> 4;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user