Created
February 10, 2024 14:20
-
-
Save N1kroks/6e1fc1c730a9a146ee8396f8a501b7b2 to your computer and use it in GitHub Desktop.
UsbHelper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Uefi.h> | |
#include <Library/UefiLib.h> | |
#include <Library/PcdLib.h> | |
#include <Library/DebugLib.h> | |
#include <Library/UefiDriverEntryPoint.h> | |
#include <Library/UefiBootServicesTableLib.h> | |
#include <Protocol/EFISPMI.h> | |
EFI_QCOM_SPMI_PROTOCOL *gSPMIProtocol; | |
EFI_STATUS | |
EFIAPI | |
Main ( | |
IN EFI_HANDLE ImageHandle, | |
IN EFI_SYSTEM_TABLE *SystemTable) | |
{ | |
EFI_STATUS Status; | |
UINT8 ByteWritten; | |
EFI_EVENT UsbPortStateChangeEvt; | |
Status = gBS->LocateProtocol (&gQcomSPMIProtocolGuid, NULL, (VOID *)&gSPMIProtocol); | |
if (EFI_ERROR (Status)) { | |
DEBUG ((EFI_D_ERROR, "Failed to Locate SPMI Protocol!\n")); | |
return Status; | |
} | |
Spmi_Result result = gSPMIProtocol->ReadModifyWriteLongByte(gSPMIProtocol, 0x02, SPMI_ACCESS_PRIORITY_HIGH, 0x1544, 0x00, 0x06, &ByteWritten); | |
if(result != SPMI_SUCCESS) { | |
DEBUG ((EFI_D_ERROR, "Failed to set drp mode error: 0x%X!\n", result)); | |
return Status; | |
} | |
return EFI_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment