History

PCI/ACPI: add a helper for retrieving _OSC Control DWORDs

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.

Vishal Verma committed 4 years ago

Commit cc10eee1 parent 35e01663 files · +15 −2Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/acpi.h+13−0
@@ -608,6 +608,13 @@ extern u32 osc_sb_native_usb4_control; · 607 unmodified lines
608608 #define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020
609609 #define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080
610610
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+
611618 #define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
612619 #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
613620 #define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
@@ -1004,6 +1011,12 @@ static inline int acpi_register_wakeup_handler(int wake_irq, · 390 unmodified lines
10041011 static inline void acpi_unregister_wakeup_handler(
10051012 bool (*wakeup)(void *context), void *context) { }
10061013
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+
10071020 #endif /* !CONFIG_ACPI */
10081021
10091022 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t