Remove all trace of Option "BiosLocation".

This code was deeply dangerous.  If anyone actually had a use for this code,
we should find a better way of doing it.
This commit is contained in:
Adam Jackson 2007-07-27 13:23:15 -04:00
parent 486fd4145a
commit f62beb6f36
5 changed files with 31 additions and 204 deletions

View File

@ -1601,13 +1601,6 @@ Note that disabling an operation will have no effect if the operation is
not accelerated (whether due to lack of support in the hardware or in the
driver).
.TP 7
.BI "Option \*qBiosLocation\*q \*q" address \*q
Set the location of the BIOS for the Int10 module. One may select a BIOS
of another card for posting or the legacy V_BIOS range located at 0xc0000
or an alternative address (BUS_ISA).
This is only useful under very special circumstances and should be used with
extreme care.
.TP 7
.BI "Option \*qInitPrimary\*q \*q" boolean \*q
Use the Int10 module to initialize the primary graphics card.
Normally, only secondary cards are soft-booted using the Int10 module, as the

View File

@ -71,8 +71,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
pciVideoPtr pvp;
int screen;
legacyVGARec vga;
xf86int10BiosLocation bios;
#ifdef _PC
int size;
CARD32 cs;
@ -131,14 +130,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
#endif
INTPriv(pInt)->highMemory = V_BIOS;
xf86int10ParseBiosLocation(options,&bios);
if (xf86IsEntityPrimary(entityIndex)
&& !(initPrimary(options))) {
if (! xf86int10GetBiosSegment(pInt, &bios,
(unsigned char *)sysMem - V_BIOS)) {
if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
if (!xf86int10GetBiosSegment(pInt, (unsigned char *)sysMem - V_BIOS))
goto error1;
}
set_return_trap(pInt);
@ -148,8 +142,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
} else {
const BusType location_type = xf86int10GetBiosLocationType(pInt,
&bios);
const BusType location_type = xf86int10GetBiosLocationType(pInt);
int bios_location = V_BIOS;
reset_int_vect(pInt);
@ -157,11 +150,7 @@ 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;
const int pci_entity = pInt->entityIndex;
vbiosMem = (unsigned char *)base + bios_location;
if (!(size = mapPciRom(pci_entity,(unsigned char *)(vbiosMem)))) {
@ -172,9 +161,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
break;
}
case BUS_ISA:
if (bios.bus == BUS_ISA) {
bios_location = bios.location.legacy;
}
vbiosMem = (unsigned char *)sysMem + bios_location;
#if 0
(void)memset(vbiosMem, 0, V_BIOS_SIZE);
@ -228,48 +214,24 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
* If this adapter is the primary, use its post-init BIOS (if we can find
* it).
*/
xf86int10ParseBiosLocation(options,&bios);
{
int bios_location = V_BIOS;
Bool done = FALSE;
vbiosMem = (unsigned char *)base + bios_location;
if ((bios.bus == BUS_ISA)
|| (bios.bus != BUS_PCI && xf86IsEntityPrimary(entityIndex))) {
if (bios.bus == BUS_ISA && bios.location.legacy) {
xf86DrvMsg(screen, X_CONFIG,"Looking for legacy V_BIOS "
"at 0x%x for %sprimary device\n",
bios.location.legacy,
xf86IsEntityPrimary(entityIndex) ? "" : "non-");
bios_location = bios.location.legacy;
vbiosMem = (unsigned char *)base + bios_location;
}
if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
done = TRUE;
else
xf86DrvMsg(screen,X_INFO,
"No legacy BIOS found -- trying PCI\n");
if (xf86IsEntityPrimary(entityIndex)) {
if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
done = TRUE;
else
xf86DrvMsg(screen,X_INFO,
"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;
if (!mapPciRom(pci_entity, vbiosMem)) {
if (!mapPciRom(pInt->entityIndex, vbiosMem)) {
xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5)\n");
goto error1;
}
}
}
pInt->BIOSseg = V_BIOS >> 4;

View File

@ -25,13 +25,11 @@
typedef enum {
OPT_NOINT10,
OPT_INIT_PRIMARY,
OPT_BIOS_LOCATION
} INT10Opts;
static const OptionInfoRec INT10Options[] = {
{OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
{OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE },
{OPT_BIOS_LOCATION, "BiosLocation", OPTV_STRING, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE },
};
@ -271,92 +269,14 @@ initPrimary(const void* options)
return initPrimary;
}
/*
* xf86int10ParseBiosLocation(): allows to set the location of the
* BIOS. One may select a BIOS of another card for posting or the
* legacy V_BIOS range located at 0xc0000 or an alternative address
* (BUS_ISA).
* This is only useful under very special circumstances and should
* be used with extreme care.
*/
void
xf86int10ParseBiosLocation(const void* options,
xf86int10BiosLocationPtr bios)
{
const char *p;
const char *str;
bios->bus = BUS_NONE;
if ((options == NULL)
|| ((str = xf86GetOptValString(options, OPT_BIOS_LOCATION)) == NULL)) {
return;
}
if (strncasecmp(str, "pci", 3) == 0) {
bios->bus = BUS_PCI;
} else if (strncasecmp(str, "primary", 7) == 0) {
bios->bus = BUS_ISA;
}
else {
return;
}
p = strchr(str, ':');
switch (bios->bus) {
case BUS_ISA:
bios->location.legacy = (p != NULL) ? atoi(++p) : 0;
break;
case BUS_PCI:
if (p) {
bios->location.pci.bus = atoi(++p);
if ((p = strchr(p, ':'))) {
bios->location.pci.dev = atoi(++p);
if ((p = strchr(p, ':'))) {
bios->location.pci.func = atoi(++p);
break;
}
}
}
/* fall through */
bios->bus = BUS_NONE;
break;
default:
break;
}
}
BusType
xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
const xf86int10BiosLocationPtr bios)
xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
{
BusType location_type = bios->bus;
BusType location_type;
switch (location_type) {
case BUS_PCI:
xf86DrvMsg(pInt->scrnIndex,X_CONFIG,"Overriding bios location: "
"PCI:%i:%i%i\n",bios->location.pci.bus,
bios->location.pci.dev,bios->location.pci.func);
break;
case BUS_ISA:
if (bios->location.legacy)
xf86DrvMsg(pInt->scrnIndex,X_CONFIG,"Overriding bios location: "
"Legacy:0x%x\n",bios->location.legacy);
else
xf86DrvMsg(pInt->scrnIndex,X_CONFIG,"Overriding bios location: "
"Legacy\n");
break;
case BUS_NONE: {
EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
location_type = pEnt->location.type;
xfree(pEnt);
break;
}
default:
break;
}
EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
location_type = pEnt->location.type;
xfree(pEnt);
return location_type;
}
@ -371,40 +291,19 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
}
Bool
xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
const xf86int10BiosLocationPtr bios, void * base)
xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
{
unsigned i;
int cs = ~0;
int segments[4];
const char * format;
segments[0] = MEM_RW(pInt, (0x10 << 2) + 2);
segments[1] = MEM_RW(pInt, (0x42 << 2) + 2);
segments[2] = V_BIOS >> 4;
segments[3] = ~0;
if (bios->bus == BUS_ISA && bios->location.legacy) {
xf86DrvMsg(pInt->scrnIndex, X_CONFIG,
"Overriding BIOS location: 0x%x\n",
bios->location.legacy);
segments[0] = bios->location.legacy >> 4;
segments[1] = ~0;
format = "No V_BIOS at specified address 0x%lx\n";
} else {
if (bios->bus == BUS_PCI) {
xf86DrvMsg(pInt->scrnIndex, X_WARNING,
"Option BiosLocation for primary device ignored: "
"It points to PCI.\n");
xf86DrvMsg(pInt->scrnIndex, X_WARNING,
"You must set Option InitPrimary also\n");
}
segments[0] = MEM_RW(pInt, (0x10 << 2) + 2);
segments[1] = MEM_RW(pInt, (0x42 << 2) + 2);
segments[2] = V_BIOS >> 4;
segments[3] = ~0;
format = "No V_BIOS found\n";
}
format = "No V_BIOS found\n";
for (i = 0; segments[i] != ~0; i++) {
unsigned char * vbiosMem;
@ -424,7 +323,7 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
}
xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
(unsigned long)cs);
(unsigned long)cs);
pInt->BIOSseg = cs;
return TRUE;

View File

@ -59,18 +59,6 @@ typedef struct {
CARD8 save_vse;
CARD8 save_46e8;
} legacyVGARec, *legacyVGAPtr;
typedef struct {
BusType bus;
union {
struct {
int bus;
int dev;
int func;
} pci;
int legacy;
} location;
} xf86int10BiosLocation, *xf86int10BiosLocationPtr;
/* OS dependent functions */
xf86Int10InfoPtr xf86InitInt10(int entityIndex);
@ -185,12 +173,8 @@ Bool int10skip(const void* options);
Bool int10_check_bios(int scrnIndex, int codeSeg,
const unsigned char* vbiosMem);
Bool initPrimary(const void* options);
void xf86int10ParseBiosLocation(const void* options,
xf86int10BiosLocationPtr bios);
BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
const xf86int10BiosLocationPtr bios);
Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
const xf86int10BiosLocationPtr bios, void * base);
BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt);
Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base);
#ifdef DEBUG
void dprint(unsigned long start, unsigned long size);
#endif

View File

@ -88,7 +88,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
int pagesize;
memType cs;
legacyVGARec vga;
xf86int10BiosLocation bios;
Bool videoBiosMapped = FALSE;
pciVideoPtr pvp;
@ -260,13 +259,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
#endif
}
xf86int10ParseBiosLocation(options,&bios);
if (xf86IsEntityPrimary(entityIndex)
&& !(initPrimary(options))) {
if (! xf86int10GetBiosSegment(pInt, &bios, NULL)) {
if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
if (!xf86int10GetBiosSegment(pInt, NULL))
goto error3;
}
set_return_trap(pInt);
#ifdef _PC
@ -276,16 +271,11 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
#endif
} else {
const BusType location_type = xf86int10GetBiosLocationType(pInt,
&bios);
const BusType location_type = xf86int10GetBiosLocationType(pInt);
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;
const int pci_entity = pInt->entityIndex;
if (!mapPciRom(pci_entity, (unsigned char *)(V_BIOS))) {
xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n");
@ -295,9 +285,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
break;
}
case BUS_ISA:
if (! xf86int10GetBiosSegment(pInt, &bios, NULL)) {
if (!xf86int10GetBiosSegment(pInt, NULL))
goto error3;
}
break;
default:
goto error3;