#include <stdio.h>
#include <stdarg.h>
+#undef ScsiPortLogError
+#undef ScsiPortMoveMemory
+#undef ScsiPortWritePortBufferUchar
+#undef ScsiPortWritePortBufferUlong
+#undef ScsiPortWritePortBufferUshort
+#undef ScsiPortWritePortUchar
+#undef ScsiPortWritePortUlong
+#undef ScsiPortWritePortUshort
+#undef ScsiPortWriteRegisterBufferUchar
+#undef ScsiPortWriteRegisterBufferUlong
+#undef ScsiPortWriteRegisterBufferUshort
+#undef ScsiPortWriteRegisterUchar
+#undef ScsiPortWriteRegisterUlong
+#undef ScsiPortWriteRegisterUshort
+#undef ScsiPortReadPortBufferUchar
+#undef ScsiPortReadPortBufferUlong
+#undef ScsiPortReadPortBufferUshort
+#undef ScsiPortReadPortUchar
+#undef ScsiPortReadPortUlong
+#undef ScsiPortReadPortUshort
+#undef ScsiPortReadRegisterBufferUchar
+#undef ScsiPortReadRegisterBufferUlong
+#undef ScsiPortReadRegisterBufferUshort
+#undef ScsiPortReadRegisterUchar
+#undef ScsiPortReadRegisterUlong
+#undef ScsiPortReadRegisterUshort
+
#define NDEBUG
#include <debug.h>
{
/* Device ID */
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
- ULONG PathId;
- ULONG TargetId;
- ULONG Lun;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
/* Device characteristics */
ULONG SectorSize;
RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize;
- Information->CurrentAddress.LowPart = Context->SectorNumber * Context->SectorSize;
+ Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize;
return ESUCCESS;
}
RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK));
Srb->Length = sizeof(SCSI_REQUEST_BLOCK);
Srb->Function = SRB_FUNCTION_EXECUTE_SCSI;
- Srb->PathId = PathId;
- Srb->TargetId = TargetId;
- Srb->Lun = Lun;
+ Srb->PathId = (UCHAR)PathId;
+ Srb->TargetId = (UCHAR)TargetId;
+ Srb->Lun = (UCHAR)Lun;
Srb->CdbLength = 10;
Srb->SrbFlags = SRB_FLAGS_DATA_IN;
Srb->DataTransferLength = sizeof(READ_CAPACITY_DATA);
if (!Context)
return ENOMEM;
Context->DeviceExtension = DeviceExtension;
- Context->PathId = PathId;
- Context->TargetId = TargetId;
- Context->Lun = Lun;
+ Context->PathId = (UCHAR)PathId;
+ Context->TargetId = (UCHAR)TargetId;
+ Context->Lun = (UCHAR)Lun;
Context->SectorSize = SectorSize;
Context->SectorOffset = SectorOffset;
Context->SectorCount = SectorCount;
return EINVAL;
/* Read full sectors */
- Lba = Context->SectorNumber;
+ ASSERT(Context->SectorNumber < 0xFFFFFFFF);
+ Lba = (ULONG)Context->SectorNumber;
if (FullSectors > 0)
{
Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK));
SpiScanAdapter(
IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
IN ULONG ScsiBus,
- IN ULONG PathId)
+ IN UCHAR PathId)
{
CHAR ArcName[64];
PSCSI_REQUEST_BLOCK Srb;
PCDB Cdb;
INQUIRYDATA InquiryBuffer;
- ULONG TargetId;
- ULONG Lun;
+ UCHAR TargetId;
+ UCHAR Lun;
if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId))
{
Cdb = (PCDB)Srb->Cdb;
Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY;
Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun;
- Cdb->CDB6INQUIRY.AllocationLength = Srb->DataTransferLength;
+ Cdb->CDB6INQUIRY.AllocationLength = (UCHAR)Srb->DataTransferLength;
if (!SpiSendSynchronousSrb(DeviceExtension, Srb))
{
/* Don't check next LUNs */
/* Device exists, create its ARC name */
if (InquiryBuffer.RemovableMedia)
{
- sprintf(ArcName, "scsi(%ld)cdrom(%ld)fdisk(%ld)",
+ sprintf(ArcName, "scsi(%ld)cdrom(%d)fdisk(%d)",
ScsiBus, TargetId, Lun);
FsRegisterDevice(ArcName, &DiskVtbl);
}
else
{
- sprintf(ArcName, "scsi(%ld)disk(%ld)rdisk(%ld)",
+ sprintf(ArcName, "scsi(%ld)disk(%d)rdisk(%d)",
ScsiBus, TargetId, Lun);
/* Now, check if it has partitions */
SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun);
BOOLEAN Again;
BOOLEAN FirstConfigCall = TRUE;
PCI_SLOT_NUMBER SlotNumber;
+ UCHAR ScsiBus;
NTSTATUS Status;
if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA))
}
/* Scan bus */
+ for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++)
{
- ULONG ScsiBus;
- for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++)
- {
- SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus);
- PortConfig.SystemIoBusNumber++;
- }
+ SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus);
+ PortConfig.SystemIoBusNumber++;
}
FirstConfigCall = FALSE;
NTAPI
ScsiPortWriteRegisterUchar(
IN PUCHAR Register,
- IN ULONG Value)
+ IN UCHAR Value)
{
WRITE_REGISTER_UCHAR(Register, Value);
}
CHAR NtBootDdPath[MAX_PATH];
PVOID ImageBase;
ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath);
- ULONG i;
+ USHORT i;
BOOLEAN Status;
/* Some initialization of our temporary loader block */
NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase));
if (!NtHeaders)
return EIO;
- Status = LdrRelocateImageWithBias(
+ Status = (BOOLEAN)LdrRelocateImageWithBias(
VaToPa(BootDdDTE->DllBase),
NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase,
"FreeLdr",