diff --git a/QualcommWifi/QualcommWifi.cpp b/QualcommWifi/QualcommWifi.cpp index 36f945d..abd7a6d 100644 --- a/QualcommWifi/QualcommWifi.cpp +++ b/QualcommWifi/QualcommWifi.cpp @@ -532,7 +532,8 @@ bool QualcommWifi::start(IOService *provider) { } UInt16 pciCommand = fPciDevice->configRead16(kIOPCIConfigCommand); - pciCommand |= (kIOPCICommandMemorySpace | kIOPCICommandBusMaster); + pciCommand |= kIOPCICommandMemorySpace; + pciCommand &= ~kIOPCICommandBusMaster; // Protection absolue contre tout accès DMA non configuré sur AMD-Vi fPciDevice->configWrite16(kIOPCIConfigCommand, pciCommand); fBar0Map = fPciDevice->mapDeviceMemoryWithRegister(kIOPCIConfigBaseAddress0); @@ -543,15 +544,6 @@ bool QualcommWifi::start(IOService *provider) { } fBar0Virt = (volatile void *)fBar0Map->getVirtualAddress(); - UInt32 socHwVer = socRead32(TCSR_SOC_HW_VERSION); - UInt32 major = (socHwVer & TCSR_SOC_HW_VERSION_MAJOR_MASK) >> TCSR_SOC_HW_VERSION_MAJOR_SHIFT; - UInt32 minor = (socHwVer & TCSR_SOC_HW_VERSION_MINOR_MASK); - IOLog("QualcommWifi: WCN7850 HW v%u.%u detecte (0x%08x)\n", major, minor, socHwVer); - - setProperty("SoC_Version", socHwVer, 32); - setProperty("SoC_Major", major, 32); - setProperty("SoC_Minor", minor, 32); - UInt32 mhiStatus = read32(ATH12K_MHI_MHISTATUS); UInt32 mhiCtrl = read32(ATH12K_MHI_MHICTRL); UInt32 bhiOff = read32(ATH12K_MHI_BHIOFF); @@ -730,37 +722,8 @@ IOReturn QualcommWifi::getPOWER(IO80211SkywalkInterface *iface, apple80211_power IOReturn QualcommWifi::setPOWER(IO80211SkywalkInterface *iface, apple80211_power_data *pwr) { int val = (pwr && pwr->power_state[0]) ? 1 : 0; - if (val == 1 && !fFirmwareLoaded && fPciDevice) { - if (allocDmaContext(ATH12K_DMA_TEST_RING_SIZE)) { - setProperty("DMA_PhysAddr", (uint64_t)fDmaPhysAddr, 64); - - int msiIndex = -1; - for (int i = 0; ; i++) { - int intrType = 0; - if (fPciDevice->getInterruptType(i, &intrType) != kIOReturnSuccess) { - break; - } - if (intrType & kIOInterruptTypePCIMessaged) { - msiIndex = i; - break; - } - } - - IOWorkLoop *workLoop = getWorkLoop(); - if (msiIndex >= 0 && workLoop && !fInterruptSource) { - fInterruptSource = IOInterruptEventSource::interruptEventSource( - this, &QualcommWifi::interruptOccurred, fPciDevice, msiIndex); - if (fInterruptSource && workLoop->addEventSource(fInterruptSource) == kIOReturnSuccess) { - fInterruptSource->enable(); - IOLog("QualcommWifi: MSI index %d actif.\n", msiIndex); - } - } - - if (loadBhiFirmware()) { - fFirmwareLoaded = true; - } - } - } + fLinkActive = (val == 1); + IOLog("QualcommWifi: setPOWER invoqué par airportd (val=%d, fLinkActive=%d)\n", val, fLinkActive); return (IOReturn)handleApple80211Request(APPLE80211_IOC_POWER, val, pwr); } @@ -928,6 +891,10 @@ SInt32 QualcommWifi::handleApple80211Request(unsigned int req_type, int req_val, return 0; } case APPLE80211_IOC_SCAN_RESULT: { + if (req_data) { + *(void **)req_data = nullptr; + } + fScanInProgress = false; return 0; } case APPLE80211_IOC_POWER: {