Annotation of driverkit/libDriver/ppc/IOPCIDevice.m, revision 1.1.1.1

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:  * Copyright (c) 1997 Apple Computer, Inc.
                     26:  *
                     27:  *
                     28:  * HISTORY
                     29:  *
                     30:  * Simon Douglas  22 Oct 97
                     31:  * - first checked in.
                     32:  */
                     33: 
                     34: 
                     35: 
                     36: #define KERNEL_PRIVATE 1
                     37: 
                     38: #import <objc/List.h>
                     39: 
                     40: #import <driverkit/KernDeviceDescription.h>
                     41: #import <driverkit/ppc/PPCKernBus.h>
                     42: 
                     43: #import <driverkit/ppc/IOPPCDeviceDescription.h>
                     44: #import <driverkit/ppc/IOPPCDeviceDescriptionPriv.h>
                     45: #import <driverkit/IODeviceDescriptionPrivate.h>
                     46: #import <driverkit/ppc/directDevice.h>
                     47: 
                     48: #import <machdep/ppc/DeviceTree.h>
                     49: #import <machdep/ppc/proc_reg.h>
                     50: #import "IOMacRiscPCI.h"
                     51: 
                     52: 
                     53: struct _pciprivate {
                     54: 
                     55:     IOMacRiscPCIBridge *parent;
                     56: };
                     57: 
                     58: 
                     59: @implementation IOPCIDevice
                     60: 
                     61: - initAt:(IOPropertyTable *)propTable parent:_parent ref:ref
                     62: {
                     63:     struct _pciprivate *private;
                     64: 
                     65:     _dtpciprivate = (void *)IOMalloc(sizeof (struct _pciprivate));
                     66:     bzero(_dtpciprivate, sizeof (struct _pciprivate));
                     67: 
                     68:     private = _dtpciprivate;
                     69:     private->parent = (IOMacRiscPCIBridge *) _parent;
                     70: 
                     71:     return( [super initAt:propTable parent:_parent ref:ref]);
                     72: }
                     73: 
                     74: - (IOReturn) resolveAddressing
                     75: {
                     76:     IOReturn   err;
                     77:     UInt32   *  cells;
                     78:     UInt32     myCells;
                     79:     UInt32     propSize;
                     80: 
                     81:     myCells = [self addressCells] + [self sizeCells];          // or, 5
                     82: 
                     83:     // Same as IODeviceTree, except "reg" is "assigned-addresses"
                     84:     err = [[self propertyTable] getProperty:"assigned-addresses" flags:kReferenceProperty
                     85:                 value:(void **) &cells length:&propSize];
                     86:     if( err == noErr) {
                     87:        err = [self findMemoryApertures:cells num:(propSize / (4 * myCells))];
                     88:     } else
                     89:        err = noErr;
                     90: 
                     91:     return( err);
                     92: }
                     93: 
                     94: - (IOReturn) resolveInterrupts
                     95: {
                     96:     IOReturn           err;
                     97:     IOPropertyTable  * propTable = [self propertyTable];
                     98:     ByteCount          propSize;
                     99: 
                    100:     [propTable createProperty:"AAPL,dk_Share IRQ Levels" flags:0
                    101:                 value:"YES" length:4];
                    102: 
                    103:     err = [super resolveInterrupts];
                    104: 
                    105:     if( err && (noErr == [propTable getProperty:"interrupts" flags:kReferenceProperty
                    106:                value:NULL length:&propSize])) {
                    107:        // inherit & share parent's
                    108:         IODeviceDescription  * bridge;
                    109: 
                    110:         bridge = [[self parent] deviceDescription];
                    111:        if( bridge) {
                    112:             err = [self setInterruptList:[bridge interruptList] num:[bridge numInterrupts]];
                    113:        }
                    114: 
                    115:     } else
                    116:        err = noErr;
                    117: 
                    118:     return( err);
                    119: }
                    120: 
                    121: - getResources
                    122: {
                    123:     [super getResources];
                    124: 
                    125:     [[self parent] getSlotName:self index:deviceNum];
                    126: 
                    127:     return( self);
                    128: }
                    129: 
                    130: - (IOReturn) configReadLong:(UInt32)offset value:(UInt32 *)value
                    131: {
                    132:     return( [[self parent] configReadLong:self offset:offset value:value] );
                    133: }
                    134: 
                    135: - (IOReturn) configWriteLong:(UInt32)offset value:(UInt32)value
                    136: {
                    137:     return( [[self parent] configWriteLong:self offset:offset value:value] );
                    138: }
                    139: 
                    140: - (LogicalAddress) getIOAperture
                    141: {
                    142:     return( [[self parent] getIOAperture] );
                    143: }
                    144: 
                    145: - getLocation:(UInt8 *)bus device:(UInt8 *)device function:(UInt8 *)function
                    146: {
                    147:     *bus       = busNum;
                    148:     *device    = deviceNum;
                    149:     *function  = functionNum;
                    150:     return( self);
                    151: }
                    152: 
                    153: 
                    154: - property_IODeviceType:(char *)types length:(unsigned int *)maxLen
                    155: {
                    156:     [super property_IODeviceType:types length:maxLen];
                    157:     strcat( types, " "IOTypePCI);
                    158:     return( self);
                    159: }
                    160: 
                    161: @end
                    162: 
                    163: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.