- Commit "new" storage stack drivers support based on NT4 DDK's sample drivers (with some modifications and a couple of hacks - they are marked with "HACK" keyword in the source code).

- ReactOS boots/works (faster/stabler), VMWare bug is gone.
- Delete the old scsiport, switching to the new scsiport instead.
NOTE(!): Before commenting this commit read license.txt files. If you still want to comment, read license.txt again, it should help.
- Warnings fixes, improvements, etc to the code will come later.

svn path=/trunk/; revision=26238
This commit is contained in:
Aleksey Bragin 2007-04-01 19:25:38 +00:00
parent 934ee21b1f
commit 4e7b22b216
23 changed files with 23475 additions and 13420 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,267 +1,459 @@
//
// ATAPI.H - defines and typedefs for the IDE Driver module.
//
/*
* PROJECT: ReactOS Storage Stack
* LICENSE: DDK - see license.txt in the root dir
* FILE: drivers/storage/atapi/atapi.h
* PURPOSE: ATAPI IDE miniport driver
* PROGRAMMERS: Based on a source code sample from Microsoft NT4 DDK
*/
#ifndef __ATAPI_H
#define __ATAPI_H
#ifdef __cplusplus
extern "C" {
#endif
#define IDE_MAXIMUM_DEVICES 8
#define IDE_MAX_NAME_LENGTH 50
#define IDE_SECTOR_BUF_SZ 512
#define IDE_MAX_SECTORS_PER_XFER 256
#define IDE_MAX_RESET_RETRIES 10000
#define IDE_MAX_POLL_RETRIES 100000
#define IDE_MAX_WRITE_RETRIES 1000
#define IDE_MAX_BUSY_RETRIES 50000
#define IDE_MAX_DRQ_RETRIES 10000
//#define IDE_MAX_CMD_RETRIES 1
#define IDE_MAX_CMD_RETRIES 0
#define IDE_CMD_TIMEOUT 5
#define IDE_RESET_PULSE_LENGTH 500 /* maybe a little too long */
#define IDE_RESET_BUSY_TIMEOUT 120
#define IDE_RESET_DRDY_TIMEOUT 120
// Control Block offsets and masks
#define IDE_REG_ALT_STATUS 0x0000
#define IDE_REG_DEV_CNTRL 0x0000 /* device control register */
#define IDE_DC_SRST 0x04 /* drive reset (both drives) */
#define IDE_DC_nIEN 0x02 /* IRQ enable (active low) */
#define IDE_REG_DRV_ADDR 0x0001
// Command Block offsets and masks
#define IDE_REG_DATA_PORT 0x0000
#define IDE_REG_ERROR 0x0001 /* error register */
#define IDE_ER_AMNF 0x01 /* addr mark not found */
#define IDE_ER_TK0NF 0x02 /* track 0 not found */
#define IDE_ER_ABRT 0x04 /* command aborted */
#define IDE_ER_MCR 0x08 /* media change requested */
#define IDE_ER_IDNF 0x10 /* ID not found */
#define IDE_ER_MC 0x20 /* Media changed */
#define IDE_ER_UNC 0x40 /* Uncorrectable data error */
#define IDE_REG_PRECOMP 0x0001
#define IDE_REG_SECTOR_CNT 0x0002
#define IDE_REG_SECTOR_NUM 0x0003
#define IDE_REG_CYL_LOW 0x0004
#define IDE_REG_CYL_HIGH 0x0005
#define IDE_REG_DRV_HEAD 0x0006
#define IDE_DH_FIXED 0xA0
#define IDE_DH_LBA 0x40
#define IDE_DH_HDMASK 0x0F
#define IDE_DH_DRV0 0x00
#define IDE_DH_DRV1 0x10
#define IDE_REG_STATUS 0x0007
#define IDE_SR_BUSY 0x80
#define IDE_SR_DRDY 0x40
#define IDE_SR_WERR 0x20
#define IDE_SR_DRQ 0x08
#define IDE_SR_ERR 0x01
#define IDE_REG_COMMAND 0x0007
/* IDE/ATA commands */
#define IDE_CMD_RESET 0x08
#define IDE_CMD_READ 0x20
#define IDE_CMD_READ_ONCE 0x21
#define IDE_CMD_READ_EXT 0x24 /* 48 bit */
#define IDE_CMD_READ_DMA_EXT 0x25 /* 48 bit */
#define IDE_CMD_READ_MULTIPLE_EXT 0x29 /* 48 bit */
#define IDE_CMD_WRITE 0x30
#define IDE_CMD_WRITE_ONCE 0x31
#define IDE_CMD_WRITE_EXT 0x34 /* 48 bit */
#define IDE_CMD_WRITE_DMA_EXT 0x35 /* 48 bit */
#define IDE_CMD_WRITE_MULTIPLE_EXT 0x39 /* 48 bit */
#define IDE_CMD_PACKET 0xA0
#define IDE_CMD_READ_MULTIPLE 0xC4
#define IDE_CMD_WRITE_MULTIPLE 0xC5
#define IDE_CMD_READ_DMA 0xC8
#define IDE_CMD_WRITE_DMA 0xCA
#define IDE_CMD_FLUSH_CACHE 0xE7
#define IDE_CMD_FLUSH_CACHE_EXT 0xEA /* 48 bit */
#define IDE_CMD_IDENT_ATA_DRV 0xEC
#define IDE_CMD_IDENT_ATAPI_DRV 0xA1
#define IDE_CMD_GET_MEDIA_STATUS 0xDA
#include <srb.h>
#include <scsi.h>
//
// Access macros for command registers
// Each macro takes an address of the command port block, and data
// IDE register definition
//
#define IDEReadError(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_ERROR)))
#define IDEWritePrecomp(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_PRECOMP), (Data)))
#define IDEReadSectorCount(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_SECTOR_CNT)))
#define IDEWriteSectorCount(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_SECTOR_CNT), (Data)))
#define IDEReadSectorNum(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_SECTOR_NUM)))
#define IDEWriteSectorNum(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_SECTOR_NUM), (Data)))
#define IDEReadCylinderLow(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_CYL_LOW)))
#define IDEWriteCylinderLow(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_CYL_LOW), (Data)))
#define IDEReadCylinderHigh(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_CYL_HIGH)))
#define IDEWriteCylinderHigh(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_CYL_HIGH), (Data)))
#define IDEReadDriveHead(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_DRV_HEAD)))
#define IDEWriteDriveHead(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_DRV_HEAD), (Data)))
#define IDEReadStatus(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_STATUS)))
#define IDEWriteCommand(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_COMMAND), (Data)))
#define IDEReadDMACommand(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address))))
#define IDEWriteDMACommand(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address)), (Data)))
#define IDEReadDMAStatus(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + 2)))
#define IDEWriteDMAStatus(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + 2), (Data)))
#define IDEWritePRDTable(Address, Data) \
(ScsiPortWritePortUlong((PULONG)((Address) + 4), (Data)))
typedef struct _IDE_REGISTERS_1 {
USHORT Data;
UCHAR BlockCount;
UCHAR BlockNumber;
UCHAR CylinderLow;
UCHAR CylinderHigh;
UCHAR DriveSelect;
UCHAR Command;
} IDE_REGISTERS_1, *PIDE_REGISTERS_1;
typedef struct _IDE_REGISTERS_2 {
UCHAR AlternateStatus;
UCHAR DriveAddress;
} IDE_REGISTERS_2, *PIDE_REGISTERS_2;
typedef struct _IDE_REGISTERS_3 {
ULONG Data;
UCHAR Others[4];
} IDE_REGISTERS_3, *PIDE_REGISTERS_3;
//
// Data block read and write commands
// Device Extension Device Flags
//
#define IDEReadBlock(Address, Buffer, Count) \
(ScsiPortReadPortBufferUshort((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
#define IDEWriteBlock(Address, Buffer, Count) \
(ScsiPortWritePortBufferUshort((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
#define IDEReadBlock32(Address, Buffer, Count) \
(ScsiPortReadPortBufferUlong((PULONG)((Address) + IDE_REG_DATA_PORT), (PULONG)(Buffer), (Count) / 4))
#define IDEWriteBlock32(Address, Buffer, Count) \
(ScsiPortWritePortBufferUlong((PULONG)((Address) + IDE_REG_DATA_PORT), (PULONG)(Buffer), (Count) / 4))
#define DFLAGS_DEVICE_PRESENT 0x0001 // Indicates that some device is present.
#define DFLAGS_ATAPI_DEVICE 0x0002 // Indicates whether Atapi commands can be used.
#define DFLAGS_TAPE_DEVICE 0x0004 // Indicates whether this is a tape device.
#define DFLAGS_INT_DRQ 0x0008 // Indicates whether device interrupts as DRQ is set after
// receiving Atapi Packet Command
#define DFLAGS_REMOVABLE_DRIVE 0x0010 // Indicates that the drive has the 'removable' bit set in
// identify data (offset 128)
#define DFLAGS_MEDIA_STATUS_ENABLED 0x0020 // Media status notification enabled
#define DFLAGS_ATAPI_CHANGER 0x0040 // Indicates atapi 2.5 changer present.
#define DFLAGS_SANYO_ATAPI_CHANGER 0x0080 // Indicates multi-platter device, not conforming to the 2.5 spec.
#define DFLAGS_CHANGER_INITED 0x0100 // Indicates that the init path for changers has already been done.
//
// Used to disable 'advanced' features.
//
#define IDEReadWord(Address) \
(ScsiPortReadPortUshort((PUSHORT)((Address) + IDE_REG_DATA_PORT)))
#define MAX_ERRORS 4
//
// Access macros for control registers
// Each macro takes an address of the control port blank and data
// ATAPI command definitions
//
#define IDEReadAltStatus(Address) \
(ScsiPortReadPortUchar((PUCHAR)((Address) + IDE_REG_ALT_STATUS)))
#define IDEWriteDriveControl(Address, Data) \
(ScsiPortWritePortUchar((PUCHAR)((Address) + IDE_REG_DEV_CNTRL), (Data)))
#define ATAPI_MODE_SENSE 0x5A
#define ATAPI_MODE_SELECT 0x55
#define ATAPI_FORMAT_UNIT 0x24
//
// ATAPI Command Descriptor Block
//
typedef struct _MODE_SENSE_10 {
UCHAR OperationCode;
UCHAR Reserved1;
UCHAR PageCode : 6;
UCHAR Pc : 2;
UCHAR Reserved2[4];
UCHAR ParameterListLengthMsb;
UCHAR ParameterListLengthLsb;
UCHAR Reserved3[3];
} MODE_SENSE_10, *PMODE_SENSE_10;
typedef struct _MODE_SELECT_10 {
UCHAR OperationCode;
UCHAR Reserved1 : 4;
UCHAR PFBit : 1;
UCHAR Reserved2 : 3;
UCHAR Reserved3[5];
UCHAR ParameterListLengthMsb;
UCHAR ParameterListLengthLsb;
UCHAR Reserved4[3];
} MODE_SELECT_10, *PMODE_SELECT_10;
typedef struct _MODE_PARAMETER_HEADER_10 {
UCHAR ModeDataLengthMsb;
UCHAR ModeDataLengthLsb;
UCHAR MediumType;
UCHAR Reserved[5];
}MODE_PARAMETER_HEADER_10, *PMODE_PARAMETER_HEADER_10;
//
// IDE command definitions
//
#define IDE_COMMAND_ATAPI_RESET 0x08
#define IDE_COMMAND_RECALIBRATE 0x10
#define IDE_COMMAND_READ 0x20
#define IDE_COMMAND_WRITE 0x30
#define IDE_COMMAND_VERIFY 0x40
#define IDE_COMMAND_SEEK 0x70
#define IDE_COMMAND_SET_DRIVE_PARAMETERS 0x91
#define IDE_COMMAND_ATAPI_PACKET 0xA0
#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1
#define IDE_COMMAND_READ_MULTIPLE 0xC4
#define IDE_COMMAND_WRITE_MULTIPLE 0xC5
#define IDE_COMMAND_SET_MULTIPLE 0xC6
#define IDE_COMMAND_READ_DMA 0xC8
#define IDE_COMMAND_WRITE_DMA 0xCA
#define IDE_COMMAND_GET_MEDIA_STATUS 0xDA
#define IDE_COMMAND_ENABLE_MEDIA_STATUS 0xEF
#define IDE_COMMAND_IDENTIFY 0xEC
#define IDE_COMMAND_MEDIA_EJECT 0xED
//
// IDE status definitions
//
#define IDE_STATUS_ERROR 0x01
#define IDE_STATUS_INDEX 0x02
#define IDE_STATUS_CORRECTED_ERROR 0x04
#define IDE_STATUS_DRQ 0x08
#define IDE_STATUS_DSC 0x10
#define IDE_STATUS_DRDY 0x40
#define IDE_STATUS_IDLE 0x50
#define IDE_STATUS_BUSY 0x80
//
// IDE drive select/head definitions
//
#define IDE_DRIVE_SELECT_1 0xA0
#define IDE_DRIVE_SELECT_2 0x10
//
// IDE drive control definitions
//
#define IDE_DC_DISABLE_INTERRUPTS 0x02
#define IDE_DC_RESET_CONTROLLER 0x04
#define IDE_DC_REENABLE_CONTROLLER 0x00
//
// IDE error definitions
//
#define IDE_ERROR_BAD_BLOCK 0x80
#define IDE_ERROR_DATA_ERROR 0x40
#define IDE_ERROR_MEDIA_CHANGE 0x20
#define IDE_ERROR_ID_NOT_FOUND 0x10
#define IDE_ERROR_MEDIA_CHANGE_REQ 0x08
#define IDE_ERROR_COMMAND_ABORTED 0x04
#define IDE_ERROR_END_OF_MEDIA 0x02
#define IDE_ERROR_ILLEGAL_LENGTH 0x01
//
// ATAPI register definition
//
typedef struct _ATAPI_REGISTERS_1 {
USHORT Data;
UCHAR InterruptReason;
UCHAR Unused1;
UCHAR ByteCountLow;
UCHAR ByteCountHigh;
UCHAR DriveSelect;
UCHAR Command;
} ATAPI_REGISTERS_1, *PATAPI_REGISTERS_1;
typedef struct _ATAPI_REGISTERS_2 {
UCHAR AlternateStatus;
UCHAR DriveAddress;
} ATAPI_REGISTERS_2, *PATAPI_REGISTERS_2;
//
// ATAPI interrupt reasons
//
#define ATAPI_IR_COD 0x01
#define ATAPI_IR_IO 0x02
//
// IDENTIFY data
//
typedef struct _IDENTIFY_DATA {
USHORT GeneralConfiguration; // 00 00
USHORT NumberOfCylinders; // 02 1
USHORT Reserved1; // 04 2
USHORT NumberOfHeads; // 06 3
USHORT UnformattedBytesPerTrack; // 08 4
USHORT UnformattedBytesPerSector; // 0A 5
USHORT SectorsPerTrack; // 0C 6
USHORT VendorUnique1[3]; // 0E 7-9
USHORT SerialNumber[10]; // 14 10-19
USHORT BufferType; // 28 20
USHORT BufferSectorSize; // 2A 21
USHORT NumberOfEccBytes; // 2C 22
USHORT FirmwareRevision[4]; // 2E 23-26
USHORT ModelNumber[20]; // 36 27-46
UCHAR MaximumBlockTransfer; // 5E 47
UCHAR VendorUnique2; // 5F
USHORT DoubleWordIo; // 60 48
USHORT Capabilities; // 62 49
USHORT Reserved2; // 64 50
UCHAR VendorUnique3; // 66 51
UCHAR PioCycleTimingMode; // 67
UCHAR VendorUnique4; // 68 52
UCHAR DmaCycleTimingMode; // 69
USHORT TranslationFieldsValid:1; // 6A 53
USHORT Reserved3:15;
USHORT NumberOfCurrentCylinders; // 6C 54
USHORT NumberOfCurrentHeads; // 6E 55
USHORT CurrentSectorsPerTrack; // 70 56
ULONG CurrentSectorCapacity; // 72 57-58
USHORT CurrentMultiSectorSetting; // 59
ULONG UserAddressableSectors; // 60-61
USHORT SingleWordDMASupport : 8; // 62
USHORT SingleWordDMAActive : 8;
USHORT MultiWordDMASupport : 8; // 63
USHORT MultiWordDMAActive : 8;
USHORT AdvancedPIOModes : 8; // 64
USHORT Reserved4 : 8;
USHORT MinimumMWXferCycleTime; // 65
USHORT RecommendedMWXferCycleTime; // 66
USHORT MinimumPIOCycleTime; // 67
USHORT MinimumPIOCycleTimeIORDY; // 68
USHORT Reserved5[2]; // 69-70
USHORT ReleaseTimeOverlapped; // 71
USHORT ReleaseTimeServiceCommand; // 72
USHORT MajorRevision; // 73
USHORT MinorRevision; // 74
USHORT Reserved6[50]; // 75-126
USHORT SpecialFunctionsEnabled; // 127
USHORT Reserved7[128]; // 128-255
} IDENTIFY_DATA, *PIDENTIFY_DATA;
//
// Identify data without the Reserved4.
//
typedef struct _IDENTIFY_DATA2 {
USHORT GeneralConfiguration; // 00
USHORT NumberOfCylinders; // 02
USHORT Reserved1; // 04
USHORT NumberOfHeads; // 06
USHORT UnformattedBytesPerTrack; // 08
USHORT UnformattedBytesPerSector; // 0A
USHORT SectorsPerTrack; // 0C
USHORT VendorUnique1[3]; // 0E
USHORT SerialNumber[10]; // 14
USHORT BufferType; // 28
USHORT BufferSectorSize; // 2A
USHORT NumberOfEccBytes; // 2C
USHORT FirmwareRevision[4]; // 2E
USHORT ModelNumber[20]; // 36
UCHAR MaximumBlockTransfer; // 5E
UCHAR VendorUnique2; // 5F
USHORT DoubleWordIo; // 60
USHORT Capabilities; // 62
USHORT Reserved2; // 64
UCHAR VendorUnique3; // 66
UCHAR PioCycleTimingMode; // 67
UCHAR VendorUnique4; // 68
UCHAR DmaCycleTimingMode; // 69
USHORT TranslationFieldsValid:1; // 6A
USHORT Reserved3:15;
USHORT NumberOfCurrentCylinders; // 6C
USHORT NumberOfCurrentHeads; // 6E
USHORT CurrentSectorsPerTrack; // 70
ULONG CurrentSectorCapacity; // 72
} IDENTIFY_DATA2, *PIDENTIFY_DATA2;
#define IDENTIFY_DATA_SIZE sizeof(IDENTIFY_DATA)
//
// IDENTIFY capability bit definitions.
//
#define IDENTIFY_CAPABILITIES_DMA_SUPPORTED 0x0100
#define IDENTIFY_CAPABILITIES_LBA_SUPPORTED 0x0200
//
// IDENTIFY DMA timing cycle modes.
//
#define IDENTIFY_DMA_CYCLES_MODE_0 0x00
#define IDENTIFY_DMA_CYCLES_MODE_1 0x01
#define IDENTIFY_DMA_CYCLES_MODE_2 0x02
typedef struct _BROKEN_CONTROLLER_INFORMATION {
PCHAR VendorId;
ULONG VendorIdLength;
PCHAR DeviceId;
ULONG DeviceIdLength;
}BROKEN_CONTROLLER_INFORMATION, *PBROKEN_CONTROLLER_INFORMATION;
BROKEN_CONTROLLER_INFORMATION const BrokenAdapters[] = {
{ "1095", 4, "0640", 4},
{ "1039", 4, "0601", 4}
};
#define BROKEN_ADAPTERS (sizeof(BrokenAdapters) / sizeof(BROKEN_CONTROLLER_INFORMATION))
typedef struct _NATIVE_MODE_CONTROLLER_INFORMATION {
PCHAR VendorId;
ULONG VendorIdLength;
PCHAR DeviceId;
ULONG DeviceIdLength;
}NATIVE_MODE_CONTROLLER_INFORMATION, *PNATIVE_MODE_CONTROLLER_INFORMATION;
NATIVE_MODE_CONTROLLER_INFORMATION const NativeModeAdapters[] = {
{ "10ad", 4, "0105", 4}
};
#define NUM_NATIVE_MODE_ADAPTERS (sizeof(NativeModeAdapters) / sizeof(NATIVE_MODE_CONTROLLER_INFORMATION))
//
// Beautification macros
//
#define GetStatus(BaseIoAddress, Status) \
Status = ScsiPortReadPortUchar(&BaseIoAddress->AlternateStatus);
#define GetBaseStatus(BaseIoAddress, Status) \
Status = ScsiPortReadPortUchar(&BaseIoAddress->Command);
#define WriteCommand(BaseIoAddress, Command) \
ScsiPortWritePortUchar(&BaseIoAddress->Command, Command);
// IDE_DRIVE_IDENTIFY
#define ReadBuffer(BaseIoAddress, Buffer, Count) \
ScsiPortReadPortBufferUshort(&BaseIoAddress->Data, \
Buffer, \
Count);
typedef struct _IDE_DRIVE_IDENTIFY
{
USHORT ConfigBits; /*00*/
USHORT LogicalCyls; /*01*/
USHORT Reserved02; /*02*/
USHORT LogicalHeads; /*03*/
USHORT BytesPerTrack; /*04*/
USHORT BytesPerSector; /*05*/
USHORT SectorsPerTrack; /*06*/
UCHAR InterSectorGap; /*07*/
UCHAR InterSectorGapSize;
UCHAR Reserved08H; /*08*/
UCHAR BytesInPLO;
USHORT VendorUniqueCnt; /*09*/
UCHAR SerialNumber[20]; /*10*/
USHORT ControllerType; /*20*/
USHORT BufferSize; /*21*/
USHORT ECCByteCnt; /*22*/
UCHAR FirmwareRev[8]; /*23*/
UCHAR ModelNumber[40]; /*27*/
USHORT RWMultImplemented; /*47*/
USHORT DWordIo; /*48*/
USHORT Capabilities; /*49*/
#define IDE_DRID_STBY_SUPPORTED 0x2000
#define IDE_DRID_IORDY_SUPPORTED 0x0800
#define IDE_DRID_IORDY_DISABLE 0x0400
#define IDE_DRID_LBA_SUPPORTED 0x0200
#define IDE_DRID_DMA_SUPPORTED 0x0100
USHORT Reserved50; /*50*/
USHORT MinPIOTransTime; /*51*/
USHORT MinDMATransTime; /*52*/
USHORT TMFieldsValid; /*53*/
USHORT TMCylinders; /*54*/
USHORT TMHeads; /*55*/
USHORT TMSectorsPerTrk; /*56*/
USHORT TMCapacityLo; /*57*/
USHORT TMCapacityHi; /*58*/
USHORT RWMultCurrent; /*59*/
USHORT TMSectorCountLo; /*60*/
USHORT TMSectorCountHi; /*61*/
USHORT DmaModes; /*62*/
USHORT MultiDmaModes; /*63*/
USHORT Reserved64[5]; /*64*/
USHORT Reserved69[2]; /*69*/
USHORT Reserved71[4]; /*71*/
USHORT MaxQueueDepth; /*75*/
USHORT Reserved76[4]; /*76*/
USHORT MajorRevision; /*80*/
USHORT MinorRevision; /*81*/
USHORT SupportedFeatures82; /*82*/
USHORT SupportedFeatures83; /*83*/
USHORT SupportedFeatures84; /*84*/
USHORT EnabledFeatures85; /*85*/
USHORT EnabledFeatures86; /*86*/
USHORT EnabledFeatures87; /*87*/
USHORT UltraDmaModes; /*88*/
USHORT Reserved89[11]; /*89*/
USHORT Max48BitAddress[4]; /*100*/
USHORT Reserved104[151]; /*104*/
USHORT Checksum; /*255*/
} IDE_DRIVE_IDENTIFY, *PIDE_DRIVE_IDENTIFY;
#define WriteBuffer(BaseIoAddress, Buffer, Count) \
ScsiPortWritePortBufferUshort(&BaseIoAddress->Data, \
Buffer, \
Count);
#define ReadBuffer2(BaseIoAddress, Buffer, Count) \
ScsiPortReadPortBufferUlong(&BaseIoAddress->Data, \
Buffer, \
Count);
/* Special ATAPI commands */
#define WriteBuffer2(BaseIoAddress, Buffer, Count) \
ScsiPortWritePortBufferUlong(&BaseIoAddress->Data, \
Buffer, \
Count);
#define ATAPI_FORMAT_UNIT 0x24
#define ATAPI_MODE_SELECT 0x55
#define ATAPI_MODE_SENSE 0x5A
/* Special ATAPI_MODE_SELECT (12 bytes) command block */
typedef struct _ATAPI_MODE_SELECT12
{
UCHAR OperationCode;
UCHAR Reserved1:4;
UCHAR PFBit:1;
UCHAR Reserved2:3;
UCHAR Reserved3[5];
UCHAR ParameterListLengthMsb;
UCHAR ParameterListLengthLsb;
UCHAR Reserved4[3];
} ATAPI_MODE_SELECT12, *PATAPI_MODE_SELECT12;
/* Special ATAPI_MODE_SENSE (12 bytes) command block */
typedef struct _ATAPI_MODE_SENSE12
{
UCHAR OperationCode;
UCHAR Reserved1;
UCHAR PageCode:6;
UCHAR Pc:2;
UCHAR Reserved2[4];
UCHAR ParameterListLengthMsb;
UCHAR ParameterListLengthLsb;
UCHAR Reserved3[3];
} ATAPI_MODE_SENSE12, *PATAPI_MODE_SENSE12;
#ifdef __cplusplus
#define WaitOnBusy(BaseIoAddress, Status) \
{ \
ULONG i; \
for (i=0; i<20000; i++) { \
GetStatus(BaseIoAddress, Status); \
if (Status & IDE_STATUS_BUSY) { \
ScsiPortStallExecution(150); \
continue; \
} else { \
break; \
} \
} \
}
#endif
#endif /* __ATAPT_H */
#define WaitOnBaseBusy(BaseIoAddress, Status) \
{ \
ULONG i; \
for (i=0; i<20000; i++) { \
GetBaseStatus(BaseIoAddress, Status); \
if (Status & IDE_STATUS_BUSY) { \
ScsiPortStallExecution(150); \
continue; \
} else { \
break; \
} \
} \
}
#define WaitForDrq(BaseIoAddress, Status) \
{ \
ULONG i; \
for (i=0; i<1000; i++) { \
GetStatus(BaseIoAddress, Status); \
if (Status & IDE_STATUS_BUSY) { \
ScsiPortStallExecution(100); \
} else if (Status & IDE_STATUS_DRQ) { \
break; \
} else { \
ScsiPortStallExecution(200); \
} \
} \
}
#define WaitShortForDrq(BaseIoAddress, Status) \
{ \
ULONG i; \
for (i=0; i<2; i++) { \
GetStatus(BaseIoAddress, Status); \
if (Status & IDE_STATUS_BUSY) { \
ScsiPortStallExecution(100); \
} else if (Status & IDE_STATUS_DRQ) { \
break; \
} else { \
ScsiPortStallExecution(100); \
} \
} \
}
#define AtapiSoftReset(BaseIoAddress,DeviceNumber) \
{\
UCHAR statusByte; \
ScsiPortWritePortUchar(&BaseIoAddress->DriveSelect,(UCHAR)(((DeviceNumber & 0x1) << 4) | 0xA0)); \
ScsiPortStallExecution(500);\
ScsiPortWritePortUchar(&BaseIoAddress->Command, IDE_COMMAND_ATAPI_RESET); \
ScsiPortStallExecution(1000*1000);\
ScsiPortWritePortUchar(&BaseIoAddress->DriveSelect,(UCHAR)((DeviceNumber << 4) | 0xA0)); \
WaitOnBusy( ((PIDE_REGISTERS_2)((PUCHAR)BaseIoAddress + 0x206)), statusByte); \
ScsiPortStallExecution(500);\
}
#define IdeHardReset(BaseIoAddress,result) \
{\
UCHAR statusByte;\
ULONG i;\
ScsiPortWritePortUchar(&BaseIoAddress->AlternateStatus,IDE_DC_RESET_CONTROLLER );\
ScsiPortStallExecution(50 * 1000);\
ScsiPortWritePortUchar(&BaseIoAddress->AlternateStatus,IDE_DC_REENABLE_CONTROLLER);\
for (i = 0; i < 1000 * 1000; i++) {\
statusByte = ScsiPortReadPortUchar(&BaseIoAddress->AlternateStatus);\
if (statusByte != IDE_STATUS_IDLE && statusByte != 0x0) {\
ScsiPortStallExecution(5);\
} else {\
break;\
}\
}\
if (i == 1000*1000) {\
result = FALSE;\
}\
result = TRUE;\
}
#define IS_RDP(OperationCode)\
((OperationCode == SCSIOP_ERASE)||\
(OperationCode == SCSIOP_LOAD_UNLOAD)||\
(OperationCode == SCSIOP_LOCATE)||\
(OperationCode == SCSIOP_REWIND) ||\
(OperationCode == SCSIOP_SPACE)||\
(OperationCode == SCSIOP_SEEK)||\
(OperationCode == SCSIOP_WRITE_FILEMARKS))

View file

@ -1,4 +1,4 @@
<module name="atapi" type="kernelmodedriver" installbase="system32/drivers" installname="atapi.sys">
<module name="atapi" type="kernelmodedriver" installbase="system32/drivers" installname="atapi.sys" allowwarnings="true">
<bootstrap base="$(CDOUTPUT)" />
<define name="__USE_W32API" />
<include base="atapi">.</include>

View file

@ -1,7 +1,7 @@
/* $Id$ */
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ATAPI Device Driver\0"
#define REACTOS_STR_FILE_DESCRIPTION "ATAPI IDE Miniport Driver\0"
#define REACTOS_STR_INTERNAL_NAME "atapi\0"
#define REACTOS_STR_ORIGINAL_FILENAME "atapi.sys\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,53 @@
Window NT Device Driver Kit
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund, or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a refund of a prorata portion of the subscription price.
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. To develop Windows NT(tm) device drivers, you will need to utilize two computers, one for development and one for debugging.
1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights:
* SOFTWARE PRODUCT. (a) You may make two (2) copies of the SOFTWARE PRODUCT for installation and use on two (2) computers, one for use in development and one for use in debugging to design, develop, and test your software product(s), including but not limited to device driver(s) and other software products, for use with Microsoft(r) Windows(r) or Windows NT ("Software Product"). You may make an additional copy of the Windows NT Workstation operating system (licensed and provided separately) for use on a single computer used for debugging purposes.
* Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein.
* SAMPLE CODE. You may modify the sample source code ("Sample Code") to design, develop and test your Software Product, and reproduce and distribute the Sample Code with such modifications in source and object code forms, provided that you comply with the Distribution Requirements described below.
* DISTRIBUTION REQUIREMENTS. You may copy and redistribute the Sample Code as described above, provided that (a) you distribute the Sample Code only in conjunction with and as a part of your Software Product; (b) you do not make any statements to the effect or which imply that your Software Product is "certified" by Microsoft or that its performance is guaranteed by Microsoft; (c) you do not use Microsoft's name, logo, or trademarks to market your Software Product; (d) you include a valid copyright notice on your Software Product; and (e) you indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Software Product. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the Sample Code
* Microsoft reserves all rights not expressly granted to you.
2. COPYRIGHT. All right, title, and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT), and any copies of the SOFTWARE PRODUCT, are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE.
4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
( Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse-engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
( Rental. You may not rent or lease the SOFTWARE PRODUCT.
( Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
( Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data or (b) your Application as described in Section 1 of this Agreement (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission.
NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed one hundred dollars (US$100.00).
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use or inability to use this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
U.S. GOVERNMENT RESTRICTED RIGHTS.The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
If you acquired this product in the United States, this Agreement is governed by the laws of the State of Washington. If you acquired this product outside the United States, local law may apply.
Should you have any questions concerning this Agreement, if you desire rights to use the product beyond what is listed here, or if you desire to contact Microsoft for any reason, please contact your local Microsoft subsidiary or sales office or write to: Microsoft Sales and Service, One Microsoft Way, Redmond, WA 98052-6399.
Si vous avez acquis votre produit Microsoft au CANADA, la garantie limitée suivante vous concerne :
GARANTIE LIMITÉE
EXCLUSION DE GARANTIES. Microsoft renonce entièrement à toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis «comme tels» sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas, aux garanties implicites de la qualité marchande ou un usage particulier. Le risque total découlant de l'utilisation ou de la performance du LOGICIEL est entre vos mains.
RESPONSABILITÉ LIMITÉE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excèderont pas cent dollars (US$100.00).
ABSENCE DE RESPONSABILITÉ POUR LES DOMMAGES INDIRECTS. Microsoft ou ses fournisseurs ne pourront être tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de façon limitative aux dommages directs ou indirects causés par la perte de bénéfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pécuniaire) résultant de l'utilisation ou de l'impossibilité d'utilisation de ce produit, et ce, même si la société Microsoft a été avisée de l'éventualité de tels dommages. Certains états/juridictions ne permettent pas l'exclusion ou la limitation de responsabilité relative aux dommages indirects ou consécutifs, et la limitation ci-dessus peut ne pas s'appliquer à votre égard.
La présente Convention est régie par les lois de la province d'Ontario, Canada. Chacune des parties à la présente reconnaît irrévocablement la compétence des tribunaux de la province d'Ontario et consent à instituer tout litige qui pourrait découler de la présente auprès des tribunaux situés dans le district judiciaire de York, province d'Ontario.
Au cas où vous auriez des questions concernant cette licence ou que vous désiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou écrire à : Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399.

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,12 @@
<module name="cdrom" type="kernelmodedriver" installbase="system32/drivers" installname="cdrom.sys">
<module name="cdrom" type="kernelmodedriver" installbase="system32/drivers" installname="cdrom.sys" allowwarnings="true">
<bootstrap base="$(CDOUTPUT)" />
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<library>class2</library>
<library>scsiport</library>
<include base="cdrom">..</include>
<file>cdrom.c</file>
<file>findscsi.c</file>
<file>cdrom.rc</file>
</module>

View file

@ -0,0 +1,315 @@
/*
* PROJECT: ReactOS Storage Stack
* LICENSE: DDK - see license.txt in the root dir
* FILE: drivers/storage/cdrom/cdrom.c
* PURPOSE: CDROM driver
* PROGRAMMERS: Based on a source code sample from Microsoft NT4 DDK
*/
#include <ntddk.h>
#include <scsi.h>
#include <ntddscsi.h>
#include <ntdddisk.h>
#include <ntddcdrm.h>
#include <include/class2.h>
#include <stdio.h>
//#define NDEBUG
#include <debug.h>
NTSTATUS
STDCALL
FindScsiAdapter (
IN HANDLE KeyHandle,
IN UNICODE_STRING ScsiUnicodeString[],
OUT PUCHAR IntermediateController
);
#define INIT_OPEN_KEY(name, rootHandle, pNewHandle) \
InitializeObjectAttributes( \
&objectAttributes, \
(name), \
OBJ_CASE_INSENSITIVE, \
(rootHandle), \
NULL \
); \
\
status = ZwOpenKey( \
(pNewHandle), \
KEY_READ | KEY_ENUMERATE_SUB_KEYS, \
&objectAttributes \
);
NTSTATUS
STDCALL
FindScsiAdapter (
IN HANDLE KeyHandle,
IN UNICODE_STRING ScsiUnicodeString[],
OUT UCHAR *IntermediateController
)
/*++
Routine Description:
Recursive routine to walk registry tree under KeyHandle looking for
location of ScsiAdapter and other valid controllers that the ScsiAdapter
might hang off of. When ScsiAdapter is found, FindScsiAdapter
returns an ARC name for the intervening controller(s) between the
original key and ScsiAdapter.
Arguments:
KeyHandle -- Handle of open registry key (somewhere under
\Registry\Machine\Hardware\Description\System)
ScsiUnicodeString -- NT name of SCSI device being sought in the registry
IntermediateController -- Null terminated buffer which this routine fills with
ARC name for intervening controller(s). Null is returned
if ScsiAdapter sits at the root or if it is not found.
Return Value:
STATUS_SUCCESS -- IntermediateController set to something like multi(1)
STATUS_OBJECT_PATH_NOT_FOUND -- all ok, but no ScsiAdapter
(with correct scsi id & lun info) found; In this case
IntermediateController is explicitly set to null.
Other status codes as returned by open\enumerate registry routines
may also be returned.
--*/
{
#if 0
NTSTATUS status;
ULONG index;
ULONG resultLength;
UCHAR lowerController[64];
BOOLEAN validControllerNumber;
UNICODE_STRING unicodeString[64];
OBJECT_ATTRIBUTES objectAttributes;
HANDLE controllerHandle;
HANDLE controllerNumberHandle;
ULONG controllerIndex;
ULONG controllerNumberIndex;
UCHAR keyBuffer[256]; // Allow for variable length name at end
UCHAR numberKeyBuffer[64];
PKEY_BASIC_INFORMATION pControllerKeyInformation;
PKEY_BASIC_INFORMATION pControllerNumberKeyInformation;
// TODO: Any PAGED_CODE stuff...
//
// Walk enumerated subkeys, looking for valid controllers
//
for (controllerIndex = 0; TRUE; controllerIndex++) {
//
// Ensure pControllerKeyInformation->Name is null terminated
//
RtlZeroMemory(keyBuffer, sizeof(keyBuffer));
pControllerKeyInformation = (PKEY_BASIC_INFORMATION) keyBuffer;
status = ZwEnumerateKey(
KeyHandle,
controllerIndex,
KeyBasicInformation,
pControllerKeyInformation,
sizeof(keyBuffer),
&resultLength
);
if (!NT_SUCCESS(status)) {
if (status != STATUS_NO_MORE_ENTRIES) {
DebugPrint ((2, "FindScsiAdapter: Error 0x%x enumerating key\n", status));
return(status);
}
break; // return NOT_FOUND
}
DebugPrint ((3, "FindScsiAdapter: Found Adapter=%S\n", pControllerKeyInformation->Name));
if (!_wcsicmp(pControllerKeyInformation->Name, L"ScsiAdapter")) {
//
// Found scsi, now verify that it's the same one we're trying to initialize.
//
INIT_OPEN_KEY (ScsiUnicodeString, KeyHandle, &controllerHandle);
ZwClose(controllerHandle);
if (NT_SUCCESS(status)) {
//
// Found correct scsi, now build ARC name of IntermediateController
// (i.e. the intervening controllers, or everything above ScsiAdapter)
// start with null, and build string one controller at a time as we
// return up the recursively called routine.
//
IntermediateController = "\0";
return (STATUS_SUCCESS);
}
//
// Found ScsiAdapter, but wrong scsi id or Lun info doesn't match,
// (ignore other ZwOpenKey errors &) keep looking...
//
}
else if (!_wcsicmp(pControllerKeyInformation->Name, L"MultifunctionAdapter") ||
!_wcsicmp(pControllerKeyInformation->Name, L"EisaAdapter")) {
//
// This is a valid controller that may have ScsiAdapter beneath it.
// Open controller & walk controller's subkeys: 0, 1, 2, etc....
//
RtlInitUnicodeString (unicodeString, pControllerKeyInformation->Name);
INIT_OPEN_KEY (unicodeString, KeyHandle, &controllerHandle);
if (!NT_SUCCESS(status)) {
DebugPrint ((2, "FindScsiAdapter: ZwOpenKey got status = %x \n", status));
ZwClose (controllerHandle);
return (status);
}
for (controllerNumberIndex = 0; TRUE; controllerNumberIndex++) {
RtlZeroMemory(numberKeyBuffer, sizeof(numberKeyBuffer));
pControllerNumberKeyInformation = (PKEY_BASIC_INFORMATION) numberKeyBuffer;
status = ZwEnumerateKey(
controllerHandle,
controllerNumberIndex,
KeyBasicInformation,
pControllerNumberKeyInformation,
sizeof(numberKeyBuffer),
&resultLength
);
if (!NT_SUCCESS(status)) {
if (status != STATUS_NO_MORE_ENTRIES) {
DebugPrint ((2, "FindScsiAdapter: Status %x enumerating key\n", status));
ZwClose(controllerHandle);
return (status);
}
ZwClose(controllerHandle);
break; // next controller
}
DebugPrint ((3, "FindScsiAdapter: Found Adapter #=%S\n", pControllerNumberKeyInformation->Name));
validControllerNumber = TRUE;
for (index = 0; index < pControllerNumberKeyInformation->NameLength / 2; index++) {
if (!isxdigit(pControllerNumberKeyInformation->Name[index])) {
validControllerNumber = FALSE;
break;
}
}
if (validControllerNumber) {
//
// Found valid controller and controller number: check children for scsi.
//
RtlInitUnicodeString (unicodeString, pControllerNumberKeyInformation->Name);
INIT_OPEN_KEY (unicodeString, controllerHandle, &controllerNumberHandle);
if (!NT_SUCCESS(status)) {
DebugPrint ((2, "FindScsiAdapter: Status %x opening controller number key\n", status));
ZwClose(controllerNumberHandle);
ZwClose(controllerHandle);
return (status);
}
RtlZeroMemory(lowerController, sizeof(lowerController));
status = FindScsiAdapter(
controllerNumberHandle,
ScsiUnicodeString,
&lowerController[0]
);
ZwClose(controllerNumberHandle);
if (NT_SUCCESS(status)) {
//
// SUCCESS!
//
// Scsi adapter DOES exist under this node,
// prepend Arc Name for the current adapter to whatever was returned
// by other calls to this routine.
//
if (!_wcsicmp(pControllerKeyInformation->Name, L"MultifunctionAdapter")) {
sprintf(IntermediateController, "multi(0)%s", lowerController);
} else {
sprintf(IntermediateController, "eisa(0)%s", lowerController);
}
ZwClose(controllerHandle);
return(STATUS_SUCCESS);
}
else if (status != STATUS_OBJECT_PATH_NOT_FOUND) {
ZwClose(controllerHandle);
return(status);
}
//
// Scsi not found under this controller number, check next one
//
} // if validControllerNumber
} // for controllerNumberIndex
//
// ScsiAdapter not found under this controller
//
ZwClose(controllerHandle);
} // else if valid subkey (i.e., scsi, multi, eisa)
} // for controllerIndex
//
// ScsiAdapter not found under key we were called with
//
IntermediateController = "\0";
#endif
return (STATUS_OBJECT_PATH_NOT_FOUND);
}

View file

@ -0,0 +1,53 @@
Window NT Device Driver Kit
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund, or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a refund of a prorata portion of the subscription price.
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. To develop Windows NT(tm) device drivers, you will need to utilize two computers, one for development and one for debugging.
1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights:
* SOFTWARE PRODUCT. (a) You may make two (2) copies of the SOFTWARE PRODUCT for installation and use on two (2) computers, one for use in development and one for use in debugging to design, develop, and test your software product(s), including but not limited to device driver(s) and other software products, for use with Microsoft(r) Windows(r) or Windows NT ("Software Product"). You may make an additional copy of the Windows NT Workstation operating system (licensed and provided separately) for use on a single computer used for debugging purposes.
* Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein.
* SAMPLE CODE. You may modify the sample source code ("Sample Code") to design, develop and test your Software Product, and reproduce and distribute the Sample Code with such modifications in source and object code forms, provided that you comply with the Distribution Requirements described below.
* DISTRIBUTION REQUIREMENTS. You may copy and redistribute the Sample Code as described above, provided that (a) you distribute the Sample Code only in conjunction with and as a part of your Software Product; (b) you do not make any statements to the effect or which imply that your Software Product is "certified" by Microsoft or that its performance is guaranteed by Microsoft; (c) you do not use Microsoft's name, logo, or trademarks to market your Software Product; (d) you include a valid copyright notice on your Software Product; and (e) you indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Software Product. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the Sample Code
* Microsoft reserves all rights not expressly granted to you.
2. COPYRIGHT. All right, title, and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT), and any copies of the SOFTWARE PRODUCT, are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE.
4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
( Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse-engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
( Rental. You may not rent or lease the SOFTWARE PRODUCT.
( Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
( Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data or (b) your Application as described in Section 1 of this Agreement (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission.
NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed one hundred dollars (US$100.00).
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use or inability to use this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
U.S. GOVERNMENT RESTRICTED RIGHTS.The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
If you acquired this product in the United States, this Agreement is governed by the laws of the State of Washington. If you acquired this product outside the United States, local law may apply.
Should you have any questions concerning this Agreement, if you desire rights to use the product beyond what is listed here, or if you desire to contact Microsoft for any reason, please contact your local Microsoft subsidiary or sales office or write to: Microsoft Sales and Service, One Microsoft Way, Redmond, WA 98052-6399.
Si vous avez acquis votre produit Microsoft au CANADA, la garantie limitée suivante vous concerne :
GARANTIE LIMITÉE
EXCLUSION DE GARANTIES. Microsoft renonce entièrement à toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis «comme tels» sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas, aux garanties implicites de la qualité marchande ou un usage particulier. Le risque total découlant de l'utilisation ou de la performance du LOGICIEL est entre vos mains.
RESPONSABILITÉ LIMITÉE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excèderont pas cent dollars (US$100.00).
ABSENCE DE RESPONSABILITÉ POUR LES DOMMAGES INDIRECTS. Microsoft ou ses fournisseurs ne pourront être tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de façon limitative aux dommages directs ou indirects causés par la perte de bénéfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pécuniaire) résultant de l'utilisation ou de l'impossibilité d'utilisation de ce produit, et ce, même si la société Microsoft a été avisée de l'éventualité de tels dommages. Certains états/juridictions ne permettent pas l'exclusion ou la limitation de responsabilité relative aux dommages indirects ou consécutifs, et la limitation ci-dessus peut ne pas s'appliquer à votre égard.
La présente Convention est régie par les lois de la province d'Ontario, Canada. Chacune des parties à la présente reconnaît irrévocablement la compétence des tribunaux de la province d'Ontario et consent à instituer tout litige qui pourrait découler de la présente auprès des tribunaux situés dans le district judiciaire de York, province d'Ontario.
Au cas où vous auriez des questions concernant cette licence ou que vous désiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou écrire à : Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399.

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,10 @@
<module name="class2" type="exportdriver" installbase="system32/drivers" installname="class2.sys">
<module name="class2" type="exportdriver" installbase="system32/drivers" installname="class2.sys" allowwarnings="true">
<bootstrap base="$(CDOUTPUT)" />
<define name="__USE_W32API" />
<importlibrary definition="class2.def" />
<library>ntoskrnl</library>
<library>hal</library>
<library>scsiport</library>
<include base="class2">..</include>
<file>class2.c</file>
<file>class2.rc</file>

View file

@ -0,0 +1,53 @@
Window NT Device Driver Kit
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund, or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a refund of a prorata portion of the subscription price.
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. To develop Windows NT(tm) device drivers, you will need to utilize two computers, one for development and one for debugging.
1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights:
* SOFTWARE PRODUCT. (a) You may make two (2) copies of the SOFTWARE PRODUCT for installation and use on two (2) computers, one for use in development and one for use in debugging to design, develop, and test your software product(s), including but not limited to device driver(s) and other software products, for use with Microsoft(r) Windows(r) or Windows NT ("Software Product"). You may make an additional copy of the Windows NT Workstation operating system (licensed and provided separately) for use on a single computer used for debugging purposes.
* Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein.
* SAMPLE CODE. You may modify the sample source code ("Sample Code") to design, develop and test your Software Product, and reproduce and distribute the Sample Code with such modifications in source and object code forms, provided that you comply with the Distribution Requirements described below.
* DISTRIBUTION REQUIREMENTS. You may copy and redistribute the Sample Code as described above, provided that (a) you distribute the Sample Code only in conjunction with and as a part of your Software Product; (b) you do not make any statements to the effect or which imply that your Software Product is "certified" by Microsoft or that its performance is guaranteed by Microsoft; (c) you do not use Microsoft's name, logo, or trademarks to market your Software Product; (d) you include a valid copyright notice on your Software Product; and (e) you indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Software Product. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the Sample Code
* Microsoft reserves all rights not expressly granted to you.
2. COPYRIGHT. All right, title, and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT), and any copies of the SOFTWARE PRODUCT, are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE.
4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
( Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse-engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
( Rental. You may not rent or lease the SOFTWARE PRODUCT.
( Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
( Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data or (b) your Application as described in Section 1 of this Agreement (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission.
NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed one hundred dollars (US$100.00).
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use or inability to use this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
U.S. GOVERNMENT RESTRICTED RIGHTS.The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
If you acquired this product in the United States, this Agreement is governed by the laws of the State of Washington. If you acquired this product outside the United States, local law may apply.
Should you have any questions concerning this Agreement, if you desire rights to use the product beyond what is listed here, or if you desire to contact Microsoft for any reason, please contact your local Microsoft subsidiary or sales office or write to: Microsoft Sales and Service, One Microsoft Way, Redmond, WA 98052-6399.
Si vous avez acquis votre produit Microsoft au CANADA, la garantie limitée suivante vous concerne :
GARANTIE LIMITÉE
EXCLUSION DE GARANTIES. Microsoft renonce entièrement à toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis «comme tels» sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas, aux garanties implicites de la qualité marchande ou un usage particulier. Le risque total découlant de l'utilisation ou de la performance du LOGICIEL est entre vos mains.
RESPONSABILITÉ LIMITÉE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excèderont pas cent dollars (US$100.00).
ABSENCE DE RESPONSABILITÉ POUR LES DOMMAGES INDIRECTS. Microsoft ou ses fournisseurs ne pourront être tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de façon limitative aux dommages directs ou indirects causés par la perte de bénéfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pécuniaire) résultant de l'utilisation ou de l'impossibilité d'utilisation de ce produit, et ce, même si la société Microsoft a été avisée de l'éventualité de tels dommages. Certains états/juridictions ne permettent pas l'exclusion ou la limitation de responsabilité relative aux dommages indirects ou consécutifs, et la limitation ci-dessus peut ne pas s'appliquer à votre égard.
La présente Convention est régie par les lois de la province d'Ontario, Canada. Chacune des parties à la présente reconnaît irrévocablement la compétence des tribunaux de la province d'Ontario et consent à instituer tout litige qui pourrait découler de la présente auprès des tribunaux situés dans le district judiciaire de York, province d'Ontario.
Au cas où vous auriez des questions concernant cette licence ou que vous désiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou écrire à : Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399.

View file

@ -22,8 +22,8 @@
<directory name="pciidex">
<xi:include href="pciidex/pciidex.rbuild" />
</directory>
<directory name="scsiport">
<xi:include href="scsiport/scsiport.rbuild" />
<directory name="scsiport-new">
<xi:include href="scsiport-new/scsiport.rbuild" />
</directory>
<directory name="diskdump">
<xi:include href="diskdump/diskdump.rbuild" />

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,7 @@
<library>ntoskrnl</library>
<library>hal</library>
<library>class2</library>
<library>scsiport</library>
<include base="disk">..</include>
<file>disk.c</file>
<file>disk.rc</file>

View file

@ -0,0 +1,53 @@
Window NT Device Driver Kit
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund, or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a refund of a prorata portion of the subscription price.
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. To develop Windows NT(tm) device drivers, you will need to utilize two computers, one for development and one for debugging.
1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights:
* SOFTWARE PRODUCT. (a) You may make two (2) copies of the SOFTWARE PRODUCT for installation and use on two (2) computers, one for use in development and one for use in debugging to design, develop, and test your software product(s), including but not limited to device driver(s) and other software products, for use with Microsoft(r) Windows(r) or Windows NT ("Software Product"). You may make an additional copy of the Windows NT Workstation operating system (licensed and provided separately) for use on a single computer used for debugging purposes.
* Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein.
* SAMPLE CODE. You may modify the sample source code ("Sample Code") to design, develop and test your Software Product, and reproduce and distribute the Sample Code with such modifications in source and object code forms, provided that you comply with the Distribution Requirements described below.
* DISTRIBUTION REQUIREMENTS. You may copy and redistribute the Sample Code as described above, provided that (a) you distribute the Sample Code only in conjunction with and as a part of your Software Product; (b) you do not make any statements to the effect or which imply that your Software Product is "certified" by Microsoft or that its performance is guaranteed by Microsoft; (c) you do not use Microsoft's name, logo, or trademarks to market your Software Product; (d) you include a valid copyright notice on your Software Product; and (e) you indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Software Product. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the Sample Code
* Microsoft reserves all rights not expressly granted to you.
2. COPYRIGHT. All right, title, and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT), and any copies of the SOFTWARE PRODUCT, are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE.
4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
( Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse-engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
( Rental. You may not rent or lease the SOFTWARE PRODUCT.
( Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
( Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data or (b) your Application as described in Section 1 of this Agreement (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission.
NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed one hundred dollars (US$100.00).
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use or inability to use this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
U.S. GOVERNMENT RESTRICTED RIGHTS.The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software -- Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
If you acquired this product in the United States, this Agreement is governed by the laws of the State of Washington. If you acquired this product outside the United States, local law may apply.
Should you have any questions concerning this Agreement, if you desire rights to use the product beyond what is listed here, or if you desire to contact Microsoft for any reason, please contact your local Microsoft subsidiary or sales office or write to: Microsoft Sales and Service, One Microsoft Way, Redmond, WA 98052-6399.
Si vous avez acquis votre produit Microsoft au CANADA, la garantie limitée suivante vous concerne :
GARANTIE LIMITÉE
EXCLUSION DE GARANTIES. Microsoft renonce entièrement à toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis «comme tels» sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas, aux garanties implicites de la qualité marchande ou un usage particulier. Le risque total découlant de l'utilisation ou de la performance du LOGICIEL est entre vos mains.
RESPONSABILITÉ LIMITÉE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excèderont pas cent dollars (US$100.00).
ABSENCE DE RESPONSABILITÉ POUR LES DOMMAGES INDIRECTS. Microsoft ou ses fournisseurs ne pourront être tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de façon limitative aux dommages directs ou indirects causés par la perte de bénéfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pécuniaire) résultant de l'utilisation ou de l'impossibilité d'utilisation de ce produit, et ce, même si la société Microsoft a été avisée de l'éventualité de tels dommages. Certains états/juridictions ne permettent pas l'exclusion ou la limitation de responsabilité relative aux dommages indirects ou consécutifs, et la limitation ci-dessus peut ne pas s'appliquer à votre égard.
La présente Convention est régie par les lois de la province d'Ontario, Canada. Chacune des parties à la présente reconnaît irrévocablement la compétence des tribunaux de la province d'Ontario et consent à instituer tout litige qui pourrait découler de la présente auprès des tribunaux situés dans le district judiciaire de York, province d'Ontario.
Au cas où vous auriez des questions concernant cette licence ou que vous désiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou écrire à : Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399.

View file

@ -16,6 +16,34 @@
#define MAXIMUM_RETRIES 15
#define RETRY_WAIT 2000000 /* 200 ms in units of 100 ns */
//
// Indicates that the device has write caching enabled.
//
#define DEV_WRITE_CACHE 0x00000001
//
// Build SCSI 1 or SCSI 2 CDBs
//
#define DEV_USE_SCSI1 0x00000002
//
// Indicates whether is is safe to send StartUnit commands
// to this device. It will only be off for some removeable devices.
//
#define DEV_SAFE_START_UNIT 0x00000004
//
// Indicates whether it is unsafe to send SCSIOP_MECHANISM_STATUS commands to
// this device. Some devices don't like these 12 byte commands
//
#define DEV_NO_12BYTE_CDB 0x00000008
struct _CLASS_INIT_DATA;
typedef VOID
@ -228,6 +256,15 @@ ScsiClassSplitRequest(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN ULONG MaximumBytes);
NTSTATUS
STDCALL
ScsiClassCheckVerifyComplete(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
);
#endif /* __INCLUDE_DDK_CLASS2_H */
/* EOF */

View file

@ -1,4 +1,4 @@
<module name="scsiport-new" type="exportdriver" installbase="system32/drivers" installname="scsiport.sys">
<module name="scsiport" type="exportdriver" installbase="system32/drivers" installname="scsiport.sys">
<bootstrap base="$(CDOUTPUT)" />
<define name="__USE_W32API" />
<define name="_SCSIPORT_" />

File diff suppressed because it is too large Load diff

View file

@ -1,52 +0,0 @@
; $Id$
;
; scsiport.def - export definition file for scsiport driver
;
LIBRARY SCSIPORT.SYS
EXPORTS
ScsiDebugPrint
ScsiPortCompleteRequest@20
ScsiPortConvertPhysicalAddressToUlong@8
ScsiPortConvertUlongToPhysicalAddress@4=NTOSKRNL.RtlConvertUlongToLargeInteger
ScsiPortFlushDma@4
ScsiPortFreeDeviceBase@8
ScsiPortGetBusData@24
ScsiPortGetDeviceBase@28
ScsiPortGetLogicalUnit@16
ScsiPortGetPhysicalAddress@16
ScsiPortGetSrb@20
ScsiPortGetUncachedExtension@12
ScsiPortGetVirtualAddress@12
ScsiPortInitialize@16
ScsiPortIoMapTransfer@16
ScsiPortLogError@28
ScsiPortMoveMemory@12
ScsiPortNotification
ScsiPortReadPortBufferUchar@12=HAL.READ_PORT_BUFFER_UCHAR
ScsiPortReadPortBufferUshort@12=HAL.READ_PORT_BUFFER_USHORT
ScsiPortReadPortBufferUlong@12=HAL.READ_PORT_BUFFER_ULONG
ScsiPortReadPortUchar@4=HAL.READ_PORT_UCHAR
ScsiPortReadPortUshort@4=HAL.READ_PORT_USHORT
ScsiPortReadPortUlong@4=HAL.READ_PORT_ULONG
ScsiPortReadRegisterBufferUchar@12=NTOSKRNL.READ_REGISTER_BUFFER_UCHAR
ScsiPortReadRegisterBufferUshort@12=NTOSKRNL.READ_REGISTER_BUFFER_USHORT
ScsiPortReadRegisterBufferUlong@12=NTOSKRNL.READ_REGISTER_BUFFER_ULONG
ScsiPortReadRegisterUchar@4=NTOSKRNL.READ_REGISTER_UCHAR
ScsiPortReadRegisterUshort@4=NTOSKRNL.READ_REGISTER_USHORT
ScsiPortReadRegisterUlong@4=NTOSKRNL.READ_REGISTER_ULONG
ScsiPortSetBusDataByOffset@28
ScsiPortStallExecution@4=HAL.KeStallExecutionProcessor
ScsiPortValidateRange@28
ScsiPortWritePortUchar@8=HAL.WRITE_PORT_UCHAR
ScsiPortWritePortUshort@8=HAL.WRITE_PORT_USHORT
ScsiPortWritePortUlong@8=HAL.WRITE_PORT_ULONG
ScsiPortWritePortBufferUchar@12=HAL.WRITE_PORT_BUFFER_UCHAR
ScsiPortWritePortBufferUshort@12=HAL.WRITE_PORT_BUFFER_USHORT
ScsiPortWritePortBufferUlong@12=HAL.WRITE_PORT_BUFFER_ULONG
ScsiPortWriteRegisterBufferUchar@12=NTOSKRNL.WRITE_REGISTER_BUFFER_UCHAR
ScsiPortWriteRegisterBufferUshort@12=NTOSKRNL.WRITE_REGISTER_BUFFER_USHORT
ScsiPortWriteRegisterBufferUlong@12=NTOSKRNL.WRITE_REGISTER_BUFFER_ULONG
ScsiPortWriteRegisterUchar@8=NTOSKRNL.WRITE_REGISTER_UCHAR
ScsiPortWriteRegisterUshort@8=NTOSKRNL.WRITE_REGISTER_USHORT
ScsiPortWriteRegisterUlong@8=NTOSKRNL.WRITE_REGISTER_ULONG
;EOF

View file

@ -1,11 +0,0 @@
<module name="scsiport" type="exportdriver" installbase="system32/drivers" installname="scsiport.sys">
<bootstrap base="$(CDOUTPUT)" />
<define name="__USE_W32API" />
<define name="_SCSIPORT_" />
<importlibrary definition="scsiport.def" />
<include base="scsiport">.</include>
<library>ntoskrnl</library>
<library>hal</library>
<file>scsiport.c</file>
<file>scsiport.rc</file>
</module>

View file

@ -1,7 +0,0 @@
/* $Id$ */
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "SCSI Port Driver\0"
#define REACTOS_STR_INTERNAL_NAME "scsiport\0"
#define REACTOS_STR_ORIGINAL_FILENAME "scsiport.sys\0"
#include <reactos/version.rc>

View file

@ -1,136 +0,0 @@
/*
* SCSI_PORT_TIMER_STATES
*
* 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,
IDETimerCmdWait,
IDETimerResetWaitForBusyNegate,
IDETimerResetWaitForDrdyAssert
} SCSI_PORT_TIMER_STATES;
typedef struct _SCSI_PORT_DEVICE_BASE
{
LIST_ENTRY List;
PVOID MappedAddress;
ULONG NumberOfBytes;
SCSI_PHYSICAL_ADDRESS IoAddress;
ULONG SystemIoBusNumber;
} SCSI_PORT_DEVICE_BASE, *PSCSI_PORT_DEVICE_BASE;
typedef struct _SCSI_PORT_LUN_EXTENSION
{
LIST_ENTRY List;
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
BOOLEAN DeviceClaimed;
PDEVICE_OBJECT DeviceObject;
INQUIRYDATA InquiryData;
ULONG PendingIrpCount;
ULONG ActiveIrpCount;
PIRP NextIrp;
ULONG Flags;
/* More data? */
UCHAR MiniportLunExtension[1]; /* must be the last entry */
} SCSI_PORT_LUN_EXTENSION, *PSCSI_PORT_LUN_EXTENSION;
/*
* SCSI_PORT_DEVICE_EXTENSION
*
* DESCRIPTION
* First part of the port objects device extension. The second
* part is the miniport-specific device extension.
*/
typedef struct _SCSI_PORT_DEVICE_EXTENSION
{
ULONG Length;
ULONG MiniPortExtensionSize;
PPORT_CONFIGURATION_INFORMATION PortConfig;
ULONG PortNumber;
KSPIN_LOCK Lock;
ULONG Flags;
PKINTERRUPT Interrupt;
SCSI_PORT_TIMER_STATES TimerState;
LONG TimerCount;
LIST_ENTRY DeviceBaseListHead;
ULONG LunExtensionSize;
LIST_ENTRY LunExtensionListHead;
ULONG SrbExtensionSize;
PIO_SCSI_CAPABILITIES PortCapabilities;
PDEVICE_OBJECT DeviceObject;
PCONTROLLER_OBJECT ControllerObject;
PHW_STARTIO HwStartIo;
PHW_INTERRUPT HwInterrupt;
/* DMA related stuff */
PADAPTER_OBJECT AdapterObject;
ULONG MapRegisterCount;
PHYSICAL_ADDRESS PhysicalAddress;
PVOID VirtualAddress;
RTL_BITMAP SrbExtensionAllocMap;
ULONG MaxSrbExtensions;
ULONG CurrentSrbExtensions;
ULONG CommonBufferLength;
LIST_ENTRY PendingIrpListHead;
PIRP NextIrp;
ULONG PendingIrpCount;
ULONG ActiveIrpCount;
UCHAR MiniPortDeviceExtension[1]; /* must be the last entry */
} SCSI_PORT_DEVICE_EXTENSION, *PSCSI_PORT_DEVICE_EXTENSION;
typedef struct _SCSI_PORT_SCAN_ADAPTER
{
KEVENT Event;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
PSCSI_PORT_LUN_EXTENSION LunExtension;
ULONG Lun;
ULONG Bus;
ULONG Target;
SCSI_REQUEST_BLOCK Srb;
UCHAR DataBuffer[256];
BOOLEAN Active;
} SCSI_PORT_SCAN_ADAPTER, *PSCSI_PORT_SCAN_ADAPTER;