Dear current-users,

In the patch below, I have implemented the few missing pieces for loading
the Atom BIOS from ACPI which is needed when booting via UEFI. Now the
BIOS loads for me (but amdgpu does not work yet).

I am trying to get amdgpu working on a Ryzen 7 5700G with (from lspci)

 Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon 
Vega Mobile Series] (rev c8)

I guess this will be supported if/when drm is next updated, but I have
patched amdgpu_drv.c below to start looking at it. The next issue is
"PSP load tmr failed" ...

-- 
Kind regards,

Yorick Hardy

Index: sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c,v
retrieving revision 1.8
diff -u -r1.8 amdgpu_drv.c
--- sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c      19 Dec 2021 
12:23:42 -0000      1.8
+++ sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c      5 Jan 2024 
07:32:12 -0000
@@ -1013,6 +1013,7 @@
 
        /* Renoir */
        {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
+       {0x1002, 0x1638, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
 
        /* Navi12 */
        {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
CHIP_NAVI12|AMD_EXP_HW_SUPPORT},
Index: sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c,v
retrieving revision 1.6
diff -u -r1.6 amdgpu_bios.c
--- sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c     27 Feb 2022 
14:23:24 -0000      1.6
+++ sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c     5 Jan 2024 
07:32:09 -0000
@@ -402,7 +402,7 @@
                return amdgpu_asic_read_disabled_bios(adev);
 }
 
-#ifdef CONFIG_ACPI
+#if defined(CONFIG_ACPI) || (NACPICA > 0)
 static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev)
 {
        struct acpi_table_header *hdr;
@@ -412,7 +412,11 @@
 
        if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr)))
                return false;
+#ifdef __NetBSD__
+       tbl_size = hdr->Length;
+#else
        tbl_size = hdr->length;
+#endif
        if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
                DRM_ERROR("ACPI VFCT table present but broken (too short 
#1)\n");
                return false;
Index: sys/external/bsd/drm2/include/linux/acpi.h
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm2/include/linux/acpi.h,v
retrieving revision 1.10
diff -u -r1.10 acpi.h
--- sys/external/bsd/drm2/include/linux/acpi.h  28 May 2022 01:07:47 -0000      
1.10
+++ sys/external/bsd/drm2/include/linux/acpi.h  5 Jan 2024 07:50:25 -0000
@@ -56,6 +56,7 @@
 union acpi_object *acpi_evaluate_dsm_typed(acpi_handle, const guid_t *,
     uint64_t, uint64_t, union acpi_object *, acpi_object_type);
 bool acpi_check_dsm(acpi_handle, const guid_t *, uint64_t, uint64_t);
+u32 acpi_get_table(const char*, u32, struct acpi_table_header **);
 
 #endif /* NACPICA > 0 */
 #endif  /* _LINUX_ACPI_H_ */
Index: sys/external/bsd/drm2/linux/linux_acpi.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm2/linux/linux_acpi.c,v
retrieving revision 1.2
diff -u -r1.2 linux_acpi.c
--- sys/external/bsd/drm2/linux/linux_acpi.c    28 Feb 2022 17:15:30 -0000      
1.2
+++ sys/external/bsd/drm2/linux/linux_acpi.c    5 Jan 2024 07:50:29 -0000
@@ -120,3 +120,9 @@
                return true;
        return false;
 }
+
+u32
+acpi_get_table(const char* signature, u32 instance, struct acpi_table_header 
**hdr)
+{
+       return AcpiGetTable(signature, instance, hdr);
+}

Reply via email to