MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / findPciRoot

Function findPciRoot

rEFIt_UEFI/Platform/FixBiosDsdt.cpp:1663–1706  ·  view source on GitHub ↗

Find PCIRootUID and all need Fix Device

Source from the content-addressed store, hash-verified

1661
1662// Find PCIRootUID and all need Fix Device
1663VOID findPciRoot (UINT8 *dsdt, UINT32 len)
1664{
1665 UINTN j;
1666 UINT32 PCIADR, PCISIZE = 0;
1667
1668 //initialising
1669 NetworkName = FALSE;
1670 DisplayName1 = FALSE;
1671 DisplayName2 = FALSE;
1672 FirewireName = FALSE;
1673 ArptName = FALSE;
1674 XhciName = FALSE;
1675
1676 PCIADR = GetPciDevice(dsdt, len);
1677 if (PCIADR) {
1678 PCISIZE = get_size(dsdt, PCIADR);
1679 }
1680 //sample
1681 /*
1682 5B 82 8A F1 05 50 43 49 30 Device (PCI0) {
1683 08 5F 48 49 44 0C 41 D0 0A 08 Name (_HID, EisaId ("PNP0A08"))
1684 08 5F 43 49 44 0C 41 D0 0A 03 Name (_CID, EisaId ("PNP0A03"))
1685 08 5F 41 44 52 00 Name (_ADR, Zero)
1686 14 09 5E 42 4E 30 30 00 A4 00 Method (^BN00, 0, NotSerialized) {Return (Zero)}
1687 14 0B 5F 42 42 4E 00 A4 42 4E 30 30 Method (_BBN, 0, NotSerialized) {Return (BN00 ())}
1688 08 5F 55 49 44 00 Name (_UID, Zero)
1689 14 16 5F 50 52 54 00 Method (_PRT, 0, NotSerialized)
1690 */
1691 if (PCISIZE > 0) {
1692 // find PCIRootUID
1693 for (j=PCIADR; j<PCIADR+64; j++) {
1694 if (dsdt[j] == '_' && dsdt[j+1] == 'U' && dsdt[j+2] == 'I' && dsdt[j+3] == 'D') {
1695 // Slice - I want to set root to zero instead of keeping original value
1696 if (dsdt[j+4] == 0x0A)
1697 dsdt[j+5] = 0; //AML_BYTE_PREFIX followed by a number
1698 else
1699 dsdt[j+4] = 0; //any other will be considered as ONE or WRONG, replace to ZERO
1700 break;
1701 }
1702 }
1703 } else {
1704 MsgLog("Warning! PCI root is not found!");
1705 }
1706}
1707
1708
1709// read device name, replace to ADP1

Callers 1

FixBiosDsdtFunction · 0.85

Calls 2

GetPciDeviceFunction · 0.85
get_sizeFunction · 0.85

Tested by

no test coverage detected