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
652fb411
Commit
652fb411
authored
May 15, 2003
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o wan/cycx: typedef cleanup
parent
41d0ff2e
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
103 deletions
+126
-103
drivers/net/wan/cycx_drv.c
drivers/net/wan/cycx_drv.c
+11
-9
drivers/net/wan/cycx_main.c
drivers/net/wan/cycx_main.c
+11
-11
drivers/net/wan/cycx_x25.c
drivers/net/wan/cycx_x25.c
+47
-45
include/linux/cyclomx.h
include/linux/cyclomx.h
+8
-8
include/linux/cycx_cfm.h
include/linux/cycx_cfm.h
+49
-30
No files found.
drivers/net/wan/cycx_drv.c
View file @
652fb411
...
@@ -73,7 +73,7 @@ int init_module(void);
...
@@ -73,7 +73,7 @@ int init_module(void);
void
cleanup_module
(
void
);
void
cleanup_module
(
void
);
/* Hardware-specific functions */
/* Hardware-specific functions */
static
int
load_cyc2x
(
cycxhw_t
*
hw
,
cfm_t
*
cfm
,
u32
len
);
static
int
load_cyc2x
(
cycxhw_t
*
hw
,
struct
cycx_firmware
*
cfm
,
u32
len
);
static
void
cycx_bootcfg
(
cycxhw_t
*
hw
);
static
void
cycx_bootcfg
(
cycxhw_t
*
hw
);
static
int
reset_cyc2x
(
u32
addr
);
static
int
reset_cyc2x
(
u32
addr
);
...
@@ -398,10 +398,10 @@ static int cycx_code_boot(u32 addr, u8 *code, u32 len)
...
@@ -398,10 +398,10 @@ static int cycx_code_boot(u32 addr, u8 *code, u32 len)
/* Load adapter from the memory image of the CYCX firmware module.
/* Load adapter from the memory image of the CYCX firmware module.
* o verify firmware integrity and compatibility
* o verify firmware integrity and compatibility
* o start adapter up */
* o start adapter up */
static
int
load_cyc2x
(
cycxhw_t
*
hw
,
cfm_t
*
cfm
,
u32
len
)
static
int
load_cyc2x
(
cycxhw_t
*
hw
,
struct
cycx_firmware
*
cfm
,
u32
len
)
{
{
int
i
,
j
;
int
i
,
j
;
cycx_header_t
*
img_hdr
;
struct
cycx_fw_header
*
img_hdr
;
u8
*
reset_image
,
u8
*
reset_image
,
*
data_image
,
*
data_image
,
*
code_image
;
*
code_image
;
...
@@ -430,17 +430,18 @@ static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
...
@@ -430,17 +430,18 @@ static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
}
}
/* Verify firmware module length and checksum */
/* Verify firmware module length and checksum */
cksum
=
checksum
((
u8
*
)
&
cfm
->
info
,
sizeof
(
cfm_info_t
)
+
cksum
=
checksum
((
u8
*
)
&
cfm
->
info
,
sizeof
(
struct
cycx_fw_info
)
+
cfm
->
info
.
codesize
);
cfm
->
info
.
codesize
);
/*
/*
FIXME cfm->info.codesize is off by 2
FIXME cfm->info.codesize is off by 2
if (((len - sizeof(
cfm_t
) - 1) != cfm->info.codesize) ||
if (((len - sizeof(
struct cycx_firmware
) - 1) != cfm->info.codesize) ||
*/
*/
if
(
cksum
!=
cfm
->
checksum
)
{
if
(
cksum
!=
cfm
->
checksum
)
{
printk
(
KERN_ERR
"%s:%s: firmware corrupted!
\n
"
,
printk
(
KERN_ERR
"%s:%s: firmware corrupted!
\n
"
,
modname
,
__FUNCTION__
);
modname
,
__FUNCTION__
);
printk
(
KERN_ERR
" cdsize = 0x%x (expected 0x%lx)
\n
"
,
printk
(
KERN_ERR
" cdsize = 0x%x (expected 0x%lx)
\n
"
,
len
-
sizeof
(
cfm_t
)
-
1
,
cfm
->
info
.
codesize
);
len
-
sizeof
(
struct
cycx_firmware
)
-
1
,
cfm
->
info
.
codesize
);
printk
(
KERN_ERR
" chksum = 0x%x (expected 0x%x)
\n
"
,
printk
(
KERN_ERR
" chksum = 0x%x (expected 0x%x)
\n
"
,
cksum
,
cfm
->
checksum
);
cksum
,
cfm
->
checksum
);
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -448,14 +449,15 @@ static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
...
@@ -448,14 +449,15 @@ static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
/* If everything is ok, set reset, data and code pointers */
/* If everything is ok, set reset, data and code pointers */
img_hdr
=
(
cycx_header_t
*
)(((
u8
*
)
cfm
)
+
sizeof
(
cfm_t
)
-
1
);
img_hdr
=
(
struct
cycx_fw_header
*
)(((
u8
*
)
cfm
)
+
sizeof
(
struct
cycx_firmware
)
-
1
);
#ifdef FIRMWARE_DEBUG
#ifdef FIRMWARE_DEBUG
printk
(
KERN_INFO
"%s:%s: image sizes
\n
"
,
__FUNCTION__
,
modname
);
printk
(
KERN_INFO
"%s:%s: image sizes
\n
"
,
__FUNCTION__
,
modname
);
printk
(
KERN_INFO
" reset=%lu
\n
"
,
img_hdr
->
reset_size
);
printk
(
KERN_INFO
" reset=%lu
\n
"
,
img_hdr
->
reset_size
);
printk
(
KERN_INFO
" data=%lu
\n
"
,
img_hdr
->
data_size
);
printk
(
KERN_INFO
" data=%lu
\n
"
,
img_hdr
->
data_size
);
printk
(
KERN_INFO
" code=%lu
\n
"
,
img_hdr
->
code_size
);
printk
(
KERN_INFO
" code=%lu
\n
"
,
img_hdr
->
code_size
);
#endif
#endif
reset_image
=
((
u8
*
)
img_hdr
)
+
sizeof
(
cycx_header_t
);
reset_image
=
((
u8
*
)
img_hdr
)
+
sizeof
(
struct
cycx_fw_header
);
data_image
=
reset_image
+
img_hdr
->
reset_size
;
data_image
=
reset_image
+
img_hdr
->
reset_size
;
code_image
=
data_image
+
img_hdr
->
data_size
;
code_image
=
data_image
+
img_hdr
->
data_size
;
...
...
drivers/net/wan/cycx_main.c
View file @
652fb411
...
@@ -87,7 +87,7 @@ static char fullname[] = "CYCLOM 2X(tm) Sync Card Driver";
...
@@ -87,7 +87,7 @@ static char fullname[] = "CYCLOM 2X(tm) Sync Card Driver";
static
char
copyright
[]
=
"(c) 1998-2001 Arnaldo Carvalho de Melo "
static
char
copyright
[]
=
"(c) 1998-2001 Arnaldo Carvalho de Melo "
"<acme@conectiva.com.br>"
;
"<acme@conectiva.com.br>"
;
static
int
ncards
=
CONFIG_CYCLOMX_CARDS
;
static
int
ncards
=
CONFIG_CYCLOMX_CARDS
;
static
cycx_t
*
card_array
;
/* adapter data space */
static
struct
cycx_device
*
card_array
;
/* adapter data space */
/* Kernel Loadable Module Entry Points */
/* Kernel Loadable Module Entry Points */
...
@@ -113,15 +113,15 @@ int __init cyclomx_init (void)
...
@@ -113,15 +113,15 @@ int __init cyclomx_init (void)
/* Verify number of cards and allocate adapter data space */
/* Verify number of cards and allocate adapter data space */
ncards
=
min_t
(
int
,
ncards
,
MAX_CARDS
);
ncards
=
min_t
(
int
,
ncards
,
MAX_CARDS
);
ncards
=
max_t
(
int
,
ncards
,
1
);
ncards
=
max_t
(
int
,
ncards
,
1
);
card_array
=
kmalloc
(
sizeof
(
cycx_t
)
*
ncards
,
GFP_KERNEL
);
card_array
=
kmalloc
(
sizeof
(
struct
cycx_device
)
*
ncards
,
GFP_KERNEL
);
if
(
!
card_array
)
if
(
!
card_array
)
goto
out
;
goto
out
;
memset
(
card_array
,
0
,
sizeof
(
cycx_t
)
*
ncards
);
memset
(
card_array
,
0
,
sizeof
(
struct
cycx_device
)
*
ncards
);
/* Register adapters with WAN router */
/* Register adapters with WAN router */
for
(
cnt
=
0
;
cnt
<
ncards
;
++
cnt
)
{
for
(
cnt
=
0
;
cnt
<
ncards
;
++
cnt
)
{
cycx_t
*
card
=
&
card_array
[
cnt
];
struct
cycx_device
*
card
=
&
card_array
[
cnt
];
struct
wan_device
*
wandev
=
&
card
->
wandev
;
struct
wan_device
*
wandev
=
&
card
->
wandev
;
sprintf
(
card
->
devname
,
"%s%d"
,
drvname
,
cnt
+
1
);
sprintf
(
card
->
devname
,
"%s%d"
,
drvname
,
cnt
+
1
);
...
@@ -161,7 +161,7 @@ static void __exit cyclomx_cleanup (void)
...
@@ -161,7 +161,7 @@ static void __exit cyclomx_cleanup (void)
int
i
=
0
;
int
i
=
0
;
for
(;
i
<
ncards
;
++
i
)
{
for
(;
i
<
ncards
;
++
i
)
{
cycx_t
*
card
=
&
card_array
[
i
];
struct
cycx_device
*
card
=
&
card_array
[
i
];
unregister_wan_device
(
card
->
devname
);
unregister_wan_device
(
card
->
devname
);
}
}
...
@@ -184,7 +184,7 @@ static void __exit cyclomx_cleanup (void)
...
@@ -184,7 +184,7 @@ static void __exit cyclomx_cleanup (void)
static
int
setup
(
struct
wan_device
*
wandev
,
wandev_conf_t
*
conf
)
static
int
setup
(
struct
wan_device
*
wandev
,
wandev_conf_t
*
conf
)
{
{
int
err
=
-
EFAULT
;
int
err
=
-
EFAULT
;
cycx_t
*
card
;
struct
cycx_device
*
card
;
int
irq
;
int
irq
;
/* Sanity checks */
/* Sanity checks */
...
@@ -276,7 +276,7 @@ out: return err;
...
@@ -276,7 +276,7 @@ out: return err;
static
int
shutdown
(
struct
wan_device
*
wandev
)
static
int
shutdown
(
struct
wan_device
*
wandev
)
{
{
int
ret
=
-
EFAULT
;
int
ret
=
-
EFAULT
;
cycx_t
*
card
;
struct
cycx_device
*
card
;
/* sanity checks */
/* sanity checks */
if
(
!
wandev
||
!
wandev
->
private
)
if
(
!
wandev
||
!
wandev
->
private
)
...
@@ -318,7 +318,7 @@ static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg)
...
@@ -318,7 +318,7 @@ static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg)
*/
*/
static
irqreturn_t
cycx_isr
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
static
irqreturn_t
cycx_isr
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
{
cycx_t
*
card
=
(
cycx_t
*
)
dev_id
;
struct
cycx_device
*
card
=
(
struct
cycx_device
*
)
dev_id
;
if
(
!
card
||
card
->
wandev
.
state
==
WAN_UNCONFIGURED
)
if
(
!
card
||
card
->
wandev
.
state
==
WAN_UNCONFIGURED
)
goto
out
;
goto
out
;
...
@@ -341,7 +341,7 @@ out: return IRQ_NONE;
...
@@ -341,7 +341,7 @@ out: return IRQ_NONE;
* have to call MOD_INC_USE_COUNT, but cannot include 'module.h' where it's
* have to call MOD_INC_USE_COUNT, but cannot include 'module.h' where it's
* defined more than once into the same kernel module.
* defined more than once into the same kernel module.
*/
*/
void
cyclomx_mod_inc_use_count
(
cycx_t
*
card
)
void
cyclomx_mod_inc_use_count
(
struct
cycx_device
*
card
)
{
{
++
card
->
open_cnt
;
++
card
->
open_cnt
;
MOD_INC_USE_COUNT
;
MOD_INC_USE_COUNT
;
...
@@ -353,14 +353,14 @@ void cyclomx_mod_inc_use_count (cycx_t *card)
...
@@ -353,14 +353,14 @@ void cyclomx_mod_inc_use_count (cycx_t *card)
* have to call MOD_DEC_USE_COUNT, but cannot include 'module.h' where it's
* have to call MOD_DEC_USE_COUNT, but cannot include 'module.h' where it's
* defined more than once into the same kernel module.
* defined more than once into the same kernel module.
*/
*/
void
cyclomx_mod_dec_use_count
(
cycx_t
*
card
)
void
cyclomx_mod_dec_use_count
(
struct
cycx_device
*
card
)
{
{
--
card
->
open_cnt
;
--
card
->
open_cnt
;
MOD_DEC_USE_COUNT
;
MOD_DEC_USE_COUNT
;
}
}
/* Set WAN device state. */
/* Set WAN device state. */
void
cyclomx_set_state
(
cycx_t
*
card
,
int
state
)
void
cyclomx_set_state
(
struct
cycx_device
*
card
,
int
state
)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
char
*
string_state
=
NULL
;
char
*
string_state
=
NULL
;
...
...
drivers/net/wan/cycx_x25.c
View file @
652fb411
This diff is collapsed.
Click to expand it.
include/linux/cyclomx.h
View file @
652fb411
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
* This structure is needed because we handle multiple cards, otherwise
* This structure is needed because we handle multiple cards, otherwise
* static data would do it.
* static data would do it.
*/
*/
typedef
struct
cycx
{
struct
cycx_device
{
char
devname
[
WAN_DRVNAME_SZ
+
1
];
/* card name */
char
devname
[
WAN_DRVNAME_SZ
+
1
];
/* card name */
cycxhw_t
hw
;
/* hardware configuration */
cycxhw_t
hw
;
/* hardware configuration */
struct
wan_device
wandev
;
/* WAN device data space */
struct
wan_device
wandev
;
/* WAN device data space */
...
@@ -54,8 +54,8 @@ typedef struct cycx {
...
@@ -54,8 +54,8 @@ typedef struct cycx {
char
buff_int_mode_unbusy
;
/* flag for carrying out dev_tint */
char
buff_int_mode_unbusy
;
/* flag for carrying out dev_tint */
wait_queue_head_t
wait_stats
;
/* to wait for the STATS indication */
wait_queue_head_t
wait_stats
;
/* to wait for the STATS indication */
u32
mbox
;
/* -> mailbox */
u32
mbox
;
/* -> mailbox */
void
(
*
isr
)(
struct
cycx
*
card
);
/* interrupt service routine */
void
(
*
isr
)(
struct
cycx
_device
*
card
);
/* interrupt service routine */
int
(
*
exec
)(
struct
cycx
*
card
,
void
*
u_cmd
,
void
*
u_data
);
int
(
*
exec
)(
struct
cycx
_device
*
card
,
void
*
u_cmd
,
void
*
u_data
);
union
{
union
{
#ifdef CONFIG_CYCLOMX_X25
#ifdef CONFIG_CYCLOMX_X25
struct
{
/* X.25 specific data */
struct
{
/* X.25 specific data */
...
@@ -69,15 +69,15 @@ typedef struct cycx {
...
@@ -69,15 +69,15 @@ typedef struct cycx {
}
x
;
}
x
;
#endif
#endif
}
u
;
}
u
;
}
cycx_t
;
};
/* Public Functions */
/* Public Functions */
void
cyclomx_mod_inc_use_count
(
cycx_t
*
card
);
/* cycx_main.c */
void
cyclomx_mod_inc_use_count
(
struct
cycx_device
*
card
);
void
cyclomx_mod_dec_use_count
(
cycx_t
*
card
);
/* cycx_main.c */
void
cyclomx_mod_dec_use_count
(
struct
cycx_device
*
card
);
void
cyclomx_set_state
(
cycx_t
*
card
,
int
state
);
/* cycx_main.c */
void
cyclomx_set_state
(
struct
cycx_device
*
card
,
int
state
);
#ifdef CONFIG_CYCLOMX_X25
#ifdef CONFIG_CYCLOMX_X25
int
cyx_init
(
cycx_t
*
card
,
wandev_conf_t
*
conf
);
/* cycx_x25.c */
int
cyx_init
(
struct
cycx_device
*
card
,
wandev_conf_t
*
conf
);
#endif
#endif
#endif
/* __KERNEL__ */
#endif
/* __KERNEL__ */
#endif
/* _CYCLOMX_H */
#endif
/* _CYCLOMX_H */
include/linux/cycx_cfm.h
View file @
652fb411
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
*
*
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* 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 sdlasfm.h by Gene Kozin <74604.152@compuserve.com>
* Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com>
*
*
...
@@ -45,38 +45,57 @@
...
@@ -45,38 +45,57 @@
#define CFID_X25_2X 5200
#define CFID_X25_2X 5200
/* Data Types */
/**
* struct cycx_fw_info - firmware module information.
* @codeid - firmware ID
* @version - firmware version number
* @adapter - compatible adapter types
* @memsize - minimum memory size
* @reserved - reserved
* @startoffs - entry point offset
* @winoffs - dual-port memory window offset
* @codeoffs - code load offset
* @codesize - code size
* @dataoffs - configuration data load offset
* @datasize - configuration data size
*/
struct
cycx_fw_info
{
unsigned
short
codeid
;
unsigned
short
version
;
unsigned
short
adapter
[
CFM_MAX_CYCX
];
unsigned
long
memsize
;
unsigned
short
reserved
[
2
];
unsigned
short
startoffs
;
unsigned
short
winoffs
;
unsigned
short
codeoffs
;
unsigned
long
codesize
;
unsigned
short
dataoffs
;
unsigned
long
datasize
;
};
typedef
struct
cfm_info
/* firmware module information */
/**
{
* struct cycx_firmware - CYCX firmware file structure
unsigned
short
codeid
;
/* firmware ID */
* @signature - CFM file signature
unsigned
short
version
;
/* firmware version number */
* @version - file format version
unsigned
short
adapter
[
CFM_MAX_CYCX
];
/* compatible adapter types */
* @checksum - info + image
unsigned
long
memsize
;
/* minimum memory size */
* @reserved - reserved
unsigned
short
reserved
[
2
];
/* reserved */
* @descr - description string
unsigned
short
startoffs
;
/* entry point offset */
* @info - firmware module info
unsigned
short
winoffs
;
/* dual-port memory window offset */
* @image - code image (variable size)
unsigned
short
codeoffs
;
/* code load offset */
*/
unsigned
long
codesize
;
/* code size */
struct
cycx_firmware
{
unsigned
short
dataoffs
;
/* configuration data load offset */
char
signature
[
80
];
unsigned
long
datasize
;
/* configuration data size */
unsigned
short
version
;
}
cfm_info_t
;
unsigned
short
checksum
;
unsigned
short
reserved
[
6
];
char
descr
[
CFM_DESCR_LEN
];
struct
cycx_fw_info
info
;
unsigned
char
image
[
1
];
};
typedef
struct
cfm
/* CYCX firmware file structure */
struct
cycx_fw_header
{
{
char
signature
[
80
];
/* CFM file signature */
unsigned
short
version
;
/* file format version */
unsigned
short
checksum
;
/* info + image */
unsigned
short
reserved
[
6
];
/* reserved */
char
descr
[
CFM_DESCR_LEN
];
/* description string */
cfm_info_t
info
;
/* firmware module info */
unsigned
char
image
[
1
];
/* code image (variable size) */
}
cfm_t
;
typedef
struct
cycx_header_s
{
unsigned
long
reset_size
;
unsigned
long
reset_size
;
unsigned
long
data_size
;
unsigned
long
data_size
;
unsigned
long
code_size
;
unsigned
long
code_size
;
}
cycx_header_t
;
};
#endif
/* _CYCX_CFM_H */
#endif
/* _CYCX_CFM_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