Merge from amd64-branch:
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 25 Mar 2010 03:24:44 +0000 (03:24 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 25 Mar 2010 03:24:44 +0000 (03:24 +0000)
34803 (sserapion)
Fix more warnings.
Convert pciidex to use spec file.

34864 (tkreuzer) // checkme vielleicht schon gemerged?
[NDIS]
fix some ULONG to pointer casts

34870 (tkreuzer)
[TCPIP]
- fix some pointer to ULONG casts

34874 (tkreuzer)
class2: fix ULONG to pointer cast

34877 (tkreuzer)
- fix LARGE_INTEGER to pointer cast

35781 (tkreuzer)
[NDIS]
define some fastcall functions to the normal functions on amd64

36011 (tkreuzer)
[NDIS]
Fix a ULONG to pointer cast.

36012 (tkreuzer)
[SCSIPORT]
more ulong <-> pointer fixes

svn path=/trunk/; revision=46422

reactos/drivers/input/i8042prt/keyboard.c
reactos/drivers/network/ndis/include/ndissys.h
reactos/drivers/network/ndis/ndis/io.c
reactos/drivers/network/tcpip/tcpip/dispatch.c
reactos/drivers/serial/serenum/detect.c
reactos/drivers/storage/class/class2/class2.c
reactos/drivers/storage/floppy/floppy.c
reactos/drivers/storage/ide/atapi/atapi.c
reactos/drivers/storage/scsiport/scsiport.c

index 3aa2b1b..0550c90 100644 (file)
@@ -200,7 +200,7 @@ i8042PowerWorkItem(
        /* Register GUID_DEVICE_SYS_BUTTON interface and report capability */
        if (DeviceExtension->NewCaps != DeviceExtension->ReportedCaps)
        {
-               WaitingIrp = InterlockedExchangePointer(&DeviceExtension->PowerIrp, NULL);
+               WaitingIrp = InterlockedExchangePointer((PVOID)&DeviceExtension->PowerIrp, NULL);
                if (WaitingIrp)
                {
                        /* Cancel the current power irp, as capability changed */
@@ -255,7 +255,7 @@ i8042PowerWorkItem(
        }
 
        /* Directly complete the IOCTL_GET_SYS_BUTTON_EVENT Irp (if any) */
-       WaitingIrp = InterlockedExchangePointer(&DeviceExtension->PowerIrp, NULL);
+       WaitingIrp = InterlockedExchangePointer((PVOID)&DeviceExtension->PowerIrp, NULL);
        if (WaitingIrp)
        {
                PULONG pEvent = (PULONG)WaitingIrp->AssociatedIrp.SystemBuffer;
@@ -413,7 +413,7 @@ i8042KbdDeviceControl(
                        else
                        {
                                WaitingIrp = InterlockedCompareExchangePointer(
-                                       &DeviceExtension->PowerIrp,
+                                       (PVOID)&DeviceExtension->PowerIrp,
                                        Irp,
                                        NULL);
                                /* Check if an Irp is already pending */
@@ -431,7 +431,7 @@ i8042KbdDeviceControl(
                                        PowerKey = InterlockedExchange((PLONG)&DeviceExtension->LastPowerKey, 0);
                                        if (PowerKey != 0)
                                        {
-                                               (VOID)InterlockedCompareExchangePointer(&DeviceExtension->PowerIrp, NULL, Irp);
+                                               (VOID)InterlockedCompareExchangePointer((PVOID)&DeviceExtension->PowerIrp, NULL, Irp);
                                                *(PULONG)Irp->AssociatedIrp.SystemBuffer = PowerKey;
                                                Status = STATUS_SUCCESS;
                                                Irp->IoStatus.Status = Status;
index d97f1f0..10c6a26 100644 (file)
@@ -59,6 +59,13 @@ NTAPI
 ExGetCurrentProcessorCpuUsage(
     PULONG CpuUsage);
 
+/* portability fixes */
+#ifdef _M_AMD64
+#define KfReleaseSpinLock KeReleaseSpinLock
+#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel
+#define KefReleaseSpinLockFromDpcLevel KeReleaseSpinLockFromDpcLevel
+#endif
+
 #endif /* __NDISSYS_H */
 
 /* EOF */
index b843997..0f809bf 100644 (file)
@@ -106,7 +106,7 @@ NdisImmediateReadPortUchar(
     OUT PUCHAR      Data)
 {
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
-  *Data = READ_PORT_UCHAR((PUCHAR)Port); // FIXME: What to do with WrapperConfigurationContext?
+  *Data = READ_PORT_UCHAR(UlongToPtr(Port)); // FIXME: What to do with WrapperConfigurationContext?
 }
 
 \f
@@ -121,7 +121,7 @@ NdisImmediateReadPortUlong(
     OUT PULONG      Data)
 {
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
-  *Data = READ_PORT_ULONG((PULONG)Port); // FIXME: What to do with WrapperConfigurationContext?
+  *Data = READ_PORT_ULONG(UlongToPtr(Port)); // FIXME: What to do with WrapperConfigurationContext?
 }
 
 \f
@@ -136,7 +136,7 @@ NdisImmediateReadPortUshort(
     OUT PUSHORT     Data)
 {
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
-  *Data = READ_PORT_USHORT((PUSHORT)Port); // FIXME: What to do with WrapperConfigurationContext?
+  *Data = READ_PORT_USHORT(UlongToPtr(Port)); // FIXME: What to do with WrapperConfigurationContext?
 }
 
 \f
@@ -151,7 +151,7 @@ NdisImmediateWritePortUchar(
     IN  UCHAR       Data)
 {
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
-  WRITE_PORT_UCHAR((PUCHAR)Port, Data); // FIXME: What to do with WrapperConfigurationContext?
+  WRITE_PORT_UCHAR(UlongToPtr(Port), Data); // FIXME: What to do with WrapperConfigurationContext?
 }
 
 \f
@@ -166,7 +166,7 @@ NdisImmediateWritePortUlong(
     IN  ULONG       Data)
 {
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
-  WRITE_PORT_ULONG((PULONG)Port, Data); // FIXME: What to do with WrapperConfigurationContext?
+  WRITE_PORT_ULONG(UlongToPtr(Port), Data); // FIXME: What to do with WrapperConfigurationContext?
 }
 
 \f
@@ -181,7 +181,7 @@ NdisImmediateWritePortUshort(
     IN  USHORT      Data)
 {
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
-  WRITE_PORT_USHORT((PUSHORT)Port, Data); // FIXME: What to do with WrapperConfigurationContext?
+  WRITE_PORT_USHORT(UlongToPtr(Port), Data); // FIXME: What to do with WrapperConfigurationContext?
 }
 
 \f
@@ -880,7 +880,7 @@ NdisMRegisterIoPortRange(
   if(AddressSpace)
     {
       ASSERT(TranslatedAddress.u.HighPart == 0);
-      *PortOffset = (PVOID) TranslatedAddress.u.LowPart;
+      *PortOffset = (PVOID)(ULONG_PTR)TranslatedAddress.QuadPart;
       NDIS_DbgPrint(MAX_TRACE, ("Returning 0x%x\n", *PortOffset));
       return NDIS_STATUS_SUCCESS;
     }
index fb77376..f216ed5 100644 (file)
@@ -688,7 +688,7 @@ NTSTATUS DispTdiQueryInformation(
         AddressInfo = (PTDI_ADDRESS_INFO)MmGetSystemAddressForMdl(Irp->MdlAddress);
                Address = (PTA_IP_ADDRESS)&AddressInfo->Address;
 
-        switch ((ULONG)IrpSp->FileObject->FsContext2) {
+        switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
           case TDI_TRANSPORT_ADDRESS_FILE:
             AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
 
@@ -732,7 +732,7 @@ NTSTATUS DispTdiQueryInformation(
         AddressInfo = (PTDI_CONNECTION_INFORMATION)
           MmGetSystemAddressForMdl(Irp->MdlAddress);
 
-        switch ((ULONG)IrpSp->FileObject->FsContext2) {
+        switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
           case TDI_TRANSPORT_ADDRESS_FILE:
             AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
             Endpoint = AddrFile ? AddrFile->Connection : NULL;
@@ -1039,12 +1039,16 @@ NTSTATUS DispTdiSendDatagram(
                     (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)));
 
         if( (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send != NULL) )
+        {
+               ULONG DataUsed = 0;
             Status = (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)(
                 Request.Handle.AddressHandle,
                 DgramInfo->SendDatagramInformation,
                 DataBuffer,
                 BufferSize,
-                &Irp->IoStatus.Information);
+                &DataUsed);
+            Irp->IoStatus.Information = DataUsed;
+        }
         else {
             Status = STATUS_UNSUCCESSFUL;
             ASSERT(FALSE);
@@ -1310,7 +1314,7 @@ NTSTATUS DispTdiQueryInformationEx(
 
     TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
 
-    switch ((ULONG)IrpSp->FileObject->FsContext2) {
+    switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
     case TDI_TRANSPORT_ADDRESS_FILE:
         Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
         break;
@@ -1485,7 +1489,7 @@ NTSTATUS DispTdiSetInformationEx(
     TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
     Info        = (PTCP_REQUEST_SET_INFORMATION_EX)Irp->AssociatedIrp.SystemBuffer;
 
-    switch ((ULONG)IrpSp->FileObject->FsContext2) {
+    switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
     case TDI_TRANSPORT_ADDRESS_FILE:
         Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
         break;
index 87af589..8391ddb 100644 (file)
@@ -532,7 +532,7 @@ SerenumDetectLegacyDevice(
 
        /* Fill the read buffer */
        TRACE_(SERENUM, "Fill the read buffer\n");
-       Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
+       Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), (PVOID)&Count);
        if (!NT_SUCCESS(Status)) goto ByeBye;
 
        RtlInitUnicodeString(&DeviceId, L"Serenum\\Mouse");
index 517ddd4..cb8d1f7 100644 (file)
@@ -1314,7 +1314,7 @@ Return Value:
     // of original IRP.
     //
 
-    nextIrpStack->Parameters.Others.Argument1 = (PVOID) irpCount;
+    nextIrpStack->Parameters.Others.Argument1 = (PVOID)(ULONG_PTR) irpCount;
 
     for (i = 0; i < irpCount; i++) {
 
@@ -1502,7 +1502,7 @@ Return Value:
             srb,
             irpStack->MajorFunction,
             irpStack->MajorFunction == IRP_MJ_DEVICE_CONTROL ? irpStack->Parameters.DeviceIoControl.IoControlCode : 0,
-            MAXIMUM_RETRIES - ((ULONG)irpStack->Parameters.Others.Argument4),
+            MAXIMUM_RETRIES - ((ULONG_PTR)irpStack->Parameters.Others.Argument4),
             &status);
 
         //
@@ -1517,7 +1517,7 @@ Return Value:
             retry = TRUE;
         }
 
-        if (retry && (irpStack->Parameters.Others.Argument4 = (PVOID)((ULONG)irpStack->Parameters.Others.Argument4-1))) {
+        if (retry && (irpStack->Parameters.Others.Argument4 = (PVOID)((ULONG_PTR)irpStack->Parameters.Others.Argument4-1))) {
 
             //
             // Retry request.
@@ -1654,7 +1654,7 @@ Return Value:
             srb,
             irpStack->MajorFunction,
             irpStack->MajorFunction == IRP_MJ_DEVICE_CONTROL ? irpStack->Parameters.DeviceIoControl.IoControlCode : 0,
-            MAXIMUM_RETRIES - ((ULONG)irpStack->Parameters.Others.Argument4),
+            MAXIMUM_RETRIES - ((ULONG_PTR)irpStack->Parameters.Others.Argument4),
             &status);
 
         //
@@ -1669,7 +1669,7 @@ Return Value:
             retry = TRUE;
         }
 
-        if (retry && (irpStack->Parameters.Others.Argument4 = (PVOID)((ULONG)irpStack->Parameters.Others.Argument4-1))) {
+        if (retry && (irpStack->Parameters.Others.Argument4 = (PVOID)((ULONG_PTR)irpStack->Parameters.Others.Argument4-1))) {
 
             //
             // Retry request. If the class driver has supplied a StartIo,
index 712f8d8..05d1598 100644 (file)
@@ -520,7 +520,7 @@ static NTSTATUS NTAPI ConfigCallback(PVOID Context,
           if(AddressSpace == 0)
               gControllerInfo[gNumberOfControllers].BaseAddress = MmMapIoSpace(TranslatedAddress, FDC_PORT_BYTES, MmNonCached);
           else
-              gControllerInfo[gNumberOfControllers].BaseAddress = (PUCHAR)TranslatedAddress.u.LowPart;
+              gControllerInfo[gNumberOfControllers].BaseAddress = (PUCHAR)(ULONG_PTR)TranslatedAddress.QuadPart;
         }
 
       else if(PartialDescriptor->Type == CmResourceTypeDma)
index ddcd417..fe3c980 100644 (file)
@@ -2744,7 +2744,7 @@ Return Value:
 
 {
     PHW_DEVICE_EXTENSION  deviceExtension = HwDeviceExtension;
-    ULONG                 nativeModeAdapterTableIndex = (ULONG)Context;
+    ULONG                 nativeModeAdapterTableIndex = (ULONG_PTR)Context;
     ULONG                 channel;
     PUCHAR                ioSpace;
     BOOLEAN               atapiOnly,
@@ -6260,7 +6260,7 @@ Return Value:
         newStatus = ScsiPortInitialize(DriverObject,
                                        Argument2,
                                        &hwInitializationData,
-                                       (PVOID) i);
+                                       (PVOID)(ULONG_PTR)i);
         if (newStatus < statusToReturn)
             statusToReturn = newStatus;
     }
index be9fc55..3e3fb54 100644 (file)
@@ -552,7 +552,7 @@ ScsiPortGetDeviceBase(IN PVOID HwDeviceExtension,
 
     /* i/o space */
     if (AddressSpace != 0)
-        return((PVOID)TranslatedAddress.u.LowPart);
+        return((PVOID)(ULONG_PTR)TranslatedAddress.QuadPart);
 
     MappedAddress = MmMapIoSpace(TranslatedAddress,
                                  NumberOfBytes,
@@ -1223,8 +1223,8 @@ CreatePortConfig:
             PortConfig->AccessRanges = (PVOID)(PortConfig+1);
 
             /* Align to LONGLONG */
-            PortConfig->AccessRanges = (PVOID)((ULONG)(PortConfig->AccessRanges) + 7);
-            PortConfig->AccessRanges = (PVOID)((ULONG)(PortConfig->AccessRanges) & ~7);
+            PortConfig->AccessRanges = (PVOID)((ULONG_PTR)(PortConfig->AccessRanges) + 7);
+            PortConfig->AccessRanges = (PVOID)((ULONG_PTR)(PortConfig->AccessRanges) & ~7);
 
             /* Copy the data */
             RtlCopyMemory(PortConfig->AccessRanges,