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 not accelerated (whether due to lack of support in the hardware or in the
driver). driver).
.TP 7 .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 .BI "Option \*qInitPrimary\*q \*q" boolean \*q
Use the Int10 module to initialize the primary graphics card. Use the Int10 module to initialize the primary graphics card.
Normally, only secondary cards are soft-booted using the Int10 module, as the Normally, only secondary cards are soft-booted using the Int10 module, as the

View File

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

View File

@ -25,13 +25,11 @@
typedef enum { typedef enum {
OPT_NOINT10, OPT_NOINT10,
OPT_INIT_PRIMARY, OPT_INIT_PRIMARY,
OPT_BIOS_LOCATION
} INT10Opts; } INT10Opts;
static const OptionInfoRec INT10Options[] = { static const OptionInfoRec INT10Options[] = {
{OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE }, {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
{OPT_INIT_PRIMARY, "InitPrimary", 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 }, { -1, NULL, OPTV_NONE, {0}, FALSE },
}; };
@ -271,92 +269,14 @@ initPrimary(const void* options)
return initPrimary; 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 BusType
xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt, xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
const xf86int10BiosLocationPtr bios)
{ {
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); EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
location_type = pEnt->location.type; location_type = pEnt->location.type;
xfree(pEnt); xfree(pEnt);
break;
}
default:
break;
}
return location_type; return location_type;
} }
@ -371,40 +291,19 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
} }
Bool Bool
xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
const xf86int10BiosLocationPtr bios, void * base)
{ {
unsigned i; unsigned i;
int cs = ~0; int cs = ~0;
int segments[4]; int segments[4];
const char * format; const char * format;
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[0] = MEM_RW(pInt, (0x10 << 2) + 2);
segments[1] = MEM_RW(pInt, (0x42 << 2) + 2); segments[1] = MEM_RW(pInt, (0x42 << 2) + 2);
segments[2] = V_BIOS >> 4; segments[2] = V_BIOS >> 4;
segments[3] = ~0; segments[3] = ~0;
format = "No V_BIOS found\n"; format = "No V_BIOS found\n";
}
for (i = 0; segments[i] != ~0; i++) { for (i = 0; segments[i] != ~0; i++) {
unsigned char * vbiosMem; unsigned char * vbiosMem;

View File

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

View File

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