home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / kernel-s / v1.2 / patch-1.2 / patch-1.2.1
Text File  |  1995-03-17  |  89KB  |  2,906 lines

  1. diff -u --recursive --new-file v1.2.0/linux/Makefile linux/Makefile
  2. --- v1.2.0/linux/Makefile    Thu Mar  9 20:37:33 1995
  3. +++ linux/Makefile    Thu Mar  9 20:35:42 1995
  4. @@ -1,6 +1,6 @@
  5.  VERSION = 1
  6.  PATCHLEVEL = 2
  7. -SUBLEVEL = 0
  8. +SUBLEVEL = 1
  9.  
  10.  ARCH = i386
  11.  
  12. diff -u --recursive --new-file v1.2.0/linux/README linux/README
  13. --- v1.2.0/linux/README    Fri Jan 27 10:51:52 1995
  14. +++ linux/README    Thu Mar  9 20:56:21 1995
  15. @@ -1,14 +1,10 @@
  16.  
  17. -    Linux kernel release 1.1.xx
  18. +    Linux kernel release 1.2.xx
  19.  
  20. -These are the release notes for linux version 1.1.  Read them carefully,
  21. +These are the release notes for linux version 1.2.  Read them carefully,
  22.  as they tell you what this is all about, explain how to install the
  23.  kernel, and what to do if something goes wrong. 
  24.  
  25. -Warning: This is a work in progress. If you are not reasonably at ease with
  26. -the C programming language, GCC, installing Linux, and recovering from
  27. -system crashes, please use the 1.0 version, or wait for 1.2.
  28. -
  29.  WHAT IS LINUX?
  30.  
  31.    Linux is a Unix clone for 386/486-based PCs written from scratch by
  32. @@ -23,12 +19,21 @@
  33.    It is distributed under the GNU General Public License - see the
  34.    accompanying COPYING file for more details. 
  35.  
  36. +DOCUMENTATION:
  37. +
  38. + - there is a lot of documentation available both in electronic form on
  39. +   the internet and in books, both Linux-specific and pertaining to
  40. +   general UNIX questions.  I'd recommend looking into the documentation
  41. +   subdirectories on any Linux ftp site for the LDP (Linux Documentation
  42. +   Project) books.  This README is not meant to be documentation on the
  43. +   system: there are much better sources available.
  44. +
  45.  INSTALLING the kernel:
  46.  
  47.   - If you install the full sources, do a
  48.  
  49.          cd /usr/src
  50. -        gzip -cd linux-1.1.XX.tar.gz | tar xfv -
  51. +        gzip -cd linux-1.2.XX.tar.gz | tar xfv -
  52.  
  53.     to get it all put in place. Replace "XX" with the version number of the
  54.     latest kernel.
  55. diff -u --recursive --new-file v1.2.0/linux/drivers/block/Makefile linux/drivers/block/Makefile
  56. --- v1.2.0/linux/drivers/block/Makefile    Sun Feb 12 15:00:45 1995
  57. +++ linux/drivers/block/Makefile    Wed Mar 15 08:47:26 1995
  58. @@ -23,6 +23,7 @@
  59.  
  60.  OBJS := ll_rw_blk.o ramdisk.o genhd.o 
  61.  SRCS := ll_rw_blk.c ramdisk.c genhd.c 
  62. +BLOCK_MODULE_OBJS =
  63.  
  64.  ifdef CONFIG_BLK_DEV_FD
  65.  OBJS := $(OBJS) floppy.o
  66. @@ -47,6 +48,8 @@
  67.  ifdef CONFIG_SBPCD
  68.  OBJS := $(OBJS) sbpcd.o
  69.  SRCS := $(SRCS) sbpcd.c
  70. +else
  71. +BLOCK_MODULE_OBJS := $(BLOCK_MODULE_OBJS) sbpcd.o
  72.  endif #CONFIG_SBPCD
  73.  
  74.  ifdef CONFIG_SBPCD2
  75. @@ -82,6 +85,8 @@
  76.  ifdef CONFIG_CDU535
  77.  OBJS := $(OBJS) sonycd535.o
  78.  SRCS := $(SRCS) sonycd535.c
  79. +else
  80. +BLOCK_MODULE_OBJS := $(BLOCK_MODULE_OBJS) sonycd535.o
  81.  endif
  82.  
  83.  all: block.a
  84. @@ -94,7 +99,10 @@
  85.  dep:
  86.      $(CPP) -M $(SRCS) > .depend
  87.  
  88. -modules:
  89. +modules: $(BLOCK_MODULE_OBJS)
  90. +    echo $(BLOCK_MODULE_OBJS) > ../../modules/BLOCK_MODULES
  91. +    (cd ../../modules;for i in $(BLOCK_MODULE_OBJS); do ln -sf ../drivers/block/$$i .; done)
  92. +
  93.  dummy:
  94.  
  95.  #
  96. diff -u --recursive --new-file v1.2.0/linux/drivers/block/README.ide linux/drivers/block/README.ide
  97. --- v1.2.0/linux/drivers/block/README.ide    Fri Feb 24 21:38:27 1995
  98. +++ linux/drivers/block/README.ide    Thu Mar  9 20:33:55 1995
  99. @@ -1,4 +1,4 @@
  100. -README.ide -- Information regarding ide.c and ide-cd.c (IDE driver in 1.1.95)
  101. +README.ide -- Information regarding ide.c and ide-cd.c (IDE driver in 1.2.x)
  102.  ================================================================================
  103.  Supported by:  mlord@bnr.ca           -- disks, interfaces, probing
  104.                 snyder@fnald0.fnal.gov -- cdroms, ATAPI, audio
  105. @@ -9,8 +9,8 @@
  106.  
  107.      - support for up to two IDE interfaces on one or two IRQs
  108.      - support for any mix of up to four disk and/or cdrom drives
  109. -    - support for reading IDE ATAPI cdrom drives (NEC, MITSUMI, VERSA, SONY)
  110. -    - support for audio functions on FX400,NEC-260 cdrom drives (others?)
  111. +    - support for reading IDE ATAPI cdrom drives (NEC,MITSUMI,VERTOS,SONY)
  112. +    - support for audio functions
  113.      - auto-detection of interfaces, drives, IRQs, and disk geometries
  114.        -- "single" drives should be jumpered as "master", not "slave"
  115.      - support for BIOSs which report "more than 16 heads" on disk drives
  116. diff -u --recursive --new-file v1.2.0/linux/drivers/block/README.sbpcd linux/drivers/block/README.sbpcd
  117. --- v1.2.0/linux/drivers/block/README.sbpcd    Thu Mar  9 20:37:33 1995
  118. +++ linux/drivers/block/README.sbpcd    Wed Mar 15 08:47:26 1995
  119. @@ -1,4 +1,4 @@
  120. -This README belongs to release 3.2 or newer of the SoundBlaster Pro
  121. +This README belongs to release 3.4 or newer of the SoundBlaster Pro
  122.  (Matsushita, Kotobuki, Panasonic, CreativeLabs, Longshine and soon TEAC, too)
  123.  CD-ROM driver for Linux.
  124.  
  125. @@ -18,12 +18,14 @@
  126.  
  127.  The quad-speed TEAC CD-55A drive uses the same interface types, but has a
  128.  totally different command and flow control scheme. Support is under
  129. -construction.
  130. +construction, but splitted: Greg Nowicki (nowicki@tardis.larc.nasa.gov)
  131. +cares about the separate driver "teaccd". Please, do not mail him merely for
  132. +asking "user questions" at the moment - the project is still a "baby".
  133.  
  134.  CreativeLabs has a new drive "CD-200". Support is under construction.
  135.  Detection should already work.
  136.  
  137. -Regarding CD200 and CD-55A support:
  138. +Regarding CD200 support:
  139.      Please, don't mail me about it if you are not a competent BETA tester 
  140.              (if you are: mail!; I do not have such drives).
  141.      Please, don't drop simple questions about the new drives in the
  142. @@ -189,15 +191,27 @@
  143.  "workman -c /dev/sbpcd &".
  144.  
  145.  
  146. +Using sbpcd as a "loadable module":
  147. +-----------------------------------
  148. +
  149. +If you do NOT select "Matsushita/Panasonic CDROM driver support" during the
  150. +"make config" of your kernel, you can build the "loadable module" sbpcd.o.
  151. +Read /usr/src/linux/README.modules on this.
  152. +
  153. +If sbpcd gets used as a module, the "audio copy" feature is disabled, and the
  154. +internal read-ahead buffer has a reduced size (the latter may affect throughput
  155. +a little bit under "slow" CPUs). Further, support of more than one interface
  156. +card (i.e. drives 4...15) is disabled.
  157. +
  158. +
  159.  Things of interest:
  160.  -------------------
  161.  
  162. -The driver is configured to try the SoundBlaster Pro type of interface at
  163. -I/O port 0x0230 first. If this is not appropriate, sbpcd.h should get changed
  164. +The driver is configured to try the LaserMate type of interface at I/O port
  165. +0x0340 first. If this is not appropriate, sbpcd.h should get changed
  166.  (you will find the right place - just at the beginning).
  167.  
  168. -No DMA and no IRQ is used, so the IRQ line stays free for the SB Pro sound
  169. -drivers.
  170. +No DMA and no IRQ is used.
  171.  
  172.  To reduce or increase the amount of kernel messages, edit sbpcd.c and play
  173.  with the "DBG_xxx" switches (initialization of the variable "sbpcd_debug").
  174. @@ -356,6 +370,20 @@
  175.  For every-day use, address and type should get configured within sbpcd.h. That
  176.  will stop the auto-probing due to success with the first try.
  177.  
  178. +The kernel command "sbpcd=0" suppresses each auto-probing and causes
  179. +the driver not to find any drive; it is meant for people who love sbpcd
  180. +so much that they do not want to miss it, even if they miss the drives. ;-)  
  181. +
  182. +If you configure "#define CDROM_PORT 0" in sbpcd.h, the auto-probing is
  183. +initially disabled and needs an explicit kernel command to get activated.
  184. +Once activated, it does not stop before success or end-of-list. This may be
  185. +useful within "universal" CDROM installation boot floppies (but using the 
  186. +loadable module would be better because it allows an "extended" auto-probing
  187. +without fearing NE2000 cards).
  188. +
  189. +To shorten the auto-probing list to a single entry, set DISTRIBUTION 0 within
  190. +sbpcd.c.
  191. +
  192.  
  193.  Setting up address and interface type:
  194.  --------------------------------------
  195. @@ -532,9 +560,7 @@
  196.  Bug reports, comments, wishes, donations (technical information is a donation,
  197.  too :-) etc. to
  198.                           emoenke@gwdg.de
  199. - or to                   eberhard_moenkeberg@rollo.central.de
  200.   or to my FIDO address:  Eberhard Moenkeberg, 2:2437/210.27
  201. -
  202.  
  203.  SnailMail address, preferable for CD editors if they want to submit a free
  204.  "cooperation" copy:
  205. diff -u --recursive --new-file v1.2.0/linux/drivers/block/ide.c linux/drivers/block/ide.c
  206. --- v1.2.0/linux/drivers/block/ide.c    Fri Feb 24 21:38:28 1995
  207. +++ linux/drivers/block/ide.c    Thu Mar  9 20:33:55 1995
  208. @@ -1,5 +1,5 @@
  209.  /*
  210. - *  linux/drivers/block/ide.c    Version 3.13  February 23, 1995
  211. + *  linux/drivers/block/ide.c    Version 3.14  March 7, 1995
  212.   *
  213.   *  Copyright (C) 1994, 1995  Linus Torvalds & authors (see below)
  214.   */
  215. @@ -104,6 +104,9 @@
  216.   *  Version 3,12    simplify logic for selecting initial mult_count
  217.   *              (fixes problems with buggy WD drives)
  218.   *  Version 3.13    remove excess "multiple mode disabled" messages
  219. + *  Version 3.14    fix ide_error() handling of BUSY_STAT
  220. + *            fix byte-swapped cdrom strings (again.. arghh!)
  221. + *            ignore INDEX bit when checking the ALTSTATUS reg
  222.   *
  223.   *  To do:
  224.   *    - special 32-bit controller-type detection & support
  225. @@ -612,17 +615,21 @@
  226.          return;
  227.      }
  228.  #endif    /* IDE_DRIVE_CMD */
  229. -    if (dev->type == disk && (stat & ERR_STAT)) {
  230. -        /* err has different meaning on cdrom */
  231. -        if (err & BBD_ERR)        /* retries won't help this! */
  232. -            rq->errors = ERROR_MAX;
  233. -        else if (err & TRK0_ERR)    /* help it find track zero */
  234. -            rq->errors |= ERROR_RECAL;
  235. -    }
  236. -    if ((stat & DRQ_STAT) && rq->cmd == READ) {
  237. -        int i = dev->mult_count ? dev->mult_count<<8 : 1<<8;
  238. -        while (i-- > 0)            /* try to flush data */
  239. -            (void) IN_BYTE(HD_DATA, dev->hwif);
  240. +    if (stat & BUSY_STAT) {        /* other bits are useless when BUSY */
  241. +        rq->errors |= ERROR_RESET;
  242. +    } else {
  243. +        if (dev->type == disk && (stat & ERR_STAT)) {
  244. +            /* err has different meaning on cdrom */
  245. +            if (err & BBD_ERR)        /* retries won't help this! */
  246. +                rq->errors = ERROR_MAX;
  247. +            else if (err & TRK0_ERR)    /* help it find track zero */
  248. +                rq->errors |= ERROR_RECAL;
  249. +        }
  250. +        if ((stat & DRQ_STAT) && rq->cmd == READ) {
  251. +            int i = dev->mult_count ? dev->mult_count<<8 : 1<<8;
  252. +            while (i-- > 0)            /* try to flush data */
  253. +                (void) IN_BYTE(HD_DATA, dev->hwif);
  254. +        }
  255.      }
  256.      if (GET_STAT(dev->hwif) & (BUSY_STAT|DRQ_STAT))
  257.          rq->errors |= ERROR_RESET;    /* Mmmm.. timing problem */
  258. @@ -1612,9 +1619,14 @@
  259.  
  260.      /*
  261.       *  WIN_IDENTIFY returns little-endian info,
  262. -     *  WIN_PIDENTIFY return big-endian info.
  263. +     *  WIN_PIDENTIFY *usually* returns little-endian info.
  264.       */
  265. -    bswap = (cmd == WIN_IDENTIFY);
  266. +    bswap = 1;
  267. +    if (cmd == WIN_PIDENTIFY) {
  268. +        if ((id->model[0] == 'N' && id->model[1] == 'E')
  269. +         || (id->model[0] == 'F' && id->model[1] == 'X'))
  270. +            bswap = 0;    /* NEC and *some* Mitsumi units */
  271. +    }                /* Vertos drives may still be weird */
  272.      fixstring (id->model,     sizeof(id->model),     bswap);
  273.      fixstring (id->fw_rev,    sizeof(id->fw_rev),    bswap);
  274.      fixstring (id->serial_no, sizeof(id->serial_no), bswap);
  275. @@ -1738,10 +1750,11 @@
  276.      }
  277.  #endif    /* PROBE_FOR_IRQS */
  278.      delay_10ms();                /* take a deep breath */
  279. -    if (IN_BYTE(HD_ALTSTATUS,DEV_HWIF) == IN_BYTE(HD_STATUS,DEV_HWIF))
  280. -        hd_status = HD_ALTSTATUS;    /* use non-intrusive polling */
  281. -    else
  282. +    if ((IN_BYTE(HD_ALTSTATUS,DEV_HWIF) ^ IN_BYTE(HD_STATUS,DEV_HWIF)) & ~INDEX_STAT) {
  283.          hd_status = HD_STATUS;        /* an ancient Seagate drive */
  284. +        printk("%s: probing with STATUS instead of ALTSTATUS\n", dev->name);
  285. +    } else
  286. +        hd_status = HD_ALTSTATUS;    /* use non-intrusive polling */
  287.      OUT_BYTE(cmd,HD_COMMAND);        /* ask drive for ID */
  288.      timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
  289.      timeout += jiffies;
  290. diff -u --recursive --new-file v1.2.0/linux/drivers/block/sbpcd.c linux/drivers/block/sbpcd.c
  291. --- v1.2.0/linux/drivers/block/sbpcd.c    Sun Jan 29 20:28:43 1995
  292. +++ linux/drivers/block/sbpcd.c    Wed Mar 15 08:47:26 1995
  293. @@ -6,10 +6,11 @@
  294.   *            Panasonic CI-101P.
  295.   *            Also for the Longshine LCS-7260 drive.
  296.   *            Also for the IBM "External ISA CD-Rom" drive.
  297. - *            Not for the TEAC CD-55A drive (yet).
  298. - *            Not for the CreativeLabs CD200 drive (who knows?).
  299. + *            Still not for the CreativeLabs CD200 drive (but should work soon).
  300. + *            Not for the TEAC CD-55A drive (separate project now).
  301. + *            Not for Funai or Sanyo drives.
  302.   *
  303. - *  NOTE:     This is release 3.3.
  304. + *  NOTE:     This is release 3.4.
  305.   *            It works with my SbPro & drive CR-521 V2.11 from 2/92
  306.   *            and with the CR-562-B V0.75 on a "naked" Panasonic
  307.   *            CI-101P interface. And vice versa. 
  308. @@ -180,6 +181,12 @@
  309.   *
  310.   *  3.3  Working with CD200 support. Maybe a simple read is already possible.
  311.   *
  312. + *  3.4  Auto-probing stops if an address of 0 is seen (to be entered with
  313. + *       the kernel command line).
  314. + *       Made the driver "loadable". If used as a module, "audio copy" is
  315. + *       disabled, and the internal read ahead data buffer has a reduced size
  316. + *       of 4 kB; so, throughput may be reduced a little bit with slow CPUs.
  317. + *
  318.   *  TODO
  319.   *
  320.   *     disk change detection
  321. @@ -196,7 +203,6 @@
  322.   * 
  323.   *
  324.   *   Copyright (C) 1993, 1994, 1995  Eberhard Moenkeberg <emoenke@gwdg.de>
  325. - *                               or <eberhard_moenkeberg@rollo.central.de>
  326.   *
  327.   *                  If you change this software, you should mail a .diff
  328.   *                  file with some description lines to emoenke@gwdg.de.
  329. @@ -224,9 +230,17 @@
  330.  #include <linux/config.h>
  331.  #include <linux/errno.h>
  332.  
  333. +#ifdef MODULE
  334. +#include <linux/malloc.h>
  335. +#include <linux/module.h>
  336. +#include <linux/version.h>
  337. +#ifndef CONFIG_MODVERSIONS
  338. +char kernel_version[]=UTS_RELEASE;
  339. +#endif
  340. +#endif MODULE
  341. +
  342.  #include <linux/sched.h>
  343.  #include <linux/mm.h>
  344. -/* #undef DS */
  345.  #include <linux/timer.h>
  346.  #include <linux/fs.h>
  347.  #include <linux/kernel.h>
  348. @@ -253,18 +267,19 @@
  349.  #define MAJOR_NR MATSUSHITA_CDROM4_MAJOR /* fourth driver issue */
  350.  #endif
  351.  
  352. +#ifdef MODULE
  353. +#include "/usr/src/linux/drivers/block/blk.h"
  354. +#else
  355.  #include "blk.h"
  356. +#define MOD_INC_USE_COUNT
  357. +#define MOD_DEC_USE_COUNT
  358. +#endif MODULE
  359.  
  360. -#define VERSION "3.3 Eberhard Moenkeberg <emoenke@gwdg.de>"
  361. +#define VERSION "3.4 Eberhard Moenkeberg <emoenke@gwdg.de>"
  362.  
  363.  /*
  364. - * still testing around...
  365. + *
  366.   */
  367. -#define TEAC 0 /* set to 1 for TEAC CD-55A detection test (not more) */
  368. -
  369. -#define MULTISESSION_BY_DRIVER 0 /* if set to 0 here, we need the counterpart
  370. -                                  * in linux/fs/isofs/inode.c
  371. -                                  */
  372.  #define READ_AUDIO 4 /* max. number of audio frames to read with one */
  373.                       /* request (allocates n* 2352 bytes kernel memory!) */
  374.  #define JUKEBOX 1 /* tray control: eject tray if no disk is in */
  375. @@ -368,18 +383,18 @@
  376.  /* due to incomplete address decoding of the SbPro card, these must be last */
  377.    0x630, 0, /* "sound card #9" (default) */
  378.    0x650, 0, /* "sound card #9" */
  379. +#ifdef MODULE
  380.  /*
  381. - * some "hazardous" locations
  382. + * some "hazardous" locations (no harm with the loadable version)
  383.   * (will stop the bus if a NE2000 ethernet card resides at offset -0x10)
  384.   */
  385. -#if 0
  386.    0x330, 0, /* Lasermate, CI-101P, WDH-7001C */
  387.    0x350, 0, /* Lasermate, CI-101P */
  388.    0x350, 2, /* SPEA Media FX */
  389.    0x370, 0, /* Lasermate, CI-101P */
  390.    0x290, 1, /* Soundblaster 16 */
  391.    0x310, 0, /* Lasermate, CI-101P, WDH-7001C */
  392. -#endif
  393. +#endif MODULE
  394.  #endif DISTRIBUTION
  395.  };
  396.  #else
  397. @@ -448,7 +463,6 @@
  398.   * (1<<DBG_AUD)  "read audio" debugging
  399.   * (1<<DBG_SEQ)  Sequoia interface configuration trace
  400.   * (1<<DBG_LCS)  Longshine LCS-7260 debugging trace
  401. - * (1<<DBG_TEA)  TEAC CD-55A debugging trace
  402.   * (1<<DBG_CD2)  MKE CD200 debugging trace
  403.   * (1<<DBG_000)  unnecessary information
  404.   */
  405. @@ -480,8 +494,10 @@
  406.  static struct cdrom_multisession ms_info;
  407.  
  408.  static char *str_sb = "SoundBlaster";
  409. +static char *str_sb_l = "soundblaster";
  410.  static char *str_lm = "LaserMate";
  411.  static char *str_sp = "SPEA";
  412. +static char *str_sp_l = "spea";
  413.  char *type;
  414.  #if !(SBPCD_ISSUE-1)
  415.  static char *major_name="sbpcd";
  416. @@ -503,16 +519,20 @@
  417.  #endif FUTURE
  418.  
  419.  /*==========================================================================*/
  420. +#ifdef MODULE
  421. +/* some restrictions for the "loadable" version */
  422. +#define SBP_BUFFER_FRAMES 2 /* kmalloc() limit */
  423. +#define SBP_BUFFER_AUDIO_FRAMES 0
  424. +#else
  425.  #define SBP_BUFFER_FRAMES 4 /* driver's own read_ahead, data mode */
  426.  #define SBP_BUFFER_AUDIO_FRAMES READ_AUDIO /* buffer for read audio mode */
  427. -
  428. +#endif MODULE
  429.  /*==========================================================================*/
  430.  
  431.  static u_char family0[]="MATSHITA"; /* MKE CR-52x */
  432.  static u_char family1[]="CR-56"; /* MKE CR-56x */
  433.  static u_char family2[]="CD200"; /* MKE CD200 */
  434.  static u_char familyL[]="LCS-7260"; /* Longshine LCS-7260 */
  435. -static u_char familyT[]="CD-55A"; /* TEAC CD-55A (still unknown)*/
  436.  
  437.  static u_int response_count=0;
  438.  static u_int flags_cmd_out;
  439. @@ -580,9 +600,6 @@
  440.    
  441.    u_char f_multisession;
  442.    u_int lba_multi;
  443. -#if MULTISESSION_BY_DRIVER
  444. -  u_int last_redirect;
  445. -#endif MULTISESSION_BY_DRIVER
  446.    int first_session;
  447.    int last_session;
  448.    
  449. @@ -829,6 +846,10 @@
  450.  #ifdef CDMKE
  451.    int i;
  452.  
  453. +#ifdef MODULE
  454. +  sbp_sleep(150);
  455. +  for (i=maxtim_data;i!=0;i--) inb(CDi_status);
  456. +#else
  457.    if (current == task[0])
  458.      for (i=maxtim02;i!=0;i--) inb(CDi_status);
  459.    else 
  460. @@ -836,6 +857,7 @@
  461.        sbp_sleep(150);
  462.        for (i=maxtim_data;i!=0;i--) inb(CDi_status);
  463.      }
  464. +#endif MODULE
  465.  #else
  466.    timed_out=0;
  467.  #if 0
  468. @@ -857,6 +879,20 @@
  469.    int i,j;
  470.    u_long timeout;
  471.    
  472. +#ifdef MODULE
  473. +    for(timeout = jiffies + 1000, i=maxtim_data; timeout > jiffies; )
  474. +      {
  475. +    for ( ;i!=0;i--)
  476. +      {
  477. +        j=inb(CDi_status);
  478. +        if (!(j&s_not_data_ready)) return (j);
  479. +        if (!(j&s_not_result_ready)) return (j);
  480. +        if (fam0L_drive) if (j&s_attention) return (j);
  481. +      }
  482. +    sbp_sleep(1);
  483. +    i = 1;
  484. +      }
  485. +#else
  486.    if (current == task[0])
  487.      for(i=maxtim16;i!=0;i--)
  488.        {
  489. @@ -878,47 +914,35 @@
  490.      sbp_sleep(1);
  491.      i = 1;
  492.        }
  493. +#endif MODULE
  494.    DPRINTF((DBG_LCS,"SBPCD: CDi_stat_loop failed\n"));
  495.    return (-1);
  496.  }
  497.  /*==========================================================================*/
  498. -#if TEAC-X
  499. -/*==========================================================================*/
  500. -static int tst_DataReady(void)
  501. -{
  502. -  int i;
  503. -  
  504. -  i=inb(CDi_status);
  505. -  if (i&s_not_data_ready) return (0);
  506. -  return (1);
  507. -}
  508. -/*==========================================================================*/
  509. -static int tst_ResultReady(void)
  510. -{
  511. -  int i;
  512. -  
  513. -  i=inb(CDi_status);
  514. -  if (i&s_not_result_ready) return (0);
  515. -  return (1);
  516. -}
  517. -/*==========================================================================*/
  518. -static int tst_Attention(void)
  519. -{
  520. -  int i;
  521. -  
  522. -  i=inb(CDi_status);
  523. -  if (i&s_attention) return (1);
  524. -  return (0);
  525. -}
  526. -/*==========================================================================*/
  527. -#endif TEAC-X
  528. -/*==========================================================================*/
  529.  static int ResponseInfo(void)
  530.  {
  531.    int i,j, st=0;
  532.    u_long timeout;
  533.  
  534.    DPRINTF((DBG_000,"SBPCD: ResponseInfo entered.\n"));
  535. +#ifdef MODULE
  536. +  for (i=0, timeout = jiffies + 100; i < response_count; i++) 
  537. +    {
  538. +      for (j=maxtim_data; ; )
  539. +    {
  540. +      for ( ;j!=0;j-- )
  541. +        {
  542. +          st=inb(CDi_status);
  543. +          if (!(st&s_not_result_ready)) break;
  544. +        }
  545. +      if (j != 0 || timeout <= jiffies) break;
  546. +      sbp_sleep(0);
  547. +      j = 1;
  548. +    }
  549. +      if (timeout <= jiffies) return (-1);
  550. +      infobuf[i]=inb(CDi_info);
  551. +    }
  552. +#else
  553.    if (current == task[0])
  554.      for (i=0;i<response_count;i++)
  555.        {
  556. @@ -953,15 +977,16 @@
  557.        infobuf[i]=inb(CDi_info);
  558.      }
  559.      }
  560. +#endif MODULE
  561.    DPRINTF((DBG_000,"SBPCD: ResponseInfo: done.\n"));
  562.    return (0);
  563.  }
  564.  /*==========================================================================*/
  565. -static int EvaluateStatus(int st)
  566. +static void EvaluateStatus(int st)
  567.  {
  568. +  DriveStruct[d].status_byte=0;
  569.    if (fam0_drive)
  570.      {
  571. -      DriveStruct[d].status_byte=0;
  572.        if (st&p_caddin_old) DriveStruct[d].status_byte |= p_door_closed|p_caddy_in;
  573.        if (st&p_spinning) DriveStruct[d].status_byte |= p_spinning;
  574.        if (st&p_check) DriveStruct[d].status_byte |= p_check;
  575. @@ -970,23 +995,26 @@
  576.      }
  577.    else if (famL_drive)
  578.      {
  579. -      DriveStruct[d].status_byte=0;
  580.        if (st&p_caddin_old) DriveStruct[d].status_byte |= p_disk_ok|p_caddy_in;
  581.        if (st&p_spinning) DriveStruct[d].status_byte |= p_spinning;
  582.        if (st&p_check) DriveStruct[d].status_byte |= p_check;
  583.        if (st&p_busy_old) DriveStruct[d].status_byte |= p_busy_new;
  584.        if (st&p_lcs_door_closed) DriveStruct[d].status_byte |= p_door_closed;
  585.        if (st&p_lcs_door_locked) DriveStruct[d].status_byte |= p_door_locked;
  586. -      }
  587. -  else if (fam1_drive)
  588. -    {
  589. -      DriveStruct[d].status_byte=st;
  590. -      st=p_success_old; /* for new drives: fake "successful" bit of old drives */
  591.      }
  592. -  else /* CD200, CD-55A */
  593. +  else if (fam2_drive)
  594.      {
  595. +      if (st&p2_check) DriveStruct[d].status_byte |= p1_check;
  596. +      if (st&p2_door_closed) DriveStruct[d].status_byte |= p1_door_closed;
  597. +      if (st&p2_disk_in) DriveStruct[d].status_byte |= p1_disk_in;
  598. +      if (st&p2_busy1) DriveStruct[d].status_byte |= p1_busy;
  599. +      if (st&p2_busy2) DriveStruct[d].status_byte |= p1_busy;
  600. +      if (st&p2_spinning) DriveStruct[d].status_byte |= p1_spinning;
  601. +      if (st&p2_door_locked) DriveStruct[d].status_byte |= p1_door_locked;
  602. +      if (st&p2_disk_ok) DriveStruct[d].status_byte |= p1_disk_ok;
  603.      }
  604. -  return (st);
  605. +  else if (fam1_drive) DriveStruct[d].status_byte=st;
  606. +  return;
  607.  }
  608.  /*==========================================================================*/
  609.  static int ResponseStatus(void)
  610. @@ -995,7 +1023,24 @@
  611.    u_long timeout;
  612.  
  613.    DPRINTF((DBG_STA,"SBPCD: doing ResponseStatus...\n"));
  614. -
  615. +#ifdef MODULE
  616. +  if (flags_cmd_out & f_respo3) timeout = jiffies;
  617. +  else if (flags_cmd_out & f_respo2) timeout = jiffies + 1600;
  618. +  else timeout = jiffies + 400;
  619. +  j=maxtim_8;
  620. +  do
  621. +    {
  622. +      for ( ;j!=0;j--)
  623. +    { 
  624. +      i=inb(CDi_status);
  625. +      if (!(i&s_not_result_ready)) break;
  626. +    }
  627. +      if (j != 0 || timeout <= jiffies) break;
  628. +      sbp_sleep(0);
  629. +      j = 1;
  630. +    }
  631. +  while (1);
  632. +#else
  633.    if (current == task[0])
  634.      {
  635.        if (flags_cmd_out & f_respo3) j = maxtim_8;
  636. @@ -1026,16 +1071,17 @@
  637.      }
  638.        while (1);
  639.      }
  640. +#endif MODULE
  641.    if (j==0) 
  642.      { if ((flags_cmd_out & f_respo3) == 0)
  643.      DPRINTF((DBG_STA,"SBPCD: ResponseStatus: timeout.\n"));
  644. -      EvaluateStatus(0);
  645. +      DriveStruct[d].status_byte=0;
  646.        return (-1);
  647.      }
  648.    i=inb(CDi_info);
  649.    DPRINTF((DBG_STA,"SBPCD: ResponseStatus: response %2X.\n", i));
  650. -  i=EvaluateStatus(i);
  651. -  return (i);
  652. +  EvaluateStatus(i);
  653. +  return (0);
  654.  }
  655.  /*==========================================================================*/
  656.  static void xx_ReadStatus(void)
  657. @@ -1046,9 +1092,7 @@
  658.    SBPCD_CLI;
  659.    if (fam0L_drive) OUT(CDo_command,CMD0_STATUS);
  660.    else if (fam1_drive) OUT(CDo_command,CMD1_STATUS);
  661. -  else /* CD200, CD-55A */
  662. -    {
  663. -    }
  664. +  else if (fam2_drive) OUT(CDo_command,CMD2_STATUS);
  665.    if (!fam0L_drive) for (i=0;i<6;i++) OUT(CDo_command,0);
  666.    SBPCD_STI;
  667.  }
  668. @@ -1080,13 +1124,6 @@
  669.        response_count=6;
  670.        flags_cmd_out=f_putcmd;
  671.      }
  672. -  else /* CD-55A */
  673. -    {
  674. -      return (-1);
  675. -      drvcmd[0]=CMDT_READ_ERR;
  676. -      response_count=5;
  677. -      flags_cmd_out=f_putcmd;
  678. -    }
  679.    i=cmd_out(7);
  680.    DriveStruct[d].error_byte=0;
  681.    DPRINTF((DBG_ERR,"SBPCD: xx_ReadError: cmd_out(82) returns %d (%02X)\n",i,i));
  682. @@ -1201,10 +1238,6 @@
  683.        drvcmd[5]=pos&0x00FF;
  684.        flags_cmd_out=f_putcmd|f_ResponseStatus;
  685.      }
  686. -  else /* CD-55A */
  687. -    {
  688. -      return (-1);
  689. -    }
  690.    response_count=0;
  691.    i=cmd_out(7);
  692.    return (i);
  693. @@ -1234,10 +1267,6 @@
  694.        drvcmd[4]=0x01;
  695.        flags_cmd_out=f_putcmd|f_respo2|f_ResponseStatus|f_obey_p_check;
  696.      }
  697. -  else /* CD-55A */
  698. -    {
  699. -      return (-1);
  700. -    }
  701.    response_count=0;
  702.    i=cmd_out(7);
  703.    DriveStruct[d].in_SpinUp = 0;
  704. @@ -1268,10 +1297,6 @@
  705.        drvcmd[1]=1;
  706.        flags_cmd_out=f_putcmd|f_respo2|f_lopsta|f_getsta|f_ResponseStatus|f_obey_p_check|f_bit1;
  707.      }
  708. -  else /* CD-55A */
  709. -    {
  710. -      return (-1);
  711. -    }
  712.    i=cmd_out(7);
  713.    return (i);
  714.  }
  715. @@ -1307,10 +1332,6 @@
  716.      }
  717.        flags_cmd_out=f_putcmd|f_ResponseStatus;
  718.      }
  719. -  else /* CD-55A */
  720. -    {
  721. -      return (-1);
  722. -    }
  723.    i=cmd_out(7);
  724.    return (i);
  725.  }
  726. @@ -1462,10 +1483,6 @@
  727.        drvcmd[5]=value0;
  728.        flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  729.      }
  730. -  else /* CD-55A */
  731. -    {
  732. -      return (-1);
  733. -    }
  734.    response_count=0;
  735.    i=cmd_out(7);
  736.    if (i>0) return (i);
  737. @@ -1505,10 +1522,6 @@
  738.        i=cmd_out(7);
  739.        OUT(CDo_reset,0x00);
  740.      }
  741. -  else /* CD-55A */
  742. -    {
  743. -      return (-1);
  744. -    }
  745.    if (famL_drive) sbp_sleep(500); /* wait 5 seconds */
  746.    else sbp_sleep(100); /* wait a second */
  747.    flush_status();
  748. @@ -1586,10 +1599,6 @@
  749.      flags_cmd_out=f_putcmd|f_respo2|f_lopsta|f_getsta|f_ResponseStatus|
  750.        f_obey_p_check;
  751.      }
  752. -  else /* CD-55A */
  753. -    {
  754. -      return (-1);
  755. -    }
  756.    i=cmd_out(7);
  757.    return (i);
  758.  }
  759. @@ -1621,10 +1630,6 @@
  760.        if (lock==1) drvcmd[1]=0x01;
  761.        flags_cmd_out=f_putcmd|f_respo2|f_lopsta|f_getsta|f_ResponseStatus|f_obey_p_check|f_bit1;
  762.      }
  763. -  else /* CD-55A */
  764. -    {
  765. -      return (-1);
  766. -    }
  767.    i=cmd_out(7);
  768.    DPRINTF((DBG_LCS,"SBPCD: p_door_locked bit %d after\n", st_door_locked));
  769.    return (i);
  770. @@ -1658,10 +1663,6 @@
  771.        flags_cmd_out=f_putcmd|f_respo2|f_lopsta|f_getsta|
  772.       f_ResponseStatus|f_obey_p_check|f_bit1;
  773.      }
  774. -  else /* CD-55A */
  775. -    {
  776. -      return (-1);
  777. -    }
  778.    i=cmd_out(7);
  779.    DPRINTF((DBG_LCS,"SBPCD: p_door_closed bit %d after\n", st_door_closed));
  780.    return (i);
  781. @@ -1699,10 +1700,6 @@
  782.           flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  783.        response_count=13;
  784.      }
  785. -      else /* CD-55A */
  786. -    {
  787. -      return (-1);
  788. -    }
  789.        i=cmd_out(7);
  790.        if (i<0) return (i);
  791.        DPRINTF((DBG_SQ,"SBPCD: xx_ReadSubQ:"));
  792. @@ -1755,18 +1752,11 @@
  793.      flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  794.        response_count=2;
  795.      }
  796. -  else /* CD-55A */
  797. -    {
  798. -      return (-1);
  799. -    }
  800.    i=cmd_out(7);
  801.    if (i<0) return (i);
  802.    i=0;
  803.    if (fam1_drive) DriveStruct[d].sense_byte=infobuf[i++];
  804.    else if (fam0L_drive) DriveStruct[d].sense_byte=0;
  805. -  else /* CD-55A */
  806. -    {
  807. -    }
  808.    DriveStruct[d].frame_size=make16(infobuf[i],infobuf[i+1]);
  809.  
  810.    DPRINTF((DBG_XA,"SBPCD: xx_ModeSense: "));
  811. @@ -1816,10 +1806,6 @@
  812.        else
  813.      flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  814.      }
  815. -  else /* CD-55A */
  816. -    {
  817. -      return (-1);
  818. -    }
  819.    response_count=0;
  820.    i=cmd_out(7);
  821.    if (i<0) return (i);
  822. @@ -1860,10 +1846,6 @@
  823.        else
  824.      flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  825.      }
  826. -  else /* CD-55A */
  827. -    {
  828. -      return (-1);
  829. -    }
  830.    i=cmd_out(7);
  831.    if (i<0) return (i);
  832.    if (fam1_drive)
  833. @@ -1931,10 +1913,6 @@
  834.              }
  835.          }
  836.      }
  837. -  else /* CD-55A */
  838. -    {
  839. -      return (-1);
  840. -    }
  841.    DriveStruct[d].vol_chan0=chan0;
  842.    DriveStruct[d].vol_ctrl0=vol0;
  843.    DriveStruct[d].vol_chan1=chan1;
  844. @@ -1976,10 +1954,6 @@
  845.        else
  846.      flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  847.      }
  848. -  else /* CD-55A */
  849. -    {
  850. -      return (-1);
  851. -    }
  852.    i=cmd_out(7);
  853.    if (i<0) return (i);
  854.    if (fam1_drive) DriveStruct[d].CDsize_frm=msf2blk(make32(make16(0,infobuf[0]),make16(infobuf[1],infobuf[2])))+CD_BLOCK_OFFSET;
  855. @@ -2021,10 +1995,6 @@
  856.        response_count=8;
  857.        flags_cmd_out=f_putcmd;
  858.      }
  859. -  else /* CD-55A */
  860. -    {
  861. -      return (-1);
  862. -    }
  863.    i=cmd_out(7);
  864.    if (i<0) return (i);
  865.    DriveStruct[d].xa_byte=infobuf[0];
  866. @@ -2117,10 +2087,6 @@
  867.        else
  868.      flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  869.      }
  870. -  else /* CD-55A */
  871. -    {
  872. -      return (-1);
  873. -    }
  874.    drvcmd[2]=num;
  875.    i=cmd_out(7);
  876.    if (i<0) return (i);
  877. @@ -2159,10 +2125,7 @@
  878.      flags_cmd_out=f_putcmd;
  879.    else if (fam01_drive)
  880.      flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
  881. -  else /* CD200, CD-55A */
  882. -    {
  883. -      return (-1);
  884. -    }
  885. +  else if (fam2_drive) return (-1); /* not implemented yet */
  886.    i=cmd_out(7);
  887.    return (i);
  888.  }
  889. @@ -2181,7 +2144,7 @@
  890.        DriveStruct[d].UPC_buf[i]=((*p++)<<4)&0xFF;
  891.        DriveStruct[d].UPC_buf[i] |= *p++;
  892.      }
  893. -      else /* CD200, CD-55A */
  894. +      else /* CD200 */
  895.      {
  896.        return (-1);
  897.      }
  898. @@ -2197,6 +2160,8 @@
  899.    int block, checksum;
  900.  #endif TEST_UPC
  901.  
  902. +  if (fam2_drive) return (0); /* not implemented yet */
  903. +
  904.    DriveStruct[d].diskstate_flags &= ~upc_bit;
  905.  #if TEST_UPC
  906.    for (block=CD_BLOCK_OFFSET+1;block<CD_BLOCK_OFFSET+200;block++)
  907. @@ -2225,7 +2190,7 @@
  908.        response_count=0;
  909.        flags_cmd_out=f_putcmd|f_lopsta|f_getsta|f_ResponseStatus|f_obey_p_check|f_bit1;
  910.      }
  911. -      else /* CD200, CD-55A */
  912. +      else /* CD200 */
  913.      {
  914.        return (-1);
  915.      }
  916. @@ -2296,9 +2261,6 @@
  917.        DriveStruct[d].f_multisession=1;
  918.        DriveStruct[d].lba_multi=msf2blk(make32(make16(0,infobuf[1]),
  919.                            make16(infobuf[2],infobuf[3])));
  920. -#if MULTISESSION_BY_DRIVER
  921. -      DriveStruct[d].last_redirect=19;
  922. -#endif MULTISESSION_BY_DRIVER
  923.        DPRINTF((DBG_MUL,"SBPCD: MultiSession CD detected: %02X %02X %02X %02X %02X %02X (%d)\n",
  924.             infobuf[0], infobuf[1], infobuf[2],
  925.             infobuf[3], infobuf[4], infobuf[5],
  926. @@ -2324,15 +2286,8 @@
  927.      {
  928.        DPRINTF((DBG_MUL,"SBPCD: MultiSession base: %06X\n", DriveStruct[d].lba_multi));
  929.        DriveStruct[d].f_multisession=1;
  930. -#if MULTISESSION_BY_DRIVER
  931. -      DriveStruct[d].last_redirect=19;
  932. -#endif MULTISESSION_BY_DRIVER
  933.      }
  934.      }
  935. -  else /* CD-55A */
  936. -    {
  937. -      return (-1);
  938. -    }
  939.    return (0);
  940.  }
  941.  /*==========================================================================*/
  942. @@ -2408,53 +2363,6 @@
  943.  #endif CDMKE
  944.  }
  945.  /*==========================================================================*/
  946. -#if TEAC-X
  947. -/*==========================================================================*/
  948. -static void teac_reset(int drv_id)
  949. -{
  950. -  int i;
  951. -
  952. -  OUT(CDo_sel_i_d,0);
  953. -  OUT(CDo_enable,drv_id);
  954. -  OUT(CDo_command,CMDT_RESET);
  955. -  for (i=0;i<9;i++) OUT(CDo_command,0);
  956. -  DPRINTF((DBG_TEA,"SBPCD: TEAC soft reset.\n"));
  957. -  sbp_sleep(100); /* wait a second */
  958. -}
  959. -/*==========================================================================*/
  960. -static int look_for_TEAC_drive(int drv_id)
  961. -{
  962. -  int i;
  963. -  if (sbpro_type!=1) teac_reset(drv_id);
  964. -
  965. -  OUT(CDo_enable,drv_id);
  966. -  OUT(CDo_sel_i_d,0);
  967. -  i=inb(CDi_status);
  968. -  if (i&s_not_result_ready) return (-1); /* drive not present */
  969. -  i=inb(CDi_info);
  970. -  DPRINTF((DBG_TEA,"SBPCD: TEAC look_for_drive: %02X.\n",i));
  971. -  if (i!=0x55) return (-2); /* something else present */
  972. -  return (1); /* drive found */
  973. -}
  974. -/*==========================================================================*/
  975. -static int find_teac_drives(void)
  976. -{
  977. -  int i, j, found;
  978. -
  979. -  found=0;
  980. -  for (i=0;i<4;i++)
  981. -    {
  982. -      j=look_for_TEAC_drive(i);
  983. -      if (j<1) continue;
  984. -      found++;
  985. -      DPRINTF((DBG_TEA,"SBPCD: TEAC drive (id=%d) found.\n",i));
  986. -    }
  987. -  return (found);
  988. -}
  989. -/*==========================================================================*/
  990. -#endif TEAC-X
  991. -/*==========================================================================*/
  992. -/*==========================================================================*/
  993.  #ifdef CD200
  994.  
  995.  #if 0
  996. @@ -2510,6 +2418,7 @@
  997.    int i;
  998.  
  999.    printk("SBPCD: please mail the following lines to emoenke@gwdg.de:\n");
  1000. +  printk("SBPCD: address %03X, type %s, drive ID %d\n", CDo_command, type, DriveStruct[d].drv_id);
  1001.    printk("SBPCD: infobuf = \"");
  1002.    for (i=0;i<12;i++) printk("%02X ",infobuf[i]);
  1003.    printk("\"\nSBPCD: infobuf = \"");
  1004. @@ -2525,25 +2434,6 @@
  1005.    DPRINTF((DBG_INI,"SBPCD: check_version entered.\n"));
  1006.    DriveStruct[d].drv_type=0;
  1007.  
  1008. -#if TEAC
  1009. -  /* check for CD-55A */
  1010. -  clr_cmdbuf();
  1011. -  drvcmd[0]=CMDT_READ_ERR;
  1012. -  response_count=5;
  1013. -  flags_cmd_out=f_putcmd;
  1014. -  i=cmd_out(7);
  1015. -  if (i<0) DPRINTF((DBG_INI,"SBPCD: CMDT_READERR returns %d (ok anyway).\n",i));
  1016. -  /* read drive version */
  1017. -  clr_cmdbuf();
  1018. -  for (i=0;i<12;i++) infobuf[i]=0;
  1019. -  if (sbpro_type==1) OUT(CDo_sel_i_d,0);
  1020. -  response_count=12; /* may be too much */
  1021. -  drvcmd[0]=CMDT_READ_VER;
  1022. -  drvcmd[4]=response_count;
  1023. -  flags_cmd_out=f_putcmd;
  1024. -  i=cmd_out(10); /* possibly only 6 */
  1025. -  if (i<0) DPRINTF((DBG_INI,"SBPCD: CMDT_READ_VER returns %d\n",i));
  1026. -#else
  1027.    /* check for CD200 */
  1028.    clr_cmdbuf();
  1029.    drvcmd[0]=CMD2_READ_ERR;
  1030. @@ -2565,8 +2455,7 @@
  1031.    flags_cmd_out=f_putcmd;
  1032.    i=cmd_out(7);
  1033.    if (i<0) DPRINTF((DBG_INI,"SBPCD: CMD2_READ_VER returns %d\n",i));
  1034. -#endif TEAC
  1035. -  if (i>=0) /* either from CD200 or CD-55A */
  1036. +  if (i>=0) /* from CD200 */
  1037.      {
  1038.        for (i=0, j=0;i<12;i++) j+=infobuf[i];
  1039.        if (j)
  1040. @@ -2589,23 +2478,6 @@
  1041.        DriveStruct[d].drive_model[7]=0;
  1042.        DriveStruct[d].drv_type=drv_fam2;
  1043.      }
  1044. -      else
  1045. -    {
  1046. -      for (i=0;i<5;i++) if (infobuf[i]!=familyT[i]) break;
  1047. -      if (i==5)
  1048. -        {
  1049. -          DriveStruct[d].drive_model[0]='C';
  1050. -          DriveStruct[d].drive_model[1]='D';
  1051. -          DriveStruct[d].drive_model[2]='-';
  1052. -          DriveStruct[d].drive_model[3]='5';
  1053. -          DriveStruct[d].drive_model[4]='5';
  1054. -          DriveStruct[d].drive_model[5]='A';
  1055. -          DriveStruct[d].drive_model[6]=infobuf[i++];
  1056. -          DriveStruct[d].drive_model[7]=infobuf[i++];
  1057. -          DriveStruct[d].drive_model[8]=0;
  1058. -        }
  1059. -      DriveStruct[d].drv_type=drv_famT; /* assumed, not sure here */
  1060. -    }
  1061.      }
  1062.  
  1063.    if (!DriveStruct[d].drv_type)
  1064. @@ -2692,14 +2564,6 @@
  1065.        if (j!=4) ask_mail();
  1066.        DriveStruct[d].drv_type=drv_260;
  1067.      }
  1068. -  else if (famT_drive)
  1069. -    {
  1070. -      printk("\n\nSBPCD: possibly TEAC CD-55A present.\n");
  1071. -      printk("SBPCD: support is not fulfilled yet - drive gets ignored.\n");
  1072. -      ask_mail();
  1073. -      DriveStruct[d].drv_type=0;
  1074. -      return (-1);
  1075. -    }
  1076.    else
  1077.      {
  1078.        j = (DriveStruct[d].firmware_version[0] & 0x0F) * 100 +
  1079. @@ -2717,15 +2581,18 @@
  1080.        else if (fam1_drive)
  1081.      {
  1082.        if (j<100) DriveStruct[d].drv_type=drv_099;
  1083. -      else DriveStruct[d].drv_type=drv_100;
  1084. +      else
  1085. +        {
  1086. +          DriveStruct[d].drv_type=drv_100;
  1087. +          ask_mail();
  1088. +        }
  1089.      }
  1090.        else if (fam2_drive)
  1091.      {
  1092.        printk("\n\nSBPCD: new drive CD200 (%s)detected.\n",
  1093.           DriveStruct[d].firmware_version);
  1094.        printk("SBPCD: support is not fulfilled yet.\n");
  1095. -      if (j!=101) /* only 1.01 known at time */
  1096. -        ask_mail();
  1097. +      if (j!=101) ask_mail(); /* only 1.01 known at time */
  1098.      }
  1099.      }
  1100.    DPRINTF((DBG_LCS,"SBPCD: drive type %02X\n",DriveStruct[d].drv_type));
  1101. @@ -3035,9 +2902,7 @@
  1102.        if (i&s_attention) GetStatus();
  1103.      }
  1104.    else if (fam1_drive) GetStatus();
  1105. -  else /* CD200, CD-55A */
  1106. -    {
  1107. -    }
  1108. +  else if (fam2_drive) GetStatus();
  1109.    if (DriveStruct[d].CD_changed==0xFF)
  1110.      {
  1111.  #if MANY_SESSION
  1112. @@ -3134,15 +2999,17 @@
  1113.        flags_cmd_out = f_putcmd | f_respo2 | f_ResponseStatus |
  1114.          f_obey_p_check | f_wait_if_busy;
  1115.      }
  1116. +      else if (fam2_drive)
  1117. +    {
  1118. +      drvcmd[0]=CMD2_PLAY_MSF;
  1119. +      flags_cmd_out = f_putcmd | f_ResponseStatus;
  1120. +    }
  1121.        else if (fam0_drive)
  1122.      {
  1123.        drvcmd[0]=CMD0_PLAY_MSF;
  1124.        flags_cmd_out = f_putcmd | f_respo2 | f_lopsta | f_getsta |
  1125.          f_ResponseStatus | f_obey_p_check | f_wait_if_busy;
  1126.      }
  1127. -      else /* CD200, CD-55A */
  1128. -    {
  1129. -    }
  1130.        drvcmd[1]=(pos_audio_start>>16)&0x00FF;
  1131.        drvcmd[2]=(pos_audio_start>>8)&0x00FF;
  1132.        drvcmd[3]=pos_audio_start&0x00FF;
  1133. @@ -3495,7 +3362,6 @@
  1134.      if (fam0_drive) return (-EINVAL);
  1135.      if (famL_drive) return (-EINVAL);
  1136.      if (fam2_drive) return (-EINVAL);
  1137. -    if (famT_drive) return (-EINVAL);
  1138.      if (DriveStruct[d].aud_buf==NULL) return (-EINVAL);
  1139.      i=verify_area(VERIFY_READ, (void *) arg, sizeof(struct cdrom_read_audio));
  1140.      if (i) return (i);
  1141. @@ -3559,7 +3425,7 @@
  1142.          drvcmd[5]=0;
  1143.          drvcmd[6]=read_audio.nframes; /* # of frames */
  1144.            }
  1145. -        else /* CD200, CD-55A */
  1146. +        else if (fam2_drive) /* CD200: not implemented yet */
  1147.            {
  1148.            }
  1149.          DPRINTF((DBG_AUD,"SBPCD: read_audio: before giving \"read\" command.\n"));
  1150. @@ -3743,29 +3609,26 @@
  1151.    int i, status_tries, data_tries;
  1152.    
  1153.  request_loop:
  1154. -
  1155. +  INIT_REQUEST;
  1156.    sti();
  1157.  
  1158. -  if ((CURRENT==NULL)||(CURRENT->dev<0)) goto done;
  1159. -  if (CURRENT -> sector == -1) goto done;
  1160. -
  1161. +  if ((CURRENT==NULL)||(CURRENT->dev<0)) goto err_done;
  1162. +  if (CURRENT -> sector == -1) goto err_done;
  1163. +  if (CURRENT->cmd != READ)
  1164. +    {
  1165. +      printk("SBPCD: bad cmd %d\n", CURRENT->cmd);
  1166. +      goto err_done;
  1167. +    }
  1168.    i = MINOR(CURRENT->dev);
  1169.    if ( (i<0) || (i>=NR_SBPCD) || (DriveStruct[i].drv_id==-1))
  1170.      {
  1171.        printk("SBPCD: do_request: bad device: %04X\n", CURRENT->dev);
  1172. -      goto done;
  1173. +      goto err_done;
  1174.      }
  1175.    switch_drive(i);
  1176.  
  1177. -  INIT_REQUEST;
  1178.    block = CURRENT->sector; /* always numbered as 512-byte-pieces */
  1179.    nsect = CURRENT->nr_sectors; /* always counted as 512-byte-pieces */
  1180. -  if (CURRENT->cmd != READ)
  1181. -    {
  1182. -      printk("SBPCD: bad cmd %d\n", CURRENT->cmd);
  1183. -      end_request(0);
  1184. -      goto request_loop;
  1185. -    }
  1186.  
  1187.    DPRINTF((DBG_BSZ,"SBPCD: read sector %d (%d sectors)\n", block, nsect));
  1188.  #if 0
  1189. @@ -3822,13 +3685,11 @@
  1190.      }
  1191.      }
  1192.    
  1193. +err_done:
  1194. +  busy_data=0;
  1195.    end_request(0);
  1196.    sbp_sleep(10);    /* wait a bit, try again */
  1197.    goto request_loop;
  1198. -
  1199. -done:
  1200. -  busy_data=0;
  1201. -  return;
  1202.  }
  1203.  /*==========================================================================*/
  1204.  /*
  1205. @@ -3842,32 +3703,6 @@
  1206.  
  1207.    DriveStruct[d].sbp_first_frame=DriveStruct[d].sbp_last_frame=-1;      /* purge buffer */
  1208.    block=CURRENT->sector/4;
  1209. -
  1210. -#if MULTISESSION_BY_DRIVER
  1211. -  if (!fam0_drive)
  1212. -    {
  1213. -#if MANY_SESSION
  1214. -      DPRINTF((DBG_MUL,"SBPCD: read MSF %08X\n", blk2msf(block)));
  1215. -      if (DriveStruct[d].f_multisession)
  1216. -    {
  1217. -      DPRINTF((DBG_MUL,"SBPCD: ManySession: use %08X for %08X (msf)\n",
  1218. -                 blk2msf(DriveStruct[d].lba_multi+block),
  1219. -                         blk2msf(block)));
  1220. -      block=DriveStruct[d].lba_multi+block;
  1221. -    }
  1222. -#else
  1223. -      if ((block<=DriveStruct[d].last_redirect)
  1224. -      && (DriveStruct[d].f_multisession))
  1225. -      {
  1226. -        DPRINTF((DBG_MUL,"SBPCD: MultiSession: use %08X for %08X (msf)\n",
  1227. -             blk2msf(DriveStruct[d].lba_multi+block),
  1228. -             blk2msf(block)));
  1229. -        block=DriveStruct[d].lba_multi+block;
  1230. -      }
  1231. -#endif MANY_SESSION
  1232. -    }
  1233. -#endif MULTISESSION_BY_DRIVER
  1234. -
  1235.    if (block+SBP_BUFFER_FRAMES <= DriveStruct[d].CDsize_frm)
  1236.      DriveStruct[d].sbp_read_frames = SBP_BUFFER_FRAMES;
  1237.    else
  1238. @@ -3940,9 +3775,6 @@
  1239.        drvcmd[5]=DriveStruct[d].sbp_read_frames;
  1240.        drvcmd[6]=0x02;
  1241.      }
  1242. -  else /* CD-55A */
  1243. -    {
  1244. -    }
  1245.    SBPCD_CLI;
  1246.    for (i=0;i<7;i++) OUT(CDo_command,drvcmd[i]);
  1247.    SBPCD_STI;
  1248. @@ -4152,6 +3984,7 @@
  1249.  /*
  1250.   * try to keep an "open" counter here and lock the door if 0->1.
  1251.   */
  1252. +  MOD_INC_USE_COUNT;
  1253.    DPRINTF((DBG_LCK,"SBPCD: open_count: %d -> %d\n",
  1254.         DriveStruct[d].open_count,DriveStruct[d].open_count+1));
  1255.    if (++DriveStruct[d].open_count==1)
  1256. @@ -4190,6 +4023,7 @@
  1257.  /*
  1258.   * try to keep an "open" counter here and unlock the door if 1->0.
  1259.   */
  1260. +  MOD_DEC_USE_COUNT;
  1261.    DPRINTF((DBG_LCK,"SBPCD: open_count: %d -> %d\n",
  1262.         DriveStruct[d].open_count,DriveStruct[d].open_count-1));
  1263.    if (DriveStruct[d].open_count!=0) /* CDROMEJECT may have been done */
  1264. @@ -4254,7 +4088,9 @@
  1265.    DPRINTF((DBG_INI,"SBPCD: sbpcd_setup called with %04X,%s\n",p[1], s));
  1266.    sbpro_type=0;
  1267.    if (!strcmp(s,str_sb)) sbpro_type=1;
  1268. +  else if (!strcmp(s,str_sb_l)) sbpro_type=1;
  1269.    else if (!strcmp(s,str_sp)) sbpro_type=2;
  1270. +  else if (!strcmp(s,str_sp_l)) sbpro_type=2;
  1271.    if (p[0]>0) sbpcd_ioaddr=p[1];
  1272.  
  1273.    CDo_command=sbpcd_ioaddr;
  1274. @@ -4329,7 +4165,11 @@
  1275.  /*
  1276.   *  Test for presence of drive and initialize it.  Called at boot time.
  1277.   */
  1278. +#ifdef MODULE
  1279. +int init_module(void)
  1280. +#else
  1281.  unsigned long SBPCD_INIT(u_long mem_start, u_long mem_end)
  1282. +#endif MODULE
  1283.  {
  1284.    int i=0, j=0;
  1285.    int addr[2]={1, CDROM_PORT};
  1286. @@ -4339,9 +4179,10 @@
  1287.  
  1288.    DPRINTF((DBG_INF,"SBPCD version %s\n", VERSION));
  1289.  
  1290. +#ifndef MODULE
  1291.    if (!setup_done)
  1292.      {
  1293. -      DPRINTF((DBG_INF,"SBPCD: Looking for Matsushita, Panasonic, CreativeLabs, IBM, Longshine, TEAC CD-ROM drives\n"));
  1294. +      DPRINTF((DBG_INF,"SBPCD: Looking for Matsushita, Panasonic, CreativeLabs, IBM, Longshine CD-ROM drives\n"));
  1295.        DPRINTF((DBG_WRN,"SBPCD: \n"));
  1296.        DPRINTF((DBG_WRN,"SBPCD: = = = = = = = = = = W A R N I N G = = = = = = = = = =\n"));
  1297.        DPRINTF((DBG_WRN,"SBPCD: Auto-Probing can cause a hang (f.e. touching an ethernet card).\n"));
  1298. @@ -4358,12 +4199,14 @@
  1299.        DPRINTF((DBG_WRN,"SBPCD: = = = = = = = = = = END of WARNING = = = = = = = = = =\n"));
  1300.        DPRINTF((DBG_WRN,"SBPCD: \n"));
  1301.      }
  1302. +#endif MODULE
  1303.    sbpcd_probe[0]=sbpcd_ioaddr; /* possibly changed by kernel command line */
  1304.    sbpcd_probe[1]=sbpro_type; /* possibly changed by kernel command line */
  1305.  
  1306.    for (port_index=0;port_index<NUM_PROBE;port_index+=2)
  1307.      {
  1308.        addr[1]=sbpcd_probe[port_index];
  1309. +      if (addr[1]==0) break;
  1310.        if (check_region(addr[1],4))
  1311.      {
  1312.        DPRINTF((DBG_INI,"SBPCD: check_region: %03X is not free.\n",addr[1]));
  1313. @@ -4384,14 +4227,6 @@
  1314.            continue;
  1315.          }
  1316.      }
  1317. -#if TEAC
  1318. -      i=find_teac_drives();
  1319. -      if (i>0)
  1320. -    {
  1321. -      DPRINTF((DBG_INF,"SBPCD: found %d TEAC drives. A wonder.\n",i));
  1322. -      DPRINTF((DBG_INF,"SBPCD: - "));
  1323. -    }
  1324. -#endif TEAC
  1325.        i=check_drives();
  1326.        DPRINTF((DBG_INI,"SBPCD: check_drives done.\n"));
  1327.        if (i>=0) break; /* drive found */
  1328. @@ -4404,7 +4239,11 @@
  1329.  #if PRINTK_BUG
  1330.        sti(); /* to avoid possible "printk" bug */
  1331.  #endif
  1332. +#ifdef MODULE
  1333. +      return -EIO;
  1334. +#else
  1335.        goto init_done;
  1336. +#endif MODULE
  1337.      }
  1338.  
  1339.    if (port_index>0)
  1340. @@ -4501,7 +4340,11 @@
  1341.  #if PRINTK_BUG
  1342.        sti(); /* to avoid possible "printk" bug */
  1343.  #endif
  1344. +#ifdef MODULE
  1345. +      return -EIO;
  1346. +#else
  1347.        goto init_done;
  1348. +#endif MODULE
  1349.      }
  1350.    blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
  1351.    read_ahead[MAJOR_NR] = SBP_BUFFER_FRAMES * (CD_FRAMESIZE / 512);
  1352. @@ -4514,7 +4357,11 @@
  1353.        switch_drive(j);
  1354.  /*
  1355.   * allocate memory for the frame buffers
  1356. - */ 
  1357. + */
  1358. +#ifdef MODULE
  1359. +      DriveStruct[j].sbp_buf=(u_char *) kmalloc(SBP_BUFFER_FRAMES*CD_FRAMESIZE, GFP_KERNEL);
  1360. +      DriveStruct[j].aud_buf=NULL;
  1361. +#else
  1362.        DriveStruct[j].sbp_buf=(u_char *)mem_start;
  1363.        mem_start += SBP_BUFFER_FRAMES*CD_FRAMESIZE;
  1364.        if ((fam1_drive) && (SBP_BUFFER_AUDIO_FRAMES>0))
  1365. @@ -4523,6 +4370,7 @@
  1366.        mem_start += SBP_BUFFER_AUDIO_FRAMES*CD_FRAMESIZE_RAW;
  1367.      }
  1368.        else DriveStruct[j].aud_buf=NULL;
  1369. +#endif MODULE
  1370.  /*
  1371.   * set the block size
  1372.   */
  1373. @@ -4530,6 +4378,9 @@
  1374.      }
  1375.    blksize_size[MAJOR_NR]=sbpcd_blocksizes;
  1376.  
  1377. +#ifdef MODULE
  1378. +return (0);
  1379. +#else
  1380.  init_done:
  1381.  #if !(SBPCD_ISSUE-1)
  1382.  #ifdef CONFIG_SBPCD2
  1383. @@ -4546,7 +4397,34 @@
  1384.    DPRINTF((DBG_INF,"SBPCD: init done.\n"));
  1385.  #endif
  1386.    return (mem_start);
  1387. +#endif MODULE
  1388. +}
  1389. +/*==========================================================================*/
  1390. +#ifdef MODULE
  1391. +void cleanup_module(void)
  1392. +{
  1393. +  int j;
  1394. +
  1395. +  if (MOD_IN_USE)
  1396. +    {
  1397. +      printk("%s module in use - can't remove it.\n", major_name);
  1398. +      return;
  1399. +    }
  1400. +  if ((unregister_blkdev(MAJOR_NR, major_name) == -EINVAL))
  1401. +    {
  1402. +      printk("What's that: can't unregister %s\n", major_name);
  1403. +      return;
  1404. +    }
  1405. +  release_region(CDo_command,4);
  1406. +
  1407. +  for (j=0;j<NR_SBPCD;j++)
  1408. +    {
  1409. +      if (DriveStruct[j].drv_id==-1) continue;
  1410. +      kfree_s(DriveStruct[j].sbp_buf, SBP_BUFFER_FRAMES*CD_FRAMESIZE);
  1411. +    }
  1412. +  printk("%s module released.\n", major_name);
  1413.  }
  1414. +#endif MODULE
  1415.  /*==========================================================================*/
  1416.  /*
  1417.   * Check if the media has changed in the CD-ROM drive.
  1418. diff -u --recursive --new-file v1.2.0/linux/drivers/char/console.c linux/drivers/char/console.c
  1419. --- v1.2.0/linux/drivers/char/console.c    Thu Mar  9 20:37:34 1995
  1420. +++ linux/drivers/char/console.c    Fri Mar 17 14:31:40 1995
  1421. @@ -1686,11 +1686,8 @@
  1422.                    case '@':  /* defined in ISO 2022 */
  1423.                      utf = 0;
  1424.                      continue;
  1425. -                  case '8':
  1426. -                    /* ISO/ECMA hasn't yet registered an
  1427. -                       official ESC sequence for UTF-8,
  1428. -                       so this one (ESC %8) will likely
  1429. -                       change in the future. */
  1430. +                  case 'G':  /* prelim official escape code */
  1431. +                  case '8':  /* retained for compatibility */
  1432.                      utf = 1;
  1433.                      continue;
  1434.                  }
  1435. diff -u --recursive --new-file v1.2.0/linux/drivers/char/cyclades.c linux/drivers/char/cyclades.c
  1436. --- v1.2.0/linux/drivers/char/cyclades.c    Thu Feb 23 13:31:40 1995
  1437. +++ linux/drivers/char/cyclades.c    Fri Mar 17 14:31:40 1995
  1438. @@ -1,8 +1,11 @@
  1439.  static char rcsid[] =
  1440. -"$Revision: 1.35 $$Date: 1994/12/16 13:54:18 $";
  1441. +"$Revision: 1.36.1.1 $$Date: 1995/03/13 15:44:43 $";
  1442.  /*
  1443.   *  linux/kernel/cyclades.c
  1444.   *
  1445. + * Maintained by Marcio Saito (cyclades@netcom.com) and
  1446. + * Randolph Bentson (bentson@grieg.seaslug.org)
  1447. + *
  1448.   * Much of the design and some of the code came from serial.c
  1449.   * which was copyright (C) 1991, 1992  Linus Torvalds.  It was
  1450.   * extensively rewritten by Theodore Ts'o, 8/16/92 -- 9/14/92,
  1451. @@ -15,6 +18,27 @@
  1452.   *   int  cy_open(struct tty_struct *tty, struct file *filp);
  1453.   *
  1454.   * $Log: cyclades.c,v $
  1455. + * Revision 1.36.1.1  1995/03/13  15:44:43  bentson
  1456. + * initialize defaults for receive threshold and stale data timeout;
  1457. + * cosmetic changes;
  1458. + *
  1459. + * Revision 1.36  1995/03/10  23:33:53  bentson
  1460. + * added support of chips 4-7 in 32 port Cyclom-Ye;
  1461. + * fix cy_interrupt pointer dereference problem
  1462. + * (Joe Portman <baron@aa.net>);
  1463. + * give better error response if open is attempted on non-existant port
  1464. + * (Zachariah Vaum <jchryslr@netcom.com>);
  1465. + * correct command timeout (Kenneth Lerman <lerman@@seltd.newnet.com>);
  1466. + * conditional compilation for -16Y on systems with fast, noisy bus;
  1467. + * comment out diagnostic print function;
  1468. + * cleaned up table of base addresses;
  1469. + * set receiver time-out period register to correct value,
  1470. + * set receive threshold to better default values,
  1471. + * set chip timer to more accurate 200 Hz ticking,
  1472. + * add code to monitor and modify receive parameters
  1473. + * (Rik Faith <faith@cs.unc.edu> Nick Simicich
  1474. + * <njs@scifi.emi.net>);
  1475. + *
  1476.   * Revision 1.35  1994/12/16  13:54:18  steffen
  1477.   * additional patch by Marcio Saito for board detection
  1478.   * Accidently left out in 1.34
  1479. @@ -199,6 +223,8 @@
  1480.  #undef  SERIAL_DEBUG_IO
  1481.  #undef  SERIAL_DEBUG_COUNT
  1482.  #undef  SERIAL_DEBUG_DTR
  1483. +#undef  CYCLOM_16Y_HACK
  1484. +#undef  CYCLOM_ENABLE_MONITORING
  1485.  
  1486.  #ifndef MIN
  1487.  #define MIN(a,b)    ((a) < (b) ? (a) : (b))
  1488. @@ -221,25 +247,37 @@
  1489.  static int cy_wild_int_mask;
  1490.  static unsigned char *intr_base_addr;
  1491.  
  1492. -/* This is the per-card data structure */
  1493. +/* This is the per-card data structure containing a card's base
  1494. +   address.  Here are declarations for some common addresses.
  1495. +   Add entries to match your configuration (there are sixty-
  1496. +   four possible from 0x80000 to 0xFE000) */
  1497.  struct cyclades_card cy_card[] = {
  1498.   /* BASE_ADDR */
  1499. -    {0xD0000,0},
  1500. -    {0xD2000,0},
  1501. -    {0xD4000,10},
  1502. -    {0xD6000,11},
  1503. -    {0xD8000,12},
  1504. -    {0xDA000,15}
  1505. +    {0xD0000},
  1506. +    {0xD2000},
  1507. +    {0xD4000},
  1508. +    {0xD6000},
  1509. +    {0xD8000},
  1510. +    {0xDA000},
  1511. +    {0xDC000},
  1512. +    {0xDE000}
  1513.  };
  1514.  
  1515.  #define NR_CARDS        (sizeof(cy_card)/sizeof(struct cyclades_card))
  1516.  
  1517. -/*  No need has yet been found for this per-chip data structure
  1518. - *  struct cyclades_chip cy_chip[] = {
  1519. - *        {0}
  1520. - *  };
  1521. - *  #define NR_CHIPS  (sizeof(cy_chip)/sizeof(struct cyclades_chip))
  1522. +/*  The Cyclom-Ye has placed the sequential chips in non-sequential
  1523. + *  address order.  This look-up table overcomes that problem.
  1524.   */
  1525. +int cy_chip_offset [] =
  1526. +    { 0x0000,
  1527. +      0x0400,
  1528. +      0x0800,
  1529. +      0x0C00,
  1530. +      0x0200,
  1531. +      0x0600,
  1532. +      0x0A00,
  1533. +      0x0E00
  1534. +    };
  1535.  
  1536.  /* This is the per-port data structure */
  1537.  struct cyclades_port cy_port[] = {
  1538. @@ -328,7 +366,7 @@
  1539.  
  1540.  static char baud_cor3[] = {  /* receive threshold */
  1541.          0x0a,  0x0a,  0x0a,  0x0a,  0x0a,  0x0a,  0x0a,  0x0a,  0x0a,  0x0a,
  1542. -        0x0a,  0x0a,  0x0a,  0x08,  0x04,  0x02,  0x01,  0x01,  0x01,  0x01};
  1543. +        0x0a,  0x0a,  0x0a,  0x09,  0x09,  0x08,  0x08,  0x08,  0x08,  0x07};
  1544.  
  1545.  
  1546.  
  1547. @@ -338,7 +376,9 @@
  1548.  static void cy_unthrottle(struct tty_struct *);
  1549.  static void config_setup(struct cyclades_port *);
  1550.  extern void console_print(const char *);
  1551. +#ifdef CYCLOM_SHOW_STATUS
  1552.  static void show_status(int);
  1553. +#endif
  1554.  
  1555.  
  1556.  
  1557. @@ -399,7 +439,7 @@
  1558.  void CP8(long data) { CP4((data>>16) & 0xffff); CP4(data & 0xffff); }/* CP8 */
  1559.  
  1560.  
  1561. -/* This routine waits up to 100 micro-seconds for the previous
  1562. +/* This routine waits up to 1000 micro-seconds for the previous
  1563.     command to the Cirrus chip to complete and then issues the
  1564.     new command.  An error is returned if the previous command
  1565.     didn't finish within the time limit.
  1566. @@ -412,7 +452,7 @@
  1567.  
  1568.      save_flags(flags); cli();
  1569.      /* Check to see that the previous command has completed */
  1570. -    for(i = 0 ; i < 10000 ; i++){
  1571. +    for(i = 0 ; i < 100 ; i++){
  1572.          if (base_addr[CyCCR] == 0){
  1573.          break;
  1574.          }
  1575. @@ -456,7 +496,7 @@
  1576.      chip = channel>>2;
  1577.      channel &= 0x03;
  1578.      base_addr = (unsigned char*)
  1579. -                   (cy_card[info->card].base_addr + chip * CyRegSize);
  1580. +                   (cy_card[info->card].base_addr + cy_chip_offset[chip]);
  1581.  
  1582.      save_flags(flags); cli();
  1583.          base_addr[CyCAR] = (u_char)(channel & 0x0003); /* index channel */
  1584. @@ -487,7 +527,7 @@
  1585.      chip = channel>>2;
  1586.      channel &= 0x03;
  1587.      base_addr = (unsigned char*)
  1588. -                   (cy_card[info->card].base_addr + chip * CyRegSize);
  1589. +                   (cy_card[info->card].base_addr + cy_chip_offset[chip]);
  1590.  
  1591.      save_flags(flags); cli();
  1592.          base_addr[CyCAR] = (u_char)(channel & 0x0003);
  1593. @@ -562,8 +602,8 @@
  1594.      do{
  1595.          had_work = 0;
  1596.          for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) {
  1597. -        base_addr = (unsigned char *)(cinfo->base_addr
  1598. -                                             + CyRegSize * chip);
  1599. +        base_addr = (unsigned char *)
  1600. +                       (cinfo->base_addr + cy_chip_offset[chip]);
  1601.              too_many = 0;
  1602.              while ( (status = base_addr[CySVRR]) != 0x00) {
  1603.                  had_work++;
  1604. @@ -661,6 +701,13 @@
  1605.                              /* load # characters available from the chip */
  1606.                              char_count = base_addr[CyRDCR];
  1607.  
  1608. +#ifdef CYCLOM_ENABLE_MONITORING
  1609. +                ++info->mon.int_count;
  1610. +                info->mon.char_count += char_count;
  1611. +                if (char_count > info->mon.char_max)
  1612. +                   info->mon.char_max = char_count;
  1613. +                info->mon.char_last = char_count;
  1614. +#endif
  1615.                              while(char_count--){
  1616.                  if (tty->flip.count >= TTY_FLIPBUF_SIZE){
  1617.                                          break;
  1618. @@ -669,6 +716,9 @@
  1619.                                  data = base_addr[CyRDSR];
  1620.                  *tty->flip.flag_buf_ptr++ = TTY_NORMAL;
  1621.                  *tty->flip.char_buf_ptr++ = data;
  1622. +#ifdef CYCLOM_16Y_HACK
  1623. +                udelay(10L);
  1624. +#endif
  1625.                              }
  1626.                          }
  1627.                          queue_task_irq_off(&tty->flip.tqueue, &tq_timer);
  1628. @@ -738,6 +788,10 @@
  1629.                  base_addr[CySRER] &= ~CyTxMpty;
  1630.                  goto txdone;
  1631.                          }
  1632. +            if (info->xmit_buf == 0){
  1633. +                base_addr[CySRER] &= ~CyTxMpty;
  1634. +                goto txdone;
  1635. +            }
  1636.              if (info->tty->stopped || info->tty->hw_stopped){
  1637.                  base_addr[CySRER] &= ~CyTxMpty;
  1638.                  goto txdone;
  1639. @@ -1103,7 +1157,7 @@
  1640.      chip = channel>>2;
  1641.      channel &= 0x03;
  1642.      base_addr = (unsigned char*)
  1643. -           (cy_card[card].base_addr + chip * CyRegSize);
  1644. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1645.  
  1646.  #ifdef SERIAL_DEBUG_OPEN
  1647.      printk("startup card %d, chip %d, channel %d, base_addr %lx",
  1648. @@ -1113,7 +1167,9 @@
  1649.      save_flags(flags); cli();
  1650.      base_addr[CyCAR] = (u_char)channel;
  1651.  
  1652. -    base_addr[CyRTPR] = 0x20; /* 32ms rx timeout */
  1653. +    base_addr[CyRTPR] = (info->default_timeout
  1654. +                 ? info->default_timeout
  1655. +                 : 0x02); /* 10ms rx timeout */
  1656.  
  1657.      write_cy_cmd(base_addr,CyCHAN_CTL|CyENB_RCVR|CyENB_XMTR);
  1658.  
  1659. @@ -1155,7 +1211,7 @@
  1660.      chip = channel>>2;
  1661.      channel &= 0x03;
  1662.      base_addr = (unsigned char*)
  1663. -           (cy_card[card].base_addr + chip * CyRegSize);
  1664. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1665.      save_flags(flags); cli();
  1666.      base_addr[CyCAR] = channel;
  1667.      base_addr[CySRER] |= CyTxMpty;
  1668. @@ -1183,7 +1239,7 @@
  1669.      chip = channel>>2;
  1670.      channel &= 0x03;
  1671.      base_addr = (unsigned char*)
  1672. -           (cy_card[card].base_addr + chip * CyRegSize);
  1673. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1674.  
  1675.  #ifdef SERIAL_DEBUG_OPEN
  1676.      printk("shutdown card %d, chip %d, channel %d, base_addr %lx\n",
  1677. @@ -1298,7 +1354,9 @@
  1678.      /* byte size and parity */
  1679.      info->cor5 = 0;
  1680.      info->cor4 = 0;
  1681. -    info->cor3 = baud_cor3[i]; /* receive threshold */
  1682. +    info->cor3 = (info->default_threshold
  1683. +          ? info->default_threshold
  1684. +          : baud_cor3[i]); /* receive threshold */
  1685.      info->cor2 = CyETC;
  1686.      switch(cflag & CSIZE){
  1687.      case CS5:
  1688. @@ -1343,7 +1401,7 @@
  1689.      chip = channel>>2;
  1690.      channel &= 0x03;
  1691.      base_addr = (unsigned char*)
  1692. -           (cy_card[card].base_addr + chip * CyRegSize);
  1693. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1694.  
  1695.      save_flags(flags); cli();
  1696.      base_addr[CyCAR] = (u_char)channel;
  1697. @@ -1369,7 +1427,9 @@
  1698.  
  1699.      base_addr[CyCAR] = (u_char)channel; /* !!! Is this needed? */
  1700.  
  1701. -    base_addr[CyRTPR] = 0x20; /* 32ms rx timeout */
  1702. +    base_addr[CyRTPR] = (info->default_timeout
  1703. +                 ? info->default_timeout
  1704. +                 : 0x02); /* 10ms rx timeout */
  1705.  
  1706.      if (C_CLOCAL(info->tty)) {
  1707.          base_addr[CySRER] |= 0; /* without modem intr */
  1708. @@ -1474,7 +1534,7 @@
  1709.      chip = channel>>2;
  1710.      channel &= 0x03;
  1711.      base_addr = (unsigned char*)
  1712. -           (cy_card[card].base_addr + chip * CyRegSize);
  1713. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1714.  
  1715.      save_flags(flags); cli();
  1716.      base_addr[CyCAR] = channel;
  1717. @@ -1636,7 +1696,7 @@
  1718.      chip = channel>>2;
  1719.      channel &= 0x03;
  1720.      base_addr = (unsigned char*)
  1721. -           (cy_card[card].base_addr + chip * CyRegSize);
  1722. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1723.  
  1724.      save_flags(flags); cli();
  1725.      base_addr[CyCAR] = (u_char)channel;
  1726. @@ -1677,7 +1737,7 @@
  1727.      chip = channel>>2;
  1728.      channel &= 0x03;
  1729.      base_addr = (unsigned char*)
  1730. -           (cy_card[card].base_addr + chip * CyRegSize);
  1731. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1732.  
  1733.      save_flags(flags); cli();
  1734.      base_addr[CyCAR] = (u_char)channel;
  1735. @@ -1768,7 +1828,7 @@
  1736.      chip = channel>>2;
  1737.      channel &= 0x03;
  1738.      base_addr = (unsigned char*)
  1739. -                   (cy_card[card].base_addr + chip * CyRegSize);
  1740. +                   (cy_card[card].base_addr + cy_chip_offset[chip]);
  1741.  
  1742.      save_flags(flags); cli();
  1743.          base_addr[CyCAR] = (u_char)channel;
  1744. @@ -1799,7 +1859,7 @@
  1745.      chip = channel>>2;
  1746.      channel &= 0x03;
  1747.      base_addr = (unsigned char*)
  1748. -                   (cy_card[card].base_addr + chip * CyRegSize);
  1749. +                   (cy_card[card].base_addr + cy_chip_offset[chip]);
  1750.  
  1751.      switch (cmd) {
  1752.      case TIOCMBIS:
  1753. @@ -1891,6 +1951,120 @@
  1754.      }
  1755.  } /* send_break */
  1756.  
  1757. +static int
  1758. +get_mon_info(struct cyclades_port * info, struct cyclades_monitor * mon)
  1759. +{
  1760. +
  1761. +   memcpy_tofs(mon, &info->mon, sizeof(struct cyclades_monitor));
  1762. +   info->mon.int_count  = 0;
  1763. +   info->mon.char_count = 0;
  1764. +   info->mon.char_max   = 0;
  1765. +   info->mon.char_last  = 0;
  1766. +   return 0;
  1767. +}
  1768. +
  1769. +static int
  1770. +set_threshold(struct cyclades_port * info, unsigned long value)
  1771. +{
  1772. +   unsigned char *base_addr;
  1773. +   int card,channel,chip;
  1774. +   
  1775. +   card = info->card;
  1776. +   channel = info->line - cy_card[card].first_line;
  1777. +   chip = channel>>2;
  1778. +   channel &= 0x03;
  1779. +   base_addr = (unsigned char*)
  1780. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1781. +
  1782. +   info->cor3 &= ~CyREC_FIFO;
  1783. +   info->cor3 |= value & CyREC_FIFO;
  1784. +   base_addr[CyCOR3] = info->cor3;
  1785. +   write_cy_cmd(base_addr,CyCOR_CHANGE|CyCOR3ch);
  1786. +   return 0;
  1787. +}
  1788. +
  1789. +static int
  1790. +get_threshold(struct cyclades_port * info, unsigned long *value)
  1791. +{
  1792. +   unsigned char *base_addr;
  1793. +   int card,channel,chip;
  1794. +   unsigned long tmp;
  1795. +   
  1796. +   card = info->card;
  1797. +   channel = info->line - cy_card[card].first_line;
  1798. +   chip = channel>>2;
  1799. +   channel &= 0x03;
  1800. +   base_addr = (unsigned char*)
  1801. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1802. +
  1803. +   tmp = base_addr[CyCOR3] & CyREC_FIFO;
  1804. +   put_fs_long(tmp,value);
  1805. +   return 0;
  1806. +}
  1807. +
  1808. +static int
  1809. +set_default_threshold(struct cyclades_port * info, unsigned long value)
  1810. +{
  1811. +   info->default_threshold = value & 0x0f;
  1812. +   return 0;
  1813. +}
  1814. +
  1815. +static int
  1816. +get_default_threshold(struct cyclades_port * info, unsigned long *value)
  1817. +{
  1818. +   put_fs_long(info->default_threshold,value);
  1819. +   return 0;
  1820. +}
  1821. +
  1822. +static int
  1823. +set_timeout(struct cyclades_port * info, unsigned long value)
  1824. +{
  1825. +   unsigned char *base_addr;
  1826. +   int card,channel,chip;
  1827. +   
  1828. +   card = info->card;
  1829. +   channel = info->line - cy_card[card].first_line;
  1830. +   chip = channel>>2;
  1831. +   channel &= 0x03;
  1832. +   base_addr = (unsigned char*)
  1833. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1834. +
  1835. +   base_addr[CyRTPR] = value & 0xff;
  1836. +   return 0;
  1837. +}
  1838. +
  1839. +static int
  1840. +get_timeout(struct cyclades_port * info, unsigned long *value)
  1841. +{
  1842. +   unsigned char *base_addr;
  1843. +   int card,channel,chip;
  1844. +   unsigned long tmp;
  1845. +   
  1846. +   card = info->card;
  1847. +   channel = info->line - cy_card[card].first_line;
  1848. +   chip = channel>>2;
  1849. +   channel &= 0x03;
  1850. +   base_addr = (unsigned char*)
  1851. +           (cy_card[card].base_addr + cy_chip_offset[chip]);
  1852. +
  1853. +   tmp = base_addr[CyRTPR];
  1854. +   put_fs_long(tmp,value);
  1855. +   return 0;
  1856. +}
  1857. +
  1858. +static int
  1859. +set_default_timeout(struct cyclades_port * info, unsigned long value)
  1860. +{
  1861. +   info->default_timeout = value & 0xff;
  1862. +   return 0;
  1863. +}
  1864. +
  1865. +static int
  1866. +get_default_timeout(struct cyclades_port * info, unsigned long *value)
  1867. +{
  1868. +   put_fs_long(info->default_timeout,value);
  1869. +   return 0;
  1870. +}
  1871.  
  1872.  static int
  1873.  cy_ioctl(struct tty_struct *tty, struct file * file,
  1874. @@ -1905,6 +2079,63 @@
  1875.  #endif
  1876.  
  1877.      switch (cmd) {
  1878. +        case CYGETMON:
  1879. +            error = verify_area(VERIFY_WRITE, (void *) arg
  1880. +                                ,sizeof(struct cyclades_monitor));
  1881. +            if (error){
  1882. +                ret_val = error;
  1883. +                break;
  1884. +            }
  1885. +            ret_val = get_mon_info(info, (struct cyclades_monitor *)arg);
  1886. +        break;
  1887. +        case CYGETTHRESH:
  1888. +            error = verify_area(VERIFY_WRITE, (void *) arg
  1889. +                                ,sizeof(unsigned long));
  1890. +            if (error){
  1891. +                ret_val = error;
  1892. +                break;
  1893. +            }
  1894. +        ret_val = get_threshold(info, (unsigned long *)arg);
  1895. +         break;
  1896. +        case CYSETTHRESH:
  1897. +            ret_val = set_threshold(info, (unsigned long)arg);
  1898. +        break;
  1899. +        case CYGETDEFTHRESH:
  1900. +            error = verify_area(VERIFY_WRITE, (void *) arg
  1901. +                                ,sizeof(unsigned long));
  1902. +            if (error){
  1903. +                ret_val = error;
  1904. +                break;
  1905. +            }
  1906. +        ret_val = get_default_threshold(info, (unsigned long *)arg);
  1907. +         break;
  1908. +        case CYSETDEFTHRESH:
  1909. +            ret_val = set_default_threshold(info, (unsigned long)arg);
  1910. +        break;
  1911. +        case CYGETTIMEOUT:
  1912. +            error = verify_area(VERIFY_WRITE, (void *) arg
  1913. +                                ,sizeof(unsigned long));
  1914. +            if (error){
  1915. +                ret_val = error;
  1916. +                break;
  1917. +            }
  1918. +        ret_val = get_timeout(info, (unsigned long *)arg);
  1919. +         break;
  1920. +        case CYSETTIMEOUT:
  1921. +            ret_val = set_timeout(info, (unsigned long)arg);
  1922. +        break;
  1923. +        case CYGETDEFTIMEOUT:
  1924. +            error = verify_area(VERIFY_WRITE, (void *) arg
  1925. +                                ,sizeof(unsigned long));
  1926. +            if (error){
  1927. +                ret_val = error;
  1928. +                break;
  1929. +            }
  1930. +        ret_val = get_default_timeout(info, (unsigned long *)arg);
  1931. +         break;
  1932. +        case CYSETDEFTIMEOUT:
  1933. +            ret_val = set_default_timeout(info, (unsigned long)arg);
  1934. +        break;
  1935.          case TCSBRK:    /* SVID version: non-zero arg --> no break */
  1936.          ret_val = tty_check_change(tty);
  1937.          if (ret_val)
  1938. @@ -2212,7 +2443,7 @@
  1939.      channel = info->line - cinfo->first_line;
  1940.      chip = channel>>2;
  1941.      channel &= 0x03;
  1942. -    base_addr = (char *) (cinfo->base_addr + chip * CyRegSize);
  1943. +    base_addr = (char *) (cinfo->base_addr + cy_chip_offset[chip]);
  1944.  
  1945.      while (1) {
  1946.      save_flags(flags); cli();
  1947. @@ -2293,6 +2524,9 @@
  1948.          return -ENODEV;
  1949.      }
  1950.      info = &cy_port[line];
  1951. +    if (info->line < 0){
  1952. +        return -ENODEV;
  1953. +    }
  1954.  #ifdef SERIAL_DEBUG_OTHER
  1955.      printk("cy_open ttyC%d\n", info->line); /* */
  1956.  #endif
  1957. @@ -2372,16 +2606,18 @@
  1958.  /* initialize chips on card -- return number of valid
  1959.     chips (which is number of ports/4) */
  1960.  int
  1961. -cy_init_card(unsigned char *base_addr)
  1962. +cy_init_card(unsigned char *true_base_addr)
  1963.  {
  1964.    volatile unsigned short discard;
  1965.    unsigned int chip_number;
  1966. +  unsigned char* base_addr;
  1967.  
  1968. -    discard = base_addr[Cy_HwReset]; /* Cy_HwReset is 0x1400 */
  1969. -    discard = base_addr[Cy_ClrIntr]; /* Cy_ClrIntr is 0x1800 */
  1970. +    discard = true_base_addr[Cy_HwReset]; /* Cy_HwReset is 0x1400 */
  1971. +    discard = true_base_addr[Cy_ClrIntr]; /* Cy_ClrIntr is 0x1800 */
  1972.      udelay(500L);
  1973.  
  1974.      for(chip_number=0; chip_number<CyMaxChipsPerCard; chip_number++){
  1975. +        base_addr = true_base_addr + cy_chip_offset[chip_number];
  1976.          udelay(1000L);
  1977.          if(base_addr[CyCCR] != 0x00){
  1978.              /*************
  1979. @@ -2408,13 +2644,11 @@
  1980.              return chip_number;
  1981.          }
  1982.          base_addr[CyGCR] = CyCH0_SERIAL;
  1983. -        base_addr[CyPPR] = CyCLOCK_25_1MS * 5; /* run clock at 200 Hz */
  1984. +        base_addr[CyPPR] = 244; /* better value than CyCLOCK_25_1MS * 5
  1985. +                                                  to run clock at 200 Hz */
  1986.  
  1987.          printk(" chip #%d at %#6lx is rev 0x%2x\n",
  1988.                 chip_number, (unsigned long)base_addr, base_addr[CyGFRCR]);
  1989. -
  1990. -        /* advance to next chip on card */
  1991. -        base_addr += CyRegSize;
  1992.      }
  1993.  
  1994.      return chip_number;
  1995. @@ -2567,6 +2801,8 @@
  1996.      printk("cyc: %d: setting count to 0\n", __LINE__);
  1997.  #endif
  1998.          info->blocked_open = 0;
  1999. +        info->default_threshold = 0;
  2000. +        info->default_timeout = 0;
  2001.          info->tqueue.routine = do_softint;
  2002.          info->tqueue.data = info;
  2003.          info->callout_termios =cy_callout_driver.init_termios;
  2004. @@ -2575,7 +2811,9 @@
  2005.          info->close_wait = 0;
  2006.          /* info->session */
  2007.          /* info->pgrp */
  2008. -        /* info->read_status_mask */
  2009. +/*** !!!!!!!! this may expose new bugs !!!!!!!!! *********/
  2010. +        info->read_status_mask = CyTIMEOUT| CySPECHAR| CyBREAK
  2011. +                                       | CyPARITY| CyFRAME| CyOVERRUN;
  2012.          /* info->timeout */
  2013.  
  2014.          printk("ttyC%1d ", info->line);
  2015. @@ -2597,6 +2835,7 @@
  2016.      
  2017.  } /* cy_init */
  2018.  
  2019. +#ifdef CYCLOM_SHOW_STATUS
  2020.  static void
  2021.  show_status(int line_num)
  2022.  {
  2023. @@ -2638,7 +2877,7 @@
  2024.      save_flags(flags); cli();
  2025.  
  2026.      base_addr = (unsigned char*)
  2027. -               (cy_card[card].base_addr + chip * CyRegSize);
  2028. +               (cy_card[card].base_addr + cy_chip_offset[chip]);
  2029.  
  2030.  /* Global Registers */
  2031.  
  2032. @@ -2693,5 +2932,5 @@
  2033.  
  2034.      restore_flags(flags);
  2035.  } /* show_status */
  2036. -
  2037. +#endif
  2038.  
  2039. diff -u --recursive --new-file v1.2.0/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
  2040. --- v1.2.0/linux/drivers/char/tty_io.c    Mon Feb 20 21:29:52 1995
  2041. +++ linux/drivers/char/tty_io.c    Fri Mar 17 14:31:51 1995
  2042. @@ -1051,7 +1051,9 @@
  2043.          if (o_tty->ldisc.close)
  2044.              (o_tty->ldisc.close)(o_tty);
  2045.          o_tty->ldisc = ldiscs[N_TTY];
  2046. +#if 0 /* No way! We just released the termios struct! */
  2047.          o_tty->termios->c_line = N_TTY;
  2048. +#endif
  2049.      }
  2050.      
  2051.      tty->driver.table[idx] = NULL;
  2052. @@ -1659,7 +1661,7 @@
  2053.      int    retval;
  2054.      struct tty_driver *p;
  2055.      int    found = 0;
  2056. -    int    major_inuse = 0;
  2057. +    char *othername = NULL;
  2058.      
  2059.      if (*driver->refcount)
  2060.          return -EBUSY;
  2061. @@ -1668,14 +1670,15 @@
  2062.          if (p == driver)
  2063.              found++;
  2064.          else if (p->major == driver->major)
  2065. -            major_inuse++;
  2066. +            othername = p->name;
  2067.      }
  2068.  
  2069. -    if (!major_inuse) {
  2070. +    if (othername == NULL) {
  2071.          retval = unregister_chrdev(driver->major, driver->name);
  2072.          if (retval)
  2073.              return retval;
  2074. -    }
  2075. +    } else
  2076. +        register_chrdev(driver->major, othername, &tty_fops);
  2077.  
  2078.      if (driver->prev)
  2079.          driver->prev->next = driver->next;
  2080. diff -u --recursive --new-file v1.2.0/linux/drivers/net/ne.c linux/drivers/net/ne.c
  2081. --- v1.2.0/linux/drivers/net/ne.c    Mon Jan  9 07:56:28 1995
  2082. +++ linux/drivers/net/ne.c    Fri Mar 17 14:31:40 1995
  2083. @@ -45,6 +45,7 @@
  2084.      {"DE100", "DE200", {0x00, 0xDE, 0x01,}},
  2085.      {"DE120", "DE220", {0x00, 0x80, 0xc8,}},
  2086.      {"DFI1000", "DFI2000", {'D', 'F', 'I',}}, /* Original, eh?  */
  2087. +    {"EtherNext UTP8", "EtherNext UTP16", {0x00, 0x00, 0x79}},
  2088.      {0,}
  2089.  };
  2090.  
  2091. diff -u --recursive --new-file v1.2.0/linux/include/linux/cyclades.h linux/include/linux/cyclades.h
  2092. --- v1.2.0/linux/include/linux/cyclades.h    Mon Dec 19 16:31:57 1994
  2093. +++ linux/include/linux/cyclades.h    Fri Mar 17 14:31:40 1995
  2094. @@ -9,6 +9,13 @@
  2095.    int filler;
  2096.  };
  2097.  
  2098. +struct cyclades_monitor {
  2099. +        unsigned long           int_count;
  2100. +        unsigned long           char_count;
  2101. +        unsigned long           char_max;
  2102. +        unsigned long           char_last;
  2103. +};
  2104. +
  2105.  /*
  2106.   * This is our internal structure for each serial port's state.
  2107.   * 
  2108. @@ -45,14 +52,28 @@
  2109.      int            xmit_head;
  2110.      int            xmit_tail;
  2111.      int            xmit_cnt;
  2112. +        int                     default_threshold;
  2113. +        int                     default_timeout;
  2114.      struct tq_struct    tqueue;
  2115.      struct termios        normal_termios;
  2116.      struct termios        callout_termios;
  2117.      struct wait_queue    *open_wait;
  2118.      struct wait_queue    *close_wait;
  2119. +        struct cyclades_monitor mon;
  2120.  };
  2121.  
  2122.  #define CYCLADES_MAGIC  0x4359
  2123. +
  2124. +#define CYGETMON                0x435901
  2125. +#define CYGETTHRESH             0x435902
  2126. +#define CYSETTHRESH             0x435903
  2127. +#define CYGETDEFTHRESH          0x435904
  2128. +#define CYSETDEFTHRESH          0x435905
  2129. +#define CYGETTIMEOUT            0x435906
  2130. +#define CYSETTIMEOUT            0x435907
  2131. +#define CYGETDEFTIMEOUT         0x435908
  2132. +#define CYSETDEFTIMEOUT         0x435909
  2133. +
  2134.  /*
  2135.   * Events are used to schedule things to happen at timer-interrupt
  2136.   * time, instead of at cy interrupt time.
  2137. diff -u --recursive --new-file v1.2.0/linux/include/linux/elf.h linux/include/linux/elf.h
  2138. --- v1.2.0/linux/include/linux/elf.h    Sun Feb  5 14:44:32 1995
  2139. +++ linux/include/linux/elf.h    Sat Mar 11 14:10:14 1995
  2140. @@ -227,6 +227,14 @@
  2141.  #define    ELFCLASS64    2
  2142.  #define    ELFCLASSNUM    3
  2143.  
  2144. +#define ELFDATANONE    0        /* e_ident[EI_DATA] */
  2145. +#define ELFDATA2LSB    1
  2146. +#define ELFDATA2MSB    2
  2147. +
  2148. +#define EV_NONE        0        /* e_version, EI_VERSION */
  2149. +#define EV_CURRENT    1
  2150. +#define EV_NUM        2
  2151. +
  2152.  #define ELF_START_MMAP 0x80000000
  2153.  
  2154.  #endif /* _LINUX_ELF_H */
  2155. diff -u --recursive --new-file v1.2.0/linux/include/linux/ip_fw.h linux/include/linux/ip_fw.h
  2156. --- v1.2.0/linux/include/linux/ip_fw.h    Thu Mar  9 20:37:36 1995
  2157. +++ linux/include/linux/ip_fw.h    Thu Mar  9 20:33:55 1995
  2158. @@ -80,7 +80,7 @@
  2159.                   * (ports[0] <= port <= ports[1])     *
  2160.                   *                                    */
  2161.  #define IP_FW_F_PRN    0x020    /* In verbose mode print this firewall*/
  2162. -#define IP_FW_F_BIDIR    0x040    /* For accounting-count two way       */
  2163. +#define IP_FW_F_BIDIR    0x040    /* For bidirectional firewalls        */
  2164.  #define IP_FW_F_TCPSYN    0x080    /* For tcp packets-check SYN only     */
  2165.  #define IP_FW_F_ICMPRPL 0x100    /* Send back icmp unreachable packet  */
  2166.  #define IP_FW_F_MASK    0x1FF    /* All possible flag bits mask        */
  2167. @@ -111,6 +111,15 @@
  2168.  #define IP_ACCT_FLUSH    (IP_FW_BASE_CTL+18)
  2169.  #define IP_ACCT_ZERO     (IP_FW_BASE_CTL+19)
  2170.  
  2171. +struct ip_fwpkt
  2172. +{
  2173. +    struct iphdr fwp_iph;            /* IP header */
  2174. +    union {
  2175. +        struct tcphdr fwp_tcph;        /* TCP header or */
  2176. +        struct udphdr fwp_udph;        /* UDP header */
  2177. +    } fwp_protoh;
  2178. +    struct in_addr fwp_via;            /* interface address */
  2179. +};
  2180.  
  2181.  /*
  2182.   *    Main firewall chains definitions and global var's definitions.
  2183. @@ -129,10 +138,10 @@
  2184.  #endif
  2185.  #ifdef CONFIG_IP_ACCT
  2186.  extern struct ip_fw *ip_acct_chain;
  2187. -extern int ip_acct_cnt(struct iphdr *, struct device *, struct ip_fw *);
  2188. +extern void ip_acct_cnt(struct iphdr *, struct device *, struct ip_fw *);
  2189.  extern int ip_acct_ctl(int, void *, int);
  2190.  #endif
  2191. -extern int ip_fw_chk(struct iphdr *, struct device *rif,struct ip_fw *, int);
  2192. +extern int ip_fw_chk(struct iphdr *, struct device *rif,struct ip_fw *, int, int);
  2193.  #endif /* KERNEL */
  2194.  
  2195.  #endif /* _IP_FW_H */
  2196. diff -u --recursive --new-file v1.2.0/linux/include/linux/sbpcd.h linux/include/linux/sbpcd.h
  2197. --- v1.2.0/linux/include/linux/sbpcd.h    Sun Jan 29 20:28:43 1995
  2198. +++ linux/include/linux/sbpcd.h    Wed Mar 15 08:47:38 1995
  2199. @@ -120,9 +120,8 @@
  2200.  #define DBG_AUD        25      /* "read audio" debugging */
  2201.  #define DBG_SEQ        26      /* Sequoia interface configuration trace */
  2202.  #define DBG_LCS        27      /* Longshine LCS-7260 debugging trace */
  2203. -#define DBG_TEA        28      /* TEAC CD-55A debugging trace */
  2204. -#define DBG_CD2        29      /* MKE CD200 debugging trace */
  2205. -#define DBG_000        30      /* unnecessary information */
  2206. +#define DBG_CD2        28      /* MKE CD200 debugging trace */
  2207. +#define DBG_000        29      /* unnecessary information */
  2208.  
  2209.  /*==========================================================================*/
  2210.  /*==========================================================================*/
  2211. @@ -254,13 +253,11 @@
  2212.  #define drv_099 (drv_fam1+0x01)    /* <100 */
  2213.  #define drv_100 (drv_fam1+0x02)    /* >=100 */
  2214.  
  2215. -#define drv_famT 0x40    /* TEAC CD-55A */
  2216.  #define drv_fam2 0x80    /* CD200 family */
  2217.  
  2218.  #define fam0_drive (DriveStruct[d].drv_type&drv_fam0)
  2219.  #define famL_drive (DriveStruct[d].drv_type&drv_famL)
  2220.  #define fam1_drive (DriveStruct[d].drv_type&drv_fam1)
  2221. -#define famT_drive (DriveStruct[d].drv_type&drv_famT)
  2222.  #define fam2_drive (DriveStruct[d].drv_type&drv_fam2)
  2223.  #define fam0L_drive (DriveStruct[d].drv_type&(drv_fam0|drv_famL))
  2224.  #define fam1L_drive (DriveStruct[d].drv_type&(drv_fam1|drv_famL))
  2225. @@ -522,19 +519,15 @@
  2226.   * CR-56x:      CMD1_
  2227.   * CD200:       CMD2_
  2228.   * LCS-7260:    CMDL_
  2229. - * TEAC CD-55A: CMDT_
  2230.   */
  2231.  #define CMD1_RESET    0x0a
  2232.  #define CMD2_RESET    0x01
  2233. -#define CMDT_RESET    0xc0
  2234.  #define CMD1_LOCK_CTL    0x0c
  2235.  #define CMD2_LOCK_CTL    0x1e
  2236.  #define CMDL_LOCK_CTL    0x0e
  2237. -#define CMDT_LOCK_CTL    0x1e
  2238.  #define CMD1_TRAY_CTL    0x07
  2239.  #define CMD2_TRAY_CTL    0x1b
  2240.  #define CMDL_TRAY_CTL    0x0d
  2241. -#define CMDT_TRAY_CTL    0x1b
  2242.  #define CMD1_MULTISESS    0x8d
  2243.  #define CMDL_MULTISESS    0x8c
  2244.  #define CMD1_SUBCHANINF    0x11
  2245. @@ -542,7 +535,6 @@
  2246.  #define CMD2_x02    0x02
  2247.  #define CMD1_x08    0x08
  2248.  #define CMD2_x08    0x08
  2249. -#define CMDT_x08    0x08
  2250.  #define CMD2_SETSPEED    0xda
  2251.  
  2252.  #define CMD0_PATH_CHECK    0x00
  2253. @@ -553,12 +545,10 @@
  2254.  #define CMD1_SEEK    0x01
  2255.  #define CMD2_SEEK    0x2b
  2256.  #define CMDL_SEEK    0x01
  2257. -#define CMDT_SEEK    0x2b
  2258.  #define CMD0_READ    0x02
  2259.  #define CMD1_READ    0x10
  2260.  #define CMD2_READ    0x28
  2261.  #define CMDL_READ    0x02
  2262. -#define CMDT_READ    0x28
  2263.  #define CMD0_READ_XA    0x03
  2264.  #define CMD2_READ_XA    0xd4
  2265.  #define CMDL_READ_XA    0x03 /* really ?? */
  2266. @@ -585,33 +575,27 @@
  2267.  #define CMD1_PLAY_MSF    0x0e
  2268.  #define CMD2_PLAY_MSF    0x47
  2269.  #define CMDL_PLAY_MSF    0x
  2270. -#define CMDT_PLAY_MSF    0x47
  2271.  #define CMD0_PLAY_TI    0x0c
  2272.  #define CMD0_STATUS    0x81
  2273.  #define CMD1_STATUS    0x05
  2274.  #define CMD2_STATUS    0x00
  2275.  #define CMDL_STATUS    0x81
  2276. -#define CMDT_STATUS    0x00
  2277.  #define CMD0_READ_ERR    0x82
  2278.  #define CMD1_READ_ERR    0x82
  2279.  #define CMD2_READ_ERR    0x03
  2280.  #define CMDL_READ_ERR    0x82
  2281. -#define CMDT_READ_ERR    0x03 /* get audio status */
  2282.  #define CMD0_READ_VER    0x83
  2283.  #define CMD1_READ_VER    0x83
  2284.  #define CMD2_READ_VER    0x12
  2285. -#define CMDT_READ_VER    0x12 /* ??? (unused) */
  2286.  #define CMDL_READ_VER    0x83
  2287.  #define CMD0_SETMODE    0x84
  2288.  #define CMD1_SETMODE    0x09
  2289.  #define CMD2_SETMODE    0x55
  2290.  #define CMDL_SETMODE    0x84
  2291. -#define CMDT_SETMODE    0x55
  2292.  #define CMD0_GETMODE    0x85
  2293.  #define CMD1_GETMODE    0x84
  2294.  #define CMD2_GETMODE    0x5a
  2295.  #define CMDL_GETMODE    0x85
  2296. -#define CMDT_GETMODE    0x5a
  2297.  #define CMD0_SET_XA    0x86
  2298.  #define CMD0_GET_XA    0x87
  2299.  #define CMD0_CAPACITY    0x88
  2300. @@ -622,13 +606,11 @@
  2301.  #define CMD1_READSUBQ    0x87
  2302.  #define CMD2_READSUBQ    0x42
  2303.  #define CMDL_READSUBQ    0x89
  2304. -#define CMDT_READSUBQ    0x42
  2305.  #define CMD0_DISKCODE    0x8a
  2306.  #define CMD0_DISKINFO    0x8b
  2307.  #define CMD1_DISKINFO    0x8b
  2308.  #define CMD2_DISKINFO    0x43
  2309.  #define CMDL_DISKINFO    0x8b
  2310. -#define CMDT_DISKINFO    0x43
  2311.  #define CMD0_READTOC    0x8c
  2312.  #define CMD1_READTOC    0x8c
  2313.  #define CMD2_READTOC    0x
  2314. @@ -637,7 +619,6 @@
  2315.  #define CMD1_PAU_RES    0x0d
  2316.  #define CMD2_PAU_RES    0x4b
  2317.  #define CMDL_PAU_RES    0x8d
  2318. -#define CMDT_PAU_RES    0x4b
  2319.  #define CMD0_PACKET    0x8e
  2320.  #define CMD1_PACKET    0x8e
  2321.  #define CMD2_PACKET    0x
  2322. diff -u --recursive --new-file v1.2.0/linux/net/inet/README linux/net/inet/README
  2323. --- v1.2.0/linux/net/inet/README    Tue Oct 25 18:10:14 1994
  2324. +++ linux/net/inet/README    Fri Mar 10 12:49:24 1995
  2325. @@ -1,21 +1,42 @@
  2326. -Changes for NET3.017
  2327. +Upgrade Notes from 1.0
  2328. +[Alan Cox -  Alan.Cox@linux.org]
  2329.  
  2330. -This is mostly small stuff as follows:
  2331. +Upgrading to 1.2.0 from a 1.0 kernel networking set. If you are using
  2332. +a complete 1.2 distribution you can ignore this.
  2333.  
  2334. -o    accept()ed socket don't end up with an invalid sk->socket and give bogus
  2335. -    netstat output.
  2336. -o    FASYNC/SIGIO now works with sockets.
  2337. -o    Fixed the permissions on F_SETOWN for all. Its now as broken/working
  2338. -    as other systems. Really we need something like a 32bit generation
  2339. -    number on processes.
  2340. -o    ARP allows proxy for whole networks (a la cisco routers)
  2341. -o    TCP sendto() reports ENOTCONN in the right cases
  2342. -o    Removed some surplus uncommented code from tcp.c
  2343. -o    Fixed protocol violation during closedown in tcp.c
  2344. -    [Still not got the window < MSS bug fix included]
  2345. +This doesn't attempt to list the changes. That would be too large. Instead
  2346. +just what you need and can change
  2347.  
  2348. -Fixes for 1.1.58
  2349. +arp,ifconfig, etc. Get net-tools-1.1.95 (or 1.2.0 if its out) from
  2350. +ftp.linux.org.uk:/pub/Linux/Networking/PROGRAMS/NetTools, and install
  2351. +these. You will also acquire a couple of new tools "plipconfig" for tuning
  2352. +plip links and "ipfw" for ip firewall management.
  2353.  
  2354. -o    non blocking connect fail gets the error code right.
  2355. -o    select() not reporting read ok after an urgent read fixed.
  2356. +bootpd: The original bootpd has a bug that the 1.2 kernel spots. You will
  2357. +need to upgrade this to the version in
  2358. +ftp.linux.org.uk:/pub/Linux/Networking/PROGRAMS/Upgrades
  2359.  
  2360. +
  2361. +Standard programs that you ought to update are
  2362. +
  2363. +named 4.7.x    to 4.9.x    Stops named dying occasionally
  2364. +pop3d 1.001     to 1.004    Fixes a bug that can lose mail
  2365. +
  2366. +A complete current networking set for Linux can be obtained by getting
  2367. +the NetKit[A,B...] series archives from ftp.funet.fi. Funet also carries
  2368. +binaries for Linux mbone applications if you now wish to make use of
  2369. +these facilities.
  2370. +
  2371. +For commercial UK custom Linux networking projects, drivers and development
  2372. +(but not free support!) I can be contacted via
  2373. +
  2374. +    I^2IT Ltd, The Innovation Centre, University Of Wales
  2375. +        Swansea SA2 8PP.  
  2376. +    Fax: +44 1792 295811
  2377. +    Tel: +44 1792 295213
  2378. +
  2379. +Please don't send commercial queries to my email address as I have that
  2380. +in an academic and _not_ commercial capacity. On the other hand feel
  2381. +free to send bug reports, queries and enhancements that way.
  2382. +
  2383. +Alan
  2384. diff -u --recursive --new-file v1.2.0/linux/net/inet/arp.c linux/net/inet/arp.c
  2385. --- v1.2.0/linux/net/inet/arp.c    Thu Feb 23 13:26:37 1995
  2386. +++ linux/net/inet/arp.c    Fri Mar 10 12:29:54 1995
  2387. @@ -130,9 +130,15 @@
  2388.  
  2389.  #define ARP_CHECK_INTERVAL    (60 * HZ)
  2390.  
  2391. +enum proxy {
  2392. +   PROXY_EXACT=0,
  2393. +   PROXY_ANY,
  2394. +   PROXY_NONE,
  2395. +};
  2396. +
  2397.  /* Forward declarations. */
  2398.  static void arp_check_expire (unsigned long);  
  2399. -static struct arp_table *arp_lookup(unsigned long paddr, int exact);
  2400. +static struct arp_table *arp_lookup(unsigned long paddr, enum proxy proxy);
  2401.  
  2402.  
  2403.  static struct timer_list arp_timer =
  2404. @@ -497,6 +503,7 @@
  2405.      struct arp_table **pentry;
  2406.      unsigned long hash = HASH(ip_addr);
  2407.  
  2408. +ugly:
  2409.      cli();
  2410.      pentry = &arp_tables[hash];
  2411.      if (! *pentry) /* also check proxy entries */
  2412. @@ -512,7 +519,12 @@
  2413.              del_timer(&entry->timer);
  2414.              sti();
  2415.              arp_release_entry(entry);
  2416. -            return;
  2417. +            /* this would have to be cleaned up */
  2418. +            goto ugly;
  2419. +            /* perhaps like this ?
  2420. +            cli();
  2421. +            entry = *pentry;
  2422. +            */
  2423.          }
  2424.          pentry = &entry->next;
  2425.          if (!checked_proxies && ! *pentry)
  2426. @@ -842,7 +854,7 @@
  2427.      /*
  2428.       *    Find an entry
  2429.       */
  2430. -    entry = arp_lookup(paddr, 1);
  2431. +    entry = arp_lookup(paddr, PROXY_NONE);
  2432.  
  2433.      if (entry != NULL)     /* It exists */
  2434.      {
  2435. @@ -1006,11 +1018,11 @@
  2436.  
  2437.  /*
  2438.   *    This will find an entry in the ARP table by looking at the IP address.
  2439. - *      If exact is true then only exact IP matches will be allowed
  2440. + *      If proxy is PROXY_EXACT then only exact IP matches will be allowed
  2441.   *      for proxy entries, otherwise the netmask will be used
  2442.   */
  2443.  
  2444. -static struct arp_table *arp_lookup(unsigned long paddr, int exact)
  2445. +static struct arp_table *arp_lookup(unsigned long paddr, enum proxy proxy)
  2446.  {
  2447.      struct arp_table *entry;
  2448.      unsigned long hash = HASH(paddr);
  2449. @@ -1019,9 +1031,10 @@
  2450.          if (entry->ip == paddr) break;
  2451.  
  2452.      /* it's possibly a proxy entry (with a netmask) */
  2453. -    if (!entry)
  2454. +    if (!entry && proxy != PROXY_NONE)
  2455.      for (entry=arp_tables[PROXY_HASH]; entry != NULL; entry = entry->next)
  2456. -      if (exact? (entry->ip==paddr) : !((entry->ip^paddr)&entry->mask)) 
  2457. +      if ((proxy==PROXY_EXACT) ? (entry->ip==paddr)
  2458. +                               : !((entry->ip^paddr)&entry->mask)) 
  2459.          break;      
  2460.  
  2461.      return entry;
  2462. @@ -1099,7 +1112,7 @@
  2463.      /*
  2464.       *    Find the entry
  2465.       */
  2466. -    entry = arp_lookup(ip, 1);
  2467. +    entry = arp_lookup(ip, PROXY_EXACT);
  2468.      if (entry && (entry->flags & ATF_PUBL) != (r.arp_flags & ATF_PUBL))
  2469.      {
  2470.          sti();
  2471. @@ -1179,7 +1192,7 @@
  2472.      
  2473.      si = (struct sockaddr_in *) &r.arp_pa;
  2474.      cli();
  2475. -    entry = arp_lookup(si->sin_addr.s_addr,0);
  2476. +    entry = arp_lookup(si->sin_addr.s_addr,PROXY_ANY);
  2477.  
  2478.      if (entry == NULL)
  2479.      {
  2480. diff -u --recursive --new-file v1.2.0/linux/net/inet/ip.c linux/net/inet/ip.c
  2481. --- v1.2.0/linux/net/inet/ip.c    Thu Mar  9 20:37:37 1995
  2482. +++ linux/net/inet/ip.c    Thu Mar  9 20:33:55 1995
  2483. @@ -109,6 +109,7 @@
  2484.  #include "protocol.h"
  2485.  #include "route.h"
  2486.  #include "tcp.h"
  2487. +#include "udp.h"
  2488.  #include <linux/skbuff.h>
  2489.  #include "sock.h"
  2490.  #include "arp.h"
  2491. @@ -1270,7 +1271,7 @@
  2492.  #ifdef CONFIG_IP_FIREWALL
  2493.      int err;
  2494.      
  2495. -    if((err=ip_fw_chk(skb->h.iph, dev, ip_fw_fwd_chain, ip_fw_fwd_policy))!=1)
  2496. +    if((err=ip_fw_chk(skb->h.iph, dev, ip_fw_fwd_chain, ip_fw_fwd_policy, 0))!=1)
  2497.      {
  2498.          if(err==-1)
  2499.              icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, dev);
  2500. @@ -1500,7 +1501,7 @@
  2501.  
  2502.  #ifdef    CONFIG_IP_FIREWALL
  2503.      
  2504. -    if ((err=ip_fw_chk(iph,dev,ip_fw_blk_chain,ip_fw_blk_policy))!=1)
  2505. +    if ((err=ip_fw_chk(iph,dev,ip_fw_blk_chain,ip_fw_blk_policy, 0))!=1)
  2506.      {
  2507.          if(err==-1)
  2508.              icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0, dev);
  2509. @@ -1816,6 +1817,12 @@
  2510.      iph = (struct iphdr *)ptr;
  2511.      skb->ip_hdr = iph;
  2512.      iph->tot_len = ntohs(skb->len-dev->hard_header_len);
  2513. +
  2514. +#ifdef CONFIG_IP_FIREWALL
  2515. +    if(ip_fw_chk(iph, dev, ip_fw_blk_chain, ip_fw_blk_policy, 0) != 1)
  2516. +        /* just don't send this packet */
  2517. +        return;
  2518. +#endif    
  2519.  
  2520.      /*
  2521.       *    No reassigning numbers to fragments...
  2522. diff -u --recursive --new-file v1.2.0/linux/net/inet/ip_fw.c linux/net/inet/ip_fw.c
  2523. --- v1.2.0/linux/net/inet/ip_fw.c    Thu Mar  9 20:37:37 1995
  2524. +++ linux/net/inet/ip_fw.c    Fri Mar 10 10:07:14 1995
  2525. @@ -16,6 +16,9 @@
  2526.   *    appear it's not practical - Read: It works, it's not clean but please
  2527.   *    don't consider it to be his standard of finished work.
  2528.   *        Alan Cox 12/Feb/1995
  2529. + *    Porting bidirectional entries from BSD, fixing accounting issues,
  2530. + *    adding struct ip_fwpkt for checking packets with interface address
  2531. + *        Jos Vos 5/Mar/1995.
  2532.   *
  2533.   *    All the real work was done by .....
  2534.   */
  2535. @@ -133,12 +136,17 @@
  2536.  
  2537.  
  2538.  /*
  2539. - *    Returns 0 if packet should be dropped, 1 or more if it should be accepted.
  2540. + *    Returns 0 if packet should be dropped, 1 if it should be accepted,
  2541. + *    and -1 if an ICMP host unreachable packet should be sent.
  2542.   *    Also does accounting so you can feed it the accounting chain.
  2543. + *    If opt is set to 1, it means that we do this for accounting
  2544. + *    purposes (searches all entries and handles fragments different).
  2545. + *    If opt is set to 2, it doesn't count a matching packet, which
  2546. + *    is used when calling this for checking purposes (IP_FW_CHK_*).
  2547.   */
  2548.  
  2549.  
  2550. -int ip_fw_chk(struct iphdr *ip, struct device *rif, struct ip_fw *chain, int policy)
  2551. +int ip_fw_chk(struct iphdr *ip, struct device *rif, struct ip_fw *chain, int policy, int opt)
  2552.  {
  2553.      struct ip_fw *f;
  2554.      struct tcphdr        *tcp=(struct tcphdr *)((unsigned long *)ip+ip->ihl);
  2555. @@ -146,7 +154,7 @@
  2556.      __u32            src, dst;
  2557.      __u16            src_port=0, dst_port=0;
  2558.      unsigned short        f_prt=0, prt;
  2559. -    char            notcpsyn=1;
  2560. +    char            notcpsyn=1, frag1, match;
  2561.      unsigned short        f_flag;
  2562.  
  2563.      /*
  2564. @@ -172,7 +180,9 @@
  2565.       *    of system.
  2566.       */
  2567.  
  2568. -    if (ip->frag_off&IP_OFFSET)
  2569. +    frag1 = ((ntohs(ip->frag_off) & IP_OFFSET) == 0);
  2570. +    if (!frag1 && (opt != 1) && (ip->protocol == IPPROTO_TCP ||
  2571. +            ip->protocol == IPPROTO_UDP))
  2572.          return(1);
  2573.  
  2574.      src = ip->saddr;
  2575. @@ -191,16 +201,23 @@
  2576.      {
  2577.          case IPPROTO_TCP:
  2578.              dprintf1("TCP ");
  2579. -            src_port=ntohs(tcp->source);
  2580. -            dst_port=ntohs(tcp->dest);
  2581. -            if(tcp->syn && !tcp->ack)
  2582. -                notcpsyn=0; /* We *DO* have SYN, value FALSE */
  2583. +            /* ports stay 0 if it is not the first fragment */
  2584. +            if (frag1) {
  2585. +                src_port=ntohs(tcp->source);
  2586. +                dst_port=ntohs(tcp->dest);
  2587. +                if(tcp->syn && !tcp->ack)
  2588. +                    /* We *DO* have SYN, value FALSE */
  2589. +                    notcpsyn=0;
  2590. +            }
  2591.              prt=IP_FW_F_TCP;
  2592.              break;
  2593.          case IPPROTO_UDP:
  2594.              dprintf1("UDP ");
  2595. -            src_port=ntohs(udp->source);
  2596. -            dst_port=ntohs(udp->dest);
  2597. +            /* ports stay 0 if it is not the first fragment */
  2598. +            if (frag1) {
  2599. +                src_port=ntohs(udp->source);
  2600. +                dst_port=ntohs(udp->dest);
  2601. +            }
  2602.              prt=IP_FW_F_UDP;
  2603.              break;
  2604.          case IPPROTO_ICMP:
  2605. @@ -214,10 +231,12 @@
  2606.      }
  2607.      dprint_ip(ip->saddr);
  2608.      
  2609. -    if (ip->protocol==IPPROTO_TCP || ip->protocol==IPPROTO_UDP) 
  2610. +    if (ip->protocol==IPPROTO_TCP || ip->protocol==IPPROTO_UDP)
  2611. +        /* This will print 0 when it is not the first fragment! */
  2612.          dprintf2(":%d ", src_port);
  2613.      dprint_ip(ip->daddr);
  2614. -    if ( ip->protocol==IPPROTO_TCP || ip->protocol==IPPROTO_UDP) 
  2615. +    if (ip->protocol==IPPROTO_TCP || ip->protocol==IPPROTO_UDP)
  2616. +        /* This will print 0 when it is not the first fragment! */
  2617.          dprintf2(":%d ",dst_port);
  2618.      dprintf1("\n");
  2619.  
  2620. @@ -228,8 +247,32 @@
  2621.           *    an interface chain as you do in BSD - same logic
  2622.           *    however.
  2623.           */
  2624. +
  2625. +        /*
  2626. +         *    Match can become 0x01 (a "normal" match was found),
  2627. +         *    0x02 (a reverse match was found), and 0x03 (the
  2628. +         *    IP addresses match in both directions).
  2629. +         *    Now we know in which direction(s) we should look
  2630. +         *    for a match for the TCP/UDP ports.  Both directions
  2631. +         *    might match (e.g., when both addresses are on the
  2632. +         *    same network for which an address/mask is given), but
  2633. +         *    the ports might only match in one direction.
  2634. +         *    This was obviously wrong in the original BSD code.
  2635. +         */
  2636. +        match = 0x00;
  2637. +
  2638.          if ((src&f->fw_smsk.s_addr)==f->fw_src.s_addr
  2639. -        &&  (dst&f->fw_dmsk.s_addr)==f->fw_dst.s_addr) 
  2640. +        &&  (dst&f->fw_dmsk.s_addr)==f->fw_dst.s_addr)
  2641. +            /* normal direction */
  2642. +            match |= 0x01;
  2643. +
  2644. +        if ((f->fw_flg & IP_FW_F_BIDIR) &&
  2645. +            (dst&f->fw_smsk.s_addr)==f->fw_src.s_addr
  2646. +        &&  (src&f->fw_dmsk.s_addr)==f->fw_dst.s_addr)
  2647. +            /* reverse direction */
  2648. +            match |= 0x02;
  2649. +
  2650. +        if (match)
  2651.          {
  2652.              /*
  2653.               *    Look for a VIA match 
  2654. @@ -270,11 +313,15 @@
  2655.              if(prt!=f_prt)
  2656.                  continue;
  2657.                  
  2658. -            if(!(prt==IP_FW_F_ICMP ||(
  2659. +            if(!(prt==IP_FW_F_ICMP || ((match & 0x01) &&
  2660.                  port_match(&f->fw_pts[0], f->fw_nsp, src_port,
  2661.                      f->fw_flg&IP_FW_F_SRNG) &&
  2662.                  port_match(&f->fw_pts[f->fw_nsp], f->fw_ndp, dst_port,
  2663. -                    f->fw_flg&IP_FW_F_SRNG))))
  2664. +                    f->fw_flg&IP_FW_F_DRNG)) || ((match & 0x02) &&
  2665. +                port_match(&f->fw_pts[0], f->fw_nsp, dst_port,
  2666. +                    f->fw_flg&IP_FW_F_SRNG) &&
  2667. +                port_match(&f->fw_pts[f->fw_nsp], f->fw_ndp, src_port,
  2668. +                    f->fw_flg&IP_FW_F_DRNG))))
  2669.              {
  2670.                  continue;
  2671.              }
  2672. @@ -287,10 +334,14 @@
  2673.  
  2674.          if (f->fw_flg & IP_FW_F_PRN)
  2675.          {
  2676. -            if(f->fw_flg&IP_FW_F_ACCEPT)
  2677. -                printk("Accept ");
  2678. -            else
  2679. -                printk("Deny ");
  2680. +            if(opt != 1) {
  2681. +                if(f->fw_flg&IP_FW_F_ACCEPT)
  2682. +                    printk("Accept ");
  2683. +                else if(f->fw_flg&IP_FW_F_ICMPRPL)
  2684. +                    printk("Reject ");
  2685. +                else
  2686. +                    printk("Deny ");
  2687. +            }
  2688.              switch(ip->protocol)
  2689.              {
  2690.                  case IPPROTO_TCP:
  2691. @@ -315,22 +366,24 @@
  2692.              printk("\n");
  2693.          }
  2694.  #endif        
  2695. -        if(f->fw_flg&IP_FW_F_ACCEPT)
  2696. -        {
  2697. +        if (opt != 2) {
  2698.              f->fw_bcnt+=ntohs(ip->tot_len);
  2699.              f->fw_pcnt++;
  2700. -            return 1;
  2701.          }
  2702. -        break;
  2703. +        if (opt != 1)
  2704. +            break;
  2705.      } /* Loop */
  2706.      
  2707. +    if(opt == 1)
  2708. +        return 0;
  2709. +
  2710.      /*
  2711. -     * If we get here then none of the firewalls matched or one matched
  2712. -     * but was a no. So now we rely on policy defined in the rejecting
  2713. -     * entry or if none was found in the policy variable
  2714. +     * We rely on policy defined in the rejecting entry or, if no match
  2715. +     * was found, we rely on the general policy variable for this type
  2716. +     * of firewall.
  2717.       */
  2718.  
  2719. -    if(f!=NULL)    /* A deny match */
  2720. +    if(f!=NULL)    /* A match was found */
  2721.          f_flag=f->fw_flg;
  2722.      else
  2723.          f_flag=policy;
  2724. @@ -342,9 +395,6 @@
  2725.  }
  2726.  
  2727.  
  2728. -
  2729. -
  2730. -
  2731.  static void zero_fw_chain(struct ip_fw *chainptr)
  2732.  {
  2733.      struct ip_fw *ctmp=chainptr;
  2734. @@ -526,6 +576,10 @@
  2735.                          addb4--;
  2736.  skip_check:
  2737.                  }
  2738. +                /* finally look at the interface address */
  2739. +                if ((addb4 == 0) && ftmp->fw_via.s_addr &&
  2740. +                        !(chtmp->fw_via.s_addr))
  2741. +                    addb4++;
  2742.              }
  2743.              if (addb4>0) 
  2744.              {
  2745. @@ -686,9 +740,10 @@
  2746.  
  2747.  #ifdef CONFIG_IP_ACCT
  2748.  
  2749. -int ip_acct_cnt(struct iphdr *iph, struct device *dev, struct ip_fw *f)
  2750. +void ip_acct_cnt(struct iphdr *iph, struct device *dev, struct ip_fw *f)
  2751.  {
  2752. -    return ip_fw_chk(iph, dev, f, 0);
  2753. +    (void) ip_fw_chk(iph, dev, f, 0, 1);
  2754. +    return;
  2755.  }
  2756.  
  2757.  int ip_acct_ctl(int stage, void *m, int len)
  2758. @@ -738,6 +793,8 @@
  2759.  #ifdef CONFIG_IP_FIREWALL
  2760.  int ip_fw_ctl(int stage, void *m, int len)
  2761.  {
  2762. +    int ret;
  2763. +
  2764.      if ( stage == IP_FW_FLUSH_BLK )
  2765.      {
  2766.          free_fw_chain(&ip_fw_blk_chain);
  2767. @@ -775,18 +832,21 @@
  2768.  
  2769.      if ( stage == IP_FW_CHK_BLK || stage == IP_FW_CHK_FWD )
  2770.      {
  2771. +        struct device viadev;
  2772. +        struct ip_fwpkt *ipfwp;
  2773.          struct iphdr *ip;
  2774.  
  2775. -        if ( len < sizeof(struct iphdr) + 2 * sizeof(unsigned short) )
  2776. +        if ( len < sizeof(struct ip_fwpkt) )
  2777.          {
  2778.  #ifdef DEBUG_CONFIG_IP_FIREWALL
  2779. -            printf("ip_fw_ctl: len=%d, want at least %d\n",
  2780. -                len,sizeof(struct ip) + 2 * sizeof(unsigned short));
  2781. +            printf("ip_fw_ctl: length=%d, expected %d\n",
  2782. +                len, sizeof(struct ip_fwpkt));
  2783.  #endif
  2784.              return( EINVAL );
  2785.          }
  2786.  
  2787. -         ip = (struct iphdr *)m;
  2788. +         ipfwp = (struct ip_fwpkt *)m;
  2789. +         ip = &(ipfwp->fwp_iph);
  2790.  
  2791.          if ( ip->ihl != sizeof(struct iphdr) / sizeof(int))
  2792.          {
  2793. @@ -797,15 +857,19 @@
  2794.              return(EINVAL);
  2795.          }
  2796.  
  2797. -        if ( ip_fw_chk(ip, NULL,
  2798. +        viadev.pa_addr = ipfwp->fwp_via.s_addr;
  2799. +
  2800. +        if ((ret = ip_fw_chk(ip, &viadev,
  2801.              stage == IP_FW_CHK_BLK ?
  2802.                      ip_fw_blk_chain : ip_fw_fwd_chain,
  2803.              stage == IP_FW_CHK_BLK ?
  2804. -                    ip_fw_blk_policy : ip_fw_fwd_policy )
  2805. -               ) 
  2806. +                    ip_fw_blk_policy : ip_fw_fwd_policy, 2 )) > 0
  2807. +           )
  2808.              return(0);
  2809. -            else    
  2810. -            return(EACCES);
  2811. +            else if (ret == -1)    
  2812. +            return(ECONNREFUSED);
  2813. +        else
  2814. +            return(ETIMEDOUT);
  2815.      }
  2816.  
  2817.  /*
  2818. @@ -858,7 +922,7 @@
  2819.      off_t pos=0, begin=0;
  2820.      struct ip_fw *i;
  2821.      unsigned long flags;
  2822. -    int len;
  2823. +    int len, p;
  2824.      
  2825.  
  2826.      switch(stage)
  2827. @@ -866,12 +930,12 @@
  2828.  #ifdef CONFIG_IP_FIREWALL
  2829.          case IP_INFO_BLK:
  2830.              i = ip_fw_blk_chain;
  2831. -            len=sprintf(buffer, "IP firewall block rules, policy = %d\n",
  2832. +            len=sprintf(buffer, "IP firewall block rules, default %d\n",
  2833.                  ip_fw_blk_policy);
  2834.              break;
  2835.          case IP_INFO_FWD:
  2836.              i = ip_fw_fwd_chain;
  2837. -            len=sprintf(buffer, "IP firewall forward rules, policy = %d\n",
  2838. +            len=sprintf(buffer, "IP firewall forward rules, default %d\n",
  2839.                  ip_fw_fwd_policy);
  2840.              break;
  2841.  #endif
  2842. @@ -897,12 +961,12 @@
  2843.              ntohl(i->fw_src.s_addr),ntohl(i->fw_smsk.s_addr),
  2844.              ntohl(i->fw_dst.s_addr),ntohl(i->fw_dmsk.s_addr),
  2845.              ntohl(i->fw_via.s_addr),i->fw_flg);
  2846. -        len+=sprintf(buffer+len,"%u %u %lu %lu ",
  2847. +        len+=sprintf(buffer+len,"%u %u %lu %lu",
  2848.              i->fw_nsp,i->fw_ndp, i->fw_pcnt,i->fw_bcnt);
  2849. -        len+=sprintf(buffer+len,"%u %u %u %u %u %u %u %u %u %u\n",
  2850. -            i->fw_pts[0],i->fw_pts[1],i->fw_pts[2],i->fw_pts[3],    
  2851. -            i->fw_pts[4],i->fw_pts[5],i->fw_pts[6],i->fw_pts[7],    
  2852. -            i->fw_pts[8],i->fw_pts[9]);    
  2853. +        for (p = 0; p < IP_FW_MAX_PORTS; p++)
  2854. +            len+=sprintf(buffer+len, " %u", i->fw_pts[p]);
  2855. +        buffer[len++]='\n';
  2856. +        buffer[len]='\0';
  2857.          pos=begin+len;
  2858.          if(pos<offset)
  2859.          {
  2860. diff -u --recursive --new-file v1.2.0/linux/net/inet/ipx.c linux/net/inet/ipx.c
  2861. --- v1.2.0/linux/net/inet/ipx.c    Thu Feb 23 13:31:40 1995
  2862. +++ linux/net/inet/ipx.c    Fri Mar 17 14:31:50 1995
  2863. @@ -465,6 +465,7 @@
  2864.      struct datalink_proto    *dl = intrfc->if_dlink;
  2865.      char        dest_node[IPX_NODE_LEN];
  2866.      int        send_to_wire = 1;
  2867. +    int        addr_len;
  2868.      
  2869.      /* We need to know how many skbuffs it will take to send out this
  2870.       * packet to avoid unnecessary copies.
  2871. @@ -501,8 +502,13 @@
  2872.          return 0;
  2873.      }
  2874.  
  2875. -    /* In some case, ipxitf_adjust_skbuff can overwrite node */
  2876. -    memcpy(dest_node, node, IPX_NODE_LEN);
  2877. +    /* determine the appropriate hardware address */
  2878. +    addr_len = dev->addr_len;
  2879. +    if (memcmp(ipx_broadcast_node, node, IPX_NODE_LEN) == 0) {
  2880. +        memcpy(dest_node, dev->broadcast, addr_len);
  2881. +    } else {
  2882. +        memcpy(dest_node, &(node[IPX_NODE_LEN-addr_len]), addr_len);
  2883. +    }
  2884.  
  2885.      /* make any compensation for differing physical/data link size */
  2886.      skb = ipxitf_adjust_skbuff(intrfc, skb);
  2887. @@ -699,9 +705,6 @@
  2888.      if(dev->addr_len>IPX_NODE_LEN)
  2889.          return -EINVAL;
  2890.  
  2891. -    if(dev->addr_len<2)
  2892. -        return -EINVAL;
  2893. -
  2894.      if ((intrfc = ipxitf_find_using_phys(dev, dlink_type)) == NULL) {
  2895.  
  2896.          /* Ok now create */
  2897. @@ -781,8 +784,6 @@
  2898.  
  2899.      /* Check addresses are suitable */
  2900.      if(dev->addr_len>IPX_NODE_LEN) return NULL;
  2901. -
  2902. -    if(dev->addr_len<2) return NULL;
  2903.  
  2904.      intrfc=(ipx_interface *)kmalloc(sizeof(ipx_interface),GFP_ATOMIC);
  2905.      if (intrfc!=NULL) {
  2906.