* HISTORY
*/
-#include <IOKit/system.h>
-#include <IOKit/IOPlatformExpert.h>
#include <IOKit/IOCPU.h>
#include <IOKit/IODeviceTreeSupport.h>
-#include <IOKit/IORangeAllocator.h>
-#include <IOKit/IONVRAM.h>
#include <IOKit/IOKitDebug.h>
+#include <IOKit/IOMapper.h>
+#include <IOKit/IOMessage.h>
+#include <IOKit/IONVRAM.h>
+#include <IOKit/IOPlatformExpert.h>
+#include <IOKit/IORangeAllocator.h>
#include <IOKit/IOWorkLoop.h>
#include <IOKit/pwr_mgt/RootDomain.h>
-#include <IOKit/IOMessage.h>
+#include <IOKit/IOKitKeys.h>
+
+#include <IOKit/system.h>
+
#include <libkern/c++/OSContainers.h>
OSMetaClassDefineReservedUsed(IOPlatformExpert, 0);
-OSMetaClassDefineReservedUnused(IOPlatformExpert, 1);
+OSMetaClassDefineReservedUsed(IOPlatformExpert, 1);
OSMetaClassDefineReservedUnused(IOPlatformExpert, 2);
OSMetaClassDefineReservedUnused(IOPlatformExpert, 3);
OSMetaClassDefineReservedUnused(IOPlatformExpert, 4);
if (!super::start(provider))
return false;
+
+ // Register the presence or lack thereof a system
+ // PCI address mapper with the IOMapper class
+
+#if 1
+ IORegistryEntry * regEntry = IORegistryEntry::fromPath("/u3/dart", gIODTPlane);
+ if (!regEntry)
+ regEntry = IORegistryEntry::fromPath("/dart", gIODTPlane);
+ if (regEntry) {
+ int debugFlags;
+ if (!PE_parse_boot_arg("dart", &debugFlags) || debugFlags)
+ setProperty(kIOPlatformMapperPresentKey, kOSBooleanTrue);
+ regEntry->release();
+ }
+#endif
+
+ IOMapper::setMapperRequired(0 != getProperty(kIOPlatformMapperPresentKey));
gIOInterruptControllers = OSDictionary::withCapacity(1);
gIOInterruptControllersLock = IOLockAlloc();
PMInstantiatePowerDomains();
+ // Parse the serial-number data and publish a user-readable string
+ OSData* mydata = (OSData*) (provider->getProperty("serial-number"));
+ if (mydata != NULL) {
+ OSString *serNoString = createSystemSerialNumberString(mydata);
+ if (serNoString != NULL) {
+ provider->setProperty(kIOPlatformSerialNumberKey, serNoString);
+ serNoString->release();
+ }
+ }
+
return( configure(provider) );
}
}
bool IOPlatformExpert::compareNubName( const IOService * nub,
- OSString * name, OSString ** matched = 0 ) const
+ OSString * name, OSString ** matched ) const
{
return( nub->IORegistryEntry::compareName( name, matched ));
}
return( false );
}
+OSString* IOPlatformExpert::createSystemSerialNumberString(OSData* myProperty)
+{
+ return NULL;
+}
+
IORangeAllocator * IOPlatformExpert::getPhysicalRangeAllocator(void)
{
return(OSDynamicCast(IORangeAllocator,
return lengthSaved;
}
+OSString* IODTPlatformExpert::createSystemSerialNumberString(OSData* myProperty) {
+ UInt8* serialNumber;
+ unsigned int serialNumberSize;
+ short pos = 0;
+ char* temp;
+ char SerialNo[30];
+
+ if (myProperty != NULL) {
+ serialNumberSize = myProperty->getLength();
+ serialNumber = (UInt8*)(myProperty->getBytesNoCopy());
+ temp = serialNumber;
+ if (serialNumberSize > 0) {
+ // check to see if this is a CTO serial number...
+ while (pos < serialNumberSize && temp[pos] != '-') pos++;
+
+ if (pos < serialNumberSize) { // there was a hyphen, so it's a CTO serial number
+ memcpy(SerialNo, serialNumber + 12, 8);
+ memcpy(&SerialNo[8], serialNumber, 3);
+ SerialNo[11] = '-';
+ memcpy(&SerialNo[12], serialNumber + 3, 8);
+ SerialNo[20] = 0;
+ } else { // just a normal serial number
+ memcpy(SerialNo, serialNumber + 13, 8);
+ memcpy(&SerialNo[8], serialNumber, 3);
+ SerialNo[11] = 0;
+ }
+ return OSString::withCString(SerialNo);
+ }
+ }
+ return NULL;
+}
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#undef super
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool IOPlatformExpertDevice::compareName( OSString * name,
- OSString ** matched = 0 ) const
+ OSString ** matched ) const
{
return( IODTCompareNubName( this, name, matched ));
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool IOPlatformDevice::compareName( OSString * name,
- OSString ** matched = 0 ) const
+ OSString ** matched ) const
{
return( ((IOPlatformExpert *)getProvider())->
compareNubName( this, name, matched ));