static void patch_pcihp(int slot, uint8_t *ssdt_ptr, uint32_t eject)

{

    ssdt_ptr[ACPI_PCIHP_OFFSET_HEX] = acpi_get_hex(slot >> 4);

    ssdt_ptr[ACPI_PCIHP_OFFSET_HEX + 1] = acpi_get_hex(slot);

    ssdt_ptr[ACPI_PCIHP_OFFSET_ID] = slot;

    ssdt_ptr[ACPI_PCIHP_OFFSET_ADR + 2] = slot;



    /* Runtime patching of ACPI_EJ0: to disable hotplug for a slot,

     * replace the method name: _EJ0 by ACPI_EJ0_.

     */

    /* Sanity check */

    assert(!memcmp(ssdt_ptr + ACPI_PCIHP_OFFSET_EJ0, "_EJ0", 4));



    if (!eject) {

        memcpy(ssdt_ptr + ACPI_PCIHP_OFFSET_EJ0, "EJ0_", 4);

    }

}

static void patch_pcihp(int slot, uint8_t *ssdt_ptr, uint32_t eject)

{

    ssdt_ptr[ACPI_PCIHP_OFFSET_HEX] = acpi_get_hex(slot >> 4);

    ssdt_ptr[ACPI_PCIHP_OFFSET_HEX + 1] = acpi_get_hex(slot);

    ssdt_ptr[ACPI_PCIHP_OFFSET_ID] = slot;

    ssdt_ptr[ACPI_PCIHP_OFFSET_ADR + 2] = slot;



    





    

    assert(!memcmp(ssdt_ptr + ACPI_PCIHP_OFFSET_EJ0, "_EJ0", 4));



    if (!eject) {

        memcpy(ssdt_ptr + ACPI_PCIHP_OFFSET_EJ0, "EJ0_", 4);

    }

}

static void FUNC_0(int VAR_0, uint8_t *VAR_1, uint32_t VAR_2)

{

    VAR_1[ACPI_PCIHP_OFFSET_HEX] = acpi_get_hex(VAR_0 >> 4);

    VAR_1[ACPI_PCIHP_OFFSET_HEX + 1] = acpi_get_hex(VAR_0);

    VAR_1[ACPI_PCIHP_OFFSET_ID] = VAR_0;

    VAR_1[ACPI_PCIHP_OFFSET_ADR + 2] = VAR_0;



    





    

    assert(!memcmp(VAR_1 + ACPI_PCIHP_OFFSET_EJ0, "_EJ0", 4));



    if (!VAR_2) {

        memcpy(VAR_1 + ACPI_PCIHP_OFFSET_EJ0, "EJ0_", 4);

    }

}

static void FUNC_0(int VAR_0, uint8_t *VAR_1, uint32_t VAR_2)
{ VAR_1[ACPI_PCIHP_OFFSET_HEX] = acpi_get_hex(VAR_0 >> 4); VAR_1[ACPI_PCIHP_OFFSET_HEX + 1] = acpi_get_hex(VAR_0); VAR_1[ACPI_PCIHP_OFFSET_ID] = VAR_0; VAR_1[ACPI_PCIHP_OFFSET_ADR + 2] = VAR_0; assert(!memcmp(VAR_1 + ACPI_PCIHP_OFFSET_EJ0, "_EJ0", 4)); if (!VAR_2) { memcpy(VAR_1 + ACPI_PCIHP_OFFSET_EJ0, "EJ0_", 4); } }