Skip to content

Instantly share code, notes, and snippets.

#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;
from argparse import ArgumentParser
from typing import Any
def ParseArgs():
parser = ArgumentParser()
parser.add_argument('-i', dest="UefiPlatPath", required=True)
return parser.parse_args()
class MemoryDescriptor:
def __init__(self, name, space, base, size, hob_option, resource_attribute, arm_attribute, resource_type, cache_type):
def TuneDataPatch(data, value1, value2):
movInstruction = 0x52800002
instr1 = movInstruction | (value1 << 5)
instr2 = movInstruction | (value2 << 5)
loc = data.find(instr1.to_bytes(4, byteorder='little'))
if loc < 0 or loc % 4 != 0:
return data
print("Patching tune data at 0x{:08x}".format(loc))
@N1kroks
N1kroks / spmi.c
Last active November 4, 2024 15:14
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/UefiBootServicesTableLib.h>
#define CORE 0x0c440000
#define OBSRVR 0x0e600000
#define PMIC_USID 4 // PM6150L GPIO USID
#define PMIC_GPIO_BASE 0xC000 // PM6150L GPIO address
#define VOL_UP_GPIO 2