Author: fireball
Date: Tue Mar 27 15:07:12 2007
New Revision: 26187
URL:
http://svn.reactos.org/svn/reactos?rev=26187&view=rev
Log:
Change code, fix warnings, so it finally builds.
Modified:
trunk/reactos/drivers/storage/scsiport-new/scsiport.c
trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h
Modified: trunk/reactos/drivers/storage/scsiport-new/scsiport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport-n…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport-new/scsiport.c (original)
+++ trunk/reactos/drivers/storage/scsiport-new/scsiport.c Tue Mar 27 15:07:12 2007
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: scsiport.c,v 1.52 2004/04/02 15:43:01 hbirr Exp $
+/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -27,19 +27,20 @@
/* INCLUDES *****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/srb.h>
-#include <ddk/scsi.h>
-#include <ddk/ntddscsi.h>
-#include <rosrtl/string.h>
-
-#define NDEBUG
+#include <ntddk.h>
+#include <srb.h>
+#include <scsi.h>
+#include <ntddscsi.h>
+#include <ntddstor.h>
+#include <ntdddisk.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+//#define NDEBUG
#include <debug.h>
-
-#define VERSION "0.0.1"
-
#include "scsiport_int.h"
+
/* #define USE_DEVICE_QUEUES */
@@ -222,18 +223,6 @@
DPRINT("ScsiPortCompleteRequest()\n");
UNIMPLEMENTED;
}
-
-
-/*
- * @implemented
- */
-ULONG STDCALL
-ScsiPortConvertPhysicalAddressToUlong(IN SCSI_PHYSICAL_ADDRESS Address)
-{
- DPRINT("ScsiPortConvertPhysicalAddressToUlong()\n");
- return(Address.u.LowPart);
-}
-
/*
* @unimplemented
@@ -448,7 +437,7 @@
}
else
{
- EndAddress = Srb->DataBuffer + Srb->DataTransferLength;
+ EndAddress = (PVOID)((ULONG_PTR)Srb->DataBuffer + Srb->DataTransferLength);
if (VirtualAddress == NULL)
{
VirtualAddress = Srb->DataBuffer;
@@ -475,18 +464,18 @@
PhysicalAddress.u.LowPart = (PhysicalAddress.u.LowPart & ~(PAGE_SIZE - 1)) +
Offset;
#endif
BufferLength += PAGE_SIZE - Offset;
- while (VirtualAddress + BufferLength < EndAddress)
- {
- NextPhysicalAddress = MmGetPhysicalAddress(VirtualAddress + BufferLength);
+ while ((ULONG_PTR)VirtualAddress + BufferLength < (ULONG_PTR)EndAddress)
+ {
+ NextPhysicalAddress = MmGetPhysicalAddress((PVOID)((ULONG_PTR)VirtualAddress +
BufferLength));
if (PhysicalAddress.QuadPart + (ULONGLONG)BufferLength !=
NextPhysicalAddress.QuadPart)
{
break;
}
BufferLength += PAGE_SIZE;
}
- if (VirtualAddress + BufferLength >= EndAddress)
- {
- BufferLength = EndAddress - VirtualAddress;
+ if ((ULONG_PTR)VirtualAddress + BufferLength >= (ULONG_PTR)EndAddress)
+ {
+ BufferLength = (ULONG_PTR)EndAddress - (ULONG_PTR)VirtualAddress;
}
}
@@ -817,7 +806,7 @@
// PortConfig->DemandMode =
PortConfig->MapBuffers = HwInitializationData->MapBuffers;
PortConfig->NeedPhysicalAddresses =
HwInitializationData->NeedPhysicalAddresses;
- PortConfig->TaggedQueuing = HwInitializationData->TaggedQueueing;
+ PortConfig->TaggedQueuing = HwInitializationData->TaggedQueuing;
PortConfig->AutoRequestSense = HwInitializationData->AutoRequestSense;
PortConfig->MultipleRequestPerLu =
HwInitializationData->MultipleRequestPerLu;
PortConfig->ReceiveEvent = HwInitializationData->ReceiveEvent;
@@ -828,7 +817,7 @@
PortConfig->SlotNumber = SlotNumber.u.AsULONG;
- PortConfig->AccessRanges = (PACCESS_RANGE)(PortConfig + 1);
+ PortConfig->AccessRanges = (ACCESS_RANGE(*)[])(PortConfig + 1);
/* Search for matching PCI device */
if ((HwInitializationData->AdapterInterfaceType == PCIBus) &&
@@ -1011,7 +1000,7 @@
VOID STDCALL
ScsiPortIoMapTransfer(IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb,
- IN ULONG LogicalAddress,
+ IN PVOID LogicalAddress,
IN ULONG Length)
{
DPRINT1("ScsiPortIoMapTransfer()\n");
@@ -1254,9 +1243,9 @@
for (i = 0; i < PortConfig->NumberOfAccessRanges; i++)
{
- PortConfig->AccessRanges[i].RangeStart.QuadPart =
+ (*PortConfig->AccessRanges)[i].RangeStart.QuadPart =
PciConfig.u.type0.BaseAddresses[i] & PCI_ADDRESS_IO_ADDRESS_MASK;
- if (PortConfig->AccessRanges[i].RangeStart.QuadPart != 0)
+ if ((*PortConfig->AccessRanges)[i].RangeStart.QuadPart != 0)
{
RangeLength = (ULONG)-1;
HalSetBusDataByOffset (PCIConfiguration,
@@ -1281,9 +1270,9 @@
sizeof(ULONG));
if (RangeLength != 0)
{
- PortConfig->AccessRanges[i].RangeLength =
+ (*PortConfig->AccessRanges)[i].RangeLength =
-(RangeLength & PCI_ADDRESS_IO_ADDRESS_MASK);
- PortConfig->AccessRanges[i].RangeInMemory =
+ (*PortConfig->AccessRanges)[i].RangeInMemory =
!(PciConfig.u.type0.BaseAddresses[i] & PCI_ADDRESS_IO_SPACE);
DPRINT("RangeStart 0x%lX RangeLength 0x%lX RangeInMemory %s\n",
@@ -2300,8 +2289,8 @@
}
/* Open or create the 'Scsi' subkey */
- RtlRosInitUnicodeStringFromLiteral(&KeyName,
- L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
+ RtlInitUnicodeString(&KeyName,
+ L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
@@ -2406,7 +2395,7 @@
}
/* Set 'IOAddress' (REG_DWORD) value (NT4 only) */
- UlongData =
ScsiPortConvertPhysicalAddressToUlong(DeviceExtension->PortConfig->AccessRanges[0].RangeStart);
+ UlongData =
ScsiPortConvertPhysicalAddressToUlong((*DeviceExtension->PortConfig->AccessRanges)[0].RangeStart);
DPRINT(" IOAddress = %lx\n", UlongData);
RtlInitUnicodeString(&ValueName,
L"IOAddress");
@@ -2666,4 +2655,17 @@
return Status;
}
+
+#undef ScsiPortConvertPhysicalAddressToUlong
+/*
+ * @implemented
+ */
+ULONG STDCALL
+ScsiPortConvertPhysicalAddressToUlong(IN SCSI_PHYSICAL_ADDRESS Address)
+{
+ DPRINT("ScsiPortConvertPhysicalAddressToUlong()\n");
+ return(Address.u.LowPart);
+}
+
+
/* EOF */
Modified: trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport-n…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h (original)
+++ trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h Tue Mar 27 15:07:12 2007
@@ -4,6 +4,18 @@
* DESCRIPTION
* An enumeration containing the states in the timer DFA
*/
+
+#define VERSION "0.0.3"
+
+#ifndef PAGE_ROUND_UP
+#define PAGE_ROUND_UP(x) ( (((ULONG_PTR)x)%PAGE_SIZE) ?
((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
+#endif
+#ifndef ROUND_UP
+#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
+#endif
+
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) +
((D)<<24))
+
typedef enum _SCSI_PORT_TIMER_STATES
{
IDETimerIdle,