Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
3df5920c
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3df5920c
编写于
11月 04, 2007
作者:
J
Jeff Garzik
提交者:
David S. Miller
1月 28, 2008
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[netdrvr] ibmlana: move away from legacy MCA API
Signed-off-by:
N
Jeff Garzik
<
jgarzik@redhat.com
>
上级
fbe02d6d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
51 addition
and
68 deletion
+51
-68
drivers/net/ibmlana.c
drivers/net/ibmlana.c
+51
-68
未找到文件。
drivers/net/ibmlana.c
浏览文件 @
3df5920c
...
...
@@ -83,7 +83,7 @@ special acknowledgements to:
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/mca
-legacy
.h>
#include <linux/mca.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
...
...
@@ -161,13 +161,13 @@ static void PrTime(void)
/* deduce resources out of POS registers */
static
void
getaddrs
(
int
slot
,
int
*
base
,
int
*
memlen
,
int
*
iobase
,
int
*
i
rq
,
ibmlana_medium
*
medium
)
static
void
getaddrs
(
struct
mca_device
*
mdev
,
int
*
base
,
int
*
memlen
,
int
*
i
obase
,
int
*
irq
,
ibmlana_medium
*
medium
)
{
u_char
pos0
,
pos1
;
pos0
=
mca_
read_stored_pos
(
slot
,
2
);
pos1
=
mca_
read_stored_pos
(
slot
,
3
);
pos0
=
mca_
device_read_stored_pos
(
mdev
,
2
);
pos1
=
mca_
device_read_stored_pos
(
mdev
,
3
);
*
base
=
0xc0000
+
((
pos1
&
0xf0
)
<<
9
);
*
memlen
=
(
pos1
&
0x01
)
?
0x8000
:
0x4000
;
...
...
@@ -744,6 +744,7 @@ static irqreturn_t irq_handler(int dummy, void *device)
/* MCA info */
#if 0 /* info available elsewhere, but this is kept for reference */
static int ibmlana_getinfo(char *buf, int slot, void *d)
{
int len = 0, i;
...
...
@@ -771,6 +772,7 @@ static int ibmlana_getinfo(char *buf, int slot, void *d)
return len;
}
#endif
/* open driver. Means also initialization and start of LANCE */
...
...
@@ -894,19 +896,26 @@ static int ibmlana_irq;
static
int
ibmlana_io
;
static
int
startslot
;
/* counts through slots when probing multiple devices */
static
int
ibmlana_probe
(
struct
net_device
**
dev_out
)
static
short
ibmlana_adapter_ids
[]
__initdata
=
{
IBM_LANA_ID
,
0x0000
};
static
char
*
ibmlana_adapter_names
[]
__initdata
=
{
"IBM LAN Adapter/A"
,
NULL
};
static
int
ibmlana_init_one
(
struct
device
*
kdev
)
{
struct
mca_device
*
mdev
=
to_mca_device
(
kdev
);
struct
net_device
*
dev
;
int
slot
,
z
,
rc
;
int
slot
=
mdev
->
slot
,
z
,
rc
;
int
base
=
0
,
irq
=
0
,
iobase
=
0
,
memlen
=
0
;
ibmlana_priv
*
priv
;
ibmlana_medium
medium
;
DECLARE_MAC_BUF
(
mac
);
/* can't work without an MCA bus ;-) */
if
(
MCA_bus
==
0
)
return
-
ENODEV
;
dev
=
alloc_etherdev
(
sizeof
(
ibmlana_priv
));
if
(
!
dev
)
return
-
ENOMEM
;
...
...
@@ -917,25 +926,16 @@ static int ibmlana_probe(struct net_device **dev_out)
base
=
dev
->
mem_start
;
irq
=
dev
->
irq
;
for
(
slot
=
startslot
;
(
slot
=
mca_find_adapter
(
IBM_LANA_ID
,
slot
))
!=
-
1
;
slot
++
)
{
/* deduce card addresses */
getaddrs
(
slot
,
&
base
,
&
memlen
,
&
iobase
,
&
irq
,
&
medium
);
getaddrs
(
mdev
,
&
base
,
&
memlen
,
&
iobase
,
&
irq
,
&
medium
);
/* slot already in use ? */
if
(
mca_is_adapter_used
(
slot
))
continue
;
/* were we looking for something different ? */
if
(
dev
->
irq
&&
dev
->
irq
!=
irq
)
continue
;
if
(
dev
->
mem_start
&&
dev
->
mem_start
!=
base
)
continue
;
/* found something that matches */
break
;
if
(
dev
->
irq
&&
dev
->
irq
!=
irq
)
{
rc
=
-
ENODEV
;
goto
err_out
;
}
/* nothing found ? */
if
(
slot
==
-
1
)
{
rc
=
(
base
!=
0
||
irq
!=
0
)
?
-
ENXIO
:
-
ENODEV
;
if
(
dev
->
mem_start
&&
dev
->
mem_start
!=
base
)
{
rc
=
-
ENODEV
;
goto
err_out
;
}
...
...
@@ -952,11 +952,10 @@ static int ibmlana_probe(struct net_device **dev_out)
priv
=
netdev_priv
(
dev
);
priv
->
slot
=
slot
;
priv
->
realirq
=
irq
;
priv
->
realirq
=
mca_device_transform_irq
(
mdev
,
irq
)
;
priv
->
medium
=
medium
;
spin_lock_init
(
&
priv
->
lock
);
/* set base + irq for this device (irq not allocated so far) */
dev
->
irq
=
0
;
...
...
@@ -972,18 +971,14 @@ static int ibmlana_probe(struct net_device **dev_out)
goto
err_out_reg
;
}
/* make procfs entries */
mca_set_adapter_name
(
slot
,
"IBM LAN Adapter/A"
);
mca_set_adapter_procfn
(
slot
,
(
MCA_ProcFn
)
ibmlana_getinfo
,
dev
);
mca_mark_as_used
(
slot
);
mca_device_set_name
(
mdev
,
ibmlana_adapter_names
[
mdev
->
index
]);
mca_device_set_claim
(
mdev
,
1
);
/* set methods */
dev
->
open
=
ibmlana_open
;
dev
->
stop
=
ibmlana_close
;
dev
->
hard_start_xmit
=
ibmlana_tx
;
dev
->
do_ioctl
=
NULL
;
dev
->
set_multicast_list
=
ibmlana_set_multicast_list
;
dev
->
flags
|=
IFF_MULTICAST
;
...
...
@@ -1013,13 +1008,11 @@ static int ibmlana_probe(struct net_device **dev_out)
if
(
rc
)
goto
err_out_claimed
;
*
dev_out
=
dev
;
dev_set_drvdata
(
kdev
,
dev
)
;
return
0
;
err_out_claimed:
mca_mark_as_unused
(
priv
->
slot
);
mca_set_adapter_name
(
priv
->
slot
,
""
);
mca_set_adapter_procfn
(
priv
->
slot
,
NULL
,
NULL
);
mca_device_set_claim
(
mdev
,
0
);
iounmap
(
priv
->
base
);
err_out_reg:
release_region
(
iobase
,
IBM_LANA_IORANGE
);
...
...
@@ -1028,59 +1021,49 @@ static int ibmlana_probe(struct net_device **dev_out)
return
rc
;
}
static
void
ibmlana_remove_one
(
struct
net_device
*
_
dev
)
static
int
ibmlana_remove_one
(
struct
device
*
k
dev
)
{
struct
net_device
*
dev
=
_dev
;
struct
mca_device
*
mdev
=
to_mca_device
(
kdev
);
struct
net_device
*
dev
=
dev_get_drvdata
(
kdev
);
ibmlana_priv
*
priv
=
netdev_priv
(
dev
);
unregister_netdev
(
dev
);
/*DeinitBoard(dev); */
release_region
(
dev
->
base_addr
,
IBM_LANA_IORANGE
);
mca_mark_as_unused
(
priv
->
slot
);
mca_set_adapter_name
(
priv
->
slot
,
""
);
mca_set_adapter_procfn
(
priv
->
slot
,
NULL
,
NULL
);
mca_device_set_claim
(
mdev
,
0
);
iounmap
(
priv
->
base
);
free_netdev
(
dev
);
return
0
;
}
/* ------------------------------------------------------------------------
* modularization support
* ------------------------------------------------------------------------ */
#define DEVMAX 5
static
struct
net_device
*
moddevs
[
DEVMAX
];
module_param_named
(
irq
,
ibmlana_irq
,
int
,
0
);
module_param_named
(
io
,
ibmlana_io
,
int
,
0
);
MODULE_PARM_DESC
(
irq
,
"IBM LAN/A IRQ number"
);
MODULE_PARM_DESC
(
io
,
"IBM LAN/A I/O base address"
);
MODULE_LICENSE
(
"GPL"
);
static
struct
mca_driver
ibmlana_driver
=
{
.
id_table
=
ibmlana_adapter_ids
,
.
driver
=
{
.
name
=
"ibmlana"
,
.
bus
=
&
mca_bus_type
,
.
probe
=
ibmlana_init_one
,
.
remove
=
ibmlana_remove_one
,
},
};
static
int
__init
ibmlana_init_module
(
void
)
{
int
z
;
startslot
=
0
;
for
(
z
=
0
;
z
<
DEVMAX
;
z
++
)
{
struct
net_device
*
dev
=
NULL
;
if
(
ibmlana_probe
(
&
dev
))
break
;
moddevs
[
z
]
=
dev
;
}
return
(
z
>
0
)
?
0
:
-
EIO
;
return
mca_register_driver
(
&
ibmlana_driver
);
}
static
void
__exit
ibmlana_cleanup_module
(
void
)
{
int
z
;
for
(
z
=
0
;
z
<
DEVMAX
;
z
++
)
{
struct
net_device
*
dev
=
moddevs
[
z
];
if
(
dev
)
ibmlana_remove_one
(
dev
);
}
mca_unregister_driver
(
&
ibmlana_driver
);
}
module_init
(
ibmlana_init_module
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录