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