|
|
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: ! 26: ! 27: #include <machdep/ppc/proc_reg.h> ! 28: #include <machdep/ppc/powermac.h> ! 29: ! 30: #import "ohare.h" ! 31: ! 32: ! 33: @implementation AppleOHare ! 34: ! 35: + (BOOL)probe:(IOPCIDevice *)deviceDescription ! 36: { ! 37: AppleOHare *OHareInstance; ! 38: ! 39: OHareInstance = [self alloc]; ! 40: ! 41: return [OHareInstance initFromDeviceDescription:deviceDescription] != nil; ! 42: } ! 43: ! 44: ! 45: - initFromDeviceDescription:(IOPCIDevice *)deviceDescription ! 46: { ! 47: unsigned long PCICommandReg; ! 48: ! 49: if ([super initFromDeviceDescription:deviceDescription] == nil) { ! 50: IOLog("AppleOHare: [super initFromDeviceDescription] failed\n"); ! 51: return nil; ! 52: } ! 53: ! 54: // Set the PCI Command Register for Bus Master, Memory Access ! 55: // and not I/O Access. ! 56: [deviceDescription configReadLong:0x04 value:&PCICommandReg]; ! 57: PCICommandReg |= (2 | 1); // Master & Memory ! 58: PCICommandReg &= ~4; // Not I/O ! 59: [deviceDescription configWriteLong:0x04 value:PCICommandReg]; ! 60: ! 61: [self mapMemoryRange:0 to:(vm_address_t *)&ioBaseOHare ! 62: findSpace:YES cache:IO_CacheOff]; ! 63: ! 64: powermac_io_info.io_base2 = ioBaseOHare; ! 65: ! 66: *(long *)(ioBaseOHare + 0x00024) = 0; /* Disable all interrupts */ ! 67: eieio(); ! 68: *(long *)(ioBaseOHare + 0x00028) = 0xffffffff; /* Clear pending interrupts */ ! 69: eieio(); ! 70: *(long *)(ioBaseOHare + 0x00024) = 0; /* Disable all interrupts */ ! 71: eieio(); ! 72: ! 73: [deviceDescription setInterruptList:NULL num:0]; ! 74: ! 75: [self setName:"AppleOHare"]; ! 76: [self registerDevice]; ! 77: ! 78: return self; ! 79: } ! 80: ! 81: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.