mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 04:13:18 +00:00
Change code, fix warnings, so it finally builds.
svn path=/trunk/; revision=26187
This commit is contained in:
parent
285adfefbe
commit
379a566aa8
2 changed files with 51 additions and 37 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -27,20 +27,21 @@
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ntddk.h>
|
||||||
#include <ddk/srb.h>
|
#include <srb.h>
|
||||||
#include <ddk/scsi.h>
|
#include <scsi.h>
|
||||||
#include <ddk/ntddscsi.h>
|
#include <ntddscsi.h>
|
||||||
#include <rosrtl/string.h>
|
#include <ntddstor.h>
|
||||||
|
#include <ntdddisk.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "0.0.1"
|
|
||||||
|
|
||||||
#include "scsiport_int.h"
|
#include "scsiport_int.h"
|
||||||
|
|
||||||
|
|
||||||
/* #define USE_DEVICE_QUEUES */
|
/* #define USE_DEVICE_QUEUES */
|
||||||
|
|
||||||
/* TYPES *********************************************************************/
|
/* TYPES *********************************************************************/
|
||||||
|
@ -223,18 +224,6 @@ ScsiPortCompleteRequest(IN PVOID HwDeviceExtension,
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
ULONG STDCALL
|
|
||||||
ScsiPortConvertPhysicalAddressToUlong(IN SCSI_PHYSICAL_ADDRESS Address)
|
|
||||||
{
|
|
||||||
DPRINT("ScsiPortConvertPhysicalAddressToUlong()\n");
|
|
||||||
return(Address.u.LowPart);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
@ -448,7 +437,7 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EndAddress = Srb->DataBuffer + Srb->DataTransferLength;
|
EndAddress = (PVOID)((ULONG_PTR)Srb->DataBuffer + Srb->DataTransferLength);
|
||||||
if (VirtualAddress == NULL)
|
if (VirtualAddress == NULL)
|
||||||
{
|
{
|
||||||
VirtualAddress = Srb->DataBuffer;
|
VirtualAddress = Srb->DataBuffer;
|
||||||
|
@ -475,18 +464,18 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
||||||
PhysicalAddress.u.LowPart = (PhysicalAddress.u.LowPart & ~(PAGE_SIZE - 1)) + Offset;
|
PhysicalAddress.u.LowPart = (PhysicalAddress.u.LowPart & ~(PAGE_SIZE - 1)) + Offset;
|
||||||
#endif
|
#endif
|
||||||
BufferLength += PAGE_SIZE - Offset;
|
BufferLength += PAGE_SIZE - Offset;
|
||||||
while (VirtualAddress + BufferLength < EndAddress)
|
while ((ULONG_PTR)VirtualAddress + BufferLength < (ULONG_PTR)EndAddress)
|
||||||
{
|
{
|
||||||
NextPhysicalAddress = MmGetPhysicalAddress(VirtualAddress + BufferLength);
|
NextPhysicalAddress = MmGetPhysicalAddress((PVOID)((ULONG_PTR)VirtualAddress + BufferLength));
|
||||||
if (PhysicalAddress.QuadPart + (ULONGLONG)BufferLength != NextPhysicalAddress.QuadPart)
|
if (PhysicalAddress.QuadPart + (ULONGLONG)BufferLength != NextPhysicalAddress.QuadPart)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
BufferLength += PAGE_SIZE;
|
BufferLength += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
if (VirtualAddress + BufferLength >= EndAddress)
|
if ((ULONG_PTR)VirtualAddress + BufferLength >= (ULONG_PTR)EndAddress)
|
||||||
{
|
{
|
||||||
BufferLength = EndAddress - VirtualAddress;
|
BufferLength = (ULONG_PTR)EndAddress - (ULONG_PTR)VirtualAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,7 +806,7 @@ ScsiPortInitialize(IN PVOID Argument1,
|
||||||
// PortConfig->DemandMode =
|
// PortConfig->DemandMode =
|
||||||
PortConfig->MapBuffers = HwInitializationData->MapBuffers;
|
PortConfig->MapBuffers = HwInitializationData->MapBuffers;
|
||||||
PortConfig->NeedPhysicalAddresses = HwInitializationData->NeedPhysicalAddresses;
|
PortConfig->NeedPhysicalAddresses = HwInitializationData->NeedPhysicalAddresses;
|
||||||
PortConfig->TaggedQueuing = HwInitializationData->TaggedQueueing;
|
PortConfig->TaggedQueuing = HwInitializationData->TaggedQueuing;
|
||||||
PortConfig->AutoRequestSense = HwInitializationData->AutoRequestSense;
|
PortConfig->AutoRequestSense = HwInitializationData->AutoRequestSense;
|
||||||
PortConfig->MultipleRequestPerLu = HwInitializationData->MultipleRequestPerLu;
|
PortConfig->MultipleRequestPerLu = HwInitializationData->MultipleRequestPerLu;
|
||||||
PortConfig->ReceiveEvent = HwInitializationData->ReceiveEvent;
|
PortConfig->ReceiveEvent = HwInitializationData->ReceiveEvent;
|
||||||
|
@ -828,7 +817,7 @@ ScsiPortInitialize(IN PVOID Argument1,
|
||||||
|
|
||||||
PortConfig->SlotNumber = SlotNumber.u.AsULONG;
|
PortConfig->SlotNumber = SlotNumber.u.AsULONG;
|
||||||
|
|
||||||
PortConfig->AccessRanges = (PACCESS_RANGE)(PortConfig + 1);
|
PortConfig->AccessRanges = (ACCESS_RANGE(*)[])(PortConfig + 1);
|
||||||
|
|
||||||
/* Search for matching PCI device */
|
/* Search for matching PCI device */
|
||||||
if ((HwInitializationData->AdapterInterfaceType == PCIBus) &&
|
if ((HwInitializationData->AdapterInterfaceType == PCIBus) &&
|
||||||
|
@ -1011,7 +1000,7 @@ ByeBye:
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
ScsiPortIoMapTransfer(IN PVOID HwDeviceExtension,
|
ScsiPortIoMapTransfer(IN PVOID HwDeviceExtension,
|
||||||
IN PSCSI_REQUEST_BLOCK Srb,
|
IN PSCSI_REQUEST_BLOCK Srb,
|
||||||
IN ULONG LogicalAddress,
|
IN PVOID LogicalAddress,
|
||||||
IN ULONG Length)
|
IN ULONG Length)
|
||||||
{
|
{
|
||||||
DPRINT1("ScsiPortIoMapTransfer()\n");
|
DPRINT1("ScsiPortIoMapTransfer()\n");
|
||||||
|
@ -1254,9 +1243,9 @@ SpiGetPciConfigData (IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
|
||||||
|
|
||||||
for (i = 0; i < PortConfig->NumberOfAccessRanges; i++)
|
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;
|
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;
|
RangeLength = (ULONG)-1;
|
||||||
HalSetBusDataByOffset (PCIConfiguration,
|
HalSetBusDataByOffset (PCIConfiguration,
|
||||||
|
@ -1281,9 +1270,9 @@ SpiGetPciConfigData (IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
if (RangeLength != 0)
|
if (RangeLength != 0)
|
||||||
{
|
{
|
||||||
PortConfig->AccessRanges[i].RangeLength =
|
(*PortConfig->AccessRanges)[i].RangeLength =
|
||||||
-(RangeLength & PCI_ADDRESS_IO_ADDRESS_MASK);
|
-(RangeLength & PCI_ADDRESS_IO_ADDRESS_MASK);
|
||||||
PortConfig->AccessRanges[i].RangeInMemory =
|
(*PortConfig->AccessRanges)[i].RangeInMemory =
|
||||||
!(PciConfig.u.type0.BaseAddresses[i] & PCI_ADDRESS_IO_SPACE);
|
!(PciConfig.u.type0.BaseAddresses[i] & PCI_ADDRESS_IO_SPACE);
|
||||||
|
|
||||||
DPRINT("RangeStart 0x%lX RangeLength 0x%lX RangeInMemory %s\n",
|
DPRINT("RangeStart 0x%lX RangeLength 0x%lX RangeInMemory %s\n",
|
||||||
|
@ -2300,8 +2289,8 @@ SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open or create the 'Scsi' subkey */
|
/* Open or create the 'Scsi' subkey */
|
||||||
RtlRosInitUnicodeStringFromLiteral(&KeyName,
|
RtlInitUnicodeString(&KeyName,
|
||||||
L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
|
L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
|
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
|
||||||
|
@ -2406,7 +2395,7 @@ SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set 'IOAddress' (REG_DWORD) value (NT4 only) */
|
/* 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);
|
DPRINT(" IOAddress = %lx\n", UlongData);
|
||||||
RtlInitUnicodeString(&ValueName,
|
RtlInitUnicodeString(&ValueName,
|
||||||
L"IOAddress");
|
L"IOAddress");
|
||||||
|
@ -2666,4 +2655,17 @@ ByeBye:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef ScsiPortConvertPhysicalAddressToUlong
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
ULONG STDCALL
|
||||||
|
ScsiPortConvertPhysicalAddressToUlong(IN SCSI_PHYSICAL_ADDRESS Address)
|
||||||
|
{
|
||||||
|
DPRINT("ScsiPortConvertPhysicalAddressToUlong()\n");
|
||||||
|
return(Address.u.LowPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -4,6 +4,18 @@
|
||||||
* DESCRIPTION
|
* DESCRIPTION
|
||||||
* An enumeration containing the states in the timer DFA
|
* 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
|
typedef enum _SCSI_PORT_TIMER_STATES
|
||||||
{
|
{
|
||||||
IDETimerIdle,
|
IDETimerIdle,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue