home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / kernel-s / v1.2 / patch-1.008 / patch-1.2.5
Text File  |  1995-04-12  |  60KB  |  1,935 lines

  1. diff -u --recursive --new-file v1.2.4/linux/Makefile linux/Makefile
  2. --- v1.2.4/linux/Makefile    Sun Apr  9 11:59:55 1995
  3. +++ linux/Makefile    Wed Apr 12 15:25:52 1995
  4. @@ -1,6 +1,6 @@
  5.  VERSION = 1
  6.  PATCHLEVEL = 2
  7. -SUBLEVEL = 4
  8. +SUBLEVEL = 5
  9.  
  10.  ARCH = i386
  11.  
  12. diff -u --recursive --new-file v1.2.4/linux/README linux/README
  13. --- v1.2.4/linux/README    Sun Apr  9 11:59:55 1995
  14. +++ linux/README    Wed Apr 12 08:12:14 1995
  15. @@ -124,15 +124,15 @@
  16.     floppy. 
  17.  
  18.     If you boot Linux from the hard drive, chances are you use LILO which
  19. -   uses the kernel image as specified in the file /etc/lilo/config.  The
  20. +   uses the kernel image as specified in the file /etc/lilo.conf.  The
  21.     kernel image file is usually /vmlinuz, or /zImage, or /etc/zImage. 
  22.     To use the new kernel, copy the new image over the old one (save a
  23.     backup of the original!).  Then, you MUST RERUN LILO to update the
  24.     loading map!! If you don't, you won't be able to boot the new kernel
  25.     image. 
  26.  
  27. -   Reinstalling LILO is usually a matter of running /etc/lilo/install. 
  28. -   You may wish to edit /etc/lilo/config to specify an entry for your
  29. +   Reinstalling LILO is usually a matter of running /sbin/lilo. 
  30. +   You may wish to edit /etc/lilo.conf to specify an entry for your
  31.     old kernel image (say, /vmlinux.old) in case the new one does not
  32.     work.  See the LILO docs for more information. 
  33.  
  34. diff -u --recursive --new-file v1.2.4/linux/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
  35. --- v1.2.4/linux/drivers/block/ll_rw_blk.c    Sun Apr  9 11:59:56 1995
  36. +++ linux/drivers/block/ll_rw_blk.c    Mon Apr 10 11:22:45 1995
  37. @@ -169,20 +169,40 @@
  38.  
  39.  /*
  40.   * wait until a free request in the first N entries is available.
  41. - * NOTE: interrupts must be disabled on the way in, and will still
  42. - *       be disabled on the way out.
  43.   */
  44. -static inline struct request * get_request_wait(int n, int dev)
  45. +static struct request * __get_request_wait(int n, int dev)
  46.  {
  47.      register struct request *req;
  48. +    struct wait_queue wait = { current, NULL };
  49.  
  50. -    while ((req = get_request(n, dev)) == NULL) {
  51. +    add_wait_queue(&wait_for_request, &wait);
  52. +    for (;;) {
  53.          unplug_device(MAJOR(dev)+blk_dev);
  54. -        sleep_on(&wait_for_request);
  55. +        current->state = TASK_UNINTERRUPTIBLE;
  56. +        cli();
  57. +        req = get_request(n, dev);
  58. +        sti();
  59. +        if (req)
  60. +            break;
  61. +        schedule();
  62.      }
  63. +    remove_wait_queue(&wait_for_request, &wait);
  64. +    current->state = TASK_RUNNING;
  65.      return req;
  66.  }
  67.  
  68. +static inline struct request * get_request_wait(int n, int dev)
  69. +{
  70. +    register struct request *req;
  71. +
  72. +    cli();
  73. +    req = get_request(n, dev);
  74. +    sti();
  75. +    if (req)
  76. +        return req;
  77. +    return __get_request_wait(n, dev);
  78. +}
  79. +
  80.  /* RO fail safe mechanism */
  81.  
  82.  static long ro_bits[MAX_BLKDEV][8];
  83. @@ -303,9 +323,7 @@
  84.   */
  85.      max_req = (rw == READ) ? NR_REQUEST : ((NR_REQUEST*2)/3);
  86.  
  87. -/* big loop: look for a free request. */
  88. -
  89. -repeat:
  90. +/* look for a free request. */
  91.      cli();
  92.  
  93.  /* The scsi disk drivers and the IDE driver completely remove the request
  94. @@ -363,23 +381,17 @@
  95.  
  96.  /* find an unused request. */
  97.      req = get_request(max_req, bh->b_dev);
  98. +    sti();
  99.  
  100. -/* if no request available: if rw_ahead, forget it; otherwise try again. */
  101. -    if (! req) {
  102. +/* if no request available: if rw_ahead, forget it; otherwise try again blocking.. */
  103. +    if (!req) {
  104.          if (rw_ahead) {
  105. -            sti();
  106.              unlock_buffer(bh);
  107.              return;
  108.          }
  109. -        unplug_device(major+blk_dev);
  110. -        sleep_on(&wait_for_request);
  111. -        sti();
  112. -        goto repeat;
  113. +        req = __get_request_wait(max_req, bh->b_dev);
  114.      }
  115.  
  116. -/* we found a request. */
  117. -    sti();
  118. -
  119.  /* fill up the request-info, and add it to the queue */
  120.      req->cmd = rw;
  121.      req->errors = 0;
  122. @@ -410,9 +422,7 @@
  123.          printk("Can't page to read-only device 0x%X\n",dev);
  124.          return;
  125.      }
  126. -    cli();
  127.      req = get_request_wait(NR_REQUEST, dev);
  128. -    sti();
  129.  /* fill up the request-info, and add it to the queue */
  130.      req->cmd = rw;
  131.      req->errors = 0;
  132. @@ -533,9 +543,7 @@
  133.  
  134.      for (i=0; i<nb; i++, buf += buffersize)
  135.      {
  136. -        cli();
  137.          req = get_request_wait(NR_REQUEST, dev);
  138. -        sti();
  139.          req->cmd = rw;
  140.          req->errors = 0;
  141.          req->sector = (b[i] * buffersize) >> 9;
  142. diff -u --recursive --new-file v1.2.4/linux/drivers/char/ChangeLog linux/drivers/char/ChangeLog
  143. --- v1.2.4/linux/drivers/char/ChangeLog    Thu Mar  9 20:37:34 1995
  144. +++ linux/drivers/char/ChangeLog    Wed Apr 12 21:24:17 1995
  145. @@ -1,3 +1,11 @@
  146. +Wed Apr 12 08:06:16 1995  Theodore Y. Ts'o  <tytso@localhost>
  147. +
  148. +    * serial.c (do_serial_hangup, do_softint, check_modem_status,
  149. +        rs_init):  Hangups are now scheduled via a separate tqueue
  150. +        structure in the async_struct structure, tqueue_hangup.
  151. +        This task is pushed on to the tq_schedule queue, so that
  152. +        it is processed syncronously by the scheduler.
  153. +
  154.  Sat Feb 18 12:13:51 1995  Theodore Y. Ts'o  (tytso@rt-11)
  155.  
  156.      * tty_io.c (disassociate_ctty, tty_open, tty_ioctl): Clear
  157. diff -u --recursive --new-file v1.2.4/linux/drivers/char/serial.c linux/drivers/char/serial.c
  158. --- v1.2.4/linux/drivers/char/serial.c    Thu Feb 23 13:31:40 1995
  159. +++ linux/drivers/char/serial.c    Wed Apr 12 21:24:17 1995
  160. @@ -468,7 +468,8 @@
  161.  #ifdef SERIAL_DEBUG_OPEN
  162.              printk("scheduling hangup...");
  163.  #endif
  164. -            rs_sched_event(info, RS_EVENT_HANGUP);
  165. +            queue_task_irq_off(&info->tqueue_hangup,
  166. +                       &tq_scheduler);
  167.          }
  168.      }
  169.      if (info->flags & ASYNC_CTS_FLOW) {
  170. @@ -722,12 +723,6 @@
  171.      if (!tty)
  172.          return;
  173.  
  174. -    if (clear_bit(RS_EVENT_HANGUP, &info->event)) {
  175. -        tty_hangup(tty);
  176. -        wake_up_interruptible(&info->open_wait);
  177. -        info->flags &= ~(ASYNC_NORMAL_ACTIVE|
  178. -                 ASYNC_CALLOUT_ACTIVE);
  179. -    }
  180.      if (clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
  181.          if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
  182.              tty->ldisc.write_wakeup)
  183. @@ -737,6 +732,28 @@
  184.  }
  185.  
  186.  /*
  187. + * This routine is called from the scheduler tqueue when the interrupt
  188. + * routine has signalled that a hangup has occured.  The path of
  189. + * hangup processing is:
  190. + *
  191. + *     serial interrupt routine -> (scheduler tqueue) ->
  192. + *     do_serial_hangup() -> tty->hangup() -> rs_hangup()
  193. + * 
  194. + */
  195. +static void do_serial_hangup(void *private_)
  196. +{
  197. +    struct async_struct    *info = (struct async_struct *) private_;
  198. +    struct tty_struct    *tty;
  199. +    
  200. +    tty = info->tty;
  201. +    if (!tty)
  202. +        return;
  203. +
  204. +    tty_hangup(tty);
  205. +}
  206. +
  207. +
  208. +/*
  209.   * This subroutine is called when the RS_TIMER goes off.  It is used
  210.   * by the serial driver to handle ports that do not have an interrupt
  211.   * (irq=0).  This doesn't work very well for 16450's, but gives barely
  212. @@ -2615,6 +2632,8 @@
  213.          info->blocked_open = 0;
  214.          info->tqueue.routine = do_softint;
  215.          info->tqueue.data = info;
  216. +        info->tqueue_hangup.routine = do_serial_hangup;
  217. +        info->tqueue_hangup.data = info;
  218.          info->callout_termios =callout_driver.init_termios;
  219.          info->normal_termios = serial_driver.init_termios;
  220.          info->open_wait = 0;
  221. diff -u --recursive --new-file v1.2.4/linux/drivers/net/lance.c linux/drivers/net/lance.c
  222. --- v1.2.4/linux/drivers/net/lance.c    Fri Jan 20 11:34:39 1995
  223. +++ linux/drivers/net/lance.c    Sun Apr  9 10:38:29 1995
  224. @@ -913,7 +913,7 @@
  225.              lp->rx_ring[entry].base &= 0x03ffffff;
  226.          } else {
  227.              /* Malloc up new buffer, compatible with net-2e. */
  228. -            short pkt_len = lp->rx_ring[entry].msg_length;
  229. +            short pkt_len = (lp->rx_ring[entry].msg_length & 0xfff)-4;
  230.              struct sk_buff *skb;
  231.  
  232.              skb = alloc_skb(pkt_len, GFP_ATOMIC);
  233. diff -u --recursive --new-file v1.2.4/linux/drivers/net/ne.c linux/drivers/net/ne.c
  234. --- v1.2.4/linux/drivers/net/ne.c    Sun Apr  9 11:59:56 1995
  235. +++ linux/drivers/net/ne.c    Wed Apr 12 13:16:11 1995
  236. @@ -1,3 +1,4 @@
  237. +#define rw_bugfix
  238.  /* ne.c: A general non-shared-memory NS8390 ethernet driver for linux. */
  239.  /*
  240.      Written 1992-94 by Donald Becker.
  241. @@ -375,6 +376,7 @@
  242.  {
  243.      int retries = 0;
  244.      int nic_base = NE_BASE;
  245. +    unsigned long flags;
  246.  
  247.      /* Round the count up for word writes.  Do we need to do this?
  248.         What effect will an odd byte count have on the 8390?
  249. @@ -415,8 +417,13 @@
  250.      race condition will munge the remote byte count values, and then
  251.      the ne2k will hang the machine by holding I/O CH RDY because it
  252.      expects more data. Hopefully fixes the lockups. -- Paul Gortmaker.
  253. +
  254. +    Use save_flags/cli/restore_flags rather than cli/sti to avoid risk
  255. +    of accidentally enabling interrupts which were disabled when we
  256. +    were entered.   Dave Platt <dplatt@3do.com>
  257.      */
  258.  
  259. +    save_flags(flags);
  260.      cli();
  261.      outb_p(count & 0xff, nic_base + EN0_RCNTLO);
  262.      outb_p(count >> 8,   nic_base + EN0_RCNTHI);
  263. @@ -429,7 +436,7 @@
  264.      } else {
  265.      outsb(NE_BASE + NE_DATAPORT, buf, count);
  266.      }
  267. -    sti();
  268. +    restore_flags(flags);
  269.  
  270.  #ifdef CONFIG_NE_SANITY
  271.      /* This was for the ALPHA version only, but enough people have
  272. diff -u --recursive --new-file v1.2.4/linux/drivers/net/wavelan.c linux/drivers/net/wavelan.c
  273. --- v1.2.4/linux/drivers/net/wavelan.c    Wed Feb 22 16:25:04 1995
  274. +++ linux/drivers/net/wavelan.c    Tue Apr 11 07:45:38 1995
  275. @@ -71,7 +71,7 @@
  276.  
  277.  extern int        wavelan_probe(device *);    /* See Space.c */
  278.  
  279. -static char        *version    = "wavelan.c:v6 22/2/95\n";
  280. +static char        *version    = "wavelan.c:v7 95/4/8\n";
  281.  
  282.  /*
  283.   * Entry point forward declarations.
  284. @@ -508,6 +508,9 @@
  285.      ac_cfg_t    cfg;
  286.      ac_ias_t    ias;
  287.  
  288. +    if (wavelan_debug > 0)
  289. +        printk("%s: ->wavelan_hardware_reset(dev=0x%x)\n", dev->name, (unsigned int)dev);
  290. +
  291.      ioaddr = dev->base_addr;
  292.      lp = (net_local *)dev->priv;
  293.  
  294. @@ -565,7 +568,12 @@
  295.      }
  296.  
  297.      if (i <= 0)
  298. +    {
  299.          printk("%s: wavelan_hardware_reset(): iscp_busy timeout.\n", dev->name);
  300. +        if (wavelan_debug > 0)
  301. +            printk("%s: <-wavelan_hardware_reset(): -1\n", dev->name);
  302. +        return -1;
  303. +    }
  304.  
  305.      for (i = 15; i > 0; i--)
  306.      {
  307. @@ -578,7 +586,12 @@
  308.      }
  309.  
  310.      if (i <= 0)
  311. +    {
  312.          printk("%s: wavelan_hardware_reset(): status: expected 0x%02x, got 0x%02x.\n", dev->name, SCB_ST_CX | SCB_ST_CNA, scb.scb_status);
  313. +        if (wavelan_debug > 0)
  314. +            printk("%s: <-wavelan_hardware_reset(): -1\n", dev->name);
  315. +        return -1;
  316. +    }
  317.  
  318.      wavelan_ack(dev);
  319.  
  320. @@ -588,12 +601,18 @@
  321.      obram_write(ioaddr, OFFSET_CU, (unsigned char *)&cb, sizeof(cb));
  322.  
  323.      if (wavelan_synchronous_cmd(dev, "diag()") == -1)
  324. +    {
  325. +        if (wavelan_debug > 0)
  326. +            printk("%s: <-wavelan_hardware_reset(): -1\n", dev->name);
  327.          return -1;
  328. +    }
  329.  
  330.      obram_read(ioaddr, OFFSET_CU, (unsigned char *)&cb, sizeof(cb));
  331.      if (cb.ac_status & AC_SFLD_FAIL)
  332.      {
  333.          printk("%s: wavelan_hardware_reset(): i82586 Self Test failed.\n", dev->name);
  334. +        if (wavelan_debug > 0)
  335. +            printk("%s: <-wavelan_hardware_reset(): -1\n", dev->name);
  336.          return -1;
  337.      }
  338.  
  339. @@ -654,7 +673,12 @@
  340.      obram_write(ioaddr, OFFSET_CU, (unsigned char *)&cfg, sizeof(cfg));
  341.  
  342.      if (wavelan_synchronous_cmd(dev, "reset()-configure") == -1)
  343. +    {
  344. +        if (wavelan_debug > 0)
  345. +            printk("%s: <-wavelan_hardware_reset(): -1\n", dev->name);
  346. +
  347.          return -1;
  348. +    }
  349.  
  350.      memset(&ias, 0x00, sizeof(ias));
  351.      ias.ias_h.ac_command = AC_CFLD_EL | (AC_CFLD_CMD & acmd_ia_setup);
  352. @@ -663,19 +687,24 @@
  353.      obram_write(ioaddr, OFFSET_CU, (unsigned char *)&ias, sizeof(ias));
  354.  
  355.      if (wavelan_synchronous_cmd(dev, "reset()-address") == -1)
  356. +    {
  357. +        if (wavelan_debug > 0)
  358. +            printk("%s: <-wavelan_hardware_reset(): -1\n", dev->name);
  359. +
  360.          return -1;
  361. +    }
  362.  
  363.      wavelan_ints_on(dev);
  364.  
  365.      if (wavelan_debug > 4)
  366. -    {
  367.          wavelan_scb_show(ioaddr);
  368. -        printk("%s: Initialized WaveLAN.\n", dev->name);
  369. -    }
  370.  
  371.      wavelan_ru_start(dev);
  372.      wavelan_cu_start(dev);
  373.  
  374. +    if (wavelan_debug > 0)
  375. +        printk("%s: <-wavelan_hardware_reset(): 0\n", dev->name);
  376. +
  377.      return 0;
  378.  }
  379.  
  380. @@ -708,6 +737,7 @@
  381.  wavelan_probe(device *dev)
  382.  {
  383.      int            i;
  384. +    int            r;
  385.      short            base_addr;
  386.      static unsigned short    iobase[]    =
  387.      {
  388. @@ -721,10 +751,17 @@
  389.          0x390,
  390.      };
  391.  
  392. +    if (wavelan_debug > 0)
  393. +        printk("%s: ->wavelan_probe(dev=0x%x (base_addr=0x%x))\n", dev->name, (unsigned int)dev, (unsigned int)dev->base_addr);
  394. +
  395.  #if    STRUCT_CHECK == 1
  396.      if (wavelan_struct_check() != (char *)0)
  397.      {
  398.          printk("%s: structure/compiler botch: \"%s\"\n", dev->name, wavelan_struct_check());
  399. +
  400. +        if (wavelan_debug > 0)
  401. +            printk("%s: <-wavelan_probe(): ENODEV\n", dev->name);
  402. +
  403.          return ENODEV;
  404.      }
  405.  #endif    /* STRUCT_CHECK == 1 */
  406. @@ -732,16 +769,25 @@
  407.      base_addr = dev->base_addr;
  408.  
  409.      if (base_addr < 0)
  410. +    {
  411.          /*
  412.           * Don't probe at all.
  413.           */
  414. +        if (wavelan_debug > 0)
  415. +            printk("%s: <-wavelan_probe(): ENXIO\n", dev->name);
  416.          return ENXIO;
  417. +    }
  418.  
  419.      if (base_addr > 0x100)
  420. +    {
  421.          /*
  422.           * Check a single specified location.
  423.           */
  424. -        return wavelan_probe1(dev, base_addr);
  425. +        r = wavelan_probe1(dev, base_addr);
  426. +        if (wavelan_debug > 0)
  427. +            printk("%s: <-wavelan_probe(): %d\n", dev->name, r);
  428. +        return r;
  429. +    }
  430.  
  431.      for (i = 0; i < nels(iobase); i++)
  432.      {
  433. @@ -749,9 +795,16 @@
  434.              continue;
  435.  
  436.          if (wavelan_probe1(dev, iobase[i]) == 0)
  437. +        {
  438. +            if (wavelan_debug > 0)
  439. +                printk("%s: <-wavelan_probe(): 0\n", dev->name);
  440.              return 0;
  441. +        }
  442.      }
  443.  
  444. +    if (wavelan_debug > 0)
  445. +        printk("%s: <-wavelan_probe(): ENODEV\n", dev->name);
  446. +
  447.      return ENODEV;
  448.  }
  449.  
  450. @@ -764,6 +817,9 @@
  451.      int        i;
  452.      net_local    *lp;
  453.  
  454. +    if (wavelan_debug > 0)
  455. +        printk("%s: ->wavelan_probe1(dev=0x%x, ioaddr=0x%x)\n", dev->name, (unsigned int)dev, ioaddr);
  456. +
  457.      wavelan_reset(ioaddr);
  458.  
  459.      psa_read(ioaddr, HACR_DEFAULT, 0, (unsigned char *)&psa, sizeof(psa));
  460. @@ -780,13 +836,19 @@
  461.          ||
  462.          psa.psa_univ_mac_addr[2] != SA_ADDR2
  463.      )
  464. +    {
  465. +        if (wavelan_debug > 0)
  466. +            printk("%s: <-wavelan_probe1(): ENODEV\n", dev->name);
  467.          return ENODEV;
  468. +    }
  469.  
  470.      printk("%s: WaveLAN at %#x,", dev->name, ioaddr);
  471.  
  472.      if ((irq = wavelan_map_irq(ioaddr, psa.psa_int_req_no)) == -1)
  473.      {
  474.          printk(" could not wavelan_map_irq(0x%x, %d).\n", ioaddr, psa.psa_int_req_no);
  475. +        if (wavelan_debug > 0)
  476. +            printk("%s: <-wavelan_probe1(): EAGAIN\n", dev->name);
  477.          return EAGAIN;
  478.      }
  479.  
  480. @@ -871,7 +933,7 @@
  481.  
  482.      printk("\n");
  483.  
  484. -    if (wavelan_debug)
  485. +    if (wavelan_debug > 0)
  486.          printk(version);
  487.  
  488.      dev->priv = kmalloc(sizeof(net_local), GFP_KERNEL);
  489. @@ -915,6 +977,9 @@
  490.  
  491.      dev->mtu = WAVELAN_MTU;
  492.  
  493. +    if (wavelan_debug > 0)
  494. +        printk("%s: <-wavelan_probe1(): 0\n", dev->name);
  495. +
  496.      return 0;
  497.  }
  498.  
  499. @@ -1074,12 +1139,21 @@
  500.  {
  501.      unsigned short    ioaddr;
  502.      net_local    *lp;
  503. +    unsigned long    x;
  504. +    int        r;
  505. +
  506. +    if (wavelan_debug > 0)
  507. +        printk("%s: ->wavelan_open(dev=0x%x)\n", dev->name, (unsigned int)dev);
  508.  
  509.      ioaddr = dev->base_addr;
  510.      lp = (net_local *)dev->priv;
  511.  
  512.      if (dev->irq == 0)
  513. +    {
  514. +        if (wavelan_debug > 0)
  515. +            printk("%s: <-wavelan_open(): -ENXIO\n", dev->name);
  516.          return -ENXIO;
  517. +    }
  518.  
  519.      if
  520.      (
  521. @@ -1092,23 +1166,35 @@
  522.      )
  523.      {
  524.          irq2dev_map[dev->irq] = (device *)0;
  525. +        if (wavelan_debug > 0)
  526. +            printk("%s: <-wavelan_open(): -EAGAIN\n", dev->name);
  527.          return -EAGAIN;
  528.      }
  529.  
  530. -    if (wavelan_hardware_reset(dev) == -1)
  531. +    x = wavelan_splhi();
  532. +    if ((r = wavelan_hardware_reset(dev)) != -1)
  533. +    {
  534. +        dev->interrupt = 0;
  535. +        dev->start = 1;
  536. +    }
  537. +    wavelan_splx(x);
  538. +
  539. +    if (r == -1)
  540.      {
  541.          free_irq(dev->irq);
  542.          irq2dev_map[dev->irq] = (device *)0;
  543. +        if (wavelan_debug > 0)
  544. +            printk("%s: <-wavelan_open(): -EAGAIN(2)\n", dev->name);
  545.          return -EAGAIN;
  546.      }
  547.  
  548. -    dev->interrupt = 0;
  549. -    dev->start = 1;
  550. -
  551.  #if    defined(MODULE)
  552.      MOD_INC_USE_COUNT;
  553.  #endif    /* defined(MODULE) */
  554.  
  555. +    if (wavelan_debug > 0)
  556. +        printk("%s: <-wavelan_open(): 0\n", dev->name);
  557. +
  558.      return 0;
  559.  }
  560.  
  561. @@ -1438,7 +1524,7 @@
  562.              }
  563.  #endif    /* 0 */
  564.  
  565. -            if (wavelan_debug > 0)
  566. +            if (wavelan_debug > 5)
  567.              {
  568.                  unsigned char    addr[WAVELAN_ADDR_SIZE];
  569.                  unsigned short    ltype;
  570. @@ -1723,14 +1809,14 @@
  571.           * This will clear it -- ignored for now.
  572.           */
  573.          mmc_read(ioaddr, mmroff(0, mmr_dce_status), &dce_status, sizeof(dce_status));
  574. -        if (wavelan_debug > 4)
  575. +        if (wavelan_debug > 0)
  576.              printk("%s: warning: wavelan_interrupt(): unexpected mmc interrupt: status 0x%04x.\n", dev->name, dce_status);
  577.      }
  578.  
  579.      if ((hasr & HASR_82586_INTR) == 0)
  580.      {
  581.          dev->interrupt = 0;
  582. -        if (wavelan_debug > 4)
  583. +        if (wavelan_debug > 0)
  584.              printk("%s: warning: wavelan_interrupt() but (hasr & HASR_82586_INTR) == 0.\n", dev->name);
  585.          return;
  586.      }
  587. @@ -1746,7 +1832,7 @@
  588.  
  589.      set_chan_attn(ioaddr, lp->hacr);
  590.  
  591. -    if (wavelan_debug > 4)
  592. +    if (wavelan_debug > 5)
  593.          printk("%s: interrupt, status 0x%04x.\n", dev->name, status);
  594.  
  595.      if ((status & SCB_ST_CX) == SCB_ST_CX)
  596. @@ -1804,6 +1890,9 @@
  597.      net_local    *lp;
  598.      unsigned short    scb_cmd;
  599.  
  600. +    if (wavelan_debug > 0)
  601. +        printk("%s: ->wavelan_close(dev=0x%x)\n", dev->name, (unsigned int)dev);
  602. +
  603.      ioaddr = dev->base_addr;
  604.      lp = (net_local *)dev->priv;
  605.  
  606. @@ -1831,6 +1920,9 @@
  607.      MOD_DEC_USE_COUNT;
  608.  #endif    /* defined(MODULE) */
  609.  
  610. +    if (wavelan_debug > 0)
  611. +        printk("%s: <-wavelan_close(): 0\n", dev->name);
  612. +
  613.      return 0;
  614.  }
  615.  
  616. @@ -1856,6 +1948,9 @@
  617.      net_local    *lp;
  618.      unsigned long    x;
  619.  
  620. +    if (wavelan_debug > 0)
  621. +        printk("%s: ->wavelan_set_multicast_list(dev=0x%x, num_addrs=%d, addrs=0x%x)\n", dev->name, (unsigned int)dev, num_addrs, (unsigned int)addrs);
  622. +
  623.      lp = (net_local *)dev->priv;
  624.  
  625.      switch (num_addrs)
  626. @@ -1888,6 +1983,9 @@
  627.           */
  628.          break;
  629.      }
  630. +
  631. +    if (wavelan_debug > 0)
  632. +        printk("%s: <-wavelan_set_multicast_list()\n", dev->name);
  633.  }
  634.  
  635.  /*
  636. @@ -2330,6 +2428,7 @@
  637.   *    Matthew Geier (matthew@cs.usyd.edu.au),
  638.   *    Remo di Giovanni (remo@cs.usyd.edu.au),
  639.   *    Eckhard Grah (grah@wrcs1.urz.uni-wuppertal.de),
  640. + *    Vipul Gupta (vgupta@cs.binghamton.edu),
  641.   *    Mark Hagan (mhagan@wtcpost.daytonoh.NCR.COM),
  642.   *    Tim Nicholson (tim@cs.usyd.edu.au),
  643.   *    Ian Parkin (ian@cs.usyd.edu.au),
  644. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/Makefile linux/drivers/scsi/Makefile
  645. --- v1.2.4/linux/drivers/scsi/Makefile    Tue Apr  4 09:05:34 1995
  646. +++ linux/drivers/scsi/Makefile    Tue Apr 11 07:56:24 1995
  647. @@ -86,9 +86,11 @@
  648.  SCSI_SRCS := $(SCSI_SRCS) buslogic.c
  649.  endif
  650.  
  651. +SCSI_SRCS := $(SCSI_SRCS) eata_dma.c
  652.  ifdef CONFIG_SCSI_EATA_DMA
  653.  SCSI_OBJS := $(SCSI_OBJS) eata_dma.o
  654. -SCSI_SRCS := $(SCSI_SRCS) eata_dma.c
  655. +else
  656. +SCSI_MODULE_OBJS := $(SCSI_MODULE_OBJS) eata_dma.o
  657.  endif
  658.  
  659.  ifdef CONFIG_SCSI_U14_34F
  660. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/buslogic.c linux/drivers/scsi/buslogic.c
  661. --- v1.2.4/linux/drivers/scsi/buslogic.c    Mon Jan 23 10:38:29 1995
  662. +++ linux/drivers/scsi/buslogic.c    Wed Apr 12 08:12:14 1995
  663. @@ -56,16 +56,18 @@
  664.   *    BT-747D - 747S + differential termination.
  665.   *    BT-757S - 747S + WIDE SCSI.
  666.   *    BT-757D - 747D + WIDE SCSI.
  667. - *    BT-445S - VESA bus-master FAST SCSI with active termination and floppy
  668. - *          support.
  669. + *    BT-445S - VESA bus-master FAST SCSI with active termination
  670. + *          and floppy support.
  671.   *    BT-445C - 445S + enhanced BIOS & firmware options.
  672. - *    BT-946C - PCI bus-master FAST SCSI. (??? Nothing else known.)
  673. + *    BT-946C - PCI bus-master FAST SCSI.
  674. + *    BT-956C - PCI bus-master FAST/WIDE SCSI.
  675.   *
  676.   *    ??? I believe other boards besides the 445 now have a "C" model, but I
  677.   *    have no facts on them.
  678.   *
  679.   *    This driver SHOULD support all of these boards.  It has only been tested
  680. - *    with a 747S and 445S.
  681. + *    with a 747S, 445S, 946C, and 956C; there is no PCI-specific support as
  682. + *    yet.
  683.   *
  684.   *    Should you require further information on any of these boards, BusLogic
  685.   *    can be reached at (408)492-9090.  Their BBS # is (408)492-1984 (maybe BBS
  686. @@ -118,7 +120,7 @@
  687.     The test is believed to fail on at least some AMI BusLogic clones. */
  688.  /* #define BIOS_TRANSLATION_OVERRIDE BIOS_TRANSLATION_BIG */
  689.  
  690. -#define BUSLOGIC_VERSION "1.14"
  691. +#define BUSLOGIC_VERSION "1.15"
  692.  
  693.  /* Not a random value - if this is too large, the system hangs for a long time
  694.     waiting for something to happen if a board is not installed. */
  695. @@ -137,11 +139,13 @@
  696.  /* Since the SG list is malloced, we have to limit the length. */
  697.  #define BUSLOGIC_MAX_SG (BUSLOGIC_SG_MALLOC / sizeof (struct chain))
  698.  
  699. -/* ??? Arbitrary.  If we can dynamically allocate the mailbox arrays, I may
  700. -   bump up this number. */
  701. -#define BUSLOGIC_MAILBOXES 16
  702. +/* Since the host adapters have room to buffer 32 commands internally, there
  703. +   is some virtue in setting BUSLOGIC_MAILBOXES to 32.  The maximum value
  704. +   appears to be 255, since the Count parameter to the Initialize Extended
  705. +   Mailbox command is limited to one byte. */
  706. +#define BUSLOGIC_MAILBOXES 32
  707.  
  708. -#define BUSLOGIC_CMDLUN 4        /* ??? Arbitrary */
  709. +#define BUSLOGIC_CMDLUN 4    /* Arbitrary, but seems to work well. */
  710.  
  711.  /* BusLogic boards can be configured for quite a number of port addresses (six
  712.     to be exact), but I generally do not want the driver poking around at
  713. @@ -165,8 +169,8 @@
  714.  struct hostdata {
  715.      unsigned int bus_type;
  716.      unsigned int bios_translation: 1;    /* BIOS mapping (for compatibility) */
  717. -    size_t last_mbi_used;
  718. -    size_t last_mbo_used;
  719. +    int last_mbi_used;
  720. +    int last_mbo_used;
  721.      char model[7];
  722.      char firmware_rev[6];
  723.      Scsi_Cmnd *sc[BUSLOGIC_MAILBOXES];
  724. @@ -425,174 +429,131 @@
  725.      return "BusLogic SCSI driver " BUSLOGIC_VERSION;
  726.  }
  727.  
  728. -/* A "high" level interrupt handler. */
  729. +/*
  730. +  This is a major rewrite of the interrupt handler to support the newer
  731. +  and faster PCI cards.  While the previous interrupt handler was supposed
  732. +  to handle multiple incoming becoming available mailboxes during the same
  733. +  interrupt, my testing showed that in practice only a single mailbox was
  734. +  ever made available.  With the 946C and 956C, multiple incoming mailboxes
  735. +  being ready for processing during a single interrupt occurs much more
  736. +  frequently, and so care must be taken to avoid race conditions managing
  737. +  the Host Adapter Interrupt Register, which can lead to lost interrupts.
  738. +
  739. +  Leonard N. Zubkoff, 23-Mar-95
  740. +*/
  741. +
  742.  static void buslogic_interrupt(int irq, struct pt_regs * regs)
  743.  {
  744. -    void (*my_done)(Scsi_Cmnd *) = NULL;
  745. -    int errstatus, mbistatus = MBX_NOT_IN_USE, number_serviced, found;
  746. -    size_t mbi, mbo = 0;
  747. +    int mbi, saved_mbo[BUSLOGIC_MAILBOXES];
  748. +    int base, interrupt_flags, found, i;
  749.      struct Scsi_Host *shpnt;
  750.      Scsi_Cmnd *sctmp;
  751. -    unsigned long flags;
  752. -    int base, flag;
  753. -    int needs_restart;
  754.      struct mailbox *mb;
  755.      struct ccb *ccb;
  756.  
  757.      shpnt = host[irq - 9];
  758. -    if (!shpnt)
  759. -    panic("buslogic_interrupt: NULL SCSI host entry");
  760. +    if (shpnt == NULL)
  761. +      panic("buslogic_interrupt: NULL SCSI host entry");
  762.  
  763.      mb = HOSTDATA(shpnt)->mb;
  764.      ccb = HOSTDATA(shpnt)->ccbs;
  765.      base = shpnt->io_port;
  766.  
  767. -#if (BUSLOGIC_DEBUG & BD_INTERRUPT)
  768. -    flag = inb(INTERRUPT(base));
  769. +    /*
  770. +      This interrupt handler is now specified to use the SA_INTERRUPT
  771. +      protocol, so interrupts are inhibited on entry until explicitly
  772. +      allowed again.  Read the Host Adapter Interrupt Register, and
  773. +      complain if there is no pending interrupt being signaled.
  774. +    */
  775. +
  776. +    interrupt_flags = inb(INTERRUPT(base));
  777. +
  778. +    if (!(interrupt_flags & INTV))
  779. +      {
  780. +    buslogic_printk("interrupt received, but INTV not set\n");
  781. +    return;
  782. +      }
  783. +
  784. +    /*
  785. +      Reset the Host Adapter Interrupt Register.  It appears to be
  786. +      important that this is only done once per interrupt to avoid
  787. +      losing interrupts under heavy loads.
  788. +    */
  789.  
  790. -    buslogic_printk("");
  791. -    if (!(flag & INTV))
  792. -    printk("no interrupt? ");
  793. -    if (flag & IMBL)
  794. -    printk("IMBL ");
  795. -    if (flag & MBOR)
  796. -    printk("MBOR ");
  797. -    if (flag & CMDC)
  798. -    printk("CMDC ");
  799. -    if (flag & RSTS)
  800. -    printk("RSTS ");
  801. -    printk("status %02X\n", inb(STATUS(base)));
  802. -#endif
  803. -
  804. -    number_serviced = 0;
  805. -    needs_restart = 0;
  806. -
  807. -    for (;;) {
  808. -    flag = inb(INTERRUPT(base));
  809. -
  810. -    /* Check for unusual interrupts.  If any of these happen, we should
  811. -       probably do something special, but for now just printing a message
  812. -       is sufficient.  A SCSI reset detected is something that we really
  813. -       need to deal with in some way. */
  814. -    if (flag & (MBOR | CMDC | RSTS)) {
  815. -        buslogic_printk("unusual flag:");
  816. -        if (flag & MBOR)
  817. -        printk(" MBOR");
  818. -        if (flag & CMDC)
  819. -        printk(" CMDC");
  820. -        if (flag & RSTS) {
  821. -        needs_restart = 1;
  822. -        printk(" RSTS");
  823. -        }
  824. -        printk("\n");
  825. -    }
  826. -
  827. -    INTR_RESET(base);
  828. -
  829. -    save_flags(flags);
  830. -    cli();
  831. -
  832. -    mbi = HOSTDATA(shpnt)->last_mbi_used + 1;
  833. -    if (mbi >= 2 * BUSLOGIC_MAILBOXES)
  834. -        mbi = BUSLOGIC_MAILBOXES;
  835. -
  836. -    /* I use the "found" variable as I like to keep cli/sti pairs at the
  837. -       same block level.  Debugging dropped sti's is no fun... */
  838. -
  839. -    found = FALSE;
  840. -    do {
  841. -        if (mb[mbi].status != MBX_NOT_IN_USE) {
  842. -        found = TRUE;
  843. -        break;
  844. -        }
  845. -        mbi++;
  846. -        if (mbi >= 2 * BUSLOGIC_MAILBOXES)
  847. -        mbi = BUSLOGIC_MAILBOXES;
  848. -    } while (mbi != HOSTDATA(shpnt)->last_mbi_used);
  849. -
  850. -    if (found) {
  851. -        mbo = (struct ccb *)mb[mbi].ccbptr - ccb;
  852. -        mbistatus = mb[mbi].status;
  853. -        mb[mbi].status = MBX_NOT_IN_USE;
  854. -        HOSTDATA(shpnt)->last_mbi_used = mbi;
  855. -    }
  856. -
  857. -    restore_flags(flags);
  858. -
  859. -    if (!found) {
  860. -        /* Hmm, no mail.  Must have read it the last time around. */
  861. -        if (!number_serviced && !needs_restart)
  862. -        buslogic_printk("interrupt received, but no mail.\n");
  863. -        /* We detected a reset.  Restart all pending commands for devices
  864. -           that use the hard reset option. */
  865. -        if (needs_restart)
  866. -        restart(shpnt);
  867. -        return;
  868. -    }
  869. -
  870. -#if (BUSLOGIC_DEBUG & BD_INTERRUPT)
  871. -    if (ccb[mbo].tarstat || ccb[mbo].hastat)
  872. -        buslogic_printk("returning %08X (status %d).\n",
  873. -                ((int)ccb[mbo].hastat << 16) | ccb[mbo].tarstat,
  874. -                mb[mbi].status);
  875. -#endif
  876. -
  877. -    if (mbistatus == MBX_COMPLETION_NOT_FOUND)
  878. -        continue;
  879. -
  880. -#if (BUSLOGIC_DEBUG & BD_INTERRUPT)
  881. -    buslogic_printk("...done %u %u\n", mbo, mbi);
  882. -#endif
  883. +    INTR_RESET(base);
  884.  
  885. +    if (interrupt_flags & RSTS)
  886. +      {
  887. +    restart(shpnt);
  888. +    return;
  889. +      }
  890. +
  891. +    /*
  892. +      With interrupts still inhibited, scan through the incoming mailboxes
  893. +      in strict round robin fashion saving the status information and
  894. +      then freeing the mailbox.  A second pass over the completed commands
  895. +      will be made separately to complete their processing.
  896. +    */
  897. +
  898. +    mbi = HOSTDATA(shpnt)->last_mbi_used + 1;
  899. +    if (mbi >= 2*BUSLOGIC_MAILBOXES)
  900. +      mbi = BUSLOGIC_MAILBOXES;
  901. +
  902. +    found = 0;
  903. +
  904. +    while (mb[mbi].status != MBX_NOT_IN_USE && found < BUSLOGIC_MAILBOXES)
  905. +      {
  906. +    int mbo = (struct ccb *)mb[mbi].ccbptr - ccb;
  907. +    int result = 0;
  908. +
  909. +    saved_mbo[found++] = mbo;
  910. +
  911. +    if (mb[mbi].status != MBX_COMPLETION_OK)
  912. +      result = makecode(ccb[mbo].hastat, ccb[mbo].tarstat);
  913. +
  914. +    HOSTDATA(shpnt)->sc[mbo]->result = result;
  915. +
  916. +    mb[mbi].status = MBX_NOT_IN_USE;
  917. +
  918. +    HOSTDATA(shpnt)->last_mbi_used = mbi;
  919. +
  920. +    if (++mbi >= 2*BUSLOGIC_MAILBOXES)
  921. +      mbi = BUSLOGIC_MAILBOXES;
  922. +      }
  923. +
  924. +    /*
  925. +      With interrupts no longer inhibited, iterate over the completed
  926. +      commands freeing resources and calling the completion routines.
  927. +      Since we exit upon completion of this loop, there is no need to
  928. +      inhibit interrupts before exit, as this will be handled by the
  929. +      fast interrupt assembly code we return to.
  930. +    */
  931. +
  932. +    sti();
  933. +
  934. +    for (i = 0; i < found; i++)
  935. +      {
  936. +    int mbo = saved_mbo[i];
  937.      sctmp = HOSTDATA(shpnt)->sc[mbo];
  938. -
  939. -    if (!sctmp || !sctmp->scsi_done) {
  940. -        buslogic_printk("unexpected interrupt.\n");
  941. -        buslogic_printk("tarstat=%02X, hastat=%02X id=%d lun=%d ccb#=%u\n",
  942. -                ccb[mbo].tarstat, ccb[mbo].hastat,
  943. -                ccb[mbo].id, ccb[mbo].lun, mbo);
  944. -        return;
  945. -    }
  946. -
  947. -    my_done = sctmp->scsi_done;
  948. +    /*
  949. +      First, free any storage allocated for a scatter/gather
  950. +      data segment list.
  951. +    */
  952.      if (sctmp->host_scribble)
  953. -        scsi_free(sctmp->host_scribble, BUSLOGIC_SG_MALLOC);
  954. -
  955. -    /* ??? more error checking left out here */
  956. -    if (mbistatus != MBX_COMPLETION_OK) {
  957. -        /* ??? This is surely wrong, but I don't know what's right. */
  958. -        errstatus = makecode(ccb[mbo].hastat, ccb[mbo].tarstat);
  959. -    } else
  960. -        errstatus = 0;
  961. -
  962. -#if (BUSLOGIC_DEBUG & BD_INTERRUPT)
  963. -    if (errstatus)
  964. -        buslogic_printk("error: %04X %04X\n",
  965. -                ccb[mbo].hastat, ccb[mbo].tarstat);
  966. -
  967. -    if (status_byte(ccb[mbo].tarstat) == CHECK_CONDITION) {
  968. -        size_t i;
  969. -
  970. -        buslogic_printk("sense:");
  971. -        for (i = 0; i < sizeof sctmp->sense_buffer; i++)
  972. -        printk(" %02X", sctmp->sense_buffer[i]);
  973. -        printk("\n");
  974. -    }
  975. -
  976. -    if (errstatus)
  977. -        buslogic_printk("returning %08X.\n", errstatus);
  978. -#endif
  979. -
  980. -    sctmp->result = errstatus;
  981. -    HOSTDATA(shpnt)->sc[mbo] = NULL;    /* This effectively frees up
  982. -                           the mailbox slot, as far as
  983. -                           queuecommand is
  984. -                           concerned. */
  985. -    my_done(sctmp);
  986. -    number_serviced++;
  987. -    }
  988. +      scsi_free(sctmp->host_scribble, BUSLOGIC_SG_MALLOC);
  989. +    /*
  990. +      Next, call the SCSI command completion handler.
  991. +    */
  992. +    sctmp->scsi_done(sctmp);
  993. +    /*
  994. +      Finally, mark the SCSI Command as completed so it may be reused
  995. +      for another command by buslogic_queuecommand.
  996. +    */
  997. +    HOSTDATA(shpnt)->sc[mbo] = NULL;
  998. +      }
  999.  }
  1000.  
  1001. +
  1002.  /* ??? Why does queuecommand return a value?  scsi.c never looks at it... */
  1003.  int buslogic_queuecommand(Scsi_Cmnd *scpnt, void (*done)(Scsi_Cmnd *))
  1004.  {
  1005. @@ -605,9 +566,10 @@
  1006.      int bufflen = scpnt->request_bufflen;
  1007.      int mbo;
  1008.      unsigned long flags;
  1009. -    struct mailbox *mb;
  1010. -    struct ccb *ccb;
  1011.      struct Scsi_Host *shpnt = scpnt->host;
  1012. +    struct mailbox *mb = HOSTDATA(shpnt)->mb;
  1013. +    struct ccb *ccb;
  1014. +
  1015.  
  1016.  #if (BUSLOGIC_DEBUG & BD_COMMAND)
  1017.      if (target > 1) {
  1018. @@ -651,9 +613,6 @@
  1019.      }
  1020.  #endif
  1021.  
  1022. -    mb = HOSTDATA(shpnt)->mb;
  1023. -    ccb = HOSTDATA(shpnt)->ccbs;
  1024. -
  1025.      /* Use the outgoing mailboxes in a round-robin fashion, because this
  1026.         is how the host adapter will scan for them. */
  1027.  
  1028. @@ -693,12 +652,14 @@
  1029.      buslogic_printk("sending command (%d %08X)...", mbo, done);
  1030.  #endif
  1031.  
  1032. +    ccb = &HOSTDATA(shpnt)->ccbs[mbo];
  1033. +
  1034.      /* This gets trashed for some reason */
  1035. -    mb[mbo].ccbptr = &ccb[mbo];
  1036. +    mb[mbo].ccbptr = ccb;
  1037.  
  1038. -    memset(&ccb[mbo], 0, sizeof (struct ccb));
  1039. +    memset(ccb, 0, sizeof (struct ccb));
  1040.  
  1041. -    ccb[mbo].cdblen = scpnt->cmd_len;        /* SCSI Command Descriptor
  1042. +    ccb->cdblen = scpnt->cmd_len;        /* SCSI Command Descriptor
  1043.                             Block Length */
  1044.  
  1045.      direction = 0;
  1046. @@ -707,14 +668,14 @@
  1047.      else if (*cmd == WRITE_10 || *cmd == WRITE_6)
  1048.      direction = 16;
  1049.  
  1050. -    memcpy(ccb[mbo].cdb, cmd, ccb[mbo].cdblen);
  1051. +    memcpy(ccb->cdb, cmd, ccb->cdblen);
  1052.  
  1053.      if (scpnt->use_sg) {
  1054.      struct scatterlist *sgpnt;
  1055.      struct chain *cptr;
  1056.      size_t i;
  1057.  
  1058. -    ccb[mbo].op = CCB_OP_INIT_SG;    /* SCSI Initiator Command
  1059. +    ccb->op = CCB_OP_INIT_SG;    /* SCSI Initiator Command
  1060.                         w/scatter-gather */
  1061.      scpnt->host_scribble
  1062.          = (unsigned char *)scsi_malloc(BUSLOGIC_SG_MALLOC);
  1063. @@ -735,8 +696,8 @@
  1064.          cptr[i].dataptr = sgpnt[i].address;
  1065.          cptr[i].datalen = sgpnt[i].length;
  1066.      }
  1067. -    ccb[mbo].datalen = scpnt->use_sg * sizeof (struct chain);
  1068. -    ccb[mbo].dataptr = cptr;
  1069. +    ccb->datalen = scpnt->use_sg * sizeof (struct chain);
  1070. +    ccb->dataptr = cptr;
  1071.  #if (BUSLOGIC_DEBUG & BD_COMMAND)
  1072.      {
  1073.          unsigned char *ptr;
  1074. @@ -749,27 +710,26 @@
  1075.      }
  1076.  #endif
  1077.      } else {
  1078. -    ccb[mbo].op = CCB_OP_INIT;    /* SCSI Initiator Command */
  1079. +    ccb->op = CCB_OP_INIT;    /* SCSI Initiator Command */
  1080.      scpnt->host_scribble = NULL;
  1081.      CHECK_DMA_ADDR(shpnt->unchecked_isa_dma, buff, goto baddma);
  1082. -    ccb[mbo].datalen = bufflen;
  1083. -    ccb[mbo].dataptr = buff;
  1084. +    ccb->datalen = bufflen;
  1085. +    ccb->dataptr = buff;
  1086.      }
  1087. -    ccb[mbo].id = target;
  1088. -    ccb[mbo].lun = lun;
  1089. -    ccb[mbo].dir = direction;
  1090. -    ccb[mbo].rsalen = sizeof scpnt->sense_buffer;
  1091. -    ccb[mbo].senseptr = scpnt->sense_buffer;
  1092. -    ccb[mbo].linkptr = NULL;
  1093. -    ccb[mbo].commlinkid = 0;
  1094. +    ccb->id = target;
  1095. +    ccb->lun = lun;
  1096. +    ccb->dir = direction;
  1097. +    ccb->rsalen = sizeof scpnt->sense_buffer;
  1098. +    ccb->senseptr = scpnt->sense_buffer;
  1099. +    /* ccbcontrol, commlinkid, and linkptr are 0 due to above memset. */
  1100.  
  1101.  #if (BUSLOGIC_DEBUG & BD_COMMAND)
  1102.      {
  1103.      size_t i;
  1104.  
  1105.      buslogic_printk("sending...");
  1106. -    for (i = 0; i < sizeof ccb[mbo] - 10; i++)
  1107. -        printk(" %02X", ((unsigned char *)&ccb[mbo])[i]);
  1108. +    for (i = 0; i < sizeof(struct ccb) - 10; i++)
  1109. +        printk(" %02X", ((unsigned char *)ccb)[i]);
  1110.      printk("\n");
  1111.      }
  1112.  #endif
  1113. @@ -1255,7 +1215,8 @@
  1114.  
  1115.          save_flags(flags);
  1116.          cli();
  1117. -        if (request_irq(irq, buslogic_interrupt, 0, "buslogic")) {
  1118. +        if (request_irq(irq, buslogic_interrupt,
  1119. +                SA_INTERRUPT, "buslogic")) {
  1120.          buslogic_printk("unable to allocate IRQ for "
  1121.                  "BusLogic controller.\n");
  1122.          restore_flags(flags);
  1123. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/eata_dma.c linux/drivers/scsi/eata_dma.c
  1124. --- v1.2.4/linux/drivers/scsi/eata_dma.c    Tue Feb 14 08:02:58 1995
  1125. +++ linux/drivers/scsi/eata_dma.c    Wed Apr 12 21:03:23 1995
  1126. @@ -44,13 +44,14 @@
  1127.   * Thanks also to Greg Hosler who did a lot of testing and  *
  1128.   * found quite a number of bugs during the development.     *
  1129.   ************************************************************
  1130. - *  last change: 95/02/13       OS: Linux 1.1.91 or higher  *
  1131. + *  last change: 95/04/10       OS: Linux 1.2.00 or higher  *
  1132.   ************************************************************/
  1133.  
  1134.  /* Look in eata_dma.h for configuration and revision information */
  1135.  
  1136.  #ifdef MODULE
  1137.  #include <linux/module.h>
  1138. +#include <linux/version.h>
  1139.  #endif
  1140.   
  1141.  #include <linux/kernel.h>
  1142. @@ -61,6 +62,7 @@
  1143.  #include <linux/in.h>
  1144.  #include <linux/bios32.h>
  1145.  #include <linux/pci.h>
  1146. +#include <asm/types.h>
  1147.  #include <asm/io.h>
  1148.  #include <asm/dma.h>
  1149.  #include "../block/blk.h"
  1150. @@ -87,10 +89,13 @@
  1151.  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  1152.  static unchar reg_IRQL[] =
  1153.  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  1154. -static struct eata_sp status[MAXIRQ];    /* Statuspacket array   */
  1155. +static struct eata_sp *status = 0;   /* Statuspacket array   */
  1156. +static void *dma_scratch = 0;
  1157.  
  1158.  static uint internal_command_finished = TRUE;
  1159.  static unchar HBA_interpret = FALSE;
  1160. +static u32 fake_int_base;
  1161. +static u32 fake_int_result;
  1162.  static struct geom_emul geometry;    /* Drive 1 & 2 geometry */
  1163.  
  1164.  static ulong int_counter = 0;
  1165. @@ -101,6 +106,14 @@
  1166.      return;
  1167.  }    
  1168.  
  1169. +void eata_fake_int_handler(s32 irq, struct pt_regs * regs)
  1170. +{
  1171. +    fake_int_result = inb(fake_int_base + HA_RSTATUS);
  1172. +    DBG(DBG_INTR3, printk("eata_fake_int_handler called irq%ld base %#lx res %#lx\n", 
  1173. +              irq, fake_int_base, fake_int_result));
  1174. +    return;
  1175. +}
  1176. +
  1177.  #if EATA_DMA_PROC 
  1178.  #include "eata_dma_proc.c"
  1179.  #endif
  1180. @@ -109,6 +122,9 @@
  1181.  {
  1182.    if (sh->irq && reg_IRQ[sh->irq] == 1) free_irq(sh->irq);
  1183.    else reg_IRQ[sh->irq]--;
  1184. +    
  1185. +    scsi_init_free((void *)status, 512);
  1186. +    
  1187.    if (SD(sh)->channel == 0) {
  1188.        if (sh->dma_channel != 0xff) free_dma(sh->dma_channel);
  1189.        if (sh->io_port && sh->n_io_port)
  1190. @@ -125,7 +141,7 @@
  1191.  
  1192.  void eata_int_handler(int irq, struct pt_regs * regs)
  1193.  {
  1194. -    uint i, result;
  1195. +    uint i, result = 0;
  1196.      uint hba_stat, scsi_stat, eata_stat;
  1197.      Scsi_Cmnd *cmd;
  1198.      struct eata_ccb *cp;
  1199. @@ -183,21 +199,25 @@
  1200.                   eata_stat, hba_stat));
  1201.  
  1202.      switch (hba_stat) {
  1203. -    case 0x00:        /* NO Error */
  1204. +    case HA_NO_ERROR:       /* NO Error */
  1205.          if (scsi_stat == CONDITION_GOOD
  1206.          && cmd->device->type == TYPE_DISK
  1207.          && (HD(cmd)->t_state[cmd->target] == RESET))
  1208.              result = DID_BUS_BUSY << 16;        
  1209. +            else if (scsi_stat == GOOD)
  1210. +          HD(cmd)->t_state[cmd->target] = FALSE;
  1211. +        else if (scsi_stat == CHECK_CONDITION
  1212. +                     && cmd->device->type == TYPE_DISK
  1213. +                     && (cmd->sense_buffer[2] & 0xf) == RECOVERED_ERROR)
  1214. +          result = DID_BUS_BUSY << 16;
  1215.          else
  1216.              result = DID_OK << 16;
  1217. -        if (scsi_stat == GOOD)
  1218. -        HD(cmd)->t_state[cmd->target] = FALSE;
  1219. -        HD(cmd)->t_timeout[cmd->target] = 0;
  1220. +        HD(cmd)->t_timeout[cmd->target] = FALSE;
  1221.          break;
  1222. -    case 0x01:        /* Selection Timeout */
  1223. +    case HA_ERR_SEL_TO:        /* Selection Timeout */
  1224.          result = DID_BAD_TARGET << 16;  
  1225.          break;
  1226. -    case 0x02:        /* Command Timeout   */
  1227. +    case HA_ERR_CMD_TO:        /* Command Timeout   */
  1228.          if (HD(cmd)->t_timeout[cmd->target] > 1)
  1229.          result = DID_ERROR << 16;
  1230.          else {
  1231. @@ -205,7 +225,8 @@
  1232.          HD(cmd)->t_timeout[cmd->target]++;
  1233.          }
  1234.          break;
  1235. -    case 0x03:        /* SCSI Bus Reset Received */
  1236. +        case HA_ERR_RESET:              /* SCSI Bus Reset Received */
  1237. +        case HA_INIT_POWERUP:           /* Initial Controller Power-up */
  1238.          if (cmd->device->type != TYPE_TAPE)
  1239.          result = DID_BUS_BUSY << 16;
  1240.          else
  1241. @@ -214,23 +235,19 @@
  1242.          for (i = 0; i < MAXTARGET; i++)
  1243.          HD(cmd)->t_state[i] = RESET;
  1244.          break;
  1245. -    case 0x07:        /* Bus Parity Error */
  1246. -    case 0x0c:        /* Controller Ram Parity */
  1247. -    case 0x04:        /* Initial Controller Power-up */
  1248. -    case 0x05:        /* Unexpected Bus Phase */
  1249. -    case 0x06:        /* Unexpected Bus Free */
  1250. -    case 0x08:        /* SCSI Hung */
  1251. -    case 0x09:        /* Unexpected Message Reject */
  1252. -    case 0x0a:        /* SCSI Bus Reset Stuck */
  1253. -    case 0x0b:        /* Auto Request-Sense Failed */
  1254. +        case HA_UNX_BUSPHASE:       /* Unexpected Bus Phase */
  1255. +        case HA_UNX_BUS_FREE:       /* Unexpected Bus Free */
  1256. +        case HA_BUS_PARITY:         /* Bus Parity Error */
  1257. +        case HA_SCSI_HUNG:          /* SCSI Hung */
  1258. +        case HA_UNX_MSGRJCT:        /* Unexpected Message Reject */
  1259. +        case HA_RESET_STUCK:        /* SCSI Bus Reset Stuck */
  1260. +        case HA_RSENSE_FAIL:        /* Auto Request-Sense Failed */
  1261. +        case HA_PARITY_ERR:         /* Controller Ram Parity */
  1262.      default:
  1263.          result = DID_ERROR << 16;
  1264.          break;
  1265.      }
  1266. -    cmd->result = result | scsi_stat; 
  1267. -        if (in_scan_scsis && scsi_stat == CHECK_CONDITION && 
  1268. -        (cmd->sense_buffer[2] & 0xf) == UNIT_ATTENTION) 
  1269. -        cmd->result |= (DRIVER_SENSE << 24);
  1270. +    cmd->result = result | (scsi_stat << 1); 
  1271.  
  1272.  #if DBG_INTR2
  1273.      if (scsi_stat || result || hba_stat || eata_stat != 0x50) 
  1274. @@ -262,14 +279,14 @@
  1275.  
  1276.      while (inb(base + HA_RAUXSTAT) & HA_ABUSY)
  1277.          if (--loop == 0)
  1278. -            return(TRUE);
  1279. +            return(FALSE);
  1280.  
  1281.      outb(addr & 0x000000ff, base + HA_WDMAADDR);
  1282.      outb((addr & 0x0000ff00) >> 8, base + HA_WDMAADDR + 1);
  1283.      outb((addr & 0x00ff0000) >> 16, base + HA_WDMAADDR + 2);
  1284.      outb((addr & 0xff000000) >> 24, base + HA_WDMAADDR + 3);
  1285.      outb(command, base + HA_WCOMMAND);
  1286. -    return(FALSE);
  1287. +    return(TRUE);
  1288.  }
  1289.  
  1290.  int eata_queue(Scsi_Cmnd * cmd, void *(done) (Scsi_Cmnd *))
  1291. @@ -337,10 +354,10 @@
  1292.      case FORMAT_UNIT:       case REASSIGN_BLOCKS: case RESERVE:
  1293.      case SEARCH_EQUAL:      case SEARCH_HIGH:     case SEARCH_LOW:
  1294.      case WRITE_6:           case WRITE_10:        case WRITE_VERIFY:
  1295. -    case 0x3f:              case 0x41:            case 0xb1:
  1296. -    case 0xb0:              case 0xb2:            case 0xaa:
  1297. -    case 0xae:              case 0x24:            case 0x38:
  1298. -    case 0x3d:              case 0xb6:            
  1299. +    case UPDATE_BLOCK:      case WRITE_LONG:      case WRITE_SAME:      
  1300. +    case SEARCH_HIGH_12:    case SEARCH_EQUAL_12: case SEARCH_LOW_12:
  1301. +    case WRITE_12:          case WRITE_VERIFY_12: case SET_WINDOW: 
  1302. +    case MEDIUM_SCAN:       case SEND_VOLUME_TAG:            
  1303.      case 0xea:        /* alternate number for WRITE LONG */
  1304.      cp->DataOut = TRUE;    /* Output mode */
  1305.          break;
  1306. @@ -376,7 +393,7 @@
  1307.      cp->cp_lun = cmd->lun;
  1308.      cp->cp_dispri = TRUE;
  1309.      cp->cp_identify = TRUE;
  1310. -    memcpy(cp->cp_cdb, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
  1311. +    memcpy(cp->cp_cdb, cmd->cmnd, cmd->cmd_len);
  1312.  
  1313.      cp->cp_statDMA = htonl((ulong) &(hd->sp));
  1314.  
  1315. @@ -384,7 +401,7 @@
  1316.      cp->cmd = cmd;
  1317.      cmd->host_scribble = (char *)&hd->ccb[y];    
  1318.  
  1319. -    if(eata_send_command((ulong) cp, (uint) sh->base, EATA_CMD_DMA_SEND_CP)) {
  1320. +    if(eata_send_command((ulong) cp, (uint) sh->base, EATA_CMD_DMA_SEND_CP) == FALSE) {
  1321.        cmd->result = DID_ERROR << 16;
  1322.        printk("eata_queue target %d, pid %ld, HBA busy, returning DID_ERROR, done.\n",
  1323.                cmd->target, cmd->pid);
  1324. @@ -494,8 +511,10 @@
  1325.          DBG(DBG_ABNORM && DBG_DELAY, DEL2(500));
  1326.          return (SCSI_RESET_ERROR);
  1327.      }
  1328. -    for (z = 0; z < MAXTARGET; z++)
  1329. +    for (z = 0; z < MAXTARGET; z++) {
  1330.      HD(cmd)->t_state[z] = RESET;
  1331. +    HD(cmd)->t_timeout[z] = FALSE;
  1332. +    }
  1333.  
  1334.      for (x = 0; x < cmd->host->can_queue; x++) {
  1335.  
  1336. @@ -577,16 +596,21 @@
  1337.  {
  1338.      struct eata_ccb cp;
  1339.      struct eata_sp  sp;
  1340. -    static char buff[256];
  1341. +    static char *buff;
  1342. +    u32 i;
  1343. +
  1344. +    buff = dma_scratch;
  1345.  
  1346.      memset(&cp, 0, sizeof(struct eata_ccb));
  1347. -    memset(buff, 0, sizeof(buff));
  1348. +    memset(&sp, 0, sizeof(struct eata_sp));
  1349. +    memset(buff, 0, 256);
  1350.  
  1351.      cp.DataIn = TRUE;     
  1352.      cp.Interpret = TRUE;   /* Interpret command */
  1353.   
  1354.      cp.cp_datalen = htonl(255);  
  1355. -    cp.cp_dataDMA = htonl((long)buff);
  1356. +    cp.cp_dataDMA = htonl((s32)buff);
  1357. +    cp.cp_viraddr = &cp;
  1358.  
  1359.      cp.cp_id = id;
  1360.      cp.cp_lun = 0;
  1361. @@ -600,9 +624,21 @@
  1362.  
  1363.      cp.cp_statDMA = htonl((ulong) &sp);
  1364.  
  1365. -    eata_send_command((ulong) &cp, (uint) base, EATA_CMD_DMA_SEND_CP);
  1366. -    while (!(inb(base + HA_RAUXSTAT) & HA_AIRQ));
  1367. -    if(inb((uint) base + HA_RSTATUS) & 1)
  1368. +    fake_int_base = base;
  1369. +    fake_int_result = 0;
  1370. +
  1371. +    eata_send_command((u32) &cp, (u32) base, EATA_CMD_DMA_SEND_CP);
  1372. +    
  1373. +    i = jiffies + 300;
  1374. +    while (!fake_int_result && jiffies <= i) 
  1375. +        /* nothing */;
  1376. +    
  1377. +    DBG(DBG_INTR3, printk("fake_int_result: %#lx hbastat %#lx scsistat %#lx,"
  1378. +              " buff %p sp %p\n",
  1379. +                          fake_int_result, (u32) (sp.hba_stat & 0x7f), 
  1380. +              (u32) sp.scsi_stat, buff, &sp));
  1381. +    
  1382. +    if (jiffies > i || (fake_int_result & 1))
  1383.          return (NULL);
  1384.      else
  1385.          return (buff);
  1386. @@ -610,7 +646,6 @@
  1387.      
  1388.  int check_blink_state(long base)
  1389.  {
  1390. -    uint ret = 0;
  1391.      uint loops = 10;
  1392.      ulong blinkindicator = 0x42445054;
  1393.      ulong state = 0x12345678;
  1394. @@ -621,10 +656,13 @@
  1395.      state = inl((uint) base + 1);
  1396.      }
  1397.  
  1398. +    DBG(DBG_BLINK, printk("Did Blink check. Status: %d\n",
  1399. +              (state == oldstate) && (state == blinkindicator)));
  1400. +
  1401.      if ((state == oldstate) && (state == blinkindicator))
  1402. -    ret = 1;
  1403. -    DBG(DBG_BLINK, printk("Did Blink check. Status: %d\n", ret));
  1404. -    return (ret);
  1405. +        return(TRUE);
  1406. +    else
  1407. +        return (FALSE);
  1408.  }
  1409.  
  1410.  int get_conf_PIO(struct eata_register *base, struct get_conf *buf)
  1411. @@ -632,8 +670,14 @@
  1412.      ulong loop = R_LIMIT;
  1413.      ushort *p;
  1414.  
  1415. -    if(check_region((uint)base, 9)) 
  1416. +    u8  warning = FALSE;
  1417. +    
  1418. +    if(check_region((int) base, 9)) {
  1419. +        if ((int)base == 0x1f0 || (int)base == 0x170) {
  1420. +            warning = 1;
  1421. +        } else
  1422.          return (FALSE);
  1423. +    }
  1424.   
  1425.      memset(buf, 0, sizeof(struct get_conf));
  1426.  
  1427. @@ -665,11 +709,15 @@
  1428.      
  1429.          while (inb((uint) base + HA_RSTATUS) & HA_SDRQ) 
  1430.              inw((uint) base + HA_RDATA);
  1431. +            if (warning == TRUE)
  1432. +                printk("Warning: HBA with IO on 0x%p dectected,\n"
  1433. +                       "         this IO space is already allocated, probably by the IDE driver.\n"
  1434. +                       "         This might lead to problems.", base);
  1435.           return (TRUE);
  1436.      } 
  1437.      } else {
  1438. -        printk("eata_dma: get_conf_PIO, error during transfer for HBA at %lx",
  1439. -           (long)base);
  1440. +        DBG(DBG_PROBE, printk("eata_dma: get_conf_PIO, error during transfer "
  1441. +                  "for HBA at %lx\n", (long)base));
  1442.      }
  1443.      return (FALSE);
  1444.  }
  1445. @@ -701,42 +749,14 @@
  1446.      
  1447.      DBG(DBG_REGISTER, print_config(gc));
  1448.  
  1449. -    if (!gc->DMA_support) {
  1450. -    printk("HBA at %#.8lx doesn't support DMA. Sorry\n",base);
  1451. -    return (FALSE);
  1452. -    }
  1453. -
  1454. -    if ((buff = get_board_data((uint)base, gc->IRQ, gc->scsi_id[3])) == NULL){
  1455. -        printk("HBA at %#lx didn't react on INQUIRY. Sorry.\n", (ulong) base);
  1456. -    return (FALSE);
  1457. -    }
  1458. -
  1459. -    if(gc->HAA_valid == FALSE || ntohl(gc->len) <= 0x1e) 
  1460. -        gc->MAX_CHAN = 0;
  1461. -
  1462. -    if(strncmp("PM2322", &buff[16], 6) && strncmp("PM3021", &buff[16], 6)
  1463. -         && strncmp("PM3222", &buff[16], 6) && strncmp("PM3224", &buff[16], 6))
  1464. +    if(gc->HAA_valid == FALSE || ntohl(gc->len) < 0x22) 
  1465.          gc->MAX_CHAN = 0;
  1466.  
  1467. -    /* if gc->DMA_valid it must be a PM2011 and we have to register it */
  1468. -    dma_channel = 0xff;
  1469. -    if (gc->DMA_valid) {
  1470. -    if (request_dma(dma_channel = (8 - gc->DMA_channel) & 7, "DPT_PM2011")) {
  1471. -        printk("Unable to allocate DMA channel %d for HBA PM2011.\n",
  1472. -        dma_channel);
  1473. -        return (FALSE);
  1474. -    }
  1475. -    } 
  1476. -    
  1477.      if (!reg_IRQ[gc->IRQ]) {    /* Interrupt already registered ? */
  1478. -    if (!request_irq(gc->IRQ, eata_int_handler, SA_INTERRUPT, "EATA-DMA")){
  1479. +        if (!request_irq(gc->IRQ, (void *) eata_fake_int_handler, SA_INTERRUPT, "eata_dma")){
  1480.          reg_IRQ[gc->IRQ] += (gc->MAX_CHAN+1);
  1481.          if (!gc->IRQ_TR)
  1482.          reg_IRQL[gc->IRQ] = TRUE;    /* IRQ is edge triggered */
  1483. -
  1484. -        /* We free it again so we can do a get_conf_dma and 
  1485. -         * allocate the interrupt again later */
  1486. -        free_irq(gc->IRQ);    
  1487.      } else {
  1488.          printk("Couldn't allocate IRQ %d, Sorry.", gc->IRQ);
  1489.          return (FALSE);
  1490. @@ -750,7 +770,47 @@
  1491.          reg_IRQ[gc->IRQ] += (gc->MAX_CHAN+1);
  1492.      }
  1493.  
  1494. -    request_region(base, 9, "eata_dma");
  1495. +    /* if gc->DMA_valid it must be an ISA HBA and we have to register it */
  1496. +    dma_channel = 0xff;
  1497. +    if (gc->DMA_valid) {
  1498. +        if (request_dma(dma_channel = (8 - gc->DMA_channel) & 7, "eata_dma")) {
  1499. +            printk("Unable to allocate DMA channel %d for ISA HBA at %#.4lx.\n",
  1500. +                   dma_channel, base);
  1501. +            reg_IRQ[gc->IRQ] -= (gc->MAX_CHAN+1);
  1502. +            if (reg_IRQ[gc->IRQ] == 0)
  1503. +                free_irq(gc->IRQ);
  1504. +            if (!gc->IRQ_TR)
  1505. +                reg_IRQL[gc->IRQ] = FALSE; 
  1506. +            return (FALSE);
  1507. +        }
  1508. +    } 
  1509. +    
  1510. +    buff = get_board_data(base, gc->IRQ, gc->scsi_id[3]);
  1511. +
  1512. +    if (buff == NULL) {
  1513. +        if (gc->DMA_support == FALSE)
  1514. +            printk("HBA at %#.4lx doesn't support DMA. Sorry\n", base);
  1515. +        else
  1516. +            printk("HBA at %#.4lx didn't react on INQUIRY. Sorry.\n", base);
  1517. +        if (gc->DMA_valid) 
  1518. +            free_dma(dma_channel);
  1519. +        reg_IRQ[gc->IRQ] -= (gc->MAX_CHAN+1);
  1520. +        if (reg_IRQ[gc->IRQ] == 0)
  1521. +            free_irq(gc->IRQ);
  1522. +        if (!gc->IRQ_TR)
  1523. +            reg_IRQL[gc->IRQ] = FALSE; 
  1524. +        return (FALSE);
  1525. +    }
  1526. +    
  1527. +    if (gc->DMA_support == FALSE && buff != NULL)  
  1528. +        printk("HBA %.12sat %#.4lx doesn't set the DMA_support flag correctly.\n",
  1529. +               &buff[16], base);
  1530. +    
  1531. +    request_region(base, 9, "eata_dma"); /* We already checked the 
  1532. +                                          * availability, so this could 
  1533. +                                          * only fail if we're on 
  1534. +                      * 0x1f0 or 0x170.
  1535. +                                          */
  1536.  
  1537.      if(ntohs(gc->queuesiz) == 0) {
  1538.          gc->queuesiz = ntohs(64);
  1539. @@ -769,6 +829,18 @@
  1540.      for (i = 0; i <= gc->MAX_CHAN; i++) {
  1541.  
  1542.      sh = scsi_register(tpnt, size);
  1543. +
  1544. +    if(sh == NULL) {
  1545. +        if (gc->DMA_valid) 
  1546. +            free_dma(dma_channel);
  1547. +        reg_IRQ[gc->IRQ] -= 1;
  1548. +        if (reg_IRQ[gc->IRQ] == 0)
  1549. +            free_irq(gc->IRQ);
  1550. +        if (!gc->IRQ_TR)
  1551. +            reg_IRQL[gc->IRQ] = FALSE; 
  1552. +        return (FALSE);
  1553. +    }
  1554. +
  1555.      hd = SD(sh);                   
  1556.  
  1557.      memset(hd->ccb, 0, (sizeof(struct eata_ccb) * ntohs(gc->queuesiz)) / 
  1558. @@ -808,8 +880,10 @@
  1559.  
  1560.      if (gc->OCS_enabled == TRUE) {
  1561.          sh->cmd_per_lun = sh->can_queue/C_P_L_DIV; 
  1562. +#if 0   /* The memory management seems to be more stable now */
  1563.          if (sh->cmd_per_lun > C_P_L_CURRENT_MAX)
  1564.              sh->cmd_per_lun = C_P_L_CURRENT_MAX;
  1565. +#endif
  1566.      } else {
  1567.          sh->cmd_per_lun = 1;
  1568.      }
  1569. @@ -940,7 +1014,7 @@
  1570.  {
  1571.  
  1572.  #ifndef CONFIG_PCI
  1573. -    printk("Kernel PCI support not enabled. Skipping.\n");
  1574. +    printk("Kernel PCI support not enabled. Skipping scan for PCI HBAs.\n");
  1575.  #else
  1576.  
  1577.      unchar pci_bus, pci_device_fn;
  1578. @@ -1041,14 +1115,12 @@
  1579.   
  1580.      geometry.drv[0].trans = geometry.drv[1].trans = 0;
  1581.  
  1582. -    printk("EATA (Extended Attachment) driver version: %d.%d%s\n"
  1583. -       "developed in co-operation with DPT\n"             
  1584. -       "(c) 1993-95 Michael Neuffer  neuffer@goofy.zdv.uni-mainz.de\n",
  1585. -       VER_MAJOR, VER_MINOR, VER_SUB);
  1586.      DBG((DBG_PROBE && DBG_DELAY)|| DPT_DEBUG,
  1587.      printk("Using lots of delays to let you read the debugging output\n"));
  1588.  
  1589. +    status = scsi_init_malloc(512, GFP_ATOMIC | GFP_DMA);
  1590. +    dma_scratch = scsi_init_malloc(512, GFP_ATOMIC | GFP_DMA);
  1591. +
  1592.      find_PCI(&gc, tpnt);
  1593.  
  1594.      for (i = 0; i < MAXEISA; i++) {
  1595. @@ -1064,23 +1136,40 @@
  1596.      }
  1597.  
  1598.      for (i = 0; i <= MAXIRQ; i++)
  1599. -    if (reg_IRQ[i])
  1600. +    if (reg_IRQ[i]){
  1601. +        free_irq(i);
  1602.          request_irq(i, eata_int_handler, SA_INTERRUPT, "EATA-DMA");
  1603. +    }
  1604.  
  1605.      HBA_ptr = first_HBA;
  1606.  
  1607. +    if (registered_HBAs != 0) {
  1608. +        printk("EATA (Extended Attachment) driver version: %d.%d%s\n"
  1609. +           "developed in co-operation with DPT\n"             
  1610. +           "(c) 1993-95 Michael Neuffer  neuffer@goofy.zdv.uni-mainz.de\n",
  1611. +           VER_MAJOR, VER_MINOR, VER_SUB);
  1612.      printk("Registered HBAs:\n");
  1613.      printk("HBA no. Boardtype: Revis: EATA: Bus: BaseIO: IRQ: DMA: Ch: ID: Pr: QS: SG: CPL:\n");
  1614.      for (i = 1; i <= registered_HBAs; i++) {
  1615. -        printk("scsi%-2d: %.10s v%s 2.0%c  %s %#.4x   %2d   %2x   %d   %d   %d  %2d  %2d   %2d\n", 
  1616. +        printk("scsi%-2d: %.10s v%s 2.0%c  %s %#.4lx   %2d",
  1617.             HBA_ptr->host_no, SD(HBA_ptr)->name, SD(HBA_ptr)->revision,
  1618.             SD(HBA_ptr)->EATA_revision, (SD(HBA_ptr)->bustype == 'P')? 
  1619.             "PCI ":(SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ",
  1620. -           (uint) HBA_ptr->base, HBA_ptr->irq, HBA_ptr->dma_channel, 
  1621. -           SD(HBA_ptr)->channel, HBA_ptr->this_id, SD(HBA_ptr)->primary, 
  1622. +                   (u32) HBA_ptr->base, HBA_ptr->irq);
  1623. +            if(HBA_ptr->dma_channel != 0xff)
  1624. +            printk("   %2x ", HBA_ptr->dma_channel);
  1625. +            else
  1626. +                printk("  %s", "BMST");
  1627. +            printk("  %d   %d   %c  %2d  %2d   %2d\n", SD(HBA_ptr)->channel, 
  1628. +                   HBA_ptr->this_id, (SD(HBA_ptr)->primary == TRUE)?'Y':'N', 
  1629.             HBA_ptr->can_queue, HBA_ptr->sg_tablesize, HBA_ptr->cmd_per_lun);
  1630.          HBA_ptr = SD(HBA_ptr)->next;
  1631.      }
  1632. +    } else 
  1633. +        scsi_init_free((void *)status, 512);
  1634. +    
  1635. +    scsi_init_free((void *)dma_scratch, 512);
  1636. +
  1637.      DBG(DPT_DEBUG,DELAY(1200));
  1638.  
  1639.      return (registered_HBAs);
  1640. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/eata_dma.h linux/drivers/scsi/eata_dma.h
  1641. --- v1.2.4/linux/drivers/scsi/eata_dma.h    Tue Feb 14 08:02:58 1995
  1642. +++ linux/drivers/scsi/eata_dma.h    Tue Apr 11 07:56:25 1995
  1643. @@ -2,7 +2,7 @@
  1644.  * Header file for eata_dma.c Linux EATA-DMA SCSI driver *
  1645.  * (c) 1993,94,95 Michael Neuffer                        *
  1646.  *********************************************************
  1647. -* last change: 95/02/13                                 *
  1648. +* last change: 95/04/10                                 *
  1649.  ********************************************************/
  1650.  
  1651.  
  1652. @@ -11,7 +11,7 @@
  1653.  
  1654.  #define VER_MAJOR 2
  1655.  #define VER_MINOR 3
  1656. -#define VER_SUB   "1a"
  1657. +#define VER_SUB   "5r"
  1658.  
  1659.  /************************************************************************
  1660.   * Here you can configure your drives that are using a non-standard     *
  1661. @@ -61,6 +61,7 @@
  1662.  #define DBG_QUEUE    0    /* Trace command queueing.         */
  1663.  #define DBG_INTR    0       /* Trace interrupt service routine.     */
  1664.  #define DBG_INTR2    0       /* Trace interrupt service routine.     */
  1665. +#define DBG_INTR3       0       /* Trace interrupt service routine.     */
  1666.  #define DBG_PROC        0       /* Debug proc-fs related statistics     */
  1667.  #define DBG_REGISTER    0       /* */
  1668.  #define DBG_ABNORM    1    /* Debug abnormal actions (reset, abort)*/
  1669. @@ -125,13 +126,15 @@
  1670.  
  1671.  #define SG_SIZE           64 
  1672.  
  1673. -#define C_P_L_CURRENT_MAX 10  /* Until this limit in the mm is removed    
  1674. +#define C_P_L_CURRENT_MAX 16  /* Until this limit in the mm is removed    
  1675.                     * Kernels < 1.1.86 died horrible deaths
  1676.                     * if you used values >2. The memory management
  1677.                     * since pl1.1.86 seems to cope with up to 10
  1678.                     * queued commands per device. 
  1679. +                               * Since 1.2.0 the memory management seems to 
  1680. +                               * have no more problems......
  1681.                     */
  1682. -#define C_P_L_DIV          4  /* 1 <= C_P_L_DIV <= 8            
  1683. +#define C_P_L_DIV          3  /* 1 <= C_P_L_DIV <= 8            
  1684.                     * You can use this parameter to fine-tune
  1685.                     * the driver. Depending on the number of 
  1686.                     * devices and their speed and ability to queue 
  1687. @@ -200,6 +203,24 @@
  1688.  #define HA_SREADY   0x40        /* drive ready               */
  1689.  #define HA_SBUSY    0x80        /* drive busy                */
  1690.  #define HA_SDRDY    HA_SSC+HA_SREADY+HA_SDRQ 
  1691. +
  1692. +#define HA_NO_ERROR      0x00
  1693. +#define HA_ERR_SEL_TO    0x01
  1694. +#define HA_ERR_CMD_TO    0x02
  1695. +#define HA_ERR_RESET     0x03
  1696. +#define HA_INIT_POWERUP  0x04
  1697. +#define HA_UNX_BUSPHASE  0x05
  1698. +#define HA_UNX_BUS_FREE  0x06
  1699. +#define HA_BUS_PARITY    0x07
  1700. +#define HA_SCSI_HUNG     0x08
  1701. +#define HA_UNX_MSGRJCT   0x09
  1702. +#define HA_RESET_STUCK   0x0a
  1703. +#define HA_RSENSE_FAIL   0x0b
  1704. +#define HA_PARITY_ERR    0x0c
  1705. +#define HA_CP_ABORT_NA   0x0d
  1706. +#define HA_CP_ABORTED    0x0e
  1707. +#define HA_CP_RESET_NA   0x0f
  1708. +#define HA_CP_RESET      0x10
  1709.  
  1710.  /**********************************************
  1711.   * Message definitions                        *
  1712. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c
  1713. --- v1.2.4/linux/drivers/scsi/scsi.c    Wed Mar 29 06:52:58 1995
  1714. +++ linux/drivers/scsi/scsi.c    Wed Apr 12 21:03:23 1995
  1715. @@ -387,7 +387,8 @@
  1716.  
  1717.  
  1718.        if(SCpnt->result) {
  1719. -        if ((driver_byte(SCpnt->result)  & DRIVER_SENSE) &&
  1720. +        if (((driver_byte(SCpnt->result) & DRIVER_SENSE) ||
  1721. +         (status_byte(SCpnt->result) & CHECK_CONDITION)) &&
  1722.          ((SCpnt->sense_buffer[0] & 0x70) >> 4) == 7) {
  1723.            if (SCpnt->sense_buffer[2] &0xe0)
  1724.          continue; /* No devices here... */
  1725. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h
  1726. --- v1.2.4/linux/drivers/scsi/scsi.h    Wed Mar 29 06:52:59 1995
  1727. +++ linux/drivers/scsi/scsi.h    Tue Apr 11 07:56:25 1995
  1728. @@ -50,6 +50,7 @@
  1729.  #define SEND_DIAGNOSTIC        0x1d
  1730.  #define ALLOW_MEDIUM_REMOVAL    0x1e
  1731.  
  1732. +#define SET_WINDOW              0x24
  1733.  #define READ_CAPACITY        0x25
  1734.  #define READ_10            0x28
  1735.  #define WRITE_10        0x2a
  1736. @@ -65,16 +66,26 @@
  1737.  #define SYNCHRONIZE_CACHE    0x35
  1738.  #define LOCK_UNLOCK_CACHE    0x36
  1739.  #define READ_DEFECT_DATA    0x37
  1740. +#define MEDIUM_SCAN             0x38
  1741.  #define COMPARE            0x39
  1742.  #define COPY_VERIFY        0x3a
  1743.  #define WRITE_BUFFER        0x3b
  1744.  #define READ_BUFFER        0x3c
  1745. +#define UPDATE_BLOCK            0x3d
  1746.  #define READ_LONG        0x3e
  1747. +#define WRITE_LONG              0x3f
  1748.  #define CHANGE_DEFINITION    0x40
  1749. +#define WRITE_SAME             0x41
  1750.  #define LOG_SELECT        0x4c
  1751.  #define LOG_SENSE        0x4d
  1752.  #define MODE_SELECT_10        0x55
  1753.  #define MODE_SENSE_10        0x5a
  1754. +#define WRITE_12                0xaa
  1755. +#define WRITE_VERIFY_12         0xae
  1756. +#define SEARCH_HIGH_12          0xb0
  1757. +#define SEARCH_EQUAL_12         0xb1
  1758. +#define SEARCH_LOW_12           0xb2
  1759. +#define SEND_VOLUME_TAG         0xb6
  1760.  
  1761.  extern void scsi_make_blocked_list(void);
  1762.  extern volatile int in_scan_scsis;
  1763. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c
  1764. --- v1.2.4/linux/drivers/scsi/sd.c    Sun Feb 19 11:33:13 1995
  1765. +++ linux/drivers/scsi/sd.c    Mon Apr 10 08:31:51 1995
  1766. @@ -358,8 +358,8 @@
  1767.    unsigned long flags;
  1768.    int flag = 0;
  1769.  
  1770. +  save_flags(flags);
  1771.    while (1==1){
  1772. -    save_flags(flags);
  1773.      cli();
  1774.      if (CURRENT != NULL && CURRENT->dev == -1) {
  1775.        restore_flags(flags);
  1776. @@ -387,12 +387,10 @@
  1777.  
  1778.      /*
  1779.       * The following restore_flags leads to latency problems.  FIXME.
  1780. +     * Using a "sti()" gets rid of the latency problems but causes
  1781. +     * race conditions and crashes.
  1782.       */
  1783. -#if 0
  1784.      restore_flags(flags);
  1785. -#else
  1786. -    sti();
  1787. -#endif
  1788.  
  1789.  /* This is a performance enhancement.  We dig down into the request list and
  1790.     try and find a queueable request (i.e. device not busy, and host able to
  1791. @@ -404,7 +402,6 @@
  1792.      if (!SCpnt && sd_template.nr_dev > 1){
  1793.        struct request *req1;
  1794.        req1 = NULL;
  1795. -      save_flags(flags);
  1796.        cli();
  1797.        req = CURRENT;
  1798.        while(req){
  1799. diff -u --recursive --new-file v1.2.4/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
  1800. --- v1.2.4/linux/drivers/scsi/st.c    Sun Apr  9 11:59:57 1995
  1801. +++ linux/drivers/scsi/st.c    Sun Apr  9 12:50:58 1995
  1802. @@ -1063,8 +1063,7 @@
  1803.      SCpnt->request.dev = dev;
  1804.      scsi_do_cmd (SCpnt,
  1805.               (void *) cmd, (STp->buffer)->b_data,
  1806. -             (STp->buffer)->buffer_size,
  1807. -             st_sleep_done, ST_TIMEOUT, MAX_RETRIES);
  1808. +             bytes, st_sleep_done, ST_TIMEOUT, MAX_RETRIES);
  1809.  
  1810.  
  1811.      /* this must be done with interrupts off */
  1812. diff -u --recursive --new-file v1.2.4/linux/fs/isofs/inode.c linux/fs/isofs/inode.c
  1813. --- v1.2.4/linux/fs/isofs/inode.c    Wed Feb 22 08:15:14 1995
  1814. +++ linux/fs/isofs/inode.c    Sun Apr  9 10:04:42 1995
  1815. @@ -79,7 +79,7 @@
  1816.      popt->rock = 'y';
  1817.      popt->cruft = 'n';
  1818.      popt->unhide = 'n';
  1819. -    popt->conversion = 'a';
  1820. +    popt->conversion = 'b';        /* default: no conversion */
  1821.      popt->blocksize = 1024;
  1822.      popt->mode = S_IRUGO;
  1823.      popt->gid = 0;
  1824. diff -u --recursive --new-file v1.2.4/linux/include/linux/major.h linux/include/linux/major.h
  1825. --- v1.2.4/linux/include/linux/major.h    Thu Feb 23 13:31:40 1995
  1826. +++ linux/include/linux/major.h    Tue Apr 11 08:03:29 1995
  1827. @@ -7,8 +7,8 @@
  1828.  
  1829.  /* limits */
  1830.  
  1831. -#define MAX_CHRDEV 32
  1832. -#define MAX_BLKDEV 32
  1833. +#define MAX_CHRDEV 64
  1834. +#define MAX_BLKDEV 64
  1835.  
  1836.  /*
  1837.   * assignments
  1838. diff -u --recursive --new-file v1.2.4/linux/include/linux/serial.h linux/include/linux/serial.h
  1839. --- v1.2.4/linux/include/linux/serial.h    Mon Feb 20 21:29:53 1995
  1840. +++ linux/include/linux/serial.h    Wed Apr 12 21:24:17 1995
  1841. @@ -140,6 +140,7 @@
  1842.      int            xmit_tail;
  1843.      int            xmit_cnt;
  1844.      struct tq_struct    tqueue;
  1845. +    struct tq_struct    tqueue_hangup;
  1846.      struct termios        normal_termios;
  1847.      struct termios        callout_termios;
  1848.      struct wait_queue    *open_wait;
  1849. @@ -160,7 +161,6 @@
  1850.   * time, instead of at rs interrupt time.
  1851.   */
  1852.  #define RS_EVENT_WRITE_WAKEUP    0
  1853. -#define RS_EVENT_HANGUP        1
  1854.  
  1855.  /*
  1856.   * Multiport serial configuration structure --- internal structure
  1857. diff -u --recursive --new-file v1.2.4/linux/include/linux/tqueue.h linux/include/linux/tqueue.h
  1858. --- v1.2.4/linux/include/linux/tqueue.h    Wed Dec 28 16:38:30 1994
  1859. +++ linux/include/linux/tqueue.h    Wed Apr 12 21:24:17 1995
  1860. @@ -57,7 +57,7 @@
  1861.  #define DECLARE_TASK_QUEUE(q)  task_queue q = &tq_last
  1862.  
  1863.  extern struct tq_struct tq_last;
  1864. -extern task_queue tq_timer, tq_immediate;
  1865. +extern task_queue tq_timer, tq_immediate, tq_scheduler;
  1866.  
  1867.  #ifdef INCLUDE_INLINE_FUNCS
  1868.  struct tq_struct tq_last = {
  1869. diff -u --recursive --new-file v1.2.4/linux/kernel/ksyms.c linux/kernel/ksyms.c
  1870. --- v1.2.4/linux/kernel/ksyms.c    Sun Apr  9 11:59:57 1995
  1871. +++ linux/kernel/ksyms.c    Wed Apr 12 21:24:17 1995
  1872. @@ -41,8 +41,10 @@
  1873.  #include <linux/tcp.h>
  1874.  #include "../net/inet/protocol.h"
  1875.  #include "../net/inet/arp.h"
  1876. +#if defined(CONFIG_PPP) || defined(CONFIG_SLIP)
  1877.  #include "../drivers/net/slhc.h"
  1878.  #endif
  1879. +#endif
  1880.  #ifdef CONFIG_PCI
  1881.  #include <linux/pci.h>
  1882.  #endif
  1883. @@ -209,6 +211,7 @@
  1884.      X(del_timer),
  1885.      X(tq_timer),
  1886.      X(tq_immediate),
  1887. +    X(tq_scheduler),
  1888.      X(tq_last),
  1889.      X(timer_active),
  1890.      X(timer_table),
  1891. @@ -273,12 +276,14 @@
  1892.  #ifdef CONFIG_INET    
  1893.      X(inet_add_protocol),
  1894.      X(inet_del_protocol),
  1895. +#if defined(CONFIG_PPP) || defined(CONFIG_SLIP)
  1896.      X(slhc_init),
  1897.      X(slhc_free),
  1898.      X(slhc_remember),
  1899.      X(slhc_compress),
  1900.      X(slhc_uncompress),
  1901.  #endif
  1902. +#endif
  1903.      /* Device callback registration */
  1904.      X(register_netdevice_notifier),
  1905.      X(unregister_netdevice_notifier),
  1906. @@ -323,6 +328,8 @@
  1907.      X(scsi_register),
  1908.      X(scsi_unregister),
  1909.      X(scsicam_bios_param),
  1910. +        X(scsi_init_malloc),
  1911. +        X(scsi_init_free),
  1912.      X(print_command),
  1913.  #endif
  1914.      /* Added to make file system as module */
  1915. diff -u --recursive --new-file v1.2.4/linux/kernel/sched.c linux/kernel/sched.c
  1916. --- v1.2.4/linux/kernel/sched.c    Sun Apr  9 11:59:57 1995
  1917. +++ linux/kernel/sched.c    Wed Apr 12 21:24:17 1995
  1918. @@ -45,6 +45,7 @@
  1919.  
  1920.  DECLARE_TASK_QUEUE(tq_timer);
  1921.  DECLARE_TASK_QUEUE(tq_immediate);
  1922. +DECLARE_TASK_QUEUE(tq_scheduler);
  1923.  
  1924.  /*
  1925.   * phase-lock loop variables
  1926. @@ -119,6 +120,7 @@
  1927.          printk("Aiee: scheduling in interrupt\n");
  1928.          intr_count = 0;
  1929.      }
  1930. +    run_task_queue(&tq_scheduler);
  1931.      cli();
  1932.      ticks = itimer_ticks;
  1933.      itimer_ticks = 0;
  1934.