1313#include <linux/seq_file.h>
1414
1515#include "ptdma.h"
16+ #include "../ae4dma/ae4dma.h"
1617
1718/* DebugFS helpers */
1819#define RI_VERSION_NUM 0x0000003F
2324static int pt_debugfs_info_show (struct seq_file * s , void * p )
2425{
2526 struct pt_device * pt = s -> private ;
27+ struct ae4_device * ae4 ;
2628 unsigned int regval ;
2729
2830 seq_printf (s , "Device name: %s\n" , dev_name (pt -> dev ));
29- seq_printf (s , " # Queues: %d\n" , 1 );
30- seq_printf (s , " # Cmds: %d\n" , pt -> cmd_count );
31+
32+ if (pt -> ver == AE4_DMA_VERSION ) {
33+ ae4 = container_of (pt , struct ae4_device , pt );
34+ seq_printf (s , " # Queues: %d\n" , ae4 -> cmd_q_count );
35+ seq_printf (s , " # Cmds per queue: %d\n" , CMD_Q_LEN );
36+ } else {
37+ seq_printf (s , " # Queues: %d\n" , 1 );
38+ seq_printf (s , " # Cmds: %d\n" , pt -> cmd_count );
39+ }
3140
3241 regval = ioread32 (pt -> io_regs + CMD_PT_VERSION );
3342
@@ -55,25 +64,32 @@ static int pt_debugfs_stats_show(struct seq_file *s, void *p)
5564static int pt_debugfs_queue_show (struct seq_file * s , void * p )
5665{
5766 struct pt_cmd_queue * cmd_q = s -> private ;
67+ struct pt_device * pt ;
5868 unsigned int regval ;
5969
6070 if (!cmd_q )
6171 return 0 ;
6272
6373 seq_printf (s , " Pass-Thru: %ld\n" , cmd_q -> total_pt_ops );
6474
65- regval = ioread32 (cmd_q -> reg_control + 0x000C );
66-
67- seq_puts (s , " Enabled Interrupts:" );
68- if (regval & INT_EMPTY_QUEUE )
69- seq_puts (s , " EMPTY" );
70- if (regval & INT_QUEUE_STOPPED )
71- seq_puts (s , " STOPPED" );
72- if (regval & INT_ERROR )
73- seq_puts (s , " ERROR" );
74- if (regval & INT_COMPLETION )
75- seq_puts (s , " COMPLETION" );
76- seq_puts (s , "\n" );
75+ pt = cmd_q -> pt ;
76+ if (pt -> ver == AE4_DMA_VERSION ) {
77+ regval = readl (cmd_q -> reg_control + 0x4 );
78+ seq_printf (s , " Enabled Interrupts:: status 0x%x\n" , regval );
79+ } else {
80+ regval = ioread32 (cmd_q -> reg_control + 0x000C );
81+
82+ seq_puts (s , " Enabled Interrupts:" );
83+ if (regval & INT_EMPTY_QUEUE )
84+ seq_puts (s , " EMPTY" );
85+ if (regval & INT_QUEUE_STOPPED )
86+ seq_puts (s , " STOPPED" );
87+ if (regval & INT_ERROR )
88+ seq_puts (s , " ERROR" );
89+ if (regval & INT_COMPLETION )
90+ seq_puts (s , " COMPLETION" );
91+ seq_puts (s , "\n" );
92+ }
7793
7894 return 0 ;
7995}
@@ -84,8 +100,12 @@ DEFINE_SHOW_ATTRIBUTE(pt_debugfs_stats);
84100
85101void ptdma_debugfs_setup (struct pt_device * pt )
86102{
87- struct pt_cmd_queue * cmd_q ;
88103 struct dentry * debugfs_q_instance ;
104+ struct ae4_cmd_queue * ae4cmd_q ;
105+ struct pt_cmd_queue * cmd_q ;
106+ struct ae4_device * ae4 ;
107+ char name [30 ];
108+ int i ;
89109
90110 if (!debugfs_initialized ())
91111 return ;
@@ -96,11 +116,27 @@ void ptdma_debugfs_setup(struct pt_device *pt)
96116 debugfs_create_file ("stats" , 0400 , pt -> dma_dev .dbg_dev_root , pt ,
97117 & pt_debugfs_stats_fops );
98118
99- cmd_q = & pt -> cmd_q ;
100-
101- debugfs_q_instance =
102- debugfs_create_dir ("q" , pt -> dma_dev .dbg_dev_root );
103119
104- debugfs_create_file ("stats" , 0400 , debugfs_q_instance , cmd_q ,
105- & pt_debugfs_queue_fops );
120+ if (pt -> ver == AE4_DMA_VERSION ) {
121+ ae4 = container_of (pt , struct ae4_device , pt );
122+ for (i = 0 ; i < ae4 -> cmd_q_count ; i ++ ) {
123+ ae4cmd_q = & ae4 -> ae4cmd_q [i ];
124+ cmd_q = & ae4cmd_q -> cmd_q ;
125+
126+ memset (name , 0 , sizeof (name ));
127+ snprintf (name , 29 , "q%d" , ae4cmd_q -> id );
128+
129+ debugfs_q_instance =
130+ debugfs_create_dir (name , pt -> dma_dev .dbg_dev_root );
131+
132+ debugfs_create_file ("stats" , 0400 , debugfs_q_instance , cmd_q ,
133+ & pt_debugfs_queue_fops );
134+ }
135+ } else {
136+ debugfs_q_instance =
137+ debugfs_create_dir ("q" , pt -> dma_dev .dbg_dev_root );
138+ cmd_q = & pt -> cmd_q ;
139+ debugfs_create_file ("stats" , 0400 , debugfs_q_instance , cmd_q ,
140+ & pt_debugfs_queue_fops );
141+ }
106142}
0 commit comments