mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 12:02:02 +00:00
[HAL]
Fix MSVC / 64 bit warnings svn path=/trunk/; revision=56260
This commit is contained in:
parent
d8e68c8aff
commit
efff43afd5
10 changed files with 317 additions and 317 deletions
|
@ -87,8 +87,8 @@ HalpGetSystemInterruptVector_Acpi(IN ULONG BusNumber,
|
||||||
OUT PKIRQL Irql,
|
OUT PKIRQL Irql,
|
||||||
OUT PKAFFINITY Affinity)
|
OUT PKAFFINITY Affinity)
|
||||||
{
|
{
|
||||||
ULONG Vector = IRQ2VECTOR(BusInterruptLevel);
|
UCHAR Vector = IRQ2VECTOR((UCHAR)BusInterruptLevel);
|
||||||
*Irql = (KIRQL)VECTOR2IRQL(Vector);
|
*Irql = VECTOR2IRQL(Vector);
|
||||||
*Affinity = 0xFFFFFFFF;
|
*Affinity = 0xFFFFFFFF;
|
||||||
return Vector;
|
return Vector;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ HalpAcpiGetCachedTable(IN ULONG Signature)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
PACPI_CACHED_TABLE CachedTable;
|
PACPI_CACHED_TABLE CachedTable;
|
||||||
|
|
||||||
/* Loop cached tables */
|
/* Loop cached tables */
|
||||||
ListHead = &HalpAcpiTableCacheList;
|
ListHead = &HalpAcpiTableCacheList;
|
||||||
NextEntry = ListHead->Flink;
|
NextEntry = ListHead->Flink;
|
||||||
|
@ -60,10 +60,10 @@ HalpAcpiGetCachedTable(IN ULONG Signature)
|
||||||
{
|
{
|
||||||
/* Get the table */
|
/* Get the table */
|
||||||
CachedTable = CONTAINING_RECORD(NextEntry, ACPI_CACHED_TABLE, Links);
|
CachedTable = CONTAINING_RECORD(NextEntry, ACPI_CACHED_TABLE, Links);
|
||||||
|
|
||||||
/* Compare signatures */
|
/* Compare signatures */
|
||||||
if (CachedTable->Header.Signature == Signature) return &CachedTable->Header;
|
if (CachedTable->Header.Signature == Signature) return &CachedTable->Header;
|
||||||
|
|
||||||
/* Keep going */
|
/* Keep going */
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ NTAPI
|
||||||
HalpAcpiCacheTable(IN PDESCRIPTION_HEADER TableHeader)
|
HalpAcpiCacheTable(IN PDESCRIPTION_HEADER TableHeader)
|
||||||
{
|
{
|
||||||
PACPI_CACHED_TABLE CachedTable;
|
PACPI_CACHED_TABLE CachedTable;
|
||||||
|
|
||||||
/* Get the cached table and link it */
|
/* Get the cached table and link it */
|
||||||
CachedTable = CONTAINING_RECORD(TableHeader, ACPI_CACHED_TABLE, Header);
|
CachedTable = CONTAINING_RECORD(TableHeader, ACPI_CACHED_TABLE, Header);
|
||||||
InsertTailList(&HalpAcpiTableCacheList, &CachedTable->Links);
|
InsertTailList(&HalpAcpiTableCacheList, &CachedTable->Links);
|
||||||
|
@ -89,11 +89,11 @@ HalpAcpiCopyBiosTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
IN PDESCRIPTION_HEADER TableHeader)
|
IN PDESCRIPTION_HEADER TableHeader)
|
||||||
{
|
{
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
PFN_NUMBER PageCount;
|
PFN_COUNT PageCount;
|
||||||
PHYSICAL_ADDRESS PhysAddress;
|
PHYSICAL_ADDRESS PhysAddress;
|
||||||
PACPI_CACHED_TABLE CachedTable;
|
PACPI_CACHED_TABLE CachedTable;
|
||||||
PDESCRIPTION_HEADER CopiedTable;
|
PDESCRIPTION_HEADER CopiedTable;
|
||||||
|
|
||||||
/* Size we'll need for the cached table */
|
/* Size we'll need for the cached table */
|
||||||
Size = TableHeader->Length + FIELD_OFFSET(ACPI_CACHED_TABLE, Header);
|
Size = TableHeader->Length + FIELD_OFFSET(ACPI_CACHED_TABLE, Header);
|
||||||
if (LoaderBlock)
|
if (LoaderBlock)
|
||||||
|
@ -120,7 +120,7 @@ HalpAcpiCopyBiosTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Use Mm pool */
|
/* Use Mm pool */
|
||||||
CachedTable = ExAllocatePoolWithTag(NonPagedPool, Size, ' laH');
|
CachedTable = ExAllocatePoolWithTag(NonPagedPool, Size, ' laH');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we have the cached table? */
|
/* Do we have the cached table? */
|
||||||
if (CachedTable)
|
if (CachedTable)
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ HalpAcpiCopyBiosTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Nothing to return */
|
/* Nothing to return */
|
||||||
CopiedTable = NULL;
|
CopiedTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the table */
|
/* Return the table */
|
||||||
return CopiedTable;
|
return CopiedTable;
|
||||||
}
|
}
|
||||||
|
@ -153,8 +153,8 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
ULONG EntryCount, CurrentEntry;
|
ULONG EntryCount, CurrentEntry;
|
||||||
PCHAR CurrentByte;
|
PCHAR CurrentByte;
|
||||||
PFN_NUMBER PageCount;
|
PFN_COUNT PageCount;
|
||||||
|
|
||||||
/* Should not query the RSDT/XSDT by itself */
|
/* Should not query the RSDT/XSDT by itself */
|
||||||
if ((Signature == RSDT_SIGNATURE) || (Signature == XSDT_SIGNATURE)) return NULL;
|
if ((Signature == RSDT_SIGNATURE) || (Signature == XSDT_SIGNATURE)) return NULL;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
PhysicalAddress.HighPart = 0;
|
PhysicalAddress.HighPart = 0;
|
||||||
PhysicalAddress.LowPart = Fadt->dsdt;
|
PhysicalAddress.LowPart = Fadt->dsdt;
|
||||||
TableLength = 2 * PAGE_SIZE;
|
TableLength = 2 * PAGE_SIZE;
|
||||||
|
|
||||||
/* Map it */
|
/* Map it */
|
||||||
if (LoaderBlock)
|
if (LoaderBlock)
|
||||||
{
|
{
|
||||||
|
@ -188,7 +188,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
DPRINT1("HAL: Failed to map ACPI table.\n");
|
DPRINT1("HAL: Failed to map ACPI table.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate the signature */
|
/* Validate the signature */
|
||||||
if (Header->Signature != DSDT_SIGNATURE)
|
if (Header->Signature != DSDT_SIGNATURE)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +232,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Won't be using the RSDT */
|
/* Won't be using the RSDT */
|
||||||
Rsdt = NULL;
|
Rsdt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Smallest RSDT/XSDT is one without table entries */
|
/* Smallest RSDT/XSDT is one without table entries */
|
||||||
Offset = FIELD_OFFSET(RSDT, Tables);
|
Offset = FIELD_OFFSET(RSDT, Tables);
|
||||||
if (Xsdt)
|
if (Xsdt)
|
||||||
|
@ -240,7 +240,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Figure out total size of table and the offset */
|
/* Figure out total size of table and the offset */
|
||||||
TableLength = Xsdt->Header.Length;
|
TableLength = Xsdt->Header.Length;
|
||||||
if (TableLength < Offset) Offset = Xsdt->Header.Length;
|
if (TableLength < Offset) Offset = Xsdt->Header.Length;
|
||||||
|
|
||||||
/* The entries are each 64-bits, so count them */
|
/* The entries are each 64-bits, so count them */
|
||||||
EntryCount = (TableLength - Offset) / sizeof(PHYSICAL_ADDRESS);
|
EntryCount = (TableLength - Offset) / sizeof(PHYSICAL_ADDRESS);
|
||||||
}
|
}
|
||||||
|
@ -249,11 +249,11 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Figure out total size of table and the offset */
|
/* Figure out total size of table and the offset */
|
||||||
TableLength = Rsdt->Header.Length;
|
TableLength = Rsdt->Header.Length;
|
||||||
if (TableLength < Offset) Offset = Rsdt->Header.Length;
|
if (TableLength < Offset) Offset = Rsdt->Header.Length;
|
||||||
|
|
||||||
/* The entries are each 32-bits, so count them */
|
/* The entries are each 32-bits, so count them */
|
||||||
EntryCount = (TableLength - Offset) / sizeof(ULONG);
|
EntryCount = (TableLength - Offset) / sizeof(ULONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start at the beginning of the array and loop it */
|
/* Start at the beginning of the array and loop it */
|
||||||
for (CurrentEntry = 0; CurrentEntry < EntryCount; CurrentEntry++)
|
for (CurrentEntry = 0; CurrentEntry < EntryCount; CurrentEntry++)
|
||||||
{
|
{
|
||||||
|
@ -269,7 +269,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Read the 64-bit physical address */
|
/* Read the 64-bit physical address */
|
||||||
PhysicalAddress = Xsdt->Tables[CurrentEntry];
|
PhysicalAddress = Xsdt->Tables[CurrentEntry];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Had we already mapped a table? */
|
/* Had we already mapped a table? */
|
||||||
if (Header)
|
if (Header)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
|
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now map this table */
|
/* Now map this table */
|
||||||
if (!LoaderBlock)
|
if (!LoaderBlock)
|
||||||
{
|
{
|
||||||
|
@ -297,7 +297,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Phase 0: Use Mm */
|
/* Phase 0: Use Mm */
|
||||||
Header = HalpMapPhysicalMemory64(PhysicalAddress, 2);
|
Header = HalpMapPhysicalMemory64(PhysicalAddress, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we mapped it */
|
/* Check if we mapped it */
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +315,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
Header);
|
Header);
|
||||||
if (Header->Signature == Signature) break;
|
if (Header->Signature == Signature) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did we end up here back at the last entry? */
|
/* Did we end up here back at the last entry? */
|
||||||
if (CurrentEntry == EntryCount)
|
if (CurrentEntry == EntryCount)
|
||||||
{
|
{
|
||||||
|
@ -335,10 +335,10 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Past this point, we assume something was found */
|
/* Past this point, we assume something was found */
|
||||||
ASSERT(Header);
|
ASSERT(Header);
|
||||||
|
|
||||||
/* How many pages do we need? */
|
/* How many pages do we need? */
|
||||||
PageCount = BYTES_TO_PAGES(Header->Length);
|
PageCount = BYTES_TO_PAGES(Header->Length);
|
||||||
if (PageCount != 2)
|
if (PageCount != 2)
|
||||||
|
@ -354,7 +354,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Using Mm */
|
/* Using Mm */
|
||||||
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
|
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now map this table using its correct size */
|
/* Now map this table using its correct size */
|
||||||
if (!LoaderBlock)
|
if (!LoaderBlock)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +367,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
Header = HalpMapPhysicalMemory64(PhysicalAddress, PageCount);
|
Header = HalpMapPhysicalMemory64(PhysicalAddress, PageCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fail if the remapped failed */
|
/* Fail if the remapped failed */
|
||||||
if (!Header) return NULL;
|
if (!Header) return NULL;
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Add this byte */
|
/* Add this byte */
|
||||||
CheckSum += *CurrentByte;
|
CheckSum += *CurrentByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The correct checksum is always 0, anything else is illegal */
|
/* The correct checksum is always 0, anything else is illegal */
|
||||||
if (CheckSum)
|
if (CheckSum)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
(Signature & 0xFF000000) >> 24);
|
(Signature & 0xFF000000) >> 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the table */
|
/* Return the table */
|
||||||
return Header;
|
return Header;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ NTAPI
|
||||||
HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
IN ULONG Signature)
|
IN ULONG Signature)
|
||||||
{
|
{
|
||||||
PFN_NUMBER PageCount;
|
PFN_COUNT PageCount;
|
||||||
PDESCRIPTION_HEADER TableAddress, BiosCopy;
|
PDESCRIPTION_HEADER TableAddress, BiosCopy;
|
||||||
|
|
||||||
/* See if we have a cached table? */
|
/* See if we have a cached table? */
|
||||||
|
@ -417,7 +417,7 @@ HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
{
|
{
|
||||||
/* Found it, copy it into our own memory */
|
/* Found it, copy it into our own memory */
|
||||||
BiosCopy = HalpAcpiCopyBiosTable(LoaderBlock, TableAddress);
|
BiosCopy = HalpAcpiCopyBiosTable(LoaderBlock, TableAddress);
|
||||||
|
|
||||||
/* Get the pages, and unmap the BIOS copy */
|
/* Get the pages, and unmap the BIOS copy */
|
||||||
PageCount = BYTES_TO_PAGES(TableAddress->Length);
|
PageCount = BYTES_TO_PAGES(TableAddress->Length);
|
||||||
if (LoaderBlock)
|
if (LoaderBlock)
|
||||||
|
@ -430,13 +430,13 @@ HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Phase 1, use Mm */
|
/* Phase 1, use Mm */
|
||||||
MmUnmapIoSpace(TableAddress, PageCount << PAGE_SHIFT);
|
MmUnmapIoSpace(TableAddress, PageCount << PAGE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache the bios copy */
|
/* Cache the bios copy */
|
||||||
TableAddress = BiosCopy;
|
TableAddress = BiosCopy;
|
||||||
if (BiosCopy) HalpAcpiCacheTable(BiosCopy);
|
if (BiosCopy) HalpAcpiCacheTable(BiosCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the table */
|
/* Return the table */
|
||||||
return TableAddress;
|
return TableAddress;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
IN ULONG Signature)
|
IN ULONG Signature)
|
||||||
{
|
{
|
||||||
PDESCRIPTION_HEADER TableHeader;
|
PDESCRIPTION_HEADER TableHeader;
|
||||||
|
|
||||||
/* Is this phase0 */
|
/* Is this phase0 */
|
||||||
if (LoaderBlock)
|
if (LoaderBlock)
|
||||||
{
|
{
|
||||||
|
@ -462,7 +462,7 @@ HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
|
||||||
/* Get the table */
|
/* Get the table */
|
||||||
TableHeader = HalpAcpiGetTable(LoaderBlock, Signature);
|
TableHeader = HalpAcpiGetTable(LoaderBlock, Signature);
|
||||||
|
|
||||||
/* Release the lock in phase 1 */
|
/* Release the lock in phase 1 */
|
||||||
if (!LoaderBlock) ExReleaseFastMutex(&HalpAcpiTableCacheLock);
|
if (!LoaderBlock) ExReleaseFastMutex(&HalpAcpiTableCacheLock);
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ NTAPI
|
||||||
HalpNumaInitializeStaticConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
HalpNumaInitializeStaticConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
PACPI_SRAT SratTable;
|
PACPI_SRAT SratTable;
|
||||||
|
|
||||||
/* Get the SRAT, bail out if it doesn't exist */
|
/* Get the SRAT, bail out if it doesn't exist */
|
||||||
SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE);
|
SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE);
|
||||||
HalpAcpiSrat = SratTable;
|
HalpAcpiSrat = SratTable;
|
||||||
|
@ -487,7 +487,7 @@ NTAPI
|
||||||
HalpGetHotPlugMemoryInfo(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
HalpGetHotPlugMemoryInfo(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
PACPI_SRAT SratTable;
|
PACPI_SRAT SratTable;
|
||||||
|
|
||||||
/* Get the SRAT, bail out if it doesn't exist */
|
/* Get the SRAT, bail out if it doesn't exist */
|
||||||
SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE);
|
SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE);
|
||||||
HalpAcpiSrat = SratTable;
|
HalpAcpiSrat = SratTable;
|
||||||
|
@ -537,7 +537,7 @@ HalpInitBootTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
/* Invalid or doesn't exist, ignore it */
|
/* Invalid or doesn't exist, ignore it */
|
||||||
HalpSimpleBootFlagTable = 0;
|
HalpSimpleBootFlagTable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install the end of boot handler */
|
/* Install the end of boot handler */
|
||||||
// HalEndOfBoot = HalpEndOfBoot;
|
// HalEndOfBoot = HalpEndOfBoot;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
PCM_PARTIAL_RESOURCE_LIST ResourceList;
|
PCM_PARTIAL_RESOURCE_LIST ResourceList;
|
||||||
PACPI_BIOS_MULTI_NODE NodeData;
|
PACPI_BIOS_MULTI_NODE NodeData;
|
||||||
SIZE_T NodeLength;
|
SIZE_T NodeLength;
|
||||||
PFN_NUMBER PageCount;
|
PFN_COUNT PageCount;
|
||||||
PVOID MappedAddress;
|
PVOID MappedAddress;
|
||||||
PHYSICAL_ADDRESS PhysicalAddress;
|
PHYSICAL_ADDRESS PhysicalAddress;
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
|
||||||
/* Assume failure */
|
/* Assume failure */
|
||||||
*AcpiMultiNode = NULL;
|
*AcpiMultiNode = NULL;
|
||||||
|
|
||||||
/* Find the multi function adapter key */
|
/* Find the multi function adapter key */
|
||||||
ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot,
|
ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot,
|
||||||
AdapterClass,
|
AdapterClass,
|
||||||
|
@ -581,7 +581,7 @@ HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Found it */
|
/* Found it */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep searching */
|
/* Keep searching */
|
||||||
Next = ComponentEntry;
|
Next = ComponentEntry;
|
||||||
ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot,
|
ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot,
|
||||||
|
@ -590,24 +590,24 @@ HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
NULL,
|
NULL,
|
||||||
&Next);
|
&Next);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we found it */
|
/* Make sure we found it */
|
||||||
if (!ComponentEntry)
|
if (!ComponentEntry)
|
||||||
{
|
{
|
||||||
DPRINT1("**** HalpAcpiFindRsdtPhase0: did NOT find RSDT\n");
|
DPRINT1("**** HalpAcpiFindRsdtPhase0: did NOT find RSDT\n");
|
||||||
return STATUS_NOT_FOUND;
|
return STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The configuration data is a resource list, and the BIOS node follows */
|
/* The configuration data is a resource list, and the BIOS node follows */
|
||||||
ResourceList = ComponentEntry->ConfigurationData;
|
ResourceList = ComponentEntry->ConfigurationData;
|
||||||
NodeData = (PACPI_BIOS_MULTI_NODE)(ResourceList + 1);
|
NodeData = (PACPI_BIOS_MULTI_NODE)(ResourceList + 1);
|
||||||
|
|
||||||
/* How many E820 memory entries are there? */
|
/* How many E820 memory entries are there? */
|
||||||
NodeLength = sizeof(ACPI_BIOS_MULTI_NODE) +
|
NodeLength = sizeof(ACPI_BIOS_MULTI_NODE) +
|
||||||
(NodeData->Count - 1) * sizeof(ACPI_E820_ENTRY);
|
(NodeData->Count - 1) * sizeof(ACPI_E820_ENTRY);
|
||||||
|
|
||||||
/* Convert to pages */
|
/* Convert to pages */
|
||||||
PageCount = BYTES_TO_PAGES(NodeLength);
|
PageCount = (PFN_COUNT)BYTES_TO_PAGES(NodeLength);
|
||||||
|
|
||||||
/* Allocate the memory */
|
/* Allocate the memory */
|
||||||
PhysicalAddress.QuadPart = HalpAllocPhysicalMemory(LoaderBlock,
|
PhysicalAddress.QuadPart = HalpAllocPhysicalMemory(LoaderBlock,
|
||||||
|
@ -624,11 +624,11 @@ HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Otherwise we'll have to fail */
|
/* Otherwise we'll have to fail */
|
||||||
MappedAddress = NULL;
|
MappedAddress = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the multi node, bail out if we didn't find it */
|
/* Save the multi node, bail out if we didn't find it */
|
||||||
HalpAcpiMultiNode = MappedAddress;
|
HalpAcpiMultiNode = MappedAddress;
|
||||||
if (!MappedAddress) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!MappedAddress) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
/* Copy the multi-node data */
|
/* Copy the multi-node data */
|
||||||
RtlCopyMemory(MappedAddress, NodeData, NodeLength);
|
RtlCopyMemory(MappedAddress, NodeData, NodeLength);
|
||||||
|
|
||||||
|
@ -648,20 +648,20 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
ULONG TableLength;
|
ULONG TableLength;
|
||||||
PRSDT Rsdt;
|
PRSDT Rsdt;
|
||||||
PLOADER_PARAMETER_EXTENSION LoaderExtension;
|
PLOADER_PARAMETER_EXTENSION LoaderExtension;
|
||||||
|
|
||||||
/* Only initialize once */
|
/* Only initialize once */
|
||||||
if (HalpAcpiTableCacheList.Flink) return Status;
|
if (HalpAcpiTableCacheList.Flink) return Status;
|
||||||
|
|
||||||
/* Setup the lock and table */
|
/* Setup the lock and table */
|
||||||
ExInitializeFastMutex(&HalpAcpiTableCacheLock);
|
ExInitializeFastMutex(&HalpAcpiTableCacheLock);
|
||||||
InitializeListHead(&HalpAcpiTableCacheList);
|
InitializeListHead(&HalpAcpiTableCacheList);
|
||||||
|
|
||||||
/* Find the RSDT */
|
/* Find the RSDT */
|
||||||
Status = HalpAcpiFindRsdtPhase0(LoaderBlock, &AcpiMultiNode);
|
Status = HalpAcpiFindRsdtPhase0(LoaderBlock, &AcpiMultiNode);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
PhysicalAddress.QuadPart = AcpiMultiNode->RsdtAddress.QuadPart;
|
PhysicalAddress.QuadPart = AcpiMultiNode->RsdtAddress.QuadPart;
|
||||||
|
|
||||||
/* Map the RSDT */
|
/* Map the RSDT */
|
||||||
if (LoaderBlock)
|
if (LoaderBlock)
|
||||||
{
|
{
|
||||||
|
@ -673,7 +673,7 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
/* Use an I/O map */
|
/* Use an I/O map */
|
||||||
MappedAddress = MmMapIoSpace(PhysicalAddress, PAGE_SIZE * 2, MmNonCached);
|
MappedAddress = MmMapIoSpace(PhysicalAddress, PAGE_SIZE * 2, MmNonCached);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the RSDT */
|
/* Get the RSDT */
|
||||||
Rsdt = MappedAddress;
|
Rsdt = MappedAddress;
|
||||||
if (!MappedAddress)
|
if (!MappedAddress)
|
||||||
|
@ -682,7 +682,7 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
DPRINT1("HAL: Failed to map RSDT\n");
|
DPRINT1("HAL: Failed to map RSDT\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate it */
|
/* Validate it */
|
||||||
if ((Rsdt->Header.Signature != RSDT_SIGNATURE) &&
|
if ((Rsdt->Header.Signature != RSDT_SIGNATURE) &&
|
||||||
(Rsdt->Header.Signature != XSDT_SIGNATURE))
|
(Rsdt->Header.Signature != XSDT_SIGNATURE))
|
||||||
|
@ -691,7 +691,7 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
HalDisplayString("Bad RSDT pointer\n");
|
HalDisplayString("Bad RSDT pointer\n");
|
||||||
KeBugCheckEx(MISMATCHED_HAL, 4, __LINE__, 0, 0);
|
KeBugCheckEx(MISMATCHED_HAL, 4, __LINE__, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We assumed two pages -- do we need less or more? */
|
/* We assumed two pages -- do we need less or more? */
|
||||||
TableLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(PhysicalAddress.LowPart,
|
TableLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(PhysicalAddress.LowPart,
|
||||||
Rsdt->Header.Length);
|
Rsdt->Header.Length);
|
||||||
|
@ -712,7 +712,7 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
HalpUnmapVirtualAddress(MappedAddress, 2);
|
HalpUnmapVirtualAddress(MappedAddress, 2);
|
||||||
MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, TableLength);
|
MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, TableLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the remapped table */
|
/* Get the remapped table */
|
||||||
Rsdt = MappedAddress;
|
Rsdt = MappedAddress;
|
||||||
if (!MappedAddress)
|
if (!MappedAddress)
|
||||||
|
@ -722,7 +722,7 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now take the BIOS copy and make our own local copy */
|
/* Now take the BIOS copy and make our own local copy */
|
||||||
Rsdt = HalpAcpiCopyBiosTable(LoaderBlock, &Rsdt->Header);
|
Rsdt = HalpAcpiCopyBiosTable(LoaderBlock, &Rsdt->Header);
|
||||||
if (!Rsdt)
|
if (!Rsdt)
|
||||||
|
@ -731,7 +731,7 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
DPRINT1("HAL: Couldn't remap RSDT\n");
|
DPRINT1("HAL: Couldn't remap RSDT\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of the BIOS mapping */
|
/* Get rid of the BIOS mapping */
|
||||||
if (LoaderBlock)
|
if (LoaderBlock)
|
||||||
{
|
{
|
||||||
|
@ -747,10 +747,10 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
|
|
||||||
LoaderExtension = NULL;
|
LoaderExtension = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache the RSDT */
|
/* Cache the RSDT */
|
||||||
HalpAcpiCacheTable(&Rsdt->Header);
|
HalpAcpiCacheTable(&Rsdt->Header);
|
||||||
|
|
||||||
/* Check for compatible loader block extension */
|
/* Check for compatible loader block extension */
|
||||||
if (LoaderExtension && (LoaderExtension->Size >= 0x58))
|
if (LoaderExtension && (LoaderExtension->Size >= 0x58))
|
||||||
{
|
{
|
||||||
|
@ -772,7 +772,7 @@ HaliAcpiTimerInit(IN ULONG TimerPort,
|
||||||
IN ULONG TimerValExt)
|
IN ULONG TimerValExt)
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Is this in the init phase? */
|
/* Is this in the init phase? */
|
||||||
if (!TimerPort)
|
if (!TimerPort)
|
||||||
{
|
{
|
||||||
|
@ -781,7 +781,7 @@ HaliAcpiTimerInit(IN ULONG TimerPort,
|
||||||
TimerValExt = HalpFixedAcpiDescTable.flags & ACPI_TMR_VAL_EXT;
|
TimerValExt = HalpFixedAcpiDescTable.flags & ACPI_TMR_VAL_EXT;
|
||||||
DPRINT1("ACPI Timer at: %Xh (EXT: %d)\n", TimerPort, TimerValExt);
|
DPRINT1("ACPI Timer at: %Xh (EXT: %d)\n", TimerPort, TimerValExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Now proceed to the timer initialization */
|
/* FIXME: Now proceed to the timer initialization */
|
||||||
//HalaAcpiTimerInit(TimerPort, TimerValExt);
|
//HalaAcpiTimerInit(TimerPort, TimerValExt);
|
||||||
}
|
}
|
||||||
|
@ -810,23 +810,23 @@ HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
DPRINT1("HAL: Didn't find the FACP\n");
|
DPRINT1("HAL: Didn't find the FACP\n");
|
||||||
return STATUS_NOT_FOUND;
|
return STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assume typical size, otherwise whatever the descriptor table says */
|
/* Assume typical size, otherwise whatever the descriptor table says */
|
||||||
TableLength = sizeof(FADT);
|
TableLength = sizeof(FADT);
|
||||||
if (Fadt->Header.Length < sizeof(FADT)) TableLength = Fadt->Header.Length;
|
if (Fadt->Header.Length < sizeof(FADT)) TableLength = Fadt->Header.Length;
|
||||||
|
|
||||||
/* Copy it in the HAL static buffer */
|
/* Copy it in the HAL static buffer */
|
||||||
RtlCopyMemory(&HalpFixedAcpiDescTable, Fadt, TableLength);
|
RtlCopyMemory(&HalpFixedAcpiDescTable, Fadt, TableLength);
|
||||||
|
|
||||||
/* Anything special this HAL needs to do? */
|
/* Anything special this HAL needs to do? */
|
||||||
HalpAcpiDetectMachineSpecificActions(LoaderBlock, &HalpFixedAcpiDescTable);
|
HalpAcpiDetectMachineSpecificActions(LoaderBlock, &HalpFixedAcpiDescTable);
|
||||||
|
|
||||||
/* Get the debug table for KD */
|
/* Get the debug table for KD */
|
||||||
HalpDebugPortTable = HalAcpiGetTable(LoaderBlock, DBGP_SIGNATURE);
|
HalpDebugPortTable = HalAcpiGetTable(LoaderBlock, DBGP_SIGNATURE);
|
||||||
|
|
||||||
/* Initialize NUMA through the SRAT */
|
/* Initialize NUMA through the SRAT */
|
||||||
HalpNumaInitializeStaticConfiguration(LoaderBlock);
|
HalpNumaInitializeStaticConfiguration(LoaderBlock);
|
||||||
|
|
||||||
/* Initialize hotplug through the SRAT */
|
/* Initialize hotplug through the SRAT */
|
||||||
HalpDynamicSystemResourceConfiguration(LoaderBlock);
|
HalpDynamicSystemResourceConfiguration(LoaderBlock);
|
||||||
if (HalpAcpiSrat)
|
if (HalpAcpiSrat)
|
||||||
|
@ -840,10 +840,10 @@ HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
/* We'll need this for DMA later */
|
/* We'll need this for DMA later */
|
||||||
HalpPhysicalMemoryMayAppearAbove4GB = TRUE;
|
HalpPhysicalMemoryMayAppearAbove4GB = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the ACPI timer */
|
/* Setup the ACPI timer */
|
||||||
HaliAcpiTimerInit(0, 0);
|
HaliAcpiTimerInit(0, 0);
|
||||||
|
|
||||||
/* Do we have a low stub address yet? */
|
/* Do we have a low stub address yet? */
|
||||||
if (!HalpLowStubPhysicalAddress.QuadPart)
|
if (!HalpLowStubPhysicalAddress.QuadPart)
|
||||||
{
|
{
|
||||||
|
@ -858,15 +858,15 @@ HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
HalpLowStub = HalpMapPhysicalMemory64(HalpLowStubPhysicalAddress, 1);
|
HalpLowStub = HalpMapPhysicalMemory64(HalpLowStubPhysicalAddress, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grab a page for flushes */
|
/* Grab a page for flushes */
|
||||||
PhysicalAddress.QuadPart = 0x100000;
|
PhysicalAddress.QuadPart = 0x100000;
|
||||||
HalpVirtAddrForFlush = HalpMapPhysicalMemory64(PhysicalAddress, 1);
|
HalpVirtAddrForFlush = HalpMapPhysicalMemory64(PhysicalAddress, 1);
|
||||||
HalpPteForFlush = HalAddressToPte(HalpVirtAddrForFlush);
|
HalpPteForFlush = HalAddressToPte(HalpVirtAddrForFlush);
|
||||||
|
|
||||||
/* Don't do this again */
|
/* Don't do this again */
|
||||||
HalpProcessedACPIPhase0 = TRUE;
|
HalpProcessedACPIPhase0 = TRUE;
|
||||||
|
|
||||||
/* Setup the boot table */
|
/* Setup the boot table */
|
||||||
HalpInitBootTable(LoaderBlock);
|
HalpInitBootTable(LoaderBlock);
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ HalpInitializePciBus(VOID)
|
||||||
{
|
{
|
||||||
/* Setup the PCI stub support */
|
/* Setup the PCI stub support */
|
||||||
HalpInitializePciStubs();
|
HalpInitializePciStubs();
|
||||||
|
|
||||||
/* Set the NMI crash flag */
|
/* Set the NMI crash flag */
|
||||||
HalpGetNMICrashFlag();
|
HalpGetNMICrashFlag();
|
||||||
}
|
}
|
||||||
|
@ -963,7 +963,7 @@ NTAPI
|
||||||
HalpAcpiDetectResourceListSize(OUT PULONG ListSize)
|
HalpAcpiDetectResourceListSize(OUT PULONG ListSize)
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* One element if there is a SCI */
|
/* One element if there is a SCI */
|
||||||
*ListSize = HalpFixedAcpiDescTable.sci_int_vector ? 1: 0;
|
*ListSize = HalpFixedAcpiDescTable.sci_int_vector ? 1: 0;
|
||||||
}
|
}
|
||||||
|
@ -983,7 +983,7 @@ HalpBuildAcpiResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceList)
|
||||||
ResourceList->List[0].Version = 1;
|
ResourceList->List[0].Version = 1;
|
||||||
ResourceList->List[0].Revision = 1;
|
ResourceList->List[0].Revision = 1;
|
||||||
ResourceList->List[0].Count = 0;
|
ResourceList->List[0].Count = 0;
|
||||||
|
|
||||||
/* Is there a SCI? */
|
/* Is there a SCI? */
|
||||||
if (HalpFixedAcpiDescTable.sci_int_vector)
|
if (HalpFixedAcpiDescTable.sci_int_vector)
|
||||||
{
|
{
|
||||||
|
@ -991,16 +991,16 @@ HalpBuildAcpiResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceList)
|
||||||
ResourceList->List[0].Descriptors[0].Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
|
ResourceList->List[0].Descriptors[0].Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
|
||||||
ResourceList->List[0].Descriptors[0].Type = CmResourceTypeInterrupt;
|
ResourceList->List[0].Descriptors[0].Type = CmResourceTypeInterrupt;
|
||||||
ResourceList->List[0].Descriptors[0].ShareDisposition = CmResourceShareShared;
|
ResourceList->List[0].Descriptors[0].ShareDisposition = CmResourceShareShared;
|
||||||
|
|
||||||
/* Get the interrupt number */
|
/* Get the interrupt number */
|
||||||
Interrupt = HalpPicVectorRedirect[HalpFixedAcpiDescTable.sci_int_vector];
|
Interrupt = HalpPicVectorRedirect[HalpFixedAcpiDescTable.sci_int_vector];
|
||||||
ResourceList->List[0].Descriptors[0].u.Interrupt.MinimumVector = Interrupt;
|
ResourceList->List[0].Descriptors[0].u.Interrupt.MinimumVector = Interrupt;
|
||||||
ResourceList->List[0].Descriptors[0].u.Interrupt.MaximumVector = Interrupt;
|
ResourceList->List[0].Descriptors[0].u.Interrupt.MaximumVector = Interrupt;
|
||||||
|
|
||||||
/* One more */
|
/* One more */
|
||||||
++ResourceList->List[0].Count;
|
++ResourceList->List[0].Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All good */
|
/* All good */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1013,11 +1013,11 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen
|
||||||
ULONG Count = 0, ListSize;
|
ULONG Count = 0, ListSize;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Get ACPI resources */
|
/* Get ACPI resources */
|
||||||
HalpAcpiDetectResourceListSize(&Count);
|
HalpAcpiDetectResourceListSize(&Count);
|
||||||
DPRINT("Resource count: %d\n", Count);
|
DPRINT("Resource count: %d\n", Count);
|
||||||
|
|
||||||
/* Compute size of the list and allocate it */
|
/* Compute size of the list and allocate it */
|
||||||
ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors) +
|
ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors) +
|
||||||
(Count * sizeof(IO_RESOURCE_DESCRIPTOR));
|
(Count * sizeof(IO_RESOURCE_DESCRIPTOR));
|
||||||
|
@ -1028,14 +1028,14 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen
|
||||||
/* Initialize it */
|
/* Initialize it */
|
||||||
RtlZeroMemory(RequirementsList, ListSize);
|
RtlZeroMemory(RequirementsList, ListSize);
|
||||||
RequirementsList->ListSize = ListSize;
|
RequirementsList->ListSize = ListSize;
|
||||||
|
|
||||||
/* Build it */
|
/* Build it */
|
||||||
Status = HalpBuildAcpiResourceList(RequirementsList);
|
Status = HalpBuildAcpiResourceList(RequirementsList);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* It worked, return it */
|
/* It worked, return it */
|
||||||
*Requirements = RequirementsList;
|
*Requirements = RequirementsList;
|
||||||
|
|
||||||
/* Validate the list */
|
/* Validate the list */
|
||||||
ASSERT(RequirementsList->List[0].Count == Count);
|
ASSERT(RequirementsList->List[0].Count == Count);
|
||||||
}
|
}
|
||||||
|
@ -1051,7 +1051,7 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen
|
||||||
/* Not enough memory */
|
/* Not enough memory */
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the status */
|
/* Return the status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
/* Create the FDO */
|
/* Create the FDO */
|
||||||
Status = IoCreateDevice(DriverObject,
|
Status = IoCreateDevice(DriverObject,
|
||||||
sizeof(FDO_EXTENSION),
|
sizeof(FDO_EXTENSION),
|
||||||
NULL,
|
NULL,
|
||||||
FILE_DEVICE_BUS_EXTENDER,
|
FILE_DEVICE_BUS_EXTENDER,
|
||||||
0,
|
0,
|
||||||
|
@ -128,17 +128,17 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the FDO extension */
|
/* Setup the FDO extension */
|
||||||
FdoExtension = DeviceObject->DeviceExtension;
|
FdoExtension = DeviceObject->DeviceExtension;
|
||||||
FdoExtension->ExtensionType = FdoExtensionType;
|
FdoExtension->ExtensionType = FdoExtensionType;
|
||||||
FdoExtension->PhysicalDeviceObject = TargetDevice;
|
FdoExtension->PhysicalDeviceObject = TargetDevice;
|
||||||
FdoExtension->FunctionalDeviceObject = DeviceObject;
|
FdoExtension->FunctionalDeviceObject = DeviceObject;
|
||||||
FdoExtension->ChildPdoList = NULL;
|
FdoExtension->ChildPdoList = NULL;
|
||||||
|
|
||||||
/* FDO is done initializing */
|
/* FDO is done initializing */
|
||||||
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
/* Attach to the physical device object (the bus) */
|
/* Attach to the physical device object (the bus) */
|
||||||
AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject, TargetDevice);
|
AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject, TargetDevice);
|
||||||
if (!AttachedDevice)
|
if (!AttachedDevice)
|
||||||
|
@ -187,11 +187,11 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PDEVICE_RELATIONS PdoRelations, FdoRelations;
|
PDEVICE_RELATIONS PdoRelations, FdoRelations;
|
||||||
PDEVICE_OBJECT* ObjectEntry;
|
PDEVICE_OBJECT* ObjectEntry;
|
||||||
ULONG i = 0, PdoCount = 0;
|
ULONG i = 0, PdoCount = 0;
|
||||||
|
|
||||||
/* Get FDO device extension and PDO count */
|
/* Get FDO device extension and PDO count */
|
||||||
FdoExtension = DeviceObject->DeviceExtension;
|
FdoExtension = DeviceObject->DeviceExtension;
|
||||||
ExtensionType = FdoExtension->ExtensionType;
|
ExtensionType = FdoExtension->ExtensionType;
|
||||||
|
|
||||||
/* What do they want? */
|
/* What do they want? */
|
||||||
if (RelationType == BusRelations)
|
if (RelationType == BusRelations)
|
||||||
{
|
{
|
||||||
|
@ -220,10 +220,10 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
||||||
sizeof(PDEVICE_OBJECT) * PdoCount,
|
sizeof(PDEVICE_OBJECT) * PdoCount,
|
||||||
' laH');
|
' laH');
|
||||||
if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
/* Save our count */
|
/* Save our count */
|
||||||
FdoRelations->Count = PdoCount;
|
FdoRelations->Count = PdoCount;
|
||||||
|
|
||||||
/* Query existing relations */
|
/* Query existing relations */
|
||||||
ObjectEntry = FdoRelations->Objects;
|
ObjectEntry = FdoRelations->Objects;
|
||||||
if (*DeviceRelations)
|
if (*DeviceRelations)
|
||||||
|
@ -239,11 +239,11 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
while (++i < (*DeviceRelations)->Count);
|
while (++i < (*DeviceRelations)->Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free existing structure */
|
/* Free existing structure */
|
||||||
ExFreePool(*DeviceRelations);
|
ExFreePool(*DeviceRelations);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now check if we have a PDO list */
|
/* Now check if we have a PDO list */
|
||||||
PdoExtension = FdoExtension->ChildPdoList;
|
PdoExtension = FdoExtension->ChildPdoList;
|
||||||
if (PdoExtension)
|
if (PdoExtension)
|
||||||
|
@ -254,13 +254,13 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Save our own PDO and reference it */
|
/* Save our own PDO and reference it */
|
||||||
*ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
|
*ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
|
||||||
ObReferenceObject(PdoExtension->PhysicalDeviceObject);
|
ObReferenceObject(PdoExtension->PhysicalDeviceObject);
|
||||||
|
|
||||||
/* Go to our next PDO */
|
/* Go to our next PDO */
|
||||||
PdoExtension = PdoExtension->Next;
|
PdoExtension = PdoExtension->Next;
|
||||||
}
|
}
|
||||||
while (PdoExtension);
|
while (PdoExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the new structure */
|
/* Return the new structure */
|
||||||
*DeviceRelations = FdoRelations;
|
*DeviceRelations = FdoRelations;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -277,18 +277,18 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
||||||
sizeof(DEVICE_RELATIONS),
|
sizeof(DEVICE_RELATIONS),
|
||||||
' laH');
|
' laH');
|
||||||
if (!PdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!PdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
/* Fill it out and reference us */
|
/* Fill it out and reference us */
|
||||||
PdoRelations->Count = 1;
|
PdoRelations->Count = 1;
|
||||||
PdoRelations->Objects[0] = DeviceObject;
|
PdoRelations->Objects[0] = DeviceObject;
|
||||||
ObReferenceObject(DeviceObject);
|
ObReferenceObject(DeviceObject);
|
||||||
|
|
||||||
/* Return it */
|
/* Return it */
|
||||||
*DeviceRelations = PdoRelations;
|
*DeviceRelations = PdoRelations;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't support anything else */
|
/* We don't support anything else */
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject,
|
||||||
//PPDO_EXTENSION PdoExtension;
|
//PPDO_EXTENSION PdoExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Get the extension and check for valid version */
|
/* Get the extension and check for valid version */
|
||||||
//PdoExtension = DeviceObject->DeviceExtension;
|
//PdoExtension = DeviceObject->DeviceExtension;
|
||||||
ASSERT(Capabilities->Version == 1);
|
ASSERT(Capabilities->Version == 1);
|
||||||
|
@ -310,33 +310,33 @@ HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Can't lock or eject us */
|
/* Can't lock or eject us */
|
||||||
Capabilities->LockSupported = FALSE;
|
Capabilities->LockSupported = FALSE;
|
||||||
Capabilities->EjectSupported = FALSE;
|
Capabilities->EjectSupported = FALSE;
|
||||||
|
|
||||||
/* Can't remove or dock us */
|
/* Can't remove or dock us */
|
||||||
Capabilities->Removable = FALSE;
|
Capabilities->Removable = FALSE;
|
||||||
Capabilities->DockDevice = FALSE;
|
Capabilities->DockDevice = FALSE;
|
||||||
|
|
||||||
/* Can't access us raw */
|
/* Can't access us raw */
|
||||||
Capabilities->RawDeviceOK = FALSE;
|
Capabilities->RawDeviceOK = FALSE;
|
||||||
|
|
||||||
/* We have a unique ID, and don't bother the user */
|
/* We have a unique ID, and don't bother the user */
|
||||||
Capabilities->UniqueID = TRUE;
|
Capabilities->UniqueID = TRUE;
|
||||||
Capabilities->SilentInstall = TRUE;
|
Capabilities->SilentInstall = TRUE;
|
||||||
|
|
||||||
/* Fill out the adress */
|
/* Fill out the adress */
|
||||||
Capabilities->Address = InterfaceTypeUndefined;
|
Capabilities->Address = InterfaceTypeUndefined;
|
||||||
Capabilities->UINumber = InterfaceTypeUndefined;
|
Capabilities->UINumber = InterfaceTypeUndefined;
|
||||||
|
|
||||||
/* Fill out latencies */
|
/* Fill out latencies */
|
||||||
Capabilities->D1Latency = 0;
|
Capabilities->D1Latency = 0;
|
||||||
Capabilities->D2Latency = 0;
|
Capabilities->D2Latency = 0;
|
||||||
Capabilities->D3Latency = 0;
|
Capabilities->D3Latency = 0;
|
||||||
|
|
||||||
/* Fill out supported device states */
|
/* Fill out supported device states */
|
||||||
Capabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
|
Capabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
|
||||||
Capabilities->DeviceState[PowerSystemHibernate] = PowerDeviceD3;
|
Capabilities->DeviceState[PowerSystemHibernate] = PowerDeviceD3;
|
||||||
Capabilities->DeviceState[PowerSystemShutdown] = PowerDeviceD3;
|
Capabilities->DeviceState[PowerSystemShutdown] = PowerDeviceD3;
|
||||||
Capabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
|
Capabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Fail */
|
/* Fail */
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -363,16 +363,16 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDesc;
|
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDesc;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Only the ACPI PDO has requirements */
|
/* Only the ACPI PDO has requirements */
|
||||||
if (DeviceExtension->PdoType == AcpiPdo)
|
if (DeviceExtension->PdoType == AcpiPdo)
|
||||||
{
|
{
|
||||||
/* Query ACPI requirements */
|
/* Query ACPI requirements */
|
||||||
Status = HalpQueryAcpiResourceRequirements(&RequirementsList);
|
Status = HalpQueryAcpiResourceRequirements(&RequirementsList);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
ASSERT(RequirementsList->AlternativeLists == 1);
|
ASSERT(RequirementsList->AlternativeLists == 1);
|
||||||
|
|
||||||
/* Allocate the resourcel ist */
|
/* Allocate the resourcel ist */
|
||||||
ResourceList = ExAllocatePoolWithTag(PagedPool,
|
ResourceList = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(CM_RESOURCE_LIST),
|
sizeof(CM_RESOURCE_LIST),
|
||||||
|
@ -384,7 +384,7 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
||||||
ExFreePoolWithTag(RequirementsList, ' laH');
|
ExFreePoolWithTag(RequirementsList, ' laH');
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize it */
|
/* Initialize it */
|
||||||
RtlZeroMemory(ResourceList, sizeof(CM_RESOURCE_LIST));
|
RtlZeroMemory(ResourceList, sizeof(CM_RESOURCE_LIST));
|
||||||
ResourceList->Count = 1;
|
ResourceList->Count = 1;
|
||||||
|
@ -432,7 +432,7 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
||||||
else if (DeviceExtension->PdoType == WdPdo)
|
else if (DeviceExtension->PdoType == WdPdo)
|
||||||
{
|
{
|
||||||
/* Watchdog doesn't */
|
/* Watchdog doesn't */
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -448,7 +448,7 @@ HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Only the ACPI PDO has requirements */
|
/* Only the ACPI PDO has requirements */
|
||||||
if (DeviceExtension->PdoType == AcpiPdo)
|
if (DeviceExtension->PdoType == AcpiPdo)
|
||||||
{
|
{
|
||||||
|
@ -458,7 +458,7 @@ HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject,
|
||||||
else if (DeviceExtension->PdoType == WdPdo)
|
else if (DeviceExtension->PdoType == WdPdo)
|
||||||
{
|
{
|
||||||
/* Watchdog doesn't */
|
/* Watchdog doesn't */
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -478,7 +478,7 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PWCHAR CurrentId;
|
PWCHAR CurrentId;
|
||||||
WCHAR Id[100];
|
WCHAR Id[100];
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Length = 0;
|
SIZE_T Length = 0;
|
||||||
PWCHAR Buffer;
|
PWCHAR Buffer;
|
||||||
|
|
||||||
/* Get the PDO type */
|
/* Get the PDO type */
|
||||||
|
@ -491,7 +491,7 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
case BusQueryDeviceID:
|
case BusQueryDeviceID:
|
||||||
case BusQueryHardwareIDs:
|
case BusQueryHardwareIDs:
|
||||||
|
|
||||||
/* What kind of PDO is this? */
|
/* What kind of PDO is this? */
|
||||||
if (PdoType == AcpiPdo)
|
if (PdoType == AcpiPdo)
|
||||||
{
|
{
|
||||||
|
@ -521,7 +521,7 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryInstanceID:
|
case BusQueryInstanceID:
|
||||||
|
|
||||||
/* Instance ID */
|
/* Instance ID */
|
||||||
|
@ -529,15 +529,15 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
|
RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
|
||||||
Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
|
Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryCompatibleIDs:
|
case BusQueryCompatibleIDs:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* We don't support anything else */
|
/* We don't support anything else */
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Allocate the buffer */
|
/* Allocate the buffer */
|
||||||
Buffer = ExAllocatePoolWithTag(PagedPool,
|
Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
Length + sizeof(UNICODE_NULL),
|
Length + sizeof(UNICODE_NULL),
|
||||||
|
@ -547,7 +547,7 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Copy the string and null-terminate it */
|
/* Copy the string and null-terminate it */
|
||||||
RtlCopyMemory(Buffer, Id, Length);
|
RtlCopyMemory(Buffer, Id, Length);
|
||||||
Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
|
Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||||
|
|
||||||
/* Return string */
|
/* Return string */
|
||||||
*BusQueryId = Buffer;
|
*BusQueryId = Buffer;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -558,11 +558,11 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Fail */
|
/* Fail */
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
|
HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
@ -570,10 +570,10 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
OUT PUSHORT *BusQueryId)
|
OUT PUSHORT *BusQueryId)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Length;
|
SIZE_T Length;
|
||||||
PWCHAR Id;
|
PWCHAR Id;
|
||||||
PWCHAR Buffer;
|
PWCHAR Buffer;
|
||||||
|
|
||||||
/* What kind of ID is being requested? */
|
/* What kind of ID is being requested? */
|
||||||
DPRINT("ID: %d\n", IdType);
|
DPRINT("ID: %d\n", IdType);
|
||||||
switch (IdType)
|
switch (IdType)
|
||||||
|
@ -584,26 +584,26 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryHardwareIDs:
|
case BusQueryHardwareIDs:
|
||||||
|
|
||||||
/* This is our hardware ID */
|
/* This is our hardware ID */
|
||||||
Id = HalHardwareIdString;
|
Id = HalHardwareIdString;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryInstanceID:
|
case BusQueryInstanceID:
|
||||||
|
|
||||||
/* And our instance ID */
|
/* And our instance ID */
|
||||||
Id = L"0";
|
Id = L"0";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* We don't support anything else */
|
/* We don't support anything else */
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the length */
|
/* Calculate the length */
|
||||||
Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
|
Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
|
||||||
|
|
||||||
/* Allocate the buffer */
|
/* Allocate the buffer */
|
||||||
Buffer = ExAllocatePoolWithTag(PagedPool,
|
Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
Length + sizeof(UNICODE_NULL),
|
Length + sizeof(UNICODE_NULL),
|
||||||
|
@ -639,12 +639,12 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PFDO_EXTENSION FdoExtension;
|
PFDO_EXTENSION FdoExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UCHAR Minor;
|
UCHAR Minor;
|
||||||
|
|
||||||
/* Get the device extension and stack location */
|
/* Get the device extension and stack location */
|
||||||
FdoExtension = DeviceObject->DeviceExtension;
|
FdoExtension = DeviceObject->DeviceExtension;
|
||||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||||
Minor = IoStackLocation->MinorFunction;
|
Minor = IoStackLocation->MinorFunction;
|
||||||
|
|
||||||
/* FDO? */
|
/* FDO? */
|
||||||
if (FdoExtension->ExtensionType == FdoExtensionType)
|
if (FdoExtension->ExtensionType == FdoExtensionType)
|
||||||
{
|
{
|
||||||
|
@ -652,14 +652,14 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||||
switch (Minor)
|
switch (Minor)
|
||||||
{
|
{
|
||||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying device relations for FDO\n");
|
DPRINT("Querying device relations for FDO\n");
|
||||||
Status = HalpQueryDeviceRelations(DeviceObject,
|
Status = HalpQueryDeviceRelations(DeviceObject,
|
||||||
IoStackLocation->Parameters.QueryDeviceRelations.Type,
|
IoStackLocation->Parameters.QueryDeviceRelations.Type,
|
||||||
(PVOID)&Irp->IoStatus.Information);
|
(PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_INTERFACE:
|
case IRP_MN_QUERY_INTERFACE:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
|
@ -672,27 +672,27 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IoStackLocation->Parameters.QueryInterface.Interface,
|
IoStackLocation->Parameters.QueryInterface.Interface,
|
||||||
(PVOID)&Irp->IoStatus.Information);
|
(PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case IRP_MN_QUERY_ID:
|
case IRP_MN_QUERY_ID:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying ID for FDO\n");
|
DPRINT("Querying ID for FDO\n");
|
||||||
Status = HalpQueryIdFdo(DeviceObject,
|
Status = HalpQueryIdFdo(DeviceObject,
|
||||||
IoStackLocation->Parameters.QueryId.IdType,
|
IoStackLocation->Parameters.QueryId.IdType,
|
||||||
(PVOID)&Irp->IoStatus.Information);
|
(PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_CAPABILITIES:
|
case IRP_MN_QUERY_CAPABILITIES:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying the capabilities for the FDO\n");
|
DPRINT("Querying the capabilities for the FDO\n");
|
||||||
Status = HalpQueryCapabilities(DeviceObject,
|
Status = HalpQueryCapabilities(DeviceObject,
|
||||||
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
|
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
DPRINT("Other IRP: %lx\n", Minor);
|
DPRINT("Other IRP: %lx\n", Minor);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
break;
|
break;
|
||||||
|
@ -711,41 +711,41 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Query the IRP type */
|
/* Query the IRP type */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
switch (Minor)
|
switch (Minor)
|
||||||
{
|
{
|
||||||
case IRP_MN_START_DEVICE:
|
case IRP_MN_START_DEVICE:
|
||||||
|
|
||||||
/* We only care about a PCI PDO */
|
/* We only care about a PCI PDO */
|
||||||
DPRINT1("Start device received\n");
|
DPRINT1("Start device received\n");
|
||||||
/* Complete the IRP normally */
|
/* Complete the IRP normally */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_REMOVE_DEVICE:
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
|
|
||||||
/* Check if this is a PCI device */
|
/* Check if this is a PCI device */
|
||||||
DPRINT1("Remove device received\n");
|
DPRINT1("Remove device received\n");
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_SURPRISE_REMOVAL:
|
case IRP_MN_SURPRISE_REMOVAL:
|
||||||
|
|
||||||
/* Inherit whatever status we had */
|
/* Inherit whatever status we had */
|
||||||
DPRINT1("Surprise removal IRP\n");
|
DPRINT1("Surprise removal IRP\n");
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
|
|
||||||
/* Query the device relations */
|
/* Query the device relations */
|
||||||
DPRINT("Querying PDO relations\n");
|
DPRINT("Querying PDO relations\n");
|
||||||
Status = HalpQueryDeviceRelations(DeviceObject,
|
Status = HalpQueryDeviceRelations(DeviceObject,
|
||||||
IoStackLocation->Parameters.QueryDeviceRelations.Type,
|
IoStackLocation->Parameters.QueryDeviceRelations.Type,
|
||||||
(PVOID)&Irp->IoStatus.Information);
|
(PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_INTERFACE:
|
case IRP_MN_QUERY_INTERFACE:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying interface for PDO\n");
|
DPRINT("Querying interface for PDO\n");
|
||||||
Status = HalpQueryInterface(DeviceObject,
|
Status = HalpQueryInterface(DeviceObject,
|
||||||
|
@ -756,24 +756,24 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IoStackLocation->Parameters.QueryInterface.Interface,
|
IoStackLocation->Parameters.QueryInterface.Interface,
|
||||||
(PVOID)&Irp->IoStatus.Information);
|
(PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_CAPABILITIES:
|
case IRP_MN_QUERY_CAPABILITIES:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying the capabilities for the PDO\n");
|
DPRINT("Querying the capabilities for the PDO\n");
|
||||||
Status = HalpQueryCapabilities(DeviceObject,
|
Status = HalpQueryCapabilities(DeviceObject,
|
||||||
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
|
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_RESOURCES:
|
case IRP_MN_QUERY_RESOURCES:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying the resources for the PDO\n");
|
DPRINT("Querying the resources for the PDO\n");
|
||||||
Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
|
Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Querying the resource requirements for the PDO\n");
|
DPRINT("Querying the resource requirements for the PDO\n");
|
||||||
Status = HalpQueryResourceRequirements(DeviceObject,
|
Status = HalpQueryResourceRequirements(DeviceObject,
|
||||||
|
@ -781,25 +781,25 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_ID:
|
case IRP_MN_QUERY_ID:
|
||||||
|
|
||||||
/* Call the worker */
|
/* Call the worker */
|
||||||
DPRINT("Query the ID for the PDO\n");
|
DPRINT("Query the ID for the PDO\n");
|
||||||
Status = HalpQueryIdPdo(DeviceObject,
|
Status = HalpQueryIdPdo(DeviceObject,
|
||||||
IoStackLocation->Parameters.QueryId.IdType,
|
IoStackLocation->Parameters.QueryId.IdType,
|
||||||
(PVOID)&Irp->IoStatus.Information);
|
(PVOID)&Irp->IoStatus.Information);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* We don't handle anything else, so inherit the old state */
|
/* We don't handle anything else, so inherit the old state */
|
||||||
DPRINT("Illegal IRP: %lx\n", Minor);
|
DPRINT("Illegal IRP: %lx\n", Minor);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's not supported, inherit the old status */
|
/* If it's not supported, inherit the old status */
|
||||||
if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
|
if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
|
||||||
|
|
||||||
/* Complete the IRP */
|
/* Complete the IRP */
|
||||||
DPRINT("IRP completed with status: %lx\n", Status);
|
DPRINT("IRP completed with status: %lx\n", Status);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
@ -815,7 +815,7 @@ HalpDispatchWmi(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
DPRINT1("HAL: PnP Driver WMI!\n");
|
DPRINT1("HAL: PnP Driver WMI!\n");
|
||||||
while (TRUE);
|
while (TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -824,7 +824,7 @@ HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
DPRINT1("HAL: PnP Driver Power!\n");
|
DPRINT1("HAL: PnP Driver Power!\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -890,7 +890,7 @@ HaliInitPnpDriver(VOID)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING DriverString;
|
UNICODE_STRING DriverString;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Create the driver */
|
/* Create the driver */
|
||||||
RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
|
RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
|
||||||
Status = IoCreateDriver(&DriverString, HalpDriverEntry);
|
Status = IoCreateDriver(&DriverString, HalpDriverEntry);
|
||||||
|
|
|
@ -309,7 +309,7 @@ HalpGrowMapBuffers(IN PADAPTER_OBJECT AdapterObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlClearBit(AdapterObject->MapRegisters,
|
RtlClearBit(AdapterObject->MapRegisters,
|
||||||
CurrentEntry - AdapterObject->MapRegisterBase);
|
(ULONG)(CurrentEntry - AdapterObject->MapRegisterBase));
|
||||||
CurrentEntry->VirtualAddress = VirtualAddress;
|
CurrentEntry->VirtualAddress = VirtualAddress;
|
||||||
CurrentEntry->PhysicalAddress = PhysicalAddress;
|
CurrentEntry->PhysicalAddress = PhysicalAddress;
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ HalpDmaInitializeEisaAdapter(IN PADAPTER_OBJECT AdapterObject,
|
||||||
{
|
{
|
||||||
/* Set the Request Data */
|
/* Set the Request Data */
|
||||||
WRITE_PORT_UCHAR(&((PDMA1_CONTROL)AdapterBaseVa)->Mode, DmaMode.Byte);
|
WRITE_PORT_UCHAR(&((PDMA1_CONTROL)AdapterBaseVa)->Mode, DmaMode.Byte);
|
||||||
|
|
||||||
/* Unmask DMA Channel */
|
/* Unmask DMA Channel */
|
||||||
WRITE_PORT_UCHAR(&((PDMA1_CONTROL)AdapterBaseVa)->SingleMask,
|
WRITE_PORT_UCHAR(&((PDMA1_CONTROL)AdapterBaseVa)->SingleMask,
|
||||||
AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
||||||
|
@ -562,7 +562,7 @@ HalpDmaInitializeEisaAdapter(IN PADAPTER_OBJECT AdapterObject,
|
||||||
{
|
{
|
||||||
/* Set the Request Data */
|
/* Set the Request Data */
|
||||||
WRITE_PORT_UCHAR(&((PDMA2_CONTROL)AdapterBaseVa)->Mode, DmaMode.Byte);
|
WRITE_PORT_UCHAR(&((PDMA2_CONTROL)AdapterBaseVa)->Mode, DmaMode.Byte);
|
||||||
|
|
||||||
/* Unmask DMA Channel */
|
/* Unmask DMA Channel */
|
||||||
WRITE_PORT_UCHAR(&((PDMA2_CONTROL)AdapterBaseVa)->SingleMask,
|
WRITE_PORT_UCHAR(&((PDMA2_CONTROL)AdapterBaseVa)->SingleMask,
|
||||||
AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
||||||
|
@ -917,7 +917,7 @@ typedef struct _SCATTER_GATHER_CONTEXT {
|
||||||
ULONG MapRegisterCount;
|
ULONG MapRegisterCount;
|
||||||
BOOLEAN WriteToDevice;
|
BOOLEAN WriteToDevice;
|
||||||
} SCATTER_GATHER_CONTEXT, *PSCATTER_GATHER_CONTEXT;
|
} SCATTER_GATHER_CONTEXT, *PSCATTER_GATHER_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
IO_ALLOCATION_ACTION
|
IO_ALLOCATION_ACTION
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -932,10 +932,10 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
SCATTER_GATHER_ELEMENT TempElements[MAX_SG_ELEMENTS];
|
SCATTER_GATHER_ELEMENT TempElements[MAX_SG_ELEMENTS];
|
||||||
ULONG ElementCount = 0, RemainingLength = AdapterControlContext->Length;
|
ULONG ElementCount = 0, RemainingLength = AdapterControlContext->Length;
|
||||||
PUCHAR CurrentVa = AdapterControlContext->CurrentVa;
|
PUCHAR CurrentVa = AdapterControlContext->CurrentVa;
|
||||||
|
|
||||||
/* Store the map register base for later in HalPutScatterGatherList */
|
/* Store the map register base for later in HalPutScatterGatherList */
|
||||||
AdapterControlContext->MapRegisterBase = MapRegisterBase;
|
AdapterControlContext->MapRegisterBase = MapRegisterBase;
|
||||||
|
|
||||||
while (RemainingLength > 0 && ElementCount < MAX_SG_ELEMENTS)
|
while (RemainingLength > 0 && ElementCount < MAX_SG_ELEMENTS)
|
||||||
{
|
{
|
||||||
TempElements[ElementCount].Length = RemainingLength;
|
TempElements[ElementCount].Length = RemainingLength;
|
||||||
|
@ -948,16 +948,16 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
AdapterControlContext->WriteToDevice);
|
AdapterControlContext->WriteToDevice);
|
||||||
if (TempElements[ElementCount].Length == 0)
|
if (TempElements[ElementCount].Length == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
DPRINT("Allocated one S/G element: 0x%I64u with length: 0x%x\n",
|
DPRINT("Allocated one S/G element: 0x%I64u with length: 0x%x\n",
|
||||||
TempElements[ElementCount].Address.QuadPart,
|
TempElements[ElementCount].Address.QuadPart,
|
||||||
TempElements[ElementCount].Length);
|
TempElements[ElementCount].Length);
|
||||||
|
|
||||||
ASSERT(TempElements[ElementCount].Length <= RemainingLength);
|
ASSERT(TempElements[ElementCount].Length <= RemainingLength);
|
||||||
RemainingLength -= TempElements[ElementCount].Length;
|
RemainingLength -= TempElements[ElementCount].Length;
|
||||||
ElementCount++;
|
ElementCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RemainingLength > 0)
|
if (RemainingLength > 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Scatter/gather list construction failed!\n");
|
DPRINT1("Scatter/gather list construction failed!\n");
|
||||||
|
@ -974,14 +974,14 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
RtlCopyMemory(ScatterGatherList->Elements,
|
RtlCopyMemory(ScatterGatherList->Elements,
|
||||||
TempElements,
|
TempElements,
|
||||||
sizeof(SCATTER_GATHER_ELEMENT) * ElementCount);
|
sizeof(SCATTER_GATHER_ELEMENT) * ElementCount);
|
||||||
|
|
||||||
DPRINT("Initiating S/G DMA with %d element(s)\n", ElementCount);
|
DPRINT("Initiating S/G DMA with %d element(s)\n", ElementCount);
|
||||||
|
|
||||||
AdapterControlContext->AdapterListControlRoutine(DeviceObject,
|
AdapterControlContext->AdapterListControlRoutine(DeviceObject,
|
||||||
Irp,
|
Irp,
|
||||||
ScatterGatherList,
|
ScatterGatherList,
|
||||||
AdapterControlContext->AdapterListControlContext);
|
AdapterControlContext->AdapterListControlContext);
|
||||||
|
|
||||||
return DeallocateObjectKeepRegisters;
|
return DeallocateObjectKeepRegisters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,10 +1025,10 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN BOOLEAN WriteToDevice)
|
IN BOOLEAN WriteToDevice)
|
||||||
{
|
{
|
||||||
PSCATTER_GATHER_CONTEXT AdapterControlContext;
|
PSCATTER_GATHER_CONTEXT AdapterControlContext;
|
||||||
|
|
||||||
AdapterControlContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(SCATTER_GATHER_CONTEXT), TAG_DMA);
|
AdapterControlContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(SCATTER_GATHER_CONTEXT), TAG_DMA);
|
||||||
if (!AdapterControlContext) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!AdapterControlContext) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
AdapterControlContext->AdapterObject = AdapterObject;
|
AdapterControlContext->AdapterObject = AdapterObject;
|
||||||
AdapterControlContext->Mdl = Mdl;
|
AdapterControlContext->Mdl = Mdl;
|
||||||
AdapterControlContext->CurrentVa = CurrentVa;
|
AdapterControlContext->CurrentVa = CurrentVa;
|
||||||
|
@ -1037,7 +1037,7 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
AdapterControlContext->AdapterListControlRoutine = ExecutionRoutine;
|
AdapterControlContext->AdapterListControlRoutine = ExecutionRoutine;
|
||||||
AdapterControlContext->AdapterListControlContext = Context;
|
AdapterControlContext->AdapterListControlContext = Context;
|
||||||
AdapterControlContext->WriteToDevice = WriteToDevice;
|
AdapterControlContext->WriteToDevice = WriteToDevice;
|
||||||
|
|
||||||
return IoAllocateAdapterChannel(AdapterObject,
|
return IoAllocateAdapterChannel(AdapterObject,
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
AdapterControlContext->MapRegisterCount,
|
AdapterControlContext->MapRegisterCount,
|
||||||
|
@ -1071,7 +1071,7 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PSCATTER_GATHER_CONTEXT AdapterControlContext = (PSCATTER_GATHER_CONTEXT)ScatterGather->Reserved;
|
PSCATTER_GATHER_CONTEXT AdapterControlContext = (PSCATTER_GATHER_CONTEXT)ScatterGather->Reserved;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
for (i = 0; i < ScatterGather->NumberOfElements; i++)
|
for (i = 0; i < ScatterGather->NumberOfElements; i++)
|
||||||
{
|
{
|
||||||
IoFlushAdapterBuffers(AdapterObject,
|
IoFlushAdapterBuffers(AdapterObject,
|
||||||
|
@ -1086,9 +1086,9 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IoFreeMapRegisters(AdapterObject,
|
IoFreeMapRegisters(AdapterObject,
|
||||||
AdapterControlContext->MapRegisterBase,
|
AdapterControlContext->MapRegisterBase,
|
||||||
AdapterControlContext->MapRegisterCount);
|
AdapterControlContext->MapRegisterCount);
|
||||||
|
|
||||||
DPRINT("S/G DMA has finished!\n");
|
DPRINT("S/G DMA has finished!\n");
|
||||||
|
|
||||||
ExFreePoolWithTag(AdapterControlContext, TAG_DMA);
|
ExFreePoolWithTag(AdapterControlContext, TAG_DMA);
|
||||||
ExFreePoolWithTag(ScatterGather, TAG_DMA);
|
ExFreePoolWithTag(ScatterGather, TAG_DMA);
|
||||||
}
|
}
|
||||||
|
@ -1141,10 +1141,10 @@ HalReadDmaCounter(IN PADAPTER_OBJECT AdapterObject)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
OldCount = Count;
|
OldCount = Count;
|
||||||
|
|
||||||
/* Send Reset */
|
/* Send Reset */
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->ClearBytePointer, 0);
|
WRITE_PORT_UCHAR(&DmaControl1->ClearBytePointer, 0);
|
||||||
|
|
||||||
/* Read Count */
|
/* Read Count */
|
||||||
Count = READ_PORT_UCHAR(&DmaControl1->DmaAddressCount
|
Count = READ_PORT_UCHAR(&DmaControl1->DmaAddressCount
|
||||||
[AdapterObject->ChannelNumber].DmaBaseCount);
|
[AdapterObject->ChannelNumber].DmaBaseCount);
|
||||||
|
@ -1160,10 +1160,10 @@ HalReadDmaCounter(IN PADAPTER_OBJECT AdapterObject)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
OldCount = Count;
|
OldCount = Count;
|
||||||
|
|
||||||
/* Send Reset */
|
/* Send Reset */
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->ClearBytePointer, 0);
|
WRITE_PORT_UCHAR(&DmaControl2->ClearBytePointer, 0);
|
||||||
|
|
||||||
/* Read Count */
|
/* Read Count */
|
||||||
Count = READ_PORT_UCHAR(&DmaControl2->DmaAddressCount
|
Count = READ_PORT_UCHAR(&DmaControl2->DmaAddressCount
|
||||||
[AdapterObject->ChannelNumber].DmaBaseCount);
|
[AdapterObject->ChannelNumber].DmaBaseCount);
|
||||||
|
@ -1327,7 +1327,7 @@ HalAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject,
|
||||||
if (Index == MAXULONG)
|
if (Index == MAXULONG)
|
||||||
{
|
{
|
||||||
InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue);
|
InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue);
|
||||||
|
|
||||||
WorkItem = ExAllocatePoolWithTag(NonPagedPool,
|
WorkItem = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
sizeof(GROW_WORK_ITEM),
|
sizeof(GROW_WORK_ITEM),
|
||||||
TAG_DMA);
|
TAG_DMA);
|
||||||
|
@ -1439,7 +1439,7 @@ IoFreeAdapterChannel(IN PADAPTER_OBJECT AdapterObject)
|
||||||
|
|
||||||
DeviceQueueEntry = KeRemoveDeviceQueue(&AdapterObject->ChannelWaitQueue);
|
DeviceQueueEntry = KeRemoveDeviceQueue(&AdapterObject->ChannelWaitQueue);
|
||||||
if (!DeviceQueueEntry) break;
|
if (!DeviceQueueEntry) break;
|
||||||
|
|
||||||
WaitContextBlock = CONTAINING_RECORD(DeviceQueueEntry,
|
WaitContextBlock = CONTAINING_RECORD(DeviceQueueEntry,
|
||||||
WAIT_CONTEXT_BLOCK,
|
WAIT_CONTEXT_BLOCK,
|
||||||
WaitQueueEntry);
|
WaitQueueEntry);
|
||||||
|
@ -1547,7 +1547,7 @@ IoFreeMapRegisters(IN PADAPTER_OBJECT AdapterObject,
|
||||||
|
|
||||||
RealMapRegisterBase = (PROS_MAP_REGISTER_ENTRY)((ULONG_PTR)MapRegisterBase & ~MAP_BASE_SW_SG);
|
RealMapRegisterBase = (PROS_MAP_REGISTER_ENTRY)((ULONG_PTR)MapRegisterBase & ~MAP_BASE_SW_SG);
|
||||||
RtlClearBits(MasterAdapter->MapRegisters,
|
RtlClearBits(MasterAdapter->MapRegisters,
|
||||||
RealMapRegisterBase - MasterAdapter->MapRegisterBase,
|
(ULONG)(RealMapRegisterBase - MasterAdapter->MapRegisterBase),
|
||||||
NumberOfMapRegisters);
|
NumberOfMapRegisters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1593,12 +1593,12 @@ IoFreeMapRegisters(IN PADAPTER_OBJECT AdapterObject,
|
||||||
{
|
{
|
||||||
KeAcquireSpinLock(&MasterAdapter->SpinLock, &OldIrql);
|
KeAcquireSpinLock(&MasterAdapter->SpinLock, &OldIrql);
|
||||||
RtlClearBits(MasterAdapter->MapRegisters,
|
RtlClearBits(MasterAdapter->MapRegisters,
|
||||||
AdapterObject->MapRegisterBase -
|
(ULONG)(AdapterObject->MapRegisterBase -
|
||||||
MasterAdapter->MapRegisterBase,
|
MasterAdapter->MapRegisterBase),
|
||||||
AdapterObject->NumberOfMapRegisters);
|
AdapterObject->NumberOfMapRegisters);
|
||||||
KeReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql);
|
KeReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
IoFreeAdapterChannel(AdapterObject);
|
IoFreeAdapterChannel(AdapterObject);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2011,16 +2011,16 @@ IoMapTransfer(IN PADAPTER_OBJECT AdapterObject,
|
||||||
|
|
||||||
/* Reset Register */
|
/* Reset Register */
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->ClearBytePointer, 0);
|
WRITE_PORT_UCHAR(&DmaControl1->ClearBytePointer, 0);
|
||||||
|
|
||||||
/* Set the Mode */
|
/* Set the Mode */
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->Mode, AdapterMode.Byte);
|
WRITE_PORT_UCHAR(&DmaControl1->Mode, AdapterMode.Byte);
|
||||||
|
|
||||||
/* Set the Offset Register */
|
/* Set the Offset Register */
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
||||||
(UCHAR)(TransferOffset));
|
(UCHAR)(TransferOffset));
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
||||||
(UCHAR)(TransferOffset >> 8));
|
(UCHAR)(TransferOffset >> 8));
|
||||||
|
|
||||||
/* Set the Page Register */
|
/* Set the Page Register */
|
||||||
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController1Pages),
|
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController1Pages),
|
||||||
(UCHAR)(PhysicalAddress.LowPart >> 16));
|
(UCHAR)(PhysicalAddress.LowPart >> 16));
|
||||||
|
@ -2029,13 +2029,13 @@ IoMapTransfer(IN PADAPTER_OBJECT AdapterObject,
|
||||||
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController2Pages),
|
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController2Pages),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the Length */
|
/* Set the Length */
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
||||||
(UCHAR)(TransferLength - 1));
|
(UCHAR)(TransferLength - 1));
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
WRITE_PORT_UCHAR(&DmaControl1->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
||||||
(UCHAR)((TransferLength - 1) >> 8));
|
(UCHAR)((TransferLength - 1) >> 8));
|
||||||
|
|
||||||
/* Unmask the Channel */
|
/* Unmask the Channel */
|
||||||
WRITE_PORT_UCHAR(&DmaControl1->SingleMask, AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
WRITE_PORT_UCHAR(&DmaControl1->SingleMask, AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
||||||
}
|
}
|
||||||
|
@ -2045,16 +2045,16 @@ IoMapTransfer(IN PADAPTER_OBJECT AdapterObject,
|
||||||
|
|
||||||
/* Reset Register */
|
/* Reset Register */
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->ClearBytePointer, 0);
|
WRITE_PORT_UCHAR(&DmaControl2->ClearBytePointer, 0);
|
||||||
|
|
||||||
/* Set the Mode */
|
/* Set the Mode */
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->Mode, AdapterMode.Byte);
|
WRITE_PORT_UCHAR(&DmaControl2->Mode, AdapterMode.Byte);
|
||||||
|
|
||||||
/* Set the Offset Register */
|
/* Set the Offset Register */
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
||||||
(UCHAR)(TransferOffset));
|
(UCHAR)(TransferOffset));
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseAddress,
|
||||||
(UCHAR)(TransferOffset >> 8));
|
(UCHAR)(TransferOffset >> 8));
|
||||||
|
|
||||||
/* Set the Page Register */
|
/* Set the Page Register */
|
||||||
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController1Pages),
|
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController1Pages),
|
||||||
(UCHAR)(PhysicalAddress.u.LowPart >> 16));
|
(UCHAR)(PhysicalAddress.u.LowPart >> 16));
|
||||||
|
@ -2063,13 +2063,13 @@ IoMapTransfer(IN PADAPTER_OBJECT AdapterObject,
|
||||||
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController2Pages),
|
WRITE_PORT_UCHAR(AdapterObject->PagePort + FIELD_OFFSET(EISA_CONTROL, DmaController2Pages),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the Length */
|
/* Set the Length */
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
||||||
(UCHAR)(TransferLength - 1));
|
(UCHAR)(TransferLength - 1));
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
WRITE_PORT_UCHAR(&DmaControl2->DmaAddressCount[AdapterObject->ChannelNumber].DmaBaseCount,
|
||||||
(UCHAR)((TransferLength - 1) >> 8));
|
(UCHAR)((TransferLength - 1) >> 8));
|
||||||
|
|
||||||
/* Unmask the Channel */
|
/* Unmask the Channel */
|
||||||
WRITE_PORT_UCHAR(&DmaControl2->SingleMask,
|
WRITE_PORT_UCHAR(&DmaControl2->SingleMask,
|
||||||
AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
AdapterObject->ChannelNumber | DMA_CLEARMASK);
|
||||||
|
|
|
@ -31,21 +31,21 @@ HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
IN PFN_NUMBER PageCount,
|
IN PFN_NUMBER PageCount,
|
||||||
IN BOOLEAN Aligned)
|
IN BOOLEAN Aligned)
|
||||||
{
|
{
|
||||||
ULONG UsedDescriptors, Alignment;
|
ULONG UsedDescriptors;
|
||||||
ULONG_PTR PhysicalAddress;
|
ULONG_PTR PhysicalAddress;
|
||||||
PFN_NUMBER MaxPage, BasePage;
|
PFN_NUMBER MaxPage, BasePage, Alignment;
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock, NewBlock, FreeBlock;
|
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock, NewBlock, FreeBlock;
|
||||||
|
|
||||||
/* Highest page we'll go */
|
/* Highest page we'll go */
|
||||||
MaxPage = MaxAddress >> PAGE_SHIFT;
|
MaxPage = MaxAddress >> PAGE_SHIFT;
|
||||||
|
|
||||||
/* We need at least two blocks */
|
/* We need at least two blocks */
|
||||||
if ((HalpUsedAllocDescriptors + 2) > 64) return 0;
|
if ((HalpUsedAllocDescriptors + 2) > 64) return 0;
|
||||||
|
|
||||||
/* Remember how many we have now */
|
/* Remember how many we have now */
|
||||||
UsedDescriptors = HalpUsedAllocDescriptors;
|
UsedDescriptors = HalpUsedAllocDescriptors;
|
||||||
|
|
||||||
/* Loop the loader block memory descriptors */
|
/* Loop the loader block memory descriptors */
|
||||||
NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
|
NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
|
||||||
while (NextEntry != &LoaderBlock->MemoryDescriptorListHead)
|
while (NextEntry != &LoaderBlock->MemoryDescriptorListHead)
|
||||||
|
@ -54,13 +54,13 @@ HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
MdBlock = CONTAINING_RECORD(NextEntry,
|
MdBlock = CONTAINING_RECORD(NextEntry,
|
||||||
MEMORY_ALLOCATION_DESCRIPTOR,
|
MEMORY_ALLOCATION_DESCRIPTOR,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
|
|
||||||
/* No alignment by default */
|
/* No alignment by default */
|
||||||
Alignment = 0;
|
Alignment = 0;
|
||||||
|
|
||||||
/* Unless requested, in which case we use a 64KB block alignment */
|
/* Unless requested, in which case we use a 64KB block alignment */
|
||||||
if (Aligned) Alignment = ((MdBlock->BasePage + 0x0F) & ~0x0F) - MdBlock->BasePage;
|
if (Aligned) Alignment = ((MdBlock->BasePage + 0x0F) & ~0x0F) - MdBlock->BasePage;
|
||||||
|
|
||||||
/* Search for free memory */
|
/* Search for free memory */
|
||||||
if ((MdBlock->MemoryType == LoaderFree) ||
|
if ((MdBlock->MemoryType == LoaderFree) ||
|
||||||
(MdBlock->MemoryType == LoaderFirmwareTemporary))
|
(MdBlock->MemoryType == LoaderFirmwareTemporary))
|
||||||
|
@ -71,30 +71,30 @@ HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
(MdBlock->PageCount >= PageCount + Alignment) &&
|
(MdBlock->PageCount >= PageCount + Alignment) &&
|
||||||
(BasePage + PageCount + Alignment < MaxPage))
|
(BasePage + PageCount + Alignment < MaxPage))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* We found an address */
|
/* We found an address */
|
||||||
PhysicalAddress = (BasePage + Alignment) << PAGE_SHIFT;
|
PhysicalAddress = (BasePage + Alignment) << PAGE_SHIFT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep trying */
|
/* Keep trying */
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't find anything, get out of here */
|
/* If we didn't find anything, get out of here */
|
||||||
if (NextEntry == &LoaderBlock->MemoryDescriptorListHead) return 0;
|
if (NextEntry == &LoaderBlock->MemoryDescriptorListHead) return 0;
|
||||||
|
|
||||||
/* Okay, now get a descriptor */
|
/* Okay, now get a descriptor */
|
||||||
NewBlock = &HalpAllocationDescriptorArray[HalpUsedAllocDescriptors];
|
NewBlock = &HalpAllocationDescriptorArray[HalpUsedAllocDescriptors];
|
||||||
NewBlock->PageCount = (ULONG)PageCount;
|
NewBlock->PageCount = (ULONG)PageCount;
|
||||||
NewBlock->BasePage = MdBlock->BasePage + Alignment;
|
NewBlock->BasePage = MdBlock->BasePage + Alignment;
|
||||||
NewBlock->MemoryType = LoaderHALCachedMemory;
|
NewBlock->MemoryType = LoaderHALCachedMemory;
|
||||||
|
|
||||||
/* Update count */
|
/* Update count */
|
||||||
UsedDescriptors++;
|
UsedDescriptors++;
|
||||||
HalpUsedAllocDescriptors = UsedDescriptors;
|
HalpUsedAllocDescriptors = UsedDescriptors;
|
||||||
|
|
||||||
/* Check if we had any alignment */
|
/* Check if we had any alignment */
|
||||||
if (Alignment)
|
if (Alignment)
|
||||||
{
|
{
|
||||||
|
@ -105,14 +105,14 @@ HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
FreeBlock = &HalpAllocationDescriptorArray[UsedDescriptors];
|
FreeBlock = &HalpAllocationDescriptorArray[UsedDescriptors];
|
||||||
FreeBlock->PageCount = MdBlock->PageCount - Alignment - (ULONG)PageCount;
|
FreeBlock->PageCount = MdBlock->PageCount - Alignment - (ULONG)PageCount;
|
||||||
FreeBlock->BasePage = MdBlock->BasePage + Alignment + (ULONG)PageCount;
|
FreeBlock->BasePage = MdBlock->BasePage + Alignment + (ULONG)PageCount;
|
||||||
|
|
||||||
/* One more */
|
/* One more */
|
||||||
HalpUsedAllocDescriptors++;
|
HalpUsedAllocDescriptors++;
|
||||||
|
|
||||||
/* Insert it into the list */
|
/* Insert it into the list */
|
||||||
InsertHeadList(&MdBlock->ListEntry, &FreeBlock->ListEntry);
|
InsertHeadList(&MdBlock->ListEntry, &FreeBlock->ListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trim the original block to the alignment only */
|
/* Trim the original block to the alignment only */
|
||||||
MdBlock->PageCount = Alignment;
|
MdBlock->PageCount = Alignment;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* Consume memory from this block */
|
/* Consume memory from this block */
|
||||||
MdBlock->BasePage += (ULONG)PageCount;
|
MdBlock->BasePage += (ULONG)PageCount;
|
||||||
MdBlock->PageCount -= (ULONG)PageCount;
|
MdBlock->PageCount -= (ULONG)PageCount;
|
||||||
|
|
||||||
/* Insert the descriptor before the original one */
|
/* Insert the descriptor before the original one */
|
||||||
InsertTailList(&MdBlock->ListEntry, &NewBlock->ListEntry);
|
InsertTailList(&MdBlock->ListEntry, &NewBlock->ListEntry);
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
PVOID
|
PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
|
HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
IN PFN_NUMBER PageCount)
|
IN PFN_COUNT PageCount)
|
||||||
{
|
{
|
||||||
PHARDWARE_PTE PointerPte;
|
PHARDWARE_PTE PointerPte;
|
||||||
PFN_NUMBER UsedPages = 0;
|
PFN_NUMBER UsedPages = 0;
|
||||||
|
@ -207,7 +207,7 @@ HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
|
HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
|
||||||
IN PFN_NUMBER PageCount)
|
IN PFN_COUNT PageCount)
|
||||||
{
|
{
|
||||||
PHARDWARE_PTE PointerPte;
|
PHARDWARE_PTE PointerPte;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
|
@ -47,7 +47,7 @@ HalpReportSerialNumber(VOID)
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
HalpSerialNumber,
|
HalpSerialNumber,
|
||||||
HalpSerialLen);
|
HalpSerialLen);
|
||||||
|
|
||||||
/* Close the handle */
|
/* Close the handle */
|
||||||
ZwClose(Handle);
|
ZwClose(Handle);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ HalpMarkAcpiHal(VOID)
|
||||||
HANDLE KeyHandle;
|
HANDLE KeyHandle;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
ULONG Value = HalDisableFirmwareMapper ? 1 : 0;
|
ULONG Value = HalDisableFirmwareMapper ? 1 : 0;
|
||||||
|
|
||||||
/* Open the control set key */
|
/* Open the control set key */
|
||||||
RtlInitUnicodeString(&KeyString,
|
RtlInitUnicodeString(&KeyString,
|
||||||
L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
|
L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
|
||||||
|
@ -79,7 +79,7 @@ HalpMarkAcpiHal(VOID)
|
||||||
TRUE);
|
TRUE);
|
||||||
/* Close root key */
|
/* Close root key */
|
||||||
ZwClose(Handle);
|
ZwClose(Handle);
|
||||||
|
|
||||||
/* Check if PNP BIOS key exists */
|
/* Check if PNP BIOS key exists */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -91,28 +91,28 @@ HalpMarkAcpiHal(VOID)
|
||||||
REG_DWORD,
|
REG_DWORD,
|
||||||
&Value,
|
&Value,
|
||||||
sizeof(Value));
|
sizeof(Value));
|
||||||
|
|
||||||
/* Close subkey */
|
/* Close subkey */
|
||||||
ZwClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpOpenRegistryKey(IN PHANDLE KeyHandle,
|
HalpOpenRegistryKey(IN PHANDLE KeyHandle,
|
||||||
IN HANDLE RootKey,
|
IN HANDLE RootKey,
|
||||||
IN PUNICODE_STRING KeyName,
|
IN PUNICODE_STRING KeyName,
|
||||||
IN ACCESS_MASK DesiredAccess,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
IN BOOLEAN Create)
|
IN BOOLEAN Create)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Disposition;
|
ULONG Disposition;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
|
||||||
/* Setup the attributes we received */
|
/* Setup the attributes we received */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
KeyName,
|
KeyName,
|
||||||
|
@ -137,7 +137,7 @@ HalpOpenRegistryKey(IN PHANDLE KeyHandle,
|
||||||
/* Open the key */
|
/* Open the key */
|
||||||
Status = ZwOpenKey(KeyHandle, DesiredAccess, &ObjectAttributes);
|
Status = ZwOpenKey(KeyHandle, DesiredAccess, &ObjectAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpFlushTLB(VOID)
|
HalpFlushTLB(VOID)
|
||||||
{
|
{
|
||||||
ULONG Flags, Cr4;
|
ULONG_PTR Flags, Cr4;
|
||||||
INT CpuInfo[4];
|
INT CpuInfo[4];
|
||||||
ULONG_PTR PageDirectory;
|
ULONG_PTR PageDirectory;
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ HalHandleNMI(IN PVOID NmiInfo)
|
||||||
//
|
//
|
||||||
// Fill the screen
|
// Fill the screen
|
||||||
//
|
//
|
||||||
InbvSolidColorFill(0, 0, 639, 479, 1);
|
InbvSolidColorFill(0, 0, 639, 479, 1);
|
||||||
InbvSetScrollRegion(0, 0, 639, 479);
|
InbvSetScrollRegion(0, 0, 639, 479);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
ULONG HalpSystemHardwareFlags;
|
ULONG_PTR HalpSystemHardwareFlags;
|
||||||
KSPIN_LOCK HalpSystemHardwareLock;
|
KSPIN_LOCK HalpSystemHardwareLock;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
@ -226,7 +226,7 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpAcquireCmosSpinLock(VOID)
|
HalpAcquireCmosSpinLock(VOID)
|
||||||
{
|
{
|
||||||
ULONG Flags;
|
ULONG_PTR Flags;
|
||||||
|
|
||||||
/* Get flags and disable interrupts */
|
/* Get flags and disable interrupts */
|
||||||
Flags = __readeflags();
|
Flags = __readeflags();
|
||||||
|
@ -243,7 +243,7 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpReleaseCmosSpinLock(VOID)
|
HalpReleaseCmosSpinLock(VOID)
|
||||||
{
|
{
|
||||||
ULONG Flags;
|
ULONG_PTR Flags;
|
||||||
|
|
||||||
/* Get the flags */
|
/* Get the flags */
|
||||||
Flags = HalpSystemHardwareFlags;
|
Flags = HalpSystemHardwareFlags;
|
||||||
|
|
|
@ -72,28 +72,28 @@ HalpGetResourceSortValue(IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
|
||||||
switch (Descriptor->Type)
|
switch (Descriptor->Type)
|
||||||
{
|
{
|
||||||
case CmResourceTypeInterrupt:
|
case CmResourceTypeInterrupt:
|
||||||
|
|
||||||
/* Interrupt goes by level */
|
/* Interrupt goes by level */
|
||||||
*Scale = 0;
|
*Scale = 0;
|
||||||
*Value = RtlConvertUlongToLargeInteger(Descriptor->u.Interrupt.Level);
|
*Value = RtlConvertUlongToLargeInteger(Descriptor->u.Interrupt.Level);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CmResourceTypePort:
|
case CmResourceTypePort:
|
||||||
|
|
||||||
/* Port goes by port address */
|
/* Port goes by port address */
|
||||||
*Scale = 1;
|
*Scale = 1;
|
||||||
*Value = Descriptor->u.Port.Start;
|
*Value = Descriptor->u.Port.Start;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CmResourceTypeMemory:
|
case CmResourceTypeMemory:
|
||||||
|
|
||||||
/* Memory goes by base address */
|
/* Memory goes by base address */
|
||||||
*Scale = 2;
|
*Scale = 2;
|
||||||
*Value = Descriptor->u.Memory.Start;
|
*Value = Descriptor->u.Memory.Start;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Anything else */
|
/* Anything else */
|
||||||
*Scale = 4;
|
*Scale = 4;
|
||||||
*Value = RtlConvertUlongToLargeInteger(0);
|
*Value = RtlConvertUlongToLargeInteger(0);
|
||||||
|
@ -111,7 +111,7 @@ HalpBuildPartialFromIdt(IN ULONG Entry,
|
||||||
/* Exclusive interrupt entry */
|
/* Exclusive interrupt entry */
|
||||||
RawDescriptor->Type = CmResourceTypeInterrupt;
|
RawDescriptor->Type = CmResourceTypeInterrupt;
|
||||||
RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||||
|
|
||||||
/* Check the interrupt type */
|
/* Check the interrupt type */
|
||||||
if (HalpIDTUsageFlags[Entry].Flags & IDT_LATCHED)
|
if (HalpIDTUsageFlags[Entry].Flags & IDT_LATCHED)
|
||||||
{
|
{
|
||||||
|
@ -127,13 +127,13 @@ HalpBuildPartialFromIdt(IN ULONG Entry,
|
||||||
/* Get vector and level from IDT usage */
|
/* Get vector and level from IDT usage */
|
||||||
RawDescriptor->u.Interrupt.Vector = HalpIDTUsage[Entry].BusReleativeVector;
|
RawDescriptor->u.Interrupt.Vector = HalpIDTUsage[Entry].BusReleativeVector;
|
||||||
RawDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].BusReleativeVector;
|
RawDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].BusReleativeVector;
|
||||||
|
|
||||||
/* Affinity is all the CPUs */
|
/* Affinity is all the CPUs */
|
||||||
RawDescriptor->u.Interrupt.Affinity = HalpActiveProcessors;
|
RawDescriptor->u.Interrupt.Affinity = HalpActiveProcessors;
|
||||||
|
|
||||||
/* The translated copy is identical */
|
/* The translated copy is identical */
|
||||||
RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
||||||
|
|
||||||
/* But the vector and IRQL must be set correctly */
|
/* But the vector and IRQL must be set correctly */
|
||||||
TranslatedDescriptor->u.Interrupt.Vector = Entry;
|
TranslatedDescriptor->u.Interrupt.Vector = Entry;
|
||||||
TranslatedDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].Irql;
|
TranslatedDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].Irql;
|
||||||
|
@ -149,11 +149,11 @@ HalpBuildPartialFromAddress(IN INTERFACE_TYPE Interface,
|
||||||
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
|
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
|
||||||
{
|
{
|
||||||
ULONG AddressSpace;
|
ULONG AddressSpace;
|
||||||
|
|
||||||
/* Set the type and make it exclusive */
|
/* Set the type and make it exclusive */
|
||||||
RawDescriptor->Type = CurrentAddress->Type;
|
RawDescriptor->Type = CurrentAddress->Type;
|
||||||
RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||||
|
|
||||||
/* Check what this is */
|
/* Check what this is */
|
||||||
if (RawDescriptor->Type == CmResourceTypePort)
|
if (RawDescriptor->Type == CmResourceTypePort)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ HalpBuildPartialFromAddress(IN INTERFACE_TYPE Interface,
|
||||||
RawDescriptor->u.Port.Start.HighPart = 0;
|
RawDescriptor->u.Port.Start.HighPart = 0;
|
||||||
RawDescriptor->u.Port.Start.LowPart = CurrentAddress->Element[Element].Start;
|
RawDescriptor->u.Port.Start.LowPart = CurrentAddress->Element[Element].Start;
|
||||||
RawDescriptor->u.Port.Length = CurrentAddress->Element[Element].Length;
|
RawDescriptor->u.Port.Length = CurrentAddress->Element[Element].Length;
|
||||||
|
|
||||||
/* Determine if 16-bit port addresses are allowed */
|
/* Determine if 16-bit port addresses are allowed */
|
||||||
RawDescriptor->Flags |= HalpIs16BitPortDecodeSupported();
|
RawDescriptor->Flags |= HalpIs16BitPortDecodeSupported();
|
||||||
}
|
}
|
||||||
|
@ -178,10 +178,10 @@ HalpBuildPartialFromAddress(IN INTERFACE_TYPE Interface,
|
||||||
RawDescriptor->u.Memory.Start.LowPart = CurrentAddress->Element[Element].Start;
|
RawDescriptor->u.Memory.Start.LowPart = CurrentAddress->Element[Element].Start;
|
||||||
RawDescriptor->u.Memory.Length = CurrentAddress->Element[Element].Length;
|
RawDescriptor->u.Memory.Length = CurrentAddress->Element[Element].Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make an identical copy to begin with */
|
/* Make an identical copy to begin with */
|
||||||
RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
||||||
|
|
||||||
/* Check what this is */
|
/* Check what this is */
|
||||||
if (RawDescriptor->Type == CmResourceTypePort)
|
if (RawDescriptor->Type == CmResourceTypePort)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ HalpBuildPartialFromAddress(IN INTERFACE_TYPE Interface,
|
||||||
RawDescriptor->u.Port.Start,
|
RawDescriptor->u.Port.Start,
|
||||||
&AddressSpace,
|
&AddressSpace,
|
||||||
&TranslatedDescriptor->u.Port.Start);
|
&TranslatedDescriptor->u.Port.Start);
|
||||||
|
|
||||||
/* If it turns out this is memory once translated, flag it */
|
/* If it turns out this is memory once translated, flag it */
|
||||||
if (AddressSpace == 0) TranslatedDescriptor->Flags = CM_RESOURCE_PORT_MEMORY;
|
if (AddressSpace == 0) TranslatedDescriptor->Flags = CM_RESOURCE_PORT_MEMORY;
|
||||||
|
|
||||||
|
@ -223,18 +223,18 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
ADDRESS_USAGE *CurrentAddress;
|
ADDRESS_USAGE *CurrentAddress;
|
||||||
LARGE_INTEGER CurrentSortValue, SortValue;
|
LARGE_INTEGER CurrentSortValue, SortValue;
|
||||||
DbgPrint("%wZ Detected\n", HalName);
|
DbgPrint("%wZ Detected\n", HalName);
|
||||||
|
|
||||||
/* Check if KD is using a COM port */
|
/* Check if KD is using a COM port */
|
||||||
if (KdComPortInUse)
|
if (KdComPortInUse)
|
||||||
{
|
{
|
||||||
/* Enter it into the I/O space */
|
/* Enter it into the I/O space */
|
||||||
HalpComIoSpace.Element[0].Start = (ULONG_PTR)KdComPortInUse;
|
HalpComIoSpace.Element[0].Start = PtrToUlong(KdComPortInUse);
|
||||||
HalpComIoSpace.Next = HalpAddressUsageList;
|
HalpComIoSpace.Next = HalpAddressUsageList;
|
||||||
HalpAddressUsageList = &HalpComIoSpace;
|
HalpAddressUsageList = &HalpComIoSpace;
|
||||||
|
|
||||||
/* Use the debug port table if we have one */
|
/* Use the debug port table if we have one */
|
||||||
HalpGetInfoFromACPI = HalpGetDebugPortTable();
|
HalpGetInfoFromACPI = HalpGetDebugPortTable();
|
||||||
|
|
||||||
/* Check if we're using ACPI */
|
/* Check if we're using ACPI */
|
||||||
if (!HalpGetInfoFromACPI)
|
if (!HalpGetInfoFromACPI)
|
||||||
{
|
{
|
||||||
|
@ -256,10 +256,10 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On non-ACPI systems, we need to build an address map */
|
/* On non-ACPI systems, we need to build an address map */
|
||||||
HalpBuildAddressMap();
|
HalpBuildAddressMap();
|
||||||
|
|
||||||
/* Allocate the master raw and translated lists */
|
/* Allocate the master raw and translated lists */
|
||||||
RawList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, ' laH');
|
RawList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, ' laH');
|
||||||
TranslatedList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, ' laH');
|
TranslatedList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, ' laH');
|
||||||
|
@ -272,14 +272,14 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
(ULONG_PTR)__FILE__,
|
(ULONG_PTR)__FILE__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero out the lists */
|
/* Zero out the lists */
|
||||||
RtlZeroMemory(RawList, PAGE_SIZE * 2);
|
RtlZeroMemory(RawList, PAGE_SIZE * 2);
|
||||||
RtlZeroMemory(TranslatedList, PAGE_SIZE * 2);
|
RtlZeroMemory(TranslatedList, PAGE_SIZE * 2);
|
||||||
|
|
||||||
/* Set the interface type to begin with */
|
/* Set the interface type to begin with */
|
||||||
RawList->List[0].InterfaceType = InterfaceTypeUndefined;
|
RawList->List[0].InterfaceType = InterfaceTypeUndefined;
|
||||||
|
|
||||||
/* Loop all IDT entries that are not IRQs */
|
/* Loop all IDT entries that are not IRQs */
|
||||||
for (i = 0; i < PRIMARY_VECTOR_BASE; i++)
|
for (i = 0; i < PRIMARY_VECTOR_BASE; i++)
|
||||||
{
|
{
|
||||||
|
@ -291,20 +291,20 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
HalpIDTUsage[i].BusReleativeVector = (UCHAR)i;
|
HalpIDTUsage[i].BusReleativeVector = (UCHAR)i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Our full raw descriptors start here */
|
/* Our full raw descriptors start here */
|
||||||
RawFull = RawList->List;
|
RawFull = RawList->List;
|
||||||
|
|
||||||
/* Keep track of the current partial raw and translated descriptors */
|
/* Keep track of the current partial raw and translated descriptors */
|
||||||
CurrentRaw = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)RawList->List;
|
CurrentRaw = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)RawList->List;
|
||||||
CurrentTranslated = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)TranslatedList->List;
|
CurrentTranslated = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)TranslatedList->List;
|
||||||
|
|
||||||
/* Do two passes */
|
/* Do two passes */
|
||||||
for (ReportType = 0; ReportType < 2; ReportType++)
|
for (ReportType = 0; ReportType < 2; ReportType++)
|
||||||
{
|
{
|
||||||
/* Pass 0 is for device usage */
|
/* Pass 0 is for device usage */
|
||||||
if (ReportType == 0)
|
if (ReportType == 0)
|
||||||
{
|
{
|
||||||
FlagMatch = IDT_DEVICE & ~IDT_REGISTERED;
|
FlagMatch = IDT_DEVICE & ~IDT_REGISTERED;
|
||||||
Interface = InterfaceType;
|
Interface = InterfaceType;
|
||||||
}
|
}
|
||||||
|
@ -314,10 +314,10 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
FlagMatch = IDT_INTERNAL & ~IDT_REGISTERED;
|
FlagMatch = IDT_INTERNAL & ~IDT_REGISTERED;
|
||||||
Interface = Internal;
|
Interface = Internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset loop variables */
|
/* Reset loop variables */
|
||||||
i = Element = 0;
|
i = Element = 0;
|
||||||
|
|
||||||
/* Start looping our address uage list and interrupts */
|
/* Start looping our address uage list and interrupts */
|
||||||
CurrentAddress = HalpAddressUsageList;
|
CurrentAddress = HalpAddressUsageList;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
@ -343,7 +343,7 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
{
|
{
|
||||||
/* This is an address instead */
|
/* This is an address instead */
|
||||||
if (!CurrentAddress) break;
|
if (!CurrentAddress) break;
|
||||||
|
|
||||||
/* Check if the address should be reported */
|
/* Check if the address should be reported */
|
||||||
if (!(CurrentAddress->Flags & FlagMatch) ||
|
if (!(CurrentAddress->Flags & FlagMatch) ||
|
||||||
!(CurrentAddress->Element[Element].Length))
|
!(CurrentAddress->Element[Element].Length))
|
||||||
|
@ -353,7 +353,7 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
CurrentAddress = CurrentAddress->Next;
|
CurrentAddress = CurrentAddress->Next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, parse the entry */
|
/* Otherwise, parse the entry */
|
||||||
HalpBuildPartialFromAddress(Interface,
|
HalpBuildPartialFromAddress(Interface,
|
||||||
CurrentAddress,
|
CurrentAddress,
|
||||||
|
@ -362,7 +362,7 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
&TranslatedPartial);
|
&TranslatedPartial);
|
||||||
Element++;
|
Element++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for interface change */
|
/* Check for interface change */
|
||||||
if (RawFull->InterfaceType != Interface)
|
if (RawFull->InterfaceType != Interface)
|
||||||
{
|
{
|
||||||
|
@ -373,67 +373,67 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
/* The full descriptor follows wherever we were */
|
/* The full descriptor follows wherever we were */
|
||||||
RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
|
RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
|
||||||
TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
|
TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
|
||||||
|
|
||||||
/* And it is of this new interface type */
|
/* And it is of this new interface type */
|
||||||
RawFull->InterfaceType = Interface;
|
RawFull->InterfaceType = Interface;
|
||||||
TranslatedFull->InterfaceType = Interface;
|
TranslatedFull->InterfaceType = Interface;
|
||||||
|
|
||||||
/* And its partial descriptors begin here */
|
/* And its partial descriptors begin here */
|
||||||
RawPartialList = &RawFull->PartialResourceList;
|
RawPartialList = &RawFull->PartialResourceList;
|
||||||
TranslatedPartialList = &TranslatedFull->PartialResourceList;
|
TranslatedPartialList = &TranslatedFull->PartialResourceList;
|
||||||
|
|
||||||
/* And our next full descriptor should follow here */
|
/* And our next full descriptor should follow here */
|
||||||
CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
|
CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
|
||||||
CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
|
CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have written a new partial descriptor */
|
/* We have written a new partial descriptor */
|
||||||
RawPartialList->Count++;
|
RawPartialList->Count++;
|
||||||
TranslatedPartialList->Count++;
|
TranslatedPartialList->Count++;
|
||||||
|
|
||||||
/* Copy our local descriptors into the actual list */
|
/* Copy our local descriptors into the actual list */
|
||||||
RtlCopyMemory(CurrentRaw, &RawPartial, sizeof(RawPartial));
|
RtlCopyMemory(CurrentRaw, &RawPartial, sizeof(RawPartial));
|
||||||
RtlCopyMemory(CurrentTranslated, &TranslatedPartial, sizeof(TranslatedPartial));
|
RtlCopyMemory(CurrentTranslated, &TranslatedPartial, sizeof(TranslatedPartial));
|
||||||
|
|
||||||
/* Move to the next partial descriptor */
|
/* Move to the next partial descriptor */
|
||||||
CurrentRaw++;
|
CurrentRaw++;
|
||||||
CurrentTranslated++;
|
CurrentTranslated++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the final list of the size for the kernel call later */
|
/* Get the final list of the size for the kernel call later */
|
||||||
ListSize = (ULONG_PTR)CurrentRaw - (ULONG_PTR)RawList;
|
ListSize = (ULONG)((ULONG_PTR)CurrentRaw - (ULONG_PTR)RawList);
|
||||||
|
|
||||||
/* Now reset back to the first full descriptor */
|
/* Now reset back to the first full descriptor */
|
||||||
RawFull = RawList->List;
|
RawFull = RawList->List;
|
||||||
TranslatedFull = TranslatedList->List;
|
TranslatedFull = TranslatedList->List;
|
||||||
|
|
||||||
/* And loop all the full descriptors */
|
/* And loop all the full descriptors */
|
||||||
for (i = 0; i < RawList->Count; i++)
|
for (i = 0; i < RawList->Count; i++)
|
||||||
{
|
{
|
||||||
/* Get the first partial descriptor in this list */
|
/* Get the first partial descriptor in this list */
|
||||||
CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
|
CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
|
||||||
CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
|
CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
|
||||||
|
|
||||||
/* Get the count of partials in this list */
|
/* Get the count of partials in this list */
|
||||||
Count = RawFull->PartialResourceList.Count;
|
Count = RawFull->PartialResourceList.Count;
|
||||||
|
|
||||||
/* Loop all the partials in this list */
|
/* Loop all the partials in this list */
|
||||||
for (j = 0; j < Count; j++)
|
for (j = 0; j < Count; j++)
|
||||||
{
|
{
|
||||||
/* Get the sort value at this point */
|
/* Get the sort value at this point */
|
||||||
HalpGetResourceSortValue(CurrentRaw, &CurrentScale, &CurrentSortValue);
|
HalpGetResourceSortValue(CurrentRaw, &CurrentScale, &CurrentSortValue);
|
||||||
|
|
||||||
/* Save the current sort pointer */
|
/* Save the current sort pointer */
|
||||||
SortedRaw = CurrentRaw;
|
SortedRaw = CurrentRaw;
|
||||||
SortedTranslated = CurrentTranslated;
|
SortedTranslated = CurrentTranslated;
|
||||||
|
|
||||||
/* Loop all descriptors starting from this one */
|
/* Loop all descriptors starting from this one */
|
||||||
for (k = j; k < Count; k++)
|
for (k = j; k < Count; k++)
|
||||||
{
|
{
|
||||||
/* Get the sort value at the sort point */
|
/* Get the sort value at the sort point */
|
||||||
HalpGetResourceSortValue(SortedRaw, &SortScale, &SortValue);
|
HalpGetResourceSortValue(SortedRaw, &SortScale, &SortValue);
|
||||||
|
|
||||||
/* Check if a swap needs to occur */
|
/* Check if a swap needs to occur */
|
||||||
if ((SortScale < CurrentScale) ||
|
if ((SortScale < CurrentScale) ||
|
||||||
((SortScale == CurrentScale) &&
|
((SortScale == CurrentScale) &&
|
||||||
|
@ -443,44 +443,44 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
RtlCopyMemory(&RawPartial, CurrentRaw, sizeof(RawPartial));
|
RtlCopyMemory(&RawPartial, CurrentRaw, sizeof(RawPartial));
|
||||||
RtlCopyMemory(CurrentRaw, SortedRaw, sizeof(RawPartial));
|
RtlCopyMemory(CurrentRaw, SortedRaw, sizeof(RawPartial));
|
||||||
RtlCopyMemory(SortedRaw, &RawPartial, sizeof(RawPartial));
|
RtlCopyMemory(SortedRaw, &RawPartial, sizeof(RawPartial));
|
||||||
|
|
||||||
/* Swap translated partial in the same way */
|
/* Swap translated partial in the same way */
|
||||||
RtlCopyMemory(&TranslatedPartial, CurrentTranslated, sizeof(TranslatedPartial));
|
RtlCopyMemory(&TranslatedPartial, CurrentTranslated, sizeof(TranslatedPartial));
|
||||||
RtlCopyMemory(CurrentTranslated, SortedTranslated, sizeof(TranslatedPartial));
|
RtlCopyMemory(CurrentTranslated, SortedTranslated, sizeof(TranslatedPartial));
|
||||||
RtlCopyMemory(SortedTranslated, &TranslatedPartial, sizeof(TranslatedPartial));
|
RtlCopyMemory(SortedTranslated, &TranslatedPartial, sizeof(TranslatedPartial));
|
||||||
|
|
||||||
/* Update the sort value at this point */
|
/* Update the sort value at this point */
|
||||||
HalpGetResourceSortValue(CurrentRaw, &CurrentScale, &CurrentSortValue);
|
HalpGetResourceSortValue(CurrentRaw, &CurrentScale, &CurrentSortValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The sort location has been updated */
|
/* The sort location has been updated */
|
||||||
SortedRaw++;
|
SortedRaw++;
|
||||||
SortedTranslated++;
|
SortedTranslated++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the next partial */
|
/* Move to the next partial */
|
||||||
CurrentRaw++;
|
CurrentRaw++;
|
||||||
CurrentTranslated++;
|
CurrentTranslated++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the next full descriptor */
|
/* Move to the next full descriptor */
|
||||||
RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
|
RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
|
||||||
TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
|
TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark this is an ACPI system, if it is */
|
/* Mark this is an ACPI system, if it is */
|
||||||
HalpMarkAcpiHal();
|
HalpMarkAcpiHal();
|
||||||
|
|
||||||
/* Tell the kernel about all this */
|
/* Tell the kernel about all this */
|
||||||
IoReportHalResourceUsage(HalName,
|
IoReportHalResourceUsage(HalName,
|
||||||
RawList,
|
RawList,
|
||||||
TranslatedList,
|
TranslatedList,
|
||||||
ListSize);
|
ListSize);
|
||||||
|
|
||||||
/* Free our lists */
|
/* Free our lists */
|
||||||
ExFreePool(RawList);
|
ExFreePool(RawList);
|
||||||
ExFreePool(TranslatedList);
|
ExFreePool(TranslatedList);
|
||||||
|
|
||||||
/* Get the machine's serial number */
|
/* Get the machine's serial number */
|
||||||
HalpReportSerialNumber();
|
HalpReportSerialNumber();
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
|
||||||
{
|
{
|
||||||
/* Set the IDT_LATCHED flag for latched interrupts */
|
/* Set the IDT_LATCHED flag for latched interrupts */
|
||||||
if (Mode == Latched) Flags |= IDT_LATCHED;
|
if (Mode == Latched) Flags |= IDT_LATCHED;
|
||||||
|
|
||||||
/* Register the vector */
|
/* Register the vector */
|
||||||
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ HalpGetNMICrashFlag(VOID)
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEY_VALUE_PARTIAL_INFORMATION KeyValueInformation;
|
KEY_VALUE_PARTIAL_INFORMATION KeyValueInformation;
|
||||||
|
|
||||||
/* Set default */
|
/* Set default */
|
||||||
HalpNMIDumpFlag = 0;
|
HalpNMIDumpFlag = 0;
|
||||||
|
@ -548,7 +548,7 @@ HalpGetNMICrashFlag(VOID)
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Open crash key */
|
/* Open crash key */
|
||||||
Status = ZwOpenKey(&Handle, KEY_READ, &ObjectAttributes);
|
Status = ZwOpenKey(&Handle, KEY_READ, &ObjectAttributes);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -570,7 +570,7 @@ HalpGetNMICrashFlag(VOID)
|
||||||
HalpNMIDumpFlag = KeyValueInformation.Data[0];
|
HalpNMIDumpFlag = KeyValueInformation.Data[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
ZwClose(Handle);
|
ZwClose(Handle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,14 +652,14 @@ PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpMapPhysicalMemory64(
|
HalpMapPhysicalMemory64(
|
||||||
IN PHYSICAL_ADDRESS PhysicalAddress,
|
IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
IN PFN_NUMBER PageCount
|
IN PFN_COUNT PageCount
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpUnmapVirtualAddress(
|
HalpUnmapVirtualAddress(
|
||||||
IN PVOID VirtualAddress,
|
IN PVOID VirtualAddress,
|
||||||
IN PFN_NUMBER NumberPages
|
IN PFN_COUNT NumberPages
|
||||||
);
|
);
|
||||||
|
|
||||||
/* sysinfo.c */
|
/* sysinfo.c */
|
||||||
|
@ -846,7 +846,7 @@ HalpInitProcessor(
|
||||||
#define KfLowerIrql KeLowerIrql
|
#define KfLowerIrql KeLowerIrql
|
||||||
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
||||||
#define KiEoiHelper(TrapFrame) return /* Just return to the caller */
|
#define KiEoiHelper(TrapFrame) return /* Just return to the caller */
|
||||||
#define HalBeginSystemInterrupt(Irql, Vector, OldIrql) TRUE
|
#define HalBeginSystemInterrupt(Irql, Vector, OldIrql) ((*(OldIrql) = PASSIVE_LEVEL), TRUE)
|
||||||
#ifndef CONFIG_SMP
|
#ifndef CONFIG_SMP
|
||||||
/* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
|
/* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
|
||||||
#define KiAcquireSpinLock(SpinLock)
|
#define KiAcquireSpinLock(SpinLock)
|
||||||
|
|
|
@ -539,7 +539,7 @@ HalpPCIPin2ISALine(IN PBUS_HANDLER BusHandler,
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
while (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpPCIISALine2Pin(IN PBUS_HANDLER BusHandler,
|
HalpPCIISALine2Pin(IN PBUS_HANDLER BusHandler,
|
||||||
|
@ -560,30 +560,30 @@ HalpGetISAFixedPCIIrq(IN PBUS_HANDLER BusHandler,
|
||||||
OUT PSUPPORTED_RANGE *Range)
|
OUT PSUPPORTED_RANGE *Range)
|
||||||
{
|
{
|
||||||
PCI_COMMON_HEADER PciData;
|
PCI_COMMON_HEADER PciData;
|
||||||
|
|
||||||
/* Read PCI configuration data */
|
/* Read PCI configuration data */
|
||||||
HalGetBusData(PCIConfiguration,
|
HalGetBusData(PCIConfiguration,
|
||||||
BusHandler->BusNumber,
|
BusHandler->BusNumber,
|
||||||
PciSlot.u.AsULONG,
|
PciSlot.u.AsULONG,
|
||||||
&PciData,
|
&PciData,
|
||||||
PCI_COMMON_HDR_LENGTH);
|
PCI_COMMON_HDR_LENGTH);
|
||||||
|
|
||||||
/* Make sure it's a real device */
|
/* Make sure it's a real device */
|
||||||
if (PciData.VendorID == PCI_INVALID_VENDORID) return STATUS_UNSUCCESSFUL;
|
if (PciData.VendorID == PCI_INVALID_VENDORID) return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
/* Allocate the supported range structure */
|
/* Allocate the supported range structure */
|
||||||
*Range = ExAllocatePoolWithTag(PagedPool, sizeof(SUPPORTED_RANGE), TAG_HAL);
|
*Range = ExAllocatePoolWithTag(PagedPool, sizeof(SUPPORTED_RANGE), TAG_HAL);
|
||||||
if (!*Range) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!*Range) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
/* Set it up */
|
/* Set it up */
|
||||||
RtlZeroMemory(*Range, sizeof(SUPPORTED_RANGE));
|
RtlZeroMemory(*Range, sizeof(SUPPORTED_RANGE));
|
||||||
(*Range)->Base = 1;
|
(*Range)->Base = 1;
|
||||||
|
|
||||||
/* If the PCI device has no IRQ, nothing to do */
|
/* If the PCI device has no IRQ, nothing to do */
|
||||||
if (!PciData.u.type0.InterruptPin) return STATUS_SUCCESS;
|
if (!PciData.u.type0.InterruptPin) return STATUS_SUCCESS;
|
||||||
|
|
||||||
/* FIXME: The PCI IRQ Routing Miniport should be called */
|
/* FIXME: The PCI IRQ Routing Miniport should be called */
|
||||||
|
|
||||||
/* Also if the INT# seems bogus, nothing to do either */
|
/* Also if the INT# seems bogus, nothing to do either */
|
||||||
if ((PciData.u.type0.InterruptLine == 0) ||
|
if ((PciData.u.type0.InterruptLine == 0) ||
|
||||||
(PciData.u.type0.InterruptLine == 255))
|
(PciData.u.type0.InterruptLine == 255))
|
||||||
|
@ -591,7 +591,7 @@ HalpGetISAFixedPCIIrq(IN PBUS_HANDLER BusHandler,
|
||||||
/* Fake success */
|
/* Fake success */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, the INT# should be valid, return it to the caller */
|
/* Otherwise, the INT# should be valid, return it to the caller */
|
||||||
(*Range)->Base = PciData.u.type0.InterruptLine;
|
(*Range)->Base = PciData.u.type0.InterruptLine;
|
||||||
(*Range)->Limit = PciData.u.type0.InterruptLine;
|
(*Range)->Limit = PciData.u.type0.InterruptLine;
|
||||||
|
@ -639,7 +639,7 @@ HalpRegisterPciDebuggingDeviceInfo(VOID)
|
||||||
|
|
||||||
/* Bail out if there aren't any */
|
/* Bail out if there aren't any */
|
||||||
if (!Found) return;
|
if (!Found) return;
|
||||||
|
|
||||||
/* FIXME: TODO */
|
/* FIXME: TODO */
|
||||||
DPRINT1("You have implemented the KD routines for searching PCI debugger"
|
DPRINT1("You have implemented the KD routines for searching PCI debugger"
|
||||||
"devices, but you have forgotten to implement this routine\n");
|
"devices, but you have forgotten to implement this routine\n");
|
||||||
|
@ -664,11 +664,11 @@ HalpAdjustPCIResourceList(IN PBUS_HANDLER BusHandler,
|
||||||
PCI_SLOT_NUMBER SlotNumber;
|
PCI_SLOT_NUMBER SlotNumber;
|
||||||
PSUPPORTED_RANGE Interrupt;
|
PSUPPORTED_RANGE Interrupt;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Get PCI bus data */
|
/* Get PCI bus data */
|
||||||
BusData = BusHandler->BusData;
|
BusData = BusHandler->BusData;
|
||||||
SlotNumber.u.AsULONG = (*pResourceList)->SlotNumber;
|
SlotNumber.u.AsULONG = (*pResourceList)->SlotNumber;
|
||||||
|
|
||||||
/* Get the IRQ supported range */
|
/* Get the IRQ supported range */
|
||||||
Status = BusData->GetIrqRange(BusHandler, RootHandler, SlotNumber, &Interrupt);
|
Status = BusData->GetIrqRange(BusHandler, RootHandler, SlotNumber, &Interrupt);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
@ -709,7 +709,7 @@ HalpAssignPCISlotResources(IN PBUS_HANDLER BusHandler,
|
||||||
{
|
{
|
||||||
PCI_COMMON_CONFIG PciConfig;
|
PCI_COMMON_CONFIG PciConfig;
|
||||||
SIZE_T Address;
|
SIZE_T Address;
|
||||||
SIZE_T ResourceCount;
|
ULONG ResourceCount;
|
||||||
ULONG Size[PCI_TYPE0_ADDRESSES];
|
ULONG Size[PCI_TYPE0_ADDRESSES];
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
UCHAR Offset;
|
UCHAR Offset;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue