Author: hbelusca
Date: Fri Feb 5 21:12:53 2016
New Revision: 70693
URL:
http://svn.reactos.org/svn/reactos?rev=70693&view=rev
Log:
[FREELDR]: Add source file header to scsiport.c; move structure definitions together.
Modified:
trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c
Modified: trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] Fri Feb 5 21:12:53
2016
@@ -1,3 +1,13 @@
+/*
+ * PROJECT: ReactOS Boot Loader (FreeLDR)
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: boot/freeldr/freeldr/disk/scsiport.c
+ * PURPOSE: Interface for SCSI Emulation
+ * PROGRAMMERS: Hervé Poussineau <hpoussin(a)reactos.org>
+ */
+
+/* INCLUDES *******************************************************************/
+
#include <freeldr.h>
#define _SCSIPORT_
@@ -48,96 +58,12 @@
DBG_DEFAULT_CHANNEL(SCSIPORT);
+/* GLOBALS ********************************************************************/
+
#ifdef _M_IX86
VOID NTAPI HalpInitializePciStubs(VOID);
VOID NTAPI HalpInitBusHandler(VOID);
#endif
-
-typedef struct
-{
- PVOID NonCachedExtension;
-
- ULONG BusNum;
- ULONG MaxTargedIds;
-
- ULONG InterruptFlags;
-
- /* SRB extension stuff */
- ULONG SrbExtensionSize;
- PVOID SrbExtensionBuffer;
-
- IO_SCSI_CAPABILITIES PortCapabilities;
-
- PHW_INITIALIZE HwInitialize;
- PHW_STARTIO HwStartIo;
- PHW_INTERRUPT HwInterrupt;
- PHW_RESET_BUS HwResetBus;
-
- /* DMA related stuff */
- PADAPTER_OBJECT AdapterObject;
-
- ULONG CommonBufferLength;
-
- PVOID MiniPortDeviceExtension;
-} SCSI_PORT_DEVICE_EXTENSION, *PSCSI_PORT_DEVICE_EXTENSION;
-
-PSCSI_PORT_DEVICE_EXTENSION ScsiDeviceExtensions[SCSI_MAXIMUM_BUSES];
-
-ULONG
-ntohl(
- IN ULONG Value)
-{
- FOUR_BYTE Dest;
- PFOUR_BYTE Source = (PFOUR_BYTE)&Value;
-
- Dest.Byte0 = Source->Byte3;
- Dest.Byte1 = Source->Byte2;
- Dest.Byte2 = Source->Byte1;
- Dest.Byte3 = Source->Byte0;
-
- return Dest.AsULong;
-}
-
-static
-BOOLEAN
-SpiSendSynchronousSrb(
- IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
- IN PSCSI_REQUEST_BLOCK Srb)
-{
- BOOLEAN ret;
-
- ASSERT(!(Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE));
-
- /* HACK: handle lack of interrupts */
- while (!(DeviceExtension->InterruptFlags & SCSI_PORT_NEXT_REQUEST_READY))
- {
- KeStallExecutionProcessor(100 * 1000);
- DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension);
- }
-
- DeviceExtension->InterruptFlags &= ~SCSI_PORT_NEXT_REQUEST_READY;
- Srb->SrbFlags |= SRB_FLAGS_IS_ACTIVE;
-
- if (!DeviceExtension->HwStartIo(
- DeviceExtension->MiniPortDeviceExtension,
- Srb))
- {
- ExFreePool(Srb);
- return FALSE;
- }
-
- /* HACK: handle lack of interrupts */
- while (Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE)
- {
- KeStallExecutionProcessor(100 * 1000);
- DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension);
- }
-
- ret = SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SUCCESS;
- ExFreePool(Srb);
-
- return ret;
-}
typedef struct tagDISKCONTEXT
{
@@ -153,6 +79,94 @@
ULONGLONG SectorCount;
ULONGLONG SectorNumber;
} DISKCONTEXT;
+
+typedef struct
+{
+ PVOID NonCachedExtension;
+
+ ULONG BusNum;
+ ULONG MaxTargedIds;
+
+ ULONG InterruptFlags;
+
+ /* SRB extension stuff */
+ ULONG SrbExtensionSize;
+ PVOID SrbExtensionBuffer;
+
+ IO_SCSI_CAPABILITIES PortCapabilities;
+
+ PHW_INITIALIZE HwInitialize;
+ PHW_STARTIO HwStartIo;
+ PHW_INTERRUPT HwInterrupt;
+ PHW_RESET_BUS HwResetBus;
+
+ /* DMA related stuff */
+ PADAPTER_OBJECT AdapterObject;
+
+ ULONG CommonBufferLength;
+
+ PVOID MiniPortDeviceExtension;
+} SCSI_PORT_DEVICE_EXTENSION, *PSCSI_PORT_DEVICE_EXTENSION;
+
+PSCSI_PORT_DEVICE_EXTENSION ScsiDeviceExtensions[SCSI_MAXIMUM_BUSES];
+
+/* FUNCTIONS ******************************************************************/
+
+ULONG
+ntohl(
+ IN ULONG Value)
+{
+ FOUR_BYTE Dest;
+ PFOUR_BYTE Source = (PFOUR_BYTE)&Value;
+
+ Dest.Byte0 = Source->Byte3;
+ Dest.Byte1 = Source->Byte2;
+ Dest.Byte2 = Source->Byte1;
+ Dest.Byte3 = Source->Byte0;
+
+ return Dest.AsULong;
+}
+
+static
+BOOLEAN
+SpiSendSynchronousSrb(
+ IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb)
+{
+ BOOLEAN ret;
+
+ ASSERT(!(Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE));
+
+ /* HACK: handle lack of interrupts */
+ while (!(DeviceExtension->InterruptFlags & SCSI_PORT_NEXT_REQUEST_READY))
+ {
+ KeStallExecutionProcessor(100 * 1000);
+ DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension);
+ }
+
+ DeviceExtension->InterruptFlags &= ~SCSI_PORT_NEXT_REQUEST_READY;
+ Srb->SrbFlags |= SRB_FLAGS_IS_ACTIVE;
+
+ if (!DeviceExtension->HwStartIo(
+ DeviceExtension->MiniPortDeviceExtension,
+ Srb))
+ {
+ ExFreePool(Srb);
+ return FALSE;
+ }
+
+ /* HACK: handle lack of interrupts */
+ while (Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE)
+ {
+ KeStallExecutionProcessor(100 * 1000);
+ DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension);
+ }
+
+ ret = SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SUCCESS;
+ ExFreePool(Srb);
+
+ return ret;
+}
static ARC_STATUS DiskClose(ULONG FileId)
{