intellicrack.providers.gpu_pci_resources

Windows PnP PCI resource enumeration for GPU BAR detection.

Uses cfgmgr32.dll (CM_Locate_DevNodeW, CM_Get_First_Log_Conf, CM_Get_Next_Res_Des, CM_Get_Res_Des_Data) to walk the allocated resource descriptors of a GPU PnP device and read the actual MEM_LARGE (64-bit prefetchable) BAR sizes that Windows allocated to the device.

This is the canonical user-space, no-admin Windows mechanism for inspecting the resized PCI BAR. Win32_DeviceMemoryAddress only reports legacy 32-bit MMIO ranges, so it cannot distinguish ReBAR-enabled (multi-GB BAR) from ReBAR-disabled (256 MB cap) on Intel Arc, AMD Radeon, or NVIDIA discrete GPUs.

Reference: cfgmgr32.h and cfg.h (Windows SDK), MEM_DES / MEM_LARGE_RESOURCE layouts.

enumerate_pci_memory_bars(device_id)[source]

Enumerate every allocated memory BAR for a PnP PCI device.

Reads the ALLOC_LOG_CONF resource list, which reflects the configuration Windows actually allocated to the device after firmware / PnP arbitration (i.e. the post-ReBAR-resize values when ReBAR is enabled).

Parameters:

device_id (str) – PnP device instance ID, e.g. PCI\VEN_8086&DEV_E20B&SUBSYS_A003207E&REV_00\6&128604AE&0&00080008.

Returns:

All MEM and MEM_LARGE BARs for the device. Empty when the device is not present, cfgmgr32 cannot be loaded, or the platform is not Windows.

Return type:

list[_BarDescriptor]

max_memory_bar_bytes(device_id)[source]

Return the size (bytes) of the largest allocated memory BAR for a device.

Parameters:

device_id (str) – PnP device instance ID.

Returns:

Largest BAR size in bytes (across both 32-bit MEM and 64-bit MEM_LARGE allocations). Zero when no BARs are reported.

Return type:

int