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
608#define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020608#define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020
609#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080609#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080
610 610
611static 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#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002618#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
612#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004619#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
613#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006620#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
@@ -1004,6 +1011,12 @@ static inline int acpi_register_wakeup_handler(int wake_irq, · 390 unmodified lines
1004static inline void acpi_unregister_wakeup_handler(1011static inline void acpi_unregister_wakeup_handler(
1005 bool (*wakeup)(void *context), void *context) { }1012 bool (*wakeup)(void *context), void *context) { }
1006 1013
1014struct acpi_osc_context;
1015static inline u32 acpi_osc_ctx_get_pci_control(struct acpi_osc_context *context)
1016{
1017 return 0;
1018}
1019
1007#endif /* !CONFIG_ACPI */1020#endif /* !CONFIG_ACPI */
1008 1021
1009#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC1022#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