diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-11-30 05:34:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-01 16:06:44 -0500 |
commit | 6cc568340148424e657508d82692ef787d6c4b2c (patch) | |
tree | 653bd7e7bcd724ef1bdac736cf5a29d5bd581df5 | |
parent | 2f7a791c92a6226cf6d9e2213a89a49da72fa574 (diff) |
isdn: remove spellcaster driver
The 'sc' ISDN driver relies on using readl() to access ISA I/O memory.
This has been deprecated and produced warnings since linux-2.3.23,
disabled by default since 2.4.10 and finally removed in 2.6.5.
I found this because the compiling the driver for ARM produces
a warning:
In file included from ../drivers/isdn/sc/includes.h:8:0,
from ../drivers/isdn/sc/init.c:13:
../arch/arm/include/asm/io.h:115:21: note: expected 'const volatile void *' but argument is of type 'long unsigned int'
It is pretty clear that this driver has not been used for a long time
and there is no point fixing it now, so let's remove it.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/isdn/Makefile | 1 | ||||
-rw-r--r-- | drivers/isdn/i4l/Kconfig | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/Kconfig | 8 | ||||
-rw-r--r-- | drivers/isdn/sc/Makefile | 10 | ||||
-rw-r--r-- | drivers/isdn/sc/card.h | 131 | ||||
-rw-r--r-- | drivers/isdn/sc/command.c | 363 | ||||
-rw-r--r-- | drivers/isdn/sc/event.c | 68 | ||||
-rw-r--r-- | drivers/isdn/sc/hardware.h | 110 | ||||
-rw-r--r-- | drivers/isdn/sc/includes.h | 16 | ||||
-rw-r--r-- | drivers/isdn/sc/init.c | 549 | ||||
-rw-r--r-- | drivers/isdn/sc/interrupt.c | 247 | ||||
-rw-r--r-- | drivers/isdn/sc/ioctl.c | 582 | ||||
-rw-r--r-- | drivers/isdn/sc/message.c | 230 | ||||
-rw-r--r-- | drivers/isdn/sc/message.h | 245 | ||||
-rw-r--r-- | drivers/isdn/sc/packet.c | 204 | ||||
-rw-r--r-- | drivers/isdn/sc/scioc.h | 110 | ||||
-rw-r--r-- | drivers/isdn/sc/shmem.c | 138 | ||||
-rw-r--r-- | drivers/isdn/sc/timer.c | 122 |
18 files changed, 0 insertions, 3136 deletions
diff --git a/drivers/isdn/Makefile b/drivers/isdn/Makefile index f1f777570e8e..91c81965e7ca 100644 --- a/drivers/isdn/Makefile +++ b/drivers/isdn/Makefile | |||
@@ -10,7 +10,6 @@ obj-$(CONFIG_ISDN_DIVERSION) += divert/ | |||
10 | obj-$(CONFIG_ISDN_DRV_HISAX) += hisax/ | 10 | obj-$(CONFIG_ISDN_DRV_HISAX) += hisax/ |
11 | obj-$(CONFIG_ISDN_DRV_ICN) += icn/ | 11 | obj-$(CONFIG_ISDN_DRV_ICN) += icn/ |
12 | obj-$(CONFIG_ISDN_DRV_PCBIT) += pcbit/ | 12 | obj-$(CONFIG_ISDN_DRV_PCBIT) += pcbit/ |
13 | obj-$(CONFIG_ISDN_DRV_SC) += sc/ | ||
14 | obj-$(CONFIG_ISDN_DRV_LOOP) += isdnloop/ | 13 | obj-$(CONFIG_ISDN_DRV_LOOP) += isdnloop/ |
15 | obj-$(CONFIG_ISDN_DRV_ACT2000) += act2000/ | 14 | obj-$(CONFIG_ISDN_DRV_ACT2000) += act2000/ |
16 | obj-$(CONFIG_HYSDN) += hysdn/ | 15 | obj-$(CONFIG_HYSDN) += hysdn/ |
diff --git a/drivers/isdn/i4l/Kconfig b/drivers/isdn/i4l/Kconfig index 9c6650ea848e..f5b714cd7618 100644 --- a/drivers/isdn/i4l/Kconfig +++ b/drivers/isdn/i4l/Kconfig | |||
@@ -130,8 +130,6 @@ source "drivers/isdn/icn/Kconfig" | |||
130 | 130 | ||
131 | source "drivers/isdn/pcbit/Kconfig" | 131 | source "drivers/isdn/pcbit/Kconfig" |
132 | 132 | ||
133 | source "drivers/isdn/sc/Kconfig" | ||
134 | |||
135 | source "drivers/isdn/act2000/Kconfig" | 133 | source "drivers/isdn/act2000/Kconfig" |
136 | 134 | ||
137 | endmenu | 135 | endmenu |
diff --git a/drivers/isdn/sc/Kconfig b/drivers/isdn/sc/Kconfig deleted file mode 100644 index 7469863a7925..000000000000 --- a/drivers/isdn/sc/Kconfig +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | config ISDN_DRV_SC | ||
2 | tristate "Spellcaster support" | ||
3 | depends on ISA | ||
4 | help | ||
5 | This enables support for the Spellcaster BRI ISDN boards. This | ||
6 | driver currently builds only in a modularized version. | ||
7 | To build it, choose M here: the module will be called sc. | ||
8 | See <file:Documentation/isdn/README.sc> for more information. | ||
diff --git a/drivers/isdn/sc/Makefile b/drivers/isdn/sc/Makefile deleted file mode 100644 index 0f2b7d602ac0..000000000000 --- a/drivers/isdn/sc/Makefile +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # Makefile for the sc ISDN device driver | ||
2 | |||
3 | # Each configuration option enables a list of files. | ||
4 | |||
5 | obj-$(CONFIG_ISDN_DRV_SC) += sc.o | ||
6 | |||
7 | # Multipart objects. | ||
8 | |||
9 | sc-y := shmem.o init.o packet.o command.o event.o \ | ||
10 | ioctl.o interrupt.o message.o timer.o | ||
diff --git a/drivers/isdn/sc/card.h b/drivers/isdn/sc/card.h deleted file mode 100644 index 3da69ee43da7..000000000000 --- a/drivers/isdn/sc/card.h +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* $Id: card.h,v 1.1.10.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Driver parameters for SpellCaster ISA ISDN adapters | ||
4 | * | ||
5 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | * For more information, please contact gpl-info@spellcast.com or write: | ||
11 | * | ||
12 | * SpellCaster Telecommunications Inc. | ||
13 | * 5621 Finch Avenue East, Unit #3 | ||
14 | * Scarborough, Ontario Canada | ||
15 | * M1B 2T9 | ||
16 | * +1 (416) 297-8565 | ||
17 | * +1 (416) 297-6433 Facsimile | ||
18 | */ | ||
19 | |||
20 | #ifndef CARD_H | ||
21 | #define CARD_H | ||
22 | |||
23 | /* | ||
24 | * We need these if they're not already included | ||
25 | */ | ||
26 | #include <linux/timer.h> | ||
27 | #include <linux/time.h> | ||
28 | #include <linux/isdnif.h> | ||
29 | #include <linux/irqreturn.h> | ||
30 | #include "message.h" | ||
31 | #include "scioc.h" | ||
32 | |||
33 | /* | ||
34 | * Amount of time to wait for a reset to complete | ||
35 | */ | ||
36 | #define CHECKRESET_TIME msecs_to_jiffies(4000) | ||
37 | |||
38 | /* | ||
39 | * Amount of time between line status checks | ||
40 | */ | ||
41 | #define CHECKSTAT_TIME msecs_to_jiffies(8000) | ||
42 | |||
43 | /* | ||
44 | * The maximum amount of time to wait for a message response | ||
45 | * to arrive. Use exclusively by send_and_receive | ||
46 | */ | ||
47 | #define SAR_TIMEOUT msecs_to_jiffies(10000) | ||
48 | |||
49 | /* | ||
50 | * Macro to determine is a card id is valid | ||
51 | */ | ||
52 | #define IS_VALID_CARD(x) ((x >= 0) && (x <= cinst)) | ||
53 | |||
54 | /* | ||
55 | * Per channel status and configuration | ||
56 | */ | ||
57 | typedef struct { | ||
58 | int l2_proto; | ||
59 | int l3_proto; | ||
60 | char dn[50]; | ||
61 | unsigned long first_sendbuf; /* Offset of first send buffer */ | ||
62 | unsigned int num_sendbufs; /* Number of send buffers */ | ||
63 | unsigned int free_sendbufs; /* Number of free sendbufs */ | ||
64 | unsigned int next_sendbuf; /* Next sequential buffer */ | ||
65 | char eazlist[50]; /* Set with SETEAZ */ | ||
66 | char sillist[50]; /* Set with SETSIL */ | ||
67 | int eazclear; /* Don't accept calls if TRUE */ | ||
68 | } bchan; | ||
69 | |||
70 | /* | ||
71 | * Everything you want to know about the adapter ... | ||
72 | */ | ||
73 | typedef struct { | ||
74 | int model; | ||
75 | int driverId; /* LL Id */ | ||
76 | char devicename[20]; /* The device name */ | ||
77 | isdn_if *card; /* ISDN4Linux structure */ | ||
78 | bchan *channel; /* status of the B channels */ | ||
79 | char nChannels; /* Number of channels */ | ||
80 | unsigned int interrupt; /* Interrupt number */ | ||
81 | int iobase; /* I/O Base address */ | ||
82 | int ioport[MAX_IO_REGS]; /* Index to I/O ports */ | ||
83 | int shmem_pgport; /* port for the exp mem page reg. */ | ||
84 | int shmem_magic; /* adapter magic number */ | ||
85 | unsigned int rambase; /* Shared RAM base address */ | ||
86 | unsigned int ramsize; /* Size of shared memory */ | ||
87 | RspMessage async_msg; /* Async response message */ | ||
88 | int want_async_messages; /* Snoop the Q ? */ | ||
89 | unsigned char seq_no; /* Next send seq. number */ | ||
90 | struct timer_list reset_timer; /* Check reset timer */ | ||
91 | struct timer_list stat_timer; /* Check startproc timer */ | ||
92 | unsigned char nphystat; /* Latest PhyStat info */ | ||
93 | unsigned char phystat; /* Last PhyStat info */ | ||
94 | HWConfig_pl hwconfig; /* Hardware config info */ | ||
95 | char load_ver[11]; /* CommManage Version string */ | ||
96 | char proc_ver[11]; /* CommEngine Version */ | ||
97 | int StartOnReset; /* Indicates startproc after reset */ | ||
98 | int EngineUp; /* Indicates CommEngine Up */ | ||
99 | int trace_mode; /* Indicate if tracing is on */ | ||
100 | spinlock_t lock; /* local lock */ | ||
101 | } board; | ||
102 | |||
103 | |||
104 | extern board *sc_adapter[]; | ||
105 | extern int cinst; | ||
106 | |||
107 | void memcpy_toshmem(int card, void *dest, const void *src, size_t n); | ||
108 | void memcpy_fromshmem(int card, void *dest, const void *src, size_t n); | ||
109 | int get_card_from_id(int driver); | ||
110 | int indicate_status(int card, int event, ulong Channel, char *Data); | ||
111 | irqreturn_t interrupt_handler(int interrupt, void *cardptr); | ||
112 | int sndpkt(int devId, int channel, int ack, struct sk_buff *data); | ||
113 | void rcvpkt(int card, RspMessage *rcvmsg); | ||
114 | int command(isdn_ctrl *cmd); | ||
115 | int reset(int card); | ||
116 | int startproc(int card); | ||
117 | int send_and_receive(int card, unsigned int procid, unsigned char type, | ||
118 | unsigned char class, unsigned char code, | ||
119 | unsigned char link, unsigned char data_len, | ||
120 | unsigned char *data, RspMessage *mesgdata, int timeout); | ||
121 | void flushreadfifo(int card); | ||
122 | int sendmessage(int card, unsigned int procid, unsigned int type, | ||
123 | unsigned int class, unsigned int code, unsigned int link, | ||
124 | unsigned int data_len, unsigned int *data); | ||
125 | int receivemessage(int card, RspMessage *rspmsg); | ||
126 | int sc_ioctl(int card, scs_ioctl *data); | ||
127 | int setup_buffers(int card, int c); | ||
128 | void sc_check_reset(unsigned long data); | ||
129 | void check_phystat(unsigned long data); | ||
130 | |||
131 | #endif /* CARD_H */ | ||
diff --git a/drivers/isdn/sc/command.c b/drivers/isdn/sc/command.c deleted file mode 100644 index 4a4e66152ce7..000000000000 --- a/drivers/isdn/sc/command.c +++ /dev/null | |||
@@ -1,363 +0,0 @@ | |||
1 | /* $Id: command.c,v 1.4.10.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | * For more information, please contact gpl-info@spellcast.com or write: | ||
9 | * | ||
10 | * SpellCaster Telecommunications Inc. | ||
11 | * 5621 Finch Avenue East, Unit #3 | ||
12 | * Scarborough, Ontario Canada | ||
13 | * M1B 2T9 | ||
14 | * +1 (416) 297-8565 | ||
15 | * +1 (416) 297-6433 Facsimile | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include "includes.h" /* This must be first */ | ||
20 | #include "hardware.h" | ||
21 | #include "message.h" | ||
22 | #include "card.h" | ||
23 | #include "scioc.h" | ||
24 | |||
25 | static int dial(int card, unsigned long channel, setup_parm setup); | ||
26 | static int hangup(int card, unsigned long channel); | ||
27 | static int answer(int card, unsigned long channel); | ||
28 | static int clreaz(int card, unsigned long channel); | ||
29 | static int seteaz(int card, unsigned long channel, char *); | ||
30 | static int setl2(int card, unsigned long arg); | ||
31 | static int setl3(int card, unsigned long arg); | ||
32 | static int acceptb(int card, unsigned long channel); | ||
33 | |||
34 | #ifdef DEBUG | ||
35 | /* | ||
36 | * Translate command codes to strings | ||
37 | */ | ||
38 | static char *commands[] = { "ISDN_CMD_IOCTL", | ||
39 | "ISDN_CMD_DIAL", | ||
40 | "ISDN_CMD_ACCEPTB", | ||
41 | "ISDN_CMD_ACCEPTB", | ||
42 | "ISDN_CMD_HANGUP", | ||
43 | "ISDN_CMD_CLREAZ", | ||
44 | "ISDN_CMD_SETEAZ", | ||
45 | NULL, | ||
46 | NULL, | ||
47 | NULL, | ||
48 | "ISDN_CMD_SETL2", | ||
49 | NULL, | ||
50 | "ISDN_CMD_SETL3", | ||
51 | NULL, | ||
52 | NULL, | ||
53 | NULL, | ||
54 | NULL, | ||
55 | NULL, }; | ||
56 | |||
57 | /* | ||
58 | * Translates ISDN4Linux protocol codes to strings for debug messages | ||
59 | */ | ||
60 | static char *l3protos[] = { "ISDN_PROTO_L3_TRANS" }; | ||
61 | static char *l2protos[] = { "ISDN_PROTO_L2_X75I", | ||
62 | "ISDN_PROTO_L2_X75UI", | ||
63 | "ISDN_PROTO_L2_X75BUI", | ||
64 | "ISDN_PROTO_L2_HDLC", | ||
65 | "ISDN_PROTO_L2_TRANS" }; | ||
66 | #endif | ||
67 | |||
68 | int get_card_from_id(int driver) | ||
69 | { | ||
70 | int i; | ||
71 | |||
72 | for (i = 0; i < cinst; i++) { | ||
73 | if (sc_adapter[i]->driverId == driver) | ||
74 | return i; | ||
75 | } | ||
76 | return -ENODEV; | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | * command | ||
81 | */ | ||
82 | |||
83 | int command(isdn_ctrl *cmd) | ||
84 | { | ||
85 | int card; | ||
86 | |||
87 | card = get_card_from_id(cmd->driver); | ||
88 | if (!IS_VALID_CARD(card)) { | ||
89 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
90 | return -ENODEV; | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Dispatch the command | ||
95 | */ | ||
96 | switch (cmd->command) { | ||
97 | case ISDN_CMD_IOCTL: | ||
98 | { | ||
99 | unsigned long cmdptr; | ||
100 | scs_ioctl ioc; | ||
101 | |||
102 | memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long)); | ||
103 | if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr, | ||
104 | sizeof(scs_ioctl))) { | ||
105 | pr_debug("%s: Failed to verify user space 0x%lx\n", | ||
106 | sc_adapter[card]->devicename, cmdptr); | ||
107 | return -EFAULT; | ||
108 | } | ||
109 | return sc_ioctl(card, &ioc); | ||
110 | } | ||
111 | case ISDN_CMD_DIAL: | ||
112 | return dial(card, cmd->arg, cmd->parm.setup); | ||
113 | case ISDN_CMD_HANGUP: | ||
114 | return hangup(card, cmd->arg); | ||
115 | case ISDN_CMD_ACCEPTD: | ||
116 | return answer(card, cmd->arg); | ||
117 | case ISDN_CMD_ACCEPTB: | ||
118 | return acceptb(card, cmd->arg); | ||
119 | case ISDN_CMD_CLREAZ: | ||
120 | return clreaz(card, cmd->arg); | ||
121 | case ISDN_CMD_SETEAZ: | ||
122 | return seteaz(card, cmd->arg, cmd->parm.num); | ||
123 | case ISDN_CMD_SETL2: | ||
124 | return setl2(card, cmd->arg); | ||
125 | case ISDN_CMD_SETL3: | ||
126 | return setl3(card, cmd->arg); | ||
127 | default: | ||
128 | return -EINVAL; | ||
129 | } | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | /* | ||
134 | * start the onboard firmware | ||
135 | */ | ||
136 | int startproc(int card) | ||
137 | { | ||
138 | int status; | ||
139 | |||
140 | if (!IS_VALID_CARD(card)) { | ||
141 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
142 | return -ENODEV; | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * send start msg | ||
147 | */ | ||
148 | status = sendmessage(card, CMPID, cmReqType2, | ||
149 | cmReqClass0, | ||
150 | cmReqStartProc, | ||
151 | 0, 0, NULL); | ||
152 | pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename); | ||
153 | |||
154 | return status; | ||
155 | } | ||
156 | |||
157 | |||
158 | /* | ||
159 | * Dials the number passed in | ||
160 | */ | ||
161 | static int dial(int card, unsigned long channel, setup_parm setup) | ||
162 | { | ||
163 | int status; | ||
164 | char Phone[48]; | ||
165 | |||
166 | if (!IS_VALID_CARD(card)) { | ||
167 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
168 | return -ENODEV; | ||
169 | } | ||
170 | |||
171 | /*extract ISDN number to dial from eaz/msn string*/ | ||
172 | strcpy(Phone, setup.phone); | ||
173 | |||
174 | /*send the connection message*/ | ||
175 | status = sendmessage(card, CEPID, ceReqTypePhy, | ||
176 | ceReqClass1, | ||
177 | ceReqPhyConnect, | ||
178 | (unsigned char)channel + 1, | ||
179 | strlen(Phone), | ||
180 | (unsigned int *)Phone); | ||
181 | |||
182 | pr_debug("%s: Dialing %s on channel %lu\n", | ||
183 | sc_adapter[card]->devicename, Phone, channel + 1); | ||
184 | |||
185 | return status; | ||
186 | } | ||
187 | |||
188 | /* | ||
189 | * Answer an incoming call | ||
190 | */ | ||
191 | static int answer(int card, unsigned long channel) | ||
192 | { | ||
193 | if (!IS_VALID_CARD(card)) { | ||
194 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
195 | return -ENODEV; | ||
196 | } | ||
197 | |||
198 | if (setup_buffers(card, channel + 1)) { | ||
199 | hangup(card, channel + 1); | ||
200 | return -ENOBUFS; | ||
201 | } | ||
202 | |||
203 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); | ||
204 | pr_debug("%s: Answered incoming call on channel %lu\n", | ||
205 | sc_adapter[card]->devicename, channel + 1); | ||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * Hangup up the call on specified channel | ||
211 | */ | ||
212 | static int hangup(int card, unsigned long channel) | ||
213 | { | ||
214 | int status; | ||
215 | |||
216 | if (!IS_VALID_CARD(card)) { | ||
217 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
218 | return -ENODEV; | ||
219 | } | ||
220 | |||
221 | status = sendmessage(card, CEPID, ceReqTypePhy, | ||
222 | ceReqClass1, | ||
223 | ceReqPhyDisconnect, | ||
224 | (unsigned char)channel + 1, | ||
225 | 0, | ||
226 | NULL); | ||
227 | pr_debug("%s: Sent HANGUP message to channel %lu\n", | ||
228 | sc_adapter[card]->devicename, channel + 1); | ||
229 | return status; | ||
230 | } | ||
231 | |||
232 | /* | ||
233 | * Set the layer 2 protocol (X.25, HDLC, Raw) | ||
234 | */ | ||
235 | static int setl2(int card, unsigned long arg) | ||
236 | { | ||
237 | int status = 0; | ||
238 | int protocol, channel; | ||
239 | |||
240 | if (!IS_VALID_CARD(card)) { | ||
241 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
242 | return -ENODEV; | ||
243 | } | ||
244 | protocol = arg >> 8; | ||
245 | channel = arg & 0xff; | ||
246 | sc_adapter[card]->channel[channel].l2_proto = protocol; | ||
247 | |||
248 | /* | ||
249 | * check that the adapter is also set to the correct protocol | ||
250 | */ | ||
251 | pr_debug("%s: Sending GetFrameFormat for channel %d\n", | ||
252 | sc_adapter[card]->devicename, channel + 1); | ||
253 | status = sendmessage(card, CEPID, ceReqTypeCall, | ||
254 | ceReqClass0, | ||
255 | ceReqCallGetFrameFormat, | ||
256 | (unsigned char)channel + 1, | ||
257 | 1, | ||
258 | (unsigned int *)protocol); | ||
259 | if (status) | ||
260 | return status; | ||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * Set the layer 3 protocol | ||
266 | */ | ||
267 | static int setl3(int card, unsigned long channel) | ||
268 | { | ||
269 | int protocol = channel >> 8; | ||
270 | |||
271 | if (!IS_VALID_CARD(card)) { | ||
272 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
273 | return -ENODEV; | ||
274 | } | ||
275 | |||
276 | sc_adapter[card]->channel[channel].l3_proto = protocol; | ||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | static int acceptb(int card, unsigned long channel) | ||
281 | { | ||
282 | if (!IS_VALID_CARD(card)) { | ||
283 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
284 | return -ENODEV; | ||
285 | } | ||
286 | |||
287 | if (setup_buffers(card, channel + 1)) | ||
288 | { | ||
289 | hangup(card, channel + 1); | ||
290 | return -ENOBUFS; | ||
291 | } | ||
292 | |||
293 | pr_debug("%s: B-Channel connection accepted on channel %lu\n", | ||
294 | sc_adapter[card]->devicename, channel + 1); | ||
295 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); | ||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | static int clreaz(int card, unsigned long arg) | ||
300 | { | ||
301 | if (!IS_VALID_CARD(card)) { | ||
302 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
303 | return -ENODEV; | ||
304 | } | ||
305 | |||
306 | strcpy(sc_adapter[card]->channel[arg].eazlist, ""); | ||
307 | sc_adapter[card]->channel[arg].eazclear = 1; | ||
308 | pr_debug("%s: EAZ List cleared for channel %lu\n", | ||
309 | sc_adapter[card]->devicename, arg + 1); | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | static int seteaz(int card, unsigned long arg, char *num) | ||
314 | { | ||
315 | if (!IS_VALID_CARD(card)) { | ||
316 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
317 | return -ENODEV; | ||
318 | } | ||
319 | |||
320 | strcpy(sc_adapter[card]->channel[arg].eazlist, num); | ||
321 | sc_adapter[card]->channel[arg].eazclear = 0; | ||
322 | pr_debug("%s: EAZ list for channel %lu set to: %s\n", | ||
323 | sc_adapter[card]->devicename, arg + 1, | ||
324 | sc_adapter[card]->channel[arg].eazlist); | ||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | int reset(int card) | ||
329 | { | ||
330 | unsigned long flags; | ||
331 | |||
332 | if (!IS_VALID_CARD(card)) { | ||
333 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
334 | return -ENODEV; | ||
335 | } | ||
336 | |||
337 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); | ||
338 | |||
339 | if (sc_adapter[card]->EngineUp) { | ||
340 | del_timer(&sc_adapter[card]->stat_timer); | ||
341 | } | ||
342 | |||
343 | sc_adapter[card]->EngineUp = 0; | ||
344 | |||
345 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
346 | init_timer(&sc_adapter[card]->reset_timer); | ||
347 | sc_adapter[card]->reset_timer.function = sc_check_reset; | ||
348 | sc_adapter[card]->reset_timer.data = card; | ||
349 | sc_adapter[card]->reset_timer.expires = jiffies + CHECKRESET_TIME; | ||
350 | add_timer(&sc_adapter[card]->reset_timer); | ||
351 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
352 | |||
353 | outb(0x1, sc_adapter[card]->ioport[SFT_RESET]); | ||
354 | |||
355 | pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename); | ||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | void flushreadfifo(int card) | ||
360 | { | ||
361 | while (inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) | ||
362 | inb(sc_adapter[card]->ioport[FIFO_READ]); | ||
363 | } | ||
diff --git a/drivers/isdn/sc/event.c b/drivers/isdn/sc/event.c deleted file mode 100644 index 833d96c2cf92..000000000000 --- a/drivers/isdn/sc/event.c +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | /* $Id: event.c,v 1.4.8.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | * For more information, please contact gpl-info@spellcast.com or write: | ||
9 | * | ||
10 | * SpellCaster Telecommunications Inc. | ||
11 | * 5621 Finch Avenue East, Unit #3 | ||
12 | * Scarborough, Ontario Canada | ||
13 | * M1B 2T9 | ||
14 | * +1 (416) 297-8565 | ||
15 | * +1 (416) 297-6433 Facsimile | ||
16 | */ | ||
17 | |||
18 | #include "includes.h" | ||
19 | #include "hardware.h" | ||
20 | #include "message.h" | ||
21 | #include "card.h" | ||
22 | |||
23 | #ifdef DEBUG | ||
24 | static char *events[] = { "ISDN_STAT_STAVAIL", | ||
25 | "ISDN_STAT_ICALL", | ||
26 | "ISDN_STAT_RUN", | ||
27 | "ISDN_STAT_STOP", | ||
28 | "ISDN_STAT_DCONN", | ||
29 | "ISDN_STAT_BCONN", | ||
30 | "ISDN_STAT_DHUP", | ||
31 | "ISDN_STAT_BHUP", | ||
32 | "ISDN_STAT_CINF", | ||
33 | "ISDN_STAT_LOAD", | ||
34 | "ISDN_STAT_UNLOAD", | ||
35 | "ISDN_STAT_BSENT", | ||
36 | "ISDN_STAT_NODCH", | ||
37 | "ISDN_STAT_ADDCH", | ||
38 | "ISDN_STAT_CAUSE" }; | ||
39 | #endif | ||
40 | |||
41 | int indicate_status(int card, int event, ulong Channel, char *Data) | ||
42 | { | ||
43 | isdn_ctrl cmd; | ||
44 | |||
45 | #ifdef DEBUG | ||
46 | pr_debug("%s: Indicating event %s on Channel %d\n", | ||
47 | sc_adapter[card]->devicename, events[event - 256], Channel); | ||
48 | #endif | ||
49 | if (Data != NULL) { | ||
50 | pr_debug("%s: Event data: %s\n", sc_adapter[card]->devicename, | ||
51 | Data); | ||
52 | switch (event) { | ||
53 | case ISDN_STAT_BSENT: | ||
54 | memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); | ||
55 | break; | ||
56 | case ISDN_STAT_ICALL: | ||
57 | memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); | ||
58 | break; | ||
59 | default: | ||
60 | strlcpy(cmd.parm.num, Data, sizeof(cmd.parm.num)); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | cmd.command = event; | ||
65 | cmd.driver = sc_adapter[card]->driverId; | ||
66 | cmd.arg = Channel; | ||
67 | return sc_adapter[card]->card->statcallb(&cmd); | ||
68 | } | ||
diff --git a/drivers/isdn/sc/hardware.h b/drivers/isdn/sc/hardware.h deleted file mode 100644 index 81fbe78701f0..000000000000 --- a/drivers/isdn/sc/hardware.h +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* | ||
2 | * Hardware specific macros, defines and structures | ||
3 | * | ||
4 | * This software may be used and distributed according to the terms | ||
5 | * of the GNU General Public License, incorporated herein by reference. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef HARDWARE_H | ||
10 | #define HARDWARE_H | ||
11 | |||
12 | #include <asm/param.h> /* For HZ */ | ||
13 | |||
14 | /* | ||
15 | * General hardware parameters common to all ISA adapters | ||
16 | */ | ||
17 | |||
18 | #define MAX_CARDS 4 /* The maximum number of cards to | ||
19 | control or probe for. */ | ||
20 | |||
21 | #define SIGNATURE 0x87654321 /* Board reset signature */ | ||
22 | #define SIG_OFFSET 0x1004 /* Where to find signature in shared RAM */ | ||
23 | #define TRACE_OFFSET 0x1008 /* Trace enable word offset in shared RAM */ | ||
24 | #define BUFFER_OFFSET 0x1800 /* Beginning of buffers */ | ||
25 | |||
26 | /* I/O Port parameters */ | ||
27 | #define IOBASE_MIN 0x180 /* Lowest I/O port address */ | ||
28 | #define IOBASE_MAX 0x3C0 /* Highest I/O port address */ | ||
29 | #define IOBASE_OFFSET 0x20 /* Inter-board I/O port gap used during | ||
30 | probing */ | ||
31 | #define FIFORD_OFFSET 0x0 | ||
32 | #define FIFOWR_OFFSET 0x400 | ||
33 | #define FIFOSTAT_OFFSET 0x1000 | ||
34 | #define RESET_OFFSET 0x2800 | ||
35 | #define PG0_OFFSET 0x3000 /* Offset from I/O Base for Page 0 register */ | ||
36 | #define PG1_OFFSET 0x3400 /* Offset from I/O Base for Page 1 register */ | ||
37 | #define PG2_OFFSET 0x3800 /* Offset from I/O Base for Page 2 register */ | ||
38 | #define PG3_OFFSET 0x3C00 /* Offset from I/O Base for Page 3 register */ | ||
39 | |||
40 | #define FIFO_READ 0 /* FIFO Read register */ | ||
41 | #define FIFO_WRITE 1 /* FIFO Write rgister */ | ||
42 | #define LO_ADDR_PTR 2 /* Extended RAM Low Addr Pointer */ | ||
43 | #define HI_ADDR_PTR 3 /* Extended RAM High Addr Pointer */ | ||
44 | #define NOT_USED_1 4 | ||
45 | #define FIFO_STATUS 5 /* FIFO Status Register */ | ||
46 | #define NOT_USED_2 6 | ||
47 | #define MEM_OFFSET 7 | ||
48 | #define SFT_RESET 10 /* Reset Register */ | ||
49 | #define EXP_BASE 11 /* Shared RAM Base address */ | ||
50 | #define EXP_PAGE0 12 /* Shared RAM Page0 register */ | ||
51 | #define EXP_PAGE1 13 /* Shared RAM Page1 register */ | ||
52 | #define EXP_PAGE2 14 /* Shared RAM Page2 register */ | ||
53 | #define EXP_PAGE3 15 /* Shared RAM Page3 register */ | ||
54 | #define IRQ_SELECT 16 /* IRQ selection register */ | ||
55 | #define MAX_IO_REGS 17 /* Total number of I/O ports */ | ||
56 | |||
57 | /* FIFO register values */ | ||
58 | #define RF_HAS_DATA 0x01 /* fifo has data */ | ||
59 | #define RF_QUART_FULL 0x02 /* fifo quarter full */ | ||
60 | #define RF_HALF_FULL 0x04 /* fifo half full */ | ||
61 | #define RF_NOT_FULL 0x08 /* fifo not full */ | ||
62 | #define WF_HAS_DATA 0x10 /* fifo has data */ | ||
63 | #define WF_QUART_FULL 0x20 /* fifo quarter full */ | ||
64 | #define WF_HALF_FULL 0x40 /* fifo half full */ | ||
65 | #define WF_NOT_FULL 0x80 /* fifo not full */ | ||
66 | |||
67 | /* Shared RAM parameters */ | ||
68 | #define SRAM_MIN 0xC0000 /* Lowest host shared RAM address */ | ||
69 | #define SRAM_MAX 0xEFFFF /* Highest host shared RAM address */ | ||
70 | #define SRAM_PAGESIZE 0x4000 /* Size of one RAM page (16K) */ | ||
71 | |||
72 | /* Shared RAM buffer parameters */ | ||
73 | #define BUFFER_SIZE 0x800 /* The size of a buffer in bytes */ | ||
74 | #define BUFFER_BASE BUFFER_OFFSET /* Offset from start of shared RAM | ||
75 | where buffer start */ | ||
76 | #define BUFFERS_MAX 16 /* Maximum number of send/receive | ||
77 | buffers per channel */ | ||
78 | #define HDLC_PROTO 0x01 /* Frame Format for Layer 2 */ | ||
79 | |||
80 | #define BRI_BOARD 0 | ||
81 | #define POTS_BOARD 1 | ||
82 | #define PRI_BOARD 2 | ||
83 | |||
84 | /* | ||
85 | * Specific hardware parameters for the DataCommute/BRI | ||
86 | */ | ||
87 | #define BRI_CHANNELS 2 /* Number of B channels */ | ||
88 | #define BRI_BASEPG_VAL 0x98 | ||
89 | #define BRI_MAGIC 0x60000 /* Magic Number */ | ||
90 | #define BRI_MEMSIZE 0x10000 /* Amount of RAM (64K) */ | ||
91 | #define BRI_PARTNO "72-029" | ||
92 | #define BRI_FEATURES ISDN_FEATURE_L2_HDLC | ISDN_FEATURE_L3_TRANS; | ||
93 | /* | ||
94 | * Specific hardware parameters for the DataCommute/PRI | ||
95 | */ | ||
96 | #define PRI_CHANNELS 23 /* Number of B channels */ | ||
97 | #define PRI_BASEPG_VAL 0x88 | ||
98 | #define PRI_MAGIC 0x20000 /* Magic Number */ | ||
99 | #define PRI_MEMSIZE 0x100000 /* Amount of RAM (1M) */ | ||
100 | #define PRI_PARTNO "72-030" | ||
101 | #define PRI_FEATURES ISDN_FEATURE_L2_HDLC | ISDN_FEATURE_L3_TRANS; | ||
102 | |||
103 | /* | ||
104 | * Some handy macros | ||
105 | */ | ||
106 | |||
107 | /* Determine if a channel number is valid for the adapter */ | ||
108 | #define IS_VALID_CHANNEL(y, x) ((x > 0) && (x <= sc_adapter[y]->channels)) | ||
109 | |||
110 | #endif | ||
diff --git a/drivers/isdn/sc/includes.h b/drivers/isdn/sc/includes.h deleted file mode 100644 index 4766e5b77378..000000000000 --- a/drivers/isdn/sc/includes.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * This software may be used and distributed according to the terms | ||
3 | * of the GNU General Public License, incorporated herein by reference. | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #include <linux/errno.h> | ||
8 | #include <asm/io.h> | ||
9 | #include <linux/delay.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/mm.h> | ||
13 | #include <linux/ioport.h> | ||
14 | #include <linux/timer.h> | ||
15 | #include <linux/wait.h> | ||
16 | #include <linux/isdnif.h> | ||
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c deleted file mode 100644 index 3597ef47b28a..000000000000 --- a/drivers/isdn/sc/init.c +++ /dev/null | |||
@@ -1,549 +0,0 @@ | |||
1 | /* | ||
2 | * This software may be used and distributed according to the terms | ||
3 | * of the GNU General Public License, incorporated herein by reference. | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #include <linux/module.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/interrupt.h> | ||
10 | #include <linux/delay.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include "includes.h" | ||
14 | #include "hardware.h" | ||
15 | #include "card.h" | ||
16 | |||
17 | MODULE_DESCRIPTION("ISDN4Linux: Driver for Spellcaster card"); | ||
18 | MODULE_AUTHOR("Spellcaster Telecommunications Inc."); | ||
19 | MODULE_LICENSE("GPL"); | ||
20 | |||
21 | board *sc_adapter[MAX_CARDS]; | ||
22 | int cinst; | ||
23 | |||
24 | static char devname[] = "scX"; | ||
25 | static const char version[] = "2.0b1"; | ||
26 | |||
27 | static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; | ||
28 | |||
29 | /* insmod set parameters */ | ||
30 | static unsigned int io[] = {0, 0, 0, 0}; | ||
31 | static unsigned char irq[] = {0, 0, 0, 0}; | ||
32 | static unsigned long ram[] = {0, 0, 0, 0}; | ||
33 | static bool do_reset; | ||
34 | |||
35 | module_param_array(io, int, NULL, 0); | ||
36 | module_param_array(irq, byte, NULL, 0); | ||
37 | module_param_array(ram, long, NULL, 0); | ||
38 | module_param(do_reset, bool, 0); | ||
39 | |||
40 | static int identify_board(unsigned long, unsigned int); | ||
41 | |||
42 | static int __init sc_init(void) | ||
43 | { | ||
44 | int b = -1; | ||
45 | int i, j; | ||
46 | int status = -ENODEV; | ||
47 | |||
48 | unsigned long memsize = 0; | ||
49 | unsigned long features = 0; | ||
50 | isdn_if *interface; | ||
51 | unsigned char channels; | ||
52 | unsigned char pgport; | ||
53 | unsigned long magic; | ||
54 | int model; | ||
55 | int last_base = IOBASE_MIN; | ||
56 | int probe_exhasted = 0; | ||
57 | |||
58 | #ifdef MODULE | ||
59 | pr_info("SpellCaster ISA ISDN Adapter Driver rev. %s Loaded\n", version); | ||
60 | #else | ||
61 | pr_info("SpellCaster ISA ISDN Adapter Driver rev. %s\n", version); | ||
62 | #endif | ||
63 | pr_info("Copyright (C) 1996 SpellCaster Telecommunications Inc.\n"); | ||
64 | |||
65 | while (b++ < MAX_CARDS - 1) { | ||
66 | pr_debug("Probing for adapter #%d\n", b); | ||
67 | /* | ||
68 | * Initialize reusable variables | ||
69 | */ | ||
70 | model = -1; | ||
71 | magic = 0; | ||
72 | channels = 0; | ||
73 | pgport = 0; | ||
74 | |||
75 | /* | ||
76 | * See if we should probe for IO base | ||
77 | */ | ||
78 | pr_debug("I/O Base for board %d is 0x%x, %s probe\n", b, io[b], | ||
79 | io[b] == 0 ? "will" : "won't"); | ||
80 | if (io[b]) { | ||
81 | /* | ||
82 | * No, I/O Base has been provided | ||
83 | */ | ||
84 | for (i = 0; i < MAX_IO_REGS - 1; i++) { | ||
85 | if (!request_region(io[b] + i * 0x400, 1, "sc test")) { | ||
86 | pr_debug("request_region for 0x%x failed\n", io[b] + i * 0x400); | ||
87 | io[b] = 0; | ||
88 | break; | ||
89 | } else | ||
90 | release_region(io[b] + i * 0x400, 1); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Confirm the I/O Address with a test | ||
95 | */ | ||
96 | if (io[b] == 0) { | ||
97 | pr_debug("I/O Address invalid.\n"); | ||
98 | continue; | ||
99 | } | ||
100 | |||
101 | outb(0x18, io[b] + 0x400 * EXP_PAGE0); | ||
102 | if (inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { | ||
103 | pr_debug("I/O Base 0x%x fails test\n", | ||
104 | io[b] + 0x400 * EXP_PAGE0); | ||
105 | continue; | ||
106 | } | ||
107 | } else { | ||
108 | /* | ||
109 | * Yes, probe for I/O Base | ||
110 | */ | ||
111 | if (probe_exhasted) { | ||
112 | pr_debug("All probe addresses exhausted, skipping\n"); | ||
113 | continue; | ||
114 | } | ||
115 | pr_debug("Probing for I/O...\n"); | ||
116 | for (i = last_base; i <= IOBASE_MAX; i += IOBASE_OFFSET) { | ||
117 | int found_io = 1; | ||
118 | if (i == IOBASE_MAX) { | ||
119 | probe_exhasted = 1; /* No more addresses to probe */ | ||
120 | pr_debug("End of Probes\n"); | ||
121 | } | ||
122 | last_base = i + IOBASE_OFFSET; | ||
123 | pr_debug(" checking 0x%x...", i); | ||
124 | for (j = 0; j < MAX_IO_REGS - 1; j++) { | ||
125 | if (!request_region(i + j * 0x400, 1, "sc test")) { | ||
126 | pr_debug("Failed\n"); | ||
127 | found_io = 0; | ||
128 | break; | ||
129 | } else | ||
130 | release_region(i + j * 0x400, 1); | ||
131 | } | ||
132 | |||
133 | if (found_io) { | ||
134 | io[b] = i; | ||
135 | outb(0x18, io[b] + 0x400 * EXP_PAGE0); | ||
136 | if (inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { | ||
137 | pr_debug("Failed by test\n"); | ||
138 | continue; | ||
139 | } | ||
140 | pr_debug("Passed\n"); | ||
141 | break; | ||
142 | } | ||
143 | } | ||
144 | if (probe_exhasted) { | ||
145 | continue; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | /* | ||
150 | * See if we should probe for shared RAM | ||
151 | */ | ||
152 | if (do_reset) { | ||
153 | pr_debug("Doing a SAFE probe reset\n"); | ||
154 | outb(0xFF, io[b] + RESET_OFFSET); | ||
155 | msleep_interruptible(10000); | ||
156 | } | ||
157 | pr_debug("RAM Base for board %d is 0x%lx, %s probe\n", b, | ||
158 | ram[b], ram[b] == 0 ? "will" : "won't"); | ||
159 | |||
160 | if (ram[b]) { | ||
161 | /* | ||
162 | * No, the RAM base has been provided | ||
163 | * Just look for a signature and ID the | ||
164 | * board model | ||
165 | */ | ||
166 | if (request_region(ram[b], SRAM_PAGESIZE, "sc test")) { | ||
167 | pr_debug("request_region for RAM base 0x%lx succeeded\n", ram[b]); | ||
168 | model = identify_board(ram[b], io[b]); | ||
169 | release_region(ram[b], SRAM_PAGESIZE); | ||
170 | } | ||
171 | } else { | ||
172 | /* | ||
173 | * Yes, probe for free RAM and look for | ||
174 | * a signature and id the board model | ||
175 | */ | ||
176 | for (i = SRAM_MIN; i < SRAM_MAX; i += SRAM_PAGESIZE) { | ||
177 | pr_debug("Checking RAM address 0x%x...\n", i); | ||
178 | if (request_region(i, SRAM_PAGESIZE, "sc test")) { | ||
179 | pr_debug(" request_region succeeded\n"); | ||
180 | model = identify_board(i, io[b]); | ||
181 | release_region(i, SRAM_PAGESIZE); | ||
182 | if (model >= 0) { | ||
183 | pr_debug(" Identified a %s\n", | ||
184 | boardname[model]); | ||
185 | ram[b] = i; | ||
186 | break; | ||
187 | } | ||
188 | pr_debug(" Unidentified or inaccessible\n"); | ||
189 | continue; | ||
190 | } | ||
191 | pr_debug(" request failed\n"); | ||
192 | } | ||
193 | } | ||
194 | /* | ||
195 | * See if we found free RAM and the board model | ||
196 | */ | ||
197 | if (!ram[b] || model < 0) { | ||
198 | /* | ||
199 | * Nope, there was no place in RAM for the | ||
200 | * board, or it couldn't be identified | ||
201 | */ | ||
202 | pr_debug("Failed to find an adapter at 0x%lx\n", ram[b]); | ||
203 | continue; | ||
204 | } | ||
205 | |||
206 | /* | ||
207 | * Set the board's magic number, memory size and page register | ||
208 | */ | ||
209 | switch (model) { | ||
210 | case PRI_BOARD: | ||
211 | channels = 23; | ||
212 | magic = 0x20000; | ||
213 | memsize = 0x100000; | ||
214 | features = PRI_FEATURES; | ||
215 | break; | ||
216 | |||
217 | case BRI_BOARD: | ||
218 | case POTS_BOARD: | ||
219 | channels = 2; | ||
220 | magic = 0x60000; | ||
221 | memsize = 0x10000; | ||
222 | features = BRI_FEATURES; | ||
223 | break; | ||
224 | } | ||
225 | switch (ram[b] >> 12 & 0x0F) { | ||
226 | case 0x0: | ||
227 | pr_debug("RAM Page register set to EXP_PAGE0\n"); | ||
228 | pgport = EXP_PAGE0; | ||
229 | break; | ||
230 | |||
231 | case 0x4: | ||
232 | pr_debug("RAM Page register set to EXP_PAGE1\n"); | ||
233 | pgport = EXP_PAGE1; | ||
234 | break; | ||
235 | |||
236 | case 0x8: | ||
237 | pr_debug("RAM Page register set to EXP_PAGE2\n"); | ||
238 | pgport = EXP_PAGE2; | ||
239 | break; | ||
240 | |||
241 | case 0xC: | ||
242 | pr_debug("RAM Page register set to EXP_PAGE3\n"); | ||
243 | pgport = EXP_PAGE3; | ||
244 | break; | ||
245 | |||
246 | default: | ||
247 | pr_debug("RAM base address doesn't fall on 16K boundary\n"); | ||
248 | continue; | ||
249 | } | ||
250 | |||
251 | pr_debug("current IRQ: %d b: %d\n", irq[b], b); | ||
252 | |||
253 | /* | ||
254 | * Make sure we got an IRQ | ||
255 | */ | ||
256 | if (!irq[b]) { | ||
257 | /* | ||
258 | * No interrupt could be used | ||
259 | */ | ||
260 | pr_debug("Failed to acquire an IRQ line\n"); | ||
261 | continue; | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * Horray! We found a board, Make sure we can register | ||
266 | * it with ISDN4Linux | ||
267 | */ | ||
268 | interface = kzalloc(sizeof(isdn_if), GFP_KERNEL); | ||
269 | if (interface == NULL) { | ||
270 | /* | ||
271 | * Oops, can't malloc isdn_if | ||
272 | */ | ||
273 | continue; | ||
274 | } | ||
275 | |||
276 | interface->owner = THIS_MODULE; | ||
277 | interface->hl_hdrlen = 0; | ||
278 | interface->channels = channels; | ||
279 | interface->maxbufsize = BUFFER_SIZE; | ||
280 | interface->features = features; | ||
281 | interface->writebuf_skb = sndpkt; | ||
282 | interface->writecmd = NULL; | ||
283 | interface->command = command; | ||
284 | strcpy(interface->id, devname); | ||
285 | interface->id[2] = '0' + cinst; | ||
286 | |||
287 | /* | ||
288 | * Allocate the board structure | ||
289 | */ | ||
290 | sc_adapter[cinst] = kzalloc(sizeof(board), GFP_KERNEL); | ||
291 | if (sc_adapter[cinst] == NULL) { | ||
292 | /* | ||
293 | * Oops, can't alloc memory for the board | ||
294 | */ | ||
295 | kfree(interface); | ||
296 | continue; | ||
297 | } | ||
298 | spin_lock_init(&sc_adapter[cinst]->lock); | ||
299 | |||
300 | if (!register_isdn(interface)) { | ||
301 | /* | ||
302 | * Oops, couldn't register for some reason | ||
303 | */ | ||
304 | kfree(interface); | ||
305 | kfree(sc_adapter[cinst]); | ||
306 | continue; | ||
307 | } | ||
308 | |||
309 | sc_adapter[cinst]->card = interface; | ||
310 | sc_adapter[cinst]->driverId = interface->channels; | ||
311 | strcpy(sc_adapter[cinst]->devicename, interface->id); | ||
312 | sc_adapter[cinst]->nChannels = channels; | ||
313 | sc_adapter[cinst]->ramsize = memsize; | ||
314 | sc_adapter[cinst]->shmem_magic = magic; | ||
315 | sc_adapter[cinst]->shmem_pgport = pgport; | ||
316 | sc_adapter[cinst]->StartOnReset = 1; | ||
317 | |||
318 | /* | ||
319 | * Allocate channels status structures | ||
320 | */ | ||
321 | sc_adapter[cinst]->channel = kzalloc(sizeof(bchan) * channels, GFP_KERNEL); | ||
322 | if (sc_adapter[cinst]->channel == NULL) { | ||
323 | /* | ||
324 | * Oops, can't alloc memory for the channels | ||
325 | */ | ||
326 | indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ | ||
327 | kfree(interface); | ||
328 | kfree(sc_adapter[cinst]); | ||
329 | continue; | ||
330 | } | ||
331 | |||
332 | /* | ||
333 | * Lock down the hardware resources | ||
334 | */ | ||
335 | sc_adapter[cinst]->interrupt = irq[b]; | ||
336 | if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler, | ||
337 | 0, interface->id, | ||
338 | (void *)(unsigned long) cinst)) { | ||
339 | kfree(sc_adapter[cinst]->channel); | ||
340 | indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ | ||
341 | kfree(interface); | ||
342 | kfree(sc_adapter[cinst]); | ||
343 | continue; | ||
344 | |||
345 | } | ||
346 | sc_adapter[cinst]->iobase = io[b]; | ||
347 | for (i = 0; i < MAX_IO_REGS - 1; i++) { | ||
348 | sc_adapter[cinst]->ioport[i] = io[b] + i * 0x400; | ||
349 | request_region(sc_adapter[cinst]->ioport[i], 1, | ||
350 | interface->id); | ||
351 | pr_debug("Requesting I/O Port %#x\n", | ||
352 | sc_adapter[cinst]->ioport[i]); | ||
353 | } | ||
354 | sc_adapter[cinst]->ioport[IRQ_SELECT] = io[b] + 0x2; | ||
355 | request_region(sc_adapter[cinst]->ioport[IRQ_SELECT], 1, | ||
356 | interface->id); | ||
357 | pr_debug("Requesting I/O Port %#x\n", | ||
358 | sc_adapter[cinst]->ioport[IRQ_SELECT]); | ||
359 | sc_adapter[cinst]->rambase = ram[b]; | ||
360 | request_region(sc_adapter[cinst]->rambase, SRAM_PAGESIZE, | ||
361 | interface->id); | ||
362 | |||
363 | pr_info(" %s (%d) - %s %d channels IRQ %d, I/O Base 0x%x, RAM Base 0x%lx\n", | ||
364 | sc_adapter[cinst]->devicename, | ||
365 | sc_adapter[cinst]->driverId, | ||
366 | boardname[model], channels, irq[b], io[b], ram[b]); | ||
367 | |||
368 | /* | ||
369 | * reset the adapter to put things in motion | ||
370 | */ | ||
371 | reset(cinst); | ||
372 | |||
373 | cinst++; | ||
374 | status = 0; | ||
375 | } | ||
376 | if (status) | ||
377 | pr_info("Failed to find any adapters, driver unloaded\n"); | ||
378 | return status; | ||
379 | } | ||
380 | |||
381 | static void __exit sc_exit(void) | ||
382 | { | ||
383 | int i, j; | ||
384 | |||
385 | for (i = 0; i < cinst; i++) { | ||
386 | pr_debug("Cleaning up after adapter %d\n", i); | ||
387 | /* | ||
388 | * kill the timers | ||
389 | */ | ||
390 | del_timer_sync(&(sc_adapter[i]->reset_timer)); | ||
391 | del_timer_sync(&(sc_adapter[i]->stat_timer)); | ||
392 | |||
393 | /* | ||
394 | * Tell I4L we're toast | ||
395 | */ | ||
396 | indicate_status(i, ISDN_STAT_STOP, 0, NULL); | ||
397 | indicate_status(i, ISDN_STAT_UNLOAD, 0, NULL); | ||
398 | |||
399 | /* | ||
400 | * Release shared RAM | ||
401 | */ | ||
402 | release_region(sc_adapter[i]->rambase, SRAM_PAGESIZE); | ||
403 | |||
404 | /* | ||
405 | * Release the IRQ | ||
406 | */ | ||
407 | free_irq(sc_adapter[i]->interrupt, NULL); | ||
408 | |||
409 | /* | ||
410 | * Reset for a clean start | ||
411 | */ | ||
412 | outb(0xFF, sc_adapter[i]->ioport[SFT_RESET]); | ||
413 | |||
414 | /* | ||
415 | * Release the I/O Port regions | ||
416 | */ | ||
417 | for (j = 0; j < MAX_IO_REGS - 1; j++) { | ||
418 | release_region(sc_adapter[i]->ioport[j], 1); | ||
419 | pr_debug("Releasing I/O Port %#x\n", | ||
420 | sc_adapter[i]->ioport[j]); | ||
421 | } | ||
422 | release_region(sc_adapter[i]->ioport[IRQ_SELECT], 1); | ||
423 | pr_debug("Releasing I/O Port %#x\n", | ||
424 | sc_adapter[i]->ioport[IRQ_SELECT]); | ||
425 | |||
426 | /* | ||
427 | * Release any memory we alloced | ||
428 | */ | ||
429 | kfree(sc_adapter[i]->channel); | ||
430 | kfree(sc_adapter[i]->card); | ||
431 | kfree(sc_adapter[i]); | ||
432 | } | ||
433 | pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n"); | ||
434 | } | ||
435 | |||
436 | static int identify_board(unsigned long rambase, unsigned int iobase) | ||
437 | { | ||
438 | unsigned int pgport; | ||
439 | unsigned long sig; | ||
440 | DualPortMemory *dpm; | ||
441 | RspMessage rcvmsg; | ||
442 | ReqMessage sndmsg; | ||
443 | HWConfig_pl hwci; | ||
444 | int x; | ||
445 | |||
446 | pr_debug("Attempting to identify adapter @ 0x%lx io 0x%x\n", | ||
447 | rambase, iobase); | ||
448 | |||
449 | /* | ||
450 | * Enable the base pointer | ||
451 | */ | ||
452 | outb(rambase >> 12, iobase + 0x2c00); | ||
453 | |||
454 | switch (rambase >> 12 & 0x0F) { | ||
455 | case 0x0: | ||
456 | pgport = iobase + PG0_OFFSET; | ||
457 | pr_debug("Page Register offset is 0x%x\n", PG0_OFFSET); | ||
458 | break; | ||
459 | |||
460 | case 0x4: | ||
461 | pgport = iobase + PG1_OFFSET; | ||
462 | pr_debug("Page Register offset is 0x%x\n", PG1_OFFSET); | ||
463 | break; | ||
464 | |||
465 | case 0x8: | ||
466 | pgport = iobase + PG2_OFFSET; | ||
467 | pr_debug("Page Register offset is 0x%x\n", PG2_OFFSET); | ||
468 | break; | ||
469 | |||
470 | case 0xC: | ||
471 | pgport = iobase + PG3_OFFSET; | ||
472 | pr_debug("Page Register offset is 0x%x\n", PG3_OFFSET); | ||
473 | break; | ||
474 | default: | ||
475 | pr_debug("Invalid rambase 0x%lx\n", rambase); | ||
476 | return -1; | ||
477 | } | ||
478 | |||
479 | /* | ||
480 | * Try to identify a PRI card | ||
481 | */ | ||
482 | outb(PRI_BASEPG_VAL, pgport); | ||
483 | msleep_interruptible(1000); | ||
484 | sig = readl(rambase + SIG_OFFSET); | ||
485 | pr_debug("Looking for a signature, got 0x%lx\n", sig); | ||
486 | if (sig == SIGNATURE) | ||
487 | return PRI_BOARD; | ||
488 | |||
489 | /* | ||
490 | * Try to identify a PRI card | ||
491 | */ | ||
492 | outb(BRI_BASEPG_VAL, pgport); | ||
493 | msleep_interruptible(1000); | ||
494 | sig = readl(rambase + SIG_OFFSET); | ||
495 | pr_debug("Looking for a signature, got 0x%lx\n", sig); | ||
496 | if (sig == SIGNATURE) | ||
497 | return BRI_BOARD; | ||
498 | |||
499 | return -1; | ||
500 | |||
501 | /* | ||
502 | * Try to spot a card | ||
503 | */ | ||
504 | sig = readl(rambase + SIG_OFFSET); | ||
505 | pr_debug("Looking for a signature, got 0x%lx\n", sig); | ||
506 | if (sig != SIGNATURE) | ||
507 | return -1; | ||
508 | |||
509 | dpm = (DualPortMemory *) rambase; | ||
510 | |||
511 | memset(&sndmsg, 0, MSG_LEN); | ||
512 | sndmsg.msg_byte_cnt = 3; | ||
513 | sndmsg.type = cmReqType1; | ||
514 | sndmsg.class = cmReqClass0; | ||
515 | sndmsg.code = cmReqHWConfig; | ||
516 | memcpy_toio(&(dpm->req_queue[dpm->req_head++]), &sndmsg, MSG_LEN); | ||
517 | outb(0, iobase + 0x400); | ||
518 | pr_debug("Sent HWConfig message\n"); | ||
519 | /* | ||
520 | * Wait for the response | ||
521 | */ | ||
522 | x = 0; | ||
523 | while ((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) { | ||
524 | schedule_timeout_interruptible(1); | ||
525 | x++; | ||
526 | } | ||
527 | if (x == 100) { | ||
528 | pr_debug("Timeout waiting for response\n"); | ||
529 | return -1; | ||
530 | } | ||
531 | |||
532 | memcpy_fromio(&rcvmsg, &(dpm->rsp_queue[dpm->rsp_tail]), MSG_LEN); | ||
533 | pr_debug("Got HWConfig response, status = 0x%x\n", rcvmsg.rsp_status); | ||
534 | memcpy(&hwci, &(rcvmsg.msg_data.HWCresponse), sizeof(HWConfig_pl)); | ||
535 | pr_debug("Hardware Config: Interface: %s, RAM Size: %ld, Serial: %s\n" | ||
536 | " Part: %s, Rev: %s\n", | ||
537 | hwci.st_u_sense ? "S/T" : "U", hwci.ram_size, | ||
538 | hwci.serial_no, hwci.part_no, hwci.rev_no); | ||
539 | |||
540 | if (!strncmp(PRI_PARTNO, hwci.part_no, 6)) | ||
541 | return PRI_BOARD; | ||
542 | if (!strncmp(BRI_PARTNO, hwci.part_no, 6)) | ||
543 | return BRI_BOARD; | ||
544 | |||
545 | return -1; | ||
546 | } | ||
547 | |||
548 | module_init(sc_init); | ||
549 | module_exit(sc_exit); | ||
diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c deleted file mode 100644 index e80cc76bc314..000000000000 --- a/drivers/isdn/sc/interrupt.c +++ /dev/null | |||
@@ -1,247 +0,0 @@ | |||
1 | /* $Id: interrupt.c,v 1.4.8.3 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | * For more information, please contact gpl-info@spellcast.com or write: | ||
9 | * | ||
10 | * SpellCaster Telecommunications Inc. | ||
11 | * 5621 Finch Avenue East, Unit #3 | ||
12 | * Scarborough, Ontario Canada | ||
13 | * M1B 2T9 | ||
14 | * +1 (416) 297-8565 | ||
15 | * +1 (416) 297-6433 Facsimile | ||
16 | */ | ||
17 | |||
18 | #include "includes.h" | ||
19 | #include "hardware.h" | ||
20 | #include "message.h" | ||
21 | #include "card.h" | ||
22 | #include <linux/interrupt.h> | ||
23 | |||
24 | /* | ||
25 | * | ||
26 | */ | ||
27 | irqreturn_t interrupt_handler(int dummy, void *card_inst) | ||
28 | { | ||
29 | |||
30 | RspMessage rcvmsg; | ||
31 | int channel; | ||
32 | int card = (int)(unsigned long) card_inst; | ||
33 | |||
34 | if (!IS_VALID_CARD(card)) { | ||
35 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
36 | return IRQ_NONE; | ||
37 | } | ||
38 | |||
39 | pr_debug("%s: Entered Interrupt handler\n", | ||
40 | sc_adapter[card]->devicename); | ||
41 | |||
42 | /* | ||
43 | * Pull all of the waiting messages off the response queue | ||
44 | */ | ||
45 | while (!receivemessage(card, &rcvmsg)) { | ||
46 | /* | ||
47 | * Push the message to the adapter structure for | ||
48 | * send_and_receive to snoop | ||
49 | */ | ||
50 | if (sc_adapter[card]->want_async_messages) | ||
51 | memcpy(&(sc_adapter[card]->async_msg), | ||
52 | &rcvmsg, sizeof(RspMessage)); | ||
53 | |||
54 | channel = (unsigned int) rcvmsg.phy_link_no; | ||
55 | |||
56 | /* | ||
57 | * Trap Invalid request messages | ||
58 | */ | ||
59 | if (IS_CM_MESSAGE(rcvmsg, 0, 0, Invalid)) { | ||
60 | pr_debug("%s: Invalid request Message, rsp_status = %d\n", | ||
61 | sc_adapter[card]->devicename, | ||
62 | rcvmsg.rsp_status); | ||
63 | break; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Check for a linkRead message | ||
68 | */ | ||
69 | if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Read)) | ||
70 | { | ||
71 | pr_debug("%s: Received packet 0x%x bytes long at 0x%lx\n", | ||
72 | sc_adapter[card]->devicename, | ||
73 | rcvmsg.msg_data.response.msg_len, | ||
74 | rcvmsg.msg_data.response.buff_offset); | ||
75 | rcvpkt(card, &rcvmsg); | ||
76 | continue; | ||
77 | |||
78 | } | ||
79 | |||
80 | /* | ||
81 | * Handle a write acknoledgement | ||
82 | */ | ||
83 | if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Write)) { | ||
84 | pr_debug("%s: Packet Send ACK on channel %d\n", | ||
85 | sc_adapter[card]->devicename, | ||
86 | rcvmsg.phy_link_no); | ||
87 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].free_sendbufs++; | ||
88 | continue; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Handle a connection message | ||
93 | */ | ||
94 | if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Connect)) | ||
95 | { | ||
96 | unsigned int callid; | ||
97 | setup_parm setup; | ||
98 | pr_debug("%s: Connect message: line %d: status %d: cause 0x%x\n", | ||
99 | sc_adapter[card]->devicename, | ||
100 | rcvmsg.phy_link_no, | ||
101 | rcvmsg.rsp_status, | ||
102 | rcvmsg.msg_data.byte_array[2]); | ||
103 | |||
104 | memcpy(&callid, rcvmsg.msg_data.byte_array, sizeof(int)); | ||
105 | if (callid >= 0x8000 && callid <= 0xFFFF) | ||
106 | { | ||
107 | pr_debug("%s: Got Dial-Out Rsp\n", | ||
108 | sc_adapter[card]->devicename); | ||
109 | indicate_status(card, ISDN_STAT_DCONN, | ||
110 | (unsigned long)rcvmsg.phy_link_no - 1, NULL); | ||
111 | |||
112 | } | ||
113 | else if (callid >= 0x0000 && callid <= 0x7FFF) | ||
114 | { | ||
115 | int len; | ||
116 | |||
117 | pr_debug("%s: Got Incoming Call\n", | ||
118 | sc_adapter[card]->devicename); | ||
119 | len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]), | ||
120 | sizeof(setup.phone)); | ||
121 | if (len >= sizeof(setup.phone)) | ||
122 | continue; | ||
123 | len = strlcpy(setup.eazmsn, | ||
124 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, | ||
125 | sizeof(setup.eazmsn)); | ||
126 | if (len >= sizeof(setup.eazmsn)) | ||
127 | continue; | ||
128 | setup.si1 = 7; | ||
129 | setup.si2 = 0; | ||
130 | setup.plan = 0; | ||
131 | setup.screen = 0; | ||
132 | |||
133 | indicate_status(card, ISDN_STAT_ICALL, (unsigned long)rcvmsg.phy_link_no - 1, (char *)&setup); | ||
134 | indicate_status(card, ISDN_STAT_DCONN, (unsigned long)rcvmsg.phy_link_no - 1, NULL); | ||
135 | } | ||
136 | continue; | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Handle a disconnection message | ||
141 | */ | ||
142 | if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Disconnect)) | ||
143 | { | ||
144 | pr_debug("%s: disconnect message: line %d: status %d: cause 0x%x\n", | ||
145 | sc_adapter[card]->devicename, | ||
146 | rcvmsg.phy_link_no, | ||
147 | rcvmsg.rsp_status, | ||
148 | rcvmsg.msg_data.byte_array[2]); | ||
149 | |||
150 | indicate_status(card, ISDN_STAT_BHUP, (unsigned long)rcvmsg.phy_link_no - 1, NULL); | ||
151 | indicate_status(card, ISDN_STAT_DHUP, (unsigned long)rcvmsg.phy_link_no - 1, NULL); | ||
152 | continue; | ||
153 | |||
154 | } | ||
155 | |||
156 | /* | ||
157 | * Handle a startProc engine up message | ||
158 | */ | ||
159 | if (IS_CM_MESSAGE(rcvmsg, 5, 0, MiscEngineUp)) { | ||
160 | pr_debug("%s: Received EngineUp message\n", | ||
161 | sc_adapter[card]->devicename); | ||
162 | sc_adapter[card]->EngineUp = 1; | ||
163 | sendmessage(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, 1, 0, NULL); | ||
164 | sendmessage(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, 2, 0, NULL); | ||
165 | init_timer(&sc_adapter[card]->stat_timer); | ||
166 | sc_adapter[card]->stat_timer.function = check_phystat; | ||
167 | sc_adapter[card]->stat_timer.data = card; | ||
168 | sc_adapter[card]->stat_timer.expires = jiffies + CHECKSTAT_TIME; | ||
169 | add_timer(&sc_adapter[card]->stat_timer); | ||
170 | continue; | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * Start proc response | ||
175 | */ | ||
176 | if (IS_CM_MESSAGE(rcvmsg, 2, 0, StartProc)) { | ||
177 | pr_debug("%s: StartProc Response Status %d\n", | ||
178 | sc_adapter[card]->devicename, | ||
179 | rcvmsg.rsp_status); | ||
180 | continue; | ||
181 | } | ||
182 | |||
183 | /* | ||
184 | * Handle a GetMyNumber Rsp | ||
185 | */ | ||
186 | if (IS_CE_MESSAGE(rcvmsg, Call, 0, GetMyNumber)) { | ||
187 | strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, | ||
188 | rcvmsg.msg_data.byte_array, | ||
189 | sizeof(rcvmsg.msg_data.byte_array)); | ||
190 | continue; | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * PhyStatus response | ||
195 | */ | ||
196 | if (IS_CE_MESSAGE(rcvmsg, Phy, 2, Status)) { | ||
197 | unsigned int b1stat, b2stat; | ||
198 | |||
199 | /* | ||
200 | * Covert the message data to the adapter->phystat code | ||
201 | */ | ||
202 | b1stat = (unsigned int) rcvmsg.msg_data.byte_array[0]; | ||
203 | b2stat = (unsigned int) rcvmsg.msg_data.byte_array[1]; | ||
204 | |||
205 | sc_adapter[card]->nphystat = (b2stat >> 8) | b1stat; /* endian?? */ | ||
206 | pr_debug("%s: PhyStat is 0x%2x\n", | ||
207 | sc_adapter[card]->devicename, | ||
208 | sc_adapter[card]->nphystat); | ||
209 | continue; | ||
210 | } | ||
211 | |||
212 | |||
213 | /* | ||
214 | * Handle a GetFramFormat | ||
215 | */ | ||
216 | if (IS_CE_MESSAGE(rcvmsg, Call, 0, GetFrameFormat)) { | ||
217 | if (rcvmsg.msg_data.byte_array[0] != HDLC_PROTO) { | ||
218 | unsigned int proto = HDLC_PROTO; | ||
219 | /* | ||
220 | * Set board format to HDLC if it wasn't already | ||
221 | */ | ||
222 | pr_debug("%s: current frame format: 0x%x, will change to HDLC\n", | ||
223 | sc_adapter[card]->devicename, | ||
224 | rcvmsg.msg_data.byte_array[0]); | ||
225 | sendmessage(card, CEPID, ceReqTypeCall, | ||
226 | ceReqClass0, | ||
227 | ceReqCallSetFrameFormat, | ||
228 | (unsigned char)channel + 1, | ||
229 | 1, &proto); | ||
230 | } | ||
231 | continue; | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * Hmm... | ||
236 | */ | ||
237 | pr_debug("%s: Received unhandled message (%d,%d,%d) link %d\n", | ||
238 | sc_adapter[card]->devicename, | ||
239 | rcvmsg.type, rcvmsg.class, rcvmsg.code, | ||
240 | rcvmsg.phy_link_no); | ||
241 | |||
242 | } /* while */ | ||
243 | |||
244 | pr_debug("%s: Exiting Interrupt Handler\n", | ||
245 | sc_adapter[card]->devicename); | ||
246 | return IRQ_HANDLED; | ||
247 | } | ||
diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c deleted file mode 100644 index e63983aa1d27..000000000000 --- a/drivers/isdn/sc/ioctl.c +++ /dev/null | |||
@@ -1,582 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
3 | * | ||
4 | * This software may be used and distributed according to the terms | ||
5 | * of the GNU General Public License, incorporated herein by reference. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include "includes.h" | ||
10 | #include "hardware.h" | ||
11 | #include "message.h" | ||
12 | #include "card.h" | ||
13 | #include "scioc.h" | ||
14 | |||
15 | static int GetStatus(int card, boardInfo *); | ||
16 | |||
17 | /* | ||
18 | * Process private IOCTL messages (typically from scctrl) | ||
19 | */ | ||
20 | int sc_ioctl(int card, scs_ioctl *data) | ||
21 | { | ||
22 | int status; | ||
23 | RspMessage *rcvmsg; | ||
24 | char *spid; | ||
25 | char *dn; | ||
26 | char switchtype; | ||
27 | char speed; | ||
28 | |||
29 | rcvmsg = kmalloc(sizeof(RspMessage), GFP_KERNEL); | ||
30 | if (!rcvmsg) | ||
31 | return -ENOMEM; | ||
32 | |||
33 | switch (data->command) { | ||
34 | case SCIOCRESET: /* Perform a hard reset of the adapter */ | ||
35 | { | ||
36 | pr_debug("%s: SCIOCRESET: ioctl received\n", | ||
37 | sc_adapter[card]->devicename); | ||
38 | sc_adapter[card]->StartOnReset = 0; | ||
39 | kfree(rcvmsg); | ||
40 | return reset(card); | ||
41 | } | ||
42 | |||
43 | case SCIOCLOAD: | ||
44 | { | ||
45 | char *srec; | ||
46 | |||
47 | srec = kmalloc(SCIOC_SRECSIZE, GFP_KERNEL); | ||
48 | if (!srec) { | ||
49 | kfree(rcvmsg); | ||
50 | return -ENOMEM; | ||
51 | } | ||
52 | pr_debug("%s: SCIOLOAD: ioctl received\n", | ||
53 | sc_adapter[card]->devicename); | ||
54 | if (sc_adapter[card]->EngineUp) { | ||
55 | pr_debug("%s: SCIOCLOAD: command failed, LoadProc while engine running.\n", | ||
56 | sc_adapter[card]->devicename); | ||
57 | kfree(rcvmsg); | ||
58 | kfree(srec); | ||
59 | return -1; | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Get the SRec from user space | ||
64 | */ | ||
65 | if (copy_from_user(srec, data->dataptr, SCIOC_SRECSIZE)) { | ||
66 | kfree(rcvmsg); | ||
67 | kfree(srec); | ||
68 | return -EFAULT; | ||
69 | } | ||
70 | |||
71 | status = send_and_receive(card, CMPID, cmReqType2, cmReqClass0, cmReqLoadProc, | ||
72 | 0, SCIOC_SRECSIZE, srec, rcvmsg, SAR_TIMEOUT); | ||
73 | kfree(rcvmsg); | ||
74 | kfree(srec); | ||
75 | |||
76 | if (status) { | ||
77 | pr_debug("%s: SCIOCLOAD: command failed, status = %d\n", | ||
78 | sc_adapter[card]->devicename, status); | ||
79 | return -1; | ||
80 | } | ||
81 | else { | ||
82 | pr_debug("%s: SCIOCLOAD: command successful\n", | ||
83 | sc_adapter[card]->devicename); | ||
84 | return 0; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | case SCIOCSTART: | ||
89 | { | ||
90 | kfree(rcvmsg); | ||
91 | pr_debug("%s: SCIOSTART: ioctl received\n", | ||
92 | sc_adapter[card]->devicename); | ||
93 | if (sc_adapter[card]->EngineUp) { | ||
94 | pr_debug("%s: SCIOCSTART: command failed, engine already running.\n", | ||
95 | sc_adapter[card]->devicename); | ||
96 | return -1; | ||
97 | } | ||
98 | |||
99 | sc_adapter[card]->StartOnReset = 1; | ||
100 | startproc(card); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | case SCIOCSETSWITCH: | ||
105 | { | ||
106 | pr_debug("%s: SCIOSETSWITCH: ioctl received\n", | ||
107 | sc_adapter[card]->devicename); | ||
108 | |||
109 | /* | ||
110 | * Get the switch type from user space | ||
111 | */ | ||
112 | if (copy_from_user(&switchtype, data->dataptr, sizeof(char))) { | ||
113 | kfree(rcvmsg); | ||
114 | return -EFAULT; | ||
115 | } | ||
116 | |||
117 | pr_debug("%s: SCIOCSETSWITCH: setting switch type to %d\n", | ||
118 | sc_adapter[card]->devicename, | ||
119 | switchtype); | ||
120 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallSetSwitchType, | ||
121 | 0, sizeof(char), &switchtype, rcvmsg, SAR_TIMEOUT); | ||
122 | if (!status && !(rcvmsg->rsp_status)) { | ||
123 | pr_debug("%s: SCIOCSETSWITCH: command successful\n", | ||
124 | sc_adapter[card]->devicename); | ||
125 | kfree(rcvmsg); | ||
126 | return 0; | ||
127 | } | ||
128 | else { | ||
129 | pr_debug("%s: SCIOCSETSWITCH: command failed (status = %d)\n", | ||
130 | sc_adapter[card]->devicename, status); | ||
131 | kfree(rcvmsg); | ||
132 | return status; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | case SCIOCGETSWITCH: | ||
137 | { | ||
138 | pr_debug("%s: SCIOGETSWITCH: ioctl received\n", | ||
139 | sc_adapter[card]->devicename); | ||
140 | |||
141 | /* | ||
142 | * Get the switch type from the board | ||
143 | */ | ||
144 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | ||
145 | ceReqCallGetSwitchType, 0, 0, NULL, rcvmsg, SAR_TIMEOUT); | ||
146 | if (!status && !(rcvmsg->rsp_status)) { | ||
147 | pr_debug("%s: SCIOCGETSWITCH: command successful\n", | ||
148 | sc_adapter[card]->devicename); | ||
149 | } | ||
150 | else { | ||
151 | pr_debug("%s: SCIOCGETSWITCH: command failed (status = %d)\n", | ||
152 | sc_adapter[card]->devicename, status); | ||
153 | kfree(rcvmsg); | ||
154 | return status; | ||
155 | } | ||
156 | |||
157 | switchtype = rcvmsg->msg_data.byte_array[0]; | ||
158 | |||
159 | /* | ||
160 | * Package the switch type and send to user space | ||
161 | */ | ||
162 | if (copy_to_user(data->dataptr, &switchtype, | ||
163 | sizeof(char))) { | ||
164 | kfree(rcvmsg); | ||
165 | return -EFAULT; | ||
166 | } | ||
167 | |||
168 | kfree(rcvmsg); | ||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | case SCIOCGETSPID: | ||
173 | { | ||
174 | pr_debug("%s: SCIOGETSPID: ioctl received\n", | ||
175 | sc_adapter[card]->devicename); | ||
176 | |||
177 | spid = kzalloc(SCIOC_SPIDSIZE, GFP_KERNEL); | ||
178 | if (!spid) { | ||
179 | kfree(rcvmsg); | ||
180 | return -ENOMEM; | ||
181 | } | ||
182 | /* | ||
183 | * Get the spid from the board | ||
184 | */ | ||
185 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetSPID, | ||
186 | data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); | ||
187 | if (!status) { | ||
188 | pr_debug("%s: SCIOCGETSPID: command successful\n", | ||
189 | sc_adapter[card]->devicename); | ||
190 | } else { | ||
191 | pr_debug("%s: SCIOCGETSPID: command failed (status = %d)\n", | ||
192 | sc_adapter[card]->devicename, status); | ||
193 | kfree(spid); | ||
194 | kfree(rcvmsg); | ||
195 | return status; | ||
196 | } | ||
197 | strlcpy(spid, rcvmsg->msg_data.byte_array, SCIOC_SPIDSIZE); | ||
198 | |||
199 | /* | ||
200 | * Package the switch type and send to user space | ||
201 | */ | ||
202 | if (copy_to_user(data->dataptr, spid, SCIOC_SPIDSIZE)) { | ||
203 | kfree(spid); | ||
204 | kfree(rcvmsg); | ||
205 | return -EFAULT; | ||
206 | } | ||
207 | |||
208 | kfree(spid); | ||
209 | kfree(rcvmsg); | ||
210 | return 0; | ||
211 | } | ||
212 | |||
213 | case SCIOCSETSPID: | ||
214 | { | ||
215 | pr_debug("%s: DCBIOSETSPID: ioctl received\n", | ||
216 | sc_adapter[card]->devicename); | ||
217 | |||
218 | /* | ||
219 | * Get the spid from user space | ||
220 | */ | ||
221 | spid = memdup_user(data->dataptr, SCIOC_SPIDSIZE); | ||
222 | if (IS_ERR(spid)) { | ||
223 | kfree(rcvmsg); | ||
224 | return PTR_ERR(spid); | ||
225 | } | ||
226 | |||
227 | pr_debug("%s: SCIOCSETSPID: setting channel %d spid to %s\n", | ||
228 | sc_adapter[card]->devicename, data->channel, spid); | ||
229 | status = send_and_receive(card, CEPID, ceReqTypeCall, | ||
230 | ceReqClass0, ceReqCallSetSPID, data->channel, | ||
231 | strlen(spid), spid, rcvmsg, SAR_TIMEOUT); | ||
232 | if (!status && !(rcvmsg->rsp_status)) { | ||
233 | pr_debug("%s: SCIOCSETSPID: command successful\n", | ||
234 | sc_adapter[card]->devicename); | ||
235 | kfree(rcvmsg); | ||
236 | kfree(spid); | ||
237 | return 0; | ||
238 | } | ||
239 | else { | ||
240 | pr_debug("%s: SCIOCSETSPID: command failed (status = %d)\n", | ||
241 | sc_adapter[card]->devicename, status); | ||
242 | kfree(rcvmsg); | ||
243 | kfree(spid); | ||
244 | return status; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | case SCIOCGETDN: | ||
249 | { | ||
250 | pr_debug("%s: SCIOGETDN: ioctl received\n", | ||
251 | sc_adapter[card]->devicename); | ||
252 | |||
253 | /* | ||
254 | * Get the dn from the board | ||
255 | */ | ||
256 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, | ||
257 | data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); | ||
258 | if (!status) { | ||
259 | pr_debug("%s: SCIOCGETDN: command successful\n", | ||
260 | sc_adapter[card]->devicename); | ||
261 | } | ||
262 | else { | ||
263 | pr_debug("%s: SCIOCGETDN: command failed (status = %d)\n", | ||
264 | sc_adapter[card]->devicename, status); | ||
265 | kfree(rcvmsg); | ||
266 | return status; | ||
267 | } | ||
268 | |||
269 | dn = kzalloc(SCIOC_DNSIZE, GFP_KERNEL); | ||
270 | if (!dn) { | ||
271 | kfree(rcvmsg); | ||
272 | return -ENOMEM; | ||
273 | } | ||
274 | strlcpy(dn, rcvmsg->msg_data.byte_array, SCIOC_DNSIZE); | ||
275 | kfree(rcvmsg); | ||
276 | |||
277 | /* | ||
278 | * Package the dn and send to user space | ||
279 | */ | ||
280 | if (copy_to_user(data->dataptr, dn, SCIOC_DNSIZE)) { | ||
281 | kfree(dn); | ||
282 | return -EFAULT; | ||
283 | } | ||
284 | kfree(dn); | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | case SCIOCSETDN: | ||
289 | { | ||
290 | pr_debug("%s: SCIOSETDN: ioctl received\n", | ||
291 | sc_adapter[card]->devicename); | ||
292 | |||
293 | /* | ||
294 | * Get the spid from user space | ||
295 | */ | ||
296 | dn = memdup_user(data->dataptr, SCIOC_DNSIZE); | ||
297 | if (IS_ERR(dn)) { | ||
298 | kfree(rcvmsg); | ||
299 | return PTR_ERR(dn); | ||
300 | } | ||
301 | |||
302 | pr_debug("%s: SCIOCSETDN: setting channel %d dn to %s\n", | ||
303 | sc_adapter[card]->devicename, data->channel, dn); | ||
304 | status = send_and_receive(card, CEPID, ceReqTypeCall, | ||
305 | ceReqClass0, ceReqCallSetMyNumber, data->channel, | ||
306 | strlen(dn), dn, rcvmsg, SAR_TIMEOUT); | ||
307 | if (!status && !(rcvmsg->rsp_status)) { | ||
308 | pr_debug("%s: SCIOCSETDN: command successful\n", | ||
309 | sc_adapter[card]->devicename); | ||
310 | kfree(rcvmsg); | ||
311 | kfree(dn); | ||
312 | return 0; | ||
313 | } | ||
314 | else { | ||
315 | pr_debug("%s: SCIOCSETDN: command failed (status = %d)\n", | ||
316 | sc_adapter[card]->devicename, status); | ||
317 | kfree(rcvmsg); | ||
318 | kfree(dn); | ||
319 | return status; | ||
320 | } | ||
321 | } | ||
322 | |||
323 | case SCIOCTRACE: | ||
324 | |||
325 | pr_debug("%s: SCIOTRACE: ioctl received\n", | ||
326 | sc_adapter[card]->devicename); | ||
327 | /* sc_adapter[card]->trace = !sc_adapter[card]->trace; | ||
328 | pr_debug("%s: SCIOCTRACE: tracing turned %s\n", | ||
329 | sc_adapter[card]->devicename, | ||
330 | sc_adapter[card]->trace ? "ON" : "OFF"); */ | ||
331 | break; | ||
332 | |||
333 | case SCIOCSTAT: | ||
334 | { | ||
335 | boardInfo *bi; | ||
336 | |||
337 | pr_debug("%s: SCIOSTAT: ioctl received\n", | ||
338 | sc_adapter[card]->devicename); | ||
339 | |||
340 | bi = kzalloc(sizeof(boardInfo), GFP_KERNEL); | ||
341 | if (!bi) { | ||
342 | kfree(rcvmsg); | ||
343 | return -ENOMEM; | ||
344 | } | ||
345 | |||
346 | kfree(rcvmsg); | ||
347 | GetStatus(card, bi); | ||
348 | |||
349 | if (copy_to_user(data->dataptr, bi, sizeof(boardInfo))) { | ||
350 | kfree(bi); | ||
351 | return -EFAULT; | ||
352 | } | ||
353 | |||
354 | kfree(bi); | ||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | case SCIOCGETSPEED: | ||
359 | { | ||
360 | pr_debug("%s: SCIOGETSPEED: ioctl received\n", | ||
361 | sc_adapter[card]->devicename); | ||
362 | |||
363 | /* | ||
364 | * Get the speed from the board | ||
365 | */ | ||
366 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | ||
367 | ceReqCallGetCallType, data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); | ||
368 | if (!status && !(rcvmsg->rsp_status)) { | ||
369 | pr_debug("%s: SCIOCGETSPEED: command successful\n", | ||
370 | sc_adapter[card]->devicename); | ||
371 | } | ||
372 | else { | ||
373 | pr_debug("%s: SCIOCGETSPEED: command failed (status = %d)\n", | ||
374 | sc_adapter[card]->devicename, status); | ||
375 | kfree(rcvmsg); | ||
376 | return status; | ||
377 | } | ||
378 | |||
379 | speed = rcvmsg->msg_data.byte_array[0]; | ||
380 | |||
381 | kfree(rcvmsg); | ||
382 | |||
383 | /* | ||
384 | * Package the switch type and send to user space | ||
385 | */ | ||
386 | |||
387 | if (copy_to_user(data->dataptr, &speed, sizeof(char))) | ||
388 | return -EFAULT; | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | case SCIOCSETSPEED: | ||
394 | pr_debug("%s: SCIOCSETSPEED: ioctl received\n", | ||
395 | sc_adapter[card]->devicename); | ||
396 | break; | ||
397 | |||
398 | case SCIOCLOOPTST: | ||
399 | pr_debug("%s: SCIOCLOOPTST: ioctl received\n", | ||
400 | sc_adapter[card]->devicename); | ||
401 | break; | ||
402 | |||
403 | default: | ||
404 | kfree(rcvmsg); | ||
405 | return -1; | ||
406 | } | ||
407 | |||
408 | kfree(rcvmsg); | ||
409 | return 0; | ||
410 | } | ||
411 | |||
412 | static int GetStatus(int card, boardInfo *bi) | ||
413 | { | ||
414 | RspMessage rcvmsg; | ||
415 | int i, status; | ||
416 | |||
417 | /* | ||
418 | * Fill in some of the basic info about the board | ||
419 | */ | ||
420 | bi->modelid = sc_adapter[card]->model; | ||
421 | strcpy(bi->serial_no, sc_adapter[card]->hwconfig.serial_no); | ||
422 | strcpy(bi->part_no, sc_adapter[card]->hwconfig.part_no); | ||
423 | bi->iobase = sc_adapter[card]->iobase; | ||
424 | bi->rambase = sc_adapter[card]->rambase; | ||
425 | bi->irq = sc_adapter[card]->interrupt; | ||
426 | bi->ramsize = sc_adapter[card]->hwconfig.ram_size; | ||
427 | bi->interface = sc_adapter[card]->hwconfig.st_u_sense; | ||
428 | strcpy(bi->load_ver, sc_adapter[card]->load_ver); | ||
429 | strcpy(bi->proc_ver, sc_adapter[card]->proc_ver); | ||
430 | |||
431 | /* | ||
432 | * Get the current PhyStats and LnkStats | ||
433 | */ | ||
434 | status = send_and_receive(card, CEPID, ceReqTypePhy, ceReqClass2, | ||
435 | ceReqPhyStatus, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
436 | if (!status) { | ||
437 | if (sc_adapter[card]->model < PRI_BOARD) { | ||
438 | bi->l1_status = rcvmsg.msg_data.byte_array[2]; | ||
439 | for (i = 0; i < BRI_CHANNELS; i++) | ||
440 | bi->status.bristats[i].phy_stat = | ||
441 | rcvmsg.msg_data.byte_array[i]; | ||
442 | } | ||
443 | else { | ||
444 | bi->l1_status = rcvmsg.msg_data.byte_array[0]; | ||
445 | bi->l2_status = rcvmsg.msg_data.byte_array[1]; | ||
446 | for (i = 0; i < PRI_CHANNELS; i++) | ||
447 | bi->status.pristats[i].phy_stat = | ||
448 | rcvmsg.msg_data.byte_array[i + 2]; | ||
449 | } | ||
450 | } | ||
451 | |||
452 | /* | ||
453 | * Get the call types for each channel | ||
454 | */ | ||
455 | for (i = 0; i < sc_adapter[card]->nChannels; i++) { | ||
456 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | ||
457 | ceReqCallGetCallType, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
458 | if (!status) { | ||
459 | if (sc_adapter[card]->model == PRI_BOARD) { | ||
460 | bi->status.pristats[i].call_type = | ||
461 | rcvmsg.msg_data.byte_array[0]; | ||
462 | } | ||
463 | else { | ||
464 | bi->status.bristats[i].call_type = | ||
465 | rcvmsg.msg_data.byte_array[0]; | ||
466 | } | ||
467 | } | ||
468 | } | ||
469 | |||
470 | /* | ||
471 | * If PRI, get the call states and service states for each channel | ||
472 | */ | ||
473 | if (sc_adapter[card]->model == PRI_BOARD) { | ||
474 | /* | ||
475 | * Get the call states | ||
476 | */ | ||
477 | status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2, | ||
478 | ceReqPhyChCallState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
479 | if (!status) { | ||
480 | for (i = 0; i < PRI_CHANNELS; i++) | ||
481 | bi->status.pristats[i].call_state = | ||
482 | rcvmsg.msg_data.byte_array[i]; | ||
483 | } | ||
484 | |||
485 | /* | ||
486 | * Get the service states | ||
487 | */ | ||
488 | status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2, | ||
489 | ceReqPhyChServState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
490 | if (!status) { | ||
491 | for (i = 0; i < PRI_CHANNELS; i++) | ||
492 | bi->status.pristats[i].serv_state = | ||
493 | rcvmsg.msg_data.byte_array[i]; | ||
494 | } | ||
495 | |||
496 | /* | ||
497 | * Get the link stats for the channels | ||
498 | */ | ||
499 | for (i = 1; i <= PRI_CHANNELS; i++) { | ||
500 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, | ||
501 | ceReqLnkGetStats, i, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
502 | if (!status) { | ||
503 | bi->status.pristats[i - 1].link_stats.tx_good = | ||
504 | (unsigned long)rcvmsg.msg_data.byte_array[0]; | ||
505 | bi->status.pristats[i - 1].link_stats.tx_bad = | ||
506 | (unsigned long)rcvmsg.msg_data.byte_array[4]; | ||
507 | bi->status.pristats[i - 1].link_stats.rx_good = | ||
508 | (unsigned long)rcvmsg.msg_data.byte_array[8]; | ||
509 | bi->status.pristats[i - 1].link_stats.rx_bad = | ||
510 | (unsigned long)rcvmsg.msg_data.byte_array[12]; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | /* | ||
515 | * Link stats for the D channel | ||
516 | */ | ||
517 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, | ||
518 | ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
519 | if (!status) { | ||
520 | bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0]; | ||
521 | bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4]; | ||
522 | bi->dch_stats.rx_good = (unsigned long)rcvmsg.msg_data.byte_array[8]; | ||
523 | bi->dch_stats.rx_bad = (unsigned long)rcvmsg.msg_data.byte_array[12]; | ||
524 | } | ||
525 | |||
526 | return 0; | ||
527 | } | ||
528 | |||
529 | /* | ||
530 | * If BRI or POTS, Get SPID, DN and call types for each channel | ||
531 | */ | ||
532 | |||
533 | /* | ||
534 | * Get the link stats for the channels | ||
535 | */ | ||
536 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, | ||
537 | ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
538 | if (!status) { | ||
539 | bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0]; | ||
540 | bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4]; | ||
541 | bi->dch_stats.rx_good = (unsigned long)rcvmsg.msg_data.byte_array[8]; | ||
542 | bi->dch_stats.rx_bad = (unsigned long)rcvmsg.msg_data.byte_array[12]; | ||
543 | bi->status.bristats[0].link_stats.tx_good = | ||
544 | (unsigned long)rcvmsg.msg_data.byte_array[16]; | ||
545 | bi->status.bristats[0].link_stats.tx_bad = | ||
546 | (unsigned long)rcvmsg.msg_data.byte_array[20]; | ||
547 | bi->status.bristats[0].link_stats.rx_good = | ||
548 | (unsigned long)rcvmsg.msg_data.byte_array[24]; | ||
549 | bi->status.bristats[0].link_stats.rx_bad = | ||
550 | (unsigned long)rcvmsg.msg_data.byte_array[28]; | ||
551 | bi->status.bristats[1].link_stats.tx_good = | ||
552 | (unsigned long)rcvmsg.msg_data.byte_array[32]; | ||
553 | bi->status.bristats[1].link_stats.tx_bad = | ||
554 | (unsigned long)rcvmsg.msg_data.byte_array[36]; | ||
555 | bi->status.bristats[1].link_stats.rx_good = | ||
556 | (unsigned long)rcvmsg.msg_data.byte_array[40]; | ||
557 | bi->status.bristats[1].link_stats.rx_bad = | ||
558 | (unsigned long)rcvmsg.msg_data.byte_array[44]; | ||
559 | } | ||
560 | |||
561 | /* | ||
562 | * Get the SPIDs | ||
563 | */ | ||
564 | for (i = 0; i < BRI_CHANNELS; i++) { | ||
565 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | ||
566 | ceReqCallGetSPID, i + 1, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
567 | if (!status) | ||
568 | strcpy(bi->status.bristats[i].spid, rcvmsg.msg_data.byte_array); | ||
569 | } | ||
570 | |||
571 | /* | ||
572 | * Get the DNs | ||
573 | */ | ||
574 | for (i = 0; i < BRI_CHANNELS; i++) { | ||
575 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | ||
576 | ceReqCallGetMyNumber, i + 1, 0, NULL, &rcvmsg, SAR_TIMEOUT); | ||
577 | if (!status) | ||
578 | strcpy(bi->status.bristats[i].dn, rcvmsg.msg_data.byte_array); | ||
579 | } | ||
580 | |||
581 | return 0; | ||
582 | } | ||
diff --git a/drivers/isdn/sc/message.c b/drivers/isdn/sc/message.c deleted file mode 100644 index 9679a1902b32..000000000000 --- a/drivers/isdn/sc/message.c +++ /dev/null | |||
@@ -1,230 +0,0 @@ | |||
1 | /* $Id: message.c,v 1.5.8.2 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * functions for sending and receiving control messages | ||
4 | * | ||
5 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | * For more information, please contact gpl-info@spellcast.com or write: | ||
11 | * | ||
12 | * SpellCaster Telecommunications Inc. | ||
13 | * 5621 Finch Avenue East, Unit #3 | ||
14 | * Scarborough, Ontario Canada | ||
15 | * M1B 2T9 | ||
16 | * +1 (416) 297-8565 | ||
17 | * +1 (416) 297-6433 Facsimile | ||
18 | */ | ||
19 | #include <linux/sched.h> | ||
20 | #include "includes.h" | ||
21 | #include "hardware.h" | ||
22 | #include "message.h" | ||
23 | #include "card.h" | ||
24 | |||
25 | /* | ||
26 | * receive a message from the board | ||
27 | */ | ||
28 | int receivemessage(int card, RspMessage *rspmsg) | ||
29 | { | ||
30 | DualPortMemory *dpm; | ||
31 | unsigned long flags; | ||
32 | |||
33 | if (!IS_VALID_CARD(card)) { | ||
34 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
35 | return -EINVAL; | ||
36 | } | ||
37 | |||
38 | pr_debug("%s: Entered receivemessage\n", | ||
39 | sc_adapter[card]->devicename); | ||
40 | |||
41 | /* | ||
42 | * See if there are messages waiting | ||
43 | */ | ||
44 | if (inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) { | ||
45 | /* | ||
46 | * Map in the DPM to the base page and copy the message | ||
47 | */ | ||
48 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
49 | outb((sc_adapter[card]->shmem_magic >> 14) | 0x80, | ||
50 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | ||
51 | dpm = (DualPortMemory *) sc_adapter[card]->rambase; | ||
52 | memcpy_fromio(rspmsg, &(dpm->rsp_queue[dpm->rsp_tail]), | ||
53 | MSG_LEN); | ||
54 | dpm->rsp_tail = (dpm->rsp_tail + 1) % MAX_MESSAGES; | ||
55 | inb(sc_adapter[card]->ioport[FIFO_READ]); | ||
56 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
57 | /* | ||
58 | * Tell the board that the message is received | ||
59 | */ | ||
60 | pr_debug("%s: Received Message seq:%d pid:%d time:%d cmd:%d " | ||
61 | "cnt:%d (type,class,code):(%d,%d,%d) " | ||
62 | "link:%d stat:0x%x\n", | ||
63 | sc_adapter[card]->devicename, | ||
64 | rspmsg->sequence_no, | ||
65 | rspmsg->process_id, | ||
66 | rspmsg->time_stamp, | ||
67 | rspmsg->cmd_sequence_no, | ||
68 | rspmsg->msg_byte_cnt, | ||
69 | rspmsg->type, | ||
70 | rspmsg->class, | ||
71 | rspmsg->code, | ||
72 | rspmsg->phy_link_no, | ||
73 | rspmsg->rsp_status); | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | return -ENOMSG; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * send a message to the board | ||
82 | */ | ||
83 | int sendmessage(int card, | ||
84 | unsigned int procid, | ||
85 | unsigned int type, | ||
86 | unsigned int class, | ||
87 | unsigned int code, | ||
88 | unsigned int link, | ||
89 | unsigned int data_len, | ||
90 | unsigned int *data) | ||
91 | { | ||
92 | DualPortMemory *dpm; | ||
93 | ReqMessage sndmsg; | ||
94 | unsigned long flags; | ||
95 | |||
96 | if (!IS_VALID_CARD(card)) { | ||
97 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
98 | return -EINVAL; | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * Make sure we only send CEPID messages when the engine is up | ||
103 | * and CMPID messages when it is down | ||
104 | */ | ||
105 | if (sc_adapter[card]->EngineUp && procid == CMPID) { | ||
106 | pr_debug("%s: Attempt to send CM message with engine up\n", | ||
107 | sc_adapter[card]->devicename); | ||
108 | return -ESRCH; | ||
109 | } | ||
110 | |||
111 | if (!sc_adapter[card]->EngineUp && procid == CEPID) { | ||
112 | pr_debug("%s: Attempt to send CE message with engine down\n", | ||
113 | sc_adapter[card]->devicename); | ||
114 | return -ESRCH; | ||
115 | } | ||
116 | |||
117 | memset(&sndmsg, 0, MSG_LEN); | ||
118 | sndmsg.msg_byte_cnt = 4; | ||
119 | sndmsg.type = type; | ||
120 | sndmsg.class = class; | ||
121 | sndmsg.code = code; | ||
122 | sndmsg.phy_link_no = link; | ||
123 | |||
124 | if (data_len > 0) { | ||
125 | if (data_len > MSG_DATA_LEN) | ||
126 | data_len = MSG_DATA_LEN; | ||
127 | memcpy(&(sndmsg.msg_data), data, data_len); | ||
128 | sndmsg.msg_byte_cnt = data_len + 8; | ||
129 | } | ||
130 | |||
131 | sndmsg.process_id = procid; | ||
132 | sndmsg.sequence_no = sc_adapter[card]->seq_no++ % 256; | ||
133 | |||
134 | /* | ||
135 | * wait for an empty slot in the queue | ||
136 | */ | ||
137 | while (!(inb(sc_adapter[card]->ioport[FIFO_STATUS]) & WF_NOT_FULL)) | ||
138 | udelay(1); | ||
139 | |||
140 | /* | ||
141 | * Disable interrupts and map in shared memory | ||
142 | */ | ||
143 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
144 | outb((sc_adapter[card]->shmem_magic >> 14) | 0x80, | ||
145 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | ||
146 | dpm = (DualPortMemory *) sc_adapter[card]->rambase; /* Fix me */ | ||
147 | memcpy_toio(&(dpm->req_queue[dpm->req_head]), &sndmsg, MSG_LEN); | ||
148 | dpm->req_head = (dpm->req_head + 1) % MAX_MESSAGES; | ||
149 | outb(sndmsg.sequence_no, sc_adapter[card]->ioport[FIFO_WRITE]); | ||
150 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
151 | |||
152 | pr_debug("%s: Sent Message seq:%d pid:%d time:%d " | ||
153 | "cnt:%d (type,class,code):(%d,%d,%d) " | ||
154 | "link:%d\n ", | ||
155 | sc_adapter[card]->devicename, | ||
156 | sndmsg.sequence_no, | ||
157 | sndmsg.process_id, | ||
158 | sndmsg.time_stamp, | ||
159 | sndmsg.msg_byte_cnt, | ||
160 | sndmsg.type, | ||
161 | sndmsg.class, | ||
162 | sndmsg.code, | ||
163 | sndmsg.phy_link_no); | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | int send_and_receive(int card, | ||
169 | unsigned int procid, | ||
170 | unsigned char type, | ||
171 | unsigned char class, | ||
172 | unsigned char code, | ||
173 | unsigned char link, | ||
174 | unsigned char data_len, | ||
175 | unsigned char *data, | ||
176 | RspMessage *mesgdata, | ||
177 | int timeout) | ||
178 | { | ||
179 | int retval; | ||
180 | int tries; | ||
181 | |||
182 | if (!IS_VALID_CARD(card)) { | ||
183 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
184 | return -EINVAL; | ||
185 | } | ||
186 | |||
187 | sc_adapter[card]->want_async_messages = 1; | ||
188 | retval = sendmessage(card, procid, type, class, code, link, | ||
189 | data_len, (unsigned int *) data); | ||
190 | |||
191 | if (retval) { | ||
192 | pr_debug("%s: SendMessage failed in SAR\n", | ||
193 | sc_adapter[card]->devicename); | ||
194 | sc_adapter[card]->want_async_messages = 0; | ||
195 | return -EIO; | ||
196 | } | ||
197 | |||
198 | tries = 0; | ||
199 | /* wait for the response */ | ||
200 | while (tries < timeout) { | ||
201 | schedule_timeout_interruptible(1); | ||
202 | |||
203 | pr_debug("SAR waiting..\n"); | ||
204 | |||
205 | /* | ||
206 | * See if we got our message back | ||
207 | */ | ||
208 | if ((sc_adapter[card]->async_msg.type == type) && | ||
209 | (sc_adapter[card]->async_msg.class == class) && | ||
210 | (sc_adapter[card]->async_msg.code == code) && | ||
211 | (sc_adapter[card]->async_msg.phy_link_no == link)) { | ||
212 | |||
213 | /* | ||
214 | * Got it! | ||
215 | */ | ||
216 | pr_debug("%s: Got ASYNC message\n", | ||
217 | sc_adapter[card]->devicename); | ||
218 | memcpy(mesgdata, &(sc_adapter[card]->async_msg), | ||
219 | sizeof(RspMessage)); | ||
220 | sc_adapter[card]->want_async_messages = 0; | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | tries++; | ||
225 | } | ||
226 | |||
227 | pr_debug("%s: SAR message timeout\n", sc_adapter[card]->devicename); | ||
228 | sc_adapter[card]->want_async_messages = 0; | ||
229 | return -ETIME; | ||
230 | } | ||
diff --git a/drivers/isdn/sc/message.h b/drivers/isdn/sc/message.h deleted file mode 100644 index 5e6f4a5c15f8..000000000000 --- a/drivers/isdn/sc/message.h +++ /dev/null | |||
@@ -1,245 +0,0 @@ | |||
1 | /* $Id: message.h,v 1.1.10.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * structures, macros and defines useful for sending | ||
6 | * messages to the adapter | ||
7 | * | ||
8 | * This software may be used and distributed according to the terms | ||
9 | * of the GNU General Public License, incorporated herein by reference. | ||
10 | * | ||
11 | * For more information, please contact gpl-info@spellcast.com or write: | ||
12 | * | ||
13 | * SpellCaster Telecommunications Inc. | ||
14 | * 5621 Finch Avenue East, Unit #3 | ||
15 | * Scarborough, Ontario Canada | ||
16 | * M1B 2T9 | ||
17 | * +1 (416) 297-8565 | ||
18 | * +1 (416) 297-6433 Facsimile | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Board message macros, defines and structures | ||
23 | */ | ||
24 | |||
25 | #ifndef MESSAGE_H | ||
26 | #define MESSAGE_H | ||
27 | |||
28 | #define MAX_MESSAGES 32 /* Maximum messages that can be | ||
29 | queued */ | ||
30 | #define MSG_DATA_LEN 48 /* Maximum size of message payload */ | ||
31 | #define MSG_LEN 64 /* Size of a message */ | ||
32 | #define CMPID 0 /* Loader message process ID */ | ||
33 | #define CEPID 64 /* Firmware message process ID */ | ||
34 | |||
35 | /* | ||
36 | * Macro to determine if a message is a loader message | ||
37 | */ | ||
38 | #define IS_CM_MESSAGE(mesg, tx, cx, dx) \ | ||
39 | ((mesg.type == cmRspType##tx) \ | ||
40 | && (mesg.class == cmRspClass##cx) \ | ||
41 | && (mesg.code == cmRsp##dx)) | ||
42 | |||
43 | /* | ||
44 | * Macro to determine if a message is a firmware message | ||
45 | */ | ||
46 | #define IS_CE_MESSAGE(mesg, tx, cx, dx) \ | ||
47 | ((mesg.type == ceRspType##tx) \ | ||
48 | && (mesg.class == ceRspClass##cx) \ | ||
49 | && (mesg.code == ceRsp##tx##dx)) | ||
50 | |||
51 | /* | ||
52 | * Loader Request and Response Messages | ||
53 | */ | ||
54 | |||
55 | /* message types */ | ||
56 | #define cmReqType1 1 | ||
57 | #define cmReqType2 2 | ||
58 | #define cmRspType0 0 | ||
59 | #define cmRspType1 1 | ||
60 | #define cmRspType2 2 | ||
61 | #define cmRspType5 5 | ||
62 | |||
63 | /* message classes */ | ||
64 | #define cmReqClass0 0 | ||
65 | #define cmRspClass0 0 | ||
66 | |||
67 | /* message codes */ | ||
68 | #define cmReqHWConfig 1 /* 1,0,1 */ | ||
69 | #define cmReqMsgLpbk 2 /* 1,0,2 */ | ||
70 | #define cmReqVersion 3 /* 1,0,3 */ | ||
71 | #define cmReqLoadProc 1 /* 2,0,1 */ | ||
72 | #define cmReqStartProc 2 /* 2,0,2 */ | ||
73 | #define cmReqReadMem 6 /* 2,0,6 */ | ||
74 | #define cmRspHWConfig cmReqHWConfig | ||
75 | #define cmRspMsgLpbk cmReqMsgLpbk | ||
76 | #define cmRspVersion cmReqVersion | ||
77 | #define cmRspLoadProc cmReqLoadProc | ||
78 | #define cmRspStartProc cmReqStartProc | ||
79 | #define cmRspReadMem cmReqReadMem | ||
80 | #define cmRspMiscEngineUp 1 /* 5,0,1 */ | ||
81 | #define cmRspInvalid 0 /* 0,0,0 */ | ||
82 | |||
83 | |||
84 | /* | ||
85 | * Firmware Request and Response Messages | ||
86 | */ | ||
87 | |||
88 | /* message types */ | ||
89 | #define ceReqTypePhy 1 | ||
90 | #define ceReqTypeLnk 2 | ||
91 | #define ceReqTypeCall 3 | ||
92 | #define ceReqTypeStat 1 | ||
93 | #define ceRspTypeErr 0 | ||
94 | #define ceRspTypePhy ceReqTypePhy | ||
95 | #define ceRspTypeLnk ceReqTypeLnk | ||
96 | #define ceRspTypeCall ceReqTypeCall | ||
97 | #define ceRspTypeStat ceReqTypeStat | ||
98 | |||
99 | /* message classes */ | ||
100 | #define ceReqClass0 0 | ||
101 | #define ceReqClass1 1 | ||
102 | #define ceReqClass2 2 | ||
103 | #define ceReqClass3 3 | ||
104 | #define ceRspClass0 ceReqClass0 | ||
105 | #define ceRspClass1 ceReqClass1 | ||
106 | #define ceRspClass2 ceReqClass2 | ||
107 | #define ceRspClass3 ceReqClass3 | ||
108 | |||
109 | /* message codes (B) = BRI only, (P) = PRI only, (V) = POTS only */ | ||
110 | #define ceReqPhyProcInfo 1 /* 1,0,1 */ | ||
111 | #define ceReqPhyConnect 1 /* 1,1,1 */ | ||
112 | #define ceReqPhyDisconnect 2 /* 1,1,2 */ | ||
113 | #define ceReqPhySetParams 3 /* 1,1,3 (P) */ | ||
114 | #define ceReqPhyGetParams 4 /* 1,1,4 (P) */ | ||
115 | #define ceReqPhyStatus 1 /* 1,2,1 */ | ||
116 | #define ceReqPhyAcfaStatus 2 /* 1,2,2 (P) */ | ||
117 | #define ceReqPhyChCallState 3 /* 1,2,3 (P) */ | ||
118 | #define ceReqPhyChServState 4 /* 1,2,4 (P) */ | ||
119 | #define ceReqPhyRLoopBack 1 /* 1,3,1 */ | ||
120 | #define ceRspPhyProcInfo ceReqPhyProcInfo | ||
121 | #define ceRspPhyConnect ceReqPhyConnect | ||
122 | #define ceRspPhyDisconnect ceReqPhyDisconnect | ||
123 | #define ceRspPhySetParams ceReqPhySetParams | ||
124 | #define ceRspPhyGetParams ceReqPhyGetParams | ||
125 | #define ceRspPhyStatus ceReqPhyStatus | ||
126 | #define ceRspPhyAcfaStatus ceReqPhyAcfaStatus | ||
127 | #define ceRspPhyChCallState ceReqPhyChCallState | ||
128 | #define ceRspPhyChServState ceReqPhyChServState | ||
129 | #define ceRspPhyRLoopBack ceReqphyRLoopBack | ||
130 | #define ceReqLnkSetParam 1 /* 2,0,1 */ | ||
131 | #define ceReqLnkGetParam 2 /* 2,0,2 */ | ||
132 | #define ceReqLnkGetStats 3 /* 2,0,3 */ | ||
133 | #define ceReqLnkWrite 1 /* 2,1,1 */ | ||
134 | #define ceReqLnkRead 2 /* 2,1,2 */ | ||
135 | #define ceReqLnkFlush 3 /* 2,1,3 */ | ||
136 | #define ceReqLnkWrBufTrc 4 /* 2,1,4 */ | ||
137 | #define ceReqLnkRdBufTrc 5 /* 2,1,5 */ | ||
138 | #define ceRspLnkSetParam ceReqLnkSetParam | ||
139 | #define ceRspLnkGetParam ceReqLnkGetParam | ||
140 | #define ceRspLnkGetStats ceReqLnkGetStats | ||
141 | #define ceRspLnkWrite ceReqLnkWrite | ||
142 | #define ceRspLnkRead ceReqLnkRead | ||
143 | #define ceRspLnkFlush ceReqLnkFlush | ||
144 | #define ceRspLnkWrBufTrc ceReqLnkWrBufTrc | ||
145 | #define ceRspLnkRdBufTrc ceReqLnkRdBufTrc | ||
146 | #define ceReqCallSetSwitchType 1 /* 3,0,1 */ | ||
147 | #define ceReqCallGetSwitchType 2 /* 3,0,2 */ | ||
148 | #define ceReqCallSetFrameFormat 3 /* 3,0,3 */ | ||
149 | #define ceReqCallGetFrameFormat 4 /* 3,0,4 */ | ||
150 | #define ceReqCallSetCallType 5 /* 3,0,5 */ | ||
151 | #define ceReqCallGetCallType 6 /* 3,0,6 */ | ||
152 | #define ceReqCallSetSPID 7 /* 3,0,7 (!P) */ | ||
153 | #define ceReqCallGetSPID 8 /* 3,0,8 (!P) */ | ||
154 | #define ceReqCallSetMyNumber 9 /* 3,0,9 (!P) */ | ||
155 | #define ceReqCallGetMyNumber 10 /* 3,0,10 (!P) */ | ||
156 | #define ceRspCallSetSwitchType ceReqCallSetSwitchType | ||
157 | #define ceRspCallGetSwitchType ceReqCallSetSwitchType | ||
158 | #define ceRspCallSetFrameFormat ceReqCallSetFrameFormat | ||
159 | #define ceRspCallGetFrameFormat ceReqCallGetFrameFormat | ||
160 | #define ceRspCallSetCallType ceReqCallSetCallType | ||
161 | #define ceRspCallGetCallType ceReqCallGetCallType | ||
162 | #define ceRspCallSetSPID ceReqCallSetSPID | ||
163 | #define ceRspCallGetSPID ceReqCallGetSPID | ||
164 | #define ceRspCallSetMyNumber ceReqCallSetMyNumber | ||
165 | #define ceRspCallGetMyNumber ceReqCallGetMyNumber | ||
166 | #define ceRspStatAcfaStatus 2 | ||
167 | #define ceRspStat | ||
168 | #define ceRspErrError 0 /* 0,0,0 */ | ||
169 | |||
170 | /* | ||
171 | * Call Types | ||
172 | */ | ||
173 | #define CALLTYPE_64K 0 | ||
174 | #define CALLTYPE_56K 1 | ||
175 | #define CALLTYPE_SPEECH 2 | ||
176 | #define CALLTYPE_31KHZ 3 | ||
177 | |||
178 | /* | ||
179 | * Link Level data contains a pointer to and the length of | ||
180 | * a buffer in shared RAM. Used by LnkRead and LnkWrite message | ||
181 | * types. Part of RspMsgStruct and ReqMsgStruct. | ||
182 | */ | ||
183 | typedef struct { | ||
184 | unsigned long buff_offset; | ||
185 | unsigned short msg_len; | ||
186 | } LLData; | ||
187 | |||
188 | |||
189 | /* | ||
190 | * Message payload template for an HWConfig message | ||
191 | */ | ||
192 | typedef struct { | ||
193 | char st_u_sense; | ||
194 | char powr_sense; | ||
195 | char sply_sense; | ||
196 | unsigned char asic_id; | ||
197 | long ram_size; | ||
198 | char serial_no[13]; | ||
199 | char part_no[13]; | ||
200 | char rev_no[2]; | ||
201 | } HWConfig_pl; | ||
202 | |||
203 | /* | ||
204 | * A Message | ||
205 | */ | ||
206 | struct message { | ||
207 | unsigned char sequence_no; | ||
208 | unsigned char process_id; | ||
209 | unsigned char time_stamp; | ||
210 | unsigned char cmd_sequence_no; /* Rsp messages only */ | ||
211 | unsigned char reserved1[3]; | ||
212 | unsigned char msg_byte_cnt; | ||
213 | unsigned char type; | ||
214 | unsigned char class; | ||
215 | unsigned char code; | ||
216 | unsigned char phy_link_no; | ||
217 | unsigned char rsp_status; /* Rsp messages only */ | ||
218 | unsigned char reseved2[3]; | ||
219 | union { | ||
220 | unsigned char byte_array[MSG_DATA_LEN]; | ||
221 | LLData response; | ||
222 | HWConfig_pl HWCresponse; | ||
223 | } msg_data; | ||
224 | }; | ||
225 | |||
226 | typedef struct message ReqMessage; /* Request message */ | ||
227 | typedef struct message RspMessage; /* Response message */ | ||
228 | |||
229 | /* | ||
230 | * The first 5010 bytes of shared memory contain the message queues, | ||
231 | * indexes and other data. This structure is its template | ||
232 | */ | ||
233 | typedef struct { | ||
234 | volatile ReqMessage req_queue[MAX_MESSAGES]; | ||
235 | volatile RspMessage rsp_queue[MAX_MESSAGES]; | ||
236 | volatile unsigned char req_head; | ||
237 | volatile unsigned char req_tail; | ||
238 | volatile unsigned char rsp_head; | ||
239 | volatile unsigned char rsp_tail; | ||
240 | volatile unsigned long signature; | ||
241 | volatile unsigned long trace_enable; | ||
242 | volatile unsigned char reserved[4]; | ||
243 | } DualPortMemory; | ||
244 | |||
245 | #endif | ||
diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c deleted file mode 100644 index 2446957085e0..000000000000 --- a/drivers/isdn/sc/packet.c +++ /dev/null | |||
@@ -1,204 +0,0 @@ | |||
1 | /* $Id: packet.c,v 1.5.8.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | * For more information, please contact gpl-info@spellcast.com or write: | ||
9 | * | ||
10 | * SpellCaster Telecommunications Inc. | ||
11 | * 5621 Finch Avenue East, Unit #3 | ||
12 | * Scarborough, Ontario Canada | ||
13 | * M1B 2T9 | ||
14 | * +1 (416) 297-8565 | ||
15 | * +1 (416) 297-6433 Facsimile | ||
16 | */ | ||
17 | |||
18 | #include "includes.h" | ||
19 | #include "hardware.h" | ||
20 | #include "message.h" | ||
21 | #include "card.h" | ||
22 | |||
23 | int sndpkt(int devId, int channel, int ack, struct sk_buff *data) | ||
24 | { | ||
25 | LLData ReqLnkWrite; | ||
26 | int status; | ||
27 | int card; | ||
28 | unsigned long len; | ||
29 | |||
30 | card = get_card_from_id(devId); | ||
31 | |||
32 | if (!IS_VALID_CARD(card)) { | ||
33 | pr_debug("invalid param: %d is not a valid card id\n", card); | ||
34 | return -ENODEV; | ||
35 | } | ||
36 | |||
37 | pr_debug("%s: sndpkt: frst = 0x%lx nxt = %d f = %d n = %d\n", | ||
38 | sc_adapter[card]->devicename, | ||
39 | sc_adapter[card]->channel[channel].first_sendbuf, | ||
40 | sc_adapter[card]->channel[channel].next_sendbuf, | ||
41 | sc_adapter[card]->channel[channel].free_sendbufs, | ||
42 | sc_adapter[card]->channel[channel].num_sendbufs); | ||
43 | |||
44 | if (!sc_adapter[card]->channel[channel].free_sendbufs) { | ||
45 | pr_debug("%s: out of TX buffers\n", | ||
46 | sc_adapter[card]->devicename); | ||
47 | return -EINVAL; | ||
48 | } | ||
49 | |||
50 | if (data->len > BUFFER_SIZE) { | ||
51 | pr_debug("%s: data overflows buffer size (data > buffer)\n", | ||
52 | sc_adapter[card]->devicename); | ||
53 | return -EINVAL; | ||
54 | } | ||
55 | |||
56 | ReqLnkWrite.buff_offset = sc_adapter[card]->channel[channel].next_sendbuf * | ||
57 | BUFFER_SIZE + sc_adapter[card]->channel[channel].first_sendbuf; | ||
58 | ReqLnkWrite.msg_len = data->len; /* sk_buff size */ | ||
59 | pr_debug("%s: writing %d bytes to buffer offset 0x%lx\n", | ||
60 | sc_adapter[card]->devicename, | ||
61 | ReqLnkWrite.msg_len, ReqLnkWrite.buff_offset); | ||
62 | memcpy_toshmem(card, (char *)ReqLnkWrite.buff_offset, data->data, ReqLnkWrite.msg_len); | ||
63 | |||
64 | /* | ||
65 | * sendmessage | ||
66 | */ | ||
67 | pr_debug("%s: sndpkt size=%d, buf_offset=0x%lx buf_indx=%d\n", | ||
68 | sc_adapter[card]->devicename, | ||
69 | ReqLnkWrite.msg_len, ReqLnkWrite.buff_offset, | ||
70 | sc_adapter[card]->channel[channel].next_sendbuf); | ||
71 | |||
72 | status = sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkWrite, | ||
73 | channel + 1, sizeof(LLData), (unsigned int *)&ReqLnkWrite); | ||
74 | len = data->len; | ||
75 | if (status) { | ||
76 | pr_debug("%s: failed to send packet, status = %d\n", | ||
77 | sc_adapter[card]->devicename, status); | ||
78 | return -1; | ||
79 | } | ||
80 | else { | ||
81 | sc_adapter[card]->channel[channel].free_sendbufs--; | ||
82 | sc_adapter[card]->channel[channel].next_sendbuf = | ||
83 | ++sc_adapter[card]->channel[channel].next_sendbuf == | ||
84 | sc_adapter[card]->channel[channel].num_sendbufs ? 0 : | ||
85 | sc_adapter[card]->channel[channel].next_sendbuf; | ||
86 | pr_debug("%s: packet sent successfully\n", sc_adapter[card]->devicename); | ||
87 | dev_kfree_skb(data); | ||
88 | indicate_status(card, ISDN_STAT_BSENT, channel, (char *)&len); | ||
89 | } | ||
90 | return len; | ||
91 | } | ||
92 | |||
93 | void rcvpkt(int card, RspMessage *rcvmsg) | ||
94 | { | ||
95 | LLData newll; | ||
96 | struct sk_buff *skb; | ||
97 | |||
98 | if (!IS_VALID_CARD(card)) { | ||
99 | pr_debug("invalid param: %d is not a valid card id\n", card); | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | switch (rcvmsg->rsp_status) { | ||
104 | case 0x01: | ||
105 | case 0x02: | ||
106 | case 0x70: | ||
107 | pr_debug("%s: error status code: 0x%x\n", | ||
108 | sc_adapter[card]->devicename, rcvmsg->rsp_status); | ||
109 | return; | ||
110 | case 0x00: | ||
111 | if (!(skb = dev_alloc_skb(rcvmsg->msg_data.response.msg_len))) { | ||
112 | printk(KERN_WARNING "%s: rcvpkt out of memory, dropping packet\n", | ||
113 | sc_adapter[card]->devicename); | ||
114 | return; | ||
115 | } | ||
116 | skb_put(skb, rcvmsg->msg_data.response.msg_len); | ||
117 | pr_debug("%s: getting data from offset: 0x%lx\n", | ||
118 | sc_adapter[card]->devicename, | ||
119 | rcvmsg->msg_data.response.buff_offset); | ||
120 | memcpy_fromshmem(card, | ||
121 | skb_put(skb, rcvmsg->msg_data.response.msg_len), | ||
122 | (char *)rcvmsg->msg_data.response.buff_offset, | ||
123 | rcvmsg->msg_data.response.msg_len); | ||
124 | sc_adapter[card]->card->rcvcallb_skb(sc_adapter[card]->driverId, | ||
125 | rcvmsg->phy_link_no - 1, skb); | ||
126 | |||
127 | case 0x03: | ||
128 | /* | ||
129 | * Recycle the buffer | ||
130 | */ | ||
131 | pr_debug("%s: buffer size : %d\n", | ||
132 | sc_adapter[card]->devicename, BUFFER_SIZE); | ||
133 | /* memset_shmem(card, rcvmsg->msg_data.response.buff_offset, 0, BUFFER_SIZE); */ | ||
134 | newll.buff_offset = rcvmsg->msg_data.response.buff_offset; | ||
135 | newll.msg_len = BUFFER_SIZE; | ||
136 | pr_debug("%s: recycled buffer at offset 0x%lx size %d\n", | ||
137 | sc_adapter[card]->devicename, | ||
138 | newll.buff_offset, newll.msg_len); | ||
139 | sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, | ||
140 | rcvmsg->phy_link_no, sizeof(LLData), (unsigned int *)&newll); | ||
141 | } | ||
142 | |||
143 | } | ||
144 | |||
145 | int setup_buffers(int card, int c) | ||
146 | { | ||
147 | unsigned int nBuffers, i, cBase; | ||
148 | unsigned int buffer_size; | ||
149 | LLData RcvBuffOffset; | ||
150 | |||
151 | if (!IS_VALID_CARD(card)) { | ||
152 | pr_debug("invalid param: %d is not a valid card id\n", card); | ||
153 | return -ENODEV; | ||
154 | } | ||
155 | |||
156 | /* | ||
157 | * Calculate the buffer offsets (send/recv/send/recv) | ||
158 | */ | ||
159 | pr_debug("%s: setting up channel buffer space in shared RAM\n", | ||
160 | sc_adapter[card]->devicename); | ||
161 | buffer_size = BUFFER_SIZE; | ||
162 | nBuffers = ((sc_adapter[card]->ramsize - BUFFER_BASE) / buffer_size) / 2; | ||
163 | nBuffers = nBuffers > BUFFERS_MAX ? BUFFERS_MAX : nBuffers; | ||
164 | pr_debug("%s: calculating buffer space: %d buffers, %d big\n", | ||
165 | sc_adapter[card]->devicename, | ||
166 | nBuffers, buffer_size); | ||
167 | if (nBuffers < 2) { | ||
168 | pr_debug("%s: not enough buffer space\n", | ||
169 | sc_adapter[card]->devicename); | ||
170 | return -1; | ||
171 | } | ||
172 | cBase = (nBuffers * buffer_size) * (c - 1); | ||
173 | pr_debug("%s: channel buffer offset from shared RAM: 0x%x\n", | ||
174 | sc_adapter[card]->devicename, cBase); | ||
175 | sc_adapter[card]->channel[c - 1].first_sendbuf = BUFFER_BASE + cBase; | ||
176 | sc_adapter[card]->channel[c - 1].num_sendbufs = nBuffers / 2; | ||
177 | sc_adapter[card]->channel[c - 1].free_sendbufs = nBuffers / 2; | ||
178 | sc_adapter[card]->channel[c - 1].next_sendbuf = 0; | ||
179 | pr_debug("%s: send buffer setup complete: first=0x%lx n=%d f=%d, nxt=%d\n", | ||
180 | sc_adapter[card]->devicename, | ||
181 | sc_adapter[card]->channel[c - 1].first_sendbuf, | ||
182 | sc_adapter[card]->channel[c - 1].num_sendbufs, | ||
183 | sc_adapter[card]->channel[c - 1].free_sendbufs, | ||
184 | sc_adapter[card]->channel[c - 1].next_sendbuf); | ||
185 | |||
186 | /* | ||
187 | * Prep the receive buffers | ||
188 | */ | ||
189 | pr_debug("%s: adding %d RecvBuffers:\n", | ||
190 | sc_adapter[card]->devicename, nBuffers / 2); | ||
191 | for (i = 0; i < nBuffers / 2; i++) { | ||
192 | RcvBuffOffset.buff_offset = | ||
193 | ((sc_adapter[card]->channel[c - 1].first_sendbuf + | ||
194 | (nBuffers / 2) * buffer_size) + (buffer_size * i)); | ||
195 | RcvBuffOffset.msg_len = buffer_size; | ||
196 | pr_debug("%s: adding RcvBuffer #%d offset=0x%lx sz=%d bufsz:%d\n", | ||
197 | sc_adapter[card]->devicename, | ||
198 | i + 1, RcvBuffOffset.buff_offset, | ||
199 | RcvBuffOffset.msg_len, buffer_size); | ||
200 | sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, | ||
201 | c, sizeof(LLData), (unsigned int *)&RcvBuffOffset); | ||
202 | } | ||
203 | return 0; | ||
204 | } | ||
diff --git a/drivers/isdn/sc/scioc.h b/drivers/isdn/sc/scioc.h deleted file mode 100644 index a50e143779e7..000000000000 --- a/drivers/isdn/sc/scioc.h +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | #ifndef __ISDN_SC_SCIOC_H__ | ||
2 | #define __ISDN_SC_SCIOC_H__ | ||
3 | |||
4 | /* | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * IOCTL Command Codes | ||
11 | */ | ||
12 | #define SCIOCLOAD 0x01 /* Load a firmware record */ | ||
13 | #define SCIOCRESET 0x02 /* Perform hard reset */ | ||
14 | #define SCIOCDEBUG 0x03 /* Set debug level */ | ||
15 | #define SCIOCREV 0x04 /* Get driver revision(s) */ | ||
16 | #define SCIOCSTART 0x05 /* Start the firmware */ | ||
17 | #define SCIOCGETSWITCH 0x06 /* Get switch type */ | ||
18 | #define SCIOCSETSWITCH 0x07 /* Set switch type */ | ||
19 | #define SCIOCGETSPID 0x08 /* Get channel SPID */ | ||
20 | #define SCIOCSETSPID 0x09 /* Set channel SPID */ | ||
21 | #define SCIOCGETDN 0x0A /* Get channel DN */ | ||
22 | #define SCIOCSETDN 0x0B /* Set channel DN */ | ||
23 | #define SCIOCTRACE 0x0C /* Toggle trace mode */ | ||
24 | #define SCIOCSTAT 0x0D /* Get line status */ | ||
25 | #define SCIOCGETSPEED 0x0E /* Set channel speed */ | ||
26 | #define SCIOCSETSPEED 0x0F /* Set channel speed */ | ||
27 | #define SCIOCLOOPTST 0x10 /* Perform loopback test */ | ||
28 | |||
29 | typedef struct { | ||
30 | int device; | ||
31 | int channel; | ||
32 | unsigned long command; | ||
33 | void __user *dataptr; | ||
34 | } scs_ioctl; | ||
35 | |||
36 | /* Size of strings */ | ||
37 | #define SCIOC_SPIDSIZE 49 | ||
38 | #define SCIOC_DNSIZE SCIOC_SPIDSIZE | ||
39 | #define SCIOC_REVSIZE SCIOC_SPIDSIZE | ||
40 | #define SCIOC_SRECSIZE 49 | ||
41 | |||
42 | typedef struct { | ||
43 | unsigned long tx_good; | ||
44 | unsigned long tx_bad; | ||
45 | unsigned long rx_good; | ||
46 | unsigned long rx_bad; | ||
47 | } ChLinkStats; | ||
48 | |||
49 | typedef struct { | ||
50 | char spid[49]; | ||
51 | char dn[49]; | ||
52 | char call_type; | ||
53 | char phy_stat; | ||
54 | ChLinkStats link_stats; | ||
55 | } BRIStat; | ||
56 | |||
57 | typedef BRIStat POTStat; | ||
58 | |||
59 | typedef struct { | ||
60 | char call_type; | ||
61 | char call_state; | ||
62 | char serv_state; | ||
63 | char phy_stat; | ||
64 | ChLinkStats link_stats; | ||
65 | } PRIStat; | ||
66 | |||
67 | typedef char PRIInfo; | ||
68 | typedef char BRIInfo; | ||
69 | typedef char POTInfo; | ||
70 | |||
71 | |||
72 | typedef struct { | ||
73 | char acfa_nos; | ||
74 | char acfa_ais; | ||
75 | char acfa_los; | ||
76 | char acfa_rra; | ||
77 | char acfa_slpp; | ||
78 | char acfa_slpn; | ||
79 | char acfa_fsrf; | ||
80 | } ACFAStat; | ||
81 | |||
82 | typedef struct { | ||
83 | unsigned char modelid; | ||
84 | char serial_no[13]; | ||
85 | char part_no[13]; | ||
86 | char load_ver[11]; | ||
87 | char proc_ver[11]; | ||
88 | int iobase; | ||
89 | long rambase; | ||
90 | char irq; | ||
91 | long ramsize; | ||
92 | char interface; | ||
93 | char switch_type; | ||
94 | char l1_status; | ||
95 | char l2_status; | ||
96 | ChLinkStats dch_stats; | ||
97 | ACFAStat AcfaStats; | ||
98 | union { | ||
99 | PRIStat pristats[23]; | ||
100 | BRIStat bristats[2]; | ||
101 | POTStat potsstats[2]; | ||
102 | } status; | ||
103 | union { | ||
104 | PRIInfo priinfo; | ||
105 | BRIInfo briinfo; | ||
106 | POTInfo potsinfo; | ||
107 | } info; | ||
108 | } boardInfo; | ||
109 | |||
110 | #endif /* __ISDN_SC_SCIOC_H__ */ | ||
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c deleted file mode 100644 index d24506ceb6e8..000000000000 --- a/drivers/isdn/sc/shmem.c +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* $Id: shmem.c,v 1.2.10.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * Card functions implementing ISDN4Linux functionality | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | * For more information, please contact gpl-info@spellcast.com or write: | ||
11 | * | ||
12 | * SpellCaster Telecommunications Inc. | ||
13 | * 5621 Finch Avenue East, Unit #3 | ||
14 | * Scarborough, Ontario Canada | ||
15 | * M1B 2T9 | ||
16 | * +1 (416) 297-8565 | ||
17 | * +1 (416) 297-6433 Facsimile | ||
18 | */ | ||
19 | |||
20 | #include "includes.h" /* This must be first */ | ||
21 | #include "hardware.h" | ||
22 | #include "card.h" | ||
23 | |||
24 | /* | ||
25 | * | ||
26 | */ | ||
27 | void memcpy_toshmem(int card, void *dest, const void *src, size_t n) | ||
28 | { | ||
29 | unsigned long flags; | ||
30 | unsigned char ch; | ||
31 | unsigned long dest_rem = ((unsigned long) dest) % 0x4000; | ||
32 | |||
33 | if (!IS_VALID_CARD(card)) { | ||
34 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
35 | return; | ||
36 | } | ||
37 | |||
38 | if (n > SRAM_PAGESIZE) | ||
39 | return; | ||
40 | |||
41 | /* | ||
42 | * determine the page to load from the address | ||
43 | */ | ||
44 | ch = (unsigned long) dest / SRAM_PAGESIZE; | ||
45 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename, ch); | ||
46 | /* | ||
47 | * Block interrupts and load the page | ||
48 | */ | ||
49 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
50 | |||
51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | ||
52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | ||
53 | memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n); | ||
54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
55 | pr_debug("%s: set page to %#x\n", sc_adapter[card]->devicename, | ||
56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80); | ||
57 | pr_debug("%s: copying %zu bytes from %#lx to %#lx\n", | ||
58 | sc_adapter[card]->devicename, n, | ||
59 | (unsigned long) src, | ||
60 | sc_adapter[card]->rambase + ((unsigned long) dest % 0x4000)); | ||
61 | } | ||
62 | |||
63 | /* | ||
64 | * Reverse of above | ||
65 | */ | ||
66 | void memcpy_fromshmem(int card, void *dest, const void *src, size_t n) | ||
67 | { | ||
68 | unsigned long flags; | ||
69 | unsigned char ch; | ||
70 | |||
71 | if (!IS_VALID_CARD(card)) { | ||
72 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | if (n > SRAM_PAGESIZE) { | ||
77 | return; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * determine the page to load from the address | ||
82 | */ | ||
83 | ch = (unsigned long) src / SRAM_PAGESIZE; | ||
84 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename, ch); | ||
85 | |||
86 | |||
87 | /* | ||
88 | * Block interrupts and load the page | ||
89 | */ | ||
90 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
91 | |||
92 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | ||
93 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | ||
94 | memcpy_fromio(dest, (void *)(sc_adapter[card]->rambase + | ||
95 | ((unsigned long) src % 0x4000)), n); | ||
96 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
97 | pr_debug("%s: set page to %#x\n", sc_adapter[card]->devicename, | ||
98 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80); | ||
99 | /* pr_debug("%s: copying %d bytes from %#x to %#x\n", | ||
100 | sc_adapter[card]->devicename, n, | ||
101 | sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */ | ||
102 | } | ||
103 | |||
104 | #if 0 | ||
105 | void memset_shmem(int card, void *dest, int c, size_t n) | ||
106 | { | ||
107 | unsigned long flags; | ||
108 | unsigned char ch; | ||
109 | |||
110 | if (!IS_VALID_CARD(card)) { | ||
111 | pr_debug("Invalid param: %d is not a valid card id\n", card); | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | if (n > SRAM_PAGESIZE) { | ||
116 | return; | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * determine the page to load from the address | ||
121 | */ | ||
122 | ch = (unsigned long) dest / SRAM_PAGESIZE; | ||
123 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename, ch); | ||
124 | |||
125 | /* | ||
126 | * Block interrupts and load the page | ||
127 | */ | ||
128 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
129 | |||
130 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | ||
131 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | ||
132 | memset_io(sc_adapter[card]->rambase + | ||
133 | ((unsigned long) dest % 0x4000), c, n); | ||
134 | pr_debug("%s: set page to %#x\n", sc_adapter[card]->devicename, | ||
135 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80); | ||
136 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
137 | } | ||
138 | #endif /* 0 */ | ||
diff --git a/drivers/isdn/sc/timer.c b/drivers/isdn/sc/timer.c deleted file mode 100644 index 6fbac2230d7e..000000000000 --- a/drivers/isdn/sc/timer.c +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* $Id: timer.c,v 1.3.6.1 2001/09/23 22:24:59 kai Exp $ | ||
2 | * | ||
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | * For more information, please contact gpl-info@spellcast.com or write: | ||
9 | * | ||
10 | * SpellCaster Telecommunications Inc. | ||
11 | * 5621 Finch Avenue East, Unit #3 | ||
12 | * Scarborough, Ontario Canada | ||
13 | * M1B 2T9 | ||
14 | * +1 (416) 297-8565 | ||
15 | * +1 (416) 297-6433 Facsimile | ||
16 | */ | ||
17 | |||
18 | #include "includes.h" | ||
19 | #include "hardware.h" | ||
20 | #include "message.h" | ||
21 | #include "card.h" | ||
22 | |||
23 | |||
24 | /* | ||
25 | * Write the proper values into the I/O ports following a reset | ||
26 | */ | ||
27 | static void setup_ports(int card) | ||
28 | { | ||
29 | |||
30 | outb((sc_adapter[card]->rambase >> 12), sc_adapter[card]->ioport[EXP_BASE]); | ||
31 | |||
32 | /* And the IRQ */ | ||
33 | outb((sc_adapter[card]->interrupt | 0x80), | ||
34 | sc_adapter[card]->ioport[IRQ_SELECT]); | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * Timed function to check the status of a previous reset | ||
39 | * Must be very fast as this function runs in the context of | ||
40 | * an interrupt handler. | ||
41 | * | ||
42 | * Setup the ioports for the board that were cleared by the reset. | ||
43 | * Then, check to see if the signate has been set. Next, set the | ||
44 | * signature to a known value and issue a startproc if needed. | ||
45 | */ | ||
46 | void sc_check_reset(unsigned long data) | ||
47 | { | ||
48 | unsigned long flags; | ||
49 | unsigned long sig; | ||
50 | int card = (unsigned int) data; | ||
51 | |||
52 | pr_debug("%s: check_timer timer called\n", | ||
53 | sc_adapter[card]->devicename); | ||
54 | |||
55 | /* Setup the io ports */ | ||
56 | setup_ports(card); | ||
57 | |||
58 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
59 | outb(sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport], | ||
60 | (sc_adapter[card]->shmem_magic >> 14) | 0x80); | ||
61 | sig = (unsigned long) *((unsigned long *)(sc_adapter[card]->rambase + SIG_OFFSET)); | ||
62 | |||
63 | /* check the signature */ | ||
64 | if (sig == SIGNATURE) { | ||
65 | flushreadfifo(card); | ||
66 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
67 | /* See if we need to do a startproc */ | ||
68 | if (sc_adapter[card]->StartOnReset) | ||
69 | startproc(card); | ||
70 | } else { | ||
71 | pr_debug("%s: No signature yet, waiting another %lu jiffies.\n", | ||
72 | sc_adapter[card]->devicename, CHECKRESET_TIME); | ||
73 | mod_timer(&sc_adapter[card]->reset_timer, jiffies + CHECKRESET_TIME); | ||
74 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | /* | ||
79 | * Timed function to check the status of a previous reset | ||
80 | * Must be very fast as this function runs in the context of | ||
81 | * an interrupt handler. | ||
82 | * | ||
83 | * Send check sc_adapter->phystat to see if the channels are up | ||
84 | * If they are, tell ISDN4Linux that the board is up. If not, | ||
85 | * tell IADN4Linux that it is up. Always reset the timer to | ||
86 | * fire again (endless loop). | ||
87 | */ | ||
88 | void check_phystat(unsigned long data) | ||
89 | { | ||
90 | unsigned long flags; | ||
91 | int card = (unsigned int) data; | ||
92 | |||
93 | pr_debug("%s: Checking status...\n", sc_adapter[card]->devicename); | ||
94 | /* | ||
95 | * check the results of the last PhyStat and change only if | ||
96 | * has changed drastically | ||
97 | */ | ||
98 | if (sc_adapter[card]->nphystat && !sc_adapter[card]->phystat) { /* All is well */ | ||
99 | pr_debug("PhyStat transition to RUN\n"); | ||
100 | pr_info("%s: Switch contacted, transmitter enabled\n", | ||
101 | sc_adapter[card]->devicename); | ||
102 | indicate_status(card, ISDN_STAT_RUN, 0, NULL); | ||
103 | } | ||
104 | else if (!sc_adapter[card]->nphystat && sc_adapter[card]->phystat) { /* All is not well */ | ||
105 | pr_debug("PhyStat transition to STOP\n"); | ||
106 | pr_info("%s: Switch connection lost, transmitter disabled\n", | ||
107 | sc_adapter[card]->devicename); | ||
108 | |||
109 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); | ||
110 | } | ||
111 | |||
112 | sc_adapter[card]->phystat = sc_adapter[card]->nphystat; | ||
113 | |||
114 | /* Reinitialize the timer */ | ||
115 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | ||
116 | mod_timer(&sc_adapter[card]->stat_timer, jiffies + CHECKSTAT_TIME); | ||
117 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | ||
118 | |||
119 | /* Send a new cePhyStatus message */ | ||
120 | sendmessage(card, CEPID, ceReqTypePhy, ceReqClass2, | ||
121 | ceReqPhyStatus, 0, 0, NULL); | ||
122 | } | ||