Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu Make amdgpu cik bu...



details:   https://anonhg.NetBSD.org/src/rev/5798753dfb92
branches:  trunk
changeset: 366282:5798753dfb92
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:24:03 2018 +0000

description:
Make amdgpu cik build.

- Sprinkle __UNCONST and __UNVOLATILE judiciously.
- Ifdef out debugfs stuff and other unused things.
- Add includes.
- Convert void * to char * before arithmetic.
- Add prototype for amdgpu_cik_gpu_check_soft_reset.
  . XXX Should really be in a header file, but whatever...
- Mark unused variables.
- sprintf -> snprintf

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c        |  30 +++++++--
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_smc.c        |   5 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c           |   5 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_ih.c        |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_sdma.c      |   9 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v8_0.c      |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v7_0.c      |  24 ++++---
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kv_dpm.c        |  30 ++++++---
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd_v4_2.c      |   7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vce_v2_0.c      |   8 +-
 11 files changed, 86 insertions(+), 52 deletions(-)

diffs (truncated from 599 to 300 lines):

diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c  Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c  Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_amdkfd_gfx_v7.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $       */
+/*     $NetBSD: amdgpu_amdkfd_gfx_v7.c,v 1.3 2018/08/27 14:24:03 riastradh Exp $       */
 
 /*
  * Copyright 2014 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd_gfx_v7.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd_gfx_v7.c,v 1.3 2018/08/27 14:24:03 riastradh Exp $");
 
 #include <linux/fdtable.h>
 #include <linux/uaccess.h>
@@ -159,9 +159,9 @@
        .get_fw_version = get_fw_version
 };
 
-struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions()
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
 {
-       return (struct kfd2kgd_calls *)&kfd2kgd;
+       return (struct kfd2kgd_calls *)__UNCONST(&kfd2kgd); /* XXX */
 }
 
 static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)
diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ci_dpm.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $      */
+/*     $NetBSD: amdgpu_ci_dpm.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $      */
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,9 +24,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ci_dpm.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ci_dpm.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $");
 
 #include <linux/firmware.h>
+#include <linux/module.h>
+#include <asm/byteorder.h>
 #include "drmP.h"
 #include "amdgpu.h"
 #include "amdgpu_pm.h"
@@ -88,12 +90,14 @@
        { 0x17C, 0x172, 0x180, 0x1BC, 0x1B3, 0x1BD, 0x206, 0x200, 0x203, 0x25D, 0x25A, 0x255, 0x2C3, 0x2C5, 0x2B4 }
 };
 
+#if 0                          /* XXX unused? */
 static const struct ci_pt_defaults defaults_bonaire_pro =
 {
        1, 0xF, 0xFD, 0x19, 5, 45, 0, 0x65062,
        { 0x8C,  0x23F, 0x244, 0xA6,  0x83,  0x85,  0x86,  0x86,  0x83,  0xDB,  0xDB,  0xDA,  0x67,  0x60,  0x5F  },
        { 0x187, 0x193, 0x193, 0x1C7, 0x1D1, 0x1D1, 0x210, 0x219, 0x219, 0x266, 0x26C, 0x26C, 0x2C9, 0x2CB, 0x2CB }
 };
+#endif
 
 static const struct ci_pt_defaults defaults_saturn_xt =
 {
@@ -102,12 +106,14 @@
        { 0x187, 0x187, 0x187, 0x1C7, 0x1C7, 0x1C7, 0x210, 0x210, 0x210, 0x266, 0x266, 0x266, 0x2C9, 0x2C9, 0x2C9 }
 };
 
+#ifndef __NetBSD__             /* XXX unused? */
 static const struct ci_pt_defaults defaults_saturn_pro =
 {
        1, 0xF, 0xFD, 0x19, 5, 55, 0, 0x30000,
        { 0x96,  0x21D, 0x23B, 0xA1,  0x85,  0x87,  0x83,  0x84,  0x81,  0xE6,  0xE6,  0xE6,  0x71,  0x6A,  0x6A  },
        { 0x193, 0x19E, 0x19E, 0x1D2, 0x1DC, 0x1DC, 0x21A, 0x223, 0x223, 0x26E, 0x27E, 0x274, 0x2CF, 0x2D2, 0x2D2 }
 };
+#endif
 
 static const struct ci_pt_config_reg didt_config_ci[] =
 {
@@ -1510,7 +1516,7 @@
 {
        struct ci_power_info *pi = ci_get_pi(adev);
        bool want_thermal_protection;
-       enum amdgpu_dpm_event_src dpm_event_src;
+       enum amdgpu_dpm_event_src dpm_event_src __unused;
        u32 tmp;
 
        switch (sources) {
@@ -1791,6 +1797,7 @@
        return amdgpu_ci_send_msg_to_smc(adev, msg);
 }
 
+#ifdef CONFIG_DEBUG_FS
 static PPSMC_Result amdgpu_ci_send_msg_to_smc_return_parameter(struct amdgpu_device *adev,
                                                        PPSMC_Msg msg, u32 *parameter)
 {
@@ -1803,6 +1810,7 @@
 
        return smc_result;
 }
+#endif
 
 static int ci_dpm_force_state_sclk(struct amdgpu_device *adev, u32 n)
 {
@@ -1877,6 +1885,7 @@
 }
 #endif
 
+#ifdef CONFIG_DEBUG_FS
 static u32 ci_get_average_sclk_freq(struct amdgpu_device *adev)
 {
        u32 sclk_freq;
@@ -1902,6 +1911,7 @@
 
        return mclk_freq;
 }
+#endif
 
 static void ci_dpm_start_smc(struct amdgpu_device *adev)
 {
@@ -5682,18 +5692,18 @@
        if (!amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,
                                   &frev, &crev, &data_offset))
                return -EINVAL;
-       power_info = (union power_info *)(mode_info->atom_context->bios + data_offset);
+       power_info = (union power_info *)((char *)mode_info->atom_context->bios + data_offset);
 
        amdgpu_add_thermal_controller(adev);
 
        state_array = (struct _StateArray *)
-               (mode_info->atom_context->bios + data_offset +
+               ((char *)mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usStateArrayOffset));
        clock_info_array = (struct _ClockInfoArray *)
-               (mode_info->atom_context->bios + data_offset +
+               ((char *)mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usClockInfoArrayOffset));
        non_clock_info_array = (struct _NonClockInfoArray *)
-               (mode_info->atom_context->bios + data_offset +
+               ((char *)mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
        adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) *
@@ -5765,7 +5775,7 @@
        if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,
                                   &frev, &crev, &data_offset)) {
                firmware_info =
-                       (ATOM_FIRMWARE_INFO_V2_2 *)(mode_info->atom_context->bios +
+                       (ATOM_FIRMWARE_INFO_V2_2 *)((char *)mode_info->atom_context->bios +
                                                    data_offset);
                boot_state->mvdd_bootup_value = le16_to_cpu(firmware_info->usBootUpMVDDCVoltage);
                boot_state->vddc_bootup_value = le16_to_cpu(firmware_info->usBootUpVDDCVoltage);
@@ -6091,6 +6101,7 @@
        return 0;
 }
 
+#ifdef CONFIG_DEBUG_FS
 static void
 ci_dpm_debugfs_print_current_performance_level(struct amdgpu_device *adev,
                                               struct seq_file *m)
@@ -6105,6 +6116,7 @@
        seq_printf(m, "power level avg    sclk: %u mclk: %u\n",
                   sclk, mclk);
 }
+#endif
 
 static void ci_dpm_print_power_state(struct amdgpu_device *adev,
                                     struct amdgpu_ps *rps)
@@ -6688,7 +6700,9 @@
        .get_sclk = &ci_dpm_get_sclk,
        .get_mclk = &ci_dpm_get_mclk,
        .print_power_state = &ci_dpm_print_power_state,
+#ifdef CONFIG_DEBUG_FS
        .debugfs_print_current_performance_level = &ci_dpm_debugfs_print_current_performance_level,
+#endif
        .force_performance_level = &ci_dpm_force_performance_level,
        .vblank_too_short = &ci_dpm_vblank_too_short,
        .powergate_uvd = &ci_dpm_powergate_uvd,
diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_smc.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_smc.c Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_smc.c Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ci_smc.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $      */
+/*     $NetBSD: amdgpu_ci_smc.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $      */
 
 /*
  * Copyright 2011 Advanced Micro Devices, Inc.
@@ -25,9 +25,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ci_smc.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ci_smc.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $");
 
 #include <linux/firmware.h>
+#include <asm/byteorder.h>
 #include "drmP.h"
 #include "amdgpu.h"
 #include "cikd.h"
diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c    Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c    Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_cik.c,v 1.2 2018/08/27 14:23:31 riastradh Exp $ */
+/*     $NetBSD: amdgpu_cik.c,v 1.3 2018/08/27 14:24:03 riastradh Exp $ */
 
 /*
  * Copyright 2012 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  * Authors: Alex Deucher
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_cik.c,v 1.2 2018/08/27 14:23:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_cik.c,v 1.3 2018/08/27 14:24:03 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <linux/slab.h>
@@ -1080,6 +1080,7 @@
  * mask to be used by cik_gpu_soft_reset().
  * Returns a mask of the blocks to be reset.
  */
+u32 amdgpu_cik_gpu_check_soft_reset(struct amdgpu_device *adev); /* XXX put this in a header file */
 u32 amdgpu_cik_gpu_check_soft_reset(struct amdgpu_device *adev)
 {
        u32 reset_mask = 0;
diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_ih.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_ih.c Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_ih.c Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_cik_ih.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $      */
+/*     $NetBSD: amdgpu_cik_ih.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $      */
 
 /*
  * Copyright 2012 Advanced Micro Devices, Inc.
@@ -23,8 +23,10 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_cik_ih.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_cik_ih.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $");
 
+#include <asm/byteorder.h>
+#include <linux/log2.h>
 #include "drmP.h"
 #include "amdgpu.h"
 #include "amdgpu_ih.h"
diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_sdma.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_sdma.c       Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik_sdma.c       Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_cik_sdma.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $    */
+/*     $NetBSD: amdgpu_cik_sdma.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $    */
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,9 +24,12 @@
  * Authors: Alex Deucher
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_cik_sdma.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_cik_sdma.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $");
 
 #include <linux/firmware.h>
+#include <linux/module.h>
+#include <linux/log2.h>
+#include <asm/byteorder.h>
 #include <drm/drmP.h>
 #include "amdgpu.h"
 #include "amdgpu_ucode.h"
@@ -979,7 +982,7 @@
        for (i = 0; i < adev->sdma.num_instances; i++) {
                ring = &adev->sdma.instance[i].ring;
                ring->ring_obj = NULL;
-               sprintf(ring->name, "sdma%d", i);
+               snprintf(ring->name, sizeof ring->name, "sdma%d", i);
                r = amdgpu_ring_init(adev, ring, 256 * 1024,
                                     SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0), 0xf,
                                     &adev->sdma.trap_irq,
diff -r 9a7250cb0e0e -r 5798753dfb92 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v8_0.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v8_0.c       Mon Aug 27 14:23:31 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v8_0.c       Mon Aug 27 14:24:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dce_v8_0.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $    */
+/*     $NetBSD: amdgpu_dce_v8_0.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $    */
 
 /*
  * Copyright 2014 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dce_v8_0.c,v 1.1 2018/08/27 14:22:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dce_v8_0.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $");
 
 #include "drmP.h"
 #include "amdgpu.h"
@@ -1703,7 +1703,7 @@



Home | Main Index | Thread Index | Old Index