During _OSC negotiation, when the 'Control' DWORD is needed from the result buffer after running _OSC, a couple of places performed manual pointer arithmetic to offset into the right spot in the raw buffer. Add a acpi_osc_ctx_get_pci_control() helper to use the #define'd DWORD offsets to fetch the DWORDs needed from @acpi_osc_context, and replace the above instances of the open-coded arithmetic.
Showing the changes to include (1 of 3 files). Show all
Unified · Split
| @@ -608,6 +608,13 @@ extern u32 osc_sb_native_usb4_control; · 607 unmodified lines | ||
| 608 | 608 | #define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020 |
| 609 | 609 | #define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080 |
| 610 | 610 | |
| 611 | +static inline u32 acpi_osc_ctx_get_pci_control(struct acpi_osc_context *context) | |
| 612 | +{ | |
| 613 | + u32 *ret = context->ret.pointer; | |
| 614 | + | |
| 615 | + return ret[OSC_CONTROL_DWORD]; | |
| 616 | +} | |
| 617 | + | |
| 611 | 618 | #define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002 |
| 612 | 619 | #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004 |
| 613 | 620 | #define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006 |
| @@ -1004,6 +1011,12 @@ static inline int acpi_register_wakeup_handler(int wake_irq, · 390 unmodified lines | ||
| 1004 | 1011 | static inline void acpi_unregister_wakeup_handler( |
| 1005 | 1012 | bool (*wakeup)(void *context), void *context) { } |
| 1006 | 1013 | |
| 1014 | +struct acpi_osc_context; | |
| 1015 | +static inline u32 acpi_osc_ctx_get_pci_control(struct acpi_osc_context *context) | |
| 1016 | +{ | |
| 1017 | + return 0; | |
| 1018 | +} | |
| 1019 | + | |
| 1007 | 1020 | #endif /* !CONFIG_ACPI */ |
| 1008 | 1021 | |
| 1009 | 1022 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC |