[BOOTVID]: Fix completely broken VidInitialize routine. I have no idea what the original code was trying to accomplish.

svn path=/trunk/; revision=45269
This commit is contained in:
Sir Richard 2010-01-26 19:21:41 +00:00
parent 71162a52f5
commit 590b4a4093

View file

@ -357,7 +357,7 @@ VidInitialize(IN BOOLEAN SetMode)
{ {
ULONG Context = 0; ULONG Context = 0;
PHYSICAL_ADDRESS TranslatedAddress; PHYSICAL_ADDRESS TranslatedAddress;
PHYSICAL_ADDRESS NullAddress = {{0, 0}}; PHYSICAL_ADDRESS NullAddress = {{0, 0}}, VgaAddress;
ULONG AddressSpace = 1; ULONG AddressSpace = 1;
BOOLEAN Result; BOOLEAN Result;
ULONG_PTR Base; ULONG_PTR Base;
@ -373,8 +373,10 @@ VidInitialize(IN BOOLEAN SetMode)
TRUE); TRUE);
if (!Result) return FALSE; if (!Result) return FALSE;
/* Loop trying to find posssible VGA base addresses */
while (TRUE)
{
/* See if this is I/O Space, which we need to map */ /* See if this is I/O Space, which we need to map */
TryAgain:
if (!AddressSpace) if (!AddressSpace)
{ {
/* Map it */ /* Map it */
@ -386,20 +388,35 @@ TryAgain:
Base = TranslatedAddress.LowPart; Base = TranslatedAddress.LowPart;
} }
/* Set the VGA Register base and now check if we have a VGA device */ /* Try to see if this is VGA */
VgaRegisterBase = Base; VgaRegisterBase = Base;
if (VgaIsPresent()) if (VgaIsPresent())
{ {
/* Translate the VGA Memory Address */ /* Translate the VGA Memory Address */
NullAddress.LowPart = 0xA0000; VgaAddress.LowPart = 0xA0000;
AddressSpace = 0; AddressSpace = 0;
Result = HalFindBusAddressTranslation(NullAddress, Result = HalFindBusAddressTranslation(VgaAddress,
&AddressSpace, &AddressSpace,
&TranslatedAddress, &TranslatedAddress,
&Context, &Context,
FALSE); FALSE);
if (Result) if (Result) break;
/* Try to see if there's any other address */
Result = HalFindBusAddressTranslation(NullAddress,
&AddressSpace,
&TranslatedAddress,
&Context,
TRUE);
if (!Result) return FALSE;
}
else
{ {
/* It's not, so unmap the I/O space if we mapped it */
if (!AddressSpace) MmUnmapIoSpace((PVOID)VgaRegisterBase, 0x400);
}
}
/* Success! See if this is I/O Space, which we need to map */ /* Success! See if this is I/O Space, which we need to map */
if (!AddressSpace) if (!AddressSpace)
{ {
@ -427,27 +444,11 @@ TryAgain:
/* Initialize it */ /* Initialize it */
VgaInterpretCmdStream(AT_Initialization); VgaInterpretCmdStream(AT_Initialization);
}
/* VGA is ready */
return TRUE; return TRUE;
} }
}
}
else
{
/* It's not, so unmap the I/O space if we mapped it */
if (!AddressSpace) MmUnmapIoSpace((PVOID)VgaRegisterBase, 0x400);
}
/* If we got here, then we failed...let's try again */
Result = HalFindBusAddressTranslation(NullAddress,
&AddressSpace,
&TranslatedAddress,
&Context,
TRUE);
if (Result) goto TryAgain;
/* If we got here, then we failed even past our re-try... */
return FALSE;
}
/* /*
* @implemented * @implemented