|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* Sym8xxController.h created by russb2 on Sat 30-May-1998 */ ! 26: ! 27: #import <bsd/sys/systm.h> ! 28: #import <bsd/include/string.h> ! 29: #import <mach/vm_param.h> ! 30: #import <machkit/NXLock.h> ! 31: #import <kernserv/ns_timer.h> ! 32: #import <kern/queue.h> ! 33: #import <driverkit/driverTypes.h> ! 34: #import <driverkit/generalFuncs.h> ! 35: #import <driverkit/kernelDriver.h> ! 36: #import <driverkit/interruptMsg.h> ! 37: #import <driverkit/IODirectDevice.h> ! 38: #import <driverkit/ppc/IOPCIDevice.h> ! 39: ! 40: #import <driverkit/IOSimpleMemoryDescriptor.h> ! 41: ! 42: #import <bsd/dev/scsireg.h> ! 43: #import <driverkit/IOSCSIController.h> ! 44: ! 45: #import "Sym8xxRegs.h" ! 46: #import "Sym8xxInterface.h" ! 47: #import "Sym8xxSRB.h" ! 48: ! 49: #import "Sym8xxScript.h" ! 50: ! 51: @interface Sym8xxController : IOSCSIController ! 52: { ! 53: AdapterInterface *adapter; ! 54: AdapterInterface *adapterPhys; ! 55: ! 56: Target targets[MAX_SCSI_TARGETS]; ! 57: u_int32_t tags[MAX_SCSI_TAG/32]; ! 58: u_int32_t nexusArrayVirt[MAX_SCSI_TAG]; ! 59: ! 60: u_int8_t mailBoxIndex; ! 61: ! 62: u_int32_t initiatorID; ! 63: ! 64: u_int8_t istatReg; ! 65: u_int8_t dstatReg; ! 66: u_int16_t sistReg; ! 67: ! 68: u_int32_t scriptRestartAddr; ! 69: ! 70: NXLock *srbPendingQLock; ! 71: queue_head_t srbPendingQ; ! 72: ! 73: NXConditionLock *srbPoolGrowLock; ! 74: u_int32_t srbPoolGrow; ! 75: ! 76: NXLock *srbPoolLock; ! 77: queue_head_t srbPool; ! 78: u_int32_t srbSeqNum; ! 79: u_int32_t resetSeqNum; ! 80: ! 81: NXLock *resetQuiesceSem; ! 82: u_int32_t resetQuiesceTimer; ! 83: ! 84: NXLock *cmdQTagSem; ! 85: NXLock *abortBdrSem; ! 86: ! 87: port_t interruptPortKern; ! 88: ! 89: SRB *resetSRB; ! 90: SRB *abortSRB; ! 91: u_int32_t abortSRBTimeout; ! 92: SRB *abortCurrentSRB; ! 93: u_int32_t abortCurrentSRBTimeout; ! 94: ! 95: u_int32_t chipType; ! 96: u_int32_t chipClockRate; ! 97: ! 98: volatile u_int8_t *chipBaseAddr; ! 99: u_int8_t *chipBaseAddrPhys; ! 100: ! 101: volatile u_int8_t *chipRamAddr; ! 102: u_int8_t *chipRamAddrPhys; ! 103: ! 104: } ! 105: @end ! 106: ! 107: @interface Sym8xxController(Init) ! 108: + (BOOL) probe:(IOPCIDevice *)deviceDescription; ! 109: - initFromDeviceDescription:(IOPCIDevice *) deviceDescription; ! 110: - (BOOL) Sym8xxInit:(IOPCIDevice *)deviceDescription; ! 111: - (BOOL) Sym8xxInitPCI:(IOPCIDevice *)deviceDescription; ! 112: - (BOOL) Sym8xxInitVars; ! 113: - (BOOL) Sym8xxInitScript; ! 114: - (void) Sym8xxLoadScript:(u_int32_t *)scriptPgm count:(u_int32_t)scriptWords; ! 115: - (BOOL) Sym8xxInitChip; ! 116: ! 117: @end ! 118: ! 119: @interface Sym8xxController(Client) ! 120: - (sc_status_t) executeRequest:(IOSCSIRequest *)scsiReq buffer:(void *)buffer client:(vm_task_t)client; ! 121: - (sc_status_t) executeRequest:(IOSCSIRequest *)scsiReq ioMemoryDescriptor: (IOMemoryDescriptor *) ioMemoryDescriptor; ! 122: - (sc_status_t) resetSCSIBus; ! 123: - (void) getDMAAlignment:(IODMAAlignment *)alignment; ! 124: - (int) numberOfTargets; ! 125: - (void) Sym8xxCalcMsgs: (SRB *)srb; ! 126: - (void) Sym8xxSendCommand: (SRB *) srb; ! 127: - (u_int32_t) Sym8xxAllocTag:(SRB *)srb CmdQueue:(BOOL)fCmdQueue; ! 128: - (void) Sym8xxFreeTag:(SRB *)srb; ! 129: - (SRB *) Sym8xxAllocSRB; ! 130: - (void) Sym8xxFreeSRB:(SRB *)srb; ! 131: - (void) Sym8xxGrowSRBPool; ! 132: - (BOOL) Sym8xxUpdateSGList:(SRB *)srb; ! 133: - (BOOL) Sym8xxUpdateSGListVirt: (SRB *) srb; ! 134: - (BOOL) Sym8xxUpdateSGListDesc: (SRB *) srb; ! 135: ! 136: ! 137: IOThreadFunc Sym8xxTimerReq( Sym8xxController *device ); ! 138: IOThreadFunc Sym8xxGrowSRBPool( Sym8xxController *controller ); ! 139: ! 140: @end ! 141: ! 142: @interface Sym8xxController(Execute) ! 143: - (void) commandRequestOccurred; ! 144: - (void) Sym8xxSignalScript:(SRB *)srb; ! 145: - (void) interruptOccurred; ! 146: - (void) timeoutOccurred; ! 147: - (void) Sym8xxProcessIODone; ! 148: - (void) Sym8xxProcessInterrupt; ! 149: - (BOOL) Sym8xxProcessStatus:(SRB *)srb; ! 150: - (void) Sym8xxIssueRequestSense:(SRB *) srb; ! 151: - (void) Sym8xxAdjustDataPtrs:(SRB *) srb Nexus:(Nexus *) nexus; ! 152: - (u_int32_t) Sym8xxCheckFifo:(SRB *)srb FifoCnt:(u_int32_t *)pfifoCnt; ! 153: - (void) Sym8xxUpdateXferOffset:(SRB *) srb; ! 154: - (void) Sym8xxProcessNoNexus; ! 155: - (void) Sym8xxAbortCurrent:(SRB *)srb; ! 156: - (void) Sym8xxClearFifo; ! 157: - (void) Sym8xxNegotiateSDTR:(SRB *) srb Nexus:(Nexus *)nexus; ! 158: - (void) Sym8xxNegotiateWDTR:(SRB *) srb Nexus:(Nexus *)nexus; ! 159: - (void) Sym8xxSendMsgReject:(SRB *) srb; ! 160: - (void) Sym8xxCheckInquiryData: (SRB *)srb; ! 161: - (void) Sym8xxSCSIBusReset:(SRB *)srb; ! 162: - (void) Sym8xxProcessSCSIBusReset; ! 163: - (void) Sym8xxAbortBdr: (SRB *) srb; ! 164: - (void) Sym8xxAbortScript; ! 165: ! 166: ! 167: ! 168: @end ! 169: ! 170: u_int32_t Sym8xxReadRegs( volatile u_int8_t *chipRegs, u_int32_t regOffset, u_int32_t regSize ); ! 171: void Sym8xxWriteRegs( volatile u_int8_t *chipRegs, u_int32_t regOffset, u_int32_t regSize, u_int32_t regValue ); ! 172: ! 173: extern kern_return_t kmem_alloc_wired(); ! 174: extern kern_return_t kmem_free(); ! 175: extern kern_return_t msg_send_from_kernel(msg_header_t *,int,int); ! 176: //extern void call_kdp(); ! 177: ! 178: extern u_int32_t page_size; ! 179: ! 180: #if 0 ! 181: extern u_int32_t gRegs875, gRegs875Phys, gRam875, gRam875Phys; ! 182: #endif ! 183: ! 184: ! 185: static __inline__ u_int16_t EndianSwap16(volatile u_int16_t y) ! 186: { ! 187: u_int16_t result; ! 188: volatile u_int16_t x; ! 189: ! 190: x = y; ! 191: __asm__ volatile("lhbrx %0, 0, %1" : "=r" (result) : "r" (&x) : "r0"); ! 192: return result; ! 193: } ! 194: ! 195: static __inline__ u_int32_t EndianSwap32(u_int32_t y) ! 196: { ! 197: u_int32_t result; ! 198: volatile u_int32_t x; ! 199: ! 200: x = y; ! 201: __asm__ volatile("lwbrx %0, 0, %1" : "=r" (result) : "r" (&x) : "r0"); ! 202: return result; ! 203: } ! 204: ! 205: #ifndef eieio ! 206: #define eieio() \ ! 207: __asm__ volatile("eieio") ! 208: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.