]>
git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/scsi/drvSymbios8xx/Sym8xxController.h
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 /* Sym8xxController.h created by russb2 on Sat 30-May-1998 */
25 #include <IOKit/IOMemoryCursor.h>
26 #include <IOKit/pci/IOPCIDevice.h>
27 #include <libkern/OSByteOrder.h>
29 #include <IOKit/scsi/IOSCSIParallelInterface.h>
31 #include "Sym8xxRegs.h"
32 #include "Sym8xxInterface.h"
33 #include "Sym8xxSRB.h"
35 #include "Sym8xxScript.h"
37 #define offsetof(type, field) ((int)&((type *)0)->field)
39 class Sym8xxSCSIController
: public IOSCSIParallelController
41 OSDeclareDefaultStructors( Sym8xxSCSIController
)
45 AdapterInterface
*adapter
;
46 AdapterInterface
*adapterPhys
;
48 UInt32 nexusArrayVirt
[MAX_SCSI_TAG
];
50 IOBigMemoryCursor
*memoryCursor
;
52 IOPCIDevice
*provider
;
54 IOInterruptEventSource
*interruptEvent
;
56 IOMemoryMap
*ioMapRegs
;
57 IOMemoryMap
*ioMapRam
;
67 UInt32 scriptRestartAddr
;
78 bool negotiateWDTRComplete
;
79 bool negotiateSDTRComplete
;
81 UInt32 transferPeriod
;
82 UInt32 transferOffset
;
88 volatile UInt8
*chipBaseAddr
;
89 UInt8
*chipBaseAddrPhys
;
91 volatile UInt8
*chipRamAddr
;
92 UInt8
*chipRamAddrPhys
;
95 bool configure( IOService
*forProvider
, SCSIControllerInfo
*controllerInfo
);
96 void executeCommand( IOSCSIParallelCommand
*scsiCommand
);
97 void cancelCommand( IOSCSIParallelCommand
*scsiCommand
);
98 void resetCommand( IOSCSIParallelCommand
*scsiCommand
);
102 bool Sym8xxInitPCI();
103 bool Sym8xxInitVars();
104 bool Sym8xxInitScript();
105 void Sym8xxLoadScript( UInt32
*scriptPgm
, UInt32 scriptWords
);
106 bool Sym8xxInitChip();
108 void Sym8xxCalcMsgs( IOSCSIParallelCommand
*scsiCommand
);
109 void Sym8xxAbortCommand( IOSCSIParallelCommand
*scsiCommand
);
111 bool Sym8xxUpdateSGList( SRB
*srb
);
112 bool Sym8xxUpdateSGListVirt( SRB
*srb
);
113 bool Sym8xxUpdateSGListDesc( SRB
*srb
);
115 void Sym8xxStartSRB( SRB
*srb
);
116 void Sym8xxSignalScript( SRB
*srb
);
117 void interruptOccurred( IOInterruptEventSource
*ies
, int intCount
);
118 void Sym8xxProcessIODone();
119 void Sym8xxCompleteSRB( SRB
*srb
);
120 void Sym8xxProcessInterrupt();
121 void Sym8xxAdjustDataPtrs( SRB
*srb
, Nexus
*nexus
);
122 UInt32
Sym8xxCheckFifo( SRB
*srb
, UInt32
*pfifoCnt
);
123 void Sym8xxUpdateXferOffset( SRB
*srb
);
124 void Sym8xxProcessNoNexus();
125 void Sym8xxAbortCurrent( SRB
*srb
);
126 void Sym8xxClearFifo();
127 void Sym8xxNegotiateSDTR( SRB
*srb
, Nexus
*nexus
);
128 void Sym8xxNegotiateWDTR( SRB
*srb
, Nexus
*nexus
);
129 void Sym8xxSendMsgReject( SRB
*srb
);
130 void Sym8xxSCSIBusReset(SRB
*srb
);
131 void Sym8xxProcessSCSIBusReset();
132 void Sym8xxCheckRequestSense( SRB
*srb
);
133 void Sym8xxAbortBdr( SRB
*srb
);
134 bool Sym8xxCancelMailBox( Nexus
*nexusCancel
);
135 void Sym8xxCancelMailBox( UInt32 target
, UInt32 lun
, bool fReschedule
);
137 void Sym8xxAbortScript();
139 UInt32
Sym8xxReadRegs( volatile UInt8
*chipRegs
, UInt32 regOffset
, UInt32 regSize
);
140 void Sym8xxWriteRegs( volatile UInt8
*chipRegs
, UInt32 regOffset
, UInt32 regSize
, UInt32 regValue
);