Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0debd094
Commit
0debd094
authored
May 15, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/acme/net-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
83a66c22
6373e8bb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
58 deletions
+67
-58
drivers/net/wan/cycx_drv.c
drivers/net/wan/cycx_drv.c
+10
-10
drivers/net/wan/cycx_main.c
drivers/net/wan/cycx_main.c
+1
-1
drivers/net/wan/cycx_x25.c
drivers/net/wan/cycx_x25.c
+32
-28
include/linux/cyclomx.h
include/linux/cyclomx.h
+2
-2
include/linux/cycx_drv.h
include/linux/cycx_drv.h
+22
-17
No files found.
drivers/net/wan/cycx_drv.c
View file @
0debd094
...
...
@@ -67,8 +67,8 @@ MODULE_DESCRIPTION("Cyclom 2x Sync Card Driver");
MODULE_LICENSE
(
"GPL"
);
/* Hardware-specific functions */
static
int
load_cyc2x
(
cycxhw_t
*
hw
,
struct
cycx_firmware
*
cfm
,
u32
len
);
static
void
cycx_bootcfg
(
cycxhw_t
*
hw
);
static
int
load_cyc2x
(
struct
cycx_hw
*
hw
,
struct
cycx_firmware
*
cfm
,
u32
len
);
static
void
cycx_bootcfg
(
struct
cycx_hw
*
hw
);
static
int
reset_cyc2x
(
u32
addr
);
static
int
detect_cyc2x
(
u32
addr
);
...
...
@@ -135,7 +135,7 @@ void cycx_drv_cleanup(void)
* Return: 0 ok.
* < 0 error */
EXPORT_SYMBOL
(
cycx_setup
);
int
cycx_setup
(
cycxhw_t
*
hw
,
void
*
cfm
,
u32
len
)
int
cycx_setup
(
struct
cycx_hw
*
hw
,
void
*
cfm
,
u32
len
)
{
unsigned
long
dpmbase
=
hw
->
dpmbase
;
int
err
;
...
...
@@ -179,7 +179,7 @@ int cycx_setup(cycxhw_t *hw, void *cfm, u32 len)
}
EXPORT_SYMBOL
(
cycx_down
);
int
cycx_down
(
cycxhw_t
*
hw
)
int
cycx_down
(
struct
cycx_hw
*
hw
)
{
iounmap
((
u32
*
)
hw
->
dpmbase
);
...
...
@@ -188,14 +188,14 @@ int cycx_down(cycxhw_t *hw)
/* Enable interrupt generation. */
EXPORT_SYMBOL
(
cycx_inten
);
void
cycx_inten
(
cycxhw_t
*
hw
)
void
cycx_inten
(
struct
cycx_hw
*
hw
)
{
writeb
(
0
,
hw
->
dpmbase
);
}
/* Generate an interrupt to adapter's CPU. */
EXPORT_SYMBOL
(
cycx_intr
);
void
cycx_intr
(
cycxhw_t
*
hw
)
void
cycx_intr
(
struct
cycx_hw
*
hw
)
{
writew
(
0
,
hw
->
dpmbase
+
GEN_CYCX_INTR
);
}
...
...
@@ -222,7 +222,7 @@ int cycx_exec(u32 addr)
/* Read absolute adapter memory.
* Transfer data from adapter's memory to data buffer. */
EXPORT_SYMBOL
(
cycx_peek
);
int
cycx_peek
(
cycxhw_t
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
)
int
cycx_peek
(
struct
cycx_hw
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
)
{
if
(
len
==
1
)
*
(
u8
*
)
buf
=
readb
(
hw
->
dpmbase
+
addr
);
...
...
@@ -235,7 +235,7 @@ int cycx_peek(cycxhw_t *hw, u32 addr, void *buf, u32 len)
/* Write Absolute Adapter Memory.
* Transfer data from data buffer to adapter's memory. */
EXPORT_SYMBOL
(
cycx_poke
);
int
cycx_poke
(
cycxhw_t
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
)
int
cycx_poke
(
struct
cycx_hw
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
)
{
if
(
len
==
1
)
writeb
(
*
(
u8
*
)
buf
,
hw
->
dpmbase
+
addr
);
...
...
@@ -385,7 +385,7 @@ static int cycx_code_boot(u32 addr, u8 *code, u32 len)
/* Load adapter from the memory image of the CYCX firmware module.
* o verify firmware integrity and compatibility
* o start adapter up */
static
int
load_cyc2x
(
cycxhw_t
*
hw
,
struct
cycx_firmware
*
cfm
,
u32
len
)
static
int
load_cyc2x
(
struct
cycx_hw
*
hw
,
struct
cycx_firmware
*
cfm
,
u32
len
)
{
int
i
,
j
;
struct
cycx_fw_header
*
img_hdr
;
...
...
@@ -514,7 +514,7 @@ static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len)
- As of now, only static buffers are available to the user.
So, the bit VD_RXDIRC must be set in 'valid'. That means that user
wants to use the static transmission and reception buffers. */
static
void
cycx_bootcfg
(
cycxhw_t
*
hw
)
static
void
cycx_bootcfg
(
struct
cycx_hw
*
hw
)
{
/* use fixed buffers */
writeb
(
FIXED_BUFFERS
,
hw
->
dpmbase
+
CONF_OFFSET
);
...
...
drivers/net/wan/cycx_main.c
View file @
0debd094
...
...
@@ -220,7 +220,7 @@ static int setup(struct wan_device *wandev, wandev_conf_t *conf)
}
/* Configure hardware, load firmware, etc. */
memset
(
&
card
->
hw
,
0
,
sizeof
(
c
ycxhw_t
));
memset
(
&
card
->
hw
,
0
,
sizeof
(
c
ard
->
hw
));
card
->
hw
.
irq
=
irq
;
card
->
hw
.
dpmbase
=
conf
->
maddr
;
card
->
hw
.
dpmsize
=
CYCX_WINDOWSIZE
;
...
...
drivers/net/wan/cycx_x25.c
View file @
0debd094
...
...
@@ -100,7 +100,7 @@
/* Data Structures */
/* This is an extension of the 'struct net_device' we create for each network
interface to keep the rest of X.25 channel-specific data. */
typedef
struct
x25_channel
{
struct
cycx_
x25_channel
{
/* This member must be first. */
struct
net_device
*
slave
;
/* WAN slave */
...
...
@@ -119,7 +119,7 @@ typedef struct x25_channel {
struct
sk_buff
*
rx_skb
;
/* receive socket buffer */
struct
cycx_device
*
card
;
/* -> owner */
struct
net_device_stats
ifstats
;
/* interface statistics */
}
x25_channel_t
;
};
/* Function Prototypes */
/* WAN link driver entry points. These are called by the WAN router module. */
...
...
@@ -156,7 +156,8 @@ static int x25_configure(struct cycx_device *card, TX25Config *conf),
x25_get_stats
(
struct
cycx_device
*
card
),
x25_send
(
struct
cycx_device
*
card
,
u8
link
,
u8
lcn
,
u8
bitm
,
int
len
,
void
*
buf
),
x25_connect_response
(
struct
cycx_device
*
card
,
x25_channel_t
*
chan
),
x25_connect_response
(
struct
cycx_device
*
card
,
struct
cycx_x25_channel
*
chan
),
x25_disconnect_response
(
struct
cycx_device
*
card
,
u8
link
,
u8
lcn
);
/* channel functions */
...
...
@@ -350,7 +351,7 @@ static int new_if(struct wan_device *wandev, struct net_device *dev,
wanif_conf_t
*
conf
)
{
struct
cycx_device
*
card
=
wandev
->
private
;
x25_channel_t
*
chan
;
struct
cycx_x25_channel
*
chan
;
int
err
=
0
;
if
(
!
conf
->
name
[
0
]
||
strlen
(
conf
->
name
)
>
WAN_IFNAME_SZ
)
{
...
...
@@ -360,10 +361,11 @@ static int new_if(struct wan_device *wandev, struct net_device *dev,
}
/* allocate and initialize private data */
if
((
chan
=
kmalloc
(
sizeof
(
x25_channel_t
),
GFP_KERNEL
))
==
NULL
)
chan
=
kmalloc
(
sizeof
(
struct
cycx_x25_channel
),
GFP_KERNEL
);
if
(
!
chan
)
return
-
ENOMEM
;
memset
(
chan
,
0
,
sizeof
(
x25_channel_t
));
memset
(
chan
,
0
,
sizeof
(
*
chan
));
strcpy
(
chan
->
name
,
conf
->
name
);
chan
->
card
=
card
;
chan
->
link
=
conf
->
port
;
...
...
@@ -439,7 +441,7 @@ static int new_if(struct wan_device *wandev, struct net_device *dev,
static
int
del_if
(
struct
wan_device
*
wandev
,
struct
net_device
*
dev
)
{
if
(
dev
->
priv
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
if
(
chan
->
svc
)
{
if
(
chan
->
local_addr
)
...
...
@@ -464,7 +466,7 @@ static int del_if(struct wan_device *wandev, struct net_device *dev)
* registration. */
static
int
if_init
(
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
struct
cycx_device
*
card
=
chan
->
card
;
struct
wan_device
*
wandev
=
&
card
->
wandev
;
...
...
@@ -522,7 +524,7 @@ static int if_open(struct net_device *dev)
* o if there's no more open channels then disconnect physical link. */
static
int
if_close
(
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
netif_stop_queue
(
dev
);
...
...
@@ -573,7 +575,7 @@ static int if_rebuild_hdr(struct sk_buff *skb)
* protocol stack and can be used for flow control with protocol layer. */
static
int
if_send
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
struct
cycx_device
*
card
=
chan
->
card
;
if
(
!
chan
->
svc
)
...
...
@@ -647,7 +649,7 @@ static int if_send(struct sk_buff *skb, struct net_device *dev)
* Return a pointer to struct net_device_stats */
static
struct
net_device_stats
*
if_stats
(
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
return
chan
?
&
chan
->
ifstats
:
NULL
;
}
...
...
@@ -741,7 +743,7 @@ static void rx_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct
wan_device
*
wandev
=
&
card
->
wandev
;
struct
net_device
*
dev
;
x25_channel_t
*
chan
;
struct
cycx_x25_channel
*
chan
;
struct
sk_buff
*
skb
;
u8
bitm
,
lcn
;
int
pktlen
=
cmd
->
len
-
5
;
...
...
@@ -825,7 +827,7 @@ static void connect_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct
wan_device
*
wandev
=
&
card
->
wandev
;
struct
net_device
*
dev
=
NULL
;
x25_channel_t
*
chan
;
struct
cycx_x25_channel
*
chan
;
u8
d
[
32
],
loc
[
24
],
rem
[
24
];
...
...
@@ -867,7 +869,7 @@ static void connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct
wan_device
*
wandev
=
&
card
->
wandev
;
struct
net_device
*
dev
;
x25_channel_t
*
chan
;
struct
cycx_x25_channel
*
chan
;
u8
lcn
,
key
;
cycx_peek
(
&
card
->
hw
,
cmd
->
buf
,
&
lcn
,
sizeof
(
lcn
));
...
...
@@ -920,7 +922,7 @@ static void disconnect_intr(struct cycx_device *card, TX25Cmd *cmd)
dprintk
(
1
,
KERN_INFO
"disconnect_intr:lcn=%d
\n
"
,
lcn
);
if
((
dev
=
get_dev_by_lcn
(
wandev
,
lcn
))
!=
NULL
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
x25_disconnect_response
(
card
,
chan
->
link
,
lcn
);
set_chan_state
(
dev
,
WAN_DISCONNECTED
);
...
...
@@ -1153,7 +1155,8 @@ static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble)
}
/* Place X.25 call. */
static
int
x25_place_call
(
struct
cycx_device
*
card
,
x25_channel_t
*
chan
)
static
int
x25_place_call
(
struct
cycx_device
*
card
,
struct
cycx_x25_channel
*
chan
)
{
int
err
=
0
,
len
;
...
...
@@ -1199,7 +1202,8 @@ static int x25_place_call(struct cycx_device *card, x25_channel_t *chan)
}
/* Place X.25 CONNECT RESPONSE. */
static
int
x25_connect_response
(
struct
cycx_device
*
card
,
x25_channel_t
*
chan
)
static
int
x25_connect_response
(
struct
cycx_device
*
card
,
struct
cycx_x25_channel
*
chan
)
{
u8
d
[
8
];
...
...
@@ -1258,10 +1262,10 @@ static int x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
static
struct
net_device
*
get_dev_by_lcn
(
struct
wan_device
*
wandev
,
s16
lcn
)
{
struct
net_device
*
dev
=
wandev
->
dev
;
x25_channel_t
*
chan
;
struct
cycx_x25_channel
*
chan
;
while
(
dev
)
{
chan
=
(
x25_channel_t
*
)
dev
->
priv
;
chan
=
(
struct
cycx_x25_channel
*
)
dev
->
priv
;
if
(
chan
->
lcn
==
lcn
)
break
;
...
...
@@ -1275,10 +1279,10 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
char
*
dte
)
{
struct
net_device
*
dev
=
wandev
->
dev
;
x25_channel_t
*
chan
;
struct
cycx_x25_channel
*
chan
;
while
(
dev
)
{
chan
=
(
x25_channel_t
*
)
dev
->
priv
;
chan
=
(
struct
cycx_x25_channel
*
)
dev
->
priv
;
if
(
!
strcmp
(
chan
->
addr
,
dte
))
break
;
...
...
@@ -1296,7 +1300,7 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
* <0 failure */
static
int
chan_connect
(
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
struct
cycx_device
*
card
=
chan
->
card
;
if
(
chan
->
svc
)
{
...
...
@@ -1321,7 +1325,7 @@ static int chan_connect(struct net_device *dev)
* o if SVC then clear X.25 call */
static
void
chan_disconnect
(
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
if
(
chan
->
svc
)
{
x25_clear_call
(
chan
->
card
,
chan
->
link
,
chan
->
lcn
,
0
,
0
);
...
...
@@ -1334,7 +1338,7 @@ static void chan_disconnect(struct net_device *dev)
static
void
chan_timer
(
unsigned
long
d
)
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
d
;
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
if
(
chan
->
state
==
WAN_CONNECTED
)
chan_disconnect
(
dev
);
...
...
@@ -1346,7 +1350,7 @@ static void chan_timer(unsigned long d)
/* Set logical channel state. */
static
void
set_chan_state
(
struct
net_device
*
dev
,
u8
state
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
struct
cycx_device
*
card
=
chan
->
card
;
unsigned
long
flags
;
char
*
string_state
=
NULL
;
...
...
@@ -1412,7 +1416,7 @@ static void set_chan_state(struct net_device *dev, u8 state)
* to the router. */
static
int
chan_send
(
struct
net_device
*
dev
,
struct
sk_buff
*
skb
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
struct
cycx_device
*
card
=
chan
->
card
;
int
bitm
=
0
;
/* final packet */
unsigned
len
=
skb
->
len
;
...
...
@@ -1510,7 +1514,7 @@ static unsigned dec_to_uint(u8 *str, int len)
static
void
reset_timer
(
struct
net_device
*
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
if
(
chan
->
svc
)
mod_timer
(
&
chan
->
timer
,
jiffies
+
chan
->
idle_tmout
*
HZ
);
...
...
@@ -1563,7 +1567,7 @@ static void x25_dump_devs(struct wan_device *wandev)
printk
(
KERN_INFO
"---------------------------------------
\n
"
);
while
(
dev
)
{
x25_channel_t
*
chan
=
dev
->
priv
;
struct
cycx_x25_channel
*
chan
=
dev
->
priv
;
printk
(
KERN_INFO
"%-5.5s %-15.15s %d ETH_P_%s
\n
"
,
chan
->
name
,
chan
->
addr
,
netif_queue_stopped
(
dev
),
...
...
include/linux/cyclomx.h
View file @
0debd094
...
...
@@ -44,8 +44,8 @@
* static data would do it.
*/
struct
cycx_device
{
char
devname
[
WAN_DRVNAME_SZ
+
1
];
/* card name */
cycxhw_t
hw
;
/* hardware configuration */
char
devname
[
WAN_DRVNAME_SZ
+
1
];
/* card name */
struct
cycx_hw
hw
;
/* hardware configuration */
struct
wan_device
wandev
;
/* WAN device data space */
u32
state_tick
;
/* link state timestamp */
spinlock_t
lock
;
...
...
include/linux/cycx_drv.h
View file @
0debd094
...
...
@@ -3,7 +3,7 @@
*
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* Copyright: (c) 1998-200
0
Arnaldo Carvalho de Melo
* Copyright: (c) 1998-200
3
Arnaldo Carvalho de Melo
*
* Based on sdladrv.h by Gene Kozin <genek@compuserve.com>
*
...
...
@@ -41,24 +41,29 @@
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
/* Data Structures */
/* Adapter hardware configuration. Pointer to this structure is passed to all
* APIs. */
typedef
struct
cycxhw
{
u32
fwid
;
/* firmware ID */
int
irq
;
/* interrupt request level */
u32
dpmbase
;
/* dual-port memory base */
u32
dpmsize
;
/* dual-port memory size */
/**
* struct cycx_hw - Adapter hardware configuration
* @fwid - firmware ID
* @irq - interrupt request level
* @dpmbase - dual-port memory base
* @dpmsize - dual-port memory size
* @reserved - reserved for future use
*/
struct
cycx_hw
{
u32
fwid
;
int
irq
;
u32
dpmbase
;
u32
dpmsize
;
u32
reserved
[
5
];
}
cycxhw_t
;
};
/* Function Prototypes */
extern
int
cycx_setup
(
cycxhw_t
*
hw
,
void
*
sfm
,
u32
len
);
extern
int
cycx_down
(
cycxhw_t
*
hw
);
extern
int
cycx_peek
(
cycxhw_t
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
);
extern
int
cycx_poke
(
cycxhw_t
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
);
extern
int
cycx_exec
(
u32
addr
);
extern
int
cycx_setup
(
struct
cycx_hw
*
hw
,
void
*
sfm
,
u32
len
);
extern
int
cycx_down
(
struct
cycx_hw
*
hw
);
extern
int
cycx_peek
(
struct
cycx_hw
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
);
extern
int
cycx_poke
(
struct
cycx_hw
*
hw
,
u32
addr
,
void
*
buf
,
u32
len
);
extern
int
cycx_exec
(
u32
addr
);
extern
void
cycx_inten
(
cycxhw_t
*
hw
);
extern
void
cycx_intr
(
cycxhw_t
*
hw
);
extern
void
cycx_inten
(
struct
cycx_hw
*
hw
);
extern
void
cycx_intr
(
struct
cycx_hw
*
hw
);
#endif
/* _CYCX_DRV_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment