| @@ -1,24 +1,24 @@ | | | @@ -1,24 +1,24 @@ |
1 | /* $NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $ */ | | 1 | /* $NetBSD: intel_acpi.c,v 1.5 2022/02/27 14:19:35 riastradh Exp $ */ |
2 | | | 2 | |
3 | // SPDX-License-Identifier: GPL-2.0 | | 3 | // SPDX-License-Identifier: GPL-2.0 |
4 | /* | | 4 | /* |
5 | * Intel ACPI functions | | 5 | * Intel ACPI functions |
6 | * | | 6 | * |
7 | * _DSM related code stolen from nouveau_acpi.c. | | 7 | * _DSM related code stolen from nouveau_acpi.c. |
8 | */ | | 8 | */ |
9 | | | 9 | |
10 | #include <sys/cdefs.h> | | 10 | #include <sys/cdefs.h> |
11 | __KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $"); | | 11 | __KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.5 2022/02/27 14:19:35 riastradh Exp $"); |
12 | | | 12 | |
13 | #include <linux/pci.h> | | 13 | #include <linux/pci.h> |
14 | #include <linux/acpi.h> | | 14 | #include <linux/acpi.h> |
15 | | | 15 | |
16 | #include "i915_drv.h" | | 16 | #include "i915_drv.h" |
17 | #include "intel_acpi.h" | | 17 | #include "intel_acpi.h" |
18 | | | 18 | |
19 | #ifdef __NetBSD__ | | 19 | #ifdef __NetBSD__ |
20 | | | 20 | |
21 | #include <dev/acpi/acpireg.h> | | 21 | #include <dev/acpi/acpireg.h> |
22 | #define _COMPONENT ACPI_BUTTON_COMPONENT | | 22 | #define _COMPONENT ACPI_BUTTON_COMPONENT |
23 | ACPI_MODULE_NAME("acpi_intel_brightness") | | 23 | ACPI_MODULE_NAME("acpi_intel_brightness") |
24 | | | 24 | |
| @@ -258,28 +258,29 @@ static ACPI_HANDLE intel_dsm_handle; | | | @@ -258,28 +258,29 @@ static ACPI_HANDLE intel_dsm_handle; |
258 | (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \ | | 258 | (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \ |
259 | PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \ | | 259 | PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \ |
260 | (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \ | | 260 | (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \ |
261 | PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0) | | 261 | PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0) |
262 | | | 262 | |
263 | static int | | 263 | static int |
264 | intel_dsm_vga_match(const struct pci_attach_args *pa) | | 264 | intel_dsm_vga_match(const struct pci_attach_args *pa) |
265 | { | | 265 | { |
266 | | | 266 | |
267 | if (!DEVICE_IS_VGA_PCI(pa->pa_class, pa->pa_id)) | | 267 | if (!DEVICE_IS_VGA_PCI(pa->pa_class, pa->pa_id)) |
268 | return 0; | | 268 | return 0; |
269 | | | 269 | |
270 | vga_count++; | | 270 | vga_count++; |
271 | struct acpi_devnode *node = acpi_pcidev_find(0 /*XXX segment*/, | | 271 | struct acpi_devnode *node = |
272 | pa->pa_bus, pa->pa_device, pa->pa_function); | | 272 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), |
| | | 273 | pa->pa_bus, pa->pa_device, pa->pa_function); |
273 | if (node != NULL && intel_dsm_handle == NULL) | | 274 | if (node != NULL && intel_dsm_handle == NULL) |
274 | intel_dsm_handle = intel_dsm_pci_probe(node->ad_handle); | | 275 | intel_dsm_handle = intel_dsm_pci_probe(node->ad_handle); |
275 | return 0; | | 276 | return 0; |
276 | } | | 277 | } |
277 | | | 278 | |
278 | static bool intel_dsm_detect(struct drm_device *dev) | | 279 | static bool intel_dsm_detect(struct drm_device *dev) |
279 | { | | 280 | { |
280 | char acpi_method_name[255] = { 0 }; | | 281 | char acpi_method_name[255] = { 0 }; |
281 | | | 282 | |
282 | vga_count = 0; | | 283 | vga_count = 0; |
283 | pci_find_device(&dev->pdev->pd_pa, intel_dsm_vga_match); | | 284 | pci_find_device(&dev->pdev->pd_pa, intel_dsm_vga_match); |
284 | | | 285 | |
285 | if (vga_count == 2 && intel_dsm_handle) { | | 286 | if (vga_count == 2 && intel_dsm_handle) { |