mirror of
https://github.com/reactos/reactos.git
synced 2024-07-04 11:44:33 +00:00
[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:
parent
71162a52f5
commit
590b4a4093
|
@ -357,7 +357,7 @@ VidInitialize(IN BOOLEAN SetMode)
|
|||
{
|
||||
ULONG Context = 0;
|
||||
PHYSICAL_ADDRESS TranslatedAddress;
|
||||
PHYSICAL_ADDRESS NullAddress = {{0, 0}};
|
||||
PHYSICAL_ADDRESS NullAddress = {{0, 0}}, VgaAddress;
|
||||
ULONG AddressSpace = 1;
|
||||
BOOLEAN Result;
|
||||
ULONG_PTR Base;
|
||||
|
@ -373,8 +373,10 @@ VidInitialize(IN BOOLEAN SetMode)
|
|||
TRUE);
|
||||
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 */
|
||||
TryAgain:
|
||||
if (!AddressSpace)
|
||||
{
|
||||
/* Map it */
|
||||
|
@ -386,20 +388,35 @@ TryAgain:
|
|||
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;
|
||||
if (VgaIsPresent())
|
||||
{
|
||||
/* Translate the VGA Memory Address */
|
||||
NullAddress.LowPart = 0xA0000;
|
||||
VgaAddress.LowPart = 0xA0000;
|
||||
AddressSpace = 0;
|
||||
Result = HalFindBusAddressTranslation(NullAddress,
|
||||
Result = HalFindBusAddressTranslation(VgaAddress,
|
||||
&AddressSpace,
|
||||
&TranslatedAddress,
|
||||
&Context,
|
||||
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 */
|
||||
if (!AddressSpace)
|
||||
{
|
||||
|
@ -427,26 +444,10 @@ TryAgain:
|
|||
|
||||
/* Initialize it */
|
||||
VgaInterpretCmdStream(AT_Initialization);
|
||||
}
|
||||
|
||||
/* VGA is ready */
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue