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

Function AddPNLF

rEFIt_UEFI/Platform/FixBiosDsdt.cpp:1913–2087  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1911}
1912
1913UINT32 AddPNLF (UINT8 *dsdt, UINT32 len)
1914{
1915#if AUTO_PNLF
1916 EFI_STATUS Status;
1917 EFI_HANDLE *HandleBuffer = NULL;
1918 EFI_HANDLE Handle;
1919 EFI_PCI_IO_PROTOCOL *PciIo;
1920 PCI_TYPE00 Pci;
1921 UINTN HandleCount = 0;
1922 UINTN HandleIndex;
1923 UINTN Segment;
1924 UINTN Bus;
1925 UINTN Device;
1926 UINTN Function;
1927#endif
1928 UINT32 i; //, j, size;
1929 UINT32 adr = 0;
1930 DBG("Start PNLF Fix\n");
1931
1932 if (FindBin(dsdt, len, app2, 10) >= 0) {
1933 return len; //the device already exists
1934 }
1935 //search PWRB PNP0C0C
1936 for (i=0x20; len >= 6 && i < len - 6; i++) {
1937 if (CmpPNP(dsdt, i, 0x0C0C)) {
1938 DBG("found PWRB at %X\n", i);
1939 adr = devFind(dsdt, i);
1940 break;
1941 }
1942 }
1943 if (!adr) {
1944 //search battery
1945 DBG("not found PWRB, look BAT0\n");
1946 for (i=0x20; len >= 6 && i < len - 6; i++) {
1947 if (CmpPNP(dsdt, i, 0x0C0A)) {
1948 adr = devFind(dsdt, i);
1949 DBG("found BAT0 at %X\n", i);
1950 break;
1951 }
1952 }
1953 }
1954 if (!adr) {
1955 return len;
1956 }
1957
1958 //Slice - add custom UID
1959 if (gSettings.PNLF_UID != 0xFF) {
1960 ((CHAR8*)pnlf)[39] = gSettings.PNLF_UID;
1961 }
1962
1963 // _UID reworked by Sherlocks. 2018.10.08
1964 //Slice - it can't depends on video DeviceID. It is hardware ID of LCD screen.
1965#if AUTO_PNLF
1966 Status = gBS->LocateHandleBuffer (
1967 ByProtocol,
1968 &gEfiPciIoProtocolGuid,
1969 NULL,
1970 &HandleCount,

Callers 1

FixBiosDsdtFunction · 0.85

Calls 7

FindBinFunction · 0.85
CmpPNPFunction · 0.85
devFindFunction · 0.85
move_dataFunction · 0.85
CorrectOutersFunction · 0.85
CopyMemFunction · 0.50
ReadMethod · 0.45

Tested by

no test coverage detected