drm: Set CONFIG_ACPI in linux/acpi.h and make it build. Leave a little ACPI-related functionality disabled for now, like getting EDID out of ACPI -- needs a bit more work to make this work, and I don't have hardware to work on that. Should help with failures of the forms: - unable to locate a BIOS ROM - bios: unable to locate usable image on various machines.diff -r1.30 -r1.31 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
(riastradh)
--- src/sys/external/bsd/drm2/amdgpu/files.amdgpu 2023/07/14 13:05:59 1.30
+++ src/sys/external/bsd/drm2/amdgpu/files.amdgpu 2024/04/16 14:34:01 1.31
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.amdgpu,v 1.30 2023/07/14 13:05:59 riastradh Exp $ | 1 | # $NetBSD: files.amdgpu,v 1.31 2024/04/16 14:34:01 riastradh Exp $ | |
2 | 2 | |||
3 | version 20180827 | 3 | version 20180827 | |
4 | 4 | |||
5 | define amdgpufbbus { } | 5 | define amdgpufbbus { } | |
6 | device amdgpu: drmkms, drmkms_pci, drmkms_sched, drmkms_ttm, amdgpufbbus, firmload | 6 | device amdgpu: drmkms, drmkms_pci, drmkms_sched, drmkms_ttm, amdgpufbbus, firmload | |
7 | attach amdgpu at pci | 7 | attach amdgpu at pci | |
8 | makeoptions amdgpu "CPPFLAGS.amdgpu"+="${CPPFLAGS.drmkms}" | 8 | makeoptions amdgpu "CPPFLAGS.amdgpu"+="${CPPFLAGS.drmkms}" | |
9 | 9 | |||
10 | defflag opt_amdgpu_cik.h AMDGPU_CIK | 10 | defflag opt_amdgpu_cik.h AMDGPU_CIK | |
11 | 11 | |||
12 | device amdgpufb: amdgpufbbus, drmfb, drmfb_pci, wsemuldisplaydev | 12 | device amdgpufb: amdgpufbbus, drmfb, drmfb_pci, wsemuldisplaydev | |
13 | attach amdgpufb at amdgpufbbus | 13 | attach amdgpufb at amdgpufbbus | |
14 | makeoptions amdgpufb "CPPFLAGS.amdgpufb"+="${CPPFLAGS.amdgpu}" | 14 | makeoptions amdgpufb "CPPFLAGS.amdgpufb"+="${CPPFLAGS.amdgpu}" | |
@@ -344,27 +344,27 @@ file external/bsd/drm2/dist/drm/amd/amdg | @@ -344,27 +344,27 @@ file external/bsd/drm2/dist/drm/amd/amdg | |||
344 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_iceland_smumgr.c amdgpu | 344 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_iceland_smumgr.c amdgpu | |
345 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_polaris10_smumgr.c amdgpu | 345 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_polaris10_smumgr.c amdgpu | |
346 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu10_smumgr.c amdgpu | 346 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu10_smumgr.c amdgpu | |
347 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu7_smumgr.c amdgpu | 347 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu7_smumgr.c amdgpu | |
348 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu8_smumgr.c amdgpu | 348 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu8_smumgr.c amdgpu | |
349 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu9_smumgr.c amdgpu | 349 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smu9_smumgr.c amdgpu | |
350 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smumgr.c amdgpu | 350 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_smumgr.c amdgpu | |
351 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_tonga_smumgr.c amdgpu | 351 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_tonga_smumgr.c amdgpu | |
352 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega10_smumgr.c amdgpu | 352 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega10_smumgr.c amdgpu | |
353 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega12_smumgr.c amdgpu | 353 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega12_smumgr.c amdgpu | |
354 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega20_smumgr.c amdgpu | 354 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega20_smumgr.c amdgpu | |
355 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vegam_smumgr.c amdgpu | 355 | file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vegam_smumgr.c amdgpu | |
356 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c amdgpu | 356 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c amdgpu | |
357 | #file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c amdgpu | 357 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c amdgpu | |
358 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_afmt.c amdgpu | 358 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_afmt.c amdgpu | |
359 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c amdgpu | 359 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c amdgpu | |
360 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_arct_reg_init.c amdgpu | 360 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_arct_reg_init.c amdgpu | |
361 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_athub_v1_0.c amdgpu | 361 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_athub_v1_0.c amdgpu | |
362 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_athub_v2_0.c amdgpu | 362 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_athub_v2_0.c amdgpu | |
363 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atom.c amdgpu | 363 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atom.c amdgpu | |
364 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c amdgpu | 364 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c amdgpu | |
365 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_crtc.c amdgpu | 365 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_crtc.c amdgpu | |
366 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_dp.c amdgpu | 366 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_dp.c amdgpu | |
367 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_encoders.c amdgpu | 367 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_encoders.c amdgpu | |
368 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_i2c.c amdgpu | 368 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_i2c.c amdgpu | |
369 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atomfirmware.c amdgpu | 369 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atomfirmware.c amdgpu | |
370 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_benchmark.c amdgpu | 370 | file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_benchmark.c amdgpu |
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h 2022/10/08 19:06:30 1.8
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h 2024/04/16 14:34:01 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amdgpu.h,v 1.8 2022/10/08 19:06:30 riastradh Exp $ */ | 1 | /* $NetBSD: amdgpu.h,v 1.9 2024/04/16 14:34:01 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2008 Advanced Micro Devices, Inc. | 4 | * Copyright 2008 Advanced Micro Devices, Inc. | |
5 | * Copyright 2008 Red Hat Inc. | 5 | * Copyright 2008 Red Hat Inc. | |
6 | * Copyright 2009 Jerome Glisse. | 6 | * Copyright 2009 Jerome Glisse. | |
7 | * | 7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a | 8 | * Permission is hereby granted, free of charge, to any person obtaining a | |
9 | * copy of this software and associated documentation files (the "Software"), | 9 | * copy of this software and associated documentation files (the "Software"), | |
10 | * to deal in the Software without restriction, including without limitation | 10 | * to deal in the Software without restriction, including without limitation | |
11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
12 | * and/or sell copies of the Software, and to permit persons to whom the | 12 | * and/or sell copies of the Software, and to permit persons to whom the | |
13 | * Software is furnished to do so, subject to the following conditions: | 13 | * Software is furnished to do so, subject to the following conditions: | |
14 | * | 14 | * | |
@@ -36,26 +36,27 @@ | @@ -36,26 +36,27 @@ | |||
36 | 36 | |||
37 | #ifdef AMDGPU_CIK | 37 | #ifdef AMDGPU_CIK | |
38 | #define CONFIG_DRM_AMDGPU_CIK 1 | 38 | #define CONFIG_DRM_AMDGPU_CIK 1 | |
39 | #endif | 39 | #endif | |
40 | #include "amdgpu_ctx.h" | 40 | #include "amdgpu_ctx.h" | |
41 | 41 | |||
42 | #include <linux/atomic.h> | 42 | #include <linux/atomic.h> | |
43 | #include <linux/wait.h> | 43 | #include <linux/wait.h> | |
44 | #include <linux/list.h> | 44 | #include <linux/list.h> | |
45 | #include <linux/kref.h> | 45 | #include <linux/kref.h> | |
46 | #include <linux/rbtree.h> | 46 | #include <linux/rbtree.h> | |
47 | #include <linux/hashtable.h> | 47 | #include <linux/hashtable.h> | |
48 | #include <linux/dma-fence.h> | 48 | #include <linux/dma-fence.h> | |
49 | #include <linux/acpi.h> | |||
49 | 50 | |||
50 | #include <drm/ttm/ttm_bo_api.h> | 51 | #include <drm/ttm/ttm_bo_api.h> | |
51 | #include <drm/ttm/ttm_bo_driver.h> | 52 | #include <drm/ttm/ttm_bo_driver.h> | |
52 | #include <drm/ttm/ttm_placement.h> | 53 | #include <drm/ttm/ttm_placement.h> | |
53 | #include <drm/ttm/ttm_module.h> | 54 | #include <drm/ttm/ttm_module.h> | |
54 | #include <drm/ttm/ttm_execbuf_util.h> | 55 | #include <drm/ttm/ttm_execbuf_util.h> | |
55 | 56 | |||
56 | #include <drm/amdgpu_drm.h> | 57 | #include <drm/amdgpu_drm.h> | |
57 | #include <drm/drm_gem.h> | 58 | #include <drm/drm_gem.h> | |
58 | #include <drm/drm_ioctl.h> | 59 | #include <drm/drm_ioctl.h> | |
59 | #include <drm/gpu_scheduler.h> | 60 | #include <drm/gpu_scheduler.h> | |
60 | 61 | |||
61 | #include <kgd_kfd_interface.h> | 62 | #include <kgd_kfd_interface.h> |
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c 2022/02/27 14:24:26 1.5
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c 2024/04/16 14:34:01 1.6
@@ -1,55 +1,63 @@ | @@ -1,55 +1,63 @@ | |||
1 | /* $NetBSD: amdgpu_acpi.c,v 1.5 2022/02/27 14:24:26 riastradh Exp $ */ | 1 | /* $NetBSD: amdgpu_acpi.c,v 1.6 2024/04/16 14:34:01 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2012 Advanced Micro Devices, Inc. | 4 | * Copyright 2012 Advanced Micro Devices, Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: amdgpu_acpi.c,v 1.5 2022/02/27 14:24:26 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: amdgpu_acpi.c,v 1.6 2024/04/16 14:34:01 riastradh Exp $"); | |
28 | 28 | |||
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> | |
30 | #include <linux/acpi.h> | 30 | #include <linux/acpi.h> | |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> | |
32 | #include <linux/power_supply.h> | 32 | #include <linux/power_supply.h> | |
33 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> | |
34 | #include <acpi/video.h> | 34 | #include <acpi/video.h> | |
35 | 35 | |||
36 | #include <drm/drm_crtc_helper.h> | 36 | #include <drm/drm_crtc_helper.h> | |
37 | #include "amdgpu.h" | 37 | #include "amdgpu.h" | |
38 | #include "amdgpu_pm.h" | 38 | #include "amdgpu_pm.h" | |
39 | #include "amdgpu_display.h" | 39 | #include "amdgpu_display.h" | |
40 | #include "amd_acpi.h" | 40 | #include "amd_acpi.h" | |
41 | #include "atom.h" | 41 | #include "atom.h" | |
42 | 42 | |||
43 | #ifdef __NetBSD__ | |||
44 | #include <dev/acpi/acpi_pci.h> | |||
45 | #include <dev/acpi/acpireg.h> | |||
46 | #define _COMPONENT ACPI_DISPLAY_COMPONENT | |||
47 | ACPI_MODULE_NAME("radeon_acpi") | |||
48 | #include <linux/nbsd-namespace-acpi.h> | |||
49 | #endif | |||
50 | ||||
43 | struct amdgpu_atif_notification_cfg { | 51 | struct amdgpu_atif_notification_cfg { | |
44 | bool enabled; | 52 | bool enabled; | |
45 | int command_code; | 53 | int command_code; | |
46 | }; | 54 | }; | |
47 | 55 | |||
48 | struct amdgpu_atif_notifications { | 56 | struct amdgpu_atif_notifications { | |
49 | bool thermal_state; | 57 | bool thermal_state; | |
50 | bool forced_power_state; | 58 | bool forced_power_state; | |
51 | bool system_power_state; | 59 | bool system_power_state; | |
52 | bool brightness_change; | 60 | bool brightness_change; | |
53 | bool dgpu_display_event; | 61 | bool dgpu_display_event; | |
54 | bool gpu_package_power_limit; | 62 | bool gpu_package_power_limit; | |
55 | }; | 63 | }; | |
@@ -352,26 +360,28 @@ static int amdgpu_atif_query_backlight_c | @@ -352,26 +360,28 @@ static int amdgpu_atif_query_backlight_c | |||
352 | size = min(sizeof(characteristics), size); | 360 | size = min(sizeof(characteristics), size); | |
353 | memcpy(&characteristics, info->buffer.pointer, size); | 361 | memcpy(&characteristics, info->buffer.pointer, size); | |
354 | 362 | |||
355 | atif->backlight_caps.caps_valid = true; | 363 | atif->backlight_caps.caps_valid = true; | |
356 | atif->backlight_caps.min_input_signal = | 364 | atif->backlight_caps.min_input_signal = | |
357 | characteristics.min_input_signal; | 365 | characteristics.min_input_signal; | |
358 | atif->backlight_caps.max_input_signal = | 366 | atif->backlight_caps.max_input_signal = | |
359 | characteristics.max_input_signal; | 367 | characteristics.max_input_signal; | |
360 | out: | 368 | out: | |
361 | ACPI_FREE(info); | 369 | ACPI_FREE(info); | |
362 | return err; | 370 | return err; | |
363 | } | 371 | } | |
364 | 372 | |||
373 | #ifndef __NetBSD__ /* XXX amdgpu acpi */ | |||
374 | ||||
365 | /** | 375 | /** | |
366 | * amdgpu_atif_get_sbios_requests - get requested sbios event | 376 | * amdgpu_atif_get_sbios_requests - get requested sbios event | |
367 | * | 377 | * | |
368 | * @handle: acpi handle | 378 | * @handle: acpi handle | |
369 | * @req: atif sbios request struct | 379 | * @req: atif sbios request struct | |
370 | * | 380 | * | |
371 | * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function | 381 | * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function | |
372 | * to determine what requests the sbios is making to the driver | 382 | * to determine what requests the sbios is making to the driver | |
373 | * (all asics). | 383 | * (all asics). | |
374 | * Returns 0 on success, error on failure. | 384 | * Returns 0 on success, error on failure. | |
375 | */ | 385 | */ | |
376 | static int amdgpu_atif_get_sbios_requests(struct amdgpu_atif *atif, | 386 | static int amdgpu_atif_get_sbios_requests(struct amdgpu_atif *atif, | |
377 | struct atif_sbios_requests *req) | 387 | struct atif_sbios_requests *req) | |
@@ -478,26 +488,28 @@ static int amdgpu_atif_handler(struct am | @@ -478,26 +488,28 @@ static int amdgpu_atif_handler(struct am | |||
478 | } | 488 | } | |
479 | } | 489 | } | |
480 | /* TODO: check other events */ | 490 | /* TODO: check other events */ | |
481 | } | 491 | } | |
482 | 492 | |||
483 | /* We've handled the event, stop the notifier chain. The ACPI interface | 493 | /* We've handled the event, stop the notifier chain. The ACPI interface | |
484 | * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to | 494 | * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to | |
485 | * userspace if the event was generated only to signal a SBIOS | 495 | * userspace if the event was generated only to signal a SBIOS | |
486 | * request. | 496 | * request. | |
487 | */ | 497 | */ | |
488 | return NOTIFY_BAD; | 498 | return NOTIFY_BAD; | |
489 | } | 499 | } | |
490 | 500 | |||
501 | #endif /* __NetBSD__ */ | |||
502 | ||||
491 | /* Call the ATCS method | 503 | /* Call the ATCS method | |
492 | */ | 504 | */ | |
493 | /** | 505 | /** | |
494 | * amdgpu_atcs_call - call an ATCS method | 506 | * amdgpu_atcs_call - call an ATCS method | |
495 | * | 507 | * | |
496 | * @handle: acpi handle | 508 | * @handle: acpi handle | |
497 | * @function: the ATCS function to execute | 509 | * @function: the ATCS function to execute | |
498 | * @params: ATCS function params | 510 | * @params: ATCS function params | |
499 | * | 511 | * | |
500 | * Executes the requested ATCS function (all asics). | 512 | * Executes the requested ATCS function (all asics). | |
501 | * Returns a pointer to the acpi output buffer. | 513 | * Returns a pointer to the acpi output buffer. | |
502 | */ | 514 | */ | |
503 | static union acpi_object *amdgpu_atcs_call(acpi_handle handle, int function, | 515 | static union acpi_object *amdgpu_atcs_call(acpi_handle handle, int function, | |
@@ -625,27 +637,37 @@ bool amdgpu_acpi_is_pcie_performance_req | @@ -625,27 +637,37 @@ bool amdgpu_acpi_is_pcie_performance_req | |||
625 | * @adev: amdgpu_device pointer | 637 | * @adev: amdgpu_device pointer | |
626 | * | 638 | * | |
627 | * Executes the PCIE_DEVICE_READY_NOTIFICATION method | 639 | * Executes the PCIE_DEVICE_READY_NOTIFICATION method | |
628 | * (all asics). | 640 | * (all asics). | |
629 | * returns 0 on success, error on failure. | 641 | * returns 0 on success, error on failure. | |
630 | */ | 642 | */ | |
631 | int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev) | 643 | int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev) | |
632 | { | 644 | { | |
633 | acpi_handle handle; | 645 | acpi_handle handle; | |
634 | union acpi_object *info; | 646 | union acpi_object *info; | |
635 | struct amdgpu_atcs *atcs = &adev->atcs; | 647 | struct amdgpu_atcs *atcs = &adev->atcs; | |
636 | 648 | |||
637 | /* Get the device handle */ | 649 | /* Get the device handle */ | |
650 | #ifdef __NetBSD__ | |||
651 | const struct pci_attach_args *pa = &adev->pdev->pd_pa; | |||
652 | struct acpi_devnode *const d = | |||
653 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), | |||
654 | pa->pa_bus, pa->pa_device, pa->pa_function); | |||
655 | if (d == NULL) | |||
656 | return -EINVAL; | |||
657 | handle = d->ad_handle; | |||
658 | #else | |||
638 | handle = ACPI_HANDLE(&adev->pdev->dev); | 659 | handle = ACPI_HANDLE(&adev->pdev->dev); | |
660 | #endif | |||
639 | if (!handle) | 661 | if (!handle) | |
640 | return -EINVAL; | 662 | return -EINVAL; | |
641 | 663 | |||
642 | if (!atcs->functions.pcie_dev_rdy) | 664 | if (!atcs->functions.pcie_dev_rdy) | |
643 | return -EINVAL; | 665 | return -EINVAL; | |
644 | 666 | |||
645 | info = amdgpu_atcs_call(handle, ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION, NULL); | 667 | info = amdgpu_atcs_call(handle, ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION, NULL); | |
646 | if (!info) | 668 | if (!info) | |
647 | return -EIO; | 669 | return -EIO; | |
648 | 670 | |||
649 | ACPI_FREE(info); | 671 | ACPI_FREE(info); | |
650 | 672 | |||
651 | return 0; | 673 | return 0; | |
@@ -668,27 +690,37 @@ int amdgpu_acpi_pcie_performance_request | @@ -668,27 +690,37 @@ int amdgpu_acpi_pcie_performance_request | |||
668 | acpi_handle handle; | 690 | acpi_handle handle; | |
669 | union acpi_object *info; | 691 | union acpi_object *info; | |
670 | struct amdgpu_atcs *atcs = &adev->atcs; | 692 | struct amdgpu_atcs *atcs = &adev->atcs; | |
671 | struct atcs_pref_req_input atcs_input; | 693 | struct atcs_pref_req_input atcs_input; | |
672 | struct atcs_pref_req_output atcs_output; | 694 | struct atcs_pref_req_output atcs_output; | |
673 | struct acpi_buffer params; | 695 | struct acpi_buffer params; | |
674 | size_t size; | 696 | size_t size; | |
675 | u32 retry = 3; | 697 | u32 retry = 3; | |
676 | 698 | |||
677 | if (amdgpu_acpi_pcie_notify_device_ready(adev)) | 699 | if (amdgpu_acpi_pcie_notify_device_ready(adev)) | |
678 | return -EINVAL; | 700 | return -EINVAL; | |
679 | 701 | |||
680 | /* Get the device handle */ | 702 | /* Get the device handle */ | |
703 | #ifdef __NetBSD__ | |||
704 | const struct pci_attach_args *pa = &adev->pdev->pd_pa; | |||
705 | struct acpi_devnode *const d = | |||
706 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), | |||
707 | pa->pa_bus, pa->pa_device, pa->pa_function); | |||
708 | if (d == NULL) | |||
709 | return -EINVAL; | |||
710 | handle = d->ad_handle; | |||
711 | #else | |||
681 | handle = ACPI_HANDLE(&adev->pdev->dev); | 712 | handle = ACPI_HANDLE(&adev->pdev->dev); | |
713 | #endif | |||
682 | if (!handle) | 714 | if (!handle) | |
683 | return -EINVAL; | 715 | return -EINVAL; | |
684 | 716 | |||
685 | if (!atcs->functions.pcie_perf_req) | 717 | if (!atcs->functions.pcie_perf_req) | |
686 | return -EINVAL; | 718 | return -EINVAL; | |
687 | 719 | |||
688 | atcs_input.size = sizeof(struct atcs_pref_req_input); | 720 | atcs_input.size = sizeof(struct atcs_pref_req_input); | |
689 | /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */ | 721 | /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */ | |
690 | atcs_input.client_id = adev->pdev->devfn | (adev->pdev->bus->number << 8); | 722 | atcs_input.client_id = adev->pdev->devfn | (adev->pdev->bus->number << 8); | |
691 | atcs_input.valid_flags_mask = ATCS_VALID_FLAGS_MASK; | 723 | atcs_input.valid_flags_mask = ATCS_VALID_FLAGS_MASK; | |
692 | atcs_input.flags = ATCS_WAIT_FOR_COMPLETION; | 724 | atcs_input.flags = ATCS_WAIT_FOR_COMPLETION; | |
693 | if (advertise) | 725 | if (advertise) | |
694 | atcs_input.flags |= ATCS_ADVERTISE_CAPS; | 726 | atcs_input.flags |= ATCS_ADVERTISE_CAPS; | |
@@ -733,65 +765,77 @@ int amdgpu_acpi_pcie_performance_request | @@ -733,65 +765,77 @@ int amdgpu_acpi_pcie_performance_request | |||
733 | } | 765 | } | |
734 | 766 | |||
735 | /** | 767 | /** | |
736 | * amdgpu_acpi_event - handle notify events | 768 | * amdgpu_acpi_event - handle notify events | |
737 | * | 769 | * | |
738 | * @nb: notifier block | 770 | * @nb: notifier block | |
739 | * @val: val | 771 | * @val: val | |
740 | * @data: acpi event | 772 | * @data: acpi event | |
741 | * | 773 | * | |
742 | * Calls relevant amdgpu functions in response to various | 774 | * Calls relevant amdgpu functions in response to various | |
743 | * acpi events. | 775 | * acpi events. | |
744 | * Returns NOTIFY code | 776 | * Returns NOTIFY code | |
745 | */ | 777 | */ | |
778 | #ifndef __NetBSD__ /* XXX amdgpu acpi */ | |||
746 | static int amdgpu_acpi_event(struct notifier_block *nb, | 779 | static int amdgpu_acpi_event(struct notifier_block *nb, | |
747 | unsigned long val, | 780 | unsigned long val, | |
748 | void *data) | 781 | void *data) | |
749 | { | 782 | { | |
750 | struct amdgpu_device *adev = container_of(nb, struct amdgpu_device, acpi_nb); | 783 | struct amdgpu_device *adev = container_of(nb, struct amdgpu_device, acpi_nb); | |
751 | struct acpi_bus_event *entry = (struct acpi_bus_event *)data; | 784 | struct acpi_bus_event *entry = (struct acpi_bus_event *)data; | |
752 | 785 | |||
753 | if (strcmp(entry->device_class, ACPI_AC_CLASS) == 0) { | 786 | if (strcmp(entry->device_class, ACPI_AC_CLASS) == 0) { | |
754 | if (power_supply_is_system_supplied() > 0) | 787 | if (power_supply_is_system_supplied() > 0) | |
755 | DRM_DEBUG_DRIVER("pm: AC\n"); | 788 | DRM_DEBUG_DRIVER("pm: AC\n"); | |
756 | else | 789 | else | |
757 | DRM_DEBUG_DRIVER("pm: DC\n"); | 790 | DRM_DEBUG_DRIVER("pm: DC\n"); | |
758 | 791 | |||
759 | amdgpu_pm_acpi_event_handler(adev); | 792 | amdgpu_pm_acpi_event_handler(adev); | |
760 | } | 793 | } | |
761 | 794 | |||
762 | /* Check for pending SBIOS requests */ | 795 | /* Check for pending SBIOS requests */ | |
763 | return amdgpu_atif_handler(adev, entry); | 796 | return amdgpu_atif_handler(adev, entry); | |
764 | } | 797 | } | |
798 | #endif | |||
765 | 799 | |||
766 | /* Call all ACPI methods here */ | 800 | /* Call all ACPI methods here */ | |
767 | /** | 801 | /** | |
768 | * amdgpu_acpi_init - init driver acpi support | 802 | * amdgpu_acpi_init - init driver acpi support | |
769 | * | 803 | * | |
770 | * @adev: amdgpu_device pointer | 804 | * @adev: amdgpu_device pointer | |
771 | * | 805 | * | |
772 | * Verifies the AMD ACPI interfaces and registers with the acpi | 806 | * Verifies the AMD ACPI interfaces and registers with the acpi | |
773 | * notifier chain (all asics). | 807 | * notifier chain (all asics). | |
774 | * Returns 0 on success, error on failure. | 808 | * Returns 0 on success, error on failure. | |
775 | */ | 809 | */ | |
776 | int amdgpu_acpi_init(struct amdgpu_device *adev) | 810 | int amdgpu_acpi_init(struct amdgpu_device *adev) | |
777 | { | 811 | { | |
778 | acpi_handle handle, atif_handle; | 812 | acpi_handle handle, atif_handle; | |
779 | struct amdgpu_atif *atif; | 813 | struct amdgpu_atif *atif; | |
780 | struct amdgpu_atcs *atcs = &adev->atcs; | 814 | struct amdgpu_atcs *atcs = &adev->atcs; | |
781 | int ret; | 815 | int ret; | |
782 | 816 | |||
783 | /* Get the device handle */ | 817 | /* Get the device handle */ | |
818 | #ifdef __NetBSD__ | |||
819 | const struct pci_attach_args *pa = &adev->pdev->pd_pa; | |||
820 | struct acpi_devnode *const d = | |||
821 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), | |||
822 | pa->pa_bus, pa->pa_device, pa->pa_function); | |||
823 | if (d == NULL) | |||
824 | return -EINVAL; | |||
825 | handle = d->ad_handle; | |||
826 | #else | |||
784 | handle = ACPI_HANDLE(&adev->pdev->dev); | 827 | handle = ACPI_HANDLE(&adev->pdev->dev); | |
828 | #endif | |||
785 | 829 | |||
786 | if (!adev->bios || !handle) | 830 | if (!adev->bios || !handle) | |
787 | return 0; | 831 | return 0; | |
788 | 832 | |||
789 | /* Call the ATCS method */ | 833 | /* Call the ATCS method */ | |
790 | ret = amdgpu_atcs_verify_interface(handle, atcs); | 834 | ret = amdgpu_atcs_verify_interface(handle, atcs); | |
791 | if (ret) { | 835 | if (ret) { | |
792 | DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret); | 836 | DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret); | |
793 | } | 837 | } | |
794 | 838 | |||
795 | /* Probe for ATIF, and initialize it if found */ | 839 | /* Probe for ATIF, and initialize it if found */ | |
796 | atif_handle = amdgpu_atif_probe_handle(handle); | 840 | atif_handle = amdgpu_atif_probe_handle(handle); | |
797 | if (!atif_handle) | 841 | if (!atif_handle) | |
@@ -852,43 +896,47 @@ int amdgpu_acpi_init(struct amdgpu_devic | @@ -852,43 +896,47 @@ int amdgpu_acpi_init(struct amdgpu_devic | |||
852 | 896 | |||
853 | if (atif->functions.query_backlight_transfer_characteristics) { | 897 | if (atif->functions.query_backlight_transfer_characteristics) { | |
854 | ret = amdgpu_atif_query_backlight_caps(atif); | 898 | ret = amdgpu_atif_query_backlight_caps(atif); | |
855 | if (ret) { | 899 | if (ret) { | |
856 | DRM_DEBUG_DRIVER("Call to QUERY_BACKLIGHT_TRANSFER_CHARACTERISTICS failed: %d\n", | 900 | DRM_DEBUG_DRIVER("Call to QUERY_BACKLIGHT_TRANSFER_CHARACTERISTICS failed: %d\n", | |
857 | ret); | 901 | ret); | |
858 | atif->backlight_caps.caps_valid = false; | 902 | atif->backlight_caps.caps_valid = false; | |
859 | } | 903 | } | |
860 | } else { | 904 | } else { | |
861 | atif->backlight_caps.caps_valid = false; | 905 | atif->backlight_caps.caps_valid = false; | |
862 | } | 906 | } | |
863 | 907 | |||
864 | out: | 908 | out: | |
909 | #ifndef __NetBSD__ /* XXX amdgpu acpi */ | |||
865 | adev->acpi_nb.notifier_call = amdgpu_acpi_event; | 910 | adev->acpi_nb.notifier_call = amdgpu_acpi_event; | |
866 | register_acpi_notifier(&adev->acpi_nb); | 911 | register_acpi_notifier(&adev->acpi_nb); | |
912 | #endif | |||
867 | 913 | |||
868 | return ret; | 914 | return ret; | |
869 | } | 915 | } | |
870 | 916 | |||
871 | void amdgpu_acpi_get_backlight_caps(struct amdgpu_device *adev, | 917 | void amdgpu_acpi_get_backlight_caps(struct amdgpu_device *adev, | |
872 | struct amdgpu_dm_backlight_caps *caps) | 918 | struct amdgpu_dm_backlight_caps *caps) | |
873 | { | 919 | { | |
874 | if (!adev->atif) { | 920 | if (!adev->atif) { | |
875 | caps->caps_valid = false; | 921 | caps->caps_valid = false; | |
876 | return; | 922 | return; | |
877 | } | 923 | } | |
878 | caps->caps_valid = adev->atif->backlight_caps.caps_valid; | 924 | caps->caps_valid = adev->atif->backlight_caps.caps_valid; | |
879 | caps->min_input_signal = adev->atif->backlight_caps.min_input_signal; | 925 | caps->min_input_signal = adev->atif->backlight_caps.min_input_signal; | |
880 | caps->max_input_signal = adev->atif->backlight_caps.max_input_signal; | 926 | caps->max_input_signal = adev->atif->backlight_caps.max_input_signal; | |
881 | } | 927 | } | |
882 | 928 | |||
883 | /** | 929 | /** | |
884 | * amdgpu_acpi_fini - tear down driver acpi support | 930 | * amdgpu_acpi_fini - tear down driver acpi support | |
885 | * | 931 | * | |
886 | * @adev: amdgpu_device pointer | 932 | * @adev: amdgpu_device pointer | |
887 | * | 933 | * | |
888 | * Unregisters with the acpi notifier chain (all asics). | 934 | * Unregisters with the acpi notifier chain (all asics). | |
889 | */ | 935 | */ | |
890 | void amdgpu_acpi_fini(struct amdgpu_device *adev) | 936 | void amdgpu_acpi_fini(struct amdgpu_device *adev) | |
891 | { | 937 | { | |
938 | #ifndef __NetBSD__ /* XXX radeon acpi */ | |||
892 | unregister_acpi_notifier(&adev->acpi_nb); | 939 | unregister_acpi_notifier(&adev->acpi_nb); | |
940 | #endif | |||
893 | kfree(adev->atif); | 941 | kfree(adev->atif); | |
894 | } | 942 | } |
--- src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c 2021/12/18 23:45:26 1.2
+++ src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c 2024/04/16 14:34:01 1.3
@@ -1,47 +1,48 @@ | @@ -1,47 +1,48 @@ | |||
1 | /* $NetBSD: amdgpu_hwmgr.c,v 1.2 2021/12/18 23:45:26 riastradh Exp $ */ | 1 | /* $NetBSD: amdgpu_hwmgr.c,v 1.3 2024/04/16 14:34:01 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2015 Advanced Micro Devices, Inc. | 4 | * Copyright 2015 Advanced Micro Devices, Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: amdgpu_hwmgr.c,v 1.2 2021/12/18 23:45:26 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: amdgpu_hwmgr.c,v 1.3 2024/04/16 14:34:01 riastradh Exp $"); | |
28 | 28 | |||
29 | #include "pp_debug.h" | 29 | #include "pp_debug.h" | |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> | |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> | |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> | |
33 | #include <linux/types.h> | 33 | #include <linux/types.h> | |
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> | |
35 | #include <linux/acpi.h> | |||
35 | #include <drm/amdgpu_drm.h> | 36 | #include <drm/amdgpu_drm.h> | |
36 | #include "power_state.h" | 37 | #include "power_state.h" | |
37 | #include "hwmgr.h" | 38 | #include "hwmgr.h" | |
38 | #include "ppsmc.h" | 39 | #include "ppsmc.h" | |
39 | #include "amd_acpi.h" | 40 | #include "amd_acpi.h" | |
40 | #include "pp_psm.h" | 41 | #include "pp_psm.h" | |
41 | 42 | |||
42 | extern const struct pp_smumgr_func ci_smu_funcs; | 43 | extern const struct pp_smumgr_func ci_smu_funcs; | |
43 | extern const struct pp_smumgr_func smu8_smu_funcs; | 44 | extern const struct pp_smumgr_func smu8_smu_funcs; | |
44 | extern const struct pp_smumgr_func iceland_smu_funcs; | 45 | extern const struct pp_smumgr_func iceland_smu_funcs; | |
45 | extern const struct pp_smumgr_func tonga_smu_funcs; | 46 | extern const struct pp_smumgr_func tonga_smu_funcs; | |
46 | extern const struct pp_smumgr_func fiji_smu_funcs; | 47 | extern const struct pp_smumgr_func fiji_smu_funcs; | |
47 | extern const struct pp_smumgr_func polaris10_smu_funcs; | 48 | extern const struct pp_smumgr_func polaris10_smu_funcs; |
--- src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c 2021/12/19 12:37:54 1.4
+++ src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c 2024/04/16 14:34:01 1.5
@@ -1,46 +1,47 @@ | @@ -1,46 +1,47 @@ | |||
1 | /* $NetBSD: amdgpu_smu7_hwmgr.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $ */ | 1 | /* $NetBSD: amdgpu_smu7_hwmgr.c,v 1.5 2024/04/16 14:34:01 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2015 Advanced Micro Devices, Inc. | 4 | * Copyright 2015 Advanced Micro Devices, Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | */ | 24 | */ | |
25 | #include <sys/cdefs.h> | 25 | #include <sys/cdefs.h> | |
26 | __KERNEL_RCSID(0, "$NetBSD: amdgpu_smu7_hwmgr.c,v 1.4 2021/12/19 12:37:54 riastradh Exp $"); | 26 | __KERNEL_RCSID(0, "$NetBSD: amdgpu_smu7_hwmgr.c,v 1.5 2024/04/16 14:34:01 riastradh Exp $"); | |
27 | 27 | |||
28 | #include "pp_debug.h" | 28 | #include "pp_debug.h" | |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> | |
30 | #include <linux/fb.h> | 30 | #include <linux/fb.h> | |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> | |
32 | #include <linux/pci.h> | 32 | #include <linux/pci.h> | |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> | |
34 | #include <linux/acpi.h> | |||
34 | #include <asm/div64.h> | 35 | #include <asm/div64.h> | |
35 | #include <drm/amdgpu_drm.h> | 36 | #include <drm/amdgpu_drm.h> | |
36 | #include "ppatomctrl.h" | 37 | #include "ppatomctrl.h" | |
37 | #include "atombios.h" | 38 | #include "atombios.h" | |
38 | #include "pptable_v1_0.h" | 39 | #include "pptable_v1_0.h" | |
39 | #include "pppcielanes.h" | 40 | #include "pppcielanes.h" | |
40 | #include "amd_pcie_helpers.h" | 41 | #include "amd_pcie_helpers.h" | |
41 | #include "hardwaremanager.h" | 42 | #include "hardwaremanager.h" | |
42 | #include "process_pptables_v1_0.h" | 43 | #include "process_pptables_v1_0.h" | |
43 | #include "cgs_common.h" | 44 | #include "cgs_common.h" | |
44 | 45 | |||
45 | #include "smu7_common.h" | 46 | #include "smu7_common.h" | |
46 | 47 |
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h 2022/09/22 14:37:38 1.48
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h 2024/04/16 14:34:02 1.49
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: i915_drv.h,v 1.48 2022/09/22 14:37:38 riastradh Exp $ */ | 1 | /* $NetBSD: i915_drv.h,v 1.49 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- | 3 | /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- | |
4 | */ | 4 | */ | |
5 | /* | 5 | /* | |
6 | * | 6 | * | |
7 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 7 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | |
8 | * All Rights Reserved. | 8 | * All Rights Reserved. | |
9 | * | 9 | * | |
10 | * Permission is hereby granted, free of charge, to any person obtaining a | 10 | * Permission is hereby granted, free of charge, to any person obtaining a | |
11 | * copy of this software and associated documentation files (the | 11 | * copy of this software and associated documentation files (the | |
12 | * "Software"), to deal in the Software without restriction, including | 12 | * "Software"), to deal in the Software without restriction, including | |
13 | * without limitation the rights to use, copy, modify, merge, publish, | 13 | * without limitation the rights to use, copy, modify, merge, publish, | |
14 | * distribute, sub license, and/or sell copies of the Software, and to | 14 | * distribute, sub license, and/or sell copies of the Software, and to | |
@@ -22,53 +22,45 @@ | @@ -22,53 +22,45 @@ | |||
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
23 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 23 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | 24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |
25 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR | 25 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR | |
26 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | 26 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
27 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 27 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
28 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 28 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
29 | * | 29 | * | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #ifndef _I915_DRV_H_ | 32 | #ifndef _I915_DRV_H_ | |
33 | #define _I915_DRV_H_ | 33 | #define _I915_DRV_H_ | |
34 | 34 | |||
35 | #if defined(__NetBSD__) | |||
36 | #ifdef _KERNEL_OPT | |||
37 | #include "acpica.h" | |||
38 | #endif /* _KERNEL_OPT */ | |||
39 | #if (NACPICA > 0) | |||
40 | #define CONFIG_ACPI | |||
41 | #endif /* NACPICA > 0 */ | |||
42 | #endif /* __NetBSD__ */ | |||
43 | ||||
44 | #include <uapi/drm/i915_drm.h> | 35 | #include <uapi/drm/i915_drm.h> | |
45 | #include <uapi/drm/drm_fourcc.h> | 36 | #include <uapi/drm/drm_fourcc.h> | |
46 | 37 | |||
47 | #include <linux/io-mapping.h> | 38 | #include <linux/io-mapping.h> | |
48 | #include <linux/i2c.h> | 39 | #include <linux/i2c.h> | |
49 | #include <linux/i2c-algo-bit.h> | 40 | #include <linux/i2c-algo-bit.h> | |
50 | #include <linux/backlight.h> | 41 | #include <linux/backlight.h> | |
51 | #include <linux/hash.h> | 42 | #include <linux/hash.h> | |
52 | #include <linux/intel-iommu.h> | 43 | #include <linux/intel-iommu.h> | |
53 | #include <linux/kref.h> | 44 | #include <linux/kref.h> | |
54 | #include <linux/mm_types.h> | 45 | #include <linux/mm_types.h> | |
55 | #include <linux/perf_event.h> | 46 | #include <linux/perf_event.h> | |
56 | #include <linux/pm_qos.h> | 47 | #include <linux/pm_qos.h> | |
57 | #include <linux/dma-resv.h> | 48 | #include <linux/dma-resv.h> | |
58 | #include <linux/shmem_fs.h> | 49 | #include <linux/shmem_fs.h> | |
59 | #include <linux/stackdepot.h> | 50 | #include <linux/stackdepot.h> | |
60 | #include <linux/xarray.h> | 51 | #include <linux/xarray.h> | |
61 | #include <linux/uuid.h> | 52 | #include <linux/uuid.h> | |
53 | #include <linux/acpi.h> | |||
62 | 54 | |||
63 | #include <drm/intel-gtt.h> | 55 | #include <drm/intel-gtt.h> | |
64 | #include <drm/drm_legacy.h> /* for struct drm_dma_handle */ | 56 | #include <drm/drm_legacy.h> /* for struct drm_dma_handle */ | |
65 | #include <drm/drm_gem.h> | 57 | #include <drm/drm_gem.h> | |
66 | #include <drm/drm_auth.h> | 58 | #include <drm/drm_auth.h> | |
67 | #include <drm/drm_cache.h> | 59 | #include <drm/drm_cache.h> | |
68 | #include <drm/drm_util.h> | 60 | #include <drm/drm_util.h> | |
69 | #include <drm/drm_dsc.h> | 61 | #include <drm/drm_dsc.h> | |
70 | #include <drm/drm_atomic.h> | 62 | #include <drm/drm_atomic.h> | |
71 | #include <drm/drm_connector.h> | 63 | #include <drm/drm_connector.h> | |
72 | #include <drm/i915_mei_hdcp_interface.h> | 64 | #include <drm/i915_mei_hdcp_interface.h> | |
73 | 65 | |||
74 | #include "i915_fixed.h" | 66 | #include "i915_fixed.h" |
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h 2021/12/19 11:16:17 1.4
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h 2024/04/16 14:34:01 1.5
@@ -1,23 +1,25 @@ | @@ -1,23 +1,25 @@ | |||
1 | /* $NetBSD: intel_acpi.h,v 1.4 2021/12/19 11:16:17 riastradh Exp $ */ | 1 | /* $NetBSD: intel_acpi.h,v 1.5 2024/04/16 14:34:01 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* SPDX-License-Identifier: MIT */ | 3 | /* SPDX-License-Identifier: MIT */ | |
4 | /* | 4 | /* | |
5 | * Copyright © 2019 Intel Corporation | 5 | * Copyright © 2019 Intel Corporation | |
6 | */ | 6 | */ | |
7 | 7 | |||
8 | #ifndef __INTEL_ACPI_H__ | 8 | #ifndef __INTEL_ACPI_H__ | |
9 | #define __INTEL_ACPI_H__ | 9 | #define __INTEL_ACPI_H__ | |
10 | 10 | |||
11 | #include <linux/acpi.h> | |||
12 | ||||
11 | struct drm_i915_private; | 13 | struct drm_i915_private; | |
12 | 14 | |||
13 | #ifdef CONFIG_ACPI | 15 | #ifdef CONFIG_ACPI | |
14 | #ifdef __NetBSD__ | 16 | #ifdef __NetBSD__ | |
15 | void intel_register_dsm_handler(struct drm_i915_private *); | 17 | void intel_register_dsm_handler(struct drm_i915_private *); | |
16 | #else | 18 | #else | |
17 | void intel_register_dsm_handler(void); | 19 | void intel_register_dsm_handler(void); | |
18 | #endif | 20 | #endif | |
19 | void intel_unregister_dsm_handler(void); | 21 | void intel_unregister_dsm_handler(void); | |
20 | #else | 22 | #else | |
21 | #ifdef __NetBSD__ | 23 | #ifdef __NetBSD__ | |
22 | static inline void intel_register_dsm_handler(struct drm_i915_private *i915) { return; } | 24 | static inline void intel_register_dsm_handler(struct drm_i915_private *i915) { return; } | |
23 | #else | 25 | #else |
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h 2022/02/27 21:22:01 1.5
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h 2024/04/16 14:34:01 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: intel_opregion.h,v 1.5 2022/02/27 21:22:01 riastradh Exp $ */ | 1 | /* $NetBSD: intel_opregion.h,v 1.6 2024/04/16 14:34:01 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright © 2008-2017 Intel Corporation | 4 | * Copyright © 2008-2017 Intel Corporation | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice (including the next | 13 | * The above copyright notice and this permission notice (including the next | |
14 | * paragraph) shall be included in all copies or substantial portions of the | 14 | * paragraph) shall be included in all copies or substantial portions of the | |
@@ -19,26 +19,27 @@ | @@ -19,26 +19,27 @@ | |||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
23 | * IN THE SOFTWARE. | 23 | * IN THE SOFTWARE. | |
24 | * | 24 | * | |
25 | */ | 25 | */ | |
26 | 26 | |||
27 | #ifndef _INTEL_OPREGION_H_ | 27 | #ifndef _INTEL_OPREGION_H_ | |
28 | #define _INTEL_OPREGION_H_ | 28 | #define _INTEL_OPREGION_H_ | |
29 | 29 | |||
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> | |
31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> | |
32 | #include <linux/acpi.h> | |||
32 | 33 | |||
33 | struct drm_i915_private; | 34 | struct drm_i915_private; | |
34 | struct intel_encoder; | 35 | struct intel_encoder; | |
35 | 36 | |||
36 | struct opregion_header; | 37 | struct opregion_header; | |
37 | struct opregion_acpi; | 38 | struct opregion_acpi; | |
38 | struct opregion_swsci; | 39 | struct opregion_swsci; | |
39 | struct opregion_asle; | 40 | struct opregion_asle; | |
40 | 41 | |||
41 | struct intel_opregion { | 42 | struct intel_opregion { | |
42 | struct opregion_header *header; | 43 | struct opregion_header *header; | |
43 | struct opregion_acpi *acpi; | 44 | struct opregion_acpi *acpi; | |
44 | struct opregion_swsci *swsci; | 45 | struct opregion_swsci *swsci; |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c 2022/02/27 14:24:27 1.4
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c 2024/04/16 14:34:02 1.5
@@ -1,30 +1,37 @@ | @@ -1,30 +1,37 @@ | |||
1 | /* $NetBSD: nouveau_acpi.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_acpi.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | // SPDX-License-Identifier: MIT | 3 | // SPDX-License-Identifier: MIT | |
4 | #include <sys/cdefs.h> | 4 | #include <sys/cdefs.h> | |
5 | __KERNEL_RCSID(0, "$NetBSD: nouveau_acpi.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $"); | 5 | __KERNEL_RCSID(0, "$NetBSD: nouveau_acpi.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $"); | |
6 | 6 | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> | |
8 | #include <linux/acpi.h> | 8 | #include <linux/acpi.h> | |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> | |
10 | #include <linux/mxm-wmi.h> | 10 | #include <linux/mxm-wmi.h> | |
11 | #include <linux/vga_switcheroo.h> | 11 | #include <linux/vga_switcheroo.h> | |
12 | #include <drm/drm_edid.h> | 12 | #include <drm/drm_edid.h> | |
13 | #include <acpi/video.h> | 13 | #include <acpi/video.h> | |
14 | 14 | |||
15 | #include "nouveau_drv.h" | 15 | #include "nouveau_drv.h" | |
16 | #include "nouveau_acpi.h" | 16 | #include "nouveau_acpi.h" | |
17 | 17 | |||
18 | #ifdef __NetBSD__ | |||
19 | #include <dev/acpi/acpireg.h> | |||
20 | #define _COMPONENT ACPI_DISPLAY_COMPONENT | |||
21 | ACPI_MODULE_NAME("nouveau_acpi") | |||
22 | #include <linux/nbsd-namespace-acpi.h> | |||
23 | #endif | |||
24 | ||||
18 | #define NOUVEAU_DSM_LED 0x02 | 25 | #define NOUVEAU_DSM_LED 0x02 | |
19 | #define NOUVEAU_DSM_LED_STATE 0x00 | 26 | #define NOUVEAU_DSM_LED_STATE 0x00 | |
20 | #define NOUVEAU_DSM_LED_OFF 0x10 | 27 | #define NOUVEAU_DSM_LED_OFF 0x10 | |
21 | #define NOUVEAU_DSM_LED_STAMINA 0x11 | 28 | #define NOUVEAU_DSM_LED_STAMINA 0x11 | |
22 | #define NOUVEAU_DSM_LED_SPEED 0x12 | 29 | #define NOUVEAU_DSM_LED_SPEED 0x12 | |
23 | 30 | |||
24 | #define NOUVEAU_DSM_POWER 0x03 | 31 | #define NOUVEAU_DSM_POWER 0x03 | |
25 | #define NOUVEAU_DSM_POWER_STATE 0x00 | 32 | #define NOUVEAU_DSM_POWER_STATE 0x00 | |
26 | #define NOUVEAU_DSM_POWER_SPEED 0x01 | 33 | #define NOUVEAU_DSM_POWER_SPEED 0x01 | |
27 | #define NOUVEAU_DSM_POWER_STAMINA 0x02 | 34 | #define NOUVEAU_DSM_POWER_STAMINA 0x02 | |
28 | 35 | |||
29 | #define NOUVEAU_DSM_OPTIMUS_CAPS 0x1A | 36 | #define NOUVEAU_DSM_OPTIMUS_CAPS 0x1A | |
30 | #define NOUVEAU_DSM_OPTIMUS_FLAGS 0x1B | 37 | #define NOUVEAU_DSM_OPTIMUS_FLAGS 0x1B | |
@@ -246,27 +253,31 @@ static bool nouveau_pr3_present(struct p | @@ -246,27 +253,31 @@ static bool nouveau_pr3_present(struct p | |||
246 | 253 | |||
247 | return parent_adev->power.flags.power_resources && | 254 | return parent_adev->power.flags.power_resources && | |
248 | acpi_has_method(parent_adev->handle, "_PR3"); | 255 | acpi_has_method(parent_adev->handle, "_PR3"); | |
249 | } | 256 | } | |
250 | 257 | |||
251 | static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out, | 258 | static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out, | |
252 | bool *has_mux, bool *has_opt, | 259 | bool *has_mux, bool *has_opt, | |
253 | bool *has_opt_flags, bool *has_pr3) | 260 | bool *has_opt_flags, bool *has_pr3) | |
254 | { | 261 | { | |
255 | acpi_handle dhandle; | 262 | acpi_handle dhandle; | |
256 | bool supports_mux; | 263 | bool supports_mux; | |
257 | int optimus_funcs; | 264 | int optimus_funcs; | |
258 | 265 | |||
266 | #ifdef __NetBSD__ | |||
267 | dhandle = pdev->pd_ad->ad_handle; | |||
268 | #else | |||
259 | dhandle = ACPI_HANDLE(&pdev->dev); | 269 | dhandle = ACPI_HANDLE(&pdev->dev); | |
270 | #endif | |||
260 | if (!dhandle) | 271 | if (!dhandle) | |
261 | return; | 272 | return; | |
262 | 273 | |||
263 | if (!acpi_has_method(dhandle, "_DSM")) | 274 | if (!acpi_has_method(dhandle, "_DSM")) | |
264 | return; | 275 | return; | |
265 | 276 | |||
266 | supports_mux = acpi_check_dsm(dhandle, &nouveau_dsm_muid, 0x00000102, | 277 | supports_mux = acpi_check_dsm(dhandle, &nouveau_dsm_muid, 0x00000102, | |
267 | 1 << NOUVEAU_DSM_POWER); | 278 | 1 << NOUVEAU_DSM_POWER); | |
268 | optimus_funcs = nouveau_dsm_get_optimus_functions(dhandle); | 279 | optimus_funcs = nouveau_dsm_get_optimus_functions(dhandle); | |
269 | 280 | |||
270 | /* Does not look like a Nvidia device. */ | 281 | /* Does not look like a Nvidia device. */ | |
271 | if (!supports_mux && !optimus_funcs) | 282 | if (!supports_mux && !optimus_funcs) | |
272 | return; | 283 | return; | |
@@ -411,66 +422,82 @@ static int nouveau_rom_call(acpi_handle | @@ -411,66 +422,82 @@ static int nouveau_rom_call(acpi_handle | |||
411 | status = acpi_evaluate_object(rom_handle, NULL, &rom_arg, &buffer); | 422 | status = acpi_evaluate_object(rom_handle, NULL, &rom_arg, &buffer); | |
412 | if (ACPI_FAILURE(status)) { | 423 | if (ACPI_FAILURE(status)) { | |
413 | pr_info("failed to evaluate ROM got %s\n", | 424 | pr_info("failed to evaluate ROM got %s\n", | |
414 | acpi_format_exception(status)); | 425 | acpi_format_exception(status)); | |
415 | return -ENODEV; | 426 | return -ENODEV; | |
416 | } | 427 | } | |
417 | obj = (union acpi_object *)buffer.pointer; | 428 | obj = (union acpi_object *)buffer.pointer; | |
418 | len = min(len, (int)obj->buffer.length); | 429 | len = min(len, (int)obj->buffer.length); | |
419 | memcpy(bios+offset, obj->buffer.pointer, len); | 430 | memcpy(bios+offset, obj->buffer.pointer, len); | |
420 | ACPI_FREE(buffer.pointer); | 431 | ACPI_FREE(buffer.pointer); | |
421 | return len; | 432 | return len; | |
422 | } | 433 | } | |
423 | 434 | |||
435 | #ifdef __NetBSD__ | |||
436 | bool nouveau_acpi_rom_supported(struct acpi_devnode *acpidev) | |||
437 | #else | |||
424 | bool nouveau_acpi_rom_supported(struct device *dev) | 438 | bool nouveau_acpi_rom_supported(struct device *dev) | |
439 | #endif | |||
425 | { | 440 | { | |
426 | acpi_status status; | 441 | acpi_status status; | |
427 | acpi_handle dhandle, rom_handle; | 442 | acpi_handle dhandle, rom_handle; | |
428 | 443 | |||
444 | #ifdef __NetBSD__ | |||
445 | dhandle = (acpidev ? acpidev->ad_handle : NULL); | |||
446 | #else | |||
429 | dhandle = ACPI_HANDLE(dev); | 447 | dhandle = ACPI_HANDLE(dev); | |
448 | #endif | |||
430 | if (!dhandle) | 449 | if (!dhandle) | |
431 | return false; | 450 | return false; | |
432 | 451 | |||
433 | status = acpi_get_handle(dhandle, "_ROM", &rom_handle); | 452 | status = acpi_get_handle(dhandle, "_ROM", &rom_handle); | |
434 | if (ACPI_FAILURE(status)) | 453 | if (ACPI_FAILURE(status)) | |
435 | return false; | 454 | return false; | |
436 | 455 | |||
437 | nouveau_dsm_priv.rom_handle = rom_handle; | 456 | nouveau_dsm_priv.rom_handle = rom_handle; | |
438 | return true; | 457 | return true; | |
439 | } | 458 | } | |
440 | 459 | |||
441 | int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) | 460 | int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) | |
442 | { | 461 | { | |
443 | return nouveau_rom_call(nouveau_dsm_priv.rom_handle, bios, offset, len); | 462 | return nouveau_rom_call(nouveau_dsm_priv.rom_handle, bios, offset, len); | |
444 | } | 463 | } | |
445 | 464 | |||
446 | void * | 465 | void * | |
447 | nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) | 466 | nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) | |
448 | { | 467 | { | |
468 | #ifdef __NetBSD__ /* XXX nouveau acpi video */ | |||
469 | return NULL; | |||
470 | #else | |||
449 | struct acpi_device *acpidev; | 471 | struct acpi_device *acpidev; | |
450 | acpi_handle handle; | 472 | acpi_handle handle; | |
451 | int type, ret; | 473 | int type, ret; | |
452 | void *edid; | 474 | void *edid; | |
453 | 475 | |||
454 | switch (connector->connector_type) { | 476 | switch (connector->connector_type) { | |
455 | case DRM_MODE_CONNECTOR_LVDS: | 477 | case DRM_MODE_CONNECTOR_LVDS: | |
456 | case DRM_MODE_CONNECTOR_eDP: | 478 | case DRM_MODE_CONNECTOR_eDP: | |
457 | type = ACPI_VIDEO_DISPLAY_LCD; | 479 | type = ACPI_VIDEO_DISPLAY_LCD; | |
458 | break; | 480 | break; | |
459 | default: | 481 | default: | |
460 | return NULL; | 482 | return NULL; | |
461 | } | 483 | } | |
462 | 484 | |||
485 | #ifdef __NetBSD__ | |||
486 | handle = (dev->pdev->pd_ad ? dev->pdev->pd_ad->ad_handle : NULL); | |||
487 | #else | |||
463 | handle = ACPI_HANDLE(&dev->pdev->dev); | 488 | handle = ACPI_HANDLE(&dev->pdev->dev); | |
489 | #endif | |||
464 | if (!handle) | 490 | if (!handle) | |
465 | return NULL; | 491 | return NULL; | |
466 | 492 | |||
467 | ret = acpi_bus_get_device(handle, &acpidev); | 493 | ret = acpi_bus_get_device(handle, &acpidev); | |
468 | if (ret) | 494 | if (ret) | |
469 | return NULL; | 495 | return NULL; | |
470 | 496 | |||
471 | ret = acpi_video_get_edid(acpidev, type, -1, &edid); | 497 | ret = acpi_video_get_edid(acpidev, type, -1, &edid); | |
472 | if (ret < 0) | 498 | if (ret < 0) | |
473 | return NULL; | 499 | return NULL; | |
474 | 500 | |||
475 | return kmemdup(edid, EDID_LENGTH, GFP_KERNEL); | 501 | return kmemdup(edid, EDID_LENGTH, GFP_KERNEL); | |
502 | #endif | |||
476 | } | 503 | } |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h 2022/05/21 17:50:21 1.4
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h 2024/04/16 14:34:02 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: nouveau_drv.h,v 1.4 2022/05/21 17:50:21 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_drv.h,v 1.5 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* SPDX-License-Identifier: MIT */ | 3 | /* SPDX-License-Identifier: MIT */ | |
4 | #ifndef __NOUVEAU_DRV_H__ | 4 | #ifndef __NOUVEAU_DRV_H__ | |
5 | #define __NOUVEAU_DRV_H__ | 5 | #define __NOUVEAU_DRV_H__ | |
6 | 6 | |||
7 | #define DRIVER_AUTHOR "Nouveau Project" | 7 | #define DRIVER_AUTHOR "Nouveau Project" | |
8 | #define DRIVER_EMAIL "nouveau@lists.freedesktop.org" | 8 | #define DRIVER_EMAIL "nouveau@lists.freedesktop.org" | |
9 | 9 | |||
10 | #define DRIVER_NAME "nouveau" | 10 | #define DRIVER_NAME "nouveau" | |
11 | #define DRIVER_DESC "nVidia Riva/TNT/GeForce/Quadro/Tesla/Tegra K1+" | 11 | #define DRIVER_DESC "nVidia Riva/TNT/GeForce/Quadro/Tesla/Tegra K1+" | |
12 | #define DRIVER_DATE "20120801" | 12 | #define DRIVER_DATE "20120801" | |
13 | 13 | |||
14 | #define DRIVER_MAJOR 1 | 14 | #define DRIVER_MAJOR 1 | |
@@ -30,26 +30,27 @@ | @@ -30,26 +30,27 @@ | |||
30 | * - object api exposed to userspace | 30 | * - object api exposed to userspace | |
31 | * - fermi,kepler,maxwell zbc | 31 | * - fermi,kepler,maxwell zbc | |
32 | * 1.2.1: | 32 | * 1.2.1: | |
33 | * - allow concurrent access to bo's mapped read/write. | 33 | * - allow concurrent access to bo's mapped read/write. | |
34 | * 1.2.2: | 34 | * 1.2.2: | |
35 | * - add NOUVEAU_GEM_DOMAIN_COHERENT flag | 35 | * - add NOUVEAU_GEM_DOMAIN_COHERENT flag | |
36 | * 1.3.0: | 36 | * 1.3.0: | |
37 | * - NVIF ABI modified, safe because only (current) users are test | 37 | * - NVIF ABI modified, safe because only (current) users are test | |
38 | * programs that get directly linked with NVKM. | 38 | * programs that get directly linked with NVKM. | |
39 | * 1.3.1: | 39 | * 1.3.1: | |
40 | * - implemented limited ABI16/NVIF interop | 40 | * - implemented limited ABI16/NVIF interop | |
41 | */ | 41 | */ | |
42 | 42 | |||
43 | #include <linux/acpi.h> | |||
43 | #include <linux/notifier.h> | 44 | #include <linux/notifier.h> | |
44 | 45 | |||
45 | #include <nvif/client.h> | 46 | #include <nvif/client.h> | |
46 | #include <nvif/device.h> | 47 | #include <nvif/device.h> | |
47 | #include <nvif/ioctl.h> | 48 | #include <nvif/ioctl.h> | |
48 | #include <nvif/mmu.h> | 49 | #include <nvif/mmu.h> | |
49 | #include <nvif/vmm.h> | 50 | #include <nvif/vmm.h> | |
50 | 51 | |||
51 | #include <drm/drm_connector.h> | 52 | #include <drm/drm_connector.h> | |
52 | #include <drm/drm_device.h> | 53 | #include <drm/drm_device.h> | |
53 | #include <drm/drm_drv.h> | 54 | #include <drm/drm_drv.h> | |
54 | #include <drm/drm_file.h> | 55 | #include <drm/drm_file.h> | |
55 | 56 |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h 2021/12/18 23:45:32 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h 2024/04/16 14:34:02 1.4
@@ -1,29 +1,39 @@ | @@ -1,29 +1,39 @@ | |||
1 | /* $NetBSD: nouveau_acpi.h,v 1.3 2021/12/18 23:45:32 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_acpi.h,v 1.4 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* SPDX-License-Identifier: MIT */ | 3 | /* SPDX-License-Identifier: MIT */ | |
4 | #ifndef __NOUVEAU_ACPI_H__ | 4 | #ifndef __NOUVEAU_ACPI_H__ | |
5 | #define __NOUVEAU_ACPI_H__ | 5 | #define __NOUVEAU_ACPI_H__ | |
6 | 6 | |||
7 | #include <linux/acpi.h> | |||
8 | ||||
7 | #define ROM_BIOS_PAGE 4096 | 9 | #define ROM_BIOS_PAGE 4096 | |
8 | 10 | |||
9 | #if defined(CONFIG_ACPI) && defined(CONFIG_X86) | 11 | #if defined(CONFIG_ACPI) && defined(CONFIG_X86) | |
10 | bool nouveau_is_optimus(void); | 12 | bool nouveau_is_optimus(void); | |
11 | bool nouveau_is_v1_dsm(void); | 13 | bool nouveau_is_v1_dsm(void); | |
12 | void nouveau_register_dsm_handler(void); | 14 | void nouveau_register_dsm_handler(void); | |
13 | void nouveau_unregister_dsm_handler(void); | 15 | void nouveau_unregister_dsm_handler(void); | |
14 | void nouveau_switcheroo_optimus_dsm(void); | 16 | void nouveau_switcheroo_optimus_dsm(void); | |
15 | int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len); | 17 | int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len); | |
18 | #ifdef __NetBSD__ | |||
19 | bool nouveau_acpi_rom_supported(struct acpi_devnode *); | |||
20 | #else | |||
16 | bool nouveau_acpi_rom_supported(struct device *); | 21 | bool nouveau_acpi_rom_supported(struct device *); | |
22 | #endif | |||
17 | void *nouveau_acpi_edid(struct drm_device *, struct drm_connector *); | 23 | void *nouveau_acpi_edid(struct drm_device *, struct drm_connector *); | |
18 | #else | 24 | #else | |
19 | static inline bool nouveau_is_optimus(void) { return false; }; | 25 | static inline bool nouveau_is_optimus(void) { return false; }; | |
20 | static inline bool nouveau_is_v1_dsm(void) { return false; }; | 26 | static inline bool nouveau_is_v1_dsm(void) { return false; }; | |
21 | static inline void nouveau_register_dsm_handler(void) {} | 27 | static inline void nouveau_register_dsm_handler(void) {} | |
22 | static inline void nouveau_unregister_dsm_handler(void) {} | 28 | static inline void nouveau_unregister_dsm_handler(void) {} | |
23 | static inline void nouveau_switcheroo_optimus_dsm(void) {} | 29 | static inline void nouveau_switcheroo_optimus_dsm(void) {} | |
30 | #ifdef __NetBSD__ | |||
31 | static inline bool nouveau_acpi_rom_supported(struct acpi_devnode *acpidev) { return false; } | |||
32 | #else | |||
24 | static inline bool nouveau_acpi_rom_supported(struct device *dev) { return false; } | 33 | static inline bool nouveau_acpi_rom_supported(struct device *dev) { return false; } | |
34 | #endif | |||
25 | static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; } | 35 | static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; } | |
26 | static inline void *nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return NULL; } | 36 | static inline void *nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return NULL; } | |
27 | #endif | 37 | #endif | |
28 | 38 | |||
29 | #endif | 39 | #endif |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c 2021/12/18 23:45:32 1.5
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c 2024/04/16 14:34:02 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: nouveau_display.c,v 1.5 2021/12/18 23:45:32 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_display.c,v 1.6 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 2008 Maarten Maathuis. | 4 | * Copyright (C) 2008 Maarten Maathuis. | |
5 | * All Rights Reserved. | 5 | * All Rights Reserved. | |
6 | * | 6 | * | |
7 | * Permission is hereby granted, free of charge, to any person obtaining | 7 | * Permission is hereby granted, free of charge, to any person obtaining | |
8 | * a copy of this software and associated documentation files (the | 8 | * a copy of this software and associated documentation files (the | |
9 | * "Software"), to deal in the Software without restriction, including | 9 | * "Software"), to deal in the Software without restriction, including | |
10 | * without limitation the rights to use, copy, modify, merge, publish, | 10 | * without limitation the rights to use, copy, modify, merge, publish, | |
11 | * distribute, sublicense, and/or sell copies of the Software, and to | 11 | * distribute, sublicense, and/or sell copies of the Software, and to | |
12 | * permit persons to whom the Software is furnished to do so, subject to | 12 | * permit persons to whom the Software is furnished to do so, subject to | |
13 | * the following conditions: | 13 | * the following conditions: | |
14 | * | 14 | * | |
@@ -17,48 +17,53 @@ | @@ -17,48 +17,53 @@ | |||
17 | * portions of the Software. | 17 | * portions of the Software. | |
18 | * | 18 | * | |
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
22 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | 22 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | |
23 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 23 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
24 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 24 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
26 | * | 26 | * | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: nouveau_display.c,v 1.5 2021/12/18 23:45:32 riastradh Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: nouveau_display.c,v 1.6 2024/04/16 14:34:02 riastradh Exp $"); | |
31 | 31 | |||
32 | #include <acpi/video.h> | 32 | #include <acpi/video.h> | |
33 | 33 | |||
34 | #include <drm/drm_atomic.h> | 34 | #include <drm/drm_atomic.h> | |
35 | #include <drm/drm_atomic_helper.h> | 35 | #include <drm/drm_atomic_helper.h> | |
36 | #include <drm/drm_crtc_helper.h> | 36 | #include <drm/drm_crtc_helper.h> | |
37 | #include <drm/drm_fb_helper.h> | 37 | #include <drm/drm_fb_helper.h> | |
38 | #include <drm/drm_fourcc.h> | 38 | #include <drm/drm_fourcc.h> | |
39 | #include <drm/drm_probe_helper.h> | 39 | #include <drm/drm_probe_helper.h> | |
40 | #include <drm/drm_vblank.h> | 40 | #include <drm/drm_vblank.h> | |
41 | 41 | |||
42 | #include "nouveau_fbcon.h" | 42 | #include "nouveau_fbcon.h" | |
43 | #include "nouveau_crtc.h" | 43 | #include "nouveau_crtc.h" | |
44 | #include "nouveau_gem.h" | 44 | #include "nouveau_gem.h" | |
45 | #include "nouveau_connector.h" | 45 | #include "nouveau_connector.h" | |
46 | #include "nv50_display.h" | 46 | #include "nv50_display.h" | |
47 | 47 | |||
48 | #include <nvif/class.h> | 48 | #include <nvif/class.h> | |
49 | #include <nvif/cl0046.h> | 49 | #include <nvif/cl0046.h> | |
50 | #include <nvif/event.h> | 50 | #include <nvif/event.h> | |
51 | 51 | |||
52 | #ifdef __NetBSD__ | |||
53 | /* Used only for runtime power management, not in NetBSD for now. */ | |||
54 | #undef CONFIG_ACPI | |||
55 | #endif | |||
56 | ||||
52 | static int | 57 | static int | |
53 | nouveau_display_vblank_handler(struct nvif_notify *notify) | 58 | nouveau_display_vblank_handler(struct nvif_notify *notify) | |
54 | { | 59 | { | |
55 | struct nouveau_crtc *nv_crtc = | 60 | struct nouveau_crtc *nv_crtc = | |
56 | container_of(notify, typeof(*nv_crtc), vblank); | 61 | container_of(notify, typeof(*nv_crtc), vblank); | |
57 | drm_crtc_handle_vblank(&nv_crtc->base); | 62 | drm_crtc_handle_vblank(&nv_crtc->base); | |
58 | return NVIF_NOTIFY_KEEP; | 63 | return NVIF_NOTIFY_KEEP; | |
59 | } | 64 | } | |
60 | 65 | |||
61 | int | 66 | int | |
62 | nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe) | 67 | nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe) | |
63 | { | 68 | { | |
64 | struct drm_crtc *crtc; | 69 | struct drm_crtc *crtc; |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h 2021/12/18 23:45:33 1.9
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h 2024/04/16 14:34:02 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: device.h,v 1.9 2021/12/18 23:45:33 riastradh Exp $ */ | 1 | /* $NetBSD: device.h,v 1.10 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* SPDX-License-Identifier: MIT */ | 3 | /* SPDX-License-Identifier: MIT */ | |
4 | #ifndef __NVKM_DEVICE_H__ | 4 | #ifndef __NVKM_DEVICE_H__ | |
5 | #define __NVKM_DEVICE_H__ | 5 | #define __NVKM_DEVICE_H__ | |
6 | #include <core/oclass.h> | 6 | #include <core/oclass.h> | |
7 | #include <core/event.h> | 7 | #include <core/event.h> | |
8 | 8 | |||
9 | enum nvkm_devidx { | 9 | enum nvkm_devidx { | |
10 | NVKM_SUBDEV_PCI, | 10 | NVKM_SUBDEV_PCI, | |
11 | NVKM_SUBDEV_VBIOS, | 11 | NVKM_SUBDEV_VBIOS, | |
12 | NVKM_SUBDEV_DEVINIT, | 12 | NVKM_SUBDEV_DEVINIT, | |
13 | NVKM_SUBDEV_TOP, | 13 | NVKM_SUBDEV_TOP, | |
14 | NVKM_SUBDEV_IBUS, | 14 | NVKM_SUBDEV_IBUS, | |
@@ -82,26 +82,29 @@ enum nvkm_devidx { | @@ -82,26 +82,29 @@ enum nvkm_devidx { | |||
82 | enum nvkm_device_type { | 82 | enum nvkm_device_type { | |
83 | NVKM_DEVICE_PCI, | 83 | NVKM_DEVICE_PCI, | |
84 | NVKM_DEVICE_AGP, | 84 | NVKM_DEVICE_AGP, | |
85 | NVKM_DEVICE_PCIE, | 85 | NVKM_DEVICE_PCIE, | |
86 | NVKM_DEVICE_TEGRA, | 86 | NVKM_DEVICE_TEGRA, | |
87 | }; | 87 | }; | |
88 | 88 | |||
89 | struct nvkm_device { | 89 | struct nvkm_device { | |
90 | const struct nvkm_device_func *func; | 90 | const struct nvkm_device_func *func; | |
91 | const struct nvkm_device_quirk *quirk; | 91 | const struct nvkm_device_quirk *quirk; | |
92 | struct device *dev; | 92 | struct device *dev; | |
93 | enum nvkm_device_type type; | 93 | enum nvkm_device_type type; | |
94 | u64 handle; | 94 | u64 handle; | |
95 | #ifdef __NetBSD__ | |||
96 | struct acpi_devnode *acpidev; | |||
97 | #endif | |||
95 | const char *name; | 98 | const char *name; | |
96 | const char *cfgopt; | 99 | const char *cfgopt; | |
97 | const char *dbgopt; | 100 | const char *dbgopt; | |
98 | 101 | |||
99 | struct list_head head; | 102 | struct list_head head; | |
100 | struct mutex mutex; | 103 | struct mutex mutex; | |
101 | int refcount; | 104 | int refcount; | |
102 | 105 | |||
103 | #ifdef __NetBSD__ | 106 | #ifdef __NetBSD__ | |
104 | bus_space_tag_t mmiot; | 107 | bus_space_tag_t mmiot; | |
105 | bus_space_handle_t mmioh; | 108 | bus_space_handle_t mmioh; | |
106 | bus_addr_t mmioaddr; | 109 | bus_addr_t mmioaddr; | |
107 | bus_size_t mmiosz; | 110 | bus_size_t mmiosz; |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c 2021/12/18 23:45:34 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c 2024/04/16 14:34:02 1.4
@@ -1,45 +1,50 @@ | @@ -1,45 +1,50 @@ | |||
1 | /* $NetBSD: nouveau_nvkm_engine_device_acpi.c,v 1.3 2021/12/18 23:45:34 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_nvkm_engine_device_acpi.c,v 1.4 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2014 Red Hat Inc. | 4 | * Copyright 2014 Red Hat Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | * Authors: Ben Skeggs | 24 | * Authors: Ben Skeggs | |
25 | */ | 25 | */ | |
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_acpi.c,v 1.3 2021/12/18 23:45:34 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_acpi.c,v 1.4 2024/04/16 14:34:02 riastradh Exp $"); | |
28 | 28 | |||
29 | #include "acpi.h" | 29 | #include "acpi.h" | |
30 | 30 | |||
31 | #include <core/device.h> | 31 | #include <core/device.h> | |
32 | 32 | |||
33 | #ifdef __NetBSD__ | |||
34 | /* This should be a PMF hook, not an ACPI notifier. */ | |||
35 | #undef CONFIG_ACPI | |||
36 | #endif | |||
37 | ||||
33 | #ifdef CONFIG_ACPI | 38 | #ifdef CONFIG_ACPI | |
34 | static int | 39 | static int | |
35 | nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data) | 40 | nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data) | |
36 | { | 41 | { | |
37 | struct nvkm_device *device = | 42 | struct nvkm_device *device = | |
38 | container_of(nb, typeof(*device), acpi.nb); | 43 | container_of(nb, typeof(*device), acpi.nb); | |
39 | struct acpi_bus_event *info = data; | 44 | struct acpi_bus_event *info = data; | |
40 | 45 | |||
41 | if (!strcmp(info->device_class, "ac_adapter")) | 46 | if (!strcmp(info->device_class, "ac_adapter")) | |
42 | nvkm_event_send(&device->event, 1, 0, NULL, 0); | 47 | nvkm_event_send(&device->event, 1, 0, NULL, 0); | |
43 | 48 | |||
44 | return NOTIFY_DONE; | 49 | return NOTIFY_DONE; | |
45 | } | 50 | } |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c 2021/12/18 23:45:34 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c 2024/04/16 14:34:02 1.4
@@ -1,38 +1,38 @@ | @@ -1,38 +1,38 @@ | |||
1 | /* $NetBSD: nouveau_nvkm_engine_device_tegra.c,v 1.3 2021/12/18 23:45:34 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_nvkm_engine_device_tegra.c,v 1.4 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
22 | * DEALINGS IN THE SOFTWARE. | 22 | * DEALINGS IN THE SOFTWARE. | |
23 | */ | 23 | */ | |
24 | #include <sys/cdefs.h> | 24 | #include <sys/cdefs.h> | |
25 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_tegra.c,v 1.3 2021/12/18 23:45:34 riastradh Exp $"); | 25 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_tegra.c,v 1.4 2024/04/16 14:34:02 riastradh Exp $"); | |
26 | 26 | |||
27 | #include <core/tegra.h> | 27 | #include <core/tegra.h> | |
28 | #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER | 28 | #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER | |
29 | #include "priv.h" | 29 | #include "priv.h" | |
30 | 30 | |||
31 | #if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) | 31 | #if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) | |
32 | #include <asm/dma-iommu.h> | 32 | #include <asm/dma-iommu.h> | |
33 | #endif | 33 | #endif | |
34 | 34 | |||
35 | static int | 35 | static int | |
36 | nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) | 36 | nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) | |
37 | { | 37 | { | |
38 | int ret; | 38 | int ret; | |
@@ -354,27 +354,31 @@ nvkm_device_tegra_new(const struct nvkm_ | @@ -354,27 +354,31 @@ nvkm_device_tegra_new(const struct nvkm_ | |||
354 | ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(tdev->func->iommu_bit)); | 354 | ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(tdev->func->iommu_bit)); | |
355 | if (ret) | 355 | if (ret) | |
356 | goto free; | 356 | goto free; | |
357 | 357 | |||
358 | nvkm_device_tegra_probe_iommu(tdev); | 358 | nvkm_device_tegra_probe_iommu(tdev); | |
359 | 359 | |||
360 | ret = nvkm_device_tegra_power_up(tdev); | 360 | ret = nvkm_device_tegra_power_up(tdev); | |
361 | if (ret) | 361 | if (ret) | |
362 | goto remove; | 362 | goto remove; | |
363 | 363 | |||
364 | tdev->gpu_speedo = tegra_sku_info.gpu_speedo_value; | 364 | tdev->gpu_speedo = tegra_sku_info.gpu_speedo_value; | |
365 | tdev->gpu_speedo_id = tegra_sku_info.gpu_speedo_id; | 365 | tdev->gpu_speedo_id = tegra_sku_info.gpu_speedo_id; | |
366 | ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev, | 366 | ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev, | |
367 | NVKM_DEVICE_TEGRA, pdev->id, NULL, | 367 | NVKM_DEVICE_TEGRA, pdev->id, | |
368 | #ifdef __NetBSD__ | |||
369 | /*acpidev*/NULL, | |||
370 | #endif | |||
371 | /*name*/NULL, | |||
368 | cfg, dbg, detect, mmio, subdev_mask, | 372 | cfg, dbg, detect, mmio, subdev_mask, | |
369 | &tdev->device); | 373 | &tdev->device); | |
370 | if (ret) | 374 | if (ret) | |
371 | goto powerdown; | 375 | goto powerdown; | |
372 | 376 | |||
373 | *pdevice = &tdev->device; | 377 | *pdevice = &tdev->device; | |
374 | 378 | |||
375 | return 0; | 379 | return 0; | |
376 | 380 | |||
377 | powerdown: | 381 | powerdown: | |
378 | nvkm_device_tegra_power_down(tdev); | 382 | nvkm_device_tegra_power_down(tdev); | |
379 | remove: | 383 | remove: | |
380 | nvkm_device_tegra_remove_iommu(tdev); | 384 | nvkm_device_tegra_remove_iommu(tdev); |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h 2021/12/18 23:45:34 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h 2024/04/16 14:34:02 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: priv.h,v 1.3 2021/12/18 23:45:34 riastradh Exp $ */ | 1 | /* $NetBSD: priv.h,v 1.4 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* SPDX-License-Identifier: MIT */ | 3 | /* SPDX-License-Identifier: MIT */ | |
4 | #ifndef __NVKM_DEVICE_PRIV_H__ | 4 | #ifndef __NVKM_DEVICE_PRIV_H__ | |
5 | #define __NVKM_DEVICE_PRIV_H__ | 5 | #define __NVKM_DEVICE_PRIV_H__ | |
6 | #include <core/device.h> | 6 | #include <core/device.h> | |
7 | 7 | |||
8 | #include <subdev/acr.h> | 8 | #include <subdev/acr.h> | |
9 | #include <subdev/bar.h> | 9 | #include <subdev/bar.h> | |
10 | #include <subdev/bios.h> | 10 | #include <subdev/bios.h> | |
11 | #include <subdev/bus.h> | 11 | #include <subdev/bus.h> | |
12 | #include <subdev/clk.h> | 12 | #include <subdev/clk.h> | |
13 | #include <subdev/devinit.h> | 13 | #include <subdev/devinit.h> | |
14 | #include <subdev/fault.h> | 14 | #include <subdev/fault.h> | |
@@ -44,19 +44,22 @@ | @@ -44,19 +44,22 @@ | |||
44 | #include <engine/msvld.h> | 44 | #include <engine/msvld.h> | |
45 | #include <engine/nvenc.h> | 45 | #include <engine/nvenc.h> | |
46 | #include <engine/nvdec.h> | 46 | #include <engine/nvdec.h> | |
47 | #include <engine/pm.h> | 47 | #include <engine/pm.h> | |
48 | #include <engine/sec.h> | 48 | #include <engine/sec.h> | |
49 | #include <engine/sec2.h> | 49 | #include <engine/sec2.h> | |
50 | #include <engine/sw.h> | 50 | #include <engine/sw.h> | |
51 | #include <engine/vic.h> | 51 | #include <engine/vic.h> | |
52 | #include <engine/vp.h> | 52 | #include <engine/vp.h> | |
53 | 53 | |||
54 | int nvkm_device_ctor(const struct nvkm_device_func *, | 54 | int nvkm_device_ctor(const struct nvkm_device_func *, | |
55 | const struct nvkm_device_quirk *, | 55 | const struct nvkm_device_quirk *, | |
56 | struct device *, enum nvkm_device_type, u64 handle, | 56 | struct device *, enum nvkm_device_type, u64 handle, | |
57 | #ifdef __NetBSD__ /* XXX nouveau acpi */ | |||
58 | struct acpi_devnode *acpidev, | |||
59 | #endif | |||
57 | const char *name, const char *cfg, const char *dbg, | 60 | const char *name, const char *cfg, const char *dbg, | |
58 | bool detect, bool mmio, u64 subdev_mask, | 61 | bool detect, bool mmio, u64 subdev_mask, | |
59 | struct nvkm_device *); | 62 | struct nvkm_device *); | |
60 | int nvkm_device_init(struct nvkm_device *); | 63 | int nvkm_device_init(struct nvkm_device *); | |
61 | int nvkm_device_fini(struct nvkm_device *, bool suspend); | 64 | int nvkm_device_fini(struct nvkm_device *, bool suspend); | |
62 | #endif | 65 | #endif |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c 2021/12/19 10:50:22 1.12
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c 2024/04/16 14:34:02 1.13
@@ -1,40 +1,40 @@ | @@ -1,40 +1,40 @@ | |||
1 | /* $NetBSD: nouveau_nvkm_engine_device_base.c,v 1.12 2021/12/19 10:50:22 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_nvkm_engine_device_base.c,v 1.13 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2012 Red Hat Inc. | 4 | * Copyright 2012 Red Hat Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | * Authors: Ben Skeggs | 24 | * Authors: Ben Skeggs | |
25 | */ | 25 | */ | |
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_base.c,v 1.12 2021/12/19 10:50:22 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_base.c,v 1.13 2024/04/16 14:34:02 riastradh Exp $"); | |
28 | 28 | |||
29 | #include "priv.h" | 29 | #include "priv.h" | |
30 | #include "acpi.h" | 30 | #include "acpi.h" | |
31 | 31 | |||
32 | #include <core/notify.h> | 32 | #include <core/notify.h> | |
33 | #include <core/option.h> | 33 | #include <core/option.h> | |
34 | 34 | |||
35 | #include <subdev/bios.h> | 35 | #include <subdev/bios.h> | |
36 | #include <subdev/therm.h> | 36 | #include <subdev/therm.h> | |
37 | 37 | |||
38 | #ifdef __NetBSD__ | 38 | #ifdef __NetBSD__ | |
39 | #include <linux/nbsd-namespace.h> | 39 | #include <linux/nbsd-namespace.h> | |
40 | static struct mutex nv_devices_mutex; | 40 | static struct mutex nv_devices_mutex; | |
@@ -2951,51 +2951,57 @@ nvkm_device_del(struct nvkm_device **pde | @@ -2951,51 +2951,57 @@ nvkm_device_del(struct nvkm_device **pde | |||
2951 | if (device->func->dtor) | 2951 | if (device->func->dtor) | |
2952 | *pdevice = device->func->dtor(device); | 2952 | *pdevice = device->func->dtor(device); | |
2953 | mutex_unlock(&nv_devices_mutex); | 2953 | mutex_unlock(&nv_devices_mutex); | |
2954 | 2954 | |||
2955 | kfree(*pdevice); | 2955 | kfree(*pdevice); | |
2956 | *pdevice = NULL; | 2956 | *pdevice = NULL; | |
2957 | } | 2957 | } | |
2958 | } | 2958 | } | |
2959 | 2959 | |||
2960 | int | 2960 | int | |
2961 | nvkm_device_ctor(const struct nvkm_device_func *func, | 2961 | nvkm_device_ctor(const struct nvkm_device_func *func, | |
2962 | const struct nvkm_device_quirk *quirk, | 2962 | const struct nvkm_device_quirk *quirk, | |
2963 | struct device *dev, enum nvkm_device_type type, u64 handle, | 2963 | struct device *dev, enum nvkm_device_type type, u64 handle, | |
2964 | #ifdef __NetBSD__ /* XXX nouveau acpi */ | |||
2965 | struct acpi_devnode *acpidev, | |||
2966 | #endif | |||
2964 | const char *name, const char *cfg, const char *dbg, | 2967 | const char *name, const char *cfg, const char *dbg, | |
2965 | bool detect, bool mmio, u64 subdev_mask, | 2968 | bool detect, bool mmio, u64 subdev_mask, | |
2966 | struct nvkm_device *device) | 2969 | struct nvkm_device *device) | |
2967 | { | 2970 | { | |
2968 | struct nvkm_subdev *subdev; | 2971 | struct nvkm_subdev *subdev; | |
2969 | u64 mmio_base, mmio_size; | 2972 | u64 mmio_base, mmio_size; | |
2970 | u32 boot0, strap; | 2973 | u32 boot0, strap; | |
2971 | #ifdef __NetBSD__ | 2974 | #ifdef __NetBSD__ | |
2972 | bus_space_tag_t mmiot; | 2975 | bus_space_tag_t mmiot; | |
2973 | bus_space_handle_t mmioh; | 2976 | bus_space_handle_t mmioh; | |
2974 | #else | 2977 | #else | |
2975 | void __iomem *map; | 2978 | void __iomem *map; | |
2976 | #endif | 2979 | #endif | |
2977 | int ret = -EEXIST, i; | 2980 | int ret = -EEXIST, i; | |
2978 | unsigned chipset; | 2981 | unsigned chipset; | |
2979 | 2982 | |||
2980 | mutex_lock(&nv_devices_mutex); | 2983 | mutex_lock(&nv_devices_mutex); | |
2981 | if (nvkm_device_find_locked(handle)) | 2984 | if (nvkm_device_find_locked(handle)) | |
2982 | goto done; | 2985 | goto done; | |
2983 | 2986 | |||
2984 | device->func = func; | 2987 | device->func = func; | |
2985 | device->quirk = quirk; | 2988 | device->quirk = quirk; | |
2986 | device->dev = dev; | 2989 | device->dev = dev; | |
2987 | device->type = type; | 2990 | device->type = type; | |
2988 | device->handle = handle; | 2991 | device->handle = handle; | |
2992 | #ifdef __NetBSD__ /* XXX nouveau acpi */ | |||
2993 | device->acpidev = acpidev; | |||
2994 | #endif | |||
2989 | device->cfgopt = cfg; | 2995 | device->cfgopt = cfg; | |
2990 | device->dbgopt = dbg; | 2996 | device->dbgopt = dbg; | |
2991 | device->name = name; | 2997 | device->name = name; | |
2992 | list_add_tail(&device->head, &nv_devices); | 2998 | list_add_tail(&device->head, &nv_devices); | |
2993 | device->debug = nvkm_dbgopt(device->dbgopt, "device"); | 2999 | device->debug = nvkm_dbgopt(device->dbgopt, "device"); | |
2994 | 3000 | |||
2995 | ret = nvkm_event_init(&nvkm_device_event_func, 1, 1, &device->event); | 3001 | ret = nvkm_event_init(&nvkm_device_event_func, 1, 1, &device->event); | |
2996 | if (ret) | 3002 | if (ret) | |
2997 | goto done; | 3003 | goto done; | |
2998 | 3004 | |||
2999 | #ifdef __NetBSD__ | 3005 | #ifdef __NetBSD__ | |
3000 | mmiot = device->func->resource_tag(device, 0); | 3006 | mmiot = device->func->resource_tag(device, 0); | |
3001 | #endif | 3007 | #endif |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c 2021/12/19 10:51:57 1.11
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c 2024/04/16 14:34:02 1.12
@@ -1,40 +1,40 @@ | @@ -1,40 +1,40 @@ | |||
1 | /* $NetBSD: nouveau_nvkm_engine_device_pci.c,v 1.11 2021/12/19 10:51:57 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_nvkm_engine_device_pci.c,v 1.12 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2015 Red Hat Inc. | 4 | * Copyright 2015 Red Hat Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | * Authors: Ben Skeggs <bskeggs@redhat.com> | 24 | * Authors: Ben Skeggs <bskeggs@redhat.com> | |
25 | */ | 25 | */ | |
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_pci.c,v 1.11 2021/12/19 10:51:57 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_pci.c,v 1.12 2024/04/16 14:34:02 riastradh Exp $"); | |
28 | 28 | |||
29 | #include <core/pci.h> | 29 | #include <core/pci.h> | |
30 | #include "priv.h" | 30 | #include "priv.h" | |
31 | 31 | |||
32 | struct nvkm_device_pci_device { | 32 | struct nvkm_device_pci_device { | |
33 | u16 device; | 33 | u16 device; | |
34 | const char *name; | 34 | const char *name; | |
35 | const struct nvkm_device_pci_vendor *vendor; | 35 | const struct nvkm_device_pci_vendor *vendor; | |
36 | }; | 36 | }; | |
37 | 37 | |||
38 | struct nvkm_device_pci_vendor { | 38 | struct nvkm_device_pci_vendor { | |
39 | u16 vendor; | 39 | u16 vendor; | |
40 | u16 device; | 40 | u16 device; | |
@@ -1711,27 +1711,31 @@ nvkm_device_pci_new(struct pci_dev *pci_ | @@ -1711,27 +1711,31 @@ nvkm_device_pci_new(struct pci_dev *pci_ | |||
1711 | return -ENOMEM; | 1711 | return -ENOMEM; | |
1712 | } | 1712 | } | |
1713 | *pdevice = &pdev->device; | 1713 | *pdevice = &pdev->device; | |
1714 | pdev->pdev = pci_dev; | 1714 | pdev->pdev = pci_dev; | |
1715 | 1715 | |||
1716 | ret = nvkm_device_ctor(&nvkm_device_pci_func, quirk, | 1716 | ret = nvkm_device_ctor(&nvkm_device_pci_func, quirk, | |
1717 | pci_dev_dev(pci_dev), | 1717 | pci_dev_dev(pci_dev), | |
1718 | pci_is_pcie(pci_dev) ? NVKM_DEVICE_PCIE : | 1718 | pci_is_pcie(pci_dev) ? NVKM_DEVICE_PCIE : | |
1719 | pci_find_capability(pci_dev, PCI_CAP_ID_AGP) ? | 1719 | pci_find_capability(pci_dev, PCI_CAP_ID_AGP) ? | |
1720 | NVKM_DEVICE_AGP : NVKM_DEVICE_PCI, | 1720 | NVKM_DEVICE_AGP : NVKM_DEVICE_PCI, | |
1721 | (u64)pci_domain_nr(pci_dev->bus) << 32 | | 1721 | (u64)pci_domain_nr(pci_dev->bus) << 32 | | |
1722 | pci_dev->bus->number << 16 | | 1722 | pci_dev->bus->number << 16 | | |
1723 | PCI_SLOT(pci_dev->devfn) << 8 | | 1723 | PCI_SLOT(pci_dev->devfn) << 8 | | |
1724 | PCI_FUNC(pci_dev->devfn), name, | 1724 | PCI_FUNC(pci_dev->devfn), | |
1725 | #ifdef __NetBSD__ | |||
1726 | /*acpidev*/pci_dev->pd_ad, | |||
1727 | #endif | |||
1728 | name, | |||
1725 | cfg, dbg, detect, mmio, subdev_mask, | 1729 | cfg, dbg, detect, mmio, subdev_mask, | |
1726 | &pdev->device); | 1730 | &pdev->device); | |
1727 | 1731 | |||
1728 | if (ret) | 1732 | if (ret) | |
1729 | return ret; | 1733 | return ret; | |
1730 | 1734 | |||
1731 | /* Set DMA mask based on capabilities reported by the MMU subdev. */ | 1735 | /* Set DMA mask based on capabilities reported by the MMU subdev. */ | |
1732 | if (pdev->device.mmu && !pdev->device.pci->agp.bridge) | 1736 | if (pdev->device.mmu && !pdev->device.pci->agp.bridge) | |
1733 | bits = pdev->device.mmu->dma_bits; | 1737 | bits = pdev->device.mmu->dma_bits; | |
1734 | else | 1738 | else | |
1735 | bits = 32; | 1739 | bits = 32; | |
1736 | 1740 | |||
1737 | #ifdef __NetBSD__ | 1741 | #ifdef __NetBSD__ |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c 2021/12/18 23:45:38 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c 2024/04/16 14:34:02 1.4
@@ -1,48 +1,56 @@ | @@ -1,48 +1,56 @@ | |||
1 | /* $NetBSD: nouveau_nvkm_subdev_bios_shadowacpi.c,v 1.3 2021/12/18 23:45:38 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_nvkm_subdev_bios_shadowacpi.c,v 1.4 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2012 Red Hat Inc. | 4 | * Copyright 2012 Red Hat Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | */ | 24 | */ | |
25 | #include <sys/cdefs.h> | 25 | #include <sys/cdefs.h> | |
26 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_bios_shadowacpi.c,v 1.3 2021/12/18 23:45:38 riastradh Exp $"); | 26 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_bios_shadowacpi.c,v 1.4 2024/04/16 14:34:02 riastradh Exp $"); | |
27 | 27 | |||
28 | #include "priv.h" | 28 | #include "priv.h" | |
29 | 29 | |||
30 | #if defined(CONFIG_ACPI) && defined(CONFIG_X86) | 30 | #if defined(CONFIG_ACPI) && defined(CONFIG_X86) | |
31 | int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len); | 31 | int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len); | |
32 | #ifdef __NetBSD__ | |||
33 | bool nouveau_acpi_rom_supported(struct acpi_devnode *); | |||
34 | #else | |||
32 | bool nouveau_acpi_rom_supported(struct device *); | 35 | bool nouveau_acpi_rom_supported(struct device *); | |
36 | #endif | |||
33 | #else | 37 | #else | |
34 | static inline bool | 38 | static inline bool | |
39 | #ifdef __NetBSD__ | |||
40 | nouveau_acpi_rom_supported(struct acpi_devnode *dev) | |||
41 | #else | |||
35 | nouveau_acpi_rom_supported(struct device *dev) | 42 | nouveau_acpi_rom_supported(struct device *dev) | |
43 | #endif | |||
36 | { | 44 | { | |
37 | return false; | 45 | return false; | |
38 | } | 46 | } | |
39 | 47 | |||
40 | static inline int | 48 | static inline int | |
41 | nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) | 49 | nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) | |
42 | { | 50 | { | |
43 | return -EINVAL; | 51 | return -EINVAL; | |
44 | } | 52 | } | |
45 | #endif | 53 | #endif | |
46 | 54 | |||
47 | /* This version of the shadow function disobeys the ACPI spec and tries | 55 | /* This version of the shadow function disobeys the ACPI spec and tries | |
48 | * to fetch in units of more than 4KiB at a time. This is a LOT faster | 56 | * to fetch in units of more than 4KiB at a time. This is a LOT faster | |
@@ -83,27 +91,27 @@ acpi_read_slow(void *data, u32 offset, u | @@ -83,27 +91,27 @@ acpi_read_slow(void *data, u32 offset, u | |||
83 | 0x1000); | 91 | 0x1000); | |
84 | if (ret != 0x1000) | 92 | if (ret != 0x1000) | |
85 | break; | 93 | break; | |
86 | fetch += 0x1000; | 94 | fetch += 0x1000; | |
87 | } | 95 | } | |
88 | } | 96 | } | |
89 | 97 | |||
90 | return fetch; | 98 | return fetch; | |
91 | } | 99 | } | |
92 | 100 | |||
93 | static void * | 101 | static void * | |
94 | acpi_init(struct nvkm_bios *bios, const char *name) | 102 | acpi_init(struct nvkm_bios *bios, const char *name) | |
95 | { | 103 | { | |
96 | if (!nouveau_acpi_rom_supported(bios->subdev.device->dev)) | 104 | if (!nouveau_acpi_rom_supported(bios->subdev.device->acpidev)) | |
97 | return ERR_PTR(-ENODEV); | 105 | return ERR_PTR(-ENODEV); | |
98 | return NULL; | 106 | return NULL; | |
99 | } | 107 | } | |
100 | 108 | |||
101 | const struct nvbios_source | 109 | const struct nvbios_source | |
102 | nvbios_acpi_fast = { | 110 | nvbios_acpi_fast = { | |
103 | .name = "ACPI", | 111 | .name = "ACPI", | |
104 | .init = acpi_init, | 112 | .init = acpi_init, | |
105 | .read = acpi_read_fast, | 113 | .read = acpi_read_fast, | |
106 | .rw = false, | 114 | .rw = false, | |
107 | .require_checksum = true, | 115 | .require_checksum = true, | |
108 | }; | 116 | }; | |
109 | 117 |
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c 2022/02/27 14:24:27 1.4
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c 2024/04/16 14:34:02 1.5
@@ -1,48 +1,57 @@ | @@ -1,48 +1,57 @@ | |||
1 | /* $NetBSD: nouveau_nvkm_subdev_mxm_base.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $ */ | 1 | /* $NetBSD: nouveau_nvkm_subdev_mxm_base.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2011 Red Hat Inc. | 4 | * Copyright 2011 Red Hat Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | * Authors: Ben Skeggs | 24 | * Authors: Ben Skeggs | |
25 | */ | 25 | */ | |
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mxm_base.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mxm_base.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $"); | |
28 | 28 | |||
29 | #include "mxms.h" | 29 | #include "mxms.h" | |
30 | 30 | |||
31 | #include <core/option.h> | 31 | #include <core/option.h> | |
32 | #include <subdev/bios.h> | 32 | #include <subdev/bios.h> | |
33 | #include <subdev/bios/mxm.h> | 33 | #include <subdev/bios/mxm.h> | |
34 | #include <subdev/i2c.h> | 34 | #include <subdev/i2c.h> | |
35 | 35 | |||
36 | #ifdef __NetBSD__ | |||
37 | #ifdef CONFIG_ACPI | |||
38 | #include <dev/acpi/acpireg.h> | |||
39 | #define _COMPONENT ACPI_DISPLAY_COMPONENT | |||
40 | ACPI_MODULE_NAME("nouveau_nvkm_subdev_mxm_base") | |||
41 | #include <linux/nbsd-namespace-acpi.h> | |||
42 | #endif | |||
43 | #endif | |||
44 | ||||
36 | static bool | 45 | static bool | |
37 | mxm_shadow_rom_fetch(struct nvkm_i2c_bus *bus, u8 addr, | 46 | mxm_shadow_rom_fetch(struct nvkm_i2c_bus *bus, u8 addr, | |
38 | u8 offset, u8 size, u8 *data) | 47 | u8 offset, u8 size, u8 *data) | |
39 | { | 48 | { | |
40 | struct i2c_msg msgs[] = { | 49 | struct i2c_msg msgs[] = { | |
41 | { .addr = addr, .flags = 0, .len = 1, .buf = &offset }, | 50 | { .addr = addr, .flags = 0, .len = 1, .buf = &offset }, | |
42 | { .addr = addr, .flags = I2C_M_RD, .len = size, .buf = data, }, | 51 | { .addr = addr, .flags = I2C_M_RD, .len = size, .buf = data, }, | |
43 | }; | 52 | }; | |
44 | 53 | |||
45 | return i2c_transfer(&bus->i2c, msgs, 2) == 2; | 54 | return i2c_transfer(&bus->i2c, msgs, 2) == 2; | |
46 | } | 55 | } | |
47 | 56 | |||
48 | static bool | 57 | static bool | |
@@ -89,27 +98,31 @@ mxm_shadow_dsm(struct nvkm_mxm *mxm, u8 | @@ -89,27 +98,31 @@ mxm_shadow_dsm(struct nvkm_mxm *mxm, u8 | |||
89 | static guid_t muid = | 98 | static guid_t muid = | |
90 | GUID_INIT(0x4004A400, 0x917D, 0x4CF2, | 99 | GUID_INIT(0x4004A400, 0x917D, 0x4CF2, | |
91 | 0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65); | 100 | 0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65); | |
92 | u32 mxms_args[] = { 0x00000000 }; | 101 | u32 mxms_args[] = { 0x00000000 }; | |
93 | union acpi_object argv4 = { | 102 | union acpi_object argv4 = { | |
94 | .buffer.type = ACPI_TYPE_BUFFER, | 103 | .buffer.type = ACPI_TYPE_BUFFER, | |
95 | .buffer.length = sizeof(mxms_args), | 104 | .buffer.length = sizeof(mxms_args), | |
96 | .buffer.pointer = (char *)mxms_args, | 105 | .buffer.pointer = (char *)mxms_args, | |
97 | }; | 106 | }; | |
98 | union acpi_object *obj; | 107 | union acpi_object *obj; | |
99 | acpi_handle handle; | 108 | acpi_handle handle; | |
100 | int rev; | 109 | int rev; | |
101 | 110 | |||
111 | #ifdef __NetBSD__ | |||
112 | handle = (device->acpidev ? device->acpidev->ad_handle : NULL); | |||
113 | #else | |||
102 | handle = ACPI_HANDLE(device->dev); | 114 | handle = ACPI_HANDLE(device->dev); | |
115 | #endif | |||
103 | if (!handle) | 116 | if (!handle) | |
104 | return false; | 117 | return false; | |
105 | 118 | |||
106 | /* | 119 | /* | |
107 | * spec says this can be zero to mean "highest revision", but | 120 | * spec says this can be zero to mean "highest revision", but | |
108 | * of course there's at least one bios out there which fails | 121 | * of course there's at least one bios out there which fails | |
109 | * unless you pass in exactly the version it supports.. | 122 | * unless you pass in exactly the version it supports.. | |
110 | */ | 123 | */ | |
111 | rev = (version & 0xf0) << 4 | (version & 0x0f); | 124 | rev = (version & 0xf0) << 4 | (version & 0x0f); | |
112 | obj = acpi_evaluate_dsm(handle, &muid, rev, 0x00000010, &argv4); | 125 | obj = acpi_evaluate_dsm(handle, &muid, rev, 0x00000010, &argv4); | |
113 | if (!obj) { | 126 | if (!obj) { | |
114 | nvkm_debug(subdev, "DSM MXMS failed\n"); | 127 | nvkm_debug(subdev, "DSM MXMS failed\n"); | |
115 | return false; | 128 | return false; |
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h 2021/12/19 11:52:38 1.11
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h 2024/04/16 14:34:02 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: radeon.h,v 1.11 2021/12/19 11:52:38 riastradh Exp $ */ | 1 | /* $NetBSD: radeon.h,v 1.12 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2008 Advanced Micro Devices, Inc. | 4 | * Copyright 2008 Advanced Micro Devices, Inc. | |
5 | * Copyright 2008 Red Hat Inc. | 5 | * Copyright 2008 Red Hat Inc. | |
6 | * Copyright 2009 Jerome Glisse. | 6 | * Copyright 2009 Jerome Glisse. | |
7 | * | 7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a | 8 | * Permission is hereby granted, free of charge, to any person obtaining a | |
9 | * copy of this software and associated documentation files (the "Software"), | 9 | * copy of this software and associated documentation files (the "Software"), | |
10 | * to deal in the Software without restriction, including without limitation | 10 | * to deal in the Software without restriction, including without limitation | |
11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
12 | * and/or sell copies of the Software, and to permit persons to whom the | 12 | * and/or sell copies of the Software, and to permit persons to whom the | |
13 | * Software is furnished to do so, subject to the following conditions: | 13 | * Software is furnished to do so, subject to the following conditions: | |
14 | * | 14 | * | |
@@ -59,26 +59,27 @@ | @@ -59,26 +59,27 @@ | |||
59 | * follow guideline the first thing this | 59 | * follow guideline the first thing this | |
60 | * function should do is setting the GPU | 60 | * function should do is setting the GPU | |
61 | * memory controller (only MC setup failure | 61 | * memory controller (only MC setup failure | |
62 | * are considered as fatal) | 62 | * are considered as fatal) | |
63 | */ | 63 | */ | |
64 | 64 | |||
65 | #include <linux/atomic.h> | 65 | #include <linux/atomic.h> | |
66 | #include <linux/wait.h> | 66 | #include <linux/wait.h> | |
67 | #include <linux/list.h> | 67 | #include <linux/list.h> | |
68 | #include <linux/kref.h> | 68 | #include <linux/kref.h> | |
69 | #include <linux/interval_tree.h> | 69 | #include <linux/interval_tree.h> | |
70 | #include <linux/hashtable.h> | 70 | #include <linux/hashtable.h> | |
71 | #include <linux/dma-fence.h> | 71 | #include <linux/dma-fence.h> | |
72 | #include <linux/acpi.h> | |||
72 | 73 | |||
73 | #ifdef CONFIG_MMU_NOTIFIER | 74 | #ifdef CONFIG_MMU_NOTIFIER | |
74 | #include <linux/mmu_notifier.h> | 75 | #include <linux/mmu_notifier.h> | |
75 | #endif | 76 | #endif | |
76 | 77 | |||
77 | #include <drm/ttm/ttm_bo_api.h> | 78 | #include <drm/ttm/ttm_bo_api.h> | |
78 | #include <drm/ttm/ttm_bo_driver.h> | 79 | #include <drm/ttm/ttm_bo_driver.h> | |
79 | #include <drm/ttm/ttm_placement.h> | 80 | #include <drm/ttm/ttm_placement.h> | |
80 | #include <drm/ttm/ttm_module.h> | 81 | #include <drm/ttm/ttm_module.h> | |
81 | #include <drm/ttm/ttm_execbuf_util.h> | 82 | #include <drm/ttm/ttm_execbuf_util.h> | |
82 | 83 | |||
83 | #include <drm/drm_gem.h> | 84 | #include <drm/drm_gem.h> | |
84 | 85 |
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c 2022/02/27 14:24:27 1.4
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c 2024/04/16 14:34:02 1.5
@@ -1,57 +1,65 @@ | @@ -1,57 +1,65 @@ | |||
1 | /* $NetBSD: radeon_acpi.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $ */ | 1 | /* $NetBSD: radeon_acpi.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2012 Advanced Micro Devices, Inc. | 4 | * Copyright 2012 Advanced Micro Devices, Inc. | |
5 | * | 5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | 8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | 10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | 11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | 12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. | |
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
22 | * OTHER DEALINGS IN THE SOFTWARE. | 22 | * OTHER DEALINGS IN THE SOFTWARE. | |
23 | * | 23 | * | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: radeon_acpi.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: radeon_acpi.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $"); | |
28 | 28 | |||
29 | #include <linux/acpi.h> | 29 | #include <linux/acpi.h> | |
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> | |
31 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> | |
32 | #include <linux/power_supply.h> | 32 | #include <linux/power_supply.h> | |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> | |
34 | 34 | |||
35 | #include <acpi/acpi_bus.h> | 35 | #include <acpi/acpi_bus.h> | |
36 | #include <acpi/video.h> | 36 | #include <acpi/video.h> | |
37 | 37 | |||
38 | #include <drm/drm_crtc_helper.h> | 38 | #include <drm/drm_crtc_helper.h> | |
39 | #include <drm/drm_probe_helper.h> | 39 | #include <drm/drm_probe_helper.h> | |
40 | 40 | |||
41 | #include "atom.h" | 41 | #include "atom.h" | |
42 | #include "radeon.h" | 42 | #include "radeon.h" | |
43 | #include "radeon_acpi.h" | 43 | #include "radeon_acpi.h" | |
44 | 44 | |||
45 | #ifdef __NetBSD__ | |||
46 | #include <dev/acpi/acpi_pci.h> | |||
47 | #include <dev/acpi/acpireg.h> | |||
48 | #define _COMPONENT ACPI_DISPLAY_COMPONENT | |||
49 | ACPI_MODULE_NAME("radeon_acpi") | |||
50 | #include <linux/nbsd-namespace-acpi.h> | |||
51 | #endif | |||
52 | ||||
45 | #if defined(CONFIG_VGA_SWITCHEROO) | 53 | #if defined(CONFIG_VGA_SWITCHEROO) | |
46 | bool radeon_atpx_dgpu_req_power_for_displays(void); | 54 | bool radeon_atpx_dgpu_req_power_for_displays(void); | |
47 | #else | 55 | #else | |
48 | static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; } | 56 | static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; } | |
49 | #endif | 57 | #endif | |
50 | 58 | |||
51 | #define ACPI_AC_CLASS "ac_adapter" | 59 | #define ACPI_AC_CLASS "ac_adapter" | |
52 | 60 | |||
53 | extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev); | 61 | extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev); | |
54 | 62 | |||
55 | struct atif_verify_interface { | 63 | struct atif_verify_interface { | |
56 | u16 size; /* structure size in bytes (includes size field) */ | 64 | u16 size; /* structure size in bytes (includes size field) */ | |
57 | u16 version; /* version */ | 65 | u16 version; /* version */ | |
@@ -300,26 +308,28 @@ static int radeon_atif_get_notification_ | @@ -300,26 +308,28 @@ static int radeon_atif_get_notification_ | |||
300 | } | 308 | } | |
301 | n->enabled = true; | 309 | n->enabled = true; | |
302 | n->command_code = params.command_code; | 310 | n->command_code = params.command_code; | |
303 | } | 311 | } | |
304 | 312 | |||
305 | out: | 313 | out: | |
306 | DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n", | 314 | DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n", | |
307 | (n->enabled ? "enabled" : "disabled"), | 315 | (n->enabled ? "enabled" : "disabled"), | |
308 | n->command_code); | 316 | n->command_code); | |
309 | ACPI_FREE(info); | 317 | ACPI_FREE(info); | |
310 | return err; | 318 | return err; | |
311 | } | 319 | } | |
312 | 320 | |||
321 | #ifndef __NetBSD__ /* XXX radeon acpi */ | |||
322 | ||||
313 | /** | 323 | /** | |
314 | * radeon_atif_get_sbios_requests - get requested sbios event | 324 | * radeon_atif_get_sbios_requests - get requested sbios event | |
315 | * | 325 | * | |
316 | * @handle: acpi handle | 326 | * @handle: acpi handle | |
317 | * @req: atif sbios request struct | 327 | * @req: atif sbios request struct | |
318 | * | 328 | * | |
319 | * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function | 329 | * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function | |
320 | * to determine what requests the sbios is making to the driver | 330 | * to determine what requests the sbios is making to the driver | |
321 | * (all asics). | 331 | * (all asics). | |
322 | * Returns 0 on success, error on failure. | 332 | * Returns 0 on success, error on failure. | |
323 | */ | 333 | */ | |
324 | static int radeon_atif_get_sbios_requests(acpi_handle handle, | 334 | static int radeon_atif_get_sbios_requests(acpi_handle handle, | |
325 | struct atif_sbios_requests *req) | 335 | struct atif_sbios_requests *req) | |
@@ -420,26 +430,28 @@ static int radeon_atif_handler(struct ra | @@ -420,26 +430,28 @@ static int radeon_atif_handler(struct ra | |||
420 | pm_runtime_put_autosuspend(rdev->ddev->dev); | 430 | pm_runtime_put_autosuspend(rdev->ddev->dev); | |
421 | } | 431 | } | |
422 | } | 432 | } | |
423 | /* TODO: check other events */ | 433 | /* TODO: check other events */ | |
424 | 434 | |||
425 | /* We've handled the event, stop the notifier chain. The ACPI interface | 435 | /* We've handled the event, stop the notifier chain. The ACPI interface | |
426 | * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to | 436 | * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to | |
427 | * userspace if the event was generated only to signal a SBIOS | 437 | * userspace if the event was generated only to signal a SBIOS | |
428 | * request. | 438 | * request. | |
429 | */ | 439 | */ | |
430 | return NOTIFY_BAD; | 440 | return NOTIFY_BAD; | |
431 | } | 441 | } | |
432 | 442 | |||
443 | #endif /* __NetBSD__ */ | |||
444 | ||||
433 | /* Call the ATCS method | 445 | /* Call the ATCS method | |
434 | */ | 446 | */ | |
435 | /** | 447 | /** | |
436 | * radeon_atcs_call - call an ATCS method | 448 | * radeon_atcs_call - call an ATCS method | |
437 | * | 449 | * | |
438 | * @handle: acpi handle | 450 | * @handle: acpi handle | |
439 | * @function: the ATCS function to execute | 451 | * @function: the ATCS function to execute | |
440 | * @params: ATCS function params | 452 | * @params: ATCS function params | |
441 | * | 453 | * | |
442 | * Executes the requested ATCS function (all asics). | 454 | * Executes the requested ATCS function (all asics). | |
443 | * Returns a pointer to the acpi output buffer. | 455 | * Returns a pointer to the acpi output buffer. | |
444 | */ | 456 | */ | |
445 | static union acpi_object *radeon_atcs_call(acpi_handle handle, int function, | 457 | static union acpi_object *radeon_atcs_call(acpi_handle handle, int function, | |
@@ -567,27 +579,37 @@ bool radeon_acpi_is_pcie_performance_req | @@ -567,27 +579,37 @@ bool radeon_acpi_is_pcie_performance_req | |||
567 | * @rdev: radeon_device pointer | 579 | * @rdev: radeon_device pointer | |
568 | * | 580 | * | |
569 | * Executes the PCIE_DEVICE_READY_NOTIFICATION method | 581 | * Executes the PCIE_DEVICE_READY_NOTIFICATION method | |
570 | * (all asics). | 582 | * (all asics). | |
571 | * returns 0 on success, error on failure. | 583 | * returns 0 on success, error on failure. | |
572 | */ | 584 | */ | |
573 | int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev) | 585 | int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev) | |
574 | { | 586 | { | |
575 | acpi_handle handle; | 587 | acpi_handle handle; | |
576 | union acpi_object *info; | 588 | union acpi_object *info; | |
577 | struct radeon_atcs *atcs = &rdev->atcs; | 589 | struct radeon_atcs *atcs = &rdev->atcs; | |
578 | 590 | |||
579 | /* Get the device handle */ | 591 | /* Get the device handle */ | |
592 | #ifdef __NetBSD__ | |||
593 | const struct pci_attach_args *pa = &rdev->pdev->pd_pa; | |||
594 | struct acpi_devnode *const d = | |||
595 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), | |||
596 | pa->pa_bus, pa->pa_device, pa->pa_function); | |||
597 | if (d == NULL) | |||
598 | return -EINVAL; | |||
599 | handle = d->ad_handle; | |||
600 | #else | |||
580 | handle = ACPI_HANDLE(&rdev->pdev->dev); | 601 | handle = ACPI_HANDLE(&rdev->pdev->dev); | |
602 | #endif | |||
581 | if (!handle) | 603 | if (!handle) | |
582 | return -EINVAL; | 604 | return -EINVAL; | |
583 | 605 | |||
584 | if (!atcs->functions.pcie_dev_rdy) | 606 | if (!atcs->functions.pcie_dev_rdy) | |
585 | return -EINVAL; | 607 | return -EINVAL; | |
586 | 608 | |||
587 | info = radeon_atcs_call(handle, ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION, NULL); | 609 | info = radeon_atcs_call(handle, ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION, NULL); | |
588 | if (!info) | 610 | if (!info) | |
589 | return -EIO; | 611 | return -EIO; | |
590 | 612 | |||
591 | ACPI_FREE(info); | 613 | ACPI_FREE(info); | |
592 | 614 | |||
593 | return 0; | 615 | return 0; | |
@@ -607,27 +629,37 @@ int radeon_acpi_pcie_notify_device_ready | @@ -607,27 +629,37 @@ int radeon_acpi_pcie_notify_device_ready | |||
607 | int radeon_acpi_pcie_performance_request(struct radeon_device *rdev, | 629 | int radeon_acpi_pcie_performance_request(struct radeon_device *rdev, | |
608 | u8 perf_req, bool advertise) | 630 | u8 perf_req, bool advertise) | |
609 | { | 631 | { | |
610 | acpi_handle handle; | 632 | acpi_handle handle; | |
611 | union acpi_object *info; | 633 | union acpi_object *info; | |
612 | struct radeon_atcs *atcs = &rdev->atcs; | 634 | struct radeon_atcs *atcs = &rdev->atcs; | |
613 | struct atcs_pref_req_input atcs_input; | 635 | struct atcs_pref_req_input atcs_input; | |
614 | struct atcs_pref_req_output atcs_output; | 636 | struct atcs_pref_req_output atcs_output; | |
615 | struct acpi_buffer params; | 637 | struct acpi_buffer params; | |
616 | size_t size; | 638 | size_t size; | |
617 | u32 retry = 3; | 639 | u32 retry = 3; | |
618 | 640 | |||
619 | /* Get the device handle */ | 641 | /* Get the device handle */ | |
642 | #ifdef __NetBSD__ | |||
643 | const struct pci_attach_args *pa = &rdev->pdev->pd_pa; | |||
644 | struct acpi_devnode *const d = | |||
645 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), | |||
646 | pa->pa_bus, pa->pa_device, pa->pa_function); | |||
647 | if (d == NULL) | |||
648 | return -EINVAL; | |||
649 | handle = d->ad_handle; | |||
650 | #else | |||
620 | handle = ACPI_HANDLE(&rdev->pdev->dev); | 651 | handle = ACPI_HANDLE(&rdev->pdev->dev); | |
652 | #endif | |||
621 | if (!handle) | 653 | if (!handle) | |
622 | return -EINVAL; | 654 | return -EINVAL; | |
623 | 655 | |||
624 | if (!atcs->functions.pcie_perf_req) | 656 | if (!atcs->functions.pcie_perf_req) | |
625 | return -EINVAL; | 657 | return -EINVAL; | |
626 | 658 | |||
627 | atcs_input.size = sizeof(struct atcs_pref_req_input); | 659 | atcs_input.size = sizeof(struct atcs_pref_req_input); | |
628 | /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */ | 660 | /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */ | |
629 | atcs_input.client_id = rdev->pdev->devfn | (rdev->pdev->bus->number << 8); | 661 | atcs_input.client_id = rdev->pdev->devfn | (rdev->pdev->bus->number << 8); | |
630 | atcs_input.valid_flags_mask = ATCS_VALID_FLAGS_MASK; | 662 | atcs_input.valid_flags_mask = ATCS_VALID_FLAGS_MASK; | |
631 | atcs_input.flags = ATCS_WAIT_FOR_COMPLETION; | 663 | atcs_input.flags = ATCS_WAIT_FOR_COMPLETION; | |
632 | if (advertise) | 664 | if (advertise) | |
633 | atcs_input.flags |= ATCS_ADVERTISE_CAPS; | 665 | atcs_input.flags |= ATCS_ADVERTISE_CAPS; | |
@@ -672,65 +704,77 @@ int radeon_acpi_pcie_performance_request | @@ -672,65 +704,77 @@ int radeon_acpi_pcie_performance_request | |||
672 | } | 704 | } | |
673 | 705 | |||
674 | /** | 706 | /** | |
675 | * radeon_acpi_event - handle notify events | 707 | * radeon_acpi_event - handle notify events | |
676 | * | 708 | * | |
677 | * @nb: notifier block | 709 | * @nb: notifier block | |
678 | * @val: val | 710 | * @val: val | |
679 | * @data: acpi event | 711 | * @data: acpi event | |
680 | * | 712 | * | |
681 | * Calls relevant radeon functions in response to various | 713 | * Calls relevant radeon functions in response to various | |
682 | * acpi events. | 714 | * acpi events. | |
683 | * Returns NOTIFY code | 715 | * Returns NOTIFY code | |
684 | */ | 716 | */ | |
717 | #ifndef __NetBSD__ /* XXX radeon acpi */ | |||
685 | static int radeon_acpi_event(struct notifier_block *nb, | 718 | static int radeon_acpi_event(struct notifier_block *nb, | |
686 | unsigned long val, | 719 | unsigned long val, | |
687 | void *data) | 720 | void *data) | |
688 | { | 721 | { | |
689 | struct radeon_device *rdev = container_of(nb, struct radeon_device, acpi_nb); | 722 | struct radeon_device *rdev = container_of(nb, struct radeon_device, acpi_nb); | |
690 | struct acpi_bus_event *entry = (struct acpi_bus_event *)data; | 723 | struct acpi_bus_event *entry = (struct acpi_bus_event *)data; | |
691 | 724 | |||
692 | if (strcmp(entry->device_class, ACPI_AC_CLASS) == 0) { | 725 | if (strcmp(entry->device_class, ACPI_AC_CLASS) == 0) { | |
693 | if (power_supply_is_system_supplied() > 0) | 726 | if (power_supply_is_system_supplied() > 0) | |
694 | DRM_DEBUG_DRIVER("pm: AC\n"); | 727 | DRM_DEBUG_DRIVER("pm: AC\n"); | |
695 | else | 728 | else | |
696 | DRM_DEBUG_DRIVER("pm: DC\n"); | 729 | DRM_DEBUG_DRIVER("pm: DC\n"); | |
697 | 730 | |||
698 | radeon_pm_acpi_event_handler(rdev); | 731 | radeon_pm_acpi_event_handler(rdev); | |
699 | } | 732 | } | |
700 | 733 | |||
701 | /* Check for pending SBIOS requests */ | 734 | /* Check for pending SBIOS requests */ | |
702 | return radeon_atif_handler(rdev, entry); | 735 | return radeon_atif_handler(rdev, entry); | |
703 | } | 736 | } | |
737 | #endif | |||
704 | 738 | |||
705 | /* Call all ACPI methods here */ | 739 | /* Call all ACPI methods here */ | |
706 | /** | 740 | /** | |
707 | * radeon_acpi_init - init driver acpi support | 741 | * radeon_acpi_init - init driver acpi support | |
708 | * | 742 | * | |
709 | * @rdev: radeon_device pointer | 743 | * @rdev: radeon_device pointer | |
710 | * | 744 | * | |
711 | * Verifies the AMD ACPI interfaces and registers with the acpi | 745 | * Verifies the AMD ACPI interfaces and registers with the acpi | |
712 | * notifier chain (all asics). | 746 | * notifier chain (all asics). | |
713 | * Returns 0 on success, error on failure. | 747 | * Returns 0 on success, error on failure. | |
714 | */ | 748 | */ | |
715 | int radeon_acpi_init(struct radeon_device *rdev) | 749 | int radeon_acpi_init(struct radeon_device *rdev) | |
716 | { | 750 | { | |
717 | acpi_handle handle; | 751 | acpi_handle handle; | |
718 | struct radeon_atif *atif = &rdev->atif; | 752 | struct radeon_atif *atif = &rdev->atif; | |
719 | struct radeon_atcs *atcs = &rdev->atcs; | 753 | struct radeon_atcs *atcs = &rdev->atcs; | |
720 | int ret; | 754 | int ret; | |
721 | 755 | |||
722 | /* Get the device handle */ | 756 | /* Get the device handle */ | |
757 | #ifdef __NetBSD__ | |||
758 | const struct pci_attach_args *pa = &rdev->pdev->pd_pa; | |||
759 | struct acpi_devnode *const d = | |||
760 | acpi_pcidev_find(pci_get_segment(pa->pa_pc), | |||
761 | pa->pa_bus, pa->pa_device, pa->pa_function); | |||
762 | if (d == NULL) | |||
763 | return -EINVAL; | |||
764 | handle = d->ad_handle; | |||
765 | #else | |||
723 | handle = ACPI_HANDLE(&rdev->pdev->dev); | 766 | handle = ACPI_HANDLE(&rdev->pdev->dev); | |
767 | #endif | |||
724 | 768 | |||
725 | /* No need to proceed if we're sure that ATIF is not supported */ | 769 | /* No need to proceed if we're sure that ATIF is not supported */ | |
726 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) | 770 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) | |
727 | return 0; | 771 | return 0; | |
728 | 772 | |||
729 | /* Call the ATCS method */ | 773 | /* Call the ATCS method */ | |
730 | ret = radeon_atcs_verify_interface(handle, atcs); | 774 | ret = radeon_atcs_verify_interface(handle, atcs); | |
731 | if (ret) { | 775 | if (ret) { | |
732 | DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret); | 776 | DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret); | |
733 | } | 777 | } | |
734 | 778 | |||
735 | /* Call the ATIF method */ | 779 | /* Call the ATIF method */ | |
736 | ret = radeon_atif_verify_interface(handle, atif); | 780 | ret = radeon_atif_verify_interface(handle, atif); | |
@@ -779,30 +823,34 @@ int radeon_acpi_init(struct radeon_devic | @@ -779,30 +823,34 @@ int radeon_acpi_init(struct radeon_devic | |||
779 | 823 | |||
780 | if (atif->functions.system_params) { | 824 | if (atif->functions.system_params) { | |
781 | ret = radeon_atif_get_notification_params(handle, | 825 | ret = radeon_atif_get_notification_params(handle, | |
782 | &atif->notification_cfg); | 826 | &atif->notification_cfg); | |
783 | if (ret) { | 827 | if (ret) { | |
784 | DRM_DEBUG_DRIVER("Call to GET_SYSTEM_PARAMS failed: %d\n", | 828 | DRM_DEBUG_DRIVER("Call to GET_SYSTEM_PARAMS failed: %d\n", | |
785 | ret); | 829 | ret); | |
786 | /* Disable notification */ | 830 | /* Disable notification */ | |
787 | atif->notification_cfg.enabled = false; | 831 | atif->notification_cfg.enabled = false; | |
788 | } | 832 | } | |
789 | } | 833 | } | |
790 | 834 | |||
791 | out: | 835 | out: | |
836 | #ifndef __NetBSD__ /* XXX radeon acpi */ | |||
792 | rdev->acpi_nb.notifier_call = radeon_acpi_event; | 837 | rdev->acpi_nb.notifier_call = radeon_acpi_event; | |
793 | register_acpi_notifier(&rdev->acpi_nb); | 838 | register_acpi_notifier(&rdev->acpi_nb); | |
839 | #endif | |||
794 | 840 | |||
795 | return ret; | 841 | return ret; | |
796 | } | 842 | } | |
797 | 843 | |||
798 | /** | 844 | /** | |
799 | * radeon_acpi_fini - tear down driver acpi support | 845 | * radeon_acpi_fini - tear down driver acpi support | |
800 | * | 846 | * | |
801 | * @rdev: radeon_device pointer | 847 | * @rdev: radeon_device pointer | |
802 | * | 848 | * | |
803 | * Unregisters with the acpi notifier chain (all asics). | 849 | * Unregisters with the acpi notifier chain (all asics). | |
804 | */ | 850 | */ | |
805 | void radeon_acpi_fini(struct radeon_device *rdev) | 851 | void radeon_acpi_fini(struct radeon_device *rdev) | |
806 | { | 852 | { | |
853 | #ifndef __NetBSD__ /* XXX radeon acpi */ | |||
807 | unregister_acpi_notifier(&rdev->acpi_nb); | 854 | unregister_acpi_notifier(&rdev->acpi_nb); | |
855 | #endif | |||
808 | } | 856 | } |
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h 2022/05/28 01:07:47 1.4
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h 2024/04/16 14:34:02 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: radeon_drv.h,v 1.4 2022/05/28 01:07:47 manu Exp $ */ | 1 | /* $NetBSD: radeon_drv.h,v 1.5 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- | 3 | /* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- | |
4 | * | 4 | * | |
5 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | 5 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | |
6 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | 6 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * Permission is hereby granted, free of charge, to any person obtaining a | 9 | * Permission is hereby granted, free of charge, to any person obtaining a | |
10 | * copy of this software and associated documentation files (the "Software"), | 10 | * copy of this software and associated documentation files (the "Software"), | |
11 | * to deal in the Software without restriction, including without limitation | 11 | * to deal in the Software without restriction, including without limitation | |
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
13 | * and/or sell copies of the Software, and to permit persons to whom the | 13 | * and/or sell copies of the Software, and to permit persons to whom the | |
14 | * Software is furnished to do so, subject to the following conditions: | 14 | * Software is furnished to do so, subject to the following conditions: | |
@@ -23,35 +23,26 @@ | @@ -23,35 +23,26 @@ | |||
23 | * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | 23 | * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
26 | * DEALINGS IN THE SOFTWARE. | 26 | * DEALINGS IN THE SOFTWARE. | |
27 | * | 27 | * | |
28 | * Authors: | 28 | * Authors: | |
29 | * Kevin E. Martin <martin@valinux.com> | 29 | * Kevin E. Martin <martin@valinux.com> | |
30 | * Gareth Hughes <gareth@valinux.com> | 30 | * Gareth Hughes <gareth@valinux.com> | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #ifndef __RADEON_DRV_H__ | 33 | #ifndef __RADEON_DRV_H__ | |
34 | #define __RADEON_DRV_H__ | 34 | #define __RADEON_DRV_H__ | |
35 | 35 | |||
36 | #if defined(__NetBSD__) | |||
37 | #ifdef _KERNEL_OPT | |||
38 | #include "acpica.h" | |||
39 | #endif /* _KERNEL_OPT */ | |||
40 | #if (NACPICA > 0) | |||
41 | #define CONFIG_ACPI | |||
42 | #endif /* NACPICA > 0 */ | |||
43 | #endif /* __NetBSD__ */ | |||
44 | ||||
45 | #include <linux/firmware.h> | 36 | #include <linux/firmware.h> | |
46 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> | |
47 | #include <drm/drm_legacy.h> | 38 | #include <drm/drm_legacy.h> | |
48 | 39 | |||
49 | #include "radeon_family.h" | 40 | #include "radeon_family.h" | |
50 | 41 | |||
51 | /* General customization: | 42 | /* General customization: | |
52 | */ | 43 | */ | |
53 | 44 | |||
54 | #define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others." | 45 | #define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others." | |
55 | 46 | |||
56 | #define DRIVER_NAME "radeon" | 47 | #define DRIVER_NAME "radeon" | |
57 | #define DRIVER_DESC "ATI Radeon" | 48 | #define DRIVER_DESC "ATI Radeon" |
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c 2023/11/06 14:33:51 1.13
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c 2024/04/16 14:34:02 1.14
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: radeon_bios.c,v 1.13 2023/11/06 14:33:51 tnn Exp $ */ | 1 | /* $NetBSD: radeon_bios.c,v 1.14 2024/04/16 14:34:02 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2008 Advanced Micro Devices, Inc. | 4 | * Copyright 2008 Advanced Micro Devices, Inc. | |
5 | * Copyright 2008 Red Hat Inc. | 5 | * Copyright 2008 Red Hat Inc. | |
6 | * Copyright 2009 Jerome Glisse. | 6 | * Copyright 2009 Jerome Glisse. | |
7 | * | 7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a | 8 | * Permission is hereby granted, free of charge, to any person obtaining a | |
9 | * copy of this software and associated documentation files (the "Software"), | 9 | * copy of this software and associated documentation files (the "Software"), | |
10 | * to deal in the Software without restriction, including without limitation | 10 | * to deal in the Software without restriction, including without limitation | |
11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
12 | * and/or sell copies of the Software, and to permit persons to whom the | 12 | * and/or sell copies of the Software, and to permit persons to whom the | |
13 | * Software is furnished to do so, subject to the following conditions: | 13 | * Software is furnished to do so, subject to the following conditions: | |
14 | * | 14 | * | |
@@ -19,40 +19,39 @@ | @@ -19,40 +19,39 @@ | |||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
21 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 21 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
24 | * OTHER DEALINGS IN THE SOFTWARE. | 24 | * OTHER DEALINGS IN THE SOFTWARE. | |
25 | * | 25 | * | |
26 | * Authors: Dave Airlie | 26 | * Authors: Dave Airlie | |
27 | * Alex Deucher | 27 | * Alex Deucher | |
28 | * Jerome Glisse | 28 | * Jerome Glisse | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.13 2023/11/06 14:33:51 tnn Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.14 2024/04/16 14:34:02 riastradh Exp $"); | |
33 | 33 | |||
34 | #include <linux/acpi.h> | 34 | #include <linux/acpi.h> | |
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> | |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> | |
37 | 37 | |||
38 | #include <drm/drm_device.h> | 38 | #include <drm/drm_device.h> | |
39 | 39 | |||
40 | #include "atom.h" | 40 | #include "atom.h" | |
41 | #include "radeon.h" | 41 | #include "radeon.h" | |
42 | #include "radeon_reg.h" | 42 | #include "radeon_reg.h" | |
43 | 43 | |||
44 | #if defined(__NetBSD__) && NACPICA > 0 | 44 | #if defined(__NetBSD__) && defined(CONFIG_ACPI) | |
45 | #define CONFIG_ACPI | |||
46 | #include <dev/acpi/acpireg.h> | 45 | #include <dev/acpi/acpireg.h> | |
47 | #define _COMPONENT ACPI_DISPLAY_COMPONENT | 46 | #define _COMPONENT ACPI_DISPLAY_COMPONENT | |
48 | ACPI_MODULE_NAME("radeon_acpi") | 47 | ACPI_MODULE_NAME("radeon_acpi") | |
49 | #include <linux/nbsd-namespace-acpi.h> | 48 | #include <linux/nbsd-namespace-acpi.h> | |
50 | #endif | 49 | #endif | |
51 | 50 | |||
52 | /* | 51 | /* | |
53 | * BIOS. | 52 | * BIOS. | |
54 | */ | 53 | */ | |
55 | 54 | |||
56 | /* If you boot an IGP board with a discrete card as the primary, | 55 | /* If you boot an IGP board with a discrete card as the primary, | |
57 | * the IGP rom is not accessible via the rom bar as the IGP rom is | 56 | * the IGP rom is not accessible via the rom bar as the IGP rom is | |
58 | * part of the system bios. On boot, the system bios puts a | 57 | * part of the system bios. On boot, the system bios puts a |
--- src/sys/external/bsd/drm2/include/acpi/video.h 2014/03/18 18:20:42 1.2
+++ src/sys/external/bsd/drm2/include/acpi/video.h 2024/04/16 14:34:03 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: video.h,v 1.2 2014/03/18 18:20:42 riastradh Exp $ */ | 1 | /* $NetBSD: video.h,v 1.3 2024/04/16 14:34:03 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Taylor R. Campbell. | 8 | * by Taylor R. Campbell. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -22,24 +22,26 @@ | @@ -22,24 +22,26 @@ | |||
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #ifndef _DRM2_COMPAT_ACPI_VIDEO_H_ | 32 | #ifndef _DRM2_COMPAT_ACPI_VIDEO_H_ | |
33 | #define _DRM2_COMPAT_ACPI_VIDEO_H_ | 33 | #define _DRM2_COMPAT_ACPI_VIDEO_H_ | |
34 | 34 | |||
35 | #include <linux/acpi.h> | |||
36 | ||||
35 | static inline void | 37 | static inline void | |
36 | acpi_video_register(void) | 38 | acpi_video_register(void) | |
37 | { | 39 | { | |
38 | } | 40 | } | |
39 | 41 | |||
40 | static inline void | 42 | static inline void | |
41 | acpi_video_unregister(void) | 43 | acpi_video_unregister(void) | |
42 | { | 44 | { | |
43 | } | 45 | } | |
44 | 46 | |||
45 | #endif /* _DRM2_COMPAT_ACPI_VIDEO_H_ */ | 47 | #endif /* _DRM2_COMPAT_ACPI_VIDEO_H_ */ |
--- src/sys/external/bsd/drm2/include/linux/acpi.h 2022/05/28 01:07:47 1.10
+++ src/sys/external/bsd/drm2/include/linux/acpi.h 2024/04/16 14:34:03 1.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: acpi.h,v 1.10 2022/05/28 01:07:47 manu Exp $ */ | 1 | /* $NetBSD: acpi.h,v 1.11 2024/04/16 14:34:03 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Taylor R. Campbell. | 8 | * by Taylor R. Campbell. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -27,35 +27,39 @@ | @@ -27,35 +27,39 @@ | |||
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #ifndef _LINUX_ACPI_H_ | 32 | #ifndef _LINUX_ACPI_H_ | |
33 | #define _LINUX_ACPI_H_ | 33 | #define _LINUX_ACPI_H_ | |
34 | 34 | |||
35 | #ifdef _KERNEL_OPT | 35 | #ifdef _KERNEL_OPT | |
36 | #include "acpica.h" | 36 | #include "acpica.h" | |
37 | #endif | 37 | #endif | |
38 | 38 | |||
39 | #if NACPICA > 0 | 39 | #if NACPICA > 0 | |
40 | ||||
41 | #define CONFIG_ACPI 1 | |||
42 | ||||
40 | #include <dev/acpi/acpivar.h> | 43 | #include <dev/acpi/acpivar.h> | |
41 | 44 | |||
42 | #include <linux/types.h> | 45 | #include <linux/types.h> | |
43 | #include <linux/uuid.h> | 46 | #include <linux/uuid.h> | |
44 | 47 | |||
45 | typedef ACPI_HANDLE acpi_handle; | 48 | typedef ACPI_HANDLE acpi_handle; | |
46 | typedef ACPI_OBJECT_TYPE acpi_object_type; | 49 | typedef ACPI_OBJECT_TYPE acpi_object_type; | |
47 | typedef ACPI_SIZE acpi_size; | 50 | typedef ACPI_SIZE acpi_size; | |
48 | typedef ACPI_STATUS acpi_status; | 51 | typedef ACPI_STATUS acpi_status; | |
49 | 52 | |||
50 | #define acpi_evaluate_dsm linux_acpi_evaluate_dsm | 53 | #define acpi_evaluate_dsm linux_acpi_evaluate_dsm | |
51 | #define acpi_evaluate_dsm_typed linux_acpi_evaluate_dsm_typed | 54 | #define acpi_evaluate_dsm_typed linux_acpi_evaluate_dsm_typed | |
52 | #define acpi_check_dsm linux_acpi_check_dsm | 55 | #define acpi_check_dsm linux_acpi_check_dsm | |
53 | 56 | |||
54 | union acpi_object *acpi_evaluate_dsm(acpi_handle, const guid_t *, | 57 | union acpi_object *acpi_evaluate_dsm(acpi_handle, const guid_t *, | |
55 | uint64_t, uint64_t, union acpi_object *); | 58 | uint64_t, uint64_t, union acpi_object *); | |
56 | union acpi_object *acpi_evaluate_dsm_typed(acpi_handle, const guid_t *, | 59 | union acpi_object *acpi_evaluate_dsm_typed(acpi_handle, const guid_t *, | |
57 | uint64_t, uint64_t, union acpi_object *, acpi_object_type); | 60 | uint64_t, uint64_t, union acpi_object *, acpi_object_type); | |
58 | bool acpi_check_dsm(acpi_handle, const guid_t *, uint64_t, uint64_t); | 61 | bool acpi_check_dsm(acpi_handle, const guid_t *, uint64_t, uint64_t); | |
59 | 62 | |||
60 | #endif /* NACPICA > 0 */ | 63 | #endif /* NACPICA > 0 */ | |
64 | ||||
61 | #endif /* _LINUX_ACPI_H_ */ | 65 | #endif /* _LINUX_ACPI_H_ */ |
--- src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h 2022/02/27 14:22:42 1.1
+++ src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h 2024/04/16 14:34:03 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: nbsd-namespace-acpi.h,v 1.1 2022/02/27 14:22:42 riastradh Exp $ */ | 1 | /* $NetBSD: nbsd-namespace-acpi.h,v 1.2 2024/04/16 14:34:03 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2022 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2022 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -30,18 +30,19 @@ | @@ -30,18 +30,19 @@ | |||
30 | #define _LINUX_NBSD_NAMESPACE_ACPI_H_ | 30 | #define _LINUX_NBSD_NAMESPACE_ACPI_H_ | |
31 | 31 | |||
32 | #define buffer Buffer | 32 | #define buffer Buffer | |
33 | #define count Count | 33 | #define count Count | |
34 | #define elements Elements | 34 | #define elements Elements | |
35 | #define integer Integer | 35 | #define integer Integer | |
36 | #define length Length | 36 | #define length Length | |
37 | #define package Package | 37 | #define package Package | |
38 | #define pointer Pointer | 38 | #define pointer Pointer | |
39 | #define type Type | 39 | #define type Type | |
40 | #define value Value | 40 | #define value Value | |
41 | 41 | |||
42 | #define acpi_get_handle AcpiGetHandle | 42 | #define acpi_get_handle AcpiGetHandle | |
43 | #define acpi_get_name AcpiGetName | |||
43 | #define acpi_get_table AcpiGetTable | 44 | #define acpi_get_table AcpiGetTable | |
44 | #define acpi_evaluate_object AcpiEvaluateObject | 45 | #define acpi_evaluate_object AcpiEvaluateObject | |
45 | #define acpi_format_exception AcpiFormatException | 46 | #define acpi_format_exception AcpiFormatException | |
46 | 47 | |||
47 | #endif /* _LINUX_NBSD_NAMESPACE_ACPI_H_ */ | 48 | #endif /* _LINUX_NBSD_NAMESPACE_ACPI_H_ */ |
--- src/sys/external/bsd/drm2/nouveau/files.nouveau 2023/06/03 21:30:22 1.39
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau 2024/04/16 14:34:03 1.40
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.nouveau,v 1.39 2023/06/03 21:30:22 lukem Exp $ | 1 | # $NetBSD: files.nouveau,v 1.40 2024/04/16 14:34:03 riastradh Exp $ | |
2 | 2 | |||
3 | version 20180827 | 3 | version 20180827 | |
4 | 4 | |||
5 | define nouveaufbbus { } | 5 | define nouveaufbbus { } | |
6 | device nouveau: drmkms, drmkms_ttm, nouveaufbbus, firmload | 6 | device nouveau: drmkms, drmkms_ttm, nouveaufbbus, firmload | |
7 | makeoptions nouveau "CPPFLAGS.nouveau"+="${CPPFLAGS.drmkms}" | 7 | makeoptions nouveau "CPPFLAGS.nouveau"+="${CPPFLAGS.drmkms}" | |
8 | 8 | |||
9 | attach nouveau at pci with nouveau_pci: drmkms_pci | 9 | attach nouveau at pci with nouveau_pci: drmkms_pci | |
10 | file external/bsd/drm2/nouveau/nouveau_pci.c nouveau_pci | 10 | file external/bsd/drm2/nouveau/nouveau_pci.c nouveau_pci | |
11 | makeoptions nouveau_pci "CPPFLAGS.nouveau_pci"+="${CPPFLAGS.nouveau}" | 11 | makeoptions nouveau_pci "CPPFLAGS.nouveau_pci"+="${CPPFLAGS.nouveau}" | |
12 | 12 | |||
13 | device nouveaufb: nouveaufbbus, drmfb, drmfb_pci, wsemuldisplaydev | 13 | device nouveaufb: nouveaufbbus, drmfb, drmfb_pci, wsemuldisplaydev | |
14 | attach nouveaufb at nouveaufbbus | 14 | attach nouveaufb at nouveaufbbus | |
@@ -89,26 +89,27 @@ file external/bsd/drm2/dist/drm/nouveau/ | @@ -89,26 +89,27 @@ file external/bsd/drm2/dist/drm/nouveau/ | |||
89 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_ovly827e.c nouveau | 89 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_ovly827e.c nouveau | |
90 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_ovly907e.c nouveau | 90 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_ovly907e.c nouveau | |
91 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_ovly917e.c nouveau | 91 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_ovly917e.c nouveau | |
92 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_pior507d.c nouveau | 92 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_pior507d.c nouveau | |
93 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_sor507d.c nouveau | 93 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_sor507d.c nouveau | |
94 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_sor907d.c nouveau | 94 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_sor907d.c nouveau | |
95 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_sorc37d.c nouveau | 95 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_sorc37d.c nouveau | |
96 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wimm.c nouveau | 96 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wimm.c nouveau | |
97 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wimmc37b.c nouveau | 97 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wimmc37b.c nouveau | |
98 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wndw.c nouveau | 98 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wndw.c nouveau | |
99 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wndwc37e.c nouveau | 99 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wndwc37e.c nouveau | |
100 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wndwc57e.c nouveau | 100 | file external/bsd/drm2/dist/drm/nouveau/dispnv50/nouveau_dispnv50_wndwc57e.c nouveau | |
101 | file external/bsd/drm2/dist/drm/nouveau/nouveau_abi16.c nouveau | 101 | file external/bsd/drm2/dist/drm/nouveau/nouveau_abi16.c nouveau | |
102 | file external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c nouveau & acpi | |||
102 | file external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c nouveau | 103 | file external/bsd/drm2/dist/drm/nouveau/nouveau_bios.c nouveau | |
103 | file external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c nouveau | 104 | file external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c nouveau | |
104 | file external/bsd/drm2/dist/drm/nouveau/nouveau_chan.c nouveau | 105 | file external/bsd/drm2/dist/drm/nouveau/nouveau_chan.c nouveau | |
105 | file external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c nouveau | 106 | file external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c nouveau | |
106 | file external/bsd/drm2/dist/drm/nouveau/nouveau_display.c nouveau | 107 | file external/bsd/drm2/dist/drm/nouveau/nouveau_display.c nouveau | |
107 | file external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c nouveau | 108 | file external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c nouveau | |
108 | file external/bsd/drm2/dist/drm/nouveau/nouveau_dp.c nouveau | 109 | file external/bsd/drm2/dist/drm/nouveau/nouveau_dp.c nouveau | |
109 | file external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c nouveau | 110 | file external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c nouveau | |
110 | file external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c nouveau | 111 | file external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c nouveau | |
111 | file external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c nouveau | 112 | file external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c nouveau | |
112 | file external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c nouveau | 113 | file external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c nouveau | |
113 | file external/bsd/drm2/dist/drm/nouveau/nouveau_hwmon.c nouveau | 114 | file external/bsd/drm2/dist/drm/nouveau/nouveau_hwmon.c nouveau | |
114 | file external/bsd/drm2/dist/drm/nouveau/nouveau_mem.c nouveau | 115 | file external/bsd/drm2/dist/drm/nouveau/nouveau_mem.c nouveau |
--- src/sys/external/bsd/drm2/radeon/files.radeon 2023/06/03 21:31:47 1.39
+++ src/sys/external/bsd/drm2/radeon/files.radeon 2024/04/16 14:34:03 1.40
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.radeon,v 1.39 2023/06/03 21:31:47 lukem Exp $ | 1 | # $NetBSD: files.radeon,v 1.40 2024/04/16 14:34:03 riastradh Exp $ | |
2 | 2 | |||
3 | version 20180827 | 3 | version 20180827 | |
4 | 4 | |||
5 | define radeonfbbus { } | 5 | define radeonfbbus { } | |
6 | device radeon: drmkms, drmkms_pci, drmkms_ttm, radeonfbbus, firmload | 6 | device radeon: drmkms, drmkms_pci, drmkms_ttm, radeonfbbus, firmload | |
7 | attach radeon at pci | 7 | attach radeon at pci | |
8 | 8 | |||
9 | # XXX Rename this to radeonfb when the legacy radeonfb(4) is gone. | 9 | # XXX Rename this to radeonfb when the legacy radeonfb(4) is gone. | |
10 | device radeondrmkmsfb: radeonfbbus, drmfb, drmfb_pci, wsemuldisplaydev | 10 | device radeondrmkmsfb: radeonfbbus, drmfb, drmfb_pci, wsemuldisplaydev | |
11 | attach radeondrmkmsfb at radeonfbbus | 11 | attach radeondrmkmsfb at radeonfbbus | |
12 | 12 | |||
13 | # This code comes from the Linux kernel, which assumes signed | 13 | # This code comes from the Linux kernel, which assumes signed | |
14 | # overflow is OK. | 14 | # overflow is OK. | |
@@ -38,27 +38,27 @@ makeoptions radeon "CWARNFLAGS.radeon"+= | @@ -38,27 +38,27 @@ makeoptions radeon "CWARNFLAGS.radeon"+= | |||
38 | 38 | |||
39 | #makeoptions radeon "CWARNFLAGS.radeon_cs.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | 39 | #makeoptions radeon "CWARNFLAGS.radeon_cs.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | |
40 | makeoptions radeon "CWARNFLAGS.radeon_evergreen_cs.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | 40 | makeoptions radeon "CWARNFLAGS.radeon_evergreen_cs.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | |
41 | makeoptions radeon "CWARNFLAGS.radeon_r300.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | 41 | makeoptions radeon "CWARNFLAGS.radeon_r300.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | |
42 | makeoptions radeon "CWARNFLAGS.radeon_r420.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | 42 | makeoptions radeon "CWARNFLAGS.radeon_r420.c"+="${CC_WNO_IMPLICIT_FALLTHROUGH}" | |
43 | makeoptions radeon "CWARNFLAGS.radeon_uvd.c"+="${${ACTIVE_CC} == clang:? -Wno-format :}" | 43 | makeoptions radeon "CWARNFLAGS.radeon_uvd.c"+="${${ACTIVE_CC} == clang:? -Wno-format :}" | |
44 | 44 | |||
45 | file external/bsd/drm2/radeon/radeon_module.c radeon | 45 | file external/bsd/drm2/radeon/radeon_module.c radeon | |
46 | file external/bsd/drm2/radeon/radeon_pci.c radeon | 46 | file external/bsd/drm2/radeon/radeon_pci.c radeon | |
47 | 47 | |||
48 | file external/bsd/drm2/radeon/radeondrmkmsfb.c radeondrmkmsfb | 48 | file external/bsd/drm2/radeon/radeondrmkmsfb.c radeondrmkmsfb | |
49 | 49 | |||
50 | # Generated from radeon2netbsd. | 50 | # Generated from radeon2netbsd. | |
51 | #file external/bsd/drm2/dist/drm/radeon/radeon_acpi.c radeon | 51 | file external/bsd/drm2/dist/drm/radeon/radeon_acpi.c radeon | |
52 | file external/bsd/drm2/dist/drm/radeon/radeon_agp.c radeon | 52 | file external/bsd/drm2/dist/drm/radeon/radeon_agp.c radeon | |
53 | file external/bsd/drm2/dist/drm/radeon/radeon_asic.c radeon | 53 | file external/bsd/drm2/dist/drm/radeon/radeon_asic.c radeon | |
54 | file external/bsd/drm2/dist/drm/radeon/radeon_atom.c radeon | 54 | file external/bsd/drm2/dist/drm/radeon/radeon_atom.c radeon | |
55 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios.c radeon | 55 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios.c radeon | |
56 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_crtc.c radeon | 56 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_crtc.c radeon | |
57 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c radeon | 57 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c radeon | |
58 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_encoders.c radeon | 58 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_encoders.c radeon | |
59 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_i2c.c radeon | 59 | file external/bsd/drm2/dist/drm/radeon/radeon_atombios_i2c.c radeon | |
60 | file external/bsd/drm2/dist/drm/radeon/radeon_audio.c radeon | 60 | file external/bsd/drm2/dist/drm/radeon/radeon_audio.c radeon | |
61 | file external/bsd/drm2/dist/drm/radeon/radeon_benchmark.c radeon | 61 | file external/bsd/drm2/dist/drm/radeon/radeon_benchmark.c radeon | |
62 | file external/bsd/drm2/dist/drm/radeon/radeon_bios.c radeon | 62 | file external/bsd/drm2/dist/drm/radeon/radeon_bios.c radeon | |
63 | file external/bsd/drm2/dist/drm/radeon/radeon_btc_dpm.c radeon | 63 | file external/bsd/drm2/dist/drm/radeon/radeon_btc_dpm.c radeon | |
64 | file external/bsd/drm2/dist/drm/radeon/radeon_cayman_blit_shaders.c radeon | 64 | file external/bsd/drm2/dist/drm/radeon/radeon_cayman_blit_shaders.c radeon |
--- src/sys/modules/amdgpu/Makefile 2023/09/10 15:12:39 1.8
+++ src/sys/modules/amdgpu/Makefile 2024/04/16 14:34:03 1.9
@@ -1,30 +1,35 @@ | @@ -1,30 +1,35 @@ | |||
1 | # $NetBSD: Makefile,v 1.8 2023/09/10 15:12:39 mrg Exp $ | 1 | # $NetBSD: Makefile,v 1.9 2024/04/16 14:34:03 riastradh Exp $ | |
2 | 2 | |||
3 | .include "../Makefile.inc" | 3 | .include "../Makefile.inc" | |
4 | .include "../drmkms/Makefile.inc" | 4 | .include "../drmkms/Makefile.inc" | |
5 | 5 | |||
6 | KMOD= amdgpu | 6 | KMOD= amdgpu | |
7 | IOCONF= amdgpu.ioconf | 7 | IOCONF= amdgpu.ioconf | |
8 | MKLDSCRIPT=yes | 8 | MKLDSCRIPT=yes | |
9 | 9 | |||
10 | WARNS= 3 | 10 | WARNS= 3 | |
11 | 11 | |||
12 | .if ${MACHINE_ARCH} == "x86_64" | 12 | .if ${MACHINE_ARCH} == "x86_64" | |
13 | COPTS.amdgpu_float+= ${${ACTIVE_CC} == "gcc" :? -mhard-float :} -msse -msse2 | 13 | COPTS.amdgpu_float+= ${${ACTIVE_CC} == "gcc" :? -mhard-float :} -msse -msse2 | |
14 | .elif !empty(MACHINE_ARCH:Maarch64*) | 14 | .elif !empty(MACHINE_ARCH:Maarch64*) | |
15 | COPTS.amdgpu_float+= -march=armv8-a | 15 | COPTS.amdgpu_float+= -march=armv8-a | |
16 | .endif | 16 | .endif | |
17 | 17 | |||
18 | .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || \ | |||
19 | ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "aarch64" | |||
20 | CPPFLAGS+= -DNACPICA=1 | |||
21 | .endif | |||
22 | ||||
18 | # sed -ne 's,^makeoptions amdgpu "\([^.]*\)\.amdgpu"+="\(.*\)",\1+= \2,gp' <files.amdgpu | sed -e 's,\$S,${S},g' | 23 | # sed -ne 's,^makeoptions amdgpu "\([^.]*\)\.amdgpu"+="\(.*\)",\1+= \2,gp' <files.amdgpu | sed -e 's,\$S,${S},g' | |
19 | # Note: order of includes is significant. | 24 | # Note: order of includes is significant. | |
20 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/include/asic_reg | 25 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/include/asic_reg | |
21 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/include | 26 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/include | |
22 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/amdgpu | 27 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/amdgpu | |
23 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/powerplay/inc | 28 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/powerplay/inc | |
24 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/powerplay/smumgr | 29 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/powerplay/smumgr | |
25 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr | 30 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr | |
26 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/acp/include | 31 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/acp/include | |
27 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display | 32 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display | |
28 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display/include | 33 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display/include | |
29 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display/dc | 34 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display/dc | |
30 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display/dc/inc | 35 | CPPFLAGS+= -I${S}/external/bsd/drm2/dist/drm/amd/display/dc/inc | |
@@ -135,26 +140,27 @@ COPTS.amdgpu_rn_clk_mgr.c+= ${COPTS.amdg | @@ -135,26 +140,27 @@ COPTS.amdgpu_rn_clk_mgr.c+= ${COPTS.amdg | |||
135 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/dmub/src | 140 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/dmub/src | |
136 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/color | 141 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/color | |
137 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/freesync | 142 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/freesync | |
138 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/hdcp | 143 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/hdcp | |
139 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/info_packet | 144 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/info_packet | |
140 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/power | 145 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../display/modules/power | |
141 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay | 146 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay | |
142 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/hwmgr | 147 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/hwmgr | |
143 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr | 148 | .PATH: ${S}/external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr | |
144 | 149 | |||
145 | # sed -ne 's,^file external/bsd/drm2/.*/\([^/ ]*\) .*,SRCS+= \1,gp' <files.amdgpu | sort -u | 150 | # sed -ne 's,^file external/bsd/drm2/.*/\([^/ ]*\) .*,SRCS+= \1,gp' <files.amdgpu | sort -u | |
146 | SRCS+= amdgpu_acp.c | 151 | SRCS+= amdgpu_acp.c | |
147 | SRCS+= amdgpu_acp_hw.c | 152 | SRCS+= amdgpu_acp_hw.c | |
153 | SRCS+= amdgpu_acpi.c | |||
148 | SRCS+= amdgpu_afmt.c | 154 | SRCS+= amdgpu_afmt.c | |
149 | SRCS+= amdgpu_amd_powerplay.c | 155 | SRCS+= amdgpu_amd_powerplay.c | |
150 | SRCS+= amdgpu_amdkfd.c | 156 | SRCS+= amdgpu_amdkfd.c | |
151 | SRCS+= amdgpu_arct_reg_init.c | 157 | SRCS+= amdgpu_arct_reg_init.c | |
152 | SRCS+= amdgpu_arcturus_ppt.c | 158 | SRCS+= amdgpu_arcturus_ppt.c | |
153 | SRCS+= amdgpu_athub_v1_0.c | 159 | SRCS+= amdgpu_athub_v1_0.c | |
154 | SRCS+= amdgpu_athub_v2_0.c | 160 | SRCS+= amdgpu_athub_v2_0.c | |
155 | SRCS+= amdgpu_atom.c | 161 | SRCS+= amdgpu_atom.c | |
156 | SRCS+= amdgpu_atombios.c | 162 | SRCS+= amdgpu_atombios.c | |
157 | SRCS+= amdgpu_atombios_crtc.c | 163 | SRCS+= amdgpu_atombios_crtc.c | |
158 | SRCS+= amdgpu_atombios_dp.c | 164 | SRCS+= amdgpu_atombios_dp.c | |
159 | SRCS+= amdgpu_atombios_encoders.c | 165 | SRCS+= amdgpu_atombios_encoders.c | |
160 | SRCS+= amdgpu_atombios_i2c.c | 166 | SRCS+= amdgpu_atombios_i2c.c |