Skip to content

Commit

Permalink
Added support for VMware device scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Jan 27, 2019
1 parent 5f147cf commit 9d50e55
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Lilu Changelog
==============
#### v1.3.3
- Added support for modern AMD device scanning by @AlGreyy
- Added support for VMware device scanning

#### v1.3.2
- Extended supported firmware vendor list
Expand Down
5 changes: 3 additions & 2 deletions Lilu/Headers/kern_iokit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ namespace WIOKit {
enum : uint16_t {
ATIAMD = 0x1002,
AMDZEN = 0x1022,
NVIDIA = 0x10de,
Intel = 0x8086
NVIDIA = 0x10DE,
Intel = 0x8086,
VMware = 0x15AD
};
};

Expand Down
26 changes: 15 additions & 11 deletions Lilu/Sources/kern_devinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ void DeviceInfo::grabDevicesFromPciRoot(IORegistryEntry *pciRoot) {
// Strip interface, as we only care about class and subclass
code &= WIOKit::ClassCode::PCISubclassMask;

if (!gotVendor || !gotClass || (vendor != WIOKit::VendorID::Intel && vendor != WIOKit::VendorID::ATIAMD && vendor != WIOKit::VendorID::AMDZEN))
if (!gotVendor || !gotClass || (vendor != WIOKit::VendorID::Intel && vendor != WIOKit::VendorID::ATIAMD &&
vendor != WIOKit::VendorID::AMDZEN && vendor != WIOKit::VendorID::VMware))
continue;

if (vendor == WIOKit::VendorID::Intel && (code == WIOKit::ClassCode::DisplayController || code == WIOKit::ClassCode::VGAController)) {
Expand Down Expand Up @@ -272,24 +273,27 @@ void DeviceInfo::grabDevicesFromPciRoot(IORegistryEntry *pciRoot) {
safeString(pciobj->getName()), safeString(name), pcivendor);
v.video = pciobj;
v.vendor = pcivendor;
} else if (pcicode == WIOKit::ClassCode::HDADevice && pcivendor != WIOKit::VendorID::AMDZEN) {
DBGLOG("dev", "found HDAU device %s at %s by %04X",
safeString(pciobj->getName()), safeString(name), pcivendor);
v.audio = pciobj;
} else if (pcicode == WIOKit::ClassCode::HDADevice) {
// On modern AMD platforms built-in audio devices sits on a PCI bridge just any other device.
// Luckily it has a distinct device-id for the time being.
DBGLOG("dev", "found AMD HDEF device %s at %s by %04X",
DBGLOG("dev", "found audio device %s at %s by %04X",
safeString(pciobj->getName()), safeString(name), pcivendor);
audioBuiltinAnalog = pciobj;
v.audio = pciobj;
}
}
}

pciiterator->release();

if (v.video && !videoExternal.push_back(v))
SYSLOG("dev", "failed to push video gpu");
if (v.video) {
DBGLOG_COND(v.audio, "dev", "marking audio device as HDAU at %s", safeString(v.audio->getName()));
if (!videoExternal.push_back(v))
SYSLOG("dev", "failed to push video gpu");
} else if (v.audio && !audioBuiltinAnalog) {
// On modern AMD platforms or VMware built-in audio devices sits on a PCI bridge just any other device.
// On AMD it has a distinct Ryzen device-id for the time being, yet on VMware it is just Intel.
// To distinguish the devices we use audio card presence as a marker.
DBGLOG("dev", "marking audio device as HDEF at %s", safeString(v.audio->getName()));
audioBuiltinAnalog = v.audio;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Lilu/Sources/kern_patcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ void KernelPatcher::onKextSummariesUpdated() {
}
if (that->khandlers.size() > 0) {
OSKextLoadedKextSummary &last = (*that->loadedKextSummaries)->summaries[num-1];
DBGLOG("patcher", "last kext is %llX and its name is %.*s", last.address, KMOD_MAX_NAME, last.name);
DBGLOG("patcher", "last kext is " PRIKADDR " and its name is %.*s", CASTKADDR(last.address), KMOD_MAX_NAME, last.name);
// We may add khandlers items inside the handler
for (size_t i = 0; i < that->khandlers.size(); i++) {
auto handler = that->khandlers[i];
Expand Down

0 comments on commit 9d50e55

Please sign in to comment.