diff --git a/EmeraldSDHC/EmeraldSDHC.cpp b/EmeraldSDHC/EmeraldSDHC.cpp index b72c50d..2b46724 100644 --- a/EmeraldSDHC/EmeraldSDHC.cpp +++ b/EmeraldSDHC/EmeraldSDHC.cpp @@ -24,14 +24,14 @@ bool EmeraldSDHC::start(IOService *provider) { do { // - // Get IOPCIDevice provider. + // Get IOPCIDevice or IOACPIPlatformDevice provider. // - _pciDevice = OSDynamicCast(IOPCIDevice, provider); - if (_pciDevice == nullptr) { - EMSYSLOG("Provider is not IOPCIDevice"); + if (!OSDynamicCast(IOACPIPlatformDevice, provider) && !OSDynamicCast(IOPCIDevice, provider)) { + EMSYSLOG("Provider is not IOPCIDevice or IOACPIPlatformDevice"); break; } - _pciDevice->retain(); + _device = provider; + _device->retain(); // // Create work loop and interrupt source. @@ -81,7 +81,8 @@ void EmeraldSDHC::stop(IOService *provider) { } OSSafeReleaseNULL(_workLoop); - OSSafeReleaseNULL(_pciDevice); + IOPCIDevice *pciDevice = OSDynamicCast(IOPCIDevice, _device); + OSSafeReleaseNULL(pciDevice); } IOWorkLoop* EmeraldSDHC::getWorkLoop() const { @@ -106,7 +107,7 @@ bool EmeraldSDHC::probeCardSlots() { // Get number of active card slots. // Each card slot will have exactly one BAR on the PCI device, for a maximum of 6. // - _cardSlotCount = _pciDevice->getDeviceMemoryCount(); + _cardSlotCount = _device->getDeviceMemoryCount(); if (_cardSlotCount > kSDHCMaximumSlotCount) { EMSYSLOG("More than %u card slots are present, limiting to %u", kSDHCMaximumSlotCount, kSDHCMaximumSlotCount); _cardSlotCount = kSDHCMaximumSlotCount; @@ -132,7 +133,7 @@ bool EmeraldSDHC::probeCardSlots() { // // Map memory for card slot. // - _cardSlotMemoryMaps[slot] = _pciDevice->mapDeviceMemoryWithIndex(slot); + _cardSlotMemoryMaps[slot] = _device->mapDeviceMemoryWithIndex(slot); if (_cardSlotMemoryMaps[slot] == nullptr) { EMSYSLOG("Failed to get memory map for card slot %u", slot + 1); return false; diff --git a/EmeraldSDHC/EmeraldSDHC.hpp b/EmeraldSDHC/EmeraldSDHC.hpp index cd0d172..9068187 100644 --- a/EmeraldSDHC/EmeraldSDHC.hpp +++ b/EmeraldSDHC/EmeraldSDHC.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "SDMisc.hpp" #include "SDRegs.hpp" @@ -25,7 +26,7 @@ class EmeraldSDHC : public IOService { typedef IOService super; private: - IOPCIDevice *_pciDevice = nullptr; + IOService *_device = nullptr; IOWorkLoop *_workLoop = nullptr; IOInterruptEventSource *_intEventSource = nullptr; diff --git a/EmeraldSDHC/Info.plist b/EmeraldSDHC/Info.plist index 5e0f73f..3151da8 100644 --- a/EmeraldSDHC/Info.plist +++ b/EmeraldSDHC/Info.plist @@ -49,6 +49,26 @@ IOProviderClass EmeraldSDHCSlot + EmeraldSDHC ACPI + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + IOClass + EmeraldSDHC + IONameMatch + PNP0D40 + IOProbeScore + 1000 + IOProviderClass + IOACPIPlatformDevice + Protocol Characteristics + + Physical Interconnect + Secure Digital + Physical Interconnect Location + Internal + + NSHumanReadableCopyright Copyright © 2021-2023 Goldfish64. All rights reserved. @@ -56,6 +76,8 @@ $(CURRENT_PROJECT_VERSION) OSBundleLibraries + com.apple.iokit.IOACPIFamily + 1.0 com.apple.iokit.IOPCIFamily 1.0 com.apple.iokit.IOStorageFamily