ReactOS 0.4.16-dev-1946-g52006dd
scsiport.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Boot Loader (FreeLDR)
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: boot/freeldr/freeldr/disk/scsiport.c
5 * PURPOSE: Interface for SCSI Emulation
6 * PROGRAMMERS: Hervé Poussineau <hpoussin@reactos.org>
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include <freeldr.h>
12
13#include <debug.h>
15
16#define _SCSIPORT_
17
18#include <srb.h>
19#include <scsi.h>
20#include <ntddscsi.h>
21#include <ntddstor.h>
22#include <ntdddisk.h>
23#include <stdio.h>
24#include <stdarg.h>
25
26#undef ScsiPortLogError
27#undef ScsiPortMoveMemory
28#undef ScsiPortWritePortBufferUchar
29#undef ScsiPortWritePortBufferUlong
30#undef ScsiPortWritePortBufferUshort
31#undef ScsiPortWritePortUchar
32#undef ScsiPortWritePortUlong
33#undef ScsiPortWritePortUshort
34#undef ScsiPortWriteRegisterBufferUchar
35#undef ScsiPortWriteRegisterBufferUlong
36#undef ScsiPortWriteRegisterBufferUshort
37#undef ScsiPortWriteRegisterUchar
38#undef ScsiPortWriteRegisterUlong
39#undef ScsiPortWriteRegisterUshort
40#undef ScsiPortReadPortBufferUchar
41#undef ScsiPortReadPortBufferUlong
42#undef ScsiPortReadPortBufferUshort
43#undef ScsiPortReadPortUchar
44#undef ScsiPortReadPortUlong
45#undef ScsiPortReadPortUshort
46#undef ScsiPortReadRegisterBufferUchar
47#undef ScsiPortReadRegisterBufferUlong
48#undef ScsiPortReadRegisterBufferUshort
49#undef ScsiPortReadRegisterUchar
50#undef ScsiPortReadRegisterUlong
51#undef ScsiPortReadRegisterUshort
52
53#define SCSI_PORT_NEXT_REQUEST_READY 0x0008
54
55#define TAG_SCSI_DEVEXT 'DscS'
56#define TAG_SCSI_ACCESS_RANGES 'AscS'
57
58/* GLOBALS ********************************************************************/
59
60#ifdef _M_IX86
63#endif
64
65typedef struct
66{
68
71
73
74 /* SRB extension stuff */
77
79
84
85 /* DMA related stuff */
87
89
92
93typedef struct tagDISKCONTEXT
94{
95 /* Device ID */
100
101 /* Device characteristics */
108
110
111/* FUNCTIONS ******************************************************************/
112
113ULONG
115 IN ULONG Value)
116{
117 FOUR_BYTE Dest;
119
120 Dest.Byte0 = Source->Byte3;
121 Dest.Byte1 = Source->Byte2;
122 Dest.Byte2 = Source->Byte1;
123 Dest.Byte3 = Source->Byte0;
124
125 return Dest.AsULong;
126}
127
128static
131 IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
133{
134 BOOLEAN ret;
135
137
138 /* HACK: handle lack of interrupts */
139 while (!(DeviceExtension->InterruptFlags & SCSI_PORT_NEXT_REQUEST_READY))
140 {
141 KeStallExecutionProcessor(100 * 1000);
142 if (!DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension))
143 {
145 return FALSE;
146 }
147 }
148
149 DeviceExtension->InterruptFlags &= ~SCSI_PORT_NEXT_REQUEST_READY;
151
152 if (!DeviceExtension->HwStartIo(
153 DeviceExtension->MiniPortDeviceExtension,
154 Srb))
155 {
157 return FALSE;
158 }
159
160 /* HACK: handle lack of interrupts */
162 {
163 KeStallExecutionProcessor(100 * 1000);
164 if (!DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension))
165 {
167 return FALSE;
168 }
169 }
170
173
174 return ret;
175}
176
178{
181 return ESUCCESS;
182}
183
185{
187
189
190 /*
191 * The ARC specification mentions that for partitions, StartingAddress and
192 * EndingAddress are the start and end positions of the partition in terms
193 * of byte offsets from the start of the disk.
194 * CurrentAddress is the current offset into (i.e. relative to) the partition.
195 */
196 Information->StartingAddress.QuadPart = Context->SectorOffset * Context->SectorSize;
197 Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize;
198 Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize;
199
201
202 return ESUCCESS;
203}
204
205static ARC_STATUS DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
206{
208 PCDB Cdb;
210
212 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
213 ULONG ScsiBus, PathId, TargetId, Lun, Partition, PathSyntax;
217
218 /* Parse ARC path */
219 if (!DissectArcPath2(Path, &ScsiBus, &TargetId, &Lun, &Partition, &PathSyntax))
220 return EINVAL;
221 if (PathSyntax != 0) /* scsi() format */
222 return EINVAL;
223 DeviceExtension = ScsiDeviceExtensions[ScsiBus];
224 PathId = ScsiBus - DeviceExtension->BusNum;
225
226 /* Get disk capacity and sector size */
228 if (!Srb)
229 return ENOMEM;
231 Srb->Length = sizeof(SCSI_REQUEST_BLOCK);
235 Srb->Lun = (UCHAR)Lun;
236 Srb->CdbLength = 10;
239 Srb->TimeOutValue = 5; /* in seconds */
241 Cdb = (PCDB)Srb->Cdb;
242 Cdb->CDB10.OperationCode = SCSIOP_READ_CAPACITY;
243 if (!SpiSendSynchronousSrb(DeviceExtension, Srb))
244 {
245 return EIO;
246 }
247
248 /* Transform result to host endianness */
251
252 if (Partition != 0)
253 {
254 /* Need to offset start of disk and length */
256 return EIO;
257 }
258
260 if (!Context)
261 return ENOMEM;
262 Context->DeviceExtension = DeviceExtension;
263 Context->PathId = (UCHAR)PathId;
264 Context->TargetId = (UCHAR)TargetId;
265 Context->Lun = (UCHAR)Lun;
266 Context->IsFloppy = (!strstr(Path, ")cdrom(") && strstr(Path, ")fdisk("));
267 Context->SectorSize = SectorSize;
268 Context->SectorOffset = SectorOffset;
269 Context->SectorCount = SectorCount;
270 Context->SectorNumber = 0;
272
273 return ESUCCESS;
274}
275
277{
280 PCDB Cdb;
281 ULONG FullSectors, NbSectors;
282 ULONG Lba;
283
284 *Count = 0;
285
286 if (N == 0)
287 return ESUCCESS;
288
289 FullSectors = N / Context->SectorSize;
290 NbSectors = (N + Context->SectorSize - 1) / Context->SectorSize;
291 if (Context->SectorNumber + NbSectors >= Context->SectorCount)
292 return EINVAL;
293 if (FullSectors > 0xffff)
294 return EINVAL;
295
296 /* Read full sectors */
297 ASSERT(Context->SectorNumber < 0xFFFFFFFF);
298 Lba = (ULONG)(Context->SectorOffset + Context->SectorNumber);
299 if (FullSectors > 0)
300 {
302 if (!Srb)
303 return ENOMEM;
304
306 Srb->Length = sizeof(SCSI_REQUEST_BLOCK);
308 Srb->PathId = Context->PathId;
309 Srb->TargetId = Context->TargetId;
310 Srb->Lun = Context->Lun;
311 Srb->CdbLength = 10;
313 Srb->DataTransferLength = FullSectors * Context->SectorSize;
314 Srb->TimeOutValue = 5; /* in seconds */
316 Cdb = (PCDB)Srb->Cdb;
317 Cdb->CDB10.OperationCode = SCSIOP_READ;
318 Cdb->CDB10.LogicalUnitNumber = Srb->Lun;
319 Cdb->CDB10.LogicalBlockByte0 = (Lba >> 24) & 0xff;
320 Cdb->CDB10.LogicalBlockByte1 = (Lba >> 16) & 0xff;
321 Cdb->CDB10.LogicalBlockByte2 = (Lba >> 8) & 0xff;
322 Cdb->CDB10.LogicalBlockByte3 = Lba & 0xff;
323 Cdb->CDB10.TransferBlocksMsb = (FullSectors >> 8) & 0xff;
324 Cdb->CDB10.TransferBlocksLsb = FullSectors & 0xff;
325 if (!SpiSendSynchronousSrb(Context->DeviceExtension, Srb))
326 {
327 return EIO;
328 }
329 Buffer = (PUCHAR)Buffer + FullSectors * Context->SectorSize;
330 N -= FullSectors * Context->SectorSize;
331 *Count += FullSectors * Context->SectorSize;
332 Context->SectorNumber += FullSectors;
333 Lba += FullSectors;
334 }
335
336 /* Read incomplete last sector */
337 if (N > 0)
338 {
339 PUCHAR Sector;
340
341 Sector = ExAllocatePool(PagedPool, Context->SectorSize);
342 if (!Sector)
343 return ENOMEM;
344
346 if (!Srb)
347 {
348 ExFreePool(Sector);
349 return ENOMEM;
350 }
351
353 Srb->Length = sizeof(SCSI_REQUEST_BLOCK);
355 Srb->PathId = Context->PathId;
356 Srb->TargetId = Context->TargetId;
357 Srb->Lun = Context->Lun;
358 Srb->CdbLength = 10;
360 Srb->DataTransferLength = Context->SectorSize;
361 Srb->TimeOutValue = 5; /* in seconds */
362 Srb->DataBuffer = Sector;
363 Cdb = (PCDB)Srb->Cdb;
364 Cdb->CDB10.OperationCode = SCSIOP_READ;
365 Cdb->CDB10.LogicalUnitNumber = Srb->Lun;
366 Cdb->CDB10.LogicalBlockByte0 = (Lba >> 24) & 0xff;
367 Cdb->CDB10.LogicalBlockByte1 = (Lba >> 16) & 0xff;
368 Cdb->CDB10.LogicalBlockByte2 = (Lba >> 8) & 0xff;
369 Cdb->CDB10.LogicalBlockByte3 = Lba & 0xff;
370 Cdb->CDB10.TransferBlocksMsb = 0;
371 Cdb->CDB10.TransferBlocksLsb = 1;
372 if (!SpiSendSynchronousSrb(Context->DeviceExtension, Srb))
373 {
374 ExFreePool(Sector);
375 return EIO;
376 }
377 RtlCopyMemory(Buffer, Sector, N);
378 *Count += N;
379 /* Context->SectorNumber remains untouched (incomplete sector read) */
380 ExFreePool(Sector);
381 }
382
383 return ESUCCESS;
384}
385
387{
389 LARGE_INTEGER NewPosition = *Position;
390
391 switch (SeekMode)
392 {
393 case SeekAbsolute:
394 break;
395 case SeekRelative:
396 NewPosition.QuadPart += (Context->SectorNumber * Context->SectorSize);
397 break;
398 default:
399 ASSERT(FALSE);
400 return EINVAL;
401 }
402
403 if (NewPosition.QuadPart & (Context->SectorSize - 1))
404 return EINVAL;
405
406 /* Convert in number of sectors */
407 NewPosition.QuadPart /= Context->SectorSize;
408 if (NewPosition.QuadPart >= Context->SectorCount)
409 return EINVAL;
410
411 Context->SectorNumber = NewPosition.QuadPart;
412 return ESUCCESS;
413}
414
415static const DEVVTBL DiskVtbl =
416{
417 DiskClose,
419 DiskOpen,
420 DiskRead,
421 DiskSeek,
422};
423
424static
427 IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
428 IN PHW_INITIALIZATION_DATA HwInitData,
430 IN BOOLEAN ZeroStruct)
431{
432 ULONG Bus;
433
434 /* Zero out the struct if told so */
435 if (ZeroStruct)
436 {
437 /* First zero the portconfig */
439
440 /* Initialize the struct */
441 ConfigInfo->Length = sizeof(PORT_CONFIGURATION_INFORMATION);
442 ConfigInfo->AdapterInterfaceType = HwInitData->AdapterInterfaceType;
443 ConfigInfo->InterruptMode = Latched;
444 ConfigInfo->DmaChannel = SP_UNINITIALIZED_VALUE;
445 ConfigInfo->DmaPort = SP_UNINITIALIZED_VALUE;
446 ConfigInfo->MaximumTransferLength = SP_UNINITIALIZED_VALUE;
447 ConfigInfo->MaximumNumberOfTargets = SCSI_MAXIMUM_TARGETS_PER_BUS;
448
449 /* Store parameters */
450 ConfigInfo->NeedPhysicalAddresses = HwInitData->NeedPhysicalAddresses;
451 ConfigInfo->MapBuffers = HwInitData->MapBuffers;
452 ConfigInfo->AutoRequestSense = HwInitData->AutoRequestSense;
453 ConfigInfo->ReceiveEvent = HwInitData->ReceiveEvent;
454 ConfigInfo->TaggedQueuing = HwInitData->TaggedQueuing;
455 ConfigInfo->MultipleRequestPerLu = HwInitData->MultipleRequestPerLu;
456
457 /* Get the disk usage */
458 ConfigInfo->AtdiskPrimaryClaimed = FALSE; // FIXME
459 ConfigInfo->AtdiskSecondaryClaimed = FALSE; // FIXME
460
461 /* Initiator bus id is not set */
462 for (Bus = 0; Bus < RTL_NUMBER_OF(ConfigInfo->InitiatorBusId); Bus++)
463 {
464 ConfigInfo->InitiatorBusId[Bus] = (CCHAR)SP_UNINITIALIZED_VALUE;
465 }
466 }
467
468 ConfigInfo->NumberOfPhysicalBreaks = 17;
469
470 return STATUS_SUCCESS;
471}
472
473VOID
476 IN ULONG DebugPrintLevel,
477 IN PCCHAR DebugMessage,
478 IN ...)
479{
480 va_list ap;
481 CHAR Buffer[512];
483
484 if (DebugPrintLevel > 10)
485 return;
486
487 va_start(ap, DebugMessage);
488
489 /* Construct a string */
490 Length = _vsnprintf(Buffer, 512, DebugMessage, ap);
491
492 /* Check if we went past the buffer */
493 if (Length == MAXULONG)
494 {
495 /* Terminate it if we went over-board */
496 Buffer[sizeof(Buffer) - 1] = '\0';
497
498 /* Put maximum */
499 Length = sizeof(Buffer);
500 }
501
502 /* Print the message */
503 TRACE("%s", Buffer);
504
505 /* Cleanup */
506 va_end(ap);
507}
508
509VOID
510NTAPI
512 IN PVOID HwDeviceExtension,
515 IN UCHAR Lun,
516 IN UCHAR SrbStatus)
517{
518 // FIXME
520}
521
522#undef ScsiPortConvertPhysicalAddressToUlong
523ULONG
524NTAPI
527{
528 return Address.LowPart;
529}
530
532NTAPI
534 IN ULONG_PTR UlongAddress)
535{
537
538 Address.QuadPart = UlongAddress;
539 return Address;
540}
541
542VOID
543NTAPI
545 IN PVOID DeviceExtension)
546{
547 // FIXME
549}
550
551VOID
552NTAPI
554 IN PVOID HwDeviceExtension,
555 IN PVOID MappedAddress)
556{
557 // Nothing to do
558}
559
560ULONG
561NTAPI
563 IN PVOID DeviceExtension,
564 IN ULONG BusDataType,
565 IN ULONG SystemIoBusNumber,
569{
570 return HalGetBusDataByOffset(BusDataType, SystemIoBusNumber, SlotNumber, Buffer, 0, Length);
571}
572
573PVOID
574NTAPI
576 IN PVOID HwDeviceExtension,
578 IN ULONG SystemIoBusNumber,
579 IN SCSI_PHYSICAL_ADDRESS IoAddress,
581 IN BOOLEAN InIoSpace)
582{
585
586 AddressSpace = (ULONG)InIoSpace;
588 SystemIoBusNumber,
589 IoAddress,
592 {
593 return NULL;
594 }
595
596 /* I/O space */
597 if (AddressSpace != 0)
598 return (PVOID)(ULONG_PTR)TranslatedAddress.u.LowPart;
599
600 // FIXME
601#if 0
604 FALSE);
605#else
607 return (PVOID)(ULONG_PTR)IoAddress.LowPart;
608#endif
609}
610
611PVOID
612NTAPI
614 IN PVOID HwDeviceExtension,
617 IN UCHAR Lun)
618{
619 // FIXME
621 return NULL;
622}
623
625NTAPI
627 IN PVOID HwDeviceExtension,
631{
632 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
636
637 TRACE("ScsiPortGetPhysicalAddress(%p %p %p %p)\n",
638 HwDeviceExtension, Srb, VirtualAddress, Length);
639
640 DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
641
643 {
644 /* Simply look it up in the allocated common buffer */
646
647 BufferLength = DeviceExtension->CommonBufferLength - Offset;
649 }
650 else
651 {
652 /* Nothing */
654 }
655
657 return PhysicalAddress;
658}
659
661NTAPI
663 IN PVOID DeviceExtension,
666 IN UCHAR Lun,
667 IN LONG QueueTag)
668{
669 // FIXME
671 return NULL;
672}
673
674static
677 IN OUT PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
678 IN ULONG NonCachedSize)
679{
681 ULONG CommonBufferLength, BufSize;
682
683 /* If size is 0, set it to 16 */
684 if (!DeviceExtension->SrbExtensionSize)
685 DeviceExtension->SrbExtensionSize = 16;
686
687 /* Calculate size */
688 BufSize = DeviceExtension->SrbExtensionSize;
689
690 /* Round it */
691 BufSize = (BufSize + sizeof(LONGLONG) - 1) & ~(sizeof(LONGLONG) - 1);
692
693 /* Sum up into the total common buffer length, and round it to page size */
694 CommonBufferLength =
695 ROUND_TO_PAGES(NonCachedSize);
696
697 /* Allocate it */
698 if (!DeviceExtension->AdapterObject)
699 {
700 /* From nonpaged pool if there is no DMA */
701 CommonBuffer = ExAllocatePool(NonPagedPool, CommonBufferLength);
702 }
703 else
704 {
705 /* Perform a full request since we have a DMA adapter*/
708 }
709
710 /* Fail in case of error */
711 if (!CommonBuffer)
713
714 /* Zero it */
715 RtlZeroMemory(CommonBuffer, CommonBufferLength);
716
717 /* Store its size in Device Extension */
718 DeviceExtension->CommonBufferLength = CommonBufferLength;
719
720 /* SrbExtension buffer is located at the beginning of the buffer */
721 DeviceExtension->SrbExtensionBuffer = CommonBuffer;
722
723 /* Non-cached extension buffer is located at the end of
724 the common buffer */
725 if (NonCachedSize)
726 {
727 CommonBufferLength -= NonCachedSize;
728 DeviceExtension->NonCachedExtension = (PUCHAR)CommonBuffer + CommonBufferLength;
729 }
730 else
731 {
732 DeviceExtension->NonCachedExtension = NULL;
733 }
734
735 return STATUS_SUCCESS;
736}
737
738PVOID
739NTAPI
741 IN PVOID HwDeviceExtension,
744{
745 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
747 ULONG MapRegistersCount;
749
750 TRACE("ScsiPortGetUncachedExtension(%p %p %lu)\n",
751 HwDeviceExtension, ConfigInfo, NumberOfBytes);
752
753 DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
754
755 /* Check for allocated common DMA buffer */
756 if (DeviceExtension->SrbExtensionBuffer != NULL)
757 {
758 return NULL;
759 }
760
761 /* Check for DMA adapter object */
762 if (DeviceExtension->AdapterObject == NULL)
763 {
764 /* Initialize DMA adapter description */
766
768 DeviceDescription.Master = ConfigInfo->Master;
769 DeviceDescription.ScatterGather = ConfigInfo->ScatterGather;
770 DeviceDescription.DemandMode = ConfigInfo->DemandMode;
771 DeviceDescription.Dma32BitAddresses = ConfigInfo->Dma32BitAddresses;
772 DeviceDescription.BusNumber = ConfigInfo->SystemIoBusNumber;
773 DeviceDescription.DmaChannel = ConfigInfo->DmaChannel;
774 DeviceDescription.InterfaceType = ConfigInfo->AdapterInterfaceType;
775 DeviceDescription.DmaWidth = ConfigInfo->DmaWidth;
776 DeviceDescription.DmaSpeed = ConfigInfo->DmaSpeed;
777 DeviceDescription.MaximumLength = ConfigInfo->MaximumTransferLength;
778 DeviceDescription.DmaPort = ConfigInfo->DmaPort;
779
780 /* Get a DMA adapter object */
781#if 0
782 DeviceExtension->AdapterObject =
783 HalGetAdapter(&DeviceDescription, &MapRegistersCount);
784
785 /* Fail in case of error */
786 if (DeviceExtension->AdapterObject == NULL)
787 {
788 return NULL;
789 }
790#else
791 MapRegistersCount = 0;
792#endif
793
794 /* Set number of physical breaks */
795 if (ConfigInfo->NumberOfPhysicalBreaks != 0 &&
796 MapRegistersCount > ConfigInfo->NumberOfPhysicalBreaks)
797 {
798 DeviceExtension->PortCapabilities.MaximumPhysicalPages =
799 ConfigInfo->NumberOfPhysicalBreaks;
800 }
801 else
802 {
803 DeviceExtension->PortCapabilities.MaximumPhysicalPages = MapRegistersCount;
804 }
805 }
806
807 /* Update Srb extension size */
808 if (DeviceExtension->SrbExtensionSize != ConfigInfo->SrbExtensionSize)
809 DeviceExtension->SrbExtensionSize = ConfigInfo->SrbExtensionSize;
810
811 /* Allocate a common DMA buffer */
812 Status = SpiAllocateCommonBuffer(DeviceExtension, NumberOfBytes);
813
814 if (!NT_SUCCESS(Status))
815 {
816 TRACE("SpiAllocateCommonBuffer() failed with Status = 0x%08X!\n", Status);
817 return NULL;
818 }
819
820 return DeviceExtension->NonCachedExtension;
821}
822
823PVOID
824NTAPI
826 IN PVOID HwDeviceExtension,
828{
829 // FIXME
831 return NULL;
832}
833
834static
835VOID
837 IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
838 IN PCHAR ArcName,
839 IN ULONG ScsiBus,
841 IN ULONG Lun)
842{
843 ULONG FileId, i;
847 CHAR PartitionName[64];
848
849 /* Register device with partition(0) suffix */
850 RtlStringCbPrintfA(PartitionName, sizeof(PartitionName), "%spartition(0)", ArcName);
851 FsRegisterDevice(PartitionName, &DiskVtbl);
852
853 /* Read device partition table */
854 Status = ArcOpen(PartitionName, OpenReadOnly, &FileId);
855 if (Status == ESUCCESS)
856 {
857 ret = HALDISPATCH->HalIoReadPartitionTable((PDEVICE_OBJECT)(ULONG_PTR)FileId,
858 512, FALSE, &PartitionBuffer);
859 if (NT_SUCCESS(ret))
860 {
861 for (i = 0; i < PartitionBuffer->PartitionCount; i++)
862 {
863 if (PartitionBuffer->PartitionEntry[i].PartitionType != PARTITION_ENTRY_UNUSED)
864 {
865 RtlStringCbPrintfA(PartitionName,
866 sizeof(PartitionName),
867 "%spartition(%lu)",
868 ArcName,
869 PartitionBuffer->PartitionEntry[i].PartitionNumber);
870 FsRegisterDevice(PartitionName, &DiskVtbl);
871 }
872 }
874 }
875 ArcClose(FileId);
876 }
877}
878
879static
880VOID
882 IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
883 IN ULONG ScsiBus,
885{
886 CHAR ArcName[64];
888 PCDB Cdb;
889 INQUIRYDATA InquiryBuffer;
891 UCHAR Lun;
892
893 if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId))
894 {
895 return;
896 }
897
898 /* Remember the extension */
899 ScsiDeviceExtensions[ScsiBus] = DeviceExtension;
900
901 for (TargetId = 0; TargetId < DeviceExtension->MaxTargetIds; TargetId++)
902 {
903 for (Lun = 0; Lun < SCSI_MAXIMUM_LOGICAL_UNITS; Lun++)
904 {
905 TRACE("Scanning SCSI device %lu.%u.%u\n", ScsiBus, TargetId, Lun);
906
908 if (!Srb)
909 break;
911 Srb->Length = sizeof(SCSI_REQUEST_BLOCK);
913 Srb->PathId = PathId;
915 Srb->Lun = Lun;
916 Srb->CdbLength = 6;
919 Srb->TimeOutValue = 5; /* in seconds */
920 Srb->DataBuffer = &InquiryBuffer;
921 Cdb = (PCDB)Srb->Cdb;
922 Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY;
923 Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun;
924 Cdb->CDB6INQUIRY.AllocationLength = (UCHAR)Srb->DataTransferLength;
925 if (!SpiSendSynchronousSrb(DeviceExtension, Srb))
926 {
927 /* Don't check next LUNs */
928 break;
929 }
930
931 /*
932 * Device exists, create its ARC name.
933 * NOTE: Other devices are not supported:
934 * - SEQUENTIAL_ACCESS_DEVICE i.e. Tape,
935 * - WRITE_ONCE_READ_MULTIPLE_DEVICE i.e. Worm.
936 */
937 if ((InquiryBuffer.DeviceType == DIRECT_ACCESS_DEVICE) ||
938 (InquiryBuffer.DeviceType == OPTICAL_DEVICE))
939 {
940 if ((InquiryBuffer.DeviceType == DIRECT_ACCESS_DEVICE) &&
941 InquiryBuffer.RemovableMedia)
942 {
943 /* Floppy disk */
944 RtlStringCbPrintfA(ArcName, sizeof(ArcName),
945 "scsi(%lu)disk(%u)fdisk(%u)",
946 ScsiBus, TargetId, Lun);
947 FsRegisterDevice(ArcName, &DiskVtbl);
948 }
949 else
950 {
951 /* Other rigid disk */
952 RtlStringCbPrintfA(ArcName, sizeof(ArcName),
953 "scsi(%lu)disk(%u)rdisk(%u)",
954 ScsiBus, TargetId, Lun);
955 /* Now, check if it has partitions */
956 SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun);
957 }
958 }
959 else if (InquiryBuffer.DeviceType == READ_ONLY_DIRECT_ACCESS_DEVICE)
960 {
961 /* CD-ROM; note that the RemovableMedia bit may or may not be set */
962 RtlStringCbPrintfA(ArcName, sizeof(ArcName),
963 "scsi(%lu)cdrom(%u)fdisk(%u)",
964 ScsiBus, TargetId, Lun);
965 FsRegisterDevice(ArcName, &DiskVtbl);
966 }
967 }
968 }
969}
970
971static
972VOID
975 IN PCM_FULL_RESOURCE_DESCRIPTOR ResourceDescriptor,
977{
978 PACCESS_RANGE AccessRange;
980 ULONG RangeNumber;
981 ULONG Index;
982
983 RangeNumber = 0;
984
985 /* Loop through all entries */
986 for (Index = 0; Index < ResourceDescriptor->PartialResourceList.Count; Index++)
987 {
988 PartialData = &ResourceDescriptor->PartialResourceList.PartialDescriptors[Index];
989
990 switch (PartialData->Type)
991 {
993 /* Copy access ranges */
994 if (RangeNumber < HwInitializationData->NumberOfAccessRanges)
995 {
996 TRACE("Got port at 0x%I64x, len 0x%x\n",
997 PartialData->u.Port.Start.QuadPart, PartialData->u.Port.Length);
998 AccessRange = &((*(PortConfig->AccessRanges))[RangeNumber]);
999
1000 AccessRange->RangeStart = PartialData->u.Port.Start;
1001 AccessRange->RangeLength = PartialData->u.Port.Length;
1002
1003 AccessRange->RangeInMemory = FALSE;
1004 RangeNumber++;
1005 }
1006 break;
1007
1009 /* Copy access ranges */
1010 if (RangeNumber < HwInitializationData->NumberOfAccessRanges)
1011 {
1012 TRACE("Got memory at 0x%I64x, len 0x%x\n",
1013 PartialData->u.Memory.Start.QuadPart, PartialData->u.Memory.Length);
1014 AccessRange = &((*(PortConfig->AccessRanges))[RangeNumber]);
1015
1016 AccessRange->RangeStart = PartialData->u.Memory.Start;
1017 AccessRange->RangeLength = PartialData->u.Memory.Length;
1018
1019 AccessRange->RangeInMemory = TRUE;
1020 RangeNumber++;
1021 }
1022 break;
1023
1025 /* Copy interrupt data */
1026 TRACE("Got interrupt level %d, vector %d\n",
1027 PartialData->u.Interrupt.Level, PartialData->u.Interrupt.Vector);
1028 PortConfig->BusInterruptLevel = PartialData->u.Interrupt.Level;
1029 PortConfig->BusInterruptVector = PartialData->u.Interrupt.Vector;
1030
1031 /* Set interrupt mode accordingly to the resource */
1032 if (PartialData->Flags == CM_RESOURCE_INTERRUPT_LATCHED)
1033 {
1034 PortConfig->InterruptMode = Latched;
1035 }
1036 else if (PartialData->Flags == CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE)
1037 {
1038 PortConfig->InterruptMode = LevelSensitive;
1039 }
1040 break;
1041
1042 case CmResourceTypeDma:
1043 TRACE("Got DMA channel %d, port %d\n",
1044 PartialData->u.Dma.Channel, PartialData->u.Dma.Port);
1045 PortConfig->DmaChannel = PartialData->u.Dma.Channel;
1046 PortConfig->DmaPort = PartialData->u.Dma.Port;
1047 break;
1048 }
1049 }
1050}
1051
1052static
1053BOOLEAN
1058 IN OUT PPCI_SLOT_NUMBER NextSlotNumber)
1059{
1060 PCI_COMMON_CONFIG PciConfig;
1064 ULONG FunctionNumber;
1065 CHAR VendorIdString[8];
1066 CHAR DeviceIdString[8];
1069
1070 SlotNumber.u.AsULONG = 0;
1071
1072 /* Loop through all devices */
1073 for (DeviceNumber = NextSlotNumber->u.bits.DeviceNumber; DeviceNumber < PCI_MAX_DEVICES; DeviceNumber++)
1074 {
1075 SlotNumber.u.bits.DeviceNumber = DeviceNumber;
1076
1077 /* Loop through all functions */
1078 for (FunctionNumber = NextSlotNumber->u.bits.FunctionNumber; FunctionNumber < PCI_MAX_FUNCTION; FunctionNumber++)
1079 {
1080 SlotNumber.u.bits.FunctionNumber = FunctionNumber;
1081
1082 /* Get PCI config bytes */
1085 BusNumber,
1086 SlotNumber.u.AsULONG,
1087 &PciConfig,
1088 0,
1089 sizeof(ULONG));
1090
1091 /* If result of HalGetBusData is 0, then the bus is wrong */
1092 if (DataSize == 0)
1093 return FALSE;
1094
1095 /* If result is PCI_INVALID_VENDORID, then this device has no more
1096 "Functions" */
1097 if (PciConfig.VendorID == PCI_INVALID_VENDORID)
1098 break;
1099
1100 sprintf(VendorIdString, "%04hx", PciConfig.VendorID);
1101 sprintf(DeviceIdString, "%04hx", PciConfig.DeviceID);
1102
1103 if (_strnicmp(VendorIdString, HwInitializationData->VendorId, HwInitializationData->VendorIdLength) ||
1104 _strnicmp(DeviceIdString, HwInitializationData->DeviceId, HwInitializationData->DeviceIdLength))
1105 {
1106 /* It is not our device */
1107 continue;
1108 }
1109
1110 TRACE( "Found device 0x%04hx 0x%04hx at %1lu %2lu %1lu\n",
1111 PciConfig.VendorID, PciConfig.DeviceID,
1112 BusNumber,
1113 SlotNumber.u.bits.DeviceNumber, SlotNumber.u.bits.FunctionNumber);
1114
1116 NULL,
1117 NULL,
1118 NULL,
1119 PCIBus,
1120 BusNumber,
1121 SlotNumber.u.AsULONG,
1122 &ResourceList);
1123
1124 if (!NT_SUCCESS(Status))
1125 break;
1126
1127 /* Create configuration information */
1129 ResourceList->List,
1130 PortConfig);
1131
1132 /* Free the resource list */
1134
1135 /* Set dev & fn numbers */
1136 NextSlotNumber->u.bits.DeviceNumber = DeviceNumber;
1137 NextSlotNumber->u.bits.FunctionNumber = FunctionNumber + 1;
1138
1139 /* Save the slot number */
1140 PortConfig->SlotNumber = SlotNumber.u.AsULONG;
1141
1142 return TRUE;
1143 }
1144 NextSlotNumber->u.bits.FunctionNumber = 0;
1145 }
1146
1147 NextSlotNumber->u.bits.DeviceNumber = 0;
1148
1149 return FALSE;
1150}
1151
1152ULONG
1153NTAPI
1159{
1160 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
1161 ULONG DeviceExtensionSize;
1163 BOOLEAN Again;
1164 BOOLEAN FirstConfigCall = TRUE;
1166 UCHAR ScsiBus;
1168
1169 if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA))
1170 {
1172 }
1173
1174 /* Check params for validity */
1175 if ((HwInitializationData->HwInitialize == NULL) ||
1176 (HwInitializationData->HwStartIo == NULL) ||
1177 (HwInitializationData->HwInterrupt == NULL) ||
1178 (HwInitializationData->HwFindAdapter == NULL) ||
1179 (HwInitializationData->HwResetBus == NULL))
1180 {
1182 }
1183
1184 /* Zero starting slot number */
1185 SlotNumber.u.AsULONG = 0;
1186
1187 while (TRUE)
1188 {
1189 Again = FALSE;
1190
1191 DeviceExtensionSize = sizeof(SCSI_PORT_DEVICE_EXTENSION) + HwInitializationData->DeviceExtensionSize;
1192 DeviceExtension = FrLdrTempAlloc(DeviceExtensionSize, TAG_SCSI_DEVEXT);
1193 if (!DeviceExtension)
1194 {
1195 return STATUS_NO_MEMORY;
1196 }
1197 RtlZeroMemory(DeviceExtension, DeviceExtensionSize);
1199 DeviceExtension->HwInitialize = HwInitializationData->HwInitialize;
1200 DeviceExtension->HwStartIo = HwInitializationData->HwStartIo;
1201 DeviceExtension->HwInterrupt = HwInitializationData->HwInterrupt;
1202 DeviceExtension->HwResetBus = HwInitializationData->HwResetBus;
1203 DeviceExtension->MiniPortDeviceExtension = (PVOID)(DeviceExtension + 1);
1204
1205 Status = SpiCreatePortConfig(DeviceExtension,
1207 &PortConfig,
1208 FirstConfigCall);
1209 if (Status != STATUS_SUCCESS)
1210 {
1211 FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
1212 return Status;
1213 }
1214
1215 PortConfig.NumberOfAccessRanges = HwInitializationData->NumberOfAccessRanges;
1216 PortConfig.AccessRanges = FrLdrTempAlloc(sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges,
1218 if (!PortConfig.AccessRanges)
1219 {
1220 FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
1221 return STATUS_NO_MEMORY;
1222 }
1223 RtlZeroMemory(PortConfig.AccessRanges, sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges);
1224
1225 /* Search for matching PCI device */
1226 if ((HwInitializationData->AdapterInterfaceType == PCIBus) &&
1227 (HwInitializationData->VendorIdLength > 0) &&
1228 (HwInitializationData->VendorId != NULL) &&
1229 (HwInitializationData->DeviceIdLength > 0) &&
1230 (HwInitializationData->DeviceId != NULL))
1231 {
1232 PortConfig.BusInterruptLevel = 0;
1233
1234 /* Get PCI device data */
1235 TRACE("VendorId '%.*s' DeviceId '%.*s'\n",
1236 HwInitializationData->VendorIdLength,
1237 HwInitializationData->VendorId,
1238 HwInitializationData->DeviceIdLength,
1239 HwInitializationData->DeviceId);
1240
1242 &PortConfig,
1243 0, /* FIXME */
1244 &SlotNumber))
1245 {
1246 /* Continue to the next bus, nothing here */
1247 FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
1248 return STATUS_INTERNAL_ERROR;
1249 }
1250
1251 if (!PortConfig.BusInterruptLevel)
1252 {
1253 /* Bypass this slot, because no interrupt was assigned */
1254 FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
1255 return STATUS_INTERNAL_ERROR;
1256 }
1257 }
1258
1259 if (HwInitializationData->HwFindAdapter(
1260 DeviceExtension->MiniPortDeviceExtension,
1261 HwContext,
1262 NULL,
1263 NULL,
1264 &PortConfig,
1265 &Again) != SP_RETURN_FOUND)
1266 {
1267 FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
1268 return STATUS_INTERNAL_ERROR;
1269 }
1270
1271 /* Copy all stuff which we ever need from PortConfig to the DeviceExtension */
1273 DeviceExtension->MaxTargetIds = SCSI_MAXIMUM_TARGETS_PER_BUS;
1274 else
1275 DeviceExtension->MaxTargetIds = PortConfig.MaximumNumberOfTargets;
1276
1277 DeviceExtension->BusNum = PortConfig.SystemIoBusNumber;
1278
1279 TRACE("Adapter found: buses = %u, targets = %u\n",
1280 PortConfig.NumberOfBuses, DeviceExtension->MaxTargetIds);
1281
1282 /* Initialize adapter */
1283 if (!DeviceExtension->HwInitialize(DeviceExtension->MiniPortDeviceExtension))
1284 {
1285 FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
1286 return STATUS_INTERNAL_ERROR;
1287 }
1288
1289 /* Scan bus */
1290 for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++)
1291 {
1292 SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus);
1293 PortConfig.SystemIoBusNumber++;
1294 }
1295
1296 FirstConfigCall = FALSE;
1297 if (!Again)
1298 {
1299 break;
1300 }
1301 }
1302
1303 return STATUS_SUCCESS;
1304}
1305
1306VOID
1307NTAPI
1309 IN PVOID HwDeviceExtension,
1311 IN PVOID LogicalAddress,
1312 IN ULONG Length)
1313{
1314 // FIXME
1316}
1317
1318VOID
1319NTAPI
1321 IN PVOID HwDeviceExtension,
1323 IN UCHAR PathId,
1325 IN UCHAR Lun,
1327 IN ULONG UniqueId)
1328{
1329 // FIXME
1331}
1332
1333VOID
1334NTAPI
1338 IN ULONG Length)
1339{
1341}
1342
1343VOID
1344__cdecl
1347 IN PVOID HwDeviceExtension,
1348 IN ...)
1349{
1350 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
1352 va_list ap;
1353
1354 DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
1355
1356 va_start(ap, HwDeviceExtension);
1357
1358 switch (NotificationType)
1359 {
1360 case RequestComplete:
1361 /* Mask the SRB as completed */
1363 Srb->SrbFlags &= ~SRB_FLAGS_IS_ACTIVE;
1364 break;
1365
1366 case NextRequest:
1367 /* Say that device is ready */
1368 DeviceExtension->InterruptFlags |= SCSI_PORT_NEXT_REQUEST_READY;
1369 break;
1370
1371 default:
1372 // FIXME
1374 }
1375
1376 va_end(ap);
1377}
1378
1379VOID
1380NTAPI
1382 IN PUCHAR Port,
1384 IN ULONG Count)
1385{
1387}
1388
1389VOID
1390NTAPI
1392 IN PULONG Port,
1394 IN ULONG Count)
1395{
1397}
1398
1399VOID
1400NTAPI
1402 IN PUSHORT Port,
1404 IN ULONG Count)
1405{
1407}
1408
1409UCHAR
1410NTAPI
1412 IN PUCHAR Port)
1413{
1414 TRACE("ScsiPortReadPortUchar(%p)\n", Port);
1415
1416 return READ_PORT_UCHAR(Port);
1417}
1418
1419ULONG
1420NTAPI
1422 IN PULONG Port)
1423{
1424 return READ_PORT_ULONG(Port);
1425}
1426
1427USHORT
1428NTAPI
1430 IN PUSHORT Port)
1431{
1432 return READ_PORT_USHORT(Port);
1433}
1434
1435VOID
1436NTAPI
1440 IN ULONG Count)
1441{
1442 // FIXME
1444}
1445
1446VOID
1447NTAPI
1451 IN ULONG Count)
1452{
1453 // FIXME
1455}
1456
1457VOID
1458NTAPI
1462 IN ULONG Count)
1463{
1464 // FIXME
1466}
1467
1468UCHAR
1469NTAPI
1472{
1474}
1475
1476ULONG
1477NTAPI
1480{
1482}
1483
1484USHORT
1485NTAPI
1488{
1490}
1491
1492ULONG
1493NTAPI
1495 IN PVOID DeviceExtension,
1496 IN ULONG BusDataType,
1497 IN ULONG SystemIoBusNumber,
1499 IN PVOID Buffer,
1500 IN ULONG Offset,
1501 IN ULONG Length)
1502{
1503 // FIXME
1505 return 0;
1506}
1507
1508VOID
1509NTAPI
1511 IN ULONG Delay)
1512{
1514}
1515
1516BOOLEAN
1517NTAPI
1519 IN PVOID HwDeviceExtension,
1521 IN ULONG SystemIoBusNumber,
1522 IN SCSI_PHYSICAL_ADDRESS IoAddress,
1524 IN BOOLEAN InIoSpace)
1525{
1526 // FIXME
1528 return TRUE;
1529}
1530
1531#if 0
1532// ScsiPortWmi*
1533#endif
1534
1535
1536VOID
1537NTAPI
1539 IN PUCHAR Port,
1541 IN ULONG Count)
1542{
1544}
1545
1546VOID
1547NTAPI
1549 IN PULONG Port,
1551 IN ULONG Count)
1552{
1554}
1555
1556VOID
1557NTAPI
1559 IN PUSHORT Port,
1561 IN ULONG Count)
1562{
1564}
1565
1566VOID
1567NTAPI
1569 IN PUCHAR Port,
1570 IN UCHAR Value)
1571{
1573}
1574
1575VOID
1576NTAPI
1578 IN PULONG Port,
1579 IN ULONG Value)
1580{
1582}
1583
1584VOID
1585NTAPI
1587 IN PUSHORT Port,
1588 IN USHORT Value)
1589{
1591}
1592
1593VOID
1594NTAPI
1598 IN ULONG Count)
1599{
1600 // FIXME
1602}
1603
1604VOID
1605NTAPI
1609 IN ULONG Count)
1610{
1611 // FIXME
1613}
1614
1615VOID
1616NTAPI
1620 IN ULONG Count)
1621{
1622 // FIXME
1624}
1625
1626VOID
1627NTAPI
1630 IN UCHAR Value)
1631{
1633}
1634
1635VOID
1636NTAPI
1639 IN ULONG Value)
1640{
1642}
1643
1644VOID
1645NTAPI
1648 IN USHORT Value)
1649{
1651}
1652
1653extern char __ImageBase;
1654
1655ULONG
1657{
1658 PLDR_DATA_TABLE_ENTRY BootDdDTE;
1659 CHAR NtBootDdPath[MAX_PATH];
1660 PVOID ImageBase = NULL;
1663
1664 // FIXME: Must be done *INSIDE* the HAL!
1665#ifdef _M_IX86
1668#endif
1669
1670 /* Create full ntbootdd.sys path */
1671 strcpy(NtBootDdPath, FrLdrGetBootPath());
1672 strcat(NtBootDdPath, "\\NTBOOTDD.SYS");
1673
1674 /* Load ntbootdd.sys */
1675 Success = PeLdrLoadBootImage(NtBootDdPath,
1676 "ntbootdd.sys",
1677 ImageBase,
1678 &BootDdDTE);
1679 if (!Success)
1680 {
1681 /* That's OK, file simply doesn't exist */
1682 return ESUCCESS;
1683 }
1684
1685 /* Call the entrypoint */
1686 EntryPoint = VaToPa(BootDdDTE->EntryPoint);
1687 (*EntryPoint)(NULL, NULL);
1688
1689 return ESUCCESS;
1690}
1691
1692/* EOF */
#define N
Definition: crc32.c:57
#define BufSize
Definition: FsRtlTunnel.c:28
unsigned char BOOLEAN
PRTL_UNICODE_STRING_BUFFER Path
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define EINVAL
Definition: acclib.h:90
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define ENOMEM
Definition: acclib.h:84
#define EIO
Definition: acclib.h:81
#define __cdecl
Definition: accygwin.h:79
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define va_arg(ap, T)
Definition: acmsvcex.h:89
#define WRITE_REGISTER_USHORT(r, v)
Definition: arm.h:30
#define READ_REGISTER_USHORT(r)
Definition: arm.h:29
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
#define READ_REGISTER_ULONG(r)
Definition: arm.h:26
#define WriteBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:344
#define ReadBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:339
LONG NTSTATUS
Definition: precomp.h:26
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
BOOLEAN DissectArcPath2(IN PCSTR ArcPath, OUT PULONG x, OUT PULONG y, OUT PULONG z, OUT PULONG Partition, OUT PULONG PathSyntax)
Definition: arcname.c:121
VOID NTAPI ScsiPortCompleteRequest(IN PVOID HwDeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN UCHAR SrbStatus)
Definition: scsiport.c:511
ULONG NTAPI ScsiPortInitialize(IN PVOID Argument1, IN PVOID Argument2, IN PHW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext OPTIONAL)
Definition: scsiport.c:1154
char __ImageBase
VOID NTAPI ScsiPortWritePortBufferUlong(IN PULONG Port, IN PULONG Buffer, IN ULONG Count)
Definition: scsiport.c:1548
static BOOLEAN SpiGetPciConfigData(IN PHW_INITIALIZATION_DATA HwInitializationData, IN OUT PPORT_CONFIGURATION_INFORMATION PortConfig, IN ULONG BusNumber, IN OUT PPCI_SLOT_NUMBER NextSlotNumber)
Definition: scsiport.c:1054
static VOID SpiScanAdapter(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN ULONG ScsiBus, IN UCHAR PathId)
Definition: scsiport.c:881
SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN PVOID VirtualAddress, OUT ULONG *Length)
Definition: scsiport.c:626
VOID NTAPI ScsiPortReadPortBufferUchar(IN PUCHAR Port, OUT PUCHAR Buffer, IN ULONG Count)
Definition: scsiport.c:1381
VOID NTAPI ScsiPortWritePortUlong(IN PULONG Port, IN ULONG Value)
Definition: scsiport.c:1577
#define TAG_SCSI_ACCESS_RANGES
Definition: scsiport.c:56
VOID NTAPI ScsiPortReadPortBufferUshort(IN PUSHORT Port, OUT PUSHORT Buffer, IN ULONG Count)
Definition: scsiport.c:1401
static const DEVVTBL DiskVtbl
Definition: scsiport.c:415
struct SCSI_PORT_DEVICE_EXTENSION * PSCSI_PORT_DEVICE_EXTENSION
USHORT NTAPI ScsiPortReadPortUshort(IN PUSHORT Port)
Definition: scsiport.c:1429
VOID __cdecl ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType, IN PVOID HwDeviceExtension, IN ...)
Definition: scsiport.c:1345
PVOID NTAPI ScsiPortGetUncachedExtension(IN PVOID HwDeviceExtension, IN PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN ULONG NumberOfBytes)
Definition: scsiport.c:740
static NTSTATUS SpiAllocateCommonBuffer(IN OUT PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN ULONG NonCachedSize)
Definition: scsiport.c:676
VOID NTAPI ScsiPortWriteRegisterBufferUshort(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
Definition: scsiport.c:1617
static BOOLEAN SpiSendSynchronousSrb(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
Definition: scsiport.c:130
BOOLEAN NTAPI ScsiPortValidateRange(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
Definition: scsiport.c:1518
VOID NTAPI ScsiPortWritePortUshort(IN PUSHORT Port, IN USHORT Value)
Definition: scsiport.c:1586
struct tagDISKCONTEXT DISKCONTEXT
static ARC_STATUS DiskGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: scsiport.c:184
ULONG LoadBootDeviceDriver(VOID)
Definition: scsiport.c:1656
static NTSTATUS SpiCreatePortConfig(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN PHW_INITIALIZATION_DATA HwInitData, OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN BOOLEAN ZeroStruct)
Definition: scsiport.c:426
SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortConvertUlongToPhysicalAddress(IN ULONG_PTR UlongAddress)
Definition: scsiport.c:533
VOID NTAPI ScsiPortLogError(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN ULONG ErrorCode, IN ULONG UniqueId)
Definition: scsiport.c:1320
VOID NTAPI ScsiPortWritePortUchar(IN PUCHAR Port, IN UCHAR Value)
Definition: scsiport.c:1568
VOID NTAPI ScsiPortWriteRegisterBufferUchar(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
Definition: scsiport.c:1595
VOID NTAPI ScsiPortWriteRegisterUshort(IN PUSHORT Register, IN USHORT Value)
Definition: scsiport.c:1646
VOID NTAPI ScsiPortReadRegisterBufferUshort(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
Definition: scsiport.c:1459
VOID __cdecl ScsiDebugPrint(IN ULONG DebugPrintLevel, IN PCCHAR DebugMessage, IN ...)
Definition: scsiport.c:475
VOID NTAPI ScsiPortMoveMemory(IN PVOID WriteBuffer, IN PVOID ReadBuffer, IN ULONG Length)
Definition: scsiport.c:1335
PVOID NTAPI ScsiPortGetLogicalUnit(IN PVOID HwDeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun)
Definition: scsiport.c:613
static ARC_STATUS DiskRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: scsiport.c:276
VOID NTAPI ScsiPortWritePortBufferUshort(IN PUSHORT Port, IN PUSHORT Buffer, IN ULONG Count)
Definition: scsiport.c:1558
VOID NTAPI ScsiPortWriteRegisterBufferUlong(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
Definition: scsiport.c:1606
VOID NTAPI ScsiPortReadRegisterBufferUchar(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
Definition: scsiport.c:1437
VOID NTAPI ScsiPortWriteRegisterUchar(IN PUCHAR Register, IN UCHAR Value)
Definition: scsiport.c:1628
VOID NTAPI ScsiPortFreeDeviceBase(IN PVOID HwDeviceExtension, IN PVOID MappedAddress)
Definition: scsiport.c:553
VOID NTAPI ScsiPortWriteRegisterUlong(IN PULONG Register, IN ULONG Value)
Definition: scsiport.c:1637
PSCSI_PORT_DEVICE_EXTENSION ScsiDeviceExtensions[SCSI_MAXIMUM_BUSES]
Definition: scsiport.c:109
static ARC_STATUS DiskOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
Definition: scsiport.c:205
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1510
ULONG NTAPI ScsiPortSetBusDataByOffset(IN PVOID DeviceExtension, IN ULONG BusDataType, IN ULONG SystemIoBusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: scsiport.c:1494
PSCSI_REQUEST_BLOCK NTAPI ScsiPortGetSrb(IN PVOID DeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN LONG QueueTag)
Definition: scsiport.c:662
static ARC_STATUS DiskSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: scsiport.c:386
VOID NTAPI ScsiPortFlushDma(IN PVOID DeviceExtension)
Definition: scsiport.c:544
static VOID SpiResourceToConfig(IN PHW_INITIALIZATION_DATA HwInitializationData, IN PCM_FULL_RESOURCE_DESCRIPTOR ResourceDescriptor, IN OUT PPORT_CONFIGURATION_INFORMATION PortConfig)
Definition: scsiport.c:973
VOID NTAPI ScsiPortReadRegisterBufferUlong(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
Definition: scsiport.c:1448
UCHAR NTAPI ScsiPortReadRegisterUchar(IN PUCHAR Register)
Definition: scsiport.c:1470
ULONG NTAPI ScsiPortReadRegisterUlong(IN PULONG Register)
Definition: scsiport.c:1478
static ARC_STATUS DiskClose(ULONG FileId)
Definition: scsiport.c:177
PVOID NTAPI ScsiPortGetVirtualAddress(IN PVOID HwDeviceExtension, IN SCSI_PHYSICAL_ADDRESS PhysicalAddress)
Definition: scsiport.c:825
VOID NTAPI ScsiPortWritePortBufferUchar(IN PUCHAR Port, IN PUCHAR Buffer, IN ULONG Count)
Definition: scsiport.c:1538
UCHAR NTAPI ScsiPortReadPortUchar(IN PUCHAR Port)
Definition: scsiport.c:1411
VOID NTAPI ScsiPortReadPortBufferUlong(IN PULONG Port, OUT PULONG Buffer, IN ULONG Count)
Definition: scsiport.c:1391
ULONG NTAPI ScsiPortGetBusData(IN PVOID DeviceExtension, IN ULONG BusDataType, IN ULONG SystemIoBusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Length)
Definition: scsiport.c:562
VOID NTAPI ScsiPortIoMapTransfer(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN PVOID LogicalAddress, IN ULONG Length)
Definition: scsiport.c:1308
static VOID SpiScanDevice(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN PCHAR ArcName, IN ULONG ScsiBus, IN ULONG TargetId, IN ULONG Lun)
Definition: scsiport.c:836
ULONG NTAPI ScsiPortReadPortUlong(IN PULONG Port)
Definition: scsiport.c:1421
USHORT NTAPI ScsiPortReadRegisterUshort(IN PUSHORT Register)
Definition: scsiport.c:1486
#define SCSI_PORT_NEXT_REQUEST_READY
Definition: scsiport.c:53
PVOID NTAPI ScsiPortGetDeviceBase(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
Definition: scsiport.c:575
#define TAG_SCSI_DEVEXT
Definition: scsiport.c:55
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:71
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
Definition: fs.c:219
PVOID FsGetDeviceSpecific(ULONG FileId)
Definition: fs.c:709
VOID FsSetDeviceSpecific(ULONG FileId, PVOID Specific)
Definition: fs.c:702
ARC_STATUS ArcClose(_In_ ULONG FileId)
Definition: fs.c:409
VOID FsRegisterDevice(_In_ PCSTR DeviceName, _In_ const DEVVTBL *FuncTable)
Definition: fs.c:673
VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: heap.c:553
PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: heap.c:545
VOID NTAPI HalpInitBusHandler(VOID)
Definition: bushndlr.c:444
VOID NTAPI HalpInitializePciStubs(VOID)
Definition: pcibus.c:1190
#define SectorOffset(L)
Definition: cdprocs.h:1622
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989
_In_ PREAD_CAPACITY_DATA ReadCapacityBuffer
Definition: cdrom.h:1103
#define SCSIOP_INQUIRY
Definition: cdrw_hw.h:888
struct _READ_CAPACITY_DATA READ_CAPACITY_DATA
#define DIRECT_ACCESS_DEVICE
Definition: cdrw_hw.h:1144
#define OPTICAL_DEVICE
Definition: cdrw_hw.h:1151
#define READ_ONLY_DIRECT_ACCESS_DEVICE
Definition: cdrw_hw.h:1149
#define SCSIOP_READ_CAPACITY
Definition: cdrw_hw.h:904
union _CDB * PCDB
#define SCSIOP_READ
Definition: cdrw_hw.h:905
#define INQUIRYDATABUFFERSIZE
Definition: cdrw_hw.h:1113
Definition: bufpool.h:45
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1315
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1313
_In_ PVOID Argument2
Definition: classpnp.h:721
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1314
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1230
FORCEINLINE PVOID VaToPa(PVOID Va)
Definition: conversion.h:15
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
#define MAX_PATH
Definition: compat.h:34
return ret
Definition: mutex.c:146
struct _FOUR_BYTE * PFOUR_BYTE
#define ULONG_PTR
Definition: config.h:101
#define SCSI_MAXIMUM_TARGETS_PER_BUS
Definition: srb.h:22
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
BOOLEAN(NTAPI * PHW_INTERRUPT)(IN PVOID DeviceExtension)
Definition: srb.h:450
#define SRB_FLAGS_IS_ACTIVE
Definition: srb.h:407
enum _SCSI_NOTIFICATION_TYPE SCSI_NOTIFICATION_TYPE
#define SCSI_MAXIMUM_BUSES
Definition: srb.h:24
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:315
#define SP_RETURN_FOUND
Definition: srb.h:522
BOOLEAN(NTAPI * PHW_STARTIO)(IN PVOID DeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
Definition: srb.h:443
#define SCSI_MAXIMUM_LOGICAL_UNITS
Definition: srb.h:21
BOOLEAN(NTAPI * PHW_RESET_BUS)(IN PVOID DeviceExtension, IN ULONG PathId)
Definition: srb.h:479
#define ScsiPortConvertPhysicalAddressToUlong(Address)
Definition: srb.h:957
struct _PORT_CONFIGURATION_INFORMATION PORT_CONFIGURATION_INFORMATION
#define SRB_FLAGS_DATA_IN
Definition: srb.h:400
#define SRB_STATUS(Status)
Definition: srb.h:389
@ RequestComplete
Definition: srb.h:531
@ NextRequest
Definition: srb.h:532
#define SP_UNINITIALIZED_VALUE
Definition: srb.h:232
#define SRB_STATUS_SUCCESS
Definition: srb.h:341
BOOLEAN(NTAPI * PHW_INITIALIZE)(IN PVOID DeviceExtension)
Definition: srb.h:437
NTHALAPI NTSTATUS NTAPI HalAssignSlotResources(PUNICODE_STRING, PUNICODE_STRING, PDRIVER_OBJECT, PDEVICE_OBJECT, INTERFACE_TYPE, ULONG, ULONG, PCM_RESOURCE_LIST *)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define PagedPool
Definition: env_spec_w32.h:308
@ Success
Definition: eventcreate.c:712
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PCCHAR FrLdrGetBootPath(VOID)
Definition: freeldr.c:196
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bus.c:140
ULONG NTAPI HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:73
PADAPTER_OBJECT NTAPI HalGetAdapter(IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters)
Definition: dma.c:22
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
Definition: portio.c:70
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
USHORT NTAPI READ_PORT_USHORT(IN PUSHORT Port)
Definition: portio.c:63
#define H2I(Port)
Definition: portio.c:18
CPPORT Port[4]
Definition: headless.c:35
PPC_QUAL void __outbytestring(unsigned long const Port, const unsigned char *const Buffer, const unsigned long Count)
Definition: intrin_ppc.h:653
PPC_QUAL void __outwordstring(unsigned long const Port, const unsigned short *const Buffer, const unsigned long Count)
Definition: intrin_ppc.h:662
PPC_QUAL void __inwordstring(unsigned long Port, unsigned short *Buffer, unsigned long Count)
Definition: intrin_ppc.h:591
PPC_QUAL void __inbytestring(unsigned long Port, unsigned char *Buffer, unsigned long Count)
Definition: intrin_ppc.h:584
PPC_QUAL void __outdwordstring(unsigned long const Port, const unsigned long *const Buffer, const unsigned long Count)
Definition: intrin_ppc.h:671
PPC_QUAL void __indwordstring(unsigned long Port, unsigned long *Buffer, unsigned long Count)
Definition: intrin_ppc.h:598
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define ntohl(x)
Definition: module.h:205
#define sprintf
Definition: sprintf.c:45
#define KeStallExecutionProcessor(MicroSeconds)
Definition: precomp.h:27
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:559
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
ULONG SectorCount
Definition: part_xbox.c:31
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN PeLdrLoadBootImage(_In_ PCSTR FilePath, _In_ PCSTR BaseDllName, _Out_ PVOID *ImageBase, _Out_ PLDR_DATA_TABLE_ENTRY *DataTableEntry)
Definition: peloader.c:1052
static WCHAR Address[46]
Definition: ping.c:68
#define CmResourceTypeMemory
Definition: restypes.h:106
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: restypes.h:116
#define CmResourceTypeDma
Definition: restypes.h:107
@ PCIBus
Definition: restypes.h:126
enum _INTERFACE_TYPE INTERFACE_TYPE
#define CmResourceTypePort
Definition: restypes.h:104
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: restypes.h:117
#define CmResourceTypeInterrupt
Definition: restypes.h:105
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
Definition: scratch.h:159
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
@ PCIConfiguration
Definition: miniport.h:93
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:907
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:906
@ ESUCCESS
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
@ DiskPeripheral
Definition: arc.h:138
@ FloppyDiskPeripheral
Definition: arc.h:139
@ SeekRelative
Definition: arc.h:60
@ SeekAbsolute
Definition: arc.h:59
enum _OPENMODE OPENMODE
enum _SEEKMODE SEEKMODE
@ OpenReadOnly
Definition: arc.h:65
strcat
Definition: string.h:92
strcpy
Definition: string.h:131
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
PHW_INITIALIZE HwInitialize
Definition: scsiport.c:80
PADAPTER_OBJECT AdapterObject
Definition: scsiport.c:86
PHW_RESET_BUS HwResetBus
Definition: scsiport.c:83
PHW_INTERRUPT HwInterrupt
Definition: scsiport.c:82
IO_SCSI_CAPABILITIES PortCapabilities
Definition: scsiport.c:78
ULONG RangeLength
Definition: srb.h:42
BOOLEAN RangeInMemory
Definition: srb.h:43
SCSI_PHYSICAL_ADDRESS RangeStart
Definition: srb.h:41
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430::@433 Interrupt
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430::@436 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430::@435 Memory
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430::@432 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430 u
UCHAR Byte0
Definition: tools.h:16
UCHAR Byte1
Definition: tools.h:17
UCHAR Byte2
Definition: tools.h:18
UCHAR Byte3
Definition: tools.h:19
ULONG AsULong
Definition: scsi.h:3485
UCHAR RemovableMedia
Definition: cdrw_hw.h:1119
UCHAR DeviceType
Definition: cdrw_hw.h:1116
Definition: btrfs_drv.h:1876
PVOID EntryPoint
Definition: ntddk_ex.h:203
ACCESS_RANGE(* AccessRanges)[]
Definition: srb.h:74
ULONG LogicalBlockAddress
Definition: cdrw_hw.h:1471
ULONG TimeOutValue
Definition: srb.h:262
UCHAR TargetId
Definition: srb.h:254
PVOID DataBuffer
Definition: srb.h:263
UCHAR PathId
Definition: srb.h:253
UCHAR CdbLength
Definition: srb.h:258
UCHAR Cdb[16]
Definition: srb.h:279
PVOID SenseInfoBuffer
Definition: srb.h:264
UCHAR Function
Definition: srb.h:250
ULONG DataTransferLength
Definition: srb.h:261
ULONG SrbFlags
Definition: srb.h:260
USHORT Length
Definition: srb.h:249
UCHAR SrbStatus
Definition: srb.h:251
Definition: fs.h:25
ULONGLONG SectorOffset
Definition: hwdisk.c:39
UCHAR PathId
Definition: scsiport.c:97
UCHAR TargetId
Definition: scsiport.c:98
BOOLEAN IsFloppy
Definition: hwdisk.c:37
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
Definition: scsiport.c:96
ULONGLONG SectorCount
Definition: hwdisk.c:40
ULONGLONG SectorNumber
Definition: hwdisk.c:41
ULONG SectorSize
Definition: hwdisk.c:38
static COORD Position
Definition: mouse.c:34
#define MAXULONG
Definition: typedefs.h:251
uint32_t * PULONG
Definition: typedefs.h:59
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define OUT
Definition: typedefs.h:40
char CCHAR
Definition: typedefs.h:51
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: cdrw_hw.h:28
struct _CDB::_CDB10 CDB10
struct _CDB::_CDB6INQUIRY CDB6INQUIRY
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2479 u
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFCOMMONBUFFER * CommonBuffer
_In_ WDF_SPECIAL_FILE_TYPE NotificationType
Definition: wdfdevice.h:1024
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
_IRQL_requires_same_ _In_opt_ PVOID Argument1
Definition: cmtypes.h:696
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
_In_ ULONG SectorSize
Definition: halfuncs.h:291
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:159
#define HALDISPATCH
Definition: haltypes.h:278
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
Definition: iofuncs.h:2052
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3603
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
#define DEVICE_DESCRIPTION_VERSION
Definition: iotypes.h:2063
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3601
#define PCI_MAX_DEVICES
Definition: iotypes.h:3600
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
#define ROUND_TO_PAGES(Size)
#define _vsnprintf
Definition: xmlstorage.h:202
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175