2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
28 #include <IOKit/system.h>
30 #include <architecture/i386/kernBootStruct.h>
32 #include <IOKit/IORegistryEntry.h>
33 #include <libkern/c++/OSContainers.h>
34 #include <IOKit/IOLib.h>
35 #include <libkern/c++/OSUnserialize.h>
37 #include "AppleI386PlatformExpert.h"
39 #include <IOKit/assert.h>
41 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
43 #define super IOPlatformExpert
45 OSSymbol
* gIntelPICName
;
47 OSDefineMetaClassAndStructors(AppleI386PlatformExpert
, IOPlatformExpert
)
49 IOService
* AppleI386PlatformExpert::probe(IOService
* /* provider */,
57 bool AppleI386PlatformExpert::start(IOService
* provider
)
59 gIntelPICName
= (OSSymbol
*) OSSymbol::withCStringNoCopy("intel-pic");
61 // setupPIC(provider);
63 if (!super::start(provider
))
69 IOService
* AppleI386PlatformExpert::createNub(OSDictionary
* from
)
73 KERNBOOTSTRUCT
* bootStruct
;
75 nub
= super::createNub(from
);
79 if (0 == strcmp( "pci", nub
->getName()))
81 bootStruct
= (KERNBOOTSTRUCT
*) PE_state
.bootArgs
;
82 prop
= OSData::withBytesNoCopy(&bootStruct
->pciInfo
,
83 sizeof(bootStruct
->pciInfo
));
86 from
->setObject( "pci-bus-info", prop
);
88 else if (0 != strcmp("intel-pic", nub
->getName()))
97 #define kNumVectors 16
100 AppleI386PlatformExpert::setupPIC(IOService
*nub
)
103 OSDictionary
* propTable
;
104 OSArray
* controller
;
109 propTable
= nub
->getPropertyTable();
112 // For the moment.. assume a classic 8259 interrupt controller
113 // with 16 interrupts.
115 // Later, this will be changed to detect a APIC and/or MP-Table
116 // and then will set the nubs appropriately.
118 // Create the interrupt specifer array.
119 specifier
= OSArray::withCapacity(kNumVectors
);
121 for (i
= 0; i
< kNumVectors
; i
++) {
123 tmpData
= OSData::withBytes(&tmpLong
, sizeof(tmpLong
));
124 specifier
->setObject(tmpData
);
127 // Create the interrupt controller array.
128 controller
= OSArray::withCapacity(kNumVectors
);
130 for (i
= 0; i
< kNumVectors
; i
++)
131 controller
->setObject(gIntelPICName
);
133 // Put the two arrays into the property table.
134 propTable
->setObject(gIOInterruptControllersKey
, controller
);
135 propTable
->setObject(gIOInterruptSpecifiersKey
, specifier
);
137 // Release the arrays after being added to the property table.
138 specifier
->release();
139 controller
->release();
143 AppleI386PlatformExpert::matchNubWithPropertyTable(IOService
* nub
,
144 OSDictionary
* propTable
)
149 if (0 == (nameProp
= (OSString
*) nub
->getProperty(gIONameKey
)))
152 if ( 0 == (match
= (OSString
*) propTable
->getObject(gIONameMatchKey
)))
155 return (match
->isEqualTo( nameProp
));
158 bool AppleI386PlatformExpert::getMachineName( char * name
, int maxLength
)
160 strncpy( name
, "x86", maxLength
);
165 bool AppleI386PlatformExpert::getModelName( char * name
, int maxLength
)
167 strncpy( name
, "x86", maxLength
);