|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 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: * Copyright (c) 1997 Apple Computer, Inc. ! 24: * ! 25: * ! 26: * HISTORY ! 27: * ! 28: * Simon Douglas 10 Nov 97 ! 29: * - first checked in, mostly from machdep/ppc/dbdma.c ! 30: * ! 31: */ ! 32: ! 33: ! 34: #include <IOKit/ppc/IODBDMA.h> ! 35: #include <IOKit/IOLib.h> ! 36: ! 37: void ! 38: IODBDMAStart( volatile IODBDMAChannelRegisters *registers, volatile IODBDMADescriptor *physicalDescPtr) ! 39: { ! 40: ! 41: if( ((int) physicalDescPtr) & 0xf) ! 42: panic("IODBDMAStart: unaligned IODBDMADescriptor"); ! 43: ! 44: eieio(); ! 45: IOSetDBDMAInterruptSelect(registers, 0xff000000); // clear out interrupts ! 46: ! 47: IOSetDBDMAChannelControl( registers, ! 48: IOClearDBDMAChannelControlBits( kdbdmaRun | kdbdmaPause | kdbdmaFlush | kdbdmaWake | kdbdmaDead | kdbdmaActive )); ! 49: ! 50: while( IOGetDBDMAChannelStatus( registers) & kdbdmaActive) ! 51: eieio(); ! 52: ! 53: IOSetDBDMACommandPtr( registers, (unsigned int) physicalDescPtr); ! 54: ! 55: IOSetDBDMAChannelControl( registers, ! 56: IOSetDBDMAChannelControlBits( kdbdmaRun | kdbdmaWake )); ! 57: ! 58: } ! 59: ! 60: void ! 61: IODBDMAStop( volatile IODBDMAChannelRegisters *registers) ! 62: { ! 63: ! 64: IOSetDBDMAChannelControl( registers, ! 65: IOClearDBDMAChannelControlBits( kdbdmaRun ) ! 66: | IOSetDBDMAChannelControlBits( kdbdmaFlush )); ! 67: ! 68: while( IOGetDBDMAChannelStatus( registers) & ( kdbdmaActive | kdbdmaFlush)) ! 69: eieio(); ! 70: ! 71: } ! 72: ! 73: void ! 74: IODBDMAFlush( volatile IODBDMAChannelRegisters *registers) ! 75: { ! 76: ! 77: IOSetDBDMAChannelControl( registers, ! 78: IOSetDBDMAChannelControlBits( kdbdmaFlush )); ! 79: ! 80: while( IOGetDBDMAChannelStatus( registers) & kdbdmaFlush) ! 81: eieio(); ! 82: ! 83: } ! 84: ! 85: void ! 86: IODBDMAReset( volatile IODBDMAChannelRegisters *registers) ! 87: { ! 88: ! 89: IOSetDBDMAChannelControl( registers, ! 90: IOClearDBDMAChannelControlBits( kdbdmaRun | kdbdmaPause | kdbdmaFlush | kdbdmaWake | kdbdmaDead | kdbdmaActive )); ! 91: ! 92: while( IOGetDBDMAChannelStatus( registers) & kdbdmaActive) ! 93: eieio(); ! 94: ! 95: } ! 96: ! 97: void ! 98: IODBDMAContinue( volatile IODBDMAChannelRegisters *registers) ! 99: { ! 100: ! 101: IOSetDBDMAChannelControl( registers, ! 102: IOClearDBDMAChannelControlBits( kdbdmaPause | kdbdmaDead ) ! 103: | IOSetDBDMAChannelControlBits( kdbdmaRun | kdbdmaWake )); ! 104: ! 105: } ! 106: ! 107: void ! 108: IODBDMAPause( volatile IODBDMAChannelRegisters *registers) ! 109: { ! 110: ! 111: IOSetDBDMAChannelControl( registers, ! 112: IOSetDBDMAChannelControlBits( kdbdmaPause )); ! 113: ! 114: while( IOGetDBDMAChannelStatus( registers) & kdbdmaActive) ! 115: eieio(); ! 116: ! 117: } ! 118: ! 119: IOReturn ! 120: IOAllocatePhysicallyContiguousMemory( ! 121: unsigned int /* size */, unsigned int /* options */, ! 122: IOVirtualAddress * /* logical */, ! 123: IOPhysicalAddress * /* physical */ ) ! 124: { ! 125: #if 0 ! 126: IOReturn err; ! 127: vm_offset_t mem; ! 128: ! 129: if( (size > 4096) || (options)) ! 130: return( kIOReturnUnsupported); ! 131: ! 132: mem = (vm_offset_t) IOMalloc( size); ! 133: *logical = (IOVirtualAddress) mem; ! 134: ! 135: if( mem) { ! 136: err = IOPhysicalFromVirtual( IOVmTaskSelf(), mem, (vm_offset_t *) physical); ! 137: if( err) ! 138: IOFree( (char *)mem, size); ! 139: ! 140: } else { ! 141: err = kIOReturnNoMemory; ! 142: *physical = 0; ! 143: } ! 144: ! 145: return( err); ! 146: #endif /* 0 */ ! 147: return (kIOReturnUnsupported); ! 148: } ! 149: ! 150: IOReturn ! 151: IOFreePhysicallyContiguousMemory( IOVirtualAddress * logical, unsigned int size) ! 152: { ! 153: IOFree( logical, size); ! 154: return( kIOReturnSuccess); ! 155: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.