|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 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. ! 11: * ! 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 ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: ! 23: /* Sym8xxController.h created by russb2 on Sat 30-May-1998 */ ! 24: ! 25: #include <IOKit/IOMemoryCursor.h> ! 26: #include <IOKit/pci/IOPCIDevice.h> ! 27: #include <libkern/OSByteOrder.h> ! 28: ! 29: #include <IOKit/scsi/IOSCSIParallelInterface.h> ! 30: ! 31: #include "Sym8xxRegs.h" ! 32: #include "Sym8xxInterface.h" ! 33: #include "Sym8xxSRB.h" ! 34: ! 35: #include "Sym8xxScript.h" ! 36: ! 37: #define offsetof(type, field) ((int)&((type *)0)->field) ! 38: ! 39: class Sym8xxSCSIController : public IOSCSIParallelController ! 40: { ! 41: OSDeclareDefaultStructors( Sym8xxSCSIController ) ! 42: ! 43: private: ! 44: ! 45: AdapterInterface *adapter; ! 46: AdapterInterface *adapterPhys; ! 47: ! 48: UInt32 nexusArrayVirt[MAX_SCSI_TAG]; ! 49: ! 50: IOBigMemoryCursor *memoryCursor; ! 51: ! 52: IOPCIDevice *provider; ! 53: ! 54: IOInterruptEventSource *interruptEvent; ! 55: ! 56: IOMemoryMap *ioMapRegs; ! 57: IOMemoryMap *ioMapRam; ! 58: ! 59: UInt8 mailBoxIndex; ! 60: ! 61: UInt32 initiatorID; ! 62: ! 63: UInt8 istatReg; ! 64: UInt8 dstatReg; ! 65: u_int16_t sistReg; ! 66: ! 67: UInt32 scriptRestartAddr; ! 68: ! 69: UInt32 srbSeqNum; ! 70: UInt32 resetSeqNum; ! 71: ! 72: SRB *resetSRB; ! 73: SRB *abortSRB; ! 74: SRB *abortCurrentSRB; ! 75: bool abortReqPending; ! 76: bool initialReset; ! 77: ! 78: UInt32 chipId; ! 79: UInt32 chipClockRate; ! 80: ! 81: volatile UInt8 *chipBaseAddr; ! 82: UInt8 *chipBaseAddrPhys; ! 83: ! 84: volatile UInt8 *chipRamAddr; ! 85: UInt8 *chipRamAddrPhys; ! 86: ! 87: public: ! 88: bool configure( IOService *forProvider, SCSIControllerInfo *controllerInfo ); ! 89: void executeCommand( IOSCSICommand *scsiCommand ); ! 90: void cancelCommand( IOSCSICommand *scsiCommand ); ! 91: void resetCommand( IOSCSICommand *scsiCommand ); ! 92: ! 93: private: ! 94: bool Sym8xxInit(); ! 95: bool Sym8xxInitPCI(); ! 96: bool Sym8xxInitVars(); ! 97: bool Sym8xxInitScript(); ! 98: void Sym8xxLoadScript( UInt32 *scriptPgm, UInt32 scriptWords ); ! 99: bool Sym8xxInitChip(); ! 100: ! 101: void Sym8xxCalcMsgs( IOSCSICommand *scsiCommand ); ! 102: void Sym8xxAbortCommand( IOSCSICommand *scsiCommand ); ! 103: ! 104: bool Sym8xxUpdateSGList( SRB *srb ); ! 105: bool Sym8xxUpdateSGListVirt( SRB *srb ); ! 106: bool Sym8xxUpdateSGListDesc( SRB *srb ); ! 107: ! 108: void Sym8xxStartSRB( SRB *srb ); ! 109: void Sym8xxSignalScript( SRB *srb ); ! 110: void interruptOccurred( IOInterruptEventSource *ies, int intCount ); ! 111: void Sym8xxProcessIODone(); ! 112: void Sym8xxCompleteSRB( SRB *srb ); ! 113: void Sym8xxProcessInterrupt(); ! 114: void Sym8xxAdjustDataPtrs( SRB *srb, Nexus *nexus ); ! 115: UInt32 Sym8xxCheckFifo( SRB *srb, UInt32 *pfifoCnt ); ! 116: void Sym8xxUpdateXferOffset( SRB *srb ); ! 117: void Sym8xxProcessNoNexus(); ! 118: void Sym8xxAbortCurrent( SRB *srb ); ! 119: void Sym8xxClearFifo(); ! 120: void Sym8xxNegotiateSDTR( SRB *srb, Nexus *nexus ); ! 121: void Sym8xxNegotiateWDTR( SRB *srb, Nexus *nexus ); ! 122: void Sym8xxSendMsgReject( SRB *srb ); ! 123: void Sym8xxSCSIBusReset(SRB *srb ); ! 124: void Sym8xxProcessSCSIBusReset(); ! 125: void Sym8xxCheckRequestSense( SRB *srb ); ! 126: void Sym8xxAbortBdr( SRB *srb ); ! 127: bool Sym8xxCancelMailBox( Nexus *nexusCancel ); ! 128: void Sym8xxCancelMailBox( UInt32 target, UInt32 lun, bool fReschedule ); ! 129: ! 130: void Sym8xxAbortScript(); ! 131: ! 132: UInt32 Sym8xxReadRegs( volatile UInt8 *chipRegs, UInt32 regOffset, UInt32 regSize ); ! 133: void Sym8xxWriteRegs( volatile UInt8 *chipRegs, UInt32 regOffset, UInt32 regSize, UInt32 regValue ); ! 134: ! 135: }; ! 136:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.