Commit 4bc7073e authored by David S. Miller's avatar David S. Miller

Merge bk://kernel.bkbits.net/acme/net-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents 5a4a60ae 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;
......
...@@ -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;
......
...@@ -114,7 +114,7 @@ typedef struct x25_channel { ...@@ -114,7 +114,7 @@ typedef struct x25_channel {
u8 drop_sequence; /* mark sequence for dropping */ u8 drop_sequence; /* mark sequence for dropping */
u32 idle_tmout; /* sec, before disconnecting */ u32 idle_tmout; /* sec, before disconnecting */
struct sk_buff *rx_skb; /* receive socket buffer */ struct sk_buff *rx_skb; /* receive socket buffer */
cycx_t *card; /* -> owner */ struct cycx_device *card; /* -> owner */
struct net_device_stats ifstats;/* interface statistics */ struct net_device_stats ifstats;/* interface statistics */
} x25_channel_t; } x25_channel_t;
...@@ -137,24 +137,24 @@ static int if_init (struct net_device *dev), ...@@ -137,24 +137,24 @@ static int if_init (struct net_device *dev),
static struct net_device_stats * if_stats (struct net_device *dev); static struct net_device_stats * if_stats (struct net_device *dev);
/* Interrupt handlers */ /* Interrupt handlers */
static void cyx_isr (cycx_t *card), static void cyx_isr(struct cycx_device *card),
tx_intr (cycx_t *card, TX25Cmd *cmd), tx_intr(struct cycx_device *card, TX25Cmd *cmd),
rx_intr (cycx_t *card, TX25Cmd *cmd), rx_intr(struct cycx_device *card, TX25Cmd *cmd),
log_intr (cycx_t *card, TX25Cmd *cmd), log_intr(struct cycx_device *card, TX25Cmd *cmd),
stat_intr (cycx_t *card, TX25Cmd *cmd), stat_intr(struct cycx_device *card, TX25Cmd *cmd),
connect_confirm_intr (cycx_t *card, TX25Cmd *cmd), connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd),
disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd), disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd),
connect_intr (cycx_t *card, TX25Cmd *cmd), connect_intr(struct cycx_device *card, TX25Cmd *cmd),
disconnect_intr (cycx_t *card, TX25Cmd *cmd), disconnect_intr(struct cycx_device *card, TX25Cmd *cmd),
spur_intr (cycx_t *card, TX25Cmd *cmd); spur_intr(struct cycx_device *card, TX25Cmd *cmd);
/* X.25 firmware interface functions */ /* X.25 firmware interface functions */
static int x25_configure (cycx_t *card, TX25Config *conf), static int x25_configure(struct cycx_device *card, TX25Config *conf),
x25_get_stats (cycx_t *card), x25_get_stats(struct cycx_device *card),
x25_send (cycx_t *card, u8 link, u8 lcn, u8 bitm, int len, x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
void *buf), void *buf),
x25_connect_response (cycx_t *card, x25_channel_t *chan), x25_connect_response(struct cycx_device *card, x25_channel_t *chan),
x25_disconnect_response (cycx_t *card, u8 link, u8 lcn); x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn);
/* channel functions */ /* channel functions */
static int chan_connect (struct net_device *dev), static int chan_connect (struct net_device *dev),
...@@ -201,7 +201,7 @@ static void x25_dump_devs(struct wan_device *wandev); ...@@ -201,7 +201,7 @@ static void x25_dump_devs(struct wan_device *wandev);
* *
* Return: 0 o.k. * Return: 0 o.k.
* < 0 failure. */ * < 0 failure. */
int cyx_init (cycx_t *card, wandev_conf_t *conf) int cyx_init(struct cycx_device *card, wandev_conf_t *conf)
{ {
TX25Config cfg; TX25Config cfg;
...@@ -346,7 +346,7 @@ static int update(struct wan_device *wandev) ...@@ -346,7 +346,7 @@ static int update(struct wan_device *wandev)
static int new_if(struct wan_device *wandev, struct net_device *dev, static int new_if(struct wan_device *wandev, struct net_device *dev,
wanif_conf_t *conf) wanif_conf_t *conf)
{ {
cycx_t *card = wandev->private; struct cycx_device *card = wandev->private;
x25_channel_t *chan; x25_channel_t *chan;
int err = 0; int err = 0;
...@@ -461,7 +461,7 @@ static int del_if(struct wan_device *wandev, struct net_device *dev) ...@@ -461,7 +461,7 @@ static int del_if(struct wan_device *wandev, struct net_device *dev)
static int if_init (struct net_device *dev) static int if_init (struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
/* Initialize device driver entry points */ /* Initialize device driver entry points */
...@@ -506,7 +506,7 @@ static int if_init (struct net_device *dev) ...@@ -506,7 +506,7 @@ static int if_init (struct net_device *dev)
static int if_open (struct net_device *dev) static int if_open (struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; /* only one open is allowed */ return -EBUSY; /* only one open is allowed */
...@@ -523,7 +523,7 @@ static int if_open (struct net_device *dev) ...@@ -523,7 +523,7 @@ static int if_open (struct net_device *dev)
static int if_close (struct net_device *dev) static int if_close (struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
netif_stop_queue(dev); netif_stop_queue(dev);
...@@ -577,7 +577,7 @@ static int if_rebuild_hdr (struct sk_buff *skb) ...@@ -577,7 +577,7 @@ static int if_rebuild_hdr (struct sk_buff *skb)
static int if_send (struct sk_buff *skb, struct net_device *dev) static int if_send (struct sk_buff *skb, struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
if (!chan->svc) if (!chan->svc)
chan->protocol = skb->protocol; chan->protocol = skb->protocol;
...@@ -657,7 +657,7 @@ static struct net_device_stats *if_stats (struct net_device *dev) ...@@ -657,7 +657,7 @@ static struct net_device_stats *if_stats (struct net_device *dev)
/* Interrupt Handlers */ /* Interrupt Handlers */
/* X.25 Interrupt Service Routine. */ /* X.25 Interrupt Service Routine. */
static void cyx_isr (cycx_t *card) static void cyx_isr(struct cycx_device *card)
{ {
TX25Cmd cmd; TX25Cmd cmd;
u16 z = 0; u16 z = 0;
...@@ -709,7 +709,7 @@ static void cyx_isr (cycx_t *card) ...@@ -709,7 +709,7 @@ static void cyx_isr (cycx_t *card)
/* Transmit interrupt handler. /* Transmit interrupt handler.
* o Release socket buffer * o Release socket buffer
* o Clear 'tbusy' flag */ * o Clear 'tbusy' flag */
static void tx_intr (cycx_t *card, TX25Cmd *cmd) static void tx_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
struct net_device *dev; struct net_device *dev;
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
...@@ -740,7 +740,7 @@ static void tx_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -740,7 +740,7 @@ static void tx_intr (cycx_t *card, TX25Cmd *cmd)
* expected on this channel. * expected on this channel.
* 2. If something goes wrong and X.25 packet has to be dropped (e.g. no * 2. If something goes wrong and X.25 packet has to be dropped (e.g. no
* socket buffers available) the whole packet sequence must be discarded. */ * socket buffers available) the whole packet sequence must be discarded. */
static void rx_intr (cycx_t *card, TX25Cmd *cmd) static void rx_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -824,7 +824,7 @@ static void rx_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -824,7 +824,7 @@ static void rx_intr (cycx_t *card, TX25Cmd *cmd)
} }
/* Connect interrupt handler. */ /* Connect interrupt handler. */
static void connect_intr (cycx_t *card, TX25Cmd *cmd) static void connect_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev = NULL; struct net_device *dev = NULL;
...@@ -866,7 +866,7 @@ static void connect_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -866,7 +866,7 @@ static void connect_intr (cycx_t *card, TX25Cmd *cmd)
} }
/* Connect confirm interrupt handler. */ /* Connect confirm interrupt handler. */
static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd) static void connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -893,7 +893,7 @@ static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -893,7 +893,7 @@ static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
} }
/* Disconnect confirm interrupt handler. */ /* Disconnect confirm interrupt handler. */
static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd) static void disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -913,7 +913,7 @@ static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -913,7 +913,7 @@ static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
} }
/* disconnect interrupt handler. */ /* disconnect interrupt handler. */
static void disconnect_intr (cycx_t *card, TX25Cmd *cmd) static void disconnect_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -932,7 +932,7 @@ static void disconnect_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -932,7 +932,7 @@ static void disconnect_intr (cycx_t *card, TX25Cmd *cmd)
} }
/* LOG interrupt handler. */ /* LOG interrupt handler. */
static void log_intr (cycx_t *card, TX25Cmd *cmd) static void log_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
#if CYCLOMX_X25_DEBUG #if CYCLOMX_X25_DEBUG
char bf[20]; char bf[20];
...@@ -960,7 +960,7 @@ static void log_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -960,7 +960,7 @@ static void log_intr (cycx_t *card, TX25Cmd *cmd)
} }
/* STATISTIC interrupt handler. */ /* STATISTIC interrupt handler. */
static void stat_intr (cycx_t *card, TX25Cmd *cmd) static void stat_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
cycx_peek(&card->hw, cmd->buf, &card->u.x.stats, cycx_peek(&card->hw, cmd->buf, &card->u.x.stats,
sizeof(card->u.x.stats)); sizeof(card->u.x.stats));
...@@ -973,7 +973,7 @@ static void stat_intr (cycx_t *card, TX25Cmd *cmd) ...@@ -973,7 +973,7 @@ static void stat_intr (cycx_t *card, TX25Cmd *cmd)
/* Spurious interrupt handler. /* Spurious interrupt handler.
* o print a warning * o print a warning
* If number of spurious interrupts exceeded some limit, then ??? */ * If number of spurious interrupts exceeded some limit, then ??? */
static void spur_intr (cycx_t *card, TX25Cmd *cmd) static void spur_intr(struct cycx_device *card, TX25Cmd *cmd)
{ {
printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n", printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n",
card->devname, cmd->command); card->devname, cmd->command);
...@@ -998,8 +998,8 @@ static void hex_dump(char *msg, unsigned char *p, int len) ...@@ -998,8 +998,8 @@ static void hex_dump(char *msg, unsigned char *p, int len)
/* Cyclom 2X Firmware-Specific Functions */ /* Cyclom 2X Firmware-Specific Functions */
/* Exec X.25 command. */ /* Exec X.25 command. */
static int x25_exec (cycx_t *card, int command, int link, static int x25_exec(struct cycx_device *card, int command, int link,
void *d1, int len1, void *d2, int len2) void *d1, int len1, void *d2, int len2)
{ {
TX25Cmd c; TX25Cmd c;
unsigned long flags; unsigned long flags;
...@@ -1046,7 +1046,7 @@ static int x25_exec (cycx_t *card, int command, int link, ...@@ -1046,7 +1046,7 @@ static int x25_exec (cycx_t *card, int command, int link,
} }
/* Configure adapter. */ /* Configure adapter. */
static int x25_configure (cycx_t *card, TX25Config *conf) static int x25_configure(struct cycx_device *card, TX25Config *conf)
{ {
struct { struct {
u16 nlinks; u16 nlinks;
...@@ -1075,7 +1075,7 @@ static int x25_configure (cycx_t *card, TX25Config *conf) ...@@ -1075,7 +1075,7 @@ static int x25_configure (cycx_t *card, TX25Config *conf)
} }
/* Get protocol statistics. */ /* Get protocol statistics. */
static int x25_get_stats (cycx_t *card) static int x25_get_stats(struct cycx_device *card)
{ {
/* the firmware expects 20 in the size field!!! /* the firmware expects 20 in the size field!!!
thanks to Daniela */ thanks to Daniela */
...@@ -1156,7 +1156,7 @@ static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble) ...@@ -1156,7 +1156,7 @@ static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble)
} }
/* Place X.25 call. */ /* Place X.25 call. */
static int x25_place_call (cycx_t *card, x25_channel_t *chan) static int x25_place_call(struct cycx_device *card, x25_channel_t *chan)
{ {
int err = 0, int err = 0,
len; len;
...@@ -1202,7 +1202,7 @@ static int x25_place_call (cycx_t *card, x25_channel_t *chan) ...@@ -1202,7 +1202,7 @@ static int x25_place_call (cycx_t *card, x25_channel_t *chan)
} }
/* Place X.25 CONNECT RESPONSE. */ /* Place X.25 CONNECT RESPONSE. */
static int x25_connect_response (cycx_t *card, x25_channel_t *chan) static int x25_connect_response(struct cycx_device *card, x25_channel_t *chan)
{ {
u8 d[8]; u8 d[8];
...@@ -1216,7 +1216,7 @@ static int x25_connect_response (cycx_t *card, x25_channel_t *chan) ...@@ -1216,7 +1216,7 @@ static int x25_connect_response (cycx_t *card, x25_channel_t *chan)
} }
/* Place X.25 DISCONNECT RESPONSE. */ /* Place X.25 DISCONNECT RESPONSE. */
static int x25_disconnect_response (cycx_t *card, u8 link, u8 lcn) static int x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn)
{ {
char d[5]; char d[5];
...@@ -1229,7 +1229,8 @@ static int x25_disconnect_response (cycx_t *card, u8 link, u8 lcn) ...@@ -1229,7 +1229,8 @@ static int x25_disconnect_response (cycx_t *card, u8 link, u8 lcn)
} }
/* Clear X.25 call. */ /* Clear X.25 call. */
static int x25_clear_call (cycx_t *card, u8 link, u8 lcn, u8 cause, u8 diagn) static int x25_clear_call(struct cycx_device *card, u8 link, u8 lcn, u8 cause,
u8 diagn)
{ {
u8 d[7]; u8 d[7];
...@@ -1244,7 +1245,8 @@ static int x25_clear_call (cycx_t *card, u8 link, u8 lcn, u8 cause, u8 diagn) ...@@ -1244,7 +1245,8 @@ static int x25_clear_call (cycx_t *card, u8 link, u8 lcn, u8 cause, u8 diagn)
} }
/* Send X.25 data packet. */ /* Send X.25 data packet. */
static int x25_send (cycx_t *card, u8 link, u8 lcn, u8 bitm, int len, void *buf) static int x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
void *buf)
{ {
u8 d[] = "?\xFF\x10??"; u8 d[] = "?\xFF\x10??";
...@@ -1298,7 +1300,7 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev, ...@@ -1298,7 +1300,7 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
static int chan_connect (struct net_device *dev) static int chan_connect (struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
if (chan->svc) { if (chan->svc) {
if (!chan->addr[0]) if (!chan->addr[0])
...@@ -1348,7 +1350,7 @@ static void chan_timer (unsigned long d) ...@@ -1348,7 +1350,7 @@ static void chan_timer (unsigned long d)
static void set_chan_state (struct net_device *dev, u8 state) static void set_chan_state (struct net_device *dev, u8 state)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
unsigned long flags; unsigned long flags;
char *string_state = NULL; char *string_state = NULL;
...@@ -1417,7 +1419,7 @@ static void set_chan_state (struct net_device *dev, u8 state) ...@@ -1417,7 +1419,7 @@ static void set_chan_state (struct net_device *dev, u8 state)
static int chan_send (struct net_device *dev, struct sk_buff *skb) static int chan_send (struct net_device *dev, struct sk_buff *skb)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
cycx_t *card = chan->card; struct cycx_device *card = chan->card;
int bitm = 0; /* final packet */ int bitm = 0; /* final packet */
unsigned len = skb->len; unsigned len = skb->len;
......
...@@ -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 */
...@@ -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-2000 Arnaldo Carvalho de Melo * Copyright: (c) 1998-2003 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 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment