Commit 5b54d679 authored by Nirmoy Das's avatar Nirmoy Das Committed by Alex Deucher

drm/radeon: do not use drm middle layer for debugfs (v2)

Use debugfs API directly instead of drm middle layer.

v2: squash in build fix (Alex)
Signed-off-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e7fa81bb
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
...@@ -1121,9 +1120,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) ...@@ -1121,9 +1120,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size)
uint32_t tmp; uint32_t tmp;
int r; int r;
if (r100_debugfs_cp_init(rdev)) { r100_debugfs_cp_init(rdev);
DRM_ERROR("Failed to register debugfs file for CP !\n");
}
if (!rdev->me_fw) { if (!rdev->me_fw) {
r = r100_cp_init_microcode(rdev); r = r100_cp_init_microcode(rdev);
if (r) { if (r) {
...@@ -2920,11 +2917,9 @@ static void r100_set_safe_registers(struct radeon_device *rdev) ...@@ -2920,11 +2917,9 @@ static void r100_set_safe_registers(struct radeon_device *rdev)
* Debugfs info * Debugfs info
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int r100_debugfs_rbbm_info(struct seq_file *m, void *data) static int r100_debugfs_rbbm_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t reg, value; uint32_t reg, value;
unsigned i; unsigned i;
...@@ -2941,11 +2936,9 @@ static int r100_debugfs_rbbm_info(struct seq_file *m, void *data) ...@@ -2941,11 +2936,9 @@ static int r100_debugfs_rbbm_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static int r100_debugfs_cp_ring_info(struct seq_file *m, void *data) static int r100_debugfs_cp_ring_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
uint32_t rdp, wdp; uint32_t rdp, wdp;
unsigned count, i, j; unsigned count, i, j;
...@@ -2969,11 +2962,9 @@ static int r100_debugfs_cp_ring_info(struct seq_file *m, void *data) ...@@ -2969,11 +2962,9 @@ static int r100_debugfs_cp_ring_info(struct seq_file *m, void *data)
} }
static int r100_debugfs_cp_csq_fifo(struct seq_file *m, void *data) static int r100_debugfs_cp_csq_fifo_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t csq_stat, csq2_stat, tmp; uint32_t csq_stat, csq2_stat, tmp;
unsigned r_rptr, r_wptr, ib1_rptr, ib1_wptr, ib2_rptr, ib2_wptr; unsigned r_rptr, r_wptr, ib1_rptr, ib1_wptr, ib2_rptr, ib2_wptr;
unsigned i; unsigned i;
...@@ -3019,11 +3010,9 @@ static int r100_debugfs_cp_csq_fifo(struct seq_file *m, void *data) ...@@ -3019,11 +3010,9 @@ static int r100_debugfs_cp_csq_fifo(struct seq_file *m, void *data)
return 0; return 0;
} }
static int r100_debugfs_mc_info(struct seq_file *m, void *data) static int r100_debugfs_mc_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t tmp; uint32_t tmp;
tmp = RREG32(RADEON_CONFIG_MEMSIZE); tmp = RREG32(RADEON_CONFIG_MEMSIZE);
...@@ -3049,44 +3038,42 @@ static int r100_debugfs_mc_info(struct seq_file *m, void *data) ...@@ -3049,44 +3038,42 @@ static int r100_debugfs_mc_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list r100_debugfs_rbbm_list[] = { DEFINE_SHOW_ATTRIBUTE(r100_debugfs_rbbm_info);
{"r100_rbbm_info", r100_debugfs_rbbm_info, 0, NULL}, DEFINE_SHOW_ATTRIBUTE(r100_debugfs_cp_ring_info);
}; DEFINE_SHOW_ATTRIBUTE(r100_debugfs_cp_csq_fifo);
DEFINE_SHOW_ATTRIBUTE(r100_debugfs_mc_info);
static struct drm_info_list r100_debugfs_cp_list[] = {
{"r100_cp_ring_info", r100_debugfs_cp_ring_info, 0, NULL},
{"r100_cp_csq_fifo", r100_debugfs_cp_csq_fifo, 0, NULL},
};
static struct drm_info_list r100_debugfs_mc_info_list[] = {
{"r100_mc_info", r100_debugfs_mc_info, 0, NULL},
};
#endif #endif
int r100_debugfs_rbbm_init(struct radeon_device *rdev) void r100_debugfs_rbbm_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, r100_debugfs_rbbm_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("r100_rbbm_info", 0444, root, rdev,
&r100_debugfs_rbbm_info_fops);
#endif #endif
} }
int r100_debugfs_cp_init(struct radeon_device *rdev) void r100_debugfs_cp_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, r100_debugfs_cp_list, 2); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("r100_cp_ring_info", 0444, root, rdev,
&r100_debugfs_cp_ring_info_fops);
debugfs_create_file("r100_cp_csq_fifo", 0444, root, rdev,
&r100_debugfs_cp_csq_fifo_fops);
#endif #endif
} }
int r100_debugfs_mc_info_init(struct radeon_device *rdev) void r100_debugfs_mc_info_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, r100_debugfs_mc_info_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("r100_mc_info", 0444, root, rdev,
&r100_debugfs_mc_info_fops);
#endif #endif
} }
...@@ -3834,15 +3821,6 @@ void r100_vga_render_disable(struct radeon_device *rdev) ...@@ -3834,15 +3821,6 @@ void r100_vga_render_disable(struct radeon_device *rdev)
WREG8(R_0003C2_GENMO_WT, C_0003C2_VGA_RAM_EN & tmp); WREG8(R_0003C2_GENMO_WT, C_0003C2_VGA_RAM_EN & tmp);
} }
static void r100_debugfs(struct radeon_device *rdev)
{
int r;
r = r100_debugfs_mc_info_init(rdev);
if (r)
dev_warn(rdev->dev, "Failed to create r100_mc debugfs file.\n");
}
static void r100_mc_program(struct radeon_device *rdev) static void r100_mc_program(struct radeon_device *rdev)
{ {
struct r100_mc_save save; struct r100_mc_save save;
...@@ -4031,7 +4009,7 @@ int r100_init(struct radeon_device *rdev) ...@@ -4031,7 +4009,7 @@ int r100_init(struct radeon_device *rdev)
int r; int r;
/* Register debugfs file specific to this group of asics */ /* Register debugfs file specific to this group of asics */
r100_debugfs(rdev); r100_debugfs_mc_info_init(rdev);
/* Disable VGA */ /* Disable VGA */
r100_vga_render_disable(rdev); r100_vga_render_disable(rdev);
/* Initialize scratch registers */ /* Initialize scratch registers */
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <drm/drm.h> #include <drm/drm.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/radeon_drm.h> #include <drm/radeon_drm.h>
...@@ -83,7 +82,7 @@ void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) ...@@ -83,7 +82,7 @@ void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
/* /*
* rv370,rv380 PCIE GART * rv370,rv380 PCIE GART
*/ */
static int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev); static void rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev);
void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev)
{ {
...@@ -140,9 +139,8 @@ int rv370_pcie_gart_init(struct radeon_device *rdev) ...@@ -140,9 +139,8 @@ int rv370_pcie_gart_init(struct radeon_device *rdev)
r = radeon_gart_init(rdev); r = radeon_gart_init(rdev);
if (r) if (r)
return r; return r;
r = rv370_debugfs_pcie_gart_info_init(rdev); rv370_debugfs_pcie_gart_info_init(rdev);
if (r)
DRM_ERROR("Failed to register debugfs file for PCIE gart !\n");
rdev->gart.table_size = rdev->gart.num_gpu_pages * 4; rdev->gart.table_size = rdev->gart.num_gpu_pages * 4;
rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush; rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry; rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry;
...@@ -590,11 +588,9 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev) ...@@ -590,11 +588,9 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev)
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data) static int rv370_debugfs_pcie_gart_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t tmp; uint32_t tmp;
tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL);
...@@ -614,17 +610,16 @@ static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data) ...@@ -614,17 +610,16 @@ static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list rv370_pcie_gart_info_list[] = { DEFINE_SHOW_ATTRIBUTE(rv370_debugfs_pcie_gart_info);
{"rv370_pcie_gart_info", rv370_debugfs_pcie_gart_info, 0, NULL},
};
#endif #endif
static int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev) static void rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, rv370_pcie_gart_info_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("rv370_pcie_gart_info", 0444, root, rdev,
&rv370_debugfs_pcie_gart_info_fops);
#endif #endif
} }
...@@ -1331,12 +1326,8 @@ void r300_set_reg_safe(struct radeon_device *rdev) ...@@ -1331,12 +1326,8 @@ void r300_set_reg_safe(struct radeon_device *rdev)
void r300_mc_program(struct radeon_device *rdev) void r300_mc_program(struct radeon_device *rdev)
{ {
struct r100_mc_save save; struct r100_mc_save save;
int r;
r = r100_debugfs_mc_info_init(rdev); r100_debugfs_mc_info_init(rdev);
if (r) {
dev_err(rdev->dev, "Failed to create r100_mc debugfs file.\n");
}
/* Stops all mc clients */ /* Stops all mc clients */
r100_mc_stop(rdev, &save); r100_mc_stop(rdev, &save);
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
...@@ -187,12 +186,8 @@ void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v) ...@@ -187,12 +186,8 @@ void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v)
static void r420_debugfs(struct radeon_device *rdev) static void r420_debugfs(struct radeon_device *rdev)
{ {
if (r100_debugfs_rbbm_init(rdev)) { r100_debugfs_rbbm_init(rdev);
DRM_ERROR("Failed to register debugfs file for RBBM !\n"); r420_debugfs_pipes_info_init(rdev);
}
if (r420_debugfs_pipes_info_init(rdev)) {
DRM_ERROR("Failed to register debugfs file for pipes !\n");
}
} }
static void r420_clock_resume(struct radeon_device *rdev) static void r420_clock_resume(struct radeon_device *rdev)
...@@ -480,11 +475,9 @@ int r420_init(struct radeon_device *rdev) ...@@ -480,11 +475,9 @@ int r420_init(struct radeon_device *rdev)
* Debugfs info * Debugfs info
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int r420_debugfs_pipes_info(struct seq_file *m, void *data) static int r420_debugfs_pipes_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t tmp; uint32_t tmp;
tmp = RREG32(R400_GB_PIPE_SELECT); tmp = RREG32(R400_GB_PIPE_SELECT);
...@@ -496,16 +489,15 @@ static int r420_debugfs_pipes_info(struct seq_file *m, void *data) ...@@ -496,16 +489,15 @@ static int r420_debugfs_pipes_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list r420_pipes_info_list[] = { DEFINE_SHOW_ATTRIBUTE(r420_debugfs_pipes_info);
{"r420_pipes_info", r420_debugfs_pipes_info, 0, NULL},
};
#endif #endif
int r420_debugfs_pipes_info_init(struct radeon_device *rdev) void r420_debugfs_pipes_info_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, r420_pipes_info_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("r420_pipes_info", 0444, root, rdev,
&r420_debugfs_pipes_info_fops);
#endif #endif
} }
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_vblank.h> #include <drm/drm_vblank.h>
#include <drm/radeon_drm.h> #include <drm/radeon_drm.h>
...@@ -106,7 +105,7 @@ static const u32 crtc_offsets[2] = ...@@ -106,7 +105,7 @@ static const u32 crtc_offsets[2] =
AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL
}; };
int r600_debugfs_mc_info_init(struct radeon_device *rdev); static void r600_debugfs_mc_info_init(struct radeon_device *rdev);
/* r600,rv610,rv630,rv620,rv635,rv670 */ /* r600,rv610,rv630,rv620,rv635,rv670 */
int r600_mc_wait_for_idle(struct radeon_device *rdev); int r600_mc_wait_for_idle(struct radeon_device *rdev);
...@@ -3251,9 +3250,7 @@ int r600_init(struct radeon_device *rdev) ...@@ -3251,9 +3250,7 @@ int r600_init(struct radeon_device *rdev)
{ {
int r; int r;
if (r600_debugfs_mc_info_init(rdev)) { r600_debugfs_mc_info_init(rdev);
DRM_ERROR("Failed to register debugfs file for mc !\n");
}
/* Read BIOS */ /* Read BIOS */
if (!radeon_get_bios(rdev)) { if (!radeon_get_bios(rdev)) {
if (ASIC_IS_AVIVO(rdev)) if (ASIC_IS_AVIVO(rdev))
...@@ -4346,28 +4343,26 @@ int r600_irq_process(struct radeon_device *rdev) ...@@ -4346,28 +4343,26 @@ int r600_irq_process(struct radeon_device *rdev)
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int r600_debugfs_mc_info(struct seq_file *m, void *data) static int r600_debugfs_mc_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
DREG32_SYS(m, rdev, R_000E50_SRBM_STATUS); DREG32_SYS(m, rdev, R_000E50_SRBM_STATUS);
DREG32_SYS(m, rdev, VM_L2_STATUS); DREG32_SYS(m, rdev, VM_L2_STATUS);
return 0; return 0;
} }
static struct drm_info_list r600_mc_info_list[] = { DEFINE_SHOW_ATTRIBUTE(r600_debugfs_mc_info);
{"r600_mc_info", r600_debugfs_mc_info, 0, NULL},
};
#endif #endif
int r600_debugfs_mc_info_init(struct radeon_device *rdev) static void r600_debugfs_mc_info_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, r600_mc_info_list, ARRAY_SIZE(r600_mc_info_list)); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("r600_mc_info", 0444, root, rdev,
&r600_debugfs_mc_info_fops);
#endif #endif
} }
......
...@@ -511,8 +511,6 @@ struct radeon_bo { ...@@ -511,8 +511,6 @@ struct radeon_bo {
}; };
#define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, tbo.base) #define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, tbo.base)
int radeon_gem_debugfs_init(struct radeon_device *rdev);
/* sub-allocation manager, it has to be protected by another lock. /* sub-allocation manager, it has to be protected by another lock.
* By conception this is an helper for other part of the driver * By conception this is an helper for other part of the driver
* like the indirect buffer or semaphore, which both have their * like the indirect buffer or semaphore, which both have their
...@@ -1789,15 +1787,8 @@ static inline void radeon_mn_unregister(struct radeon_bo *bo) {} ...@@ -1789,15 +1787,8 @@ static inline void radeon_mn_unregister(struct radeon_bo *bo) {}
/* /*
* Debugfs * Debugfs
*/ */
struct radeon_debugfs { void radeon_debugfs_fence_init(struct radeon_device *rdev);
struct drm_info_list *files; void radeon_gem_debugfs_init(struct radeon_device *rdev);
unsigned num_files;
};
int radeon_debugfs_add_files(struct radeon_device *rdev,
struct drm_info_list *files,
unsigned nfiles);
int radeon_debugfs_fence_init(struct radeon_device *rdev);
/* /*
* ASIC ring specific functions. * ASIC ring specific functions.
...@@ -2422,9 +2413,6 @@ struct radeon_device { ...@@ -2422,9 +2413,6 @@ struct radeon_device {
struct drm_file *cmask_filp; struct drm_file *cmask_filp;
/* i2c buses */ /* i2c buses */
struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS]; struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS];
/* debugfs */
struct radeon_debugfs debugfs[RADEON_DEBUGFS_MAX_COMPONENTS];
unsigned debugfs_count;
/* virtual memory */ /* virtual memory */
struct radeon_vm_manager vm_manager; struct radeon_vm_manager vm_manager;
struct mutex gpu_clock_mutex; struct mutex gpu_clock_mutex;
......
...@@ -99,8 +99,8 @@ void r100_hpd_fini(struct radeon_device *rdev); ...@@ -99,8 +99,8 @@ void r100_hpd_fini(struct radeon_device *rdev);
bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
void r100_hpd_set_polarity(struct radeon_device *rdev, void r100_hpd_set_polarity(struct radeon_device *rdev,
enum radeon_hpd_id hpd); enum radeon_hpd_id hpd);
int r100_debugfs_rbbm_init(struct radeon_device *rdev); void r100_debugfs_rbbm_init(struct radeon_device *rdev);
int r100_debugfs_cp_init(struct radeon_device *rdev); void r100_debugfs_cp_init(struct radeon_device *rdev);
void r100_cp_disable(struct radeon_device *rdev); void r100_cp_disable(struct radeon_device *rdev);
int r100_cp_init(struct radeon_device *rdev, unsigned ring_size); int r100_cp_init(struct radeon_device *rdev, unsigned ring_size);
void r100_cp_fini(struct radeon_device *rdev); void r100_cp_fini(struct radeon_device *rdev);
...@@ -108,7 +108,7 @@ int r100_pci_gart_init(struct radeon_device *rdev); ...@@ -108,7 +108,7 @@ int r100_pci_gart_init(struct radeon_device *rdev);
void r100_pci_gart_fini(struct radeon_device *rdev); void r100_pci_gart_fini(struct radeon_device *rdev);
int r100_pci_gart_enable(struct radeon_device *rdev); int r100_pci_gart_enable(struct radeon_device *rdev);
void r100_pci_gart_disable(struct radeon_device *rdev); void r100_pci_gart_disable(struct radeon_device *rdev);
int r100_debugfs_mc_info_init(struct radeon_device *rdev); void r100_debugfs_mc_info_init(struct radeon_device *rdev);
int r100_gui_wait_for_idle(struct radeon_device *rdev); int r100_gui_wait_for_idle(struct radeon_device *rdev);
int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
void r100_irq_disable(struct radeon_device *rdev); void r100_irq_disable(struct radeon_device *rdev);
...@@ -199,7 +199,7 @@ extern int r420_resume(struct radeon_device *rdev); ...@@ -199,7 +199,7 @@ extern int r420_resume(struct radeon_device *rdev);
extern void r420_pm_init_profile(struct radeon_device *rdev); extern void r420_pm_init_profile(struct radeon_device *rdev);
extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg); extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg);
extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v); extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v);
extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev); extern void r420_debugfs_pipes_info_init(struct radeon_device *rdev);
extern void r420_pipes_init(struct radeon_device *rdev); extern void r420_pipes_init(struct radeon_device *rdev);
/* /*
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <drm/drm_cache.h> #include <drm/drm_cache.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
...@@ -1448,15 +1447,8 @@ int radeon_device_init(struct radeon_device *rdev, ...@@ -1448,15 +1447,8 @@ int radeon_device_init(struct radeon_device *rdev,
if (r) if (r)
goto failed; goto failed;
r = radeon_gem_debugfs_init(rdev); radeon_gem_debugfs_init(rdev);
if (r) { radeon_mst_debugfs_init(rdev);
DRM_ERROR("registering gem debugfs failed (%d).\n", r);
}
r = radeon_mst_debugfs_init(rdev);
if (r) {
DRM_ERROR("registering mst debugfs failed (%d).\n", r);
}
if (rdev->flags & RADEON_IS_AGP && !rdev->accel_working) { if (rdev->flags & RADEON_IS_AGP && !rdev->accel_working) {
/* Acceleration not working on AGP card try again /* Acceleration not working on AGP card try again
...@@ -1884,38 +1876,3 @@ int radeon_gpu_reset(struct radeon_device *rdev) ...@@ -1884,38 +1876,3 @@ int radeon_gpu_reset(struct radeon_device *rdev)
up_read(&rdev->exclusive_lock); up_read(&rdev->exclusive_lock);
return r; return r;
} }
/*
* Debugfs
*/
int radeon_debugfs_add_files(struct radeon_device *rdev,
struct drm_info_list *files,
unsigned nfiles)
{
unsigned i;
for (i = 0; i < rdev->debugfs_count; i++) {
if (rdev->debugfs[i].files == files) {
/* Already registered */
return 0;
}
}
i = rdev->debugfs_count + 1;
if (i > RADEON_DEBUGFS_MAX_COMPONENTS) {
DRM_ERROR("Reached maximum number of debugfs components.\n");
DRM_ERROR("Report so we increase "
"RADEON_DEBUGFS_MAX_COMPONENTS.\n");
return -EINVAL;
}
rdev->debugfs[rdev->debugfs_count].files = files;
rdev->debugfs[rdev->debugfs_count].num_files = nfiles;
rdev->debugfs_count = i;
#if defined(CONFIG_DEBUG_FS)
drm_debugfs_create_files(files, nfiles,
rdev->ddev->primary->debugfs_root,
rdev->ddev->primary);
#endif
return 0;
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
#include <drm/drm_debugfs.h>
#include <drm/drm_dp_mst_helper.h> #include <drm/drm_dp_mst_helper.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
...@@ -723,10 +722,10 @@ radeon_dp_mst_check_status(struct radeon_connector *radeon_connector) ...@@ -723,10 +722,10 @@ radeon_dp_mst_check_status(struct radeon_connector *radeon_connector)
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_mst_info(struct seq_file *m, void *data) static int radeon_debugfs_mst_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = rdev->ddev;
struct drm_connector *connector; struct drm_connector *connector;
struct radeon_connector *radeon_connector; struct radeon_connector *radeon_connector;
struct radeon_connector_atom_dig *dig_connector; struct radeon_connector_atom_dig *dig_connector;
...@@ -754,15 +753,16 @@ static int radeon_debugfs_mst_info(struct seq_file *m, void *data) ...@@ -754,15 +753,16 @@ static int radeon_debugfs_mst_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list radeon_debugfs_mst_list[] = { DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_mst_info);
{"radeon_mst_info", &radeon_debugfs_mst_info, 0, NULL},
};
#endif #endif
int radeon_mst_debugfs_init(struct radeon_device *rdev) void radeon_mst_debugfs_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, radeon_debugfs_mst_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
debugfs_create_file("radeon_mst_info", 0444, root, rdev,
&radeon_debugfs_mst_info_fops);
#endif #endif
return 0;
} }
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
...@@ -916,9 +915,9 @@ int radeon_fence_driver_init(struct radeon_device *rdev) ...@@ -916,9 +915,9 @@ int radeon_fence_driver_init(struct radeon_device *rdev)
for (ring = 0; ring < RADEON_NUM_RINGS; ring++) { for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
radeon_fence_driver_init_ring(rdev, ring); radeon_fence_driver_init_ring(rdev, ring);
} }
if (radeon_debugfs_fence_init(rdev)) {
dev_err(rdev->dev, "fence debugfs file creation failed\n"); radeon_debugfs_fence_init(rdev);
}
return 0; return 0;
} }
...@@ -973,11 +972,9 @@ void radeon_fence_driver_force_completion(struct radeon_device *rdev, int ring) ...@@ -973,11 +972,9 @@ void radeon_fence_driver_force_completion(struct radeon_device *rdev, int ring)
* Fence debugfs * Fence debugfs
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_fence_info(struct seq_file *m, void *data) static int radeon_debugfs_fence_info_show(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
int i, j; int i, j;
for (i = 0; i < RADEON_NUM_RINGS; ++i) { for (i = 0; i < RADEON_NUM_RINGS; ++i) {
...@@ -1006,33 +1003,34 @@ static int radeon_debugfs_fence_info(struct seq_file *m, void *data) ...@@ -1006,33 +1003,34 @@ static int radeon_debugfs_fence_info(struct seq_file *m, void *data)
* *
* Manually trigger a gpu reset at the next fence wait. * Manually trigger a gpu reset at the next fence wait.
*/ */
static int radeon_debugfs_gpu_reset(struct seq_file *m, void *data) static int radeon_debugfs_gpu_reset(void *data, u64 *val)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)data;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
down_read(&rdev->exclusive_lock); down_read(&rdev->exclusive_lock);
seq_printf(m, "%d\n", rdev->needs_reset); *val = rdev->needs_reset;
rdev->needs_reset = true; rdev->needs_reset = true;
wake_up_all(&rdev->fence_queue); wake_up_all(&rdev->fence_queue);
up_read(&rdev->exclusive_lock); up_read(&rdev->exclusive_lock);
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_fence_info);
static struct drm_info_list radeon_debugfs_fence_list[] = { DEFINE_DEBUGFS_ATTRIBUTE(radeon_debugfs_gpu_reset_fops,
{"radeon_fence_info", &radeon_debugfs_fence_info, 0, NULL}, radeon_debugfs_gpu_reset, NULL, "%lld\n");
{"radeon_gpu_reset", &radeon_debugfs_gpu_reset, 0, NULL}
};
#endif #endif
int radeon_debugfs_fence_init(struct radeon_device *rdev) void radeon_debugfs_fence_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, radeon_debugfs_fence_list, 2); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("radeon_gpu_reset", 0444, root, rdev,
&radeon_debugfs_gpu_reset_fops);
debugfs_create_file("radeon_fence_info", 0444, root, rdev,
&radeon_debugfs_fence_info_fops);
#endif #endif
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_gem_ttm_helper.h>
...@@ -801,11 +800,9 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, ...@@ -801,11 +800,9 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_gem_info(struct seq_file *m, void *data) static int radeon_debugfs_gem_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
struct radeon_bo *rbo; struct radeon_bo *rbo;
unsigned i = 0; unsigned i = 0;
...@@ -836,15 +833,16 @@ static int radeon_debugfs_gem_info(struct seq_file *m, void *data) ...@@ -836,15 +833,16 @@ static int radeon_debugfs_gem_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list radeon_debugfs_gem_list[] = { DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_gem_info);
{"radeon_gem_info", &radeon_debugfs_gem_info, 0, NULL},
};
#endif #endif
int radeon_gem_debugfs_init(struct radeon_device *rdev) void radeon_gem_debugfs_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, radeon_debugfs_gem_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
debugfs_create_file("radeon_gem_info", 0444, root, rdev,
&radeon_debugfs_gem_info_fops);
#endif #endif
return 0;
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
* Christian König * Christian König
*/ */
#include <drm/drm_debugfs.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include "radeon.h" #include "radeon.h"
...@@ -41,7 +40,7 @@ ...@@ -41,7 +40,7 @@
* produce command buffers which are send to the kernel and * produce command buffers which are send to the kernel and
* put in IBs for execution by the requested ring. * put in IBs for execution by the requested ring.
*/ */
static int radeon_debugfs_sa_init(struct radeon_device *rdev); static void radeon_debugfs_sa_init(struct radeon_device *rdev);
/** /**
* radeon_ib_get - request an IB (Indirect Buffer) * radeon_ib_get - request an IB (Indirect Buffer)
...@@ -225,9 +224,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev) ...@@ -225,9 +224,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
} }
rdev->ib_pool_ready = true; rdev->ib_pool_ready = true;
if (radeon_debugfs_sa_init(rdev)) { radeon_debugfs_sa_init(rdev);
dev_err(rdev->dev, "failed to register debugfs file for SA\n");
}
return 0; return 0;
} }
...@@ -295,11 +292,9 @@ int radeon_ib_ring_tests(struct radeon_device *rdev) ...@@ -295,11 +292,9 @@ int radeon_ib_ring_tests(struct radeon_device *rdev)
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_sa_info(struct seq_file *m, void *data) static int radeon_debugfs_sa_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
radeon_sa_bo_dump_debug_info(&rdev->ring_tmp_bo, m); radeon_sa_bo_dump_debug_info(&rdev->ring_tmp_bo, m);
...@@ -307,17 +302,16 @@ static int radeon_debugfs_sa_info(struct seq_file *m, void *data) ...@@ -307,17 +302,16 @@ static int radeon_debugfs_sa_info(struct seq_file *m, void *data)
} }
static struct drm_info_list radeon_debugfs_sa_list[] = { DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_sa_info);
{"radeon_sa_info", &radeon_debugfs_sa_info, 0, NULL},
};
#endif #endif
static int radeon_debugfs_sa_init(struct radeon_device *rdev) static void radeon_debugfs_sa_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, radeon_debugfs_sa_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("radeon_sa_info", 0444, root, rdev,
&radeon_debugfs_sa_info_fops);
#endif #endif
} }
...@@ -994,7 +994,7 @@ int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tile ...@@ -994,7 +994,7 @@ int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tile
int radeon_dp_mst_init(struct radeon_connector *radeon_connector); int radeon_dp_mst_init(struct radeon_connector *radeon_connector);
int radeon_dp_mst_probe(struct radeon_connector *radeon_connector); int radeon_dp_mst_probe(struct radeon_connector *radeon_connector);
int radeon_dp_mst_check_status(struct radeon_connector *radeon_connector); int radeon_dp_mst_check_status(struct radeon_connector *radeon_connector);
int radeon_mst_debugfs_init(struct radeon_device *rdev); void radeon_mst_debugfs_init(struct radeon_device *rdev);
void radeon_dp_mst_prepare_pll(struct drm_crtc *crtc, struct drm_display_mode *mode); void radeon_dp_mst_prepare_pll(struct drm_crtc *crtc, struct drm_display_mode *mode);
void radeon_setup_mst_connector(struct drm_device *dev); void radeon_setup_mst_connector(struct drm_device *dev);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_vblank.h> #include <drm/drm_vblank.h>
#include "atom.h" #include "atom.h"
...@@ -48,7 +47,7 @@ static const char *radeon_pm_state_type_name[5] = { ...@@ -48,7 +47,7 @@ static const char *radeon_pm_state_type_name[5] = {
}; };
static void radeon_dynpm_idle_work_handler(struct work_struct *work); static void radeon_dynpm_idle_work_handler(struct work_struct *work);
static int radeon_debugfs_pm_init(struct radeon_device *rdev); static void radeon_debugfs_pm_init(struct radeon_device *rdev);
static bool radeon_pm_in_vbl(struct radeon_device *rdev); static bool radeon_pm_in_vbl(struct radeon_device *rdev);
static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish); static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
static void radeon_pm_update_profile(struct radeon_device *rdev); static void radeon_pm_update_profile(struct radeon_device *rdev);
...@@ -1399,10 +1398,7 @@ static int radeon_pm_init_old(struct radeon_device *rdev) ...@@ -1399,10 +1398,7 @@ static int radeon_pm_init_old(struct radeon_device *rdev)
INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
if (rdev->pm.num_power_states > 1) { if (rdev->pm.num_power_states > 1) {
if (radeon_debugfs_pm_init(rdev)) { radeon_debugfs_pm_init(rdev);
DRM_ERROR("Failed to register debugfs file for PM!\n");
}
DRM_INFO("radeon: power management initialized\n"); DRM_INFO("radeon: power management initialized\n");
} }
...@@ -1456,9 +1452,7 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev) ...@@ -1456,9 +1452,7 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
goto dpm_failed; goto dpm_failed;
rdev->pm.dpm_enabled = true; rdev->pm.dpm_enabled = true;
if (radeon_debugfs_pm_init(rdev)) { radeon_debugfs_pm_init(rdev);
DRM_ERROR("Failed to register debugfs file for dpm!\n");
}
DRM_INFO("radeon: dpm initialized\n"); DRM_INFO("radeon: dpm initialized\n");
...@@ -1916,11 +1910,9 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work) ...@@ -1916,11 +1910,9 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_pm_info(struct seq_file *m, void *data) static int radeon_debugfs_pm_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
struct drm_device *ddev = rdev->ddev; struct drm_device *ddev = rdev->ddev;
if ((rdev->flags & RADEON_IS_PX) && if ((rdev->flags & RADEON_IS_PX) &&
...@@ -1952,16 +1944,16 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data) ...@@ -1952,16 +1944,16 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list radeon_pm_info_list[] = { DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_pm_info);
{"radeon_pm_info", radeon_debugfs_pm_info, 0, NULL},
};
#endif #endif
static int radeon_debugfs_pm_init(struct radeon_device *rdev) static void radeon_debugfs_pm_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, radeon_pm_info_list, ARRAY_SIZE(radeon_pm_info_list)); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("radeon_pm_info", 0444, root, rdev,
&radeon_debugfs_pm_info_fops);
#endif #endif
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
* Christian König * Christian König
*/ */
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
...@@ -46,7 +45,7 @@ ...@@ -46,7 +45,7 @@
* wptr. The GPU then starts fetching commands and executes * wptr. The GPU then starts fetching commands and executes
* them until the pointers are equal again. * them until the pointers are equal again.
*/ */
static int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring); static void radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring);
/** /**
* radeon_ring_supports_scratch_reg - check if the ring supports * radeon_ring_supports_scratch_reg - check if the ring supports
...@@ -422,9 +421,7 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig ...@@ -422,9 +421,7 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig
ring->next_rptr_gpu_addr = rdev->wb.gpu_addr + index; ring->next_rptr_gpu_addr = rdev->wb.gpu_addr + index;
ring->next_rptr_cpu_addr = &rdev->wb.wb[index/4]; ring->next_rptr_cpu_addr = &rdev->wb.wb[index/4];
} }
if (radeon_debugfs_ring_init(rdev, ring)) { radeon_debugfs_ring_init(rdev, ring);
DRM_ERROR("Failed to register debugfs file for rings !\n");
}
radeon_ring_lockup_update(rdev, ring); radeon_ring_lockup_update(rdev, ring);
return 0; return 0;
} }
...@@ -465,13 +462,10 @@ void radeon_ring_fini(struct radeon_device *rdev, struct radeon_ring *ring) ...@@ -465,13 +462,10 @@ void radeon_ring_fini(struct radeon_device *rdev, struct radeon_ring *ring)
*/ */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_ring_info(struct seq_file *m, void *data) static int radeon_debugfs_ring_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_ring *ring = (struct radeon_ring *) m->private;
struct drm_device *dev = node->minor->dev; struct radeon_device *rdev = ring->rdev;
struct radeon_device *rdev = dev->dev_private;
int ridx = *(int*)node->info_ent->data;
struct radeon_ring *ring = &rdev->ring[ridx];
uint32_t rptr, wptr, rptr_next; uint32_t rptr, wptr, rptr_next;
unsigned count, i, j; unsigned count, i, j;
...@@ -522,44 +516,43 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data) ...@@ -522,44 +516,43 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static int radeon_gfx_index = RADEON_RING_TYPE_GFX_INDEX; DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_ring_info);
static int cayman_cp1_index = CAYMAN_RING_TYPE_CP1_INDEX;
static int cayman_cp2_index = CAYMAN_RING_TYPE_CP2_INDEX; static const char *radeon_debugfs_ring_idx_to_name(uint32_t ridx)
static int radeon_dma1_index = R600_RING_TYPE_DMA_INDEX; {
static int radeon_dma2_index = CAYMAN_RING_TYPE_DMA1_INDEX; switch (ridx) {
static int r600_uvd_index = R600_RING_TYPE_UVD_INDEX; case RADEON_RING_TYPE_GFX_INDEX:
static int si_vce1_index = TN_RING_TYPE_VCE1_INDEX; return "radeon_ring_gfx";
static int si_vce2_index = TN_RING_TYPE_VCE2_INDEX; case CAYMAN_RING_TYPE_CP1_INDEX:
return "radeon_ring_cp1";
static struct drm_info_list radeon_debugfs_ring_info_list[] = { case CAYMAN_RING_TYPE_CP2_INDEX:
{"radeon_ring_gfx", radeon_debugfs_ring_info, 0, &radeon_gfx_index}, return "radeon_ring_cp2";
{"radeon_ring_cp1", radeon_debugfs_ring_info, 0, &cayman_cp1_index}, case R600_RING_TYPE_DMA_INDEX:
{"radeon_ring_cp2", radeon_debugfs_ring_info, 0, &cayman_cp2_index}, return "radeon_ring_dma1";
{"radeon_ring_dma1", radeon_debugfs_ring_info, 0, &radeon_dma1_index}, case CAYMAN_RING_TYPE_DMA1_INDEX:
{"radeon_ring_dma2", radeon_debugfs_ring_info, 0, &radeon_dma2_index}, return "radeon_ring_dma2";
{"radeon_ring_uvd", radeon_debugfs_ring_info, 0, &r600_uvd_index}, case R600_RING_TYPE_UVD_INDEX:
{"radeon_ring_vce1", radeon_debugfs_ring_info, 0, &si_vce1_index}, return "radeon_ring_uvd";
{"radeon_ring_vce2", radeon_debugfs_ring_info, 0, &si_vce2_index}, case TN_RING_TYPE_VCE1_INDEX:
}; return "radeon_ring_vce1";
case TN_RING_TYPE_VCE2_INDEX:
return "radeon_ring_vce2";
default:
return NULL;
}
}
#endif #endif
static int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring) static void radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
unsigned i; const char *ring_name = radeon_debugfs_ring_idx_to_name(ring->idx);
for (i = 0; i < ARRAY_SIZE(radeon_debugfs_ring_info_list); ++i) { struct dentry *root = rdev->ddev->primary->debugfs_root;
struct drm_info_list *info = &radeon_debugfs_ring_info_list[i];
int ridx = *(int*)radeon_debugfs_ring_info_list[i].data;
unsigned r;
if (&rdev->ring[ridx] != ring) if (ring_name)
continue; debugfs_create_file(ring_name, 0444, root, ring,
&radeon_debugfs_ring_info_fops);
r = radeon_debugfs_add_files(rdev, info, 1);
if (r)
return r;
}
#endif #endif
return 0;
} }
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <linux/swiotlb.h> #include <linux/swiotlb.h>
#include <drm/drm_agpsupport.h> #include <drm/drm_agpsupport.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_prime.h> #include <drm/drm_prime.h>
...@@ -52,7 +51,7 @@ ...@@ -52,7 +51,7 @@
#include "radeon.h" #include "radeon.h"
#include "radeon_ttm.h" #include "radeon_ttm.h"
static int radeon_ttm_debugfs_init(struct radeon_device *rdev); static void radeon_ttm_debugfs_init(struct radeon_device *rdev);
static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev, static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev,
struct ttm_tt *ttm, struct ttm_tt *ttm,
...@@ -762,11 +761,8 @@ int radeon_ttm_init(struct radeon_device *rdev) ...@@ -762,11 +761,8 @@ int radeon_ttm_init(struct radeon_device *rdev)
DRM_INFO("radeon: %uM of GTT memory ready.\n", DRM_INFO("radeon: %uM of GTT memory ready.\n",
(unsigned)(rdev->mc.gtt_size / (1024 * 1024))); (unsigned)(rdev->mc.gtt_size / (1024 * 1024)));
r = radeon_ttm_debugfs_init(rdev); radeon_ttm_debugfs_init(rdev);
if (r) {
DRM_ERROR("Failed to init debugfs\n");
return r;
}
return 0; return 0;
} }
...@@ -862,36 +858,38 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma) ...@@ -862,36 +858,38 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int radeon_mm_dump_table(struct seq_file *m, void *data) static int radeon_mm_vram_dump_table_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
unsigned ttm_pl = *(int*)node->info_ent->data; struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev,
struct drm_device *dev = node->minor->dev; TTM_PL_VRAM);
struct radeon_device *rdev = dev->dev_private;
struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev, ttm_pl);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
man->func->debug(man, &p); man->func->debug(man, &p);
return 0; return 0;
} }
static int radeon_ttm_pool_debugfs(struct seq_file *m, void *data) static int radeon_ttm_page_pool_show(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
return ttm_pool_debugfs(&rdev->mman.bdev.pool, m); return ttm_pool_debugfs(&rdev->mman.bdev.pool, m);
} }
static int ttm_pl_vram = TTM_PL_VRAM; static int radeon_mm_gtt_dump_table_show(struct seq_file *m, void *unused)
static int ttm_pl_tt = TTM_PL_TT; {
struct radeon_device *rdev = (struct radeon_device *)m->private;
struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev,
TTM_PL_TT);
struct drm_printer p = drm_seq_file_printer(m);
static struct drm_info_list radeon_ttm_debugfs_list[] = { man->func->debug(man, &p);
{"radeon_vram_mm", radeon_mm_dump_table, 0, &ttm_pl_vram}, return 0;
{"radeon_gtt_mm", radeon_mm_dump_table, 0, &ttm_pl_tt}, }
{"ttm_page_pool", radeon_ttm_pool_debugfs, 0, NULL}
}; DEFINE_SHOW_ATTRIBUTE(radeon_mm_vram_dump_table);
DEFINE_SHOW_ATTRIBUTE(radeon_mm_gtt_dump_table);
DEFINE_SHOW_ATTRIBUTE(radeon_ttm_page_pool);
static int radeon_ttm_vram_open(struct inode *inode, struct file *filep) static int radeon_ttm_vram_open(struct inode *inode, struct file *filep)
{ {
...@@ -1001,25 +999,23 @@ static const struct file_operations radeon_ttm_gtt_fops = { ...@@ -1001,25 +999,23 @@ static const struct file_operations radeon_ttm_gtt_fops = {
#endif #endif
static int radeon_ttm_debugfs_init(struct radeon_device *rdev) static void radeon_ttm_debugfs_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
unsigned count;
struct drm_minor *minor = rdev->ddev->primary; struct drm_minor *minor = rdev->ddev->primary;
struct dentry *root = minor->debugfs_root; struct dentry *root = minor->debugfs_root;
debugfs_create_file("radeon_vram", S_IFREG | S_IRUGO, root, rdev, debugfs_create_file("radeon_vram", 0444, root, rdev,
&radeon_ttm_vram_fops); &radeon_ttm_vram_fops);
debugfs_create_file("radeon_gtt", S_IFREG | S_IRUGO, root, rdev, debugfs_create_file("radeon_gtt", 0444, root, rdev,
&radeon_ttm_gtt_fops); &radeon_ttm_gtt_fops);
count = ARRAY_SIZE(radeon_ttm_debugfs_list); debugfs_create_file("radeon_vram_mm", 0444, root, rdev,
&radeon_mm_vram_dump_table_fops);
return radeon_debugfs_add_files(rdev, radeon_ttm_debugfs_list, count); debugfs_create_file("radeon_gtt_mm", 0444, root, rdev,
#else &radeon_mm_gtt_dump_table_fops);
debugfs_create_file("ttm_page_pool", 0444, root, rdev,
return 0; &radeon_ttm_page_pool_fops);
#endif #endif
} }
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
...@@ -38,7 +37,7 @@ ...@@ -38,7 +37,7 @@
#include "rs400d.h" #include "rs400d.h"
/* This files gather functions specifics to : rs400,rs480 */ /* This files gather functions specifics to : rs400,rs480 */
static int rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev); static void rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev);
void rs400_gart_adjust_size(struct radeon_device *rdev) void rs400_gart_adjust_size(struct radeon_device *rdev)
{ {
...@@ -103,8 +102,7 @@ int rs400_gart_init(struct radeon_device *rdev) ...@@ -103,8 +102,7 @@ int rs400_gart_init(struct radeon_device *rdev)
r = radeon_gart_init(rdev); r = radeon_gart_init(rdev);
if (r) if (r)
return r; return r;
if (rs400_debugfs_pcie_gart_info_init(rdev)) rs400_debugfs_pcie_gart_info_init(rdev);
DRM_ERROR("Failed to register debugfs file for RS400 GART !\n");
rdev->gart.table_size = rdev->gart.num_gpu_pages * 4; rdev->gart.table_size = rdev->gart.num_gpu_pages * 4;
return radeon_gart_table_ram_alloc(rdev); return radeon_gart_table_ram_alloc(rdev);
} }
...@@ -307,11 +305,9 @@ void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) ...@@ -307,11 +305,9 @@ void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int rs400_debugfs_gart_info(struct seq_file *m, void *data) static int rs400_debugfs_gart_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t tmp; uint32_t tmp;
tmp = RREG32(RADEON_HOST_PATH_CNTL); tmp = RREG32(RADEON_HOST_PATH_CNTL);
...@@ -376,17 +372,16 @@ static int rs400_debugfs_gart_info(struct seq_file *m, void *data) ...@@ -376,17 +372,16 @@ static int rs400_debugfs_gart_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list rs400_gart_info_list[] = { DEFINE_SHOW_ATTRIBUTE(rs400_debugfs_gart_info);
{"rs400_gart_info", rs400_debugfs_gart_info, 0, NULL},
};
#endif #endif
static int rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev) static void rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, rs400_gart_info_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0; debugfs_create_file("rs400_gart_info", 0444, root, rdev,
&rs400_debugfs_gart_info_fops);
#endif #endif
} }
......
...@@ -945,12 +945,6 @@ void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) ...@@ -945,12 +945,6 @@ void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); spin_unlock_irqrestore(&rdev->mc_idx_lock, flags);
} }
static void rs600_debugfs(struct radeon_device *rdev)
{
if (r100_debugfs_rbbm_init(rdev))
DRM_ERROR("Failed to register debugfs file for RBBM !\n");
}
void rs600_set_safe_registers(struct radeon_device *rdev) void rs600_set_safe_registers(struct radeon_device *rdev)
{ {
rdev->config.r300.reg_safe_bm = rs600_reg_safe_bm; rdev->config.r300.reg_safe_bm = rs600_reg_safe_bm;
...@@ -1136,7 +1130,7 @@ int rs600_init(struct radeon_device *rdev) ...@@ -1136,7 +1130,7 @@ int rs600_init(struct radeon_device *rdev)
radeon_get_clock_info(rdev->ddev); radeon_get_clock_info(rdev->ddev);
/* initialize memory controller */ /* initialize memory controller */
rs600_mc_init(rdev); rs600_mc_init(rdev);
rs600_debugfs(rdev); r100_debugfs_rbbm_init(rdev);
/* Fence driver */ /* Fence driver */
r = radeon_fence_driver_init(rdev); r = radeon_fence_driver_init(rdev);
if (r) if (r)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
...@@ -40,8 +39,6 @@ ...@@ -40,8 +39,6 @@
#include "rv515d.h" #include "rv515d.h"
/* This files gather functions specifics to: rv515 */ /* This files gather functions specifics to: rv515 */
static int rv515_debugfs_pipes_info_init(struct radeon_device *rdev);
static int rv515_debugfs_ga_info_init(struct radeon_device *rdev);
static void rv515_gpu_init(struct radeon_device *rdev); static void rv515_gpu_init(struct radeon_device *rdev);
int rv515_mc_wait_for_idle(struct radeon_device *rdev); int rv515_mc_wait_for_idle(struct radeon_device *rdev);
...@@ -51,19 +48,6 @@ static const u32 crtc_offsets[2] = ...@@ -51,19 +48,6 @@ static const u32 crtc_offsets[2] =
AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL
}; };
void rv515_debugfs(struct radeon_device *rdev)
{
if (r100_debugfs_rbbm_init(rdev)) {
DRM_ERROR("Failed to register debugfs file for RBBM !\n");
}
if (rv515_debugfs_pipes_info_init(rdev)) {
DRM_ERROR("Failed to register debugfs file for pipes !\n");
}
if (rv515_debugfs_ga_info_init(rdev)) {
DRM_ERROR("Failed to register debugfs file for pipes !\n");
}
}
void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring)
{ {
int r; int r;
...@@ -235,11 +219,9 @@ void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) ...@@ -235,11 +219,9 @@ void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
static int rv515_debugfs_pipes_info(struct seq_file *m, void *data) static int rv515_debugfs_pipes_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t tmp; uint32_t tmp;
tmp = RREG32(GB_PIPE_SELECT); tmp = RREG32(GB_PIPE_SELECT);
...@@ -253,11 +235,9 @@ static int rv515_debugfs_pipes_info(struct seq_file *m, void *data) ...@@ -253,11 +235,9 @@ static int rv515_debugfs_pipes_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static int rv515_debugfs_ga_info(struct seq_file *m, void *data) static int rv515_debugfs_ga_info_show(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct radeon_device *rdev = (struct radeon_device *)m->private;
struct drm_device *dev = node->minor->dev;
struct radeon_device *rdev = dev->dev_private;
uint32_t tmp; uint32_t tmp;
tmp = RREG32(0x2140); tmp = RREG32(0x2140);
...@@ -268,31 +248,21 @@ static int rv515_debugfs_ga_info(struct seq_file *m, void *data) ...@@ -268,31 +248,21 @@ static int rv515_debugfs_ga_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static struct drm_info_list rv515_pipes_info_list[] = { DEFINE_SHOW_ATTRIBUTE(rv515_debugfs_pipes_info);
{"rv515_pipes_info", rv515_debugfs_pipes_info, 0, NULL}, DEFINE_SHOW_ATTRIBUTE(rv515_debugfs_ga_info);
};
static struct drm_info_list rv515_ga_info_list[] = {
{"rv515_ga_info", rv515_debugfs_ga_info, 0, NULL},
};
#endif #endif
static int rv515_debugfs_pipes_info_init(struct radeon_device *rdev) void rv515_debugfs(struct radeon_device *rdev)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
return radeon_debugfs_add_files(rdev, rv515_pipes_info_list, 1); struct dentry *root = rdev->ddev->primary->debugfs_root;
#else
return 0;
#endif
}
static int rv515_debugfs_ga_info_init(struct radeon_device *rdev) debugfs_create_file("rv515_pipes_info", 0444, root, rdev,
{ &rv515_debugfs_pipes_info_fops);
#if defined(CONFIG_DEBUG_FS) debugfs_create_file("rv515_ga_info", 0444, root, rdev,
return radeon_debugfs_add_files(rdev, rv515_ga_info_list, 1); &rv515_debugfs_ga_info_fops);
#else
return 0;
#endif #endif
r100_debugfs_rbbm_init(rdev);
} }
void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save) void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment