root/drivers/isdn/teles/card.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. readisac_0
  2. readisac_3
  3. writeisac_0
  4. writeisac_3
  5. readisac_s
  6. writeisac_s
  7. readhscx_0
  8. readhscx_3
  9. writehscx_0
  10. writehscx_3
  11. readhscx_s
  12. writehscx_s
  13. waitforCEC_0
  14. waitforCEC_3
  15. waitforXFW_0
  16. waitforXFW_3
  17. writehscxCMDR_0
  18. writehscxCMDR_3
  19. teles_hscxreport
  20. teles_report
  21. hscx_sched_event
  22. hscx_empty_fifo
  23. hscx_fill_fifo
  24. hscx_interrupt
  25. isac_sched_event
  26. empty_fifo
  27. fill_fifo
  28. act_wanted
  29. ph_command
  30. isac_new_ph
  31. teles_interrupt
  32. act_ivated
  33. process_new_ph
  34. process_xmt
  35. process_rcv
  36. isac_bh
  37. hscx_process_xmt
  38. hscx_process_rcv
  39. hscx_bh
  40. restart_ph
  41. initisac
  42. checkcard
  43. modehscx
  44. teles_addlist
  45. teles_rmlist
  46. teles_l2l1
  47. check_ph_act
  48. teles_manl1
  49. teles_l2l1discardq
  50. setstack_teles
  51. init_hscxstate
  52. initcard
  53. get_irq
  54. release_irq
  55. close_hscxstate
  56. closecard
  57. teles_shiftcards
  58. teles_inithardware
  59. teles_closehardware
  60. hscx_l2l1
  61. hscx_l2l1discardq
  62. open_hscxstate
  63. hscx_manl1
  64. setstack_hscx
  65. teles_reportcard

   1 /*
   2  * card.c     low level stuff for the Teles S0 isdn card
   3  * 
   4  * Author     Jan den Ouden
   5  * 
   6  * 
   7  * 
   8  * Changelog:
   9  * 
  10  * Beat Doebeli         log all D channel traffic
  11  * 
  12  */
  13 
  14 #define __NO_VERSION__
  15 #include "teles.h"
  16 
  17 #define INCLUDE_INLINE_FUNCS
  18 #include <linux/tqueue.h>
  19 #include <linux/interrupt.h>
  20 
  21 #undef DCHAN_VERBOSE
  22 
  23 extern void     tei_handler(struct PStack *st, byte pr,
  24                             struct BufHeader *ibh);
  25 extern struct   IsdnCard cards[];
  26 extern int      nrcards;
  27 
  28 #define byteout(addr,val) outb_p(val,addr)
  29 #define bytein(addr) inb_p(addr)
  30 
  31 static inline   byte
  32 readisac_0(byte * cardm, byte offset)
     /* [previous][next][first][last][top][bottom][index][help] */
  33 {
  34         return *(byte *) (cardm + 0x100 + ((offset & 1) ? 0x1ff : 0) + offset);
  35 }
  36 
  37 static inline   byte
  38 readisac_3(int iobase, byte offset)
     /* [previous][next][first][last][top][bottom][index][help] */
  39 {
  40         return (bytein(iobase - 0x420 + offset));
  41 }
  42 
  43 #define READISAC(mbase,ibase,ofs) \
  44         ((mbase)?readisac_0(mbase,ofs):readisac_3(ibase,ofs))
  45 
  46 static inline void
  47 writeisac_0(byte * cardm, byte offset, byte value)
     /* [previous][next][first][last][top][bottom][index][help] */
  48 {
  49         *(byte *) (cardm + 0x100 + ((offset & 1) ? 0x1ff : 0) + offset) = value;
  50 }
  51 
  52 static inline void
  53 writeisac_3(int iobase, byte offset, byte value)
     /* [previous][next][first][last][top][bottom][index][help] */
  54 {
  55         byteout(iobase - 0x420 + offset, value);
  56 }
  57 
  58 #define WRITEISAC(mbase,ibase,ofs,val) \
  59         ((mbase)?writeisac_0(mbase,ofs,val):writeisac_3(ibase,ofs,val))
  60 
  61 static inline void
  62 readisac_s(int iobase, byte offset, byte * dest, int count)
     /* [previous][next][first][last][top][bottom][index][help] */
  63 {
  64         insb(iobase - 0x420 + offset, dest, count);
  65 }
  66 
  67 static inline void
  68 writeisac_s(int iobase, byte offset, byte * src, int count)
     /* [previous][next][first][last][top][bottom][index][help] */
  69 {
  70         outsb(iobase - 0x420 + offset, src, count);
  71 }
  72 
  73 static inline   byte
  74 readhscx_0(byte * base, byte hscx, byte offset)
     /* [previous][next][first][last][top][bottom][index][help] */
  75 {
  76         return *(byte *) (base + 0x180 + ((offset & 1) ? 0x1FF : 0) +
  77                           ((hscx & 1) ? 0x40 : 0) + offset);
  78 }
  79 
  80 static inline   byte
  81 readhscx_3(int iobase, byte hscx, byte offset)
     /* [previous][next][first][last][top][bottom][index][help] */
  82 {
  83         return (bytein(iobase - (hscx ? 0x820 : 0xc20) + offset));
  84 }
  85 
  86 #define READHSCX(mbase,ibase,hscx,ofs) \
  87         ((mbase)?readhscx_0(mbase,hscx,ofs):readhscx_3(ibase,hscx,ofs))
  88 
  89 static inline void
  90 writehscx_0(byte * base, byte hscx, byte offset, byte data)
     /* [previous][next][first][last][top][bottom][index][help] */
  91 {
  92         *(byte *) (base + 0x180 + ((offset & 1) ? 0x1FF : 0) +
  93                    ((hscx & 1) ? 0x40 : 0) + offset) = data;
  94 }
  95 
  96 static inline void
  97 writehscx_3(int iobase, byte hscx, byte offset, byte data)
     /* [previous][next][first][last][top][bottom][index][help] */
  98 {
  99         byteout(iobase - (hscx ? 0x820 : 0xc20) + offset, data);
 100 }
 101 
 102 static inline void
 103 readhscx_s(int iobase, byte hscx, byte offset, byte * dest, int count)
     /* [previous][next][first][last][top][bottom][index][help] */
 104 {
 105         insb(iobase - (hscx ? 0x820 : 0xc20) + offset, dest, count);
 106 }
 107 
 108 static inline void
 109 writehscx_s(int iobase, byte hscx, byte offset, byte * src, int count)
     /* [previous][next][first][last][top][bottom][index][help] */
 110 {
 111         outsb(iobase - (hscx ? 0x820 : 0xc20) + offset, src, count);
 112 }
 113 
 114 #define ISAC_MASK 0x20
 115 #define ISAC_ISTA 0x20
 116 #define ISAC_STAR 0x21
 117 #define ISAC_CMDR 0x21
 118 #define ISAC_EXIR 0x24
 119 
 120 #define ISAC_RBCH 0x2a
 121 
 122 #define ISAC_ADF2 0x39
 123 #define ISAC_SPCR 0x30
 124 #define ISAC_ADF1 0x38
 125 #define ISAC_CIX0 0x31
 126 #define ISAC_STCR 0x37
 127 #define ISAC_MODE 0x22
 128 #define ISAC_RSTA 0x27
 129 #define ISAC_RBCL 0x25
 130 #define ISAC_TIMR 0x23
 131 #define ISAC_SQXR 0x3b
 132 
 133 #define HSCX_ISTA 0x20
 134 #define HSCX_CCR1 0x2f
 135 #define HSCX_CCR2 0x2c
 136 #define HSCX_TSAR 0x31
 137 #define HSCX_TSAX 0x30
 138 #define HSCX_XCCR 0x32
 139 #define HSCX_RCCR 0x33
 140 #define HSCX_MODE 0x22
 141 #define HSCX_CMDR 0x21
 142 #define HSCX_EXIR 0x24
 143 #define HSCX_XAD1 0x24
 144 #define HSCX_XAD2 0x25
 145 #define HSCX_RAH2 0x27
 146 #define HSCX_RSTA 0x27
 147 #define HSCX_TIMR 0x23
 148 #define HSCX_STAR 0x21
 149 #define HSCX_RBCL 0x25
 150 #define HSCX_XBCH 0x2d
 151 #define HSCX_VSTR 0x2e
 152 #define HSCX_RLCR 0x2e
 153 #define HSCX_MASK 0x20
 154 
 155 static inline void
 156 waitforCEC_0(byte * base, byte hscx)
     /* [previous][next][first][last][top][bottom][index][help] */
 157 {
 158         long            to = 10;
 159 
 160         while ((readhscx_0(base, hscx, HSCX_STAR) & 0x04) && to) {
 161                 udelay(5);
 162                 to--;
 163         }
 164         if (!to)
 165                 printk(KERN_WARNING "waitforCEC timeout\n");
 166 }
 167 
 168 static inline void
 169 waitforCEC_3(int iobase, byte hscx)
     /* [previous][next][first][last][top][bottom][index][help] */
 170 {
 171         long            to = 10;
 172 
 173         while ((readhscx_3(iobase, hscx, HSCX_STAR) & 0x04) && to) {
 174                 udelay(5);
 175                 to--;
 176         }
 177         if (!to)
 178                 printk(KERN_WARNING "waitforCEC timeout\n");
 179 }
 180 
 181 static inline void
 182 waitforXFW_0(byte * base, byte hscx)
     /* [previous][next][first][last][top][bottom][index][help] */
 183 {
 184         long            to = 10;
 185 
 186         waitforCEC_0(base, hscx);
 187 
 188         while ((!(readhscx_0(base, hscx, HSCX_STAR) & 0x40)) && to) {
 189                 udelay(5);
 190                 to--;
 191         }
 192         if (!to)
 193                 printk(KERN_WARNING "waitforXFW timeout\n");
 194 }
 195 
 196 static inline void
 197 waitforXFW_3(int iobase, byte hscx)
     /* [previous][next][first][last][top][bottom][index][help] */
 198 {
 199         long            to = 10;
 200 
 201         waitforCEC_3(iobase, hscx);
 202 
 203         while ((!(readhscx_3(iobase, hscx, HSCX_STAR) & 0x40)) && to) {
 204                 udelay(5);
 205                 to--;
 206         }
 207         if (!to)
 208                 printk(KERN_WARNING "waitforXFW timeout\n");
 209 }
 210 
 211 static inline void
 212 writehscxCMDR_0(byte * base, byte hscx, byte data)
     /* [previous][next][first][last][top][bottom][index][help] */
 213 {
 214         long            flags;
 215 
 216         save_flags(flags);
 217         cli();
 218         waitforCEC_0(base, hscx);
 219         writehscx_0(base, hscx, HSCX_CMDR, data);
 220         restore_flags(flags);
 221 }
 222 
 223 static inline void
 224 writehscxCMDR_3(int iobase, byte hscx, byte data)
     /* [previous][next][first][last][top][bottom][index][help] */
 225 {
 226         long            flags;
 227 
 228         save_flags(flags);
 229         cli();
 230         waitforCEC_3(iobase, hscx);
 231         writehscx_3(iobase, hscx, HSCX_CMDR, data);
 232         restore_flags(flags);
 233 }
 234 
 235 #define WRITEHSCX_CMDR(mbase,ibase,hscx,data) \
 236         ((mbase)?writehscxCMDR_0(mbase,hscx,data):writehscxCMDR_3(ibase,hscx,data))
 237 
 238 /*
 239  * fast interrupt here
 240  */
 241 
 242 #define ISAC_RCVBUFREADY 0
 243 #define ISAC_XMTBUFREADY 1
 244 #define ISAC_PHCHANGE    2
 245 
 246 #define HSCX_RCVBUFREADY 0
 247 #define HSCX_XMTBUFREADY 1
 248 
 249 void
 250 teles_hscxreport(struct IsdnCardState *sp, int hscx)
     /* [previous][next][first][last][top][bottom][index][help] */
 251 {
 252         printk(KERN_DEBUG "HSCX %d\n", hscx);
 253         if (sp->membase) {
 254                 printk(KERN_DEBUG "  ISTA %x\n", readhscx_0(sp->membase,
 255                                                           hscx, HSCX_ISTA));
 256                 printk(KERN_DEBUG "  STAR %x\n", readhscx_0(sp->membase,
 257                                                           hscx, HSCX_STAR));
 258                 printk(KERN_DEBUG "  EXIR %x\n", readhscx_0(sp->membase,
 259                                                           hscx, HSCX_EXIR));
 260         } else {
 261                 printk(KERN_DEBUG "  ISTA %x\n", readhscx_3(sp->iobase,
 262                                                           hscx, HSCX_ISTA));
 263                 printk(KERN_DEBUG "  STAR %x\n", readhscx_3(sp->iobase,
 264                                                           hscx, HSCX_STAR));
 265                 printk(KERN_DEBUG "  EXIR %x\n", readhscx_3(sp->iobase,
 266                                                           hscx, HSCX_EXIR));
 267         }
 268 }
 269 
 270 void
 271 teles_report(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 272 {
 273         printk(KERN_DEBUG "ISAC\n");
 274         if (sp->membase) {
 275                printk(KERN_DEBUG "  ISTA %x\n", readisac_0(sp->membase,
 276                                                             ISAC_ISTA));
 277                printk(KERN_DEBUG "  STAR %x\n", readisac_0(sp->membase,
 278                                                            ISAC_STAR));
 279                printk(KERN_DEBUG "  EXIR %x\n", readisac_0(sp->membase,
 280                                                            ISAC_EXIR));
 281         } else {
 282                 printk(KERN_DEBUG "  ISTA %x\n", readisac_3(sp->iobase,
 283                                                           ISAC_ISTA));
 284                 printk(KERN_DEBUG "  STAR %x\n", readisac_3(sp->iobase,
 285                                                           ISAC_STAR));
 286                 printk(KERN_DEBUG "  EXIR %x\n", readisac_3(sp->iobase,
 287                                                           ISAC_EXIR));
 288         }
 289         teles_hscxreport(sp, 0);
 290         teles_hscxreport(sp, 1);
 291 }
 292 
 293 /*
 294  * HSCX stuff goes here
 295  */
 296 
 297 static void
 298 hscx_sched_event(struct HscxState *hsp, int event)
     /* [previous][next][first][last][top][bottom][index][help] */
 299 {
 300         hsp->event |= 1 << event;
 301         queue_task_irq_off(&hsp->tqueue, &tq_immediate);
 302         mark_bh(IMMEDIATE_BH);
 303 }
 304 
 305 static void
 306 hscx_empty_fifo(struct HscxState *hsp, int count)
     /* [previous][next][first][last][top][bottom][index][help] */
 307 {
 308         byte             *ptr;
 309         struct BufHeader *ibh = hsp->rcvibh;
 310 
 311         if (hsp->sp->debug)
 312                 printk(KERN_DEBUG "hscx_empty_fifo\n");
 313 
 314         if (hsp->rcvptr + count > BUFFER_SIZE(HSCX_RBUF_ORDER,
 315                                               HSCX_RBUF_BPPS)) {
 316                 printk(KERN_WARNING
 317                        "hscx_empty_fifo: incoming packet too large\n");
 318                 WRITEHSCX_CMDR(hsp->membase, hsp->iobase, hsp->hscx, 0x80);
 319                 return;
 320         }
 321         ptr = DATAPTR(ibh);
 322         ptr += hsp->rcvptr;
 323 
 324         hsp->rcvptr += count;
 325         if (hsp->membase) {
 326                 while (count--)
 327                         *ptr++ = readhscx_0(hsp->membase, hsp->hscx, 0x0);
 328                 writehscxCMDR_0(hsp->membase, hsp->hscx, 0x80);
 329         } else {
 330                 readhscx_s(hsp->iobase, hsp->hscx, 0x3e, ptr, count);
 331                 writehscxCMDR_3(hsp->iobase, hsp->hscx, 0x80);
 332         }
 333 #ifdef BCHAN_VERBOSE
 334         {
 335                 int i;
 336                 printk(KERN_DEBUG "hscx_empty_fifo");
 337                 for (i = 0; i < count; i++)
 338                         printk(" %2x", ptr[i]);
 339                 printk("\n");
 340         }
 341 #endif                          /* BCHAN_VERBOSE */
 342 }
 343 
 344 static void
 345 hscx_fill_fifo(struct HscxState *hsp)
     /* [previous][next][first][last][top][bottom][index][help] */
 346 {
 347         struct BufHeader *ibh;
 348         int              more, count;
 349         byte             *ptr;
 350 
 351         if (hsp->sp->debug)
 352                 printk(KERN_DEBUG "hscx_fill_fifo\n");
 353 
 354         ibh = hsp->xmtibh;
 355         if (!ibh)
 356                 return;
 357 
 358         count = ibh->datasize - hsp->sendptr;
 359         if (count <= 0)
 360                 return;
 361 
 362 #if 0
 363         if (!hsp->sendptr) {
 364                 ptr = DATAPTR(ibh);
 365                 printk(KERN_DEBUG "snd bytes %2x %2x %2x %2x %2x\n", ptr[0], ptr[1], ptr[2],
 366                        ptr[3], ptr[4]);
 367         }
 368 #endif
 369 
 370         more = 0;
 371         if (count > 32) {
 372                 more = !0;
 373                 count = 32;
 374         }
 375         ptr = DATAPTR(ibh);
 376         ptr += hsp->sendptr;
 377         hsp->sendptr += count;
 378 
 379 #ifdef BCHAN_VERBOSE
 380         {
 381                 int i;
 382                 printk(KERN_DEBUG "hscx_fill_fifo ");
 383                 for (i = 0; i < count; i++)
 384                         printk(" %2x", ptr[i]);
 385                 printk("\n");
 386         }
 387 #endif
 388         if (hsp->membase) {
 389                 waitforXFW_0(hsp->membase, hsp->hscx);
 390                 while (count--)
 391                         writehscx_0(hsp->membase, hsp->hscx, 0x0, *ptr++);
 392                 writehscxCMDR_0(hsp->membase, hsp->hscx, more ? 0x8 : 0xa);
 393         } else {
 394                 waitforXFW_3(hsp->iobase, hsp->hscx);
 395                 writehscx_s(hsp->iobase, hsp->hscx, 0x3e, ptr, count);
 396                 writehscxCMDR_3(hsp->iobase, hsp->hscx, more ? 0x8 : 0xa);
 397         }
 398 }
 399 
 400 static inline void
 401 hscx_interrupt(struct IsdnCardState *sp, byte val, byte hscx)
     /* [previous][next][first][last][top][bottom][index][help] */
 402 {
 403         byte             r;
 404         struct HscxState *hsp = sp->hs + hscx;
 405         int              count;
 406 
 407         if (!hsp->init)
 408                 return;
 409 
 410         if (val & 0x80) {       /* RME */
 411 
 412                 r = READHSCX(hsp->membase, sp->iobase, hsp->hscx, HSCX_RSTA);
 413                 if ((r & 0xf0) != 0xa0) {
 414                         if (!r & 0x80)
 415                                 printk(KERN_WARNING
 416                                        "Teles: HSCX invalid frame\n");
 417                         if (r & 0x40)
 418                                 printk(KERN_WARNING "Teles: HSCX RDO\n");
 419                         if (!r & 0x20)
 420                                 printk(KERN_WARNING "Teles: HSCX CRC error\n");
 421                         if (hsp->rcvibh)
 422                                 BufPoolRelease(hsp->rcvibh);
 423                         hsp->rcvibh = NULL;
 424                         WRITEHSCX_CMDR(hsp->membase, hsp->iobase, hsp->hscx,
 425                                        0x80);
 426                         goto afterRME;
 427                 }
 428                 if (!hsp->rcvibh)
 429                         if (BufPoolGet(&hsp->rcvibh, &hsp->rbufpool,
 430                                        GFP_ATOMIC, (void *) 1, 1)) {
 431                                 printk(KERN_WARNING
 432                                        "HSCX RME out of buffers at %ld\n",
 433                                        jiffies);
 434                                 WRITEHSCX_CMDR(hsp->membase, hsp->iobase,
 435                                                hsp->hscx, 0x80);
 436                                 goto afterRME;
 437                         } else
 438                                 hsp->rcvptr = 0;
 439 
 440                 count = READHSCX(hsp->membase, sp->iobase, hsp->hscx,
 441                                  HSCX_RBCL) & 0x1f;
 442                 if (count == 0)
 443                         count = 32;
 444                 hscx_empty_fifo(hsp, count);
 445                 hsp->rcvibh->datasize = hsp->rcvptr - 1;
 446                 BufQueueLink(&hsp->rq, hsp->rcvibh);
 447                 hsp->rcvibh = NULL;
 448                 hscx_sched_event(hsp, HSCX_RCVBUFREADY);
 449         }
 450       afterRME:
 451         if (val & 0x40) {       /* RPF */
 452                 if (!hsp->rcvibh)
 453                         if (BufPoolGet(&hsp->rcvibh, &hsp->rbufpool,
 454                                        GFP_ATOMIC, (void *) 1, 2)) {
 455                                 printk(KERN_WARNING
 456                                        "HSCX RME out of buffers at %ld\n",
 457                                        jiffies);
 458                                 WRITEHSCX_CMDR(hsp->membase, hsp->iobase,
 459                                                hsp->hscx, 0x80);
 460                                 goto afterRPF;
 461                         } else
 462                                 hsp->rcvptr = 0;
 463 
 464                 hscx_empty_fifo(hsp, 32);
 465 #ifdef VOICE
 466                 hsp->rcvibh->datasize = hsp->rcvptr - 1;
 467                 BufQueueLink(&hsp->rq, hsp->rcvibh);
 468                 hsp->rcvibh = NULL;
 469                 hscx_sched_event(hsp, HSCX_RCVBUFREADY);
 470 #endif
 471         }
 472       afterRPF:
 473         if (val & 0x10) {       /* XPR */
 474                 if (hsp->xmtibh)
 475                         if (hsp->xmtibh->datasize > hsp->sendptr) {
 476                                 hscx_fill_fifo(hsp);
 477                                 goto afterXPR;
 478                         } else {
 479                                 if (hsp->releasebuf)
 480                                         BufPoolRelease(hsp->xmtibh);
 481                                 hsp->xmtibh = NULL;
 482                                 hsp->sendptr = 0;
 483                                 if (hsp->st->l4.l1writewakeup)
 484                                         hsp->st->l4.l1writewakeup(hsp->st);
 485                         }
 486                 if (!BufQueueUnlink(&hsp->xmtibh, &hsp->sq)) {
 487                         hsp->releasebuf = !0;
 488                         hscx_fill_fifo(hsp);
 489                 } else
 490                         hscx_sched_event(hsp, HSCX_XMTBUFREADY);
 491         }
 492       afterXPR:
 493 }
 494 
 495 /*
 496  * ISAC stuff goes here
 497  */
 498 
 499 static void
 500 isac_sched_event(struct IsdnCardState *sp, int event)
     /* [previous][next][first][last][top][bottom][index][help] */
 501 {
 502         sp->event |= 1 << event;
 503         queue_task_irq_off(&sp->tqueue, &tq_immediate);
 504         mark_bh(IMMEDIATE_BH);
 505 }
 506 
 507 static void
 508 empty_fifo(struct IsdnCardState *sp, int count)
     /* [previous][next][first][last][top][bottom][index][help] */
 509 {
 510         byte             *ptr;
 511         struct BufHeader *ibh = sp->rcvibh;
 512 
 513         if (sp->debug)
 514                 printk(KERN_DEBUG "empty_fifo\n");
 515 
 516         if (sp->rcvptr >= 3072) {
 517                 printk(KERN_WARNING "empty_fifo rcvptr %d\n", sp->rcvptr);
 518                 return;
 519         }
 520         ptr = DATAPTR(ibh);
 521         ptr += sp->rcvptr;
 522         sp->rcvptr += count;
 523 
 524         if (sp->membase) {
 525 #ifdef DCHAN_VERBOSE
 526                 printk(KERN_DEBUG "empty_fifo ");
 527                 while (count--) {
 528                         *ptr = readisac_0(sp->membase, 0x0);
 529                         printk("%2x ", *ptr);
 530                         ptr++;
 531                 }
 532                 printk("\n");
 533 #else
 534                 while (count--)
 535                         *ptr++ = readisac_0(sp->membase, 0x0);
 536 #endif
 537                 writeisac_0(sp->membase, ISAC_CMDR, 0x80);
 538         } else {
 539 #ifdef DCHAN_VERBOSE
 540                 int i;
 541                 printk(KERN_DEBUG "empty_fifo ");
 542                 readisac_s(sp->iobase, 0x3e, ptr, count);
 543                 for (i = 0; i < count; i++)
 544                         printk("%2x ", ptr[i]);
 545                 printk("\n");
 546 #else
 547                 readisac_s(sp->iobase, 0x3e, ptr, count);
 548 #endif
 549                 writeisac_3(sp->iobase, ISAC_CMDR, 0x80);
 550         }
 551 }
 552 
 553 static void
 554 fill_fifo(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 555 {
 556         struct BufHeader *ibh;
 557         int              count, more;
 558         byte             *ptr;
 559 
 560         if (sp->debug)
 561                 printk(KERN_DEBUG "fill_fifo\n");
 562 
 563         ibh = sp->xmtibh;
 564         if (!ibh)
 565                 return;
 566 
 567         count = ibh->datasize - sp->sendptr;
 568         if (count <= 0)
 569                 return;
 570         if (count >= 3072)
 571                 return;
 572 
 573         more = 0;
 574         if (count > 32) {
 575                 more = !0;
 576                 count = 32;
 577         }
 578         ptr = DATAPTR(ibh);
 579         ptr += sp->sendptr;
 580         sp->sendptr += count;
 581 
 582         if (sp->membase) {
 583 #ifdef DCHAN_VERBOSE
 584                 printk(KERN_DEBUG "fill_fifo ");
 585                 while (count--) {
 586                         writeisac_0(sp->membase, 0x0, *ptr);
 587                         printk("%2x ", *ptr);
 588                         ptr++;
 589                 }
 590                 printk("\n");
 591 #else
 592                 while (count--)
 593                         writeisac_0(sp->membase, 0x0, *ptr++);
 594 #endif
 595                 writeisac_0(sp->membase, ISAC_CMDR, more ? 0x8 : 0xa);
 596         } else {
 597 #ifdef DCHAN_VERBOSE
 598                 int i;
 599                 writeisac_s(sp->iobase, 0x3e, ptr, count);
 600                 printk(KERN_DEBUG "fill_fifo ");
 601                 for (i = 0; i < count; i++)
 602                         printk("%2x ", ptr[i]);
 603                 printk("\n");
 604 #else
 605                 writeisac_s(sp->iobase, 0x3e, ptr, count);
 606 #endif
 607                 writeisac_3(sp->iobase, ISAC_CMDR, more ? 0x8 : 0xa);
 608         }
 609 }
 610 
 611 static int
 612 act_wanted(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 613 {
 614         struct PStack  *st;
 615 
 616         st = sp->stlist;
 617         while (st)
 618                 if (st->l1.act_state)
 619                         return (!0);
 620                 else
 621                         st = st->next;
 622         return (0);
 623 }
 624 
 625 static void
 626 ph_command(struct IsdnCardState *sp, unsigned int command)
     /* [previous][next][first][last][top][bottom][index][help] */
 627 {
 628         printk(KERN_DEBUG "ph_command %d\n", command);
 629         WRITEISAC(sp->membase, sp->iobase, ISAC_CIX0, (command << 2) | 3);
 630 }
 631 
 632 static void
 633 isac_new_ph(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 634 {
 635         int             enq;
 636 
 637         enq = act_wanted(sp);
 638 
 639         switch (sp->ph_state) {
 640           case (0):
 641           case (6):
 642                   if (enq)
 643                           ph_command(sp, 0);
 644                   else
 645                           ph_command(sp, 15);
 646                   break;
 647           case (7):
 648                   if (enq)
 649                           ph_command(sp, 9);
 650                   break;
 651           case (12):
 652           case (13):
 653                   sp->ph_active = 5;
 654                   isac_sched_event(sp, ISAC_PHCHANGE);
 655                   if (!sp->xmtibh)
 656                           if (!BufQueueUnlink(&sp->xmtibh, &sp->sq))
 657                                   sp->sendptr = 0;
 658                   if (sp->xmtibh)
 659                           fill_fifo(sp);
 660                   break;
 661           case (4):
 662           case (8):
 663                   break;
 664           default:
 665                   sp->ph_active = 0;
 666                   break;
 667         }
 668 }
 669 
 670 static void
 671 teles_interrupt(int intno, struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
 672 {
 673         byte                 val, val2, r;
 674         struct IsdnCardState *sp;
 675         unsigned int         count;
 676         struct HscxState     *hsp;
 677 
 678         sp = (struct IsdnCardState *) irq2dev_map[intno];
 679 
 680         if (!sp) {
 681                 printk(KERN_WARNING "Teles: Spurious interrupt!\n");
 682                 return;
 683         }
 684         val = READHSCX(sp->membase, sp->iobase, 1, HSCX_ISTA);
 685 
 686         if (val & 0x01) {
 687                 hsp = sp->hs + 1;
 688                 printk(KERN_WARNING "HSCX B EXIR %x xmitbh %lx rcvibh %lx\n",
 689                        READHSCX(sp->membase, sp->iobase, 1, HSCX_EXIR),
 690                        (long) hsp->xmtibh,
 691                        (long) hsp->rcvibh);
 692         }
 693         if (val & 0xf8) {
 694                 if (sp->debug)
 695                         printk(KERN_DEBUG "HSCX B interrupt %x\n", val);
 696                 hscx_interrupt(sp, val, 1);
 697         }
 698         if (val & 0x02) {
 699                 printk(KERN_WARNING "HSCX A EXIR %x\n",
 700                        READHSCX(sp->membase, sp->iobase, 0, HSCX_EXIR));
 701         }
 702 
 703 /* ??? Why do that vvvvvvvvvvvvvvvvvvvvv different on Teles 16-3 ??? */
 704         if (sp->membase) {
 705                 if (val & 0x04) {
 706                         val = readhscx_0(sp->membase, 0, HSCX_ISTA);
 707                         if (sp->debug)
 708                                 printk(KERN_DEBUG "HSCX A interrupt %x\n",
 709                                        val);
 710                         hscx_interrupt(sp, val, 0);
 711                 }
 712         } else {
 713                 val2 = readhscx_3(sp->iobase, 0, HSCX_ISTA);
 714                 if (sp->debug)
 715                         printk(KERN_DEBUG "HSCX A ISTA %x\n", val2);
 716                 if (val & 0x04) {
 717                         if (sp->debug)
 718                                 printk(KERN_DEBUG "HSCX A interrupt %x\n",
 719                                        val2);
 720                         hscx_interrupt(sp, val2, 0);
 721                 }
 722         }
 723 /* ??? Why do that ^^^^^^^^^^^^^^^^^^^^^ different on Teles 16-3 ??? */
 724 
 725         val = READISAC(sp->membase, sp->iobase, ISAC_ISTA);
 726 
 727         if (sp->debug)
 728                 printk(KERN_DEBUG "ISAC interrupt %x\n", val);
 729 
 730         if (val & 0x80) {       /* RME */
 731 
 732                 r = READISAC(sp->membase, sp->iobase, ISAC_RSTA);
 733                 if ((r & 0x70) != 0x20) {
 734                         if (r & 0x40)
 735                                 printk(KERN_WARNING "Teles: ISAC RDO\n");
 736                         if (!r & 0x20)
 737                                 printk(KERN_WARNING "Teles: ISAC CRC error\n");
 738                         if (sp->rcvibh)
 739                                 BufPoolRelease(sp->rcvibh);
 740                         sp->rcvibh = NULL;
 741                         WRITEISAC(sp->membase, sp->iobase, ISAC_CMDR, 0x80);
 742                         goto afterRME;
 743                 }
 744                 if (!sp->rcvibh)
 745                         if (BufPoolGet(&(sp->rcvibh), &(sp->rbufpool),
 746                                        GFP_ATOMIC,
 747                                        (void *) 1, 3)) {
 748                                 printk(KERN_WARNING
 749                                        "ISAC RME out of buffers!\n");
 750                                 WRITEISAC(sp->membase, sp->iobase, 
 751                                           ISAC_CMDR, 0x80);
 752                                 goto afterRME;
 753                         } else
 754                                 sp->rcvptr = 0;
 755 
 756                 count = READISAC(sp->membase, sp->iobase, ISAC_RBCL) & 0x1f;
 757                 if (count == 0)
 758                         count = 32;
 759                 empty_fifo(sp, count);
 760                 sp->rcvibh->datasize = sp->rcvptr;
 761                 BufQueueLink(&(sp->rq), sp->rcvibh);
 762                 sp->rcvibh = NULL;
 763                 isac_sched_event(sp, ISAC_RCVBUFREADY);
 764         }
 765       afterRME:
 766         if (val & 0x40) {       /* RPF */
 767                 if (!sp->rcvibh)
 768                         if (BufPoolGet(&(sp->rcvibh), &(sp->rbufpool),
 769                                        GFP_ATOMIC,
 770                                        (void *) 1, 4)) {
 771                                 printk(KERN_WARNING
 772                                        "ISAC RME out of buffers!\n");
 773                                 WRITEISAC(sp->membase, sp->iobase,
 774                                           ISAC_CMDR, 0x80);
 775                                 goto afterRPF;
 776                         } else
 777                                 sp->rcvptr = 0;
 778                 empty_fifo(sp, 32);
 779         }
 780       afterRPF:
 781         if (val & 0x20) {
 782         }
 783         if (val & 0x10) {       /* XPR */
 784                 if (sp->xmtibh)
 785                         if (sp->xmtibh->datasize > sp->sendptr) {
 786                                 fill_fifo(sp);
 787                                 goto afterXPR;
 788                         } else {
 789                                 if (sp->releasebuf)
 790                                         BufPoolRelease(sp->xmtibh);
 791                                 sp->xmtibh = NULL;
 792                                 sp->sendptr = 0;
 793                         }
 794                 if (!BufQueueUnlink(&sp->xmtibh, &sp->sq)) {
 795                         sp->releasebuf = !0;
 796                         fill_fifo(sp);
 797                 } else
 798                         isac_sched_event(sp, ISAC_XMTBUFREADY);
 799         }
 800       afterXPR:
 801         if (val & 0x04) {       /* CISQ */
 802                 sp->ph_state = (READISAC(sp->membase, sp->iobase, ISAC_CIX0)
 803                                 >> 2) & 0xf;
 804                 printk(KERN_DEBUG "l1state %d\n", sp->ph_state);
 805                 isac_new_ph(sp);
 806         }
 807         if (sp->membase) {
 808                 writeisac_0(sp->membase, ISAC_MASK, 0xFF);
 809                 writehscx_0(sp->membase, 0, HSCX_MASK, 0xFF);
 810                 writehscx_0(sp->membase, 1, HSCX_MASK, 0xFF);
 811                 writeisac_0(sp->membase, ISAC_MASK, 0x0);
 812                 writehscx_0(sp->membase, 0, HSCX_MASK, 0x0);
 813                 writehscx_0(sp->membase, 1, HSCX_MASK, 0x0);
 814         } else {
 815                 writeisac_3(sp->iobase, ISAC_MASK, 0xFF);
 816                 writehscx_3(sp->iobase, 0, HSCX_MASK, 0xFF);
 817                 writehscx_3(sp->iobase, 1, HSCX_MASK, 0xFF);
 818                 writeisac_3(sp->iobase, ISAC_MASK, 0x0);
 819                 writehscx_3(sp->iobase, 0, HSCX_MASK, 0x0);
 820                 writehscx_3(sp->iobase, 1, HSCX_MASK, 0x0);
 821         }
 822 }
 823 
 824 /*
 825  * soft interrupt
 826  */
 827 
 828 static void
 829 act_ivated(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 830 {
 831         struct PStack  *st;
 832 
 833         st = sp->stlist;
 834         while (st) {
 835                 if (st->l1.act_state == 1) {
 836                         st->l1.act_state = 2;
 837                         st->l1.l1man(st, PH_ACTIVATE, NULL);
 838                 }
 839                 st = st->next;
 840         }
 841 }
 842 
 843 static void
 844 process_new_ph(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 845 {
 846         if (sp->ph_active == 5)
 847                 act_ivated(sp);
 848 }
 849 
 850 static void
 851 process_xmt(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 852 {
 853         struct PStack  *stptr;
 854 
 855         if (sp->xmtibh)
 856                 return;
 857 
 858         stptr = sp->stlist;
 859         while (stptr != NULL)
 860                 if (stptr->l1.requestpull) {
 861                         stptr->l1.requestpull = 0;
 862                         stptr->l1.l1l2(stptr, PH_PULL_ACK, NULL);
 863                         break;
 864                 } else
 865                         stptr = stptr->next;
 866 }
 867 
 868 static void
 869 process_rcv(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 870 {
 871         struct BufHeader *ibh, *cibh;
 872         struct PStack    *stptr;
 873         byte             *ptr;
 874         int              found, broadc;
 875         char             tmp[64];
 876 
 877         while (!BufQueueUnlink(&ibh, &sp->rq)) {
 878                 stptr = sp->stlist;
 879                 ptr = DATAPTR(ibh);
 880                 broadc = (ptr[1] >> 1) == 127;
 881 
 882                 if (broadc && sp->dlogflag && (!(ptr[0] >> 2)))
 883                         dlogframe(sp, ptr + 3, ibh->datasize - 3,
 884                                   "Q.931 frame network->user broadcast");
 885 
 886                 if (broadc) {
 887                         while (stptr != NULL) {
 888                                 if ((ptr[0] >> 2) == stptr->l2.sap)
 889                                         if (!BufPoolGet(&cibh, &sp->rbufpool, GFP_ATOMIC,
 890                                                         (void *) 1, 5)) {
 891                                                 memcpy(DATAPTR(cibh), DATAPTR(ibh), ibh->datasize);
 892                                                 cibh->datasize = ibh->datasize;
 893                                                 stptr->l1.l1l2(stptr, PH_DATA, cibh);
 894                                         } else
 895                                                 printk(KERN_WARNING "isdn broadcast buffer shortage\n");
 896                                 stptr = stptr->next;
 897                         }
 898                         BufPoolRelease(ibh);
 899                 } else {
 900                         found = 0;
 901                         while (stptr != NULL)
 902                                 if (((ptr[0] >> 2) == stptr->l2.sap) &&
 903                                     ((ptr[1] >> 1) == stptr->l2.tei)) {
 904                                         stptr->l1.l1l2(stptr, PH_DATA, ibh);
 905                                         found = !0;
 906                                         break;
 907                                 } else
 908                                         stptr = stptr->next;
 909                         if (!found) {
 910                                 /* BD 10.10.95
 911                                  * Print out D-Channel msg not processed
 912                                  * by isdn4linux
 913                                  */
 914 
 915                                 if ((!(ptr[0] >> 2)) && (!(ptr[2] & 0x01))) {
 916                                         sprintf(tmp, "Q.931 frame network->user with tei %d (not for us)", ptr[1] >> 1);
 917                                         dlogframe(sp, ptr + 4, ibh->datasize - 4, tmp);
 918                                 }
 919                                 BufPoolRelease(ibh);
 920                         }
 921                 }
 922 
 923         }
 924 
 925 }
 926 
 927 static void
 928 isac_bh(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 929 {
 930         if (!sp)
 931                 return;
 932 
 933         if (clear_bit(ISAC_PHCHANGE, &sp->event))
 934                 process_new_ph(sp);
 935         if (clear_bit(ISAC_RCVBUFREADY, &sp->event))
 936                 process_rcv(sp);
 937         if (clear_bit(ISAC_XMTBUFREADY, &sp->event))
 938                 process_xmt(sp);
 939 }
 940 
 941 
 942 static void
 943 hscx_process_xmt(struct HscxState *hsp)
     /* [previous][next][first][last][top][bottom][index][help] */
 944 {
 945         struct PStack  *st = hsp->st;
 946 
 947         if (hsp->xmtibh)
 948                 return;
 949 
 950         if (st->l1.requestpull) {
 951                 st->l1.requestpull = 0;
 952                 st->l1.l1l2(st, PH_PULL_ACK, NULL);
 953         }
 954         if (!hsp->active)
 955                 if ((!hsp->xmtibh) && (!hsp->sq.head))
 956                         modehscx(hsp, 0, 0);
 957 }
 958 
 959 static void
 960 hscx_process_rcv(struct HscxState *hsp)
     /* [previous][next][first][last][top][bottom][index][help] */
 961 {
 962         struct BufHeader *ibh;
 963 
 964 #ifdef DEBUG_MAGIC
 965         if (hsp->magic != 301270) {
 966                 printk(KERN_DEBUG "hscx_process_rcv magic not 301270\n");
 967                 return;
 968         }
 969 #endif
 970         while (!BufQueueUnlink(&ibh, &hsp->rq)) {
 971                 hsp->st->l1.l1l2(hsp->st, PH_DATA, ibh);
 972         }
 973 }
 974 
 975 static void
 976 hscx_bh(struct HscxState *hsp)
     /* [previous][next][first][last][top][bottom][index][help] */
 977 {
 978 
 979         if (!hsp)
 980                 return;
 981 
 982         if (clear_bit(HSCX_RCVBUFREADY, &hsp->event))
 983                 hscx_process_rcv(hsp);
 984         if (clear_bit(HSCX_XMTBUFREADY, &hsp->event))
 985                 hscx_process_xmt(hsp);
 986 
 987 }
 988 
 989 /*
 990  * interrupt stuff ends here
 991  */
 992 
 993 static void
 994 restart_ph(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 995 {
 996         switch (sp->ph_active) {
 997           case (0):
 998                   if (sp->ph_state == 6)
 999                           ph_command(sp, 0);
1000                   else
1001                           ph_command(sp, 1);
1002                   sp->ph_active = 1;
1003                   break;
1004         }
1005 }
1006 
1007 static void
1008 initisac(byte * cardmem, int iobase)
     /* [previous][next][first][last][top][bottom][index][help] */
1009 {
1010         if (cardmem) {
1011                 writeisac_0(cardmem, ISAC_MASK, 0xff);
1012                 writeisac_0(cardmem, ISAC_ADF2, 0x0);
1013                 writeisac_0(cardmem, ISAC_SPCR, 0xa);
1014                 writeisac_0(cardmem, ISAC_ADF1, 0x2);
1015                 writeisac_0(cardmem, ISAC_STCR, 0x70);
1016                 writeisac_0(cardmem, ISAC_MODE, 0xc9);
1017                 writeisac_0(cardmem, ISAC_CMDR, 0x41);
1018                 writeisac_0(cardmem, ISAC_CIX0, (1 << 2) | 3);
1019         } else {
1020                 writeisac_3(iobase, ISAC_MASK, 0xff);
1021                 writeisac_3(iobase, ISAC_ADF2, 0x80);
1022                 writeisac_3(iobase, ISAC_SQXR, 0x2f);
1023                 writeisac_3(iobase, ISAC_SPCR, 0x00);
1024                 writeisac_3(iobase, ISAC_ADF1, 0x02);
1025                 writeisac_3(iobase, ISAC_STCR, 0x70);
1026                 writeisac_3(iobase, ISAC_MODE, 0xc9);
1027                 writeisac_3(iobase, ISAC_TIMR, 0x00);
1028                 writeisac_3(iobase, ISAC_ADF1, 0x00);
1029                 writeisac_3(iobase, ISAC_CMDR, 0x41);
1030                 writeisac_3(iobase, ISAC_CIX0, (1 << 2) | 3);
1031         }
1032 }
1033 
1034 static int
1035 checkcard(int cardnr)
     /* [previous][next][first][last][top][bottom][index][help] */
1036 {
1037         int             timout;
1038         byte            cfval, val;
1039         struct IsdnCard *card = cards + cardnr;
1040 
1041         if (!card->iobase) {
1042                 if (card->membase) {
1043                         printk(KERN_NOTICE
1044                                "Teles 8 assumed, mem: %lx irq: %d proto: %s\n",
1045                                (long) card->membase, card->interrupt,
1046                                (card->protocol == ISDN_PTYPE_1TR6) ?
1047                                "1TR6" : "EDSS1");
1048                         printk(KERN_INFO "HSCX version A: %x B:%x\n",
1049                                readhscx_0(card->membase, 0, HSCX_VSTR) & 0xf,
1050                                readhscx_0(card->membase, 1, HSCX_VSTR) & 0xf);
1051                 }
1052         } else {
1053                 if (check_region(card->iobase, 8)) {
1054                         printk(KERN_WARNING
1055                                "teles: ports %x-%x already in use\n",
1056                                card->iobase,
1057                                card->iobase + 8 );
1058                         return -1;
1059                 }
1060                 switch (card->interrupt) {
1061                 case 2:
1062                         cfval = 0x00;
1063                         break;
1064                 case 3:
1065                         cfval = 0x02;
1066                         break;
1067                 case 4:
1068                         cfval = 0x04;
1069                         break;
1070                 case 5:
1071                         cfval = 0x06;
1072                         break;
1073                 case 10:
1074                         cfval = 0x08;
1075                         break;
1076                 case 11:
1077                         cfval = 0x0A;
1078                         break;
1079                 case 12:
1080                         cfval = 0x0C;
1081                         break;
1082                 case 15:
1083                         cfval = 0x0E;
1084                         break;
1085                 default:
1086                         cfval = 0x00;
1087                         break;
1088                 }
1089                 if (card->membase) {
1090                         cfval |= (((unsigned int) card->membase >> 9) & 0xF0);
1091                         
1092                         if (bytein(card->iobase + 0) != 0x51) {
1093                                 printk(KERN_INFO "XXX Byte at %x is %x\n",
1094                                        card->iobase + 0,
1095                                        bytein(card->iobase + 0));
1096                                 return -2;
1097                         }
1098                         if (bytein(card->iobase + 1) != 0x93) {
1099                                 printk(KERN_INFO "XXX Byte at %x is %x\n",
1100                                        card->iobase + 1,
1101                                        bytein(card->iobase + 1));
1102                                 return -2;
1103                         }
1104                         val = bytein(card->iobase + 2); /* 0x1e=without AB
1105                                                          * 0x1f=with AB
1106                                                          */
1107                         if (val != 0x1e && val != 0x1f) {
1108                                 printk(KERN_INFO "XXX Byte at %x is %x\n",
1109                                        card->iobase + 2,
1110                                        bytein(card->iobase + 2));
1111                                 return -2;
1112                         }
1113                 }
1114                 request_region(card->iobase, 8, "teles");
1115                 cli();
1116                 timout = jiffies + (HZ / 10) + 1;
1117                 byteout(card->iobase + 4, cfval);
1118                 sti();
1119                 while (jiffies <= timout);
1120                 
1121                 cli();
1122                 timout = jiffies + (HZ / 10) + 1;
1123                 byteout(card->iobase + 4, cfval | 1);
1124                 sti();
1125                 while (jiffies <= timout);
1126                 
1127                 if (card->membase)
1128                         printk(KERN_NOTICE
1129                                "Teles 16.0 found, io: %x mem: %lx irq: %d proto: %s\n",
1130                                card->iobase, (long) card->membase,
1131                                card->interrupt,
1132                                (card->protocol == ISDN_PTYPE_1TR6) ?
1133                                "1TR6" : "EDSS1");
1134                 else
1135                         printk(KERN_NOTICE
1136                                "Teles 16.3 found, io: %x irq: %d proto: %s\n",
1137                                card->iobase, card->interrupt,
1138                                (card->protocol == ISDN_PTYPE_1TR6) ?
1139                                "1TR6" : "EDSS1");
1140                 printk(KERN_INFO "HSCX version A:%x B:%x\n",
1141                        READHSCX(card->membase, card->iobase, 0,
1142                                 HSCX_VSTR) & 0xf,
1143                        READHSCX(card->membase, card->iobase, 1,
1144                                 HSCX_VSTR) & 0xf);
1145                 
1146         }
1147         if (card->membase) {
1148                 cli();
1149                 timout = jiffies + (HZ / 5) + 1;
1150                 *(byte *) (card->membase + 0x80) = 0;
1151                 sti();
1152                 while (jiffies <= timout);
1153                 
1154                 cli();
1155                 *(byte *) (card->membase + 0x80) = 1;
1156                 timout = jiffies + (HZ / 5) + 1;
1157                 sti();
1158                 while (jiffies <= timout);
1159         }
1160         return (0);
1161 }
1162 
1163 void
1164 modehscx(struct HscxState *hs, int mode,
     /* [previous][next][first][last][top][bottom][index][help] */
1165          int ichan)
1166 {
1167         struct IsdnCardState *sp = hs->sp;
1168         int             hscx = hs->hscx;
1169 
1170         printk(KERN_DEBUG "modehscx hscx %d mode %d ichan %d\n",
1171                hscx, mode, ichan);
1172 
1173         if (hscx == 0)
1174                 ichan = 1 - ichan;      /* raar maar waar... */
1175 
1176         if (sp->membase) {
1177                 writehscx_0(sp->membase, hscx, HSCX_CCR1, 0x85);
1178                 writehscx_0(sp->membase, hscx, HSCX_XAD1, 0xFF);
1179                 writehscx_0(sp->membase, hscx, HSCX_XAD2, 0xFF);
1180                 writehscx_0(sp->membase, hscx, HSCX_RAH2, 0xFF);
1181                 writehscx_0(sp->membase, hscx, HSCX_XBCH, 0x0);
1182 
1183                 switch (mode) {
1184                 case (0):
1185                         writehscx_0(sp->membase, hscx, HSCX_CCR2, 0x30);
1186                         writehscx_0(sp->membase, hscx, HSCX_TSAX, 0xff);
1187                         writehscx_0(sp->membase, hscx, HSCX_TSAR, 0xff);
1188                         writehscx_0(sp->membase, hscx, HSCX_XCCR, 7);
1189                         writehscx_0(sp->membase, hscx, HSCX_RCCR, 7);
1190                         writehscx_0(sp->membase, hscx, HSCX_MODE, 0x84);
1191                         break;
1192                 case (1):
1193                         if (ichan == 0) {
1194                                 writehscx_0(sp->membase, hscx, HSCX_CCR2, 0x30);
1195                                 writehscx_0(sp->membase, hscx, HSCX_TSAX, 0x7);
1196                                 writehscx_0(sp->membase, hscx, HSCX_TSAR, 0x7);
1197                                 writehscx_0(sp->membase, hscx, HSCX_XCCR, 7);
1198                                 writehscx_0(sp->membase, hscx, HSCX_RCCR, 7);
1199                         } else {
1200                                 writehscx_0(sp->membase, hscx, HSCX_CCR2, 0x30);
1201                                 writehscx_0(sp->membase, hscx, HSCX_TSAX, 0x3);
1202                                 writehscx_0(sp->membase, hscx, HSCX_TSAR, 0x3);
1203                                 writehscx_0(sp->membase, hscx, HSCX_XCCR, 7);
1204                                 writehscx_0(sp->membase, hscx, HSCX_RCCR, 7);
1205                         }
1206                         writehscx_0(sp->membase, hscx, HSCX_MODE, 0xe4);
1207                         writehscx_0(sp->membase, hscx, HSCX_CMDR, 0x41);
1208                         break;
1209                 case (2):
1210                         if (ichan == 0) {
1211                                 writehscx_0(sp->membase, hscx, HSCX_CCR2, 0x30);
1212                                 writehscx_0(sp->membase, hscx, HSCX_TSAX, 0x7);
1213                                 writehscx_0(sp->membase, hscx, HSCX_TSAR, 0x7);
1214                                 writehscx_0(sp->membase, hscx, HSCX_XCCR, 7);
1215                                 writehscx_0(sp->membase, hscx, HSCX_RCCR, 7);
1216                         } else {
1217                                 writehscx_0(sp->membase, hscx, HSCX_CCR2, 0x30);
1218                                 writehscx_0(sp->membase, hscx, HSCX_TSAX, 0x3);
1219                                 writehscx_0(sp->membase, hscx, HSCX_TSAR, 0x3);
1220                                 writehscx_0(sp->membase, hscx, HSCX_XCCR, 7);
1221                                 writehscx_0(sp->membase, hscx, HSCX_RCCR, 7);
1222                         }
1223                         writehscx_0(sp->membase, hscx, HSCX_MODE, 0x8c);
1224                         writehscx_0(sp->membase, hscx, HSCX_CMDR, 0x41);
1225                         break;
1226                 }
1227                 writehscx_0(sp->membase, hscx, HSCX_ISTA, 0x00);
1228         } else {
1229                 writehscx_3(sp->iobase, hscx, HSCX_CCR1, 0x85);
1230                 writehscx_3(sp->iobase, hscx, HSCX_XAD1, 0xFF);
1231                 writehscx_3(sp->iobase, hscx, HSCX_XAD2, 0xFF);
1232                 writehscx_3(sp->iobase, hscx, HSCX_RAH2, 0xFF);
1233                 writehscx_3(sp->iobase, hscx, HSCX_XBCH, 0x00);
1234                 writehscx_3(sp->iobase, hscx, HSCX_RLCR, 0x00);
1235                 
1236                 switch (mode) {
1237                 case (0):
1238                         writehscx_3(sp->iobase, hscx, HSCX_CCR2, 0x30);
1239                         writehscx_3(sp->iobase, hscx, HSCX_TSAX, 0xff);
1240                         writehscx_3(sp->iobase, hscx, HSCX_TSAR, 0xff);
1241                         writehscx_3(sp->iobase, hscx, HSCX_XCCR, 7);
1242                         writehscx_3(sp->iobase, hscx, HSCX_RCCR, 7);
1243                         writehscx_3(sp->iobase, hscx, HSCX_MODE, 0x84);
1244                         break;
1245                 case (1):
1246                         if (ichan == 0) {
1247                                 writehscx_3(sp->iobase, hscx, HSCX_CCR2, 0x30);
1248                                 writehscx_3(sp->iobase, hscx, HSCX_TSAX, 0x2f);
1249                                 writehscx_3(sp->iobase, hscx, HSCX_TSAR, 0x2f);
1250                                 writehscx_3(sp->iobase, hscx, HSCX_XCCR, 7);
1251                                 writehscx_3(sp->iobase, hscx, HSCX_RCCR, 7);
1252                         } else {
1253                                 writehscx_3(sp->iobase, hscx, HSCX_CCR2, 0x30);
1254                                 writehscx_3(sp->iobase, hscx, HSCX_TSAX, 0x3);
1255                                 writehscx_3(sp->iobase, hscx, HSCX_TSAR, 0x3);
1256                                 writehscx_3(sp->iobase, hscx, HSCX_XCCR, 7);
1257                                 writehscx_3(sp->iobase, hscx, HSCX_RCCR, 7);
1258                         }
1259                         writehscx_3(sp->iobase, hscx, HSCX_MODE, 0xe4);
1260                         writehscx_3(sp->iobase, hscx, HSCX_CMDR, 0x41);
1261                         break;
1262                 case (2):
1263                         if (ichan == 0) {
1264                                 writehscx_3(sp->iobase, hscx, HSCX_CCR2, 0x30);
1265                                 writehscx_3(sp->iobase, hscx, HSCX_TSAX, 0x2f);
1266                                 writehscx_3(sp->iobase, hscx, HSCX_TSAR, 0x2f);
1267                                 writehscx_3(sp->iobase, hscx, HSCX_XCCR, 7);
1268                                 writehscx_3(sp->iobase, hscx, HSCX_RCCR, 7);
1269                         } else {
1270                                 writehscx_3(sp->iobase, hscx, HSCX_CCR2, 0x30);
1271                                 writehscx_3(sp->iobase, hscx, HSCX_TSAX, 0x3);
1272                                 writehscx_3(sp->iobase, hscx, HSCX_TSAR, 0x3);
1273                                 writehscx_3(sp->iobase, hscx, HSCX_XCCR, 7);
1274                                 writehscx_3(sp->iobase, hscx, HSCX_RCCR, 7);
1275                         }
1276                         writehscx_3(sp->iobase, hscx, HSCX_MODE, 0x8c);
1277                         writehscx_3(sp->iobase, hscx, HSCX_CMDR, 0x41);
1278                         break;
1279                 }
1280                 writehscx_3(sp->iobase, hscx, HSCX_ISTA, 0x00);
1281         }
1282 }
1283 
1284 void
1285 teles_addlist(struct IsdnCardState *sp,
     /* [previous][next][first][last][top][bottom][index][help] */
1286               struct PStack *st)
1287 {
1288         st->next = sp->stlist;
1289         sp->stlist = st;
1290 }
1291 
1292 void
1293 teles_rmlist(struct IsdnCardState *sp,
     /* [previous][next][first][last][top][bottom][index][help] */
1294              struct PStack *st)
1295 {
1296         struct PStack  *p;
1297 
1298         if (sp->stlist == st)
1299                 sp->stlist = st->next;
1300         else {
1301                 p = sp->stlist;
1302                 while (p)
1303                         if (p->next == st) {
1304                                 p->next = st->next;
1305                                 return;
1306                         } else
1307                                 p = p->next;
1308         }
1309 }
1310 
1311 
1312 static void
1313 teles_l2l1(struct PStack *st, int pr,
     /* [previous][next][first][last][top][bottom][index][help] */
1314            struct BufHeader *ibh)
1315 {
1316         struct IsdnCardState *sp = (struct IsdnCardState *)
1317         st->l1.hardware;
1318 
1319 
1320         switch (pr) {
1321           case (PH_DATA):
1322                   if (sp->xmtibh)
1323                           BufQueueLink(&sp->sq, ibh);
1324                   else {
1325                           sp->xmtibh = ibh;
1326                           sp->sendptr = 0;
1327                           sp->releasebuf = !0;
1328                           fill_fifo(sp);
1329                   }
1330                   break;
1331           case (PH_DATA_PULLED):
1332                   if (sp->xmtibh) {
1333                           printk(KERN_DEBUG "teles_l2l1: this shouldn't happen\n");
1334                           break;
1335                   }
1336                   sp->xmtibh = ibh;
1337                   sp->sendptr = 0;
1338                   sp->releasebuf = 0;
1339                   fill_fifo(sp);
1340                   break;
1341           case (PH_REQUEST_PULL):
1342                   if (!sp->xmtibh) {
1343                           st->l1.requestpull = 0;
1344                           st->l1.l1l2(st, PH_PULL_ACK, NULL);
1345                   } else
1346                           st->l1.requestpull = !0;
1347                   break;
1348         }
1349 }
1350 
1351 static void
1352 check_ph_act(struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
1353 {
1354         struct PStack  *st = sp->stlist;
1355 
1356         while (st) {
1357                 if (st->l1.act_state)
1358                         return;
1359                 st = st->next;
1360         }
1361         sp->ph_active = 0;
1362 }
1363 
1364 static void
1365 teles_manl1(struct PStack *st, int pr,
     /* [previous][next][first][last][top][bottom][index][help] */
1366             void *arg)
1367 {
1368         struct IsdnCardState *sp = (struct IsdnCardState *)
1369         st->l1.hardware;
1370         long            flags;
1371 
1372         switch (pr) {
1373           case (PH_ACTIVATE):
1374                   save_flags(flags);
1375                   cli();
1376                   if (sp->ph_active == 5) {
1377                           st->l1.act_state = 2;
1378                           restore_flags(flags);
1379                           st->l1.l1man(st, PH_ACTIVATE, NULL);
1380                   } else {
1381                           st->l1.act_state = 1;
1382                           if (sp->ph_active == 0)
1383                                   restart_ph(sp);
1384                           restore_flags(flags);
1385                   }
1386                   break;
1387           case (PH_DEACTIVATE):
1388                   st->l1.act_state = 0;
1389                   check_ph_act(sp);
1390                   break;
1391         }
1392 }
1393 
1394 static void
1395 teles_l2l1discardq(struct PStack *st, int pr,
     /* [previous][next][first][last][top][bottom][index][help] */
1396                    void *heldby, int releasetoo)
1397 {
1398         struct IsdnCardState *sp = (struct IsdnCardState *) st->l1.hardware;
1399 
1400 #ifdef DEBUG_MAGIC
1401         if (sp->magic != 301271) {
1402                 printk(KERN_DEBUG "isac_discardq magic not 301271\n");
1403                 return;
1404         }
1405 #endif
1406 
1407         BufQueueDiscard(&sp->sq, pr, heldby, releasetoo);
1408 }
1409 
1410 void
1411 setstack_teles(struct PStack *st, struct IsdnCardState *sp)
     /* [previous][next][first][last][top][bottom][index][help] */
1412 {
1413         st->l1.hardware = sp;
1414         st->l1.sbufpool = &(sp->sbufpool);
1415         st->l1.rbufpool = &(sp->rbufpool);
1416         st->l1.smallpool = &(sp->smallpool);
1417         st->protocol = sp->teistack->protocol;
1418 
1419         setstack_tei(st);
1420 
1421         st->l1.stlistp = &(sp->stlist);
1422         st->l1.act_state = 0;
1423         st->l2.l2l1 = teles_l2l1;
1424         st->l2.l2l1discardq = teles_l2l1discardq;
1425         st->ma.manl1 = teles_manl1;
1426         st->l1.requestpull = 0;
1427 }
1428 
1429 void
1430 init_hscxstate(struct IsdnCardState *sp,
     /* [previous][next][first][last][top][bottom][index][help] */
1431                int hscx)
1432 {
1433         struct HscxState *hsp = sp->hs + hscx;
1434 
1435         hsp->sp = sp;
1436         hsp->hscx = hscx;
1437         hsp->membase = sp->membase;
1438         hsp->iobase = sp->iobase;
1439 
1440         hsp->tqueue.next = 0;
1441         hsp->tqueue.sync = 0;
1442         hsp->tqueue.routine = (void *) (void *) hscx_bh;
1443         hsp->tqueue.data = hsp;
1444 
1445         hsp->inuse = 0;
1446         hsp->init = 0;
1447         hsp->active = 0;
1448 
1449 #ifdef DEBUG_MAGIC
1450         hsp->magic = 301270;
1451 #endif
1452 }
1453 
1454 void
1455 initcard(int cardnr)
     /* [previous][next][first][last][top][bottom][index][help] */
1456 {
1457         struct IsdnCardState *sp;
1458         struct IsdnCard *card = cards + cardnr;
1459 
1460         sp = (struct IsdnCardState *)
1461             Smalloc(sizeof(struct IsdnCardState), GFP_KERNEL,
1462                     "struct IsdnCardState");
1463 
1464         sp->membase = card->membase;
1465         sp->iobase = card->iobase;
1466         sp->cardnr = cardnr;
1467 
1468         BufPoolInit(&sp->sbufpool, ISAC_SBUF_ORDER, ISAC_SBUF_BPPS,
1469                     ISAC_SBUF_MAXPAGES);
1470         BufPoolInit(&sp->rbufpool, ISAC_RBUF_ORDER, ISAC_RBUF_BPPS,
1471                     ISAC_RBUF_MAXPAGES);
1472         BufPoolInit(&sp->smallpool, ISAC_SMALLBUF_ORDER, ISAC_SMALLBUF_BPPS,
1473                     ISAC_SMALLBUF_MAXPAGES);
1474 
1475         sp->dlogspace = Smalloc(4096, GFP_KERNEL, "dlogspace");
1476 
1477         initisac(card->membase, card->iobase);
1478 
1479         sp->rcvibh = NULL;
1480         sp->rcvptr = 0;
1481         sp->xmtibh = NULL;
1482         sp->sendptr = 0;
1483         sp->event = 0;
1484         sp->tqueue.next = 0;
1485         sp->tqueue.sync = 0;
1486         sp->tqueue.routine = (void *) (void *) isac_bh;
1487         sp->tqueue.data = sp;
1488 
1489         BufQueueInit(&sp->rq);
1490         BufQueueInit(&sp->sq);
1491 
1492         sp->stlist = NULL;
1493 
1494         sp->ph_active = 0;
1495 
1496         sp->dlogflag = 0;
1497         sp->debug = 0;
1498 
1499         sp->releasebuf = 0;
1500 #ifdef DEBUG_MAGIC
1501         sp->magic = 301271;
1502 #endif
1503 
1504         cards[sp->cardnr].sp = sp;
1505 
1506         init_hscxstate(sp, 0);
1507         init_hscxstate(sp, 1);
1508 
1509         modehscx(sp->hs, 0, 0);
1510         modehscx(sp->hs + 1, 0, 0);
1511 
1512         WRITEISAC(sp->membase, sp->iobase, ISAC_MASK, 0x0);
1513 }
1514 
1515 static int
1516 get_irq(int cardnr)
     /* [previous][next][first][last][top][bottom][index][help] */
1517 {
1518         struct IsdnCard *card = cards + cardnr;
1519         long            flags;
1520 
1521         save_flags(flags);
1522         cli();
1523         if (request_irq(card->interrupt, &teles_interrupt,
1524                         SA_INTERRUPT, "teles")) {
1525                 printk(KERN_WARNING "Teles couldn't get interrupt %d\n",
1526                        card->interrupt);
1527                 restore_flags(flags);
1528                 return (!0);
1529         }
1530         irq2dev_map[card->interrupt] = (void *) card->sp;
1531         restore_flags(flags);
1532         return (0);
1533 }
1534 
1535 static void
1536 release_irq(int cardnr)
     /* [previous][next][first][last][top][bottom][index][help] */
1537 {
1538         struct IsdnCard *card = cards + cardnr;
1539 
1540         irq2dev_map[card->interrupt] = NULL;
1541         free_irq(card->interrupt);
1542 }
1543 
1544 void
1545 close_hscxstate(struct HscxState *hs)
     /* [previous][next][first][last][top][bottom][index][help] */
1546 {
1547         modehscx(hs, 0, 0);
1548         hs->inuse = 0;
1549 
1550         if (hs->init) {
1551                 BufPoolFree(&hs->smallpool);
1552                 BufPoolFree(&hs->rbufpool);
1553                 BufPoolFree(&hs->sbufpool);
1554         }
1555         hs->init = 0;
1556 }
1557 
1558 void
1559 closecard(int cardnr)
     /* [previous][next][first][last][top][bottom][index][help] */
1560 {
1561         struct IsdnCardState *sp = cards[cardnr].sp;
1562 
1563         cards[cardnr].sp = NULL;
1564 
1565         Sfree(sp->dlogspace);
1566 
1567         BufPoolFree(&sp->smallpool);
1568         BufPoolFree(&sp->rbufpool);
1569         BufPoolFree(&sp->sbufpool);
1570 
1571         close_hscxstate(sp->hs + 1);
1572         close_hscxstate(sp->hs);
1573 
1574         if (cards[cardnr].iobase)
1575                 release_region(cards[cardnr].iobase, 8);
1576 
1577         Sfree((void *) sp);
1578 }
1579 
1580 void
1581 teles_shiftcards(int idx)
     /* [previous][next][first][last][top][bottom][index][help] */
1582 {
1583         int i;
1584 
1585         for (i = idx; i < 15; i++)
1586                 memcpy(&cards[i],&cards[i+1],sizeof(cards[i]));
1587 }
1588 
1589 int
1590 teles_inithardware(void)
     /* [previous][next][first][last][top][bottom][index][help] */
1591 {
1592         int             foundcards = 0;
1593         int             i = 0;
1594 
1595         while (i < nrcards) {
1596                 if (!cards[i].protocol)
1597                         break;
1598                 switch (checkcard(i)) {
1599                   case (0):
1600                           initcard(i);
1601                           if (get_irq(i)) {
1602                                   closecard(i);
1603                                   teles_shiftcards(i);
1604                           } else {
1605                                   foundcards++;
1606                                   i++;
1607                           }
1608                           break;
1609                   case (-1):
1610                           teles_shiftcards(i);
1611                           break;
1612                   case (-2):
1613                           release_region(cards[i].iobase, 8);
1614                           teles_shiftcards(i);
1615                           printk(KERN_WARNING "NO Teles card found at 0x%x!\n", cards[i].iobase);
1616                           break;
1617                 }
1618         }
1619         return foundcards;
1620 }
1621 
1622 void
1623 teles_closehardware(void)
     /* [previous][next][first][last][top][bottom][index][help] */
1624 {
1625         int             i;
1626 
1627         for (i = 0; i < nrcards; i++)
1628                 if (cards[i].sp) {
1629                         release_irq(i);
1630                         closecard(i);
1631                 }
1632 }
1633 
1634 static void
1635 hscx_l2l1(struct PStack *st, int pr,
     /* [previous][next][first][last][top][bottom][index][help] */
1636           struct BufHeader *ibh)
1637 {
1638         struct IsdnCardState *sp = (struct IsdnCardState *)
1639         st->l1.hardware;
1640         struct HscxState *hsp = sp->hs + st->l1.hscx;
1641 
1642         switch (pr) {
1643           case (PH_DATA):
1644                   if (hsp->xmtibh)
1645                           BufQueueLink(&hsp->sq, ibh);
1646                   else {
1647                           hsp->xmtibh = ibh;
1648                           hsp->sendptr = 0;
1649                           hsp->releasebuf = !0;
1650                           hscx_fill_fifo(hsp);
1651                   }
1652                   break;
1653           case (PH_DATA_PULLED):
1654                   if (hsp->xmtibh) {
1655                           printk(KERN_DEBUG "hscx_l2l1: this shouldn't happen\n");
1656                           break;
1657                   }
1658                   hsp->xmtibh = ibh;
1659                   hsp->sendptr = 0;
1660                   hsp->releasebuf = 0;
1661                   hscx_fill_fifo(hsp);
1662                   break;
1663           case (PH_REQUEST_PULL):
1664                   if (!hsp->xmtibh) {
1665                           st->l1.requestpull = 0;
1666                           st->l1.l1l2(st, PH_PULL_ACK, NULL);
1667                   } else
1668                           st->l1.requestpull = !0;
1669                   break;
1670         }
1671 
1672 }
1673 
1674 extern struct IsdnBuffers *tracebuf;
1675 
1676 static void
1677 hscx_l2l1discardq(struct PStack *st, int pr, void *heldby,
     /* [previous][next][first][last][top][bottom][index][help] */
1678                   int releasetoo)
1679 {
1680         struct IsdnCardState *sp = (struct IsdnCardState *)
1681         st->l1.hardware;
1682         struct HscxState *hsp = sp->hs + st->l1.hscx;
1683 
1684 #ifdef DEBUG_MAGIC
1685         if (hsp->magic != 301270) {
1686                 printk(KERN_DEBUG "hscx_discardq magic not 301270\n");
1687                 return;
1688         }
1689 #endif
1690 
1691         BufQueueDiscard(&hsp->sq, pr, heldby, releasetoo);
1692 }
1693 
1694 static int
1695 open_hscxstate(struct IsdnCardState *sp,
     /* [previous][next][first][last][top][bottom][index][help] */
1696                int hscx)
1697 {
1698         struct HscxState *hsp = sp->hs + hscx;
1699 
1700         if (!hsp->init) {
1701                 BufPoolInit(&hsp->sbufpool, HSCX_SBUF_ORDER, HSCX_SBUF_BPPS,
1702                             HSCX_SBUF_MAXPAGES);
1703                 BufPoolInit(&hsp->rbufpool, HSCX_RBUF_ORDER, HSCX_RBUF_BPPS,
1704                             HSCX_RBUF_MAXPAGES);
1705                 BufPoolInit(&hsp->smallpool, HSCX_SMALLBUF_ORDER, HSCX_SMALLBUF_BPPS,
1706                             HSCX_SMALLBUF_MAXPAGES);
1707         }
1708         hsp->init = !0;
1709 
1710         BufQueueInit(&hsp->rq);
1711         BufQueueInit(&hsp->sq);
1712 
1713         hsp->releasebuf = 0;
1714         hsp->rcvibh = NULL;
1715         hsp->xmtibh = NULL;
1716         hsp->rcvptr = 0;
1717         hsp->sendptr = 0;
1718         hsp->event = 0;
1719         return (0);
1720 }
1721 
1722 static void
1723 hscx_manl1(struct PStack *st, int pr,
     /* [previous][next][first][last][top][bottom][index][help] */
1724            void *arg)
1725 {
1726         struct IsdnCardState *sp = (struct IsdnCardState *)
1727         st->l1.hardware;
1728         struct HscxState *hsp = sp->hs + st->l1.hscx;
1729 
1730         switch (pr) {
1731           case (PH_ACTIVATE):
1732                   hsp->active = !0;
1733                   modehscx(hsp, st->l1.hscxmode, st->l1.hscxchannel);
1734                   st->l1.l1man(st, PH_ACTIVATE, NULL);
1735                   break;
1736           case (PH_DEACTIVATE):
1737                   if (!hsp->xmtibh)
1738                           modehscx(hsp, 0, 0);
1739 
1740                   hsp->active = 0;
1741                   break;
1742         }
1743 }
1744 
1745 int
1746 setstack_hscx(struct PStack *st, struct HscxState *hs)
     /* [previous][next][first][last][top][bottom][index][help] */
1747 {
1748         if (open_hscxstate(st->l1.hardware, hs->hscx))
1749                 return (-1);
1750 
1751         st->l1.hscx = hs->hscx;
1752         st->l2.l2l1 = hscx_l2l1;
1753         st->ma.manl1 = hscx_manl1;
1754         st->l2.l2l1discardq = hscx_l2l1discardq;
1755 
1756         st->l1.sbufpool = &hs->sbufpool;
1757         st->l1.rbufpool = &hs->rbufpool;
1758         st->l1.smallpool = &hs->smallpool;
1759         st->l1.act_state = 0;
1760         st->l1.requestpull = 0;
1761 
1762         hs->st = st;
1763         return (0);
1764 }
1765 
1766 void
1767 teles_reportcard(int cardnr)
     /* [previous][next][first][last][top][bottom][index][help] */
1768 {
1769 
1770         printk(KERN_DEBUG "teles_reportcard\n");
1771 
1772 }

/* [previous][next][first][last][top][bottom][index][help] */