Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
e6da96ac
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e6da96ac
编写于
12月 22, 2008
作者:
K
Krzysztof Hałasa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IXP4xx: move common debugging from network drivers to QMGR module.
Signed-off-by:
N
Krzysztof Hałasa
<
khc@pm.waw.pl
>
上级
9251ce95
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
100 deletion
+85
-100
arch/arm/mach-ixp4xx/include/mach/qmgr.h
arch/arm/mach-ixp4xx/include/mach/qmgr.h
+33
-2
arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+29
-12
drivers/net/arm/ixp4xx_eth.c
drivers/net/arm/ixp4xx_eth.c
+12
-43
drivers/net/wan/ixp4xx_hss.c
drivers/net/wan/ixp4xx_hss.c
+11
-43
未找到文件。
arch/arm/mach-ixp4xx/include/mach/qmgr.h
浏览文件 @
e6da96ac
...
...
@@ -12,6 +12,8 @@
#include <linux/io.h>
#include <linux/kernel.h>
#define DEBUG_QMGR 0
#define HALF_QUEUES 32
#define QUEUES 64
/* only 32 lower queues currently supported */
#define MAX_QUEUE_LENGTH 4
/* in dwords */
...
...
@@ -61,22 +63,51 @@ void qmgr_enable_irq(unsigned int queue);
void
qmgr_disable_irq
(
unsigned
int
queue
);
/* request_ and release_queue() must be called from non-IRQ context */
#if DEBUG_QMGR
extern
char
qmgr_queue_descs
[
QUEUES
][
32
];
int
qmgr_request_queue
(
unsigned
int
queue
,
unsigned
int
len
/* dwords */
,
unsigned
int
nearly_empty_watermark
,
unsigned
int
nearly_full_watermark
);
unsigned
int
nearly_full_watermark
,
const
char
*
desc_format
,
const
char
*
name
);
#else
int
__qmgr_request_queue
(
unsigned
int
queue
,
unsigned
int
len
/* dwords */
,
unsigned
int
nearly_empty_watermark
,
unsigned
int
nearly_full_watermark
);
#define qmgr_request_queue(queue, len, nearly_empty_watermark, \
nearly_full_watermark, desc_format, name) \
__qmgr_request_queue(queue, len, nearly_empty_watermark, \
nearly_full_watermark)
#endif
void
qmgr_release_queue
(
unsigned
int
queue
);
static
inline
void
qmgr_put_entry
(
unsigned
int
queue
,
u32
val
)
{
extern
struct
qmgr_regs
__iomem
*
qmgr_regs
;
#if DEBUG_QMGR
BUG_ON
(
!
qmgr_queue_descs
[
queue
]);
/* not yet requested */
printk
(
KERN_DEBUG
"Queue %s(%i) put %X
\n
"
,
qmgr_queue_descs
[
queue
],
queue
,
val
);
#endif
__raw_writel
(
val
,
&
qmgr_regs
->
acc
[
queue
][
0
]);
}
static
inline
u32
qmgr_get_entry
(
unsigned
int
queue
)
{
u32
val
;
extern
struct
qmgr_regs
__iomem
*
qmgr_regs
;
return
__raw_readl
(
&
qmgr_regs
->
acc
[
queue
][
0
]);
val
=
__raw_readl
(
&
qmgr_regs
->
acc
[
queue
][
0
]);
#if DEBUG_QMGR
BUG_ON
(
!
qmgr_queue_descs
[
queue
]);
/* not yet requested */
printk
(
KERN_DEBUG
"Queue %s(%i) get %X
\n
"
,
qmgr_queue_descs
[
queue
],
queue
,
val
);
#endif
return
val
;
}
static
inline
int
qmgr_get_stat1
(
unsigned
int
queue
)
...
...
arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
浏览文件 @
e6da96ac
...
...
@@ -14,8 +14,6 @@
#include <linux/module.h>
#include <mach/qmgr.h>
#define DEBUG 0
struct
qmgr_regs
__iomem
*
qmgr_regs
;
static
struct
resource
*
mem_res
;
static
spinlock_t
qmgr_lock
;
...
...
@@ -23,6 +21,10 @@ static u32 used_sram_bitmap[4]; /* 128 16-dword pages */
static
void
(
*
irq_handlers
[
HALF_QUEUES
])(
void
*
pdev
);
static
void
*
irq_pdevs
[
HALF_QUEUES
];
#if DEBUG_QMGR
char
qmgr_queue_descs
[
QUEUES
][
32
];
#endif
void
qmgr_set_irq
(
unsigned
int
queue
,
int
src
,
void
(
*
handler
)(
void
*
pdev
),
void
*
pdev
)
{
...
...
@@ -82,9 +84,16 @@ static inline void shift_mask(u32 *mask)
mask
[
0
]
<<=
1
;
}
#if DEBUG_QMGR
int
qmgr_request_queue
(
unsigned
int
queue
,
unsigned
int
len
/* dwords */
,
unsigned
int
nearly_empty_watermark
,
unsigned
int
nearly_full_watermark
)
unsigned
int
nearly_full_watermark
,
const
char
*
desc_format
,
const
char
*
name
)
#else
int
__qmgr_request_queue
(
unsigned
int
queue
,
unsigned
int
len
/* dwords */
,
unsigned
int
nearly_empty_watermark
,
unsigned
int
nearly_full_watermark
)
#endif
{
u32
cfg
,
addr
=
0
,
mask
[
4
];
/* in 16-dwords */
int
err
;
...
...
@@ -152,12 +161,13 @@ int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
used_sram_bitmap
[
2
]
|=
mask
[
2
];
used_sram_bitmap
[
3
]
|=
mask
[
3
];
__raw_writel
(
cfg
|
(
addr
<<
14
),
&
qmgr_regs
->
sram
[
queue
]);
spin_unlock_irq
(
&
qmgr_lock
);
#if DEBUG
printk
(
KERN_DEBUG
"qmgr: requested queue %
i,
addr = 0x%02X
\n
"
,
queue
,
addr
);
#if DEBUG_QMGR
snprintf
(
qmgr_queue_descs
[
queue
],
sizeof
(
qmgr_queue_descs
[
0
]),
desc_format
,
name
);
printk
(
KERN_DEBUG
"qmgr: requested queue %
s(%i)
addr = 0x%02X
\n
"
,
q
mgr_queue_descs
[
queue
],
q
ueue
,
addr
);
#endif
spin_unlock_irq
(
&
qmgr_lock
);
return
0
;
err:
...
...
@@ -190,6 +200,11 @@ void qmgr_release_queue(unsigned int queue)
while
(
addr
--
)
shift_mask
(
mask
);
#if DEBUG_QMGR
printk
(
KERN_DEBUG
"qmgr: releasing queue %s(%i)
\n
"
,
qmgr_queue_descs
[
queue
],
queue
);
qmgr_queue_descs
[
queue
][
0
]
=
'\x0'
;
#endif
__raw_writel
(
0
,
&
qmgr_regs
->
sram
[
queue
]);
used_sram_bitmap
[
0
]
&=
~
mask
[
0
];
...
...
@@ -202,11 +217,8 @@ void qmgr_release_queue(unsigned int queue)
module_put
(
THIS_MODULE
);
while
((
addr
=
qmgr_get_entry
(
queue
)))
printk
(
KERN_ERR
"qmgr: released queue %
d
not empty: 0x%08X
\n
"
,
printk
(
KERN_ERR
"qmgr: released queue %
i
not empty: 0x%08X
\n
"
,
queue
,
addr
);
#if DEBUG
printk
(
KERN_DEBUG
"qmgr: released queue %i
\n
"
,
queue
);
#endif
}
static
int
qmgr_init
(
void
)
...
...
@@ -277,5 +289,10 @@ EXPORT_SYMBOL(qmgr_regs);
EXPORT_SYMBOL
(
qmgr_set_irq
);
EXPORT_SYMBOL
(
qmgr_enable_irq
);
EXPORT_SYMBOL
(
qmgr_disable_irq
);
#if DEBUG_QMGR
EXPORT_SYMBOL
(
qmgr_queue_descs
);
EXPORT_SYMBOL
(
qmgr_request_queue
);
#else
EXPORT_SYMBOL
(
__qmgr_request_queue
);
#endif
EXPORT_SYMBOL
(
qmgr_release_queue
);
drivers/net/arm/ixp4xx_eth.c
浏览文件 @
e6da96ac
...
...
@@ -35,7 +35,6 @@
#include <mach/npe.h>
#include <mach/qmgr.h>
#define DEBUG_QUEUES 0
#define DEBUG_DESC 0
#define DEBUG_RX 0
#define DEBUG_TX 0
...
...
@@ -423,47 +422,13 @@ static inline void debug_desc(u32 phys, struct desc *desc)
#endif
}
static
inline
void
debug_queue
(
unsigned
int
queue
,
int
is_get
,
u32
phys
)
{
#if DEBUG_QUEUES
static
struct
{
int
queue
;
char
*
name
;
}
names
[]
=
{
{
TX_QUEUE
(
0x10
),
"TX#0 "
},
{
TX_QUEUE
(
0x20
),
"TX#1 "
},
{
TX_QUEUE
(
0x00
),
"TX#2 "
},
{
RXFREE_QUEUE
(
0x10
),
"RX-free#0 "
},
{
RXFREE_QUEUE
(
0x20
),
"RX-free#1 "
},
{
RXFREE_QUEUE
(
0x00
),
"RX-free#2 "
},
{
TXDONE_QUEUE
,
"TX-done "
},
};
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
names
);
i
++
)
if
(
names
[
i
].
queue
==
queue
)
break
;
printk
(
KERN_DEBUG
"Queue %i %s%s %X
\n
"
,
queue
,
i
<
ARRAY_SIZE
(
names
)
?
names
[
i
].
name
:
""
,
is_get
?
"->"
:
"<-"
,
phys
);
#endif
}
static
inline
u32
queue_get_entry
(
unsigned
int
queue
)
{
u32
phys
=
qmgr_get_entry
(
queue
);
debug_queue
(
queue
,
1
,
phys
);
return
phys
;
}
static
inline
int
queue_get_desc
(
unsigned
int
queue
,
struct
port
*
port
,
int
is_tx
)
{
u32
phys
,
tab_phys
,
n_desc
;
struct
desc
*
tab
;
if
(
!
(
phys
=
q
ueue
_get_entry
(
queue
)))
if
(
!
(
phys
=
q
mgr
_get_entry
(
queue
)))
return
-
1
;
phys
&=
~
0x1F
;
/* mask out non-address bits */
...
...
@@ -479,7 +444,6 @@ static inline int queue_get_desc(unsigned int queue, struct port *port,
static
inline
void
queue_put_desc
(
unsigned
int
queue
,
u32
phys
,
struct
desc
*
desc
)
{
debug_queue
(
queue
,
0
,
phys
);
debug_desc
(
phys
,
desc
);
BUG_ON
(
phys
&
0x1F
);
qmgr_put_entry
(
queue
,
phys
);
...
...
@@ -628,7 +592,7 @@ static void eth_txdone_irq(void *unused)
#if DEBUG_TX
printk
(
KERN_DEBUG
DRV_NAME
": eth_txdone_irq
\n
"
);
#endif
while
((
phys
=
q
ueue
_get_entry
(
TXDONE_QUEUE
))
!=
0
)
{
while
((
phys
=
q
mgr
_get_entry
(
TXDONE_QUEUE
))
!=
0
)
{
u32
npe_id
,
n_desc
;
struct
port
*
port
;
struct
desc
*
desc
;
...
...
@@ -840,25 +804,30 @@ static int request_queues(struct port *port)
{
int
err
;
err
=
qmgr_request_queue
(
RXFREE_QUEUE
(
port
->
id
),
RX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
RXFREE_QUEUE
(
port
->
id
),
RX_DESCS
,
0
,
0
,
"%s:RX-free"
,
port
->
netdev
->
name
);
if
(
err
)
return
err
;
err
=
qmgr_request_queue
(
port
->
plat
->
rxq
,
RX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
port
->
plat
->
rxq
,
RX_DESCS
,
0
,
0
,
"%s:RX"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_rxfree
;
err
=
qmgr_request_queue
(
TX_QUEUE
(
port
->
id
),
TX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
TX_QUEUE
(
port
->
id
),
TX_DESCS
,
0
,
0
,
"%s:TX"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_rx
;
err
=
qmgr_request_queue
(
port
->
plat
->
txreadyq
,
TX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
port
->
plat
->
txreadyq
,
TX_DESCS
,
0
,
0
,
"%s:TX-ready"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_tx
;
/* TX-done queue handles skbs sent out by the NPEs */
if
(
!
ports_open
)
{
err
=
qmgr_request_queue
(
TXDONE_QUEUE
,
TXDONE_QUEUE_LEN
,
0
,
0
);
err
=
qmgr_request_queue
(
TXDONE_QUEUE
,
TXDONE_QUEUE_LEN
,
0
,
0
,
"%s:TX-done"
,
DRV_NAME
);
if
(
err
)
goto
rel_txready
;
}
...
...
drivers/net/wan/ixp4xx_hss.c
浏览文件 @
e6da96ac
...
...
@@ -21,7 +21,6 @@
#include <mach/npe.h>
#include <mach/qmgr.h>
#define DEBUG_QUEUES 0
#define DEBUG_DESC 0
#define DEBUG_RX 0
#define DEBUG_TX 0
...
...
@@ -555,48 +554,13 @@ static inline void debug_desc(u32 phys, struct desc *desc)
#endif
}
static
inline
void
debug_queue
(
unsigned
int
queue
,
int
is_get
,
u32
phys
)
{
#if DEBUG_QUEUES
static
struct
{
int
queue
;
char
*
name
;
}
names
[]
=
{
{
HSS0_PKT_TX0_QUEUE
,
"TX#0 "
},
{
HSS0_PKT_TXDONE_QUEUE
,
"TX-done#0 "
},
{
HSS0_PKT_RX_QUEUE
,
"RX#0 "
},
{
HSS0_PKT_RXFREE0_QUEUE
,
"RX-free#0 "
},
{
HSS1_PKT_TX0_QUEUE
,
"TX#1 "
},
{
HSS1_PKT_TXDONE_QUEUE
,
"TX-done#1 "
},
{
HSS1_PKT_RX_QUEUE
,
"RX#1 "
},
{
HSS1_PKT_RXFREE0_QUEUE
,
"RX-free#1 "
},
};
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
names
);
i
++
)
if
(
names
[
i
].
queue
==
queue
)
break
;
printk
(
KERN_DEBUG
"Queue %i %s%s %X
\n
"
,
queue
,
i
<
ARRAY_SIZE
(
names
)
?
names
[
i
].
name
:
""
,
is_get
?
"->"
:
"<-"
,
phys
);
#endif
}
static
inline
u32
queue_get_entry
(
unsigned
int
queue
)
{
u32
phys
=
qmgr_get_entry
(
queue
);
debug_queue
(
queue
,
1
,
phys
);
return
phys
;
}
static
inline
int
queue_get_desc
(
unsigned
int
queue
,
struct
port
*
port
,
int
is_tx
)
{
u32
phys
,
tab_phys
,
n_desc
;
struct
desc
*
tab
;
if
(
!
(
phys
=
q
ueue
_get_entry
(
queue
)))
if
(
!
(
phys
=
q
mgr
_get_entry
(
queue
)))
return
-
1
;
BUG_ON
(
phys
&
0x1F
);
...
...
@@ -612,7 +576,6 @@ static inline int queue_get_desc(unsigned int queue, struct port *port,
static
inline
void
queue_put_desc
(
unsigned
int
queue
,
u32
phys
,
struct
desc
*
desc
)
{
debug_queue
(
queue
,
0
,
phys
);
debug_desc
(
phys
,
desc
);
BUG_ON
(
phys
&
0x1F
);
qmgr_put_entry
(
queue
,
phys
);
...
...
@@ -930,23 +893,28 @@ static int request_hdlc_queues(struct port *port)
{
int
err
;
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
rxfree
,
RX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
rxfree
,
RX_DESCS
,
0
,
0
,
"%s:RX-free"
,
port
->
netdev
->
name
);
if
(
err
)
return
err
;
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
rx
,
RX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
rx
,
RX_DESCS
,
0
,
0
,
"%s:RX"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_rxfree
;
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
tx
,
TX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
tx
,
TX_DESCS
,
0
,
0
,
"%s:TX"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_rx
;
err
=
qmgr_request_queue
(
port
->
plat
->
txreadyq
,
TX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
port
->
plat
->
txreadyq
,
TX_DESCS
,
0
,
0
,
"%s:TX-ready"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_tx
;
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
txdone
,
TX_DESCS
,
0
,
0
);
err
=
qmgr_request_queue
(
queue_ids
[
port
->
id
].
txdone
,
TX_DESCS
,
0
,
0
,
"%s:TX-done"
,
port
->
netdev
->
name
);
if
(
err
)
goto
rel_txready
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录