]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Drivers/platform/drvAppleMacIO/AppleMacIO.cpp
xnu-792.6.56.tar.gz
[apple/xnu.git] / iokit / Drivers / platform / drvAppleMacIO / AppleMacIO.cpp
index 5242a6fd6e35c499e6882351aa2d30df2ffbb304..974bf94fae4bab8596f573d9b33f09b6d78cd5f2 100644 (file)
@@ -3,8 +3,6 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
- * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
@@ -267,19 +265,30 @@ OSMetaClassDefineReservedUnused(AppleMacIODevice,  3);
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 bool AppleMacIODevice::compareName( OSString * name,
-                                       OSString ** matched = 0 ) const
+                                       OSString ** matched ) const
 {
-    return( ((AppleMacIO *)getProvider())->
-               compareNubName( this, name, matched ));
+  return (IODTCompareNubName(this, name, matched) ||
+         IORegistryEntry::compareName(name, matched));
 }
 
 IOService * AppleMacIODevice::matchLocation( IOService * /* client */ )
 {
-      return( this );
+  return this;
 }
 
 IOReturn AppleMacIODevice::getResources( void )
 {
-    return( ((AppleMacIO *)getProvider())->getNubResources( this ));
+  IOService *macIO = this;
+  
+  if (getDeviceMemory() != 0) return kIOReturnSuccess;
+  
+  while (macIO && ((macIO = macIO->getProvider()) != 0))
+    if (strcmp("mac-io", macIO->getName()) == 0) break;
+  
+  if (macIO == 0) return kIOReturnError;
+  
+  IODTResolveAddressing(this, "reg", macIO->getDeviceMemoryWithIndex(0));
+  
+  return kIOReturnSuccess;
 }