home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / prept206.zip / PREPT206.GZ / PREPT206
Text File  |  1996-05-19  |  740KB  |  20,298 lines

  1. diff -u --recursive --new-file pre2.0.5/linux/CREDITS linux/CREDITS
  2. --- pre2.0.5/linux/CREDITS    Fri May 17 15:32:09 1996
  3. +++ linux/CREDITS    Sun May 19 15:22:19 1996
  4. @@ -434,6 +434,15 @@
  5.  E: philipg@onsett.com
  6.  D: Kernel / timekeeping stuff
  7.  
  8. +N: Michael A. Griffith
  9. +E: grif@cs.ucr.edu
  10. +W: http://www.cs.ucr.edu/~grif
  11. +D: Loopback speedup, qlogic scsi hacking, VT_LOCKSWITCH
  12. +S: Department of Computer Science
  13. +S: University of California, Riverside
  14. +S: Riverside, CA  92521-0304
  15. +S: USA
  16. +
  17.  N: Dmitry S. Gorodchanin
  18.  E: begemot@bgm.rosprint.net
  19.  D: RISCom/8 driver, misc kernel fixes.
  20. @@ -1270,8 +1279,10 @@
  21.  
  22.  N: Stephen Tweedie
  23.  E: sct@dcs.ed.ac.uk
  24. +P: 1024/E7A417AD E2 FE A4 20 34 EC ED FC 7D 7E 67 8D E0 31 D1 69
  25.  D: Second extended file system developer
  26.  D: General filesystem hacker
  27. +D: kswap vm management code
  28.  S: Dept. of Computer Science
  29.  S: University of Edinburgh
  30.  S: JCMB, The King's Buildings
  31. @@ -1349,6 +1360,13 @@
  32.  S: Roger Maris Cancer Center
  33.  S: 820 4th St. N.
  34.  S: Fargo, ND  58122
  35. +
  36. +N: Hans-Joachim Widmaier
  37. +E: jbhr@sofal.tynet.sub.org
  38. +D: AFFS rewrite
  39. +S: Eichenweg 16
  40. +S: 73650 Winterbach
  41. +S: Germany
  42.  
  43.  N: Marco van Wieringen
  44.  E: mvw@mercury.mcs.nl.mugnet.org
  45. diff -u --recursive --new-file pre2.0.5/linux/Documentation/Changes linux/Documentation/Changes
  46. --- pre2.0.5/linux/Documentation/Changes    Fri May 17 15:32:09 1996
  47. +++ linux/Documentation/Changes    Fri May 17 18:30:39 1996
  48. @@ -324,8 +324,8 @@
  49.  numbers are used, and their use will be discontinued entirely in 2.1.x
  50.  
  51.     In order to avoid trouble, you need to recompile any programs that
  52. -emit floppy ioctls. These include mtools and fdutils. You can get
  53. -mtools at:
  54. +emit floppy ioctls. These include mtools, fdutils and dosemu. You can
  55. +get mtools at:
  56.  
  57.  ftp://ftp.imag.fr/pub/Linux/ZLIBC/mtools/mtools-3.0.src.tar.gz
  58.  ftp://sunsite.unc.edu/pub/Linux/utils/disk-management/mtools-3.0.src.tar.gz
  59. @@ -336,6 +336,8 @@
  60.  ftp://ftp.imag.fr/pub/Linux/ZLIBC/fdutils/fdutils-4.3.src.tar.gz
  61.  ftp://sunsite.unc.edu/pub/Linux/system/Misc/fdutils-4.3.src.tar.gz
  62.  ftp://tsx-11.mit.edu/pub/linux/sources/sbin/fdutils-4.3.src.tar.gz
  63. +
  64. +   For dosemu, see above.
  65.  
  66.     In the future, the ioctl used by fdformat might be discontinued
  67.  altogether. Please use superformat (included in fdutils) instead.
  68. diff -u --recursive --new-file pre2.0.5/linux/Documentation/Configure.help linux/Documentation/Configure.help
  69. --- pre2.0.5/linux/Documentation/Configure.help    Fri May 17 15:32:09 1996
  70. +++ linux/Documentation/Configure.help    Sun May 19 15:29:28 1996
  71. @@ -1,8 +1,7 @@
  72.  # Maintained by Axel Boldt (boldt@math.ucsb.edu) 
  73.  #
  74.  # This version of the Linux kernel configuration help texts
  75. -# corresponds to the kernel versions 1.3.x. Be aware that these
  76. -# are development kernels.
  77. +# corresponds to the kernel versions 2.0.x.
  78.  #
  79.  # Information about what a kernel is, what it does, how to patch and
  80.  # compile it and much more is contained in the Kernel-HOWTO, available
  81. @@ -45,7 +44,6 @@
  82.    may not meet the normal level of reliability or it may fail to work
  83.    in some special cases. Detailed bug reports from people familiar with
  84.    the kernel internals are usually welcomed by the developers. 
  85. -
  86.    Unless you intend to help test and develop a feature or driver that
  87.    falls into this category, or you have a situation that requires using 
  88.    these features you should probably say N here, which will cause this 
  89. @@ -128,7 +126,7 @@
  90.    interfaces, for a combination of up to eight IDE disk/cdrom/tape
  91.    drives.  Useful information about large (>540MB) IDE disks,
  92.    soundcard IDE ports, and other topics, is all contained in
  93. -  drivers/block/README.ide.  If you have one or more IDE drives, say Y
  94. +  Documentation/ide.txt.  If you have one or more IDE drives, say Y
  95.    here.  If your system has no IDE drives, or if memory requirements
  96.    are really tight, you could say N here, and select the Old harddisk
  97.    driver instead to save about 13kB of memory in the kernel.  To
  98. @@ -156,11 +154,13 @@
  99.    the new enhanced driver by itself.  This option installs the old
  100.    harddisk driver to control the primary IDE/disk interface in the
  101.    system, leaving the new enhanced IDE driver take care of only the
  102. -  2nd/3rd/4th IDE interfaces.  Choosing this option may be useful for
  103. -  older systems which have MFM/RLL/ESDI controller+drives at the
  104. -  primary port address (0x1f0), along with IDE drives at the
  105. -  secondary/3rd/4th port addresses.  Normally, just say N here; you
  106. -  will then use the new driver for all 4 interfaces.
  107. +  2nd/3rd/4th IDE interfaces. Doing this will prevent you from having
  108. +  an IDE/ATAPI CDROM or tape drive connected to the primary IDE
  109. +  interface. Choosing this option may be useful for older systems
  110. +  which have MFM/RLL/ESDI controller+drives at the primary port
  111. +  address (0x1f0), along with IDE drives at the secondary/3rd/4th port
  112. +  addresses.  Normally, just say N here; you will then use the new
  113. +  driver for all 4 interfaces.
  114.    
  115.  Include IDE/ATAPI CDROM support
  116.  CONFIG_BLK_DEV_IDECD
  117. @@ -174,9 +174,10 @@
  118.    If this is your only CDROM drive, you can say N to all other CDROM
  119.    options, but be sure to say Y to the ISO9660 filesystem.  Read the
  120.    CDROM-HOWTO, available via ftp (user: anonymous) in
  121. -  sunsite.unc.edu:/pub/Linux/docs/HOWTO.  Note that older versions of
  122. -  lilo (the linux boot loader) cannot properly deal with IDE/ATAPI
  123. -  CDROMs, so install lilo-16 or higher, available from
  124. +  sunsite.unc.edu:/pub/Linux/docs/HOWTO and the file
  125. +  Documentation/cdrom/ide-cd.  Note that older versions of lilo (the
  126. +  linux boot loader) cannot properly deal with IDE/ATAPI CDROMs, so
  127. +  install lilo-16 or higher, available from
  128.    sunsite.unc.edu:/pub/Linux/system/Linux-boot/lilo.
  129.  
  130.  Include IDE/ATAPI TAPE support
  131. @@ -186,7 +187,7 @@
  132.    similar to the SCSI protocol.  At boot time, the TAPE drive will
  133.    be identified along with other IDE devices, as "hdb" or "hdc",
  134.    or something similar.  Be sure to consult the drivers/block/ide-tape.c
  135. -  and README.ide files for usage information.
  136. +  and Documentation/ide.txt files for usage information.
  137.  
  138.  Support removable IDE interfaces (PCMCIA)
  139.  CONFIG_BLK_DEV_IDE_PCMCIA
  140. @@ -278,8 +279,12 @@
  141.  
  142.  XT harddisk support
  143.  CONFIG_BLK_DEV_XD
  144. -  Very old 8 bit hard disk controllers used in the IBM XT
  145. -  computer. Pretty unlikely that you have this: say N.
  146. +  Very old 8 bit hard disk controllers used in the IBM XT computer. To
  147. +  include a driver for these, say Y. If you want to compile the driver
  148. +  as a module ( = code which can be inserted in and removed from the
  149. +  running kernel whenever you want), say M here and read
  150. +  Documentation/modules.txt. It's pretty unlikely that you have one of
  151. +  these: say N.
  152.  
  153.  Multiple devices driver support
  154.  CONFIG_BLK_DEV_MD
  155. @@ -390,15 +395,15 @@
  156.  
  157.  Network aliasing
  158.  CONFIG_NET_ALIAS
  159. -  This is for setting several network addresses on the same low-level
  160. +  This is for setting multiple IP addresses on the same low-level
  161.    network device driver. Typically used for services that act
  162. -  differently based on the address they listen on (e.g. Apache httpd)
  163. -  or for connecting to different logical networks through the same
  164. -  physical interface.  This is the generic part, later when
  165. -  configuring network protocol options you will be asked for
  166. -  protocol-specific aliasing support.  See
  167. +  differently based on the address they listen on (e.g. "multihosting"
  168. +  on Apache httpd) or for connecting to different logical networks
  169. +  through the same physical interface.  This is the generic part,
  170. +  later when configuring network protocol options you will be asked
  171. +  for protocol-specific aliasing support.  See
  172.    Documentation/networking/alias.txt for more info.  If you need this
  173. -  features (for any protocol, like IP) say Y; if unsure, say N.
  174. +  feature (for any protocol, like IP) say Y; if unsure, say N.
  175.  
  176.  Network firewalls
  177.  CONFIG_FIREWALL
  178. @@ -407,8 +412,16 @@
  179.    net is inspected by the firewall first. If you want to configure
  180.    your Linux box as a firewall for a local network, say Y here. If
  181.    your local network is TCP/IP based, you will have to say Y to "IP:
  182. -  firewalling", below. Chances are that you should use this on any
  183. -  machine being run as a router and not on a host.
  184. +  firewalling", below.  You also need to say Y here and enable "IP
  185. +  firewalling" below in order to be able to use IP masquerading
  186. +  (i.e. local computers can chat with an outside host, but that
  187. +  outside host is made to think that it is talking to the firewall
  188. +  box. Makes the local network completely invisible and avoids the
  189. +  need to allocate valid IP host addresses for the machines on the
  190. +  local net) or to use the ip packet accounting to see what is using
  191. +  all your network bandwidth. Chances are that you should use this on
  192. +  any machine being run as a router and not on a host. If unsure, say
  193. +  N.
  194.  
  195.  Sun floppy controller support
  196.  CONFIG_BLK_DEV_SUNFD
  197. @@ -512,8 +525,9 @@
  198.    Find out whether you have a PCI motherboard. PCI is the name of a
  199.    bus system, i.e. the way the CPU talks to the other stuff inside
  200.    your box. Other bus systems are ISA, EISA, Microchannel (MCA) or
  201. -  VESA. If you have PCI, say Y, otherwise N. Note1: MCA systems are
  202. -  not supported by the standard kernels, but patches exist at
  203. +  VESA. If you have PCI, say Y, otherwise N. Note1: MCA systems
  204. +  (notably some IBM PS/2's) are not supported by the standard kernels,
  205. +  but patches exist at
  206.    http://www.undergrad.math.uwaterloo.ca/~cpbeaure/mca-linux.html on
  207.    the WWW. Note2: some old PCI motherboards have BIOS bugs and may
  208.    crash if "PCI bios support" is enabled (but they run fine without
  209. @@ -615,19 +629,26 @@
  210.  
  211.  Kernel support for JAVA binaries
  212.  CONFIG_BINFMT_JAVA
  213. -  JAVA binaries are becoming a universal executable format. This
  214. -  option allows Java binaries and Java Applets to be handled invisibly
  215. -  to the OS. As more and more Java programs become available, the use
  216. -  for this will gradually increase. If you want to use this, read the
  217. -  Java on Linux HOWTO, available via ftp (user: anonymous) at
  218. -  sunsite.unc.edu:/pub/Linux/docs/HOWTO. In order to execute Java binaries,
  219. -  you will also need to install the Java Developers Kit. If you disable
  220. -  this option it will reduce your kernel by about one page. This is not
  221. -  much and by itself does not warrant removing support. However its
  222. -  removal is a good idea if you do not have the JDK installed. If you
  223. -  don't know what to answer at this point then answer Y. You may answer
  224. -  M for module support and later load the module when you install the
  225. -  JDK or find a interesting Java program that you can't live without.
  226. +  JAVA is an object oriented programming language developed by SUN;
  227. +  JAVA programs are compiled into "JAVA bytecode" which can then be
  228. +  interpreted by run time systems on many different operating systems.
  229. +  These JAVA binaries are becoming a universal executable format. This
  230. +  option allows you to run a Java binary just like any other Linux
  231. +  program: by typing in its name. As more and more Java programs
  232. +  become available, the use for this will gradually increase. You can
  233. +  even execute HTML files containing JAVA applets (= JAVA binaries) if
  234. +  those files start with the string "<!--applet-->". If you want to
  235. +  use this, read Documentation/java.txt and the Java on Linux HOWTO,
  236. +  available via ftp (user: anonymous) at
  237. +  sunsite.unc.edu:/pub/Linux/docs/HOWTO. You will then need to install
  238. +  the run time system contained in the Java Developers Kit (JDK) as
  239. +  described in the HOWTO. If you disable this option it will reduce
  240. +  your kernel by about 4kB. This is not much and by itself does not
  241. +  warrant removing support. However its removal is a good idea if you
  242. +  do not have the JDK installed. If you don't know what to answer at
  243. +  this point then answer Y. You may answer M for module support and
  244. +  later load the module when you install the JDK or find a interesting
  245. +  Java program that you can't live without.
  246.  
  247.  Processor type
  248.  CONFIG_M386
  249. @@ -704,25 +725,23 @@
  250.    available via ftp (user: anonymous) from
  251.    sunsite.unc.edu:/pub/Linux/docs/HOWTO/mini. If unsure, say Y.
  252.  
  253. -ARP daemon support
  254. +ARP daemon support (EXPERIMENTAL)
  255.  CONFIG_ARPD
  256.    Normally, the kernel maintains an internal cache which maps IP 
  257.    addresses to hardware addresses on the local network, so that
  258. -  Ethernet/Token Ring/ etc. frames are sent to the proper address
  259. -  on the physical networking layer.  For small networks having
  260. -  a few hundred directly connected hosts or less, keeping  this
  261. -  address resolution cache (ARP) inside the kernel works well.
  262. -  However, maintaining an internal ARP cache does not work well for
  263. -  very large switched networks, and will use a lot of kernel memory
  264. -  if TCP/IP connections are made to many machines on the network.
  265. -  By enabling this option, the kernel's internal ARP cache will
  266. -  never grow to more than 256 entries (the oldest entries are 
  267. -  expired in a LIFO manner) and communication will be attempted
  268. -  with an external ARP daemon, arpd, via the kerneld message
  269. -  queue.  This code is still experimental.  If you do enable
  270. -  arpd support, you should obtain a copy of arpd from
  271. -  http://www.loran.com/~layes/arpd/index.html.  If unsure,
  272. -  say N.  
  273. +  Ethernet/Token Ring/ etc. frames are sent to the proper address on
  274. +  the physical networking layer.  For small networks having a few
  275. +  hundred directly connected hosts or less, keeping this address
  276. +  resolution (ARP) cache inside the kernel works well.  However,
  277. +  maintaining an internal ARP cache does not work well for very large
  278. +  switched networks, and will use a lot of kernel memory if TCP/IP
  279. +  connections are made to many machines on the network.  By enabling
  280. +  this option, the kernel's internal ARP cache will never grow to more
  281. +  than 256 entries (the oldest entries are expired in a LIFO manner)
  282. +  and communication will be attempted with an external ARP daemon,
  283. +  arpd.  This code is still experimental.  If you do enable arpd
  284. +  support, you should obtain a copy of arpd from
  285. +  http://www.loran.com/~layes/arpd/index.html.  If unsure, say N.
  286.  
  287.  TCP/IP networking
  288.  CONFIG_INET
  289. @@ -778,9 +797,9 @@
  290.  CONFIG_IP_MULTICAST
  291.    This is code for addressing several networked computers at once,
  292.    enlarging your kernel by about 2 kB. If you are using gated, the
  293. -  to update your computer's routing tables and are using RIP2 or OSPF
  294. -  you will need to have this option compiled in. You also need
  295. -  multicasting if you intend to participate in the MBONE, a high
  296. +  daemon that updates your computer's routing tables, and are using
  297. +  RIP2 or OSPF you will need to have this option compiled in. You also
  298. +  need multicasting if you intend to participate in the MBONE, a high
  299.    bandwidth network on top of the internet which carries audio and
  300.    video broadcasts. More information about the MBONE is on the WWW at
  301.    http://www.best.com/~prince/techinfo/mbone.html (to browse the WWW,
  302. @@ -799,17 +818,19 @@
  303.  
  304.  IP: firewalling
  305.  CONFIG_IP_FIREWALL
  306. -  If you want to configure your Linux box as a firewall for a local 
  307. +  If you want to configure your Linux box as a firewall for a local
  308.    TCP/IP based network, say Y here. This will enlarge your kernel by
  309.    about 2kB. You may need to read the FIREWALL-HOWTO, available via
  310. -  ftp (user: anonymous) in sunsite.unc.edu:/pub/Linux/docs/HOWTO. Also,
  311. -  you will need the ipfwadm tool to allow selective blocking of internet
  312. -  traffic based on type, origin and destination.  You need to enable IP
  313. -  firewalling in order to be able to use IP masquerading (i.e. local 
  314. -  computers can chat with an outside host, but that outside host is 
  315. -  made to think that it is talking to the firewall box. Makes the local
  316. -  network completely invisible) or to use the ip packet accounting to see
  317. -  what is using all your network bandwidth.
  318. +  ftp (user: anonymous) in
  319. +  sunsite.unc.edu:/pub/Linux/docs/HOWTO. Also, you will need the
  320. +  ipfwadm tool to allow selective blocking of internet traffic based
  321. +  on type, origin and destination.  You need to enable IP firewalling
  322. +  in order to be able to use IP masquerading (i.e. local computers can
  323. +  chat with an outside host, but that outside host is made to think
  324. +  that it is talking to the firewall box. Makes the local network
  325. +  completely invisible and avoids the need to allocate valid IP host
  326. +  addresses for the machines on the local net) or to use the ip packet
  327. +  accounting to see what is using all your network bandwidth.
  328.  
  329.  IP: accounting
  330.  CONFIG_IP_ACCT
  331. @@ -882,7 +903,7 @@
  332.    syntax explained in Documentation/networking/alias.txt. If you want
  333.    this, say Y. Most people don't need it and say N.
  334.  
  335. -IP: multicast routing(in progress)
  336. +IP: multicast routing (EXPERIMENTAL)
  337.  CONFIG_IP_MROUTE
  338.    This is used if you want your machine to act as a router for IP
  339.    packets that have several destination addresses. It is needed on the
  340. @@ -1041,11 +1062,11 @@
  341.    use a low speed TNC (a Terminal Node Controller acts as a kind of
  342.    modem connecting your computer's serial port to your radio's
  343.    microphone input and speaker output) supporting the KISS protocol or
  344. -  the  various SCC cards that are supported by the Ottowa PI, the
  345. +  the  various SCC cards that are supported by the Ottawa PI, the
  346.    Gracilis Packetwin and the generic Z8530 driver. 
  347.    At the moment there is no driver for the Baycom modem serial and parallel
  348.    port hacks although one is being written (see the HAM-HOWTO). The other
  349. -  baycom cards (SCC) are supported by the Z8530 driver.
  350. +  Baycom cards (SCC) are supported by the Z8530 driver.
  351.    In order to use AX.25, you need to get a set of all the software for 
  352.    Linux amateur radio users as well as information about how to 
  353.    configure an AX.25 port is contained in the HAM-HOWTO, available via
  354. @@ -1083,19 +1104,21 @@
  355.  
  356.  Bridging (EXPERIMENTAL)
  357.  CONFIG_BRIDGE
  358. -  If you enable this, your Linux box will be able to act as an
  359. +  If you say Y here, then your Linux box will be able to act as an
  360.    ethernet bridge, which means that the different ethernet segments it
  361.    is connected to will appear as one ethernet to the
  362.    participants. Several such bridges can work together to create even
  363.    larger networks of ethernets using the IEEE802.1 spanning tree
  364. -  algorithm. As this is a standard Linux bridges will interwork properly
  365. -  with other third party bridge products. Note that if your box acts as 
  366. -  a bridge, it probably contains several ethernet devices, but the kernel
  367. -  is not able to recognize more than one at boot time without help; for 
  368. -  details read the Multiple-Ethernet-mini-HOWTO, available via ftp (user:
  369. -  anonymous) in sunsite.unc.edu:/pub/Linux/docs/HOWTO/mini. The
  370. -  Bridging code is still in test. If unsure, say N.
  371. -  The bridge configuration tools are available via ftp from shadow.cabi.net.
  372. +  algorithm. As this is a standard, Linux bridges will interwork
  373. +  properly with other third party bridge products. In order to use
  374. +  this, you'll need the bridge configuration tools available via ftp
  375. +  (user: anonymous) from shadow.cabi.net. Note that if your box acts
  376. +  as a bridge, it probably contains several ethernet devices, but the
  377. +  kernel is not able to recognize more than one at boot time without
  378. +  help; for details read the Multiple-Ethernet-mini-HOWTO, available
  379. +  via ftp (user: anonymous) in
  380. +  sunsite.unc.edu:/pub/Linux/docs/HOWTO/mini. The Bridging code is
  381. +  still in test. If unsure, say N.
  382.  
  383.  Kernel/User network link driver(ALPHA)
  384.  CONFIG_NETLINK
  385. @@ -1107,6 +1130,10 @@
  386.    messages", below. Say Y if you want to experiment with it; this is
  387.    ALPHA code, which means that it need not be completely stable; it
  388.    has nothing to do with the computer architecture of the same name.
  389. +  You need to include this if you want to use arpd, a daemon that
  390. +  helps keep the internal ARP cache (a mapping between IP addresses
  391. +  and hardware addresses on the local network) small. If unsure, say
  392. +  N.
  393.  
  394.  Routing messages
  395.  CONFIG_RTNETLINK
  396. @@ -1375,9 +1402,14 @@
  397.   
  398.  allow DISCONNECT
  399.  CONFIG_SCSI_NCR53C7xx_DISCONNECT
  400. -###
  401. -### Dunno
  402. -###
  403. +  This enables the disconnect/reconnect feature of the NCR SCSI controller.
  404. +  When this is enabled, a slow SCSI device will not lock the SCSI bus
  405. +  while processing a request, allowing simultaneous use of e.g. a SCSI
  406. +  hard disk and SCSI tape or CD-ROM drive, and providing much better 
  407. +  performance when using slow and fast SCSI devices at the same time. Some 
  408. +  devices, however, do not operate properly with this option enabled, and 
  409. +  will cause your SCSI system to hang, which might cause a system crash. 
  410. +  The safe answer therefore is to say N.
  411.  
  412.  Always IN2000 SCSI support
  413.  CONFIG_SCSI_IN2000
  414. @@ -1523,22 +1555,33 @@
  415.    read Olaf Kirch's excellent book "Network Administrator's Guide", to
  416.    be found in sunsite.unc.edu:/pub/Linux/docs/LDP.  If unsure, say Y.
  417.  
  418. +CONFIG_NET_ETHERNET
  419. +  Ethernet is the most common protocol used on Local Area Networks
  420. +  (LANs) in universities or companies. 10-base-2 and 10-base-T and
  421. +  100-base-<whatever> are common types of ethernet. If your Linux
  422. +  machine will be connected to an Ethernet and you have an ethernet
  423. +  network card installed in your computer, say Y here and read the
  424. +  Ethernet-HOWTO, available via ftp (user: anonymous) from
  425. +  sunsite.unc.edu:/pub/Linux/docs/HOWTO.  Note that the answer to this
  426. +  question won't directly affect the kernel: saying N will just cause
  427. +  this configure script to skip all the questions about Ethernet
  428. +  network cards. If unsure, say N.
  429. +
  430.  Dummy net driver support
  431.  CONFIG_DUMMY
  432. -  This is essentially a bit-bucket device (i.e. traffic you send to 
  433. +  This is essentially a bit-bucket device (i.e. traffic you send to
  434.    this device is consigned into oblivion) with a configurable IP
  435. -  address different from the usual 127.0.0.1. It is most commonly used
  436. -  in order to make your currently inactive SLIP address seem like a
  437. -  real address for local programs. If you use SLIP or PPP, you might
  438. -  want to enable it. Read about it in the Network Administrator's
  439. -  Guide, available via ftp (user: anonymous) from
  440. -  sunsite.unc.edu:/pub/Linux/docs/LDP. Since this thing comes often
  441. -  handy, the default is Y. It won't enlarge your kernel either. What a
  442. -  deal.  If you want to compile this as a module ( = code which can be
  443. -  inserted in and removed from the running kernel whenever you want),
  444. -  say M here and read Documentation/modules.txt. If you want to use
  445. -  more than one dummy device at a time, you need to compile it as a
  446. -  module. 
  447. +  address. It is most commonly used in order to make your currently
  448. +  inactive SLIP address seem like a real address for local
  449. +  programs. If you use SLIP or PPP, you might want to enable it. Read
  450. +  about it in the Network Administrator's Guide, available via ftp
  451. +  (user: anonymous) from sunsite.unc.edu:/pub/Linux/docs/LDP. Since
  452. +  this thing comes often handy, the default is Y. It won't enlarge
  453. +  your kernel either. What a deal.  If you want to compile this as a
  454. +  module ( = code which can be inserted in and removed from the
  455. +  running kernel whenever you want), say M here and read
  456. +  Documentation/modules.txt. If you want to use more than one dummy
  457. +  device at a time, you need to compile it as a module.
  458.    
  459.  SLIP (serial line) support
  460.  CONFIG_SLIP
  461. @@ -1588,17 +1631,23 @@
  462.  
  463.  Six bit SLIP encapsulation
  464.  CONFIG_SLIP_MODE_SLIP6
  465. -  Just occasionally you may need to run IP over hostile serial networks that
  466. -  don't pass all control characters or are only seven bit. This adds an
  467. -  extra mode you can use with SLIP "slip6" which contains only the normal
  468. -  ascii symbols. Its good enough, for example, to run IP over the async
  469. -  ports of a Camtec JNT Pad.
  470. +  Just occasionally you may need to run IP over hostile serial
  471. +  networks that don't pass all control characters or are only seven
  472. +  bit. Saying Y here adds an extra mode you can use with SLIP:
  473. +  "slip6". In this mode, SLIP will only send normal ascii symbols over
  474. +  the serial device. Naturally, this has to be supported at the other
  475. +  end of the link as well. It's good enough, for example, to run IP
  476. +  over the async ports of a Camtec JNT Pad. If unsure, say N.
  477.  
  478.  Radio network interfaces
  479.  CONFIG_NET_RADIO
  480. -  Radio based interfaces for Linux. Both amateur radio (AX.25) and other
  481. -  systems. In addition shadow.cabi.net carries user mode drivers for the
  482. -  Scarab devices. These need no kernel support.
  483. +  Radio based interfaces for Linux. This includes amateur radio
  484. +  (AX.25), support for wireless ethernet and other systems. Note that
  485. +  the answer to this question won't directly affect the kernel:
  486. +  saying N will just cause this configure script to skip all the
  487. +  questions about radio interfaces. Some user-level drivers for scarab
  488. +  devices which don't require special kernel support are available via
  489. +  ftp (user: anonymous) from shadow.cabi.net. If unsure, say N.
  490.  
  491.  PPP (point-to-point) support
  492.  CONFIG_PPP
  493. @@ -1654,17 +1703,20 @@
  494.  WIC (Radio IP bridge)
  495.  CONFIG_WIC
  496.    Support for the WIC parallel port radio bridge. You'll probably want
  497. -  to say N.
  498. +  to say N.  If you want to compile this driver as a module though ( =
  499. +  code which can be inserted in and removed from the running kernel
  500. +  whenever you want), say M here and read Documentation/modules.txt.
  501.  
  502.  Z8530 SCC kiss emulation driver for AX.25
  503.  CONFIG_SCC
  504.    These cards are used to connect your Linux box to an amateur radio
  505. -  and communicate with other computers.  If you want to use this, read
  506. -  Documentation/networking/z8530drv.txt and the HAM-HOWTO, available
  507. -  via ftp (user: anonymous) at sunsite.unc.edu:/pub/Linux/docs/HOWTO.
  508. -  If you want to compile this as a module ( = code which can be
  509. -  inserted in and removed from the running kernel whenever you want),
  510. -  say M here and read Documentation/modules.txt.
  511. +  in order to communicate with other computers.  If you want to use
  512. +  this, read Documentation/networking/z8530drv.txt and the HAM-HOWTO,
  513. +  available via ftp (user: anonymous) at
  514. +  sunsite.unc.edu:/pub/Linux/docs/HOWTO.  If you want to compile this
  515. +  as a module ( = code which can be inserted in and removed from the
  516. +  running kernel whenever you want), say M here and read
  517. +  Documentation/modules.txt.
  518.  
  519.  BAYCOM ser12 and par96 kiss emulation driver for AX.25
  520.  CONFIG_BAYCOM
  521. @@ -1688,11 +1740,11 @@
  522.    on bidirectional parallel ports only, which can transmit 8 bits at a
  523.    time (you can find the wiring of these cables in
  524.    drivers/net/README?.plip). The cables can be up to 15m long. This
  525. -  works also if one of the machines runs DOS and has some PLIP
  526. +  works also if one of the machines runs DOS/Windows and has some PLIP
  527.    software installed, e.g. the Crynwr PLIP packet driver
  528.    (http://sunsite.cnam.fr/packages/Telnet/PC/msdos/misc/pktdrvr.txt)
  529. -  and NCSA's telnet.  If you want to use this, say Y and read the PLIP
  530. -  mini-HOWTO, available via ftp (user: anonymous) in
  531. +  and winsock or NCSA's telnet.  If you want to use this, say Y and
  532. +  read the PLIP mini-HOWTO, available via ftp (user: anonymous) in
  533.    sunsite.unc.edu:/pub/Linux/docs/HOWTO/mini as well as the
  534.    NET-2-HOWTO in sunsite.unc.edu:/pub/Linux/docs/HOWTO. Note that the
  535.    PLIP protocol was changed and this PLIP driver won't work together
  536. @@ -1776,10 +1828,6 @@
  537.    from the running kernel whenever you want). If you want to compile
  538.    it as a module, say M here and read Documentation/modules.txt.
  539.  
  540. -Ethernet (10 or 100Mbit)
  541. -CONFIG_NET_ETHERNET
  542. -  Say yes if you want to select support for ethernet cards.
  543. -
  544.  Sun LANCE Ethernet support
  545.  CONFIG_SUN_LANCE
  546.    This is support for lance ethernet cards on Sun workstations such as
  547. @@ -2577,15 +2625,7 @@
  548.    use it. Probably this is only useful for multi user systems. If
  549.    unsure, say N.
  550.  
  551. -Mandatory lock support
  552. -CONFIG_LOCK_MANDATORY
  553. -  Mandatory locking is used by some System 5 style database applications.
  554. -  To use this option safely you must have newer NFS daemons, new samba,
  555. -  new netatalk, new mars-nwe and other file servers. At the time of 
  556. -  writing none of these are available. Unless you need this feature say
  557. -  N.
  558. -  
  559. -Standard (minix) fs support
  560. +Minix fs support
  561.  CONFIG_MINIX_FS
  562.    Minix is a simple operating system used in many classes about
  563.    OS's. The minix filesystem (= method to organize files on a harddisk
  564. @@ -2916,23 +2956,23 @@
  565.    removed from the running kernel whenever you want), say M here and
  566.    read Documentation/modules.txt.
  567.  
  568. -Amiga FFS filesystem support (read only)
  569. +Amiga FFS filesystem support (EXPERIMENTAL)
  570.  CONFIG_AFFS_FS
  571.    The Fast File System (FFS) is the common filesystem used on harddisks
  572.    by Amiga (tm) Systems since AmigaOS Version 1.3 (34.20). It's also
  573.    possible to mount diskfiles used by the Un*X Amiga Emulator by Bernd
  574.    Schmidt (http://www-users.informatik.rwth-aachen.de/~crux/uae.html)
  575.    If you want to do the latter, you will also need the loop device
  576. -  support. Because it's in an early development state, the AFFS is 
  577. -  read only. Say Y if you want to be able to read files from an Amiga
  578. -  FFS partition of your harddrive. Amiga floppies however cannot be
  579. -  read with this driver due to an incompatibility of the floppy
  580. -  controller used in an Amiga and the standard floppy controller in
  581. -  PCs and workstations. Read Documentation/filesystems/affs.txt. This
  582. -  filesystem is also available as a module ( = code which can be
  583. -  inserted in and removed from the running kernel whenever you
  584. -  want). If you want to compile it as a module, say M here and read
  585. -  Documentation/modules.txt. If unsure, say N.
  586. +  support. Say Y if you want to be able to read and write files from
  587. +  and to an Amiga FFS partition of your harddrive. Amiga floppies
  588. +  however cannot be read with this driver due to an incompatibility of
  589. +  the floppy controller used in an Amiga and the standard floppy
  590. +  controller in PCs and workstations. Read
  591. +  Documentation/filesystems/affs.txt. This filesystem is also available
  592. +  as a module ( = code which can be inserted in and removed from the
  593. +  running kernel whenever you want). If you want to compile it as a
  594. +  module, say M here and read Documentation/modules.txt.
  595. +  If unsure, say N.
  596.  
  597.  Standard/generic serial support
  598.  CONFIG_SERIAL
  599. @@ -3216,11 +3256,14 @@
  600.    result in rebooting the machine. This could be useful for a
  601.    networked machine that needs to come back online as fast as possible
  602.    after a lock-up. There's a watchdog implementation entirely in
  603. -  software (which can sometimes fail to reboot the machine) and a driver
  604. -  for hardware watchdog boards, which are more robust and can also
  605. -  keep track of the temperature inside your computer. For details,
  606. -  read Documentation/watchdog.txt in the kernel source. If unsure, say
  607. -  N.
  608. +  software (which can sometimes fail to reboot the machine) and a
  609. +  driver for hardware watchdog boards, which are more robust and can
  610. +  also keep track of the temperature inside your computer. For
  611. +  details, read Documentation/watchdog.txt in the kernel source. If
  612. +  unsure, say N. This driver is also available as a module ( = code
  613. +  which can be inserted in and removed from the running kernel
  614. +  whenever you want). If you want to compile it as a module, say M
  615. +  here and read Documentation/modules.txt.
  616.  
  617.  Disable watchdog shutdown on close
  618.  CONFIG_WATCHDOG_NOWAYOUT
  619. @@ -3257,7 +3300,10 @@
  620.  CONFIG_SOFT_WATCHDOG
  621.    A software monitoring watchdog. This will fail to reboot your system
  622.    from some situations that the hardware watchdog will recover
  623. -  from. Equally it's a lot cheaper to install.
  624. +  from. Equally it's a lot cheaper to install. This driver is also
  625. +  available as a module ( = code which can be inserted in and removed
  626. +  from the running kernel whenever you want). If you want to compile
  627. +  it as a module, say M here and read Documentation/modules.txt.
  628.  
  629.  Enhanced Real Time Clock Support
  630.  CONFIG_RTC
  631. @@ -3317,20 +3363,30 @@
  632.  
  633.  ISDN subsystem
  634.  CONFIG_ISDN
  635. -  This allows you to use an ISDN-card for networking connections and
  636. -  as dialin/out device. The isdn-tty's have a built in AT-compatible
  637. -  modem emulator. Network devices support autodial, channel-bundling,
  638. +  ISDN ("Integrated Services Digital Networks", called RNIS in
  639. +  France) is a special type of fully digital telephone line; it's
  640. +  mostly used to connect to your Internet service provider (with SLIP
  641. +  or PPP). The main advantage is that the speed is higher than
  642. +  ordinary modem/telephone connections. It only works if your computer
  643. +  is equipped with an ISDN card and both you and your service provider
  644. +  purchased an ISDN line from your phone company.  For details, read
  645. +  http://alumni.caltech.edu/~dank/isdn/ on the WWW. (To browse the
  646. +  WWW, you need to have access to a machine on the Internet that has
  647. +  one of the programs lynx, netscape or Mosaic.)  This driver allows
  648. +  you to use an ISDN-card for networking connections and as dialin/out
  649. +  device. The isdn-tty's have a built in AT-compatible modem
  650. +  emulator. Network devices support autodial, channel-bundling,
  651.    callback and caller-authentication without having a daemon
  652.    running. A reduced T.70 protocol is supported with tty's suitable
  653. -  for German BTX. Currently cards by Teles and compatibles and ICN are
  654. -  supported. On D-Channel, the protocols EDSS1 and 1TR6 are
  655. +  for German BTX. On D-Channel, the protocols EDSS1 and 1TR6 are
  656.    supported. See Documentation/isdn/README for more information.
  657.  
  658.  Support synchronous PPP
  659.  CONFIG_ISDN_PPP
  660.    This enables synchronous PPP via ISDN. This protocol is used by
  661. -  Cisco or Sun for example. You will need a special version of pppd
  662. -  (called ipppd) for using this feature. See
  663. +  Cisco or Sun for example. So you want say Y here if the other end of
  664. +  your ISDN connection supports it. You will need a special version of
  665. +  pppd (called ipppd) for using this feature. See
  666.    Documentation/isdn/README.syncppp and Documentation/isdn/syncPPP.FAQ
  667.    for more information.
  668.  
  669. @@ -3344,11 +3400,21 @@
  670.  CONFIG_ISDN_PPP_VJ
  671.    This enables Van Jacobson header compression for synchronous PPP.
  672.  
  673. -ICN B1 and B2 support
  674. +Support audio via ISDN
  675. +CONFIG_ISDN_AUDIO
  676. +  With this option enabled, the modem-emulator supports a subset
  677. +  of the EIA Class 8 Voice commands. Using a getty with voice-support
  678. +  (mgetty+sendfax by gert@greenie.muc.de with an extension, available
  679. +  with the ISDN utily package for example), you will be able
  680. +  to use your Linux box as an ISDN-answering machine. Of course, this
  681. +  must be supported by the lowlevel driver also. Currently, the Teles
  682. +  driver is the only voice-supporting one.
  683. +
  684. +ICN 2B and 4B support
  685.  CONFIG_ISDN_DRV_ICN
  686.    This enables support for two kinds of ISDN-cards made by a German
  687. -  company called ICN. 1B is the standard version for a single ISDN
  688. -  line with two B-channels, 2B supports two ISDN lines. For running
  689. +  company called ICN. 2B is the standard version for a single ISDN
  690. +  line with two B-channels, 4B supports two ISDN lines. For running
  691.    this card, additional firmware is necessary, which has to be
  692.    downloaded into the card using a utility which is distributed
  693.    separately.  See Documentation/isdn/README and README.icn for more
  694. @@ -3452,4 +3518,8 @@
  695.  # LocalWords:  Solaris RISCom riscom syncPPP PCBIT pcbit sparc anu au artoo ufs
  696.  # LocalWords:  hitchcock Crynwr cnam pktdrvr NCSA's CyDROM CyCDROM FreeBSD NeXT
  697.  # LocalWords:  NeXTstep disklabel disklabels SMD FFS tm AmigaOS diskfiles Un
  698. -# LocalWords:  Bernd informatik rwth aachen uae affs
  699. +# LocalWords:  Bernd informatik rwth aachen uae affs multihosting bytecode java
  700. +# LocalWords:  applets applet JDK ncsa cabi SNI Alphatronix readme LANs scarab
  701. +# LocalWords:  winsock RNIS caltech OSPF honour Honouring Mbit Localtalk Ottowa
  702. +# LocalWords:  localtalk download Packetwin Baycom baycom interwork ascii JNT
  703. +# LocalWords:  Camtec
  704. diff -u --recursive --new-file pre2.0.5/linux/Documentation/cdrom/aztcd linux/Documentation/cdrom/aztcd
  705. --- pre2.0.5/linux/Documentation/cdrom/aztcd    Mon Apr 29 18:05:15 1996
  706. +++ linux/Documentation/cdrom/aztcd    Sun May 19 15:17:57 1996
  707. @@ -1,10 +1,10 @@
  708. -$Id: README.aztcd,v 2.30 1996/04/26 05:32:23 root Exp root $
  709. +$Id: README.aztcd,v 2.50 1996/05/16 18:31:22 root Exp root $
  710.            Readme-File /usr/src/Documentation/cdrom/aztcd
  711.                         for 
  712.           AZTECH CD-ROM CDA268-01A, ORCHID CD-3110,
  713.        OKANO/WEARNES CDD110, CONRAD TXC, CyCDROM CR520, CR540
  714.                             CD-ROM Drives 
  715. -                       Version 2.3 and newer
  716. +                       Version 2.5 and newer
  717.                     (for other drives see 6.-8.)
  718.  
  719.  NOTE: THIS DRIVER WILL WORK WITH THE CD-ROM DRIVES LISTED, WHICH HAVE
  720. diff -u --recursive --new-file pre2.0.5/linux/Documentation/cdrom/cdrom-standard.tex linux/Documentation/cdrom/cdrom-standard.tex
  721. --- pre2.0.5/linux/Documentation/cdrom/cdrom-standard.tex    Fri May 17 15:32:09 1996
  722. +++ linux/Documentation/cdrom/cdrom-standard.tex    Sat May 18 11:15:10 1996
  723. @@ -77,7 +77,7 @@
  724.  the drive door has closed without having a disk inside; without any
  725.  new software layer or any structures which are not already present in
  726.  \cdromh.  This `other' group of \linux\ \cdrom\ driver writers
  727. -explicitely does {\em not\/} support the idea to define an additional
  728. +explicitly does {\em not\/} support the idea to define an additional
  729.  software layer between driver and user program.
  730.  
  731.  The following text reflects the opinion of the first mentioned \linux\ 
  732. diff -u --recursive --new-file pre2.0.5/linux/Documentation/cdrom/ide-cd linux/Documentation/cdrom/ide-cd
  733. --- pre2.0.5/linux/Documentation/cdrom/ide-cd    Sun May 12 22:54:22 1996
  734. +++ linux/Documentation/cdrom/ide-cd    Sun May 19 15:16:34 1996
  735. @@ -1,5 +1,5 @@
  736.  IDE-CD driver documentation
  737. -10 May 1996
  738. +19 May 1996
  739.  scott snyder  <snyder@fnald0.fnal.gov>
  740.  
  741.  1. Introduction
  742. @@ -45,7 +45,7 @@
  743.  ---------------
  744.  
  745.  0. The ide-cd relies on the ide disk driver.  See
  746. -   drivers/block/README.ide for up-to-date information on the ide
  747. +   Documentation/ide.txt for up-to-date information on the ide
  748.     driver.
  749.  
  750.  1. Make sure that the ide and ide-cd drivers are compiled into the
  751. @@ -61,7 +61,7 @@
  752.  
  753.     Depending on what type of IDE interface you have, you may need to
  754.     specify additional configuration options.  See
  755. -   drivers/block/README.ide.
  756. +   Documentation/ide.txt.
  757.  
  758.  2. You should also ensure that the iso9660 filesystem is either
  759.     compiled into the kernel or available as a loadable module.  You
  760. @@ -81,7 +81,7 @@
  761.     on the primary IDE interface are called `hda' and `hdb',
  762.     respectively.  The drives on the secondary interface are called
  763.     `hdc' and `hdd'.  (Interfaces at other locations get other letters
  764. -   in the third position; see drivers/block/README.ide.)
  765. +   in the third position; see Documentation/ide.txt.)
  766.  
  767.     If you want your cdrom drive to be found automatically by the
  768.     driver, you should make sure your IDE interface uses either the
  769. @@ -90,7 +90,7 @@
  770.     be jumpered as `master'.  (If for some reason you cannot configure
  771.     your system in this manner, you can probably still use the driver.
  772.     You may have to pass extra configuration information to the kernel
  773. -   when you boot, however.  See drivers/block/README.ide for more
  774. +   when you boot, however.  See Documentation/ide.txt for more
  775.     information.)
  776.  
  777.  4. Boot the system.  If the drive is recognized, you should see a
  778. @@ -194,7 +194,7 @@
  779.  This section discusses some common problems encountered when trying to
  780.  use the driver, and some possible solutions.  Note that if you are
  781.  experiencing problems, you should probably also review
  782. -drivers/block/README.ide for current information about the underlying
  783. +Documentation/ide.txt for current information about the underlying
  784.  IDE support code.  Some of these items apply only to earlier versions
  785.  of the driver, but are mentioned here for completeness.
  786.  
  787. @@ -204,7 +204,7 @@
  788.  a. Drive is not detected during booting.
  789.  
  790.     - Review the configuration instructions above and in
  791. -     drivers/block/README.ide, and check how your hardware is
  792. +     Documentation/ide.txt, and check how your hardware is
  793.       configured.
  794.  
  795.     - If your drive is the only device on an IDE interface, it should
  796. @@ -212,7 +212,7 @@
  797.  
  798.     - If your IDE interface is not at the standard addresses of 0x170
  799.       or 0x1f0, you'll need to explicitly inform the driver using a
  800. -     lilo option.  See drivers/block/README.ide.  (This feature was
  801. +     lilo option.  See Documentation/ide.txt.  (This feature was
  802.       added around kernel version 1.3.30.)
  803.  
  804.     - If the autoprobing is not finding your drive, you can tell the
  805. @@ -238,7 +238,7 @@
  806.       Support for some interfaces needing extra initialization is
  807.       provided in later 1.3.x kernels.  You may need to turn on
  808.       additional kernel configuration options to get them to work;
  809. -     see drivers/block/README.ide.
  810. +     see Documentation/ide.txt.
  811.  
  812.       Even if support is not available for your interface, you may be
  813.       able to get it to work with the following procedure.  First boot
  814. @@ -283,7 +283,7 @@
  815.      be worked around by specifying the `serialize' option when
  816.      booting.  Recent kernels should be able to detect the need for
  817.      this automatically in most cases, but the detection is not
  818. -    foolproof.  See drivers/block/README.ide for more information
  819. +    foolproof.  See Documentation/ide.txt for more information
  820.      about the `serialize' option and the CMD640B.
  821.  
  822.    - Note that many MS-DOS cdrom drivers will work with such buggy
  823. @@ -319,7 +319,7 @@
  824.  
  825.      Some early Slackware releases had these defined incorrectly.  If
  826.      these are wrong, you can remake them by running the script
  827. -    drivers/block/MAKEDEV.ide.  (You may have to make it executable
  828. +    scripts/MAKEDEV.ide.  (You may have to make it executable
  829.      with chmod first.)
  830.  
  831.      If you have a /dev/cdrom symbolic link, check that it is pointing
  832. diff -u --recursive --new-file pre2.0.5/linux/Documentation/filesystems/affs.txt linux/Documentation/filesystems/affs.txt
  833. --- pre2.0.5/linux/Documentation/filesystems/affs.txt    Sat May 11 10:42:04 1996
  834. +++ linux/Documentation/filesystems/affs.txt    Sun May 19 15:22:19 1996
  835. @@ -6,14 +6,12 @@
  836.  
  837.  DOS\0        The old or original filesystem, not really suited for
  838.          hard disks and normally not used on them, either.
  839. -        Not supported.
  840.  
  841.  DOS\1        The original Fast File System. Supported.
  842.  
  843.  DOS\2        The old "international" filesystem. International means that
  844.          a bug has been fixed so that accented ("international") letters
  845.          in file names are case-insensitive, as they ought to be.
  846. -        Not supported.
  847.  
  848.  DOS\3        The "international" Fast File System.  Supported.
  849.  
  850. @@ -29,7 +27,10 @@
  851.  speed up almost everything with the expense of wasted disk space. The speed
  852.  gain above 4K seems not really worth the price, so you don't lose too
  853.  much here, either.
  854. -  
  855. +
  856. +The muFS (multi user File System) equivalents of the above file systems
  857. +are supported, too.
  858. +
  859.  Mount options for the AFFS
  860.  ==========================
  861.  
  862. @@ -68,6 +69,9 @@
  863.  quiet        The file system will not return an error for disallowed
  864.          mode changes.
  865.  
  866. +verbose        The volume name, file system type and block size will
  867. +        be written to the syslog.
  868. +
  869.  Handling of the Users/Groups and protection flags
  870.  =================================================
  871.  
  872. @@ -104,22 +108,47 @@
  873.      
  874.  Newly created files and directories will get the user and group id
  875.  of the current user and a mode according to the umask.
  876. -Linux can read, but not write, Amiga FFS partitions.
  877. -
  878. -Mount options are
  879. -    size    has the size in 512 byte blocks of the mounted medium. 
  880. -
  881. -Case is significant in filename matching, different to real AFFS.
  882. -
  883.  
  884.  Command line example
  885. +====================
  886.      mount  Archive/Amiga/Workbench3.1.adf /mnt -t affs -o loop,size=1760
  887.      mount  /dev/sda3 /Amiga -t affs
  888.  
  889.  /etc/fstab example
  890.      /dev/sdb5    /d/f    affs    ro
  891.  
  892. -This file system will probably be writeable in future releases.
  893. +Bugs, Restrictions, Caveats
  894. +===========================
  895. +
  896. +Quite a few things may not work as advertised. Not everything is
  897. +tested, though several hundred MB have been read and written using
  898. +this fs.
  899. +
  900. +Filenames are truncated to 30 characters without warning.
  901. +
  902. +Currently there are no checks against invalid characters (':')
  903. +in filenames.
  904. +
  905. +Case is ignored by the affs in filename matching, but Linux shells
  906. +do care about the case. Example (with /mnt being an affs mounted fs):
  907. +    rm /mnt/WRONGCASE
  908. +will remove /mnt/wrongcase, but
  909. +    rm /mnt/WR*
  910. +will not since the names are matched by the shell.
  911. +
  912. +The block allocation is designed for hard disk partitions. If more
  913. +than 1 process writes to a (small) diskette, the blocks are allocated
  914. +in an ugly way (but the real AFFS doesn't do much better). This
  915. +is also true when space gets tight.
  916. +
  917. +The bitmap valid flag in the root block may not be accurate when the
  918. +system crashes while an affs partition is mounted. There's currently
  919. +no way to fix this without an Amiga (disk validator) or manually
  920. +(who would do this?). Maybe later.
  921. +
  922. +A fsck.affs and mkfs.affs will probably be available in the future.
  923. +Until then, you should do
  924. +    ln -s /bin/true /etc/fs/mkfs.affs
  925.  
  926.  It's not possible to read floppy disks with a normal PC or workstation
  927.  due to an incompatibility to the Amiga floppy controller.
  928. diff -u --recursive --new-file pre2.0.5/linux/Documentation/isdn/INTERFACE linux/Documentation/isdn/INTERFACE
  929. --- pre2.0.5/linux/Documentation/isdn/INTERFACE    Tue May  7 16:22:15 1996
  930. +++ linux/Documentation/isdn/INTERFACE    Sun May 19 15:29:28 1996
  931. @@ -1,3 +1,4 @@
  932. +$Id: INTERFACE,v 1.2 1996/05/18 15:58:53 fritz Exp $
  933.  
  934.  Description of the Interface between Linklevel and Hardwarelevel
  935.    of isdn4linux:
  936. @@ -12,9 +13,29 @@
  937.    the fields. All further communication is done via callbacks using
  938.    the function-pointers defined in isdn_if.
  939.  
  940. -  ATTENTION, CHANGES since version 0.6 are marked with   "***CHANGE0.6"!
  941. -  ATTENTION, CHANGES since version 0.7 are marked with   "***CHANGE0.7"!
  942. -  ATTENTION, CHANGES since version 0.71 are marked with  "***CHANGE0.7.1"!
  943. +  Changes/Version numbering:
  944. +
  945. +  During development of the ISDN subsystem, several changes have been
  946. +  made to the interface. Before it went into kernel, the package
  947. +  had a unique version number. The last version, distributed separately
  948. +  was 0.7.4. When the subsystem went into kernel, every functional unit
  949. +  got a separate version number. These numbers are shown at initialization,
  950. +  separated by slashes:
  951. +
  952. +     c.c/t.t/n.n/p.p/a.a
  953. +
  954. +  where
  955. +
  956. +   c.c is the revision of the common code.
  957. +   t.t is the revision of the tty related code.
  958. +   n.n is the revision of the network related code.
  959. +   p.p is the revision of the ppp related code.
  960. +   a.a is the revision of the audio related code.
  961. +
  962. +  Changes in this document are marked with '***CHANGEx' where x representing
  963. +  the version number. If that number starts with 0, it refers to the old,
  964. +  separately distributed package. If it starts with one of the letters
  965. +  above, it refers to the revision of the corresponding module. 
  966.  
  967.  1. Description of the fields of isdn_if:
  968.  
  969. @@ -53,6 +74,11 @@
  970.  
  971.    void (*rcvcallb)(int, int, u_char*, int);
  972.  
  973. +    ***CHANGEc1.14: Declared obsolete. Do NOT use this field/function
  974. +                    anymore, since it will be removed when all current
  975. +                    LL drivers have been changed accordingly. Use
  976. +                    rcvcallb_skb instead.
  977. +
  978.      This field will be set by LL. The HL-driver delivers received data-
  979.      packets by calling this function.
  980.  
  981. @@ -114,6 +140,11 @@
  982.  
  983.    int (*writebuf)(int, int, u_char*, int, int);
  984.  
  985. +    ***CHANGEc1.14: Declared obsolete. Do NOT use this field/function
  986. +                    anymore, since it will be removed when all current
  987. +                    LL drivers have been changed accordingly. Set this
  988. +                    field to NULL and use writebuf_skb instead.
  989. +
  990.      This field has to be preset by the HL-driver. The given function will
  991.      be called by the LL for delivering data to be send via B-Channel.
  992.  
  993. @@ -149,11 +180,7 @@
  994.        Length of data accepted on success, else error-code (-EINVAL on
  995.        oversized packets etc.)
  996.  
  997. -NOTE on writebuf and writebuf_skb:
  998. -    The HL-driver may initialize one of the fields to NULL, in which case
  999. -    the LL will call the non-NULL function only.
  1000. -
  1001. -  int (*writecmd)(u_char*, int, int);
  1002. +  int (*writecmd)(u_char*, int, int, int, int);
  1003.  
  1004.      This field has to be preset by the HL-driver. The given function will be
  1005.      called to perform write-requests on /dev/isdnctrl (i.e. sending commands
  1006. @@ -169,11 +196,15 @@
  1007.                          memcpy, may NOT use schedule())
  1008.                      1 = call from user-space. (HL-driver must use
  1009.                          memcpy_fromfs, use of schedule() allowed)
  1010. +      int     driver-Id.
  1011. +      int     channel-number locally to the HL-driver. (starts with 0)
  1012. +
  1013. +***CHANGEc1.14: The driver-Id and channel-number are new since this revision.
  1014.  
  1015.      Returnvalue:
  1016.        Length of data accepted on success, else error-code (-EINVAL etc.)
  1017.  
  1018. -  int (*readstat)(u_char*, int, int);
  1019. +  int (*readstat)(u_char*, int, int, int, int);
  1020.  
  1021.      This field has to be preset by the HL-driver. The given function will be
  1022.      called to perform read-requests on /dev/isdnctrl (i.e. reading replies
  1023. @@ -189,6 +220,10 @@
  1024.                          memcpy, may NOT use schedule())
  1025.                      1 = call from user-space. (HL-driver must use
  1026.                          memcpy_fromfs, use of schedule() allowed)
  1027. +      int     driver-Id.
  1028. +      int     channel-number locally to the HL-driver. (starts with 0)
  1029. +
  1030. +***CHANGEc1.14: The driver-Id and channel-number are new since this revision.
  1031.  
  1032.      Returnvalue:
  1033.        Length of data on success, else error-code (-EINVAL etc.)
  1034. diff -u --recursive --new-file pre2.0.5/linux/Documentation/isdn/README linux/Documentation/isdn/README
  1035. --- pre2.0.5/linux/Documentation/isdn/README    Tue May  7 16:22:15 1996
  1036. +++ linux/Documentation/isdn/README    Sun May 19 15:29:28 1996
  1037. @@ -119,6 +119,8 @@
  1038.                 AT&X0    BTX-mode off (default)
  1039.             AT&X1    BTX-mode on. (S13.1=1, S14=0, S16=7, S18=7, S19=0)
  1040.  
  1041. +           For voice-mode commands refer to README.audio
  1042. +
  1043.         1.3.2 Escape sequence:
  1044.                 During a connection, the emulation reacts just like
  1045.                 a normal modem to the escape sequence <DELAY>+++<DELAY>.
  1046. @@ -168,18 +170,34 @@
  1047.                                        1 = Direct tty-send.
  1048.                              Bit 1:    0 = T.70 protocol (Only for BTX!) off
  1049.                                        1 = T.70 protocol (Only for BTX!) on
  1050. -         14   0         Layer-2 protocol: (with the ICN-driver 
  1051. -                                                currently always 0)
  1052. +         14   0         Layer-2 protocol:
  1053.                        0 = X75/LAPB with I-frames
  1054.                        1 = X75/LAPB with UI-frames
  1055.                                        2 = X75/LAPB with BUI-frames
  1056.                                        3 = HDLC
  1057. +                                      4 = Transparent (audio)
  1058.               15   0         Layer-3 protocol: (at the moment always 0)
  1059.                                        0 = transparent
  1060.           16   250       Send-Packet-size/16
  1061.               17   8         Window-size for Teles-driver (not yet implemented)
  1062. -             18   7         Service-Octet-1
  1063. +             18   4         Bit coded register, Service-Octet-1 to accept,
  1064. +                            or to be used on dialout:
  1065. +                            Bit 0:    Service 1 (audio) when set.
  1066. +                            Bit 1:    Service 5 (BTX) when set.
  1067. +                            Bit 2:    Service 7 (data) when set.
  1068. +                            Note: It is possible to set more than one
  1069. +                                  bit. In this case, on incoming calls
  1070. +                                  the selected services are accepted,
  1071. +                                  and if the service is "audio", the
  1072. +                                  Layer-2-protocol is automatically
  1073. +                                  changed to 4 regardless of the setting
  1074. +                                  of register 14. On outgoing calls,
  1075. +                                  the most significant 1-bit is choosen to
  1076. +                                  select the outgoing service octet.
  1077.               19   0         Service-Octet-2
  1078. +             20   0         Bit coded register (readonly)
  1079. +                            Service-Octet-1 of last call.
  1080. +                            Bit mapping is the same like register 18
  1081.  
  1082.    Last but not least a (at the moment fairly primitive) device to request
  1083.    the line-status (/dev/isdninfo) is made available.
  1084. @@ -272,9 +290,8 @@
  1085.         Due to limited hardware-capabilities, there is no way to check the
  1086.         existence of a card. Therefore you need to be sure your card's setup
  1087.         is correct. Also there are bugs in the printed manual of some newer
  1088. -       16.3 cards. The manual tells the port has to be 0x180. THIS IS WRONG!!
  1089. -       0xd80 is the correct value! Have a look to the kernel-syslog. With
  1090. -       most of the cards, you should see a line "HSCX version A:5 B:5" there.
  1091. +       16.3 cards. Have a look to the kernel-syslog. With most of the cards,
  1092. +       you should see a line "HSCX version A:5 B:5" there.
  1093.         
  1094.       3.1.2 ICN driver.
  1095.  
  1096. @@ -292,9 +309,10 @@
  1097.         When using the ICN double card, you MUST define TWO idstrings.
  1098.         idstring must start with a character!
  1099.  
  1100. -       The ICN driver supports only one card at the moment. If you like to
  1101. -       use more than one card, build the modularized version, loading it
  1102. -       more than one time, each module driving a single card.
  1103. +       If you like to use more than one card, you can use the program
  1104. +       "icnctrl" from the utility-package to configure additional cards.
  1105. +       You need to configure shared memory only once, since the icn-driver
  1106. +       maps all cards into the same address-space.
  1107.  
  1108.         Using the "icnctrl"-utility, portbase and shared memory can also be
  1109.         changed during runtime.
  1110. @@ -335,12 +353,8 @@
  1111.         When using the ICN double card, you MUST define TWO idstrings.
  1112.         idstring must start with a character!
  1113.  
  1114. -       The ICN driver supports only one card at the moment. If you like to
  1115. -       use more than one card, build the modularized version, loading it
  1116. -       more than one time, each module driving a single card.
  1117. -
  1118. -       Using the "icnctrl"-utility, portbase and shared memory can also be
  1119. -       changed during runtime.
  1120. +       Using the "icnctrl"-utility, the same features apply to the modularized
  1121. +       version like to the kernel-builtin one.
  1122.  
  1123.         The D-channel protocol is configured by loading different firmware
  1124.         into the card's memory using the "icnctrl"-utility.
  1125. @@ -365,12 +379,15 @@
  1126.       For Euro-ISDN:
  1127.         icnctrl [-d IDstring] load download/loadpg.bin download/pc_eu_ca.bin
  1128.  
  1129. -     When using the ICN-2B, the protocol-software for the second half of
  1130. +     When using the ICN-4B, the protocol-software for the second half of
  1131.       the card must be appended to the command line.
  1132.  
  1133. -     -> The two LEDs at the back cover of the card (ICN-2B: 4 LEDs) must be
  1134. +     -> The two LEDs at the back cover of the card (ICN-4B: 4 LEDs) must be
  1135.          blinking intermittently now. If a connection is up, the corresponding
  1136.          led is lit continuously.
  1137. +
  1138. +     For loading pcbit-firmware, refer to Documentation/isdn/README.pcbit
  1139. +     and the pcbit manpage, included in the utility-package.
  1140.  
  1141.     b) If you only intend to use ttys, you are nearly ready now.
  1142.  
  1143. diff -u --recursive --new-file pre2.0.5/linux/Documentation/isdn/README.icn linux/Documentation/isdn/README.icn
  1144. --- pre2.0.5/linux/Documentation/isdn/README.icn    Fri Apr 12 15:51:44 1996
  1145. +++ linux/Documentation/isdn/README.icn    Sun May 19 15:29:28 1996
  1146. @@ -1,3 +1,5 @@
  1147. +$Id: README.icn,v 1.3 1996/05/19 00:10:37 fritz Exp $
  1148. +
  1149.  You can get the ICN-ISDN-card from:
  1150.  
  1151.  Thinking Objects Software GmbH
  1152. @@ -16,7 +18,8 @@
  1153.    2. A memory window with 16KB-256KB size, which can be setup in 16k steps
  1154.       over the whole range of 16MB. Isdn4linux only uses a 16k window.
  1155.       The base address of the window can be configured when loading
  1156. -     the lowlevel-module (see README).
  1157. +     the lowlevel-module (see README). If using more than one card,
  1158. +     all cards are mapped to the same window and activated as needed.
  1159.  
  1160.  Setting up the IO-address dipswitches for the ICN-ISDN-card:
  1161.  
  1162. diff -u --recursive --new-file pre2.0.5/linux/Documentation/isdn/README.syncppp linux/Documentation/isdn/README.syncppp
  1163. --- pre2.0.5/linux/Documentation/isdn/README.syncppp    Sun Apr 21 19:21:59 1996
  1164. +++ linux/Documentation/isdn/README.syncppp    Sun May 19 15:29:28 1996
  1165. @@ -12,7 +12,7 @@
  1166.  to answer the appropriate question when doing a "make config"
  1167.  Don't forget to load the slhc.o
  1168.  module before the isdn.o module, if VJ-compression support
  1169. -is not compiled into your kernel. (e.g if you have PPP or
  1170. +is not compiled into your kernel. (e.g if you have no PPP or
  1171.  CSLIP in the kernel)
  1172.  
  1173.  Using isdn4linux with sync PPP:
  1174. @@ -20,11 +20,13 @@
  1175.  Sync PPP is just another encapsulation for isdn4linux. The
  1176.  name to enable sync PPP encapsulation is 'syncppp' .. e.g:
  1177.  
  1178. -  isdn/isdnctrl encap ippp0 syncppp
  1179. +  /sbin/isdnctrl encap ippp0 syncppp
  1180.  
  1181.  The name of the interface is here 'ippp0'. You need 
  1182.  one interface with the name 'ippp0' to saturate the
  1183.  ipppd, which checks the ppp version via this interface.
  1184. +Currently, all devices must have the name ipppX where
  1185. +'X' is a decimal value.
  1186.  
  1187.  To set up a PPP connection you need the ipppd .. You must start 
  1188.  the ipppd once after installing the modules. The ipppd 
  1189. @@ -46,7 +48,8 @@
  1190.  To use the MPPP stuff, you must configure a slave device
  1191.  with isdn4linux. Now call the ipppd with the '+mp' option.
  1192.  To increase the number of links, you must use the
  1193. -'addlink' option of the isdnctrl tool.
  1194. +'addlink' option of the isdnctrl tool. (rc.isdn.syncppp.MPPP is
  1195. +an example script)
  1196.  
  1197.  enjoy it,
  1198.      michael
  1199. diff -u --recursive --new-file pre2.0.5/linux/Documentation/isdn/syncPPP.FAQ linux/Documentation/isdn/syncPPP.FAQ
  1200. --- pre2.0.5/linux/Documentation/isdn/syncPPP.FAQ    Wed Apr 24 17:00:33 1996
  1201. +++ linux/Documentation/isdn/syncPPP.FAQ    Sun May 19 15:29:28 1996
  1202. @@ -1,32 +1,50 @@
  1203.  simple isdn4linux PPP FAQ .. to be continued .. not 'debugged' 
  1204. +-------------------------------------------------------------------
  1205.  
  1206. -Q: pppd,ipppd, syncPPP , asyncPPP .. what is that ?
  1207. -  what should I use?
  1208. -A: The pppd is for asynchronous PPP .. asynchronous means
  1209. -here, the framing is character based. (e.g when
  1210. -using ttyI* or tty* devices)
  1211. -
  1212. -The ipppd handles PPP packets coming in HDLC
  1213. -frames (bit based protocol) ... The PPP driver
  1214. -in isdn4linux pushes all IP packets direct
  1215. -to the network layer and all PPP protocol
  1216. -frames to the /dev/ippp* device. 
  1217. -So, the ipppd is a simple external network
  1218. -protocol handler.
  1219. -
  1220. -If you login into a remote machine using the
  1221. -/dev/ttyI* devices and then enable PPP on the
  1222. -remote terminal server -> use the 'old' pppd
  1223. -
  1224. -If your remote side immediately starts to send
  1225. -frames ... you probably connect to a 
  1226. -syncPPP machine .. use the network device part
  1227. -of isdn4linux with the 'syncppp' encapsulation
  1228. -and make sure, that the ipppd is running and 
  1229. -connected to at least one /dev/ippp*. Check the 
  1230. -isdn4linux manual on how to configure a network device.
  1231. +Q01: what's pppd,ipppd, syncPPP , asyncPPP ??
  1232. +Q02: error message "this systems lacks PPP support"
  1233. +Q03: strange information using 'ifconfig'
  1234. +Q04: MPPP?? What's that and how can I use it ...
  1235. +Q05: I tried MPPP but it doesn't work 
  1236. +Q06: can I use asynchronous PPP encapuslation with network devices
  1237. +Q07: A SunISDN machine can't connect to my i4l system
  1238. +Q08: I wanna talk to several machines, which need different configs
  1239. +Q09: Starting the ipppd, I get only error messages from i4l
  1240. +Q10: I wanna use dynamic IP address assignment 
  1241. +Q11: I can't connect. How can I check where the problem is.
  1242. +Q12: How can I reduce login delay? 
  1243. +
  1244. +-------------------------------------------------------------------
  1245. +
  1246. +Q01: pppd,ipppd, syncPPP , asyncPPP .. what is that ?
  1247. +   what should I use?
  1248. +A: The pppd is for asynchronous PPP .. asynchron means
  1249. +   here, the framing is character based. (e.g when
  1250. +   using ttyI* or tty* devices)
  1251. +
  1252. +   The ipppd handles PPP packets coming in HDLC
  1253. +   frames (bit based protocol) ... The PPP driver
  1254. +   in isdn4linux pushes all IP packets direct
  1255. +   to the network layer and all PPP protocol
  1256. +   frames to the /dev/ippp* device. 
  1257. +   So, the ipppd is a simple externel network
  1258. +   protocol handler.
  1259. +
  1260. +   If you login into a remote machine using the
  1261. +   /dev/ttyI* devices and then enable PPP on the
  1262. +   remote terminal server -> use the 'old' pppd
  1263. +
  1264. +   If your remote side immediately starts to send
  1265. +   frames ... you probably connect to a 
  1266. +   syncPPP machine .. use the network device part
  1267. +   of isdn4linux with the 'syncppp' encapsulation
  1268. +   and make sure, that the ipppd is running and 
  1269. +   conneted to at least one /dev/ippp*. Check the 
  1270. +   isdn4linux manual on how to configure a network device.
  1271.  
  1272. -Q: when I start the ipppd .. I only get the
  1273. +--
  1274. +
  1275. +Q02: when I start the ipppd .. I only get the
  1276.     error message "this systems lacks PPP support"
  1277.  A: check that at least the device 'ippp0' exists.
  1278.     (you can check this e.g with the program 'ifconfig')
  1279. @@ -39,12 +57,168 @@
  1280.     kernel source tree than the kernel you currently
  1281.     run ... 
  1282.  
  1283. -Q: when I list the netdevices with ifconfig I see, that
  1284. +--
  1285. +
  1286. +Q03: when I list the netdevices with ifconfig I see, that
  1287.     my ISDN interface has a HWaddr and IRQ=0 and Base 
  1288.     address = 0 
  1289. -A: The device is a fake ethernet device .. ignore IRQ and baseaddr
  1290. +A: The device is a fake ethernetdevice .. ignore IRQ and baseaddr
  1291.     You need the HWaddr only for ethernet encapsulation.
  1292.     
  1293. +--
  1294. +
  1295. +Q04: MPPP?? What's that and how can I use it ...
  1296. +
  1297. +A: MPPP or MP or MPP (Warning: MP is also an 
  1298. +   acronym for 'Multi Processor') stands for
  1299. +   Multi Point to Point and means bundling
  1300. +   of several channels to one logical stream.
  1301. +   To enable MPPP negotiation you must call the
  1302. +   ipppd with the '+mp' option. 
  1303. +   You must also configure a slave device for
  1304. +   every additional channel. (see the i4l manual
  1305. +   for more)
  1306. +   To use channel bundling you must first activate
  1307. +   the 'master' or inital call. Now you can add 
  1308. +   the slave channels with the command:
  1309. +       isdnctrl addlink <device>
  1310. +   e.g:
  1311. +       isdnctrl addlink ippp0
  1312. +   This is different to other encapsualtions of
  1313. +   isdn4linux! With syncPPP, there is no automatic
  1314. +   activation of slave devices.
  1315. +
  1316. +--
  1317. +
  1318. +Q05: I tried MPPP but it doesn't work .. the ipppd
  1319. +   writes in the debug log something like:
  1320. +   .. rcvd [0][proto=0x3d] c0 00 00 00 80 fd 01 01 00 0a ...
  1321. +   .. sent [0][LCP ProtRej id=0x2 00 3d c0 00 00 00 80 fd 01 ...
  1322. +
  1323. +A: you forgot to compile MPPP/RFC1717 support into the
  1324. +   ISDN Subsystem. Recompile with this option enabled.
  1325. +
  1326. +--
  1327. +
  1328. +Q06: can I use asynchronous PPP encapuslation
  1329. +   over the network interface of isdn4linux ..
  1330. +
  1331. +A: No .. that's not possible .. Use the standard
  1332. +   PPP package over the /dev/ttyI* devices. You
  1333. +   must not use the ipppd for this.
  1334. +   
  1335. +--
  1336. +
  1337. +Q07: A SunISDN machine tries to connect my i4l system,
  1338. +   which doesn't work.
  1339. +   Checking the debug log I just saw garbage like:
  1340. +!![ ... fill in the line ... ]!!
  1341. +
  1342. +A: The Sun tries to talk asynchronous PPP ... i4l
  1343. +   can't understand this ... try to use the ttyI*
  1344. +   devices with the standard PPP/pppd package
  1345. +
  1346. +A: (from Alexanter Strauss: )
  1347. +!![ ... fill in mail ]!!
  1348. +
  1349. +--
  1350. +
  1351. +Q08: A wanna talk to remote machines, which need
  1352. +   a different configuration. The only way
  1353. +   I found to do this is to kill the ipppd and
  1354. +   start a new one with another config to connect
  1355. +   to the second machine. 
  1356. +
  1357. +A: you must bind a network interface explicitly to
  1358. +   an ippp device, where you can connect a (for this
  1359. +   interface) individualy configured ipppd.
  1360. +
  1361. +--
  1362. +
  1363. +Q09: When I start the ipppd I only get error messages
  1364. +   from the i4l driver .. 
  1365. +
  1366. +A: When starting, the ipppd calls functions which may 
  1367. +   trigger a network packet. (e.g gethostbyname()).
  1368. +   Without the ipppd (at this moment, it is not
  1369. +   fully started) we can't handle this network request.
  1370. +   Try to configure hostnames necessary for the ipppd
  1371. +   in your local /etc/hosts file or in a way, that
  1372. +   your system can resolve it without using an
  1373. +   isdn/ippp network-interface.
  1374. +
  1375. +--
  1376. +
  1377. +Q10: I wanna use dynamic IP address assignment ... How 
  1378. +   must I configure the network device.
  1379. +
  1380. +A: At least you must have a routing, which forwards
  1381. +   a packet to the ippp network-interface to trigger
  1382. +   the dial-on-demand.
  1383. +   A default routing to the ippp-interface will work.
  1384. +   Now you must choose a dummy IP address for your
  1385. +   interface.
  1386. +   If for some reason you can't set the default
  1387. +   routing to the ippp interface, you may take any 
  1388. +   address of the subnet from which you expect your
  1389. +   dynamic IP number and set a 'network route' for
  1390. +   this subnet to the ippp interface.
  1391. +   To allow overriding of the dummy address you
  1392. +   must call the ipppd with the 'ipcp-accept-local' option.
  1393. +
  1394. +A: You must know, how the ipppd gets the addresses it wanna
  1395. +   configure. If you don't give any option, the ipppd
  1396. +   tries to negotiate the local host address!
  1397. +   With the option 'noipdefault' it requests an address
  1398. +   from the remote machine. With 'useifip' it gets the
  1399. +   addresses from the net interface. Or you set the addresse
  1400. +   on the option line with the <a.b.c.d:e.f.g.h> option.
  1401. +   Note: the IP address of the remote machine must be configured
  1402. +   locally or the remote machine must send it in an IPCP request.
  1403. +   If your side doesn't know the IP address after negotiation, it
  1404. +   closes the connection!
  1405. +   You must allow overriding of address with the 'ipcp-accept-*'
  1406. +   options, if you have set your own or the remote address 
  1407. +   explicitly.
  1408. +
  1409. +A: Maybe you try these options .. e.g:   
  1410. +
  1411. +    /sbin/ipppd :$REMOTE noipdefault /dev/ippp0
  1412. +
  1413. +   where REMOTE must be the address of the remote machine (the
  1414. +   machine, which gives you your address)
  1415. +
  1416. +--
  1417. +
  1418. +Q11: I can't connect. How can I check where the problem is.
  1419. +
  1420. +A: A good help log is the debug output from the ipppd...
  1421. +   Check whether you can find there:
  1422. +   - only a few LCP-conf-req SENT messages (less then 10)
  1423. +     and then a Term-REQ:
  1424. +     -> check whether your ISDN card is well configured
  1425. +        it seems, that your machine doesn't dial
  1426. +        (IRQ,IO,Proto, etc problems)
  1427. +        Configure your ISDN card to print debug messages and
  1428. +        check the /dev/isdnctrl output next time. There
  1429. +        you can see, whether there is activity on the card/line.
  1430. +   - there are at least a few RECV messages in the log:
  1431. +     -> fine: your card is dialing and your remote machine
  1432. +        tries to talk with you. Maybe only a missing 
  1433. +        authentification. Check your ipppd configuration again.
  1434. +   - the ipppd exits for some reason:
  1435. +     -> not good ... check /var/adm/syslog and /var/adm/daemon.
  1436. +        Could be a bug in the ipppd.
  1437. +
  1438. +--
  1439. +
  1440. +Q12: How can I reduce login delay?
  1441. +
  1442. +A: Log a login session ('debug' log) and check which options 
  1443. +  your remote side rejects. Next time configure your ipppd
  1444. +  to not negotiate these options. Another 'side effect' is, that
  1445. +  this increases redundancy. (e.g your remote side is buggy and
  1446. +  rejects options in a wrong way).
  1447.  
  1448.  
  1449.  
  1450. diff -u --recursive --new-file pre2.0.5/linux/Makefile linux/Makefile
  1451. --- pre2.0.5/linux/Makefile    Fri May 17 15:32:10 1996
  1452. +++ linux/Makefile    Fri May 17 15:32:53 1996
  1453. @@ -1,6 +1,6 @@
  1454.  VERSION = 1
  1455.  PATCHLEVEL = 99
  1456. -SUBLEVEL = 5
  1457. +SUBLEVEL = 6
  1458.  
  1459.  ARCH = i386
  1460.  
  1461. diff -u --recursive --new-file pre2.0.5/linux/arch/alpha/defconfig linux/arch/alpha/defconfig
  1462. --- pre2.0.5/linux/arch/alpha/defconfig    Mon May 13 23:02:47 1996
  1463. +++ linux/arch/alpha/defconfig    Sun May 19 16:41:54 1996
  1464. @@ -24,6 +24,7 @@
  1465.  # CONFIG_ALPHA_EB66P is not set
  1466.  # CONFIG_ALPHA_EB64P is not set
  1467.  CONFIG_ALPHA_EB164=y
  1468. +# CONFIG_ALPHA_PC164 is not set
  1469.  # CONFIG_ALPHA_JENSEN is not set
  1470.  # CONFIG_ALPHA_NONAME is not set
  1471.  # CONFIG_ALPHA_P2K is not set
  1472. @@ -47,11 +48,15 @@
  1473.  # Please see drivers/block/README.ide for help/info on IDE drives
  1474.  #
  1475.  # CONFIG_BLK_DEV_HD_ONLY is not set
  1476. +
  1477. +#
  1478. +# Additional Block Devices
  1479. +#
  1480. +# CONFIG_BLK_DEV_LOOP is not set
  1481. +# CONFIG_BLK_DEV_MD is not set
  1482.  CONFIG_BLK_DEV_RAM=y
  1483.  # CONFIG_BLK_DEV_INITRD is not set
  1484. -# CONFIG_BLK_DEV_LOOP is not set
  1485.  # CONFIG_BLK_DEV_XD is not set
  1486. -# CONFIG_BLK_DEV_MD is not set
  1487.  
  1488.  #
  1489.  # Networking options
  1490. @@ -120,7 +125,7 @@
  1491.  # CONFIG_SCSI_NCR53C7xx_DISCONNECT is not set
  1492.  # CONFIG_SCSI_IN2000 is not set
  1493.  # CONFIG_SCSI_PAS16 is not set
  1494. -# CONFIG_SCSI_QLOGIC is not set
  1495. +# CONFIG_SCSI_QLOGIC_FAS is not set
  1496.  # CONFIG_SCSI_SEAGATE is not set
  1497.  # CONFIG_SCSI_T128 is not set
  1498.  # CONFIG_SCSI_ULTRASTOR is not set
  1499. diff -u --recursive --new-file pre2.0.5/linux/arch/alpha/kernel/traps.c linux/arch/alpha/kernel/traps.c
  1500. --- pre2.0.5/linux/arch/alpha/kernel/traps.c    Sat Apr 27 15:19:44 1996
  1501. +++ linux/arch/alpha/kernel/traps.c    Sun May 19 17:02:31 1996
  1502. @@ -70,9 +70,9 @@
  1503.      force_sig(SIGFPE, current);
  1504.  }
  1505.  
  1506. -asmlinkage void do_entIF(unsigned long type, unsigned long a1, unsigned long a2,
  1507. -             unsigned long a3, unsigned long a4, unsigned long a5,
  1508. -             struct pt_regs regs)
  1509. +asmlinkage void do_entIF(unsigned long type, unsigned long a1,
  1510. +             unsigned long a2, unsigned long a3, unsigned long a4,
  1511. +             unsigned long a5, struct pt_regs regs)
  1512.  {
  1513.      extern int ptrace_cancel_bpt (struct task_struct *who);
  1514.  
  1515. @@ -201,18 +201,18 @@
  1516.      if (reg >= 16 && reg <= 18)
  1517.          reg += 19;
  1518.      switch (opcode) {
  1519. -        case 0x28: /* ldl */
  1520. -            *(reg+regs.regs) = (int) ldl_u(va);
  1521. -            return;
  1522. -        case 0x29: /* ldq */
  1523. -            *(reg+regs.regs) = ldq_u(va);
  1524. -            return;
  1525. -        case 0x2c: /* stl */
  1526. -            stl_u(*(reg+regs.regs), va);
  1527. -            return;
  1528. -        case 0x2d: /* stq */
  1529. -            stq_u(*(reg+regs.regs), va);
  1530. -            return;
  1531. +          case 0x28: /* ldl */
  1532. +        *(reg+regs.regs) = get_unaligned((int *)va);
  1533. +        return;
  1534. +          case 0x29: /* ldq */
  1535. +        *(reg+regs.regs) = get_unaligned((long *)va);
  1536. +        return;
  1537. +          case 0x2c: /* stl */
  1538. +        put_unaligned(*(reg+regs.regs), (int *)va);
  1539. +        return;
  1540. +          case 0x2d: /* stq */
  1541. +        put_unaligned(*(reg+regs.regs), (long *)va);
  1542. +        return;
  1543.      }
  1544.      printk("Bad unaligned kernel access at %016lx: %p %lx %ld\n",
  1545.          regs.pc, va, opcode, reg);
  1546. @@ -321,45 +321,79 @@
  1547.      reg_addr = frame;
  1548.      if (opcode >= 0x28) {
  1549.          /* it's an integer load/store */
  1550. -        if (reg < 9) {
  1551. -            reg_addr += 7 + reg;            /* v0-t7 in SAVE_ALL frame */
  1552. -        } else if (reg < 16) {
  1553. -            reg_addr += (reg - 9);            /* s0-s6 in entUna frame */
  1554. -        } else if (reg < 19) {
  1555. -            reg_addr += 7 + 20 + 3 + (reg - 16);    /* a0-a2 in PAL frame */
  1556. -        } else if (reg < 29) {
  1557. -            reg_addr += 7 + 9 + (reg - 19);        /* a3-at in SAVE_ALL frame */
  1558. -        } else {
  1559. -            switch (reg) {
  1560. -                  case 29:                /* gp in PAL frame */
  1561. -                reg_addr += 7 + 20 + 2;
  1562. -                break;
  1563. -                  case 30:                /* usp in PAL regs */
  1564. -                usp = rdusp();
  1565. -                reg_addr = &usp;
  1566. -                break;
  1567. -                  case 31:                /* zero "register" */
  1568. -                reg_addr = &zero;
  1569. -                break;
  1570. -            }
  1571. +        switch (reg) {
  1572. +              case 0: case 1: case 2: case 3: case 4:
  1573. +              case 5: case 6: case 7: case 8:
  1574. +            /* v0-t7 in SAVE_ALL frame */
  1575. +            reg_addr += 7 + reg;
  1576. +            break;
  1577. +
  1578. +              case 9: case 10: case 11: case 12:
  1579. +              case 13: case 14: case 15:
  1580. +            /* s0-s6 in entUna frame */
  1581. +            reg_addr += (reg - 9);
  1582. +            break;
  1583. +
  1584. +              case 16: case 17: case 18: 
  1585. +            /* a0-a2 in PAL frame */
  1586. +            reg_addr += 7 + 20 + 3 + (reg - 16);
  1587. +            break;
  1588. +
  1589. +              case 19: case 20: case 21: case 22: case 23: 
  1590. +              case 24: case 25: case 26: case 27: case 28:
  1591. +            /* a3-at in SAVE_ALL frame */
  1592. +            reg_addr += 7 + 9 + (reg - 19);
  1593. +            break;
  1594. +
  1595. +              case 29:
  1596. +            /* gp in PAL frame */
  1597. +            reg_addr += 7 + 20 + 2;
  1598. +            break;
  1599. +
  1600. +              case 30:
  1601. +            /* usp in PAL regs */
  1602. +            usp = rdusp();
  1603. +            reg_addr = &usp;
  1604. +            break;
  1605. +
  1606. +              case 31:
  1607. +            /* zero "register" */
  1608. +            reg_addr = &zero;
  1609. +            break;
  1610.          }
  1611.      }
  1612.  
  1613.      switch (opcode) {
  1614. -          case 0x22:                        /* lds */
  1615. -        alpha_write_fp_reg(reg, s_mem_to_reg(ldl_u(va)));
  1616. +          case 0x22: /* lds */
  1617. +        alpha_write_fp_reg(reg, s_mem_to_reg(
  1618. +            get_unaligned((unsigned int *)va)));
  1619.          break;
  1620. -          case 0x26:                        /* lds */
  1621. -        alpha_write_fp_reg(reg, s_reg_to_mem(ldl_u(va)));
  1622. +          case 0x26: /* sts */
  1623. +        put_unaligned(s_reg_to_mem(alpha_read_fp_reg(reg)),
  1624. +                  (unsigned int *)va);
  1625.          break;
  1626.  
  1627. -          case 0x23: alpha_write_fp_reg(reg, ldq_u(va)); break;    /* ldt */
  1628. -          case 0x27: stq_u(alpha_read_fp_reg(reg), va);  break;    /* stt */
  1629. +          case 0x23: /* ldt */
  1630. +        alpha_write_fp_reg(reg, get_unaligned((unsigned long *)va));
  1631. +        break;    
  1632. +          case 0x27: /* stt */
  1633. +        put_unaligned(alpha_read_fp_reg(reg), (unsigned long *)va);
  1634. +        break;
  1635. +
  1636. +          case 0x28: /* ldl */
  1637. +        *reg_addr = get_unaligned((int *)va);
  1638. +        break;
  1639. +          case 0x2c: /* stl */
  1640. +        put_unaligned(*reg_addr, (int *)va);
  1641. +        break;
  1642. +
  1643. +          case 0x29: /* ldq */
  1644. +        *reg_addr = get_unaligned((long *)va);
  1645. +        break;
  1646. +          case 0x2d: /* stq */
  1647. +        put_unaligned(*reg_addr, (long *)va);
  1648. +        break;
  1649.  
  1650. -          case 0x28: *reg_addr = (int) ldl_u(va);         break;    /* ldl */
  1651. -          case 0x29: *reg_addr = ldq_u(va);             break;    /* ldq */
  1652. -          case 0x2c: stl_u(*reg_addr, va);             break;    /* stl */
  1653. -          case 0x2d: stq_u(*reg_addr, va);             break;    /* stq */
  1654.            default:
  1655.          *pc_addr -= 4;    /* make pc point to faulting insn */
  1656.          force_sig(SIGBUS, current);
  1657. @@ -383,10 +417,11 @@
  1658.   * got terminally tainted by VMS at some point.
  1659.   */
  1660.  asmlinkage long do_entSys(unsigned long a0, unsigned long a1, unsigned long a2,
  1661. -    unsigned long a3, unsigned long a4, unsigned long a5, struct pt_regs regs)
  1662. +              unsigned long a3, unsigned long a4, unsigned long a5,
  1663. +              struct pt_regs regs)
  1664.  {
  1665.      if (regs.r0 != 112)
  1666. -      printk("<sc %ld(%lx,%lx,%lx)>", regs.r0, a0, a1, a2);
  1667. +        printk("<sc %ld(%lx,%lx,%lx)>", regs.r0, a0, a1, a2);
  1668.      return -1;
  1669.  }
  1670.  
  1671. diff -u --recursive --new-file pre2.0.5/linux/arch/i386/boot/video.S linux/arch/i386/boot/video.S
  1672. --- pre2.0.5/linux/arch/i386/boot/video.S    Mon May 13 23:02:47 1996
  1673. +++ linux/arch/i386/boot/video.S    Sat May 18 11:15:10 1996
  1674. @@ -880,7 +880,7 @@
  1675.      cmp    ax,#0x0080    ! Check validity of mode ID
  1676.      jc    vesa2
  1677.      or    ah,ah        ! Valid ID's are 0x0000-0x007f and 0x0100-0x07ff
  1678. -    jz    vesan        ! [Certain BIOSes errorneously report 0x80-0xff]
  1679. +    jz    vesan        ! [Certain BIOSes erroneously report 0x80-0xff]
  1680.      cmp    ax,#0x0800
  1681.      jnc    vesae
  1682.  vesa2:    push    cx
  1683. diff -u --recursive --new-file pre2.0.5/linux/arch/i386/defconfig linux/arch/i386/defconfig
  1684. --- pre2.0.5/linux/arch/i386/defconfig    Mon May 13 23:02:47 1996
  1685. +++ linux/arch/i386/defconfig    Sun May 19 16:22:52 1996
  1686. @@ -44,13 +44,17 @@
  1687.  # CONFIG_BLK_DEV_IDETAPE is not set
  1688.  # CONFIG_BLK_DEV_IDE_PCMCIA is not set
  1689.  CONFIG_BLK_DEV_CMD640=y
  1690. -CONFIG_BLK_DEV_RZ1000=y
  1691.  # CONFIG_BLK_DEV_TRITON is not set
  1692. +CONFIG_BLK_DEV_RZ1000=y
  1693.  # CONFIG_IDE_CHIPSETS is not set
  1694. -# CONFIG_BLK_DEV_RAM is not set
  1695. +
  1696. +#
  1697. +# Additional Block Devices
  1698. +#
  1699.  # CONFIG_BLK_DEV_LOOP is not set
  1700. -# CONFIG_BLK_DEV_XD is not set
  1701.  # CONFIG_BLK_DEV_MD is not set
  1702. +# CONFIG_BLK_DEV_RAM is not set
  1703. +# CONFIG_BLK_DEV_XD is not set
  1704.  
  1705.  #
  1706.  # Networking options
  1707. diff -u --recursive --new-file pre2.0.5/linux/arch/m68k/kernel/head.S linux/arch/m68k/kernel/head.S
  1708. --- pre2.0.5/linux/arch/m68k/kernel/head.S    Fri May 17 15:32:11 1996
  1709. +++ linux/arch/m68k/kernel/head.S    Sat May 18 11:15:10 1996
  1710. @@ -375,7 +375,7 @@
  1711.      movel    %d1,%a2@+
  1712.      /*
  1713.       * %a2 points now to the page table entry for available pages at %a6,
  1714. -     * hence caching modes for new pages can easiely set unless increasing
  1715. +     * hence caching modes for new pages can easily set unless increasing
  1716.       * of %a2 are forgotten.
  1717.       */
  1718.  Lnot040:
  1719. diff -u --recursive --new-file pre2.0.5/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
  1720. --- pre2.0.5/linux/drivers/block/genhd.c    Mon May 13 23:02:47 1996
  1721. +++ linux/drivers/block/genhd.c    Sun May 19 13:29:22 1996
  1722. @@ -30,21 +30,16 @@
  1723.  
  1724.  #include <asm/system.h>
  1725.  
  1726. -#ifdef __alpha__
  1727.  /*
  1728. - * On the Alpha, we get unaligned access exceptions on
  1729. - *  p->nr_sects and p->start_sect, when the partition table
  1730. - *  is not on a 4-byte boundary, which is frequently the case.
  1731. - * This code uses unaligned load instructions to prevent
  1732. - *  such exceptions.
  1733. + * Many architectures don't like unaligned accesses, which is
  1734. + * frequently the case with the nr_sects and start_sect partition
  1735. + * table entries.
  1736.   */
  1737.  #include <asm/unaligned.h>
  1738. -#define NR_SECTS(p)    ldl_u(&p->nr_sects)
  1739. -#define START_SECT(p)    ldl_u(&p->start_sect)
  1740. -#else /* __alpha__ */
  1741. -#define NR_SECTS(p)    p->nr_sects
  1742. -#define START_SECT(p)    p->start_sect
  1743. -#endif /* __alpha__ */
  1744. +
  1745. +#define NR_SECTS(p)    get_unaligned(&p->nr_sects)
  1746. +#define START_SECT(p)    get_unaligned(&p->start_sect)
  1747. +
  1748.  
  1749.  struct gendisk *gendisk_head = NULL;
  1750.  
  1751. diff -u --recursive --new-file pre2.0.5/linux/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c
  1752. --- pre2.0.5/linux/drivers/block/ide-cd.c    Sat May 11 10:42:05 1996
  1753. +++ linux/drivers/block/ide-cd.c    Sun May 19 15:16:34 1996
  1754. @@ -97,6 +97,7 @@
  1755.   * 3.12  May  7, 1996 -- Rudimentary changer support.  Based on patches
  1756.   *                        from Gerhard Zuber <zuber@berlin.snafu.de>.
  1757.   *                       Let open succeed even if there's no loaded disc.
  1758. + * 3.13  May 19, 1996 -- Fixes for changer code.
  1759.   *
  1760.   * NOTE: Direct audio reads will only work on some types of drive.
  1761.   * So far, i've received reports of success for Sony and Toshiba drives.
  1762. @@ -106,6 +107,7 @@
  1763.   * uses a different protocol.
  1764.   *
  1765.   * ATAPI cd-rom driver.  To be used with ide.c.
  1766. + * See Documentation/cdrom/ide-cd for usage information.
  1767.   *
  1768.   * Copyright (C) 1994, 1995, 1996  scott snyder  <snyder@fnald0.fnal.gov>
  1769.   * May be copied or modified under the terms of the GNU General Public License
  1770. @@ -130,9 +132,7 @@
  1771.  #include <asm/io.h>
  1772.  #include <asm/byteorder.h>
  1773.  #include <asm/segment.h>
  1774. -#ifdef __alpha__
  1775. -# include <asm/unaligned.h>
  1776. -#endif
  1777. +#include <asm/unaligned.h>
  1778.  
  1779.  #include "ide.h"
  1780.  
  1781. @@ -1149,11 +1149,7 @@
  1782.      pc.c[0] = READ_10;
  1783.      pc.c[7] = (nframes >> 8);
  1784.      pc.c[8] = (nframes & 0xff);
  1785. -#ifdef __alpha__
  1786. -    stl_u (htonl (frame), (unsigned int *) &pc.c[2]);
  1787. -#else
  1788. -    *(int *)(&pc.c[2]) = htonl (frame);
  1789. -#endif
  1790. +    put_unaligned(htonl (frame), (unsigned int *) &pc.c[2]);
  1791.  
  1792.      /* Send the command to the drive and return. */
  1793.      (void) cdrom_transfer_packet_command (drive, pc.c, sizeof (pc.c),
  1794. @@ -1937,11 +1933,7 @@
  1795.          pc.c[0] = READ_CD;
  1796.  
  1797.      pc.c[1] = (format << 2);
  1798. -#ifdef __alpha__
  1799. -    stl_u(htonl (lba), (unsigned int *) &pc.c[2]);
  1800. -#else
  1801. -    *(int *)(&pc.c[2]) = htonl (lba);
  1802. -#endif
  1803. +    put_unaligned(htonl(lba), (unsigned int *) &pc.c[2]);
  1804.      pc.c[8] = 1;  /* one block */
  1805.      pc.c[9] = 0x10;
  1806.  
  1807. @@ -1968,7 +1960,7 @@
  1808.  
  1809.  /* If SLOT<0, unload the current slot.  Otherwise, try to load SLOT. */
  1810.  static int
  1811. -cdrom_load_unload (ide_drive_t *drive, unsigned long slot,
  1812. +cdrom_load_unload (ide_drive_t *drive, int slot,
  1813.             struct atapi_request_sense *reqbuf)
  1814.  {
  1815.      struct packet_command pc;
  1816. @@ -2403,16 +2395,14 @@
  1817.          if (drive->usage > 1)
  1818.              return -EBUSY;
  1819.  
  1820. -        stat = cdrom_load_unload (drive, -1, NULL);
  1821. -        if (stat) return stat;
  1822. +        (void) cdrom_load_unload (drive, -1, NULL);
  1823.  
  1824.                  cdrom_saw_media_change (drive);
  1825.                  if (arg == -1) {
  1826.              (void) cdrom_lockdoor (drive, 0, NULL);
  1827.              return 0;
  1828.          }
  1829. -        stat = cdrom_load_unload (drive, arg, NULL);
  1830. -        if (stat) return stat;
  1831. +        (void) cdrom_load_unload (drive, (int)arg, NULL);
  1832.  
  1833.          stat = cdrom_check_status (drive, &my_reqbuf);
  1834.          if (stat && my_reqbuf.sense_key == NOT_READY) {
  1835. @@ -2642,7 +2632,6 @@
  1836.   *  Establish interfaces for an IDE port driver, and break out the cdrom
  1837.   *   code into a loadable module.
  1838.   *  Support changers better.
  1839. - *  Write some real documentation.
  1840.   */
  1841.  
  1842.  
  1843. diff -u --recursive --new-file pre2.0.5/linux/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
  1844. --- pre2.0.5/linux/drivers/block/ll_rw_blk.c    Sat May 11 10:42:05 1996
  1845. +++ linux/drivers/block/ll_rw_blk.c    Fri May 17 18:30:40 1996
  1846. @@ -286,9 +286,17 @@
  1847.  
  1848.      count = bh->b_size >> 9;
  1849.      sector = bh->b_rsector;
  1850. +
  1851. +    /* Uhhuh.. Nasty dead-lock possible here.. */
  1852. +    if (buffer_locked(bh))
  1853. +        return;
  1854. +    /* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
  1855. +
  1856. +    lock_buffer(bh);
  1857. +
  1858.      if (blk_size[major])
  1859.          if (blk_size[major][MINOR(bh->b_rdev)] < (sector + count)>>1) {
  1860. -            bh->b_state = 0;
  1861. +            bh->b_state &= (1 << BH_Lock) | (1 << BH_FreeOnIO);
  1862.                          /* This may well happen - the kernel calls bread()
  1863.                             without checking the size of the device, e.g.,
  1864.                             when mounting a device. */
  1865. @@ -298,13 +306,9 @@
  1866.                                 kdevname(bh->b_rdev), rw,
  1867.                                 (sector + count)>>1,
  1868.                                 blk_size[major][MINOR(bh->b_rdev)]);
  1869. +            unlock_buffer(bh);
  1870.              return;
  1871.          }
  1872. -    /* Uhhuh.. Nasty dead-lock possible here.. */
  1873. -    if (buffer_locked(bh))
  1874. -        return;
  1875. -    /* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
  1876. -    lock_buffer(bh);
  1877.  
  1878.      rw_ahead = 0;    /* normal case; gets changed below for READA/WRITEA */
  1879.      switch (rw) {
  1880. diff -u --recursive --new-file pre2.0.5/linux/drivers/cdrom/aztcd.c linux/drivers/cdrom/aztcd.c
  1881. --- pre2.0.5/linux/drivers/cdrom/aztcd.c    Tue May  7 16:22:23 1996
  1882. +++ linux/drivers/cdrom/aztcd.c    Sun May 19 15:17:57 1996
  1883. @@ -1,5 +1,5 @@
  1884. -#define AZT_VERSION "2.40"
  1885. -/*      $Id: aztcd.c,v 2.40 1996/05/01 11:09:35 root Exp root $
  1886. +#define AZT_VERSION "2.50"
  1887. +/*      $Id: aztcd.c,v 2.50 1996/05/17 16:19:03 root Exp root $
  1888.      linux/drivers/block/aztcd.c - Aztech CD268 CDROM driver
  1889.  
  1890.      Copyright (C) 1994,95,96 Werner Zimmermann(zimmerma@rz.fht-esslingen.de)
  1891. @@ -151,6 +151,9 @@
  1892.          V2.40   Reorganized the placement of functions in the source code file
  1893.                  to reflect the layered approach; did not actually change code
  1894.                  Werner Zimmermann, May 1, 96
  1895. +        V2.50   Heiko Eissfeld suggested to remove some VERIFY_READs in 
  1896. +                aztcd_ioctl; check_aztcd_media_change modified 
  1897. +                Werner Zimmermann, May 16, 96       
  1898.  */
  1899.  #include <linux/module.h>
  1900.  #include <linux/errno.h>
  1901. @@ -1053,10 +1056,15 @@
  1902.  }
  1903.  
  1904.  /* 
  1905. - * Checking if the media has been changed not yet implemented
  1906. + * Checking if the media has been changed
  1907.  */
  1908.  static int check_aztcd_media_change(kdev_t full_dev)
  1909. -{ return 0;
  1910. +{ if (aztDiskChanged)          /* disk changed */
  1911. +     { aztDiskChanged=0;
  1912. +       return 1;
  1913. +     }
  1914. +  else
  1915. +       return 0;               /* no change */
  1916.  }
  1917.  
  1918.  /*
  1919. @@ -1127,7 +1135,7 @@
  1920.  #ifdef AZT_DEBUG
  1921.               printk("aztcd ioctl MULTISESSION\n");
  1922.  #endif
  1923. -          st = verify_area(VERIFY_READ, (void*) arg, sizeof(struct cdrom_multisession));
  1924. +          st = verify_area(VERIFY_WRITE, (void*) arg, sizeof(struct cdrom_multisession));
  1925.            if (st) return st;
  1926.            memcpy_fromfs(&ms, (void*) arg, sizeof(struct cdrom_multisession));
  1927.            if (ms.addr_format == CDROM_MSF) 
  1928. @@ -1140,8 +1148,6 @@
  1929.            else
  1930.                 return -EINVAL;
  1931.            ms.xa_flag = DiskInfo.xa;
  1932. -           st = verify_area(VERIFY_WRITE, (void*) arg, sizeof(struct cdrom_multisession));
  1933. -          if (st) return st;
  1934.              memcpy_tofs((void*) arg, &ms, sizeof(struct cdrom_multisession));
  1935.  #ifdef AZT_DEBUG 
  1936.             if (ms.addr_format == CDROM_MSF) 
  1937. @@ -1225,8 +1231,6 @@
  1938.          memcpy_tofs((void *) arg, &tocHdr, sizeof tocHdr);
  1939.          break;
  1940.      case CDROMREADTOCENTRY:      /* Read an entry in the table of contents */
  1941. -        st = verify_area(VERIFY_READ, (void *) arg, sizeof entry);
  1942. -        if (st) return st;
  1943.          st = verify_area(VERIFY_WRITE, (void *) arg, sizeof entry);
  1944.          if (st) return st;
  1945.          memcpy_fromfs(&entry, (void *) arg, sizeof entry);
  1946. @@ -1254,17 +1258,10 @@
  1947.          memcpy_tofs((void *) arg, &entry, sizeof entry);
  1948.          break;
  1949.      case CDROMSUBCHNL:   /* Get subchannel info */
  1950. -        st = verify_area(VERIFY_READ, (void *) arg, sizeof(struct cdrom_subchnl));
  1951. -        if (st) { 
  1952. -#ifdef AZT_DEBUG
  1953. -                  printk("aztcd: exiting aztcd_ioctl - Error 1 - Command:%x\n",cmd);
  1954. -#endif
  1955. -                  return st;
  1956. -                }  
  1957.          st = verify_area(VERIFY_WRITE, (void *) arg, sizeof(struct cdrom_subchnl));
  1958.          if (st) { 
  1959.  #ifdef AZT_DEBUG
  1960. -                  printk("aztcd: exiting aztcd_ioctl - Error 2 - Command:%x\n",cmd);
  1961. +                  printk("aztcd: exiting aztcd_ioctl - Error 1 - Command:%x\n",cmd);
  1962.  #endif
  1963.                    return st;
  1964.                  }  
  1965. @@ -1340,9 +1337,7 @@
  1966.  #if AZT_PRIVATE_IOCTLS 
  1967.      case CDROMREADCOOKED: /*read data in mode 1 (2048 Bytes)*/
  1968.      case CDROMREADRAW:    /*read data in mode 2 (2336 Bytes)*/
  1969. -        { st = verify_area(VERIFY_READ,  (void *) arg, sizeof msf);
  1970. -          if (st) return st;
  1971. -          st = verify_area(VERIFY_WRITE, (void *) arg, sizeof buf);
  1972. +        { st = verify_area(VERIFY_WRITE, (void *) arg, sizeof buf);
  1973.            if (st) return st;
  1974.            memcpy_fromfs(&msf, (void *) arg, sizeof msf);
  1975.            /* convert to bcd */
  1976. diff -u --recursive --new-file pre2.0.5/linux/drivers/cdrom/mcdx.c linux/drivers/cdrom/mcdx.c
  1977. --- pre2.0.5/linux/drivers/cdrom/mcdx.c    Fri May 17 15:32:13 1996
  1978. +++ linux/drivers/cdrom/mcdx.c    Sat May 18 11:15:10 1996
  1979. @@ -27,7 +27,7 @@
  1980.   *  Daniel v. Mosnenck (he sent me the Technical and Programming Reference)
  1981.   *  Gerd Knorr (he lent me his PhotoCD)
  1982.   *  Nils Faerber and Roger E. Wolff (extensively tested the LU portion)
  1983. - *  Andreas Kies (testing the mysterious hang up's)
  1984. + *  Andreas Kies (testing the mysterious hangups)
  1985.   *  ... somebody forgotten?
  1986.   * 
  1987.   * 2.1  1996/04/29 Marcin Dalecki <dalecki@namu03.gwdg.de>
  1988. @@ -38,8 +38,8 @@
  1989.   * 2.3  1996/05/15 Marcin Dalecki <dalecki@namu03.gwdg.de>
  1990.   *    Fixed stereo support. 
  1991.   * NOTE:
  1992. - *    There will be propably a 3.0 adhering to the new generic non ATAPI
  1993. - *    cdrom interface in the unforseen future.
  1994. + *    There will be probably a 3.0 adhering to the new generic non ATAPI
  1995. + *    cdrom interface in the unforeseen future.
  1996.   */
  1997.  #define VERSION "2.3"
  1998.  
  1999. @@ -261,8 +261,8 @@
  2000.   * Return drives status in case of success, -1 otherwise.
  2001.   *
  2002.   * First we try to get the status information quickly.
  2003. - * Then we sleep repeatedly for about 10 usecs, befor we finally reach the 
  2004. - * timeout. For this reason this command must be called with the drive beeing 
  2005. + * Then we sleep repeatedly for about 10 usecs, before we finally reach the 
  2006. + * timeout. For this reason this command must be called with the drive being 
  2007.   * locked!
  2008.   */
  2009.  static int get_status(struct s_drive_stuff *stuffp,
  2010. @@ -462,7 +462,7 @@
  2011.          set_drive_mode(stuffp, DATA);
  2012.          return -EIO;
  2013.      }
  2014. -    /* now read actually the index tarcks */
  2015. +    /* now read actually the index tracks */
  2016.      for (trk = 0;
  2017.           trk < (stuffp->n_last - stuffp->n_first + 1);
  2018.           trk++)
  2019. @@ -563,8 +563,8 @@
  2020.      /*
  2021.       * Update disk information, when necessary.
  2022.       * This part will only work, when the new disk is of the same type as 
  2023. -     * the one which was previousley there, esp. also for audio diks.
  2024. -     * This doesn't hurt us, since otherwise the mouting/unmounting scheme 
  2025. +     * the one which was previously there, esp. also for audio disks.
  2026. +     * This doesn't hurt us, since otherwise the mounting/unmounting scheme 
  2027.       * will ensure correct operation.
  2028.       */
  2029.      if (stuffp->xxx) {    /* disk changed */
  2030. @@ -797,7 +797,7 @@
  2031.              return ans;
  2032.  
  2033.          memcpy_fromfs(&volctrl, (char *) arg, sizeof(volctrl));
  2034. -        /* Adjust for the wiredness of workman. */
  2035. +        /* Adjust for the weirdness of workman. */
  2036.          volctrl.channel2 = volctrl.channel1;
  2037.          volctrl.channel1 = volctrl.channel3 = 0x00;
  2038.          return talk(stuffp, MCDX_CMD_SET_ATTENATOR,
  2039. @@ -815,7 +815,7 @@
  2040.   * This does actually the transfer from the drive.
  2041.   * Return:      -1 on timeout or other error
  2042.   * else status byte (as in stuff->st) 
  2043. - * FIXME: the excessive jumping throught wait queues degrades the
  2044. + * FIXME: the excessive jumping through wait queues degrades the
  2045.   * performance significantly.
  2046.   */
  2047.  static int transfer_data(struct s_drive_stuff *stuffp,
  2048. @@ -1179,7 +1179,7 @@
  2049.      MCDX_TRACE(("mcdx_media_change()\n"));
  2050.  
  2051.      /*
  2052. -     * FIXME: propably this is unneded or should be simplified!
  2053. +     * FIXME: probably this is unneeded or should be simplified!
  2054.       */
  2055.      issue_command(stuffp = mcdx_stuffp[MINOR(full_dev)],
  2056.                MCDX_CMD_GET_STATUS, 5 * HZ);
  2057. @@ -1197,7 +1197,7 @@
  2058.      u_char b;
  2059.  
  2060.      if (!(stuffp = mcdx_irq_map[irq])) {
  2061. -        return;        /* hugh? */
  2062. +        return;        /* huh? */
  2063.      }
  2064.      
  2065.      /* NOTE: We only should get interrupts if data were requested.
  2066. @@ -1225,7 +1225,7 @@
  2067.  
  2068.  /*
  2069.   * FIXME!
  2070. - * This seems to hang badly, when the driver is loaded with inappriopriate
  2071. + * This seems to hang badly, when the driver is loaded with inappropriate
  2072.   * port/irq settings!
  2073.   */
  2074.  int mcdx_init(void)
  2075. diff -u --recursive --new-file pre2.0.5/linux/drivers/char/README.baycom linux/drivers/char/README.baycom
  2076. --- pre2.0.5/linux/drivers/char/README.baycom    Fri May 17 15:32:14 1996
  2077. +++ linux/drivers/char/README.baycom    Sat May 18 11:15:09 1996
  2078. @@ -79,7 +79,7 @@
  2079.  
  2080.  Configuring the driver
  2081.  
  2082. -Everytime the driver is inserted into the kernel, it has to know which
  2083. +Every time the driver is inserted into the kernel, it has to know which
  2084.  modems it should access at which ports. This can be done with the setbaycom
  2085.  utility. If you are only using one modem, you can also configure the
  2086.  driver from the insmod command line (or by means of an option line in
  2087. diff -u --recursive --new-file pre2.0.5/linux/drivers/char/pcxx.c linux/drivers/char/pcxx.c
  2088. --- pre2.0.5/linux/drivers/char/pcxx.c    Tue May  7 16:22:25 1996
  2089. +++ linux/drivers/char/pcxx.c    Sun May 19 15:24:50 1996
  2090. @@ -1868,6 +1868,9 @@
  2091.              return 0;
  2092.  
  2093.          case TIOCSSOFTCAR:
  2094. +            error = verify_area(VERIFY_READ, (void *) arg,sizeof(long));
  2095. +            if(error)
  2096. +                return error;
  2097.              arg = get_fs_long((unsigned long *) arg);
  2098.              tty->termios->c_cflag =    ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
  2099.              return 0;
  2100. @@ -1905,6 +1908,9 @@
  2101.          case TIOCMBIC:
  2102.          case TIOCMODS:
  2103.          case TIOCMSET:
  2104. +            error = verify_area(VERIFY_READ, (void *) arg,sizeof(long));
  2105. +            if(error)
  2106. +                return error;
  2107.              mstat = get_fs_long((unsigned long *) arg);
  2108.  
  2109.              mflag = 0;
  2110. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/Config.in linux/drivers/isdn/Config.in
  2111. --- pre2.0.5/linux/drivers/isdn/Config.in    Fri May 17 15:32:14 1996
  2112. +++ linux/drivers/isdn/Config.in    Sun May 19 15:29:29 1996
  2113. @@ -8,6 +8,7 @@
  2114.      bool 'Support generic MP (RFC 1717)' CONFIG_ISDN_MPP
  2115.    fi
  2116.  fi
  2117. -dep_tristate 'ICN B1 and B2 support' CONFIG_ISDN_DRV_ICN $CONFIG_ISDN
  2118. +bool 'Support audio via ISDN' CONFIG_ISDN_AUDIO
  2119. +dep_tristate 'ICN 2B and 4B support' CONFIG_ISDN_DRV_ICN $CONFIG_ISDN
  2120.  dep_tristate 'PCBIT-D support' CONFIG_ISDN_DRV_PCBIT $CONFIG_ISDN
  2121.  dep_tristate 'Teles/NICCY1016PC/Creatix support' CONFIG_ISDN_DRV_TELES $CONFIG_ISDN
  2122. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/Makefile linux/drivers/isdn/Makefile
  2123. --- pre2.0.5/linux/drivers/isdn/Makefile    Sun Apr 21 19:22:06 1996
  2124. +++ linux/drivers/isdn/Makefile    Sun May 19 15:29:29 1996
  2125. @@ -18,6 +18,9 @@
  2126.    ifdef CONFIG_ISDN_PPP
  2127.      L_OBJS += isdn_ppp.o
  2128.    endif
  2129. +  ifdef CONFIG_ISDN_AUDIO
  2130. +    L_OBJS += isdn_audio.o
  2131. +  endif
  2132.  else
  2133.    ifeq ($(CONFIG_ISDN),m)
  2134.      M_OBJS += isdn.o
  2135. @@ -26,6 +29,9 @@
  2136.      OX_OBJS += isdn_common.o
  2137.      ifdef CONFIG_ISDN_PPP
  2138.        O_OBJS += isdn_ppp.o
  2139. +    endif
  2140. +    ifdef CONFIG_ISDN_AUDIO
  2141. +      O_OBJS += isdn_audio.o
  2142.      endif
  2143.    endif
  2144.  endif
  2145. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/icn/icn.c linux/drivers/isdn/icn/icn.c
  2146. --- pre2.0.5/linux/drivers/isdn/icn/icn.c    Sun Apr 21 19:22:06 1996
  2147. +++ linux/drivers/isdn/icn/icn.c    Sun May 19 15:29:29 1996
  2148. @@ -1,4 +1,4 @@
  2149. -/* $Id icn.c,v 1.15 1996/01/10 20:57:39 fritz Exp fritz $
  2150. +/* $Id: icn.c,v 1.22 1996/05/17 15:46:41 fritz Exp $
  2151.   *
  2152.   * ISDN low-level module for the ICN active ISDN-Card.
  2153.   *
  2154. @@ -19,6 +19,22 @@
  2155.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  2156.   *
  2157.   * $Log: icn.c,v $
  2158. + * Revision 1.22  1996/05/17 15:46:41  fritz
  2159. + * Removed own queue management.
  2160. + * Changed queue management to use sk_buffs.
  2161. + *
  2162. + * Revision 1.21  1996/05/02 04:01:20  fritz
  2163. + * Bugfix:
  2164. + *  - icn_addcard() evalueated wrong driverId.
  2165. + *
  2166. + * Revision 1.20  1996/05/02 00:40:27  fritz
  2167. + * Major rewrite to support more than one card
  2168. + * with a single module.
  2169. + * Support for new firmware.
  2170. + *
  2171. + * Revision 1.19  1996/04/21 17:43:32  fritz
  2172. + * Changes for Support of new Firmware BRV3.02
  2173. + *
  2174.   * Revision 1.18  1996/04/20 16:50:26  fritz
  2175.   * Fixed status-buffer overrun.
  2176.   * Misc. typos
  2177. @@ -86,8 +102,6 @@
  2178.  
  2179.  #include "icn.h"
  2180.  
  2181. -
  2182. -
  2183.  /*
  2184.   * Verbose bootcode- and protocol-downloading.
  2185.   */
  2186. @@ -98,58 +112,29 @@
  2187.   */
  2188.  #undef MAP_DEBUG
  2189.  
  2190. -/* If defined, no bootcode- and protocol-downloading is supported and
  2191. - * you must use an external loader
  2192. - */
  2193. -#undef LOADEXTERN
  2194. -
  2195.  static char
  2196. -*revision = "$Revision: 1.18 $";
  2197. +*revision = "$Revision: 1.22 $";
  2198.  
  2199. -static void icn_pollcard(unsigned long dummy);
  2200. +static int icn_addcard(int, char *, char *);
  2201.  
  2202. -/* Try to allocate a new buffer, link it into queue. */
  2203. -static u_char *
  2204. - icn_new_buf(pqueue ** queue, int length)
  2205. -{
  2206. -    pqueue *p;
  2207. -    pqueue *q;
  2208. -
  2209. -    if ((p = *queue)) {
  2210. -        while (p) {
  2211. -            q = p;
  2212. -            p = (pqueue *) p->next;
  2213. -        }
  2214. -        p = (pqueue *) kmalloc(sizeof(pqueue) + length, GFP_ATOMIC);
  2215. -        q->next = (u_char *) p;
  2216. -    } else
  2217. -        p = *queue = (pqueue *) kmalloc(sizeof(pqueue) + length, GFP_ATOMIC);
  2218. -    if (p) {
  2219. -        p->size = sizeof(pqueue) + length;
  2220. -        p->length = length;
  2221. -        p->next = NULL;
  2222. -        p->rptr = p->buffer;
  2223. -        return p->buffer;
  2224. -    } else {
  2225. -        return (u_char *) NULL;
  2226. -    }
  2227. -}
  2228. -
  2229. -#ifdef MODULE
  2230. -static void icn_free_queue(pqueue ** queue)
  2231. +/*
  2232. + * Free queue completely.
  2233. + * Parameter:
  2234. + *   queue = pointer to queue-head
  2235. + */
  2236. +static void icn_free_queue(struct sk_buff_head *queue)
  2237.  {
  2238. -    pqueue *p;
  2239. -    pqueue *q;
  2240. -
  2241. -    p = *queue;
  2242. -    while (p) {
  2243. -        q = p;
  2244. -        p = (pqueue *) p->next;
  2245. -        kfree_s(q, q->size);
  2246. -    }
  2247. -    *queue = (pqueue *) 0;
  2248. +        struct sk_buff *skb;
  2249. +        unsigned long flags;
  2250. +        
  2251. +        save_flags(flags);
  2252. +        cli();
  2253. +        while ((skb = skb_dequeue(queue))) {
  2254. +                skb->free = 1;
  2255. +                kfree_skb(skb, FREE_WRITE);
  2256. +        }
  2257. +        restore_flags(flags);
  2258.  }
  2259. -#endif
  2260.  
  2261.  /* Put a value into a shift-register, highest bit first.
  2262.   * Parameters:
  2263. @@ -159,241 +144,257 @@
  2264.   *            bitcount = Number of bits to output
  2265.   */
  2266.  static inline void icn_shiftout(unsigned short port,
  2267. -             unsigned long val,
  2268. -             int firstbit,
  2269. -             int bitcount)
  2270. +                     unsigned long val,
  2271. +                     int firstbit,
  2272. +                     int bitcount)
  2273.  {
  2274.  
  2275. -    register u_char s;
  2276. -    register u_char c;
  2277. +        register u_char s;
  2278. +        register u_char c;
  2279.  
  2280. -    for (s = firstbit, c = bitcount; c > 0; s--, c--)
  2281. -        OUTB_P((u_char) ((val >> s) & 1) ? 0xff : 0, port);
  2282. +        for (s = firstbit, c = bitcount; c > 0; s--, c--)
  2283. +                OUTB_P((u_char) ((val >> s) & 1) ? 0xff : 0, port);
  2284.  }
  2285.  
  2286.  /*
  2287. - * Map Cannel0 (Bank0/Bank8) or Channel1 (Bank4/Bank12)
  2288. + * disable a cards shared memory
  2289.   */
  2290. -static inline void icn_map_channel(int channel)
  2291. +static inline void icn_disable_ram(icn_card *card)
  2292.  {
  2293. -    static u_char chan2bank[] =
  2294. -    {0, 4, 8, 12};
  2295. +        OUTB_P(0, ICN_MAPRAM);
  2296. +}
  2297.  
  2298. +/*
  2299. + * enable a cards shared memory
  2300. + */
  2301. +static inline void icn_enable_ram(icn_card *card)
  2302. +{
  2303. +        OUTB_P(0xff, ICN_MAPRAM);
  2304. +}
  2305. +
  2306. +/*
  2307. + * Map a cards channel0 (Bank0/Bank8) or channel1 (Bank4/Bank12)
  2308. + */
  2309. +static inline void icn_map_channel(icn_card *card, int channel)
  2310. +{
  2311.  #ifdef MAP_DEBUG
  2312. -    printk(KERN_DEBUG "icn_map_channel %d %d\n", dev->channel, channel);
  2313. +        printk(KERN_DEBUG "icn_map_channel %d %d\n", dev->channel, channel);
  2314.  #endif
  2315. -    if (channel == dev->channel)
  2316. -        return;
  2317. -    OUTB_P(0, ICN_MAPRAM);    /* Disable RAM          */
  2318. -    icn_shiftout(ICN_BANK, chan2bank[channel], 3, 4);    /* Select Bank          */
  2319. -    OUTB_P(0xff, ICN_MAPRAM);    /* Enable RAM           */
  2320. -    dev->channel = channel;
  2321. +        if ((channel == dev.channel) && (card == dev.mcard))
  2322. +                return;
  2323. +        if (dev.mcard)
  2324. +                icn_disable_ram(dev.mcard);
  2325. +        icn_shiftout(ICN_BANK, chan2bank[channel], 3, 4);        /* Select Bank          */
  2326. +        icn_enable_ram(card);
  2327. +        dev.mcard = card;
  2328. +        dev.channel = channel;
  2329.  #ifdef MAP_DEBUG
  2330. -    printk(KERN_DEBUG "icn_map_channel done\n");
  2331. +        printk(KERN_DEBUG "icn_map_channel done\n");
  2332.  #endif
  2333.  }
  2334.  
  2335. -static inline int icn_lock_channel(int channel)
  2336. +/*
  2337. + * Lock a cards channel.
  2338. + * Return 0 if requested card/channel is unmapped (failure).
  2339. + * Return 1 on success.
  2340. + */
  2341. +static inline int icn_lock_channel(icn_card *card, int channel)
  2342.  {
  2343. -    register int retval;
  2344. -    ulong flags;
  2345. +        register int retval;
  2346. +        ulong flags;
  2347.  
  2348.  #ifdef MAP_DEBUG
  2349. -    printk(KERN_DEBUG "icn_lock_channel %d\n", channel);
  2350. +        printk(KERN_DEBUG "icn_lock_channel %d\n", channel);
  2351.  #endif
  2352. -    save_flags(flags);
  2353. -    cli();
  2354. -    if (dev->channel == channel) {
  2355. -        dev->chanlock++;
  2356. -        retval = 1;
  2357. +        save_flags(flags);
  2358. +        cli();
  2359. +        if ((dev.channel == channel) && (card == dev.mcard)) {
  2360. +                dev.chanlock++;
  2361. +                retval = 1;
  2362.  #ifdef MAP_DEBUG
  2363. -        printk(KERN_DEBUG "icn_lock_channel %d OK\n", channel);
  2364. +                printk(KERN_DEBUG "icn_lock_channel %d OK\n", channel);
  2365.  #endif
  2366. -    } else {
  2367. -        retval = 0;
  2368. +        } else {
  2369. +                retval = 0;
  2370.  #ifdef MAP_DEBUG
  2371. -        printk(KERN_DEBUG "icn_lock_channel %d FAILED, dc=%d\n", channel, dev->channel);
  2372. +                printk(KERN_DEBUG "icn_lock_channel %d FAILED, dc=%d\n", channel, device->channel);
  2373.  #endif
  2374. -    }
  2375. -    restore_flags(flags);
  2376. -    return retval;
  2377. +        }
  2378. +        restore_flags(flags);
  2379. +        return retval;
  2380.  }
  2381.  
  2382. +/*
  2383. + * Release current card/channel lock
  2384. + */
  2385.  static inline void icn_release_channel(void)
  2386.  {
  2387. -    ulong flags;
  2388. +        ulong flags;
  2389.  
  2390.  #ifdef MAP_DEBUG
  2391. -    printk(KERN_DEBUG "icn_release_channel l=%d\n", dev->chanlock);
  2392. +        printk(KERN_DEBUG "icn_release_channel l=%d\n", device->chanlock);
  2393.  #endif
  2394. -    save_flags(flags);
  2395. -    cli();
  2396. -    if (dev->chanlock)
  2397. -        dev->chanlock--;
  2398. -    restore_flags(flags);
  2399. +        save_flags(flags);
  2400. +        cli();
  2401. +        if (dev.chanlock)
  2402. +                dev.chanlock--;
  2403. +        restore_flags(flags);
  2404.  }
  2405.  
  2406. -static inline int icn_trymaplock_channel(int channel)
  2407. +/*
  2408. + * Try to map and lock a cards channel.
  2409. + * Return 1 on success, 0 on failure.
  2410. + */
  2411. +static inline int icn_trymaplock_channel(icn_card *card, int channel)
  2412.  {
  2413. -    ulong flags;
  2414. +        ulong flags;
  2415.  
  2416. -    save_flags(flags);
  2417. -    cli();
  2418. +        save_flags(flags);
  2419. +        cli();
  2420.  #ifdef MAP_DEBUG
  2421. -    printk(KERN_DEBUG "trymaplock c=%d dc=%d l=%d\n", channel, dev->channel,
  2422. -           dev->chanlock);
  2423. +        printk(KERN_DEBUG "trymaplock c=%d dc=%d l=%d\n", channel, dev.channel,
  2424. +               dev.chanlock);
  2425.  #endif
  2426. -    if ((!dev->chanlock) || (dev->channel == channel)) {
  2427. -        dev->chanlock++;
  2428. -        icn_map_channel(channel);
  2429. -        restore_flags(flags);
  2430. +        if ((!dev.chanlock) ||
  2431. +            ((dev.channel == channel) && (dev.mcard == card))) {
  2432. +                dev.chanlock++;
  2433. +                icn_map_channel(card,channel);
  2434. +                restore_flags(flags);
  2435.  #ifdef MAP_DEBUG
  2436. -        printk(KERN_DEBUG "trymaplock %d OK\n", channel);
  2437. +                printk(KERN_DEBUG "trymaplock %d OK\n", channel);
  2438.  #endif
  2439. -        return 1;
  2440. -    }
  2441. -    restore_flags(flags);
  2442. +                return 1;
  2443. +        }
  2444. +        restore_flags(flags);
  2445.  #ifdef MAP_DEBUG
  2446. -    printk(KERN_DEBUG "trymaplock %d FAILED\n", channel);
  2447. +        printk(KERN_DEBUG "trymaplock %d FAILED\n", channel);
  2448.  #endif
  2449. -    return 0;
  2450. +        return 0;
  2451.  }
  2452.  
  2453. -static inline void icn_maprelease_channel(int channel)
  2454. +/*
  2455. + * Release currend card/channel lock,
  2456. + * then map same or other channel without locking.
  2457. + */
  2458. +static inline void icn_maprelease_channel(icn_card *card, int channel)
  2459.  {
  2460. -    ulong flags;
  2461. +        ulong flags;
  2462.  
  2463. -    save_flags(flags);
  2464. -    cli();
  2465. +        save_flags(flags);
  2466. +        cli();
  2467.  #ifdef MAP_DEBUG
  2468. -    printk(KERN_DEBUG "map_release c=%d l=%d\n", channel, dev->chanlock);
  2469. +        printk(KERN_DEBUG "map_release c=%d l=%d\n", channel, dev.chanlock);
  2470.  #endif
  2471. -    if (dev->chanlock)
  2472. -        dev->chanlock--;
  2473. -    if (!dev->chanlock)
  2474. -        icn_map_channel(channel);
  2475. -    restore_flags(flags);
  2476. +        if (dev.chanlock)
  2477. +                dev.chanlock--;
  2478. +        if (!dev.chanlock)
  2479. +                icn_map_channel(card,channel);
  2480. +        restore_flags(flags);
  2481.  }
  2482.  
  2483.  /* Get Data from the B-Channel, assemble fragmented packets and put them
  2484.   * into receive-queue. Wake up any B-Channel-reading processes.
  2485. - * This routine is called via timer-callback from pollbchan().
  2486. - * It schedules itself while any B-Channel is open.
  2487. + * This routine is called via timer-callback from icn_pollbchan().
  2488.   */
  2489.  
  2490. -#ifdef DEBUG_RCVCALLBACK
  2491. -static int max_pending[2] =
  2492. -{0, 0};
  2493. -#endif
  2494. -
  2495. -static void icn_pollbchan_receive(int channel, icn_dev * dev)
  2496. -{
  2497. -    int mch = channel + ((dev->secondhalf) ? 2 : 0);
  2498. -    int eflag;
  2499. -    int cnt;
  2500. -    int flags;
  2501. -#ifdef DEBUG_RCVCALLBACK
  2502. -    int rcv_pending1;
  2503. -    int rcv_pending2;
  2504. -    int akt_pending;
  2505. -#endif
  2506. -
  2507. -    if (icn_trymaplock_channel(mch)) {
  2508. -        while (rbavl) {
  2509. -            cnt = rbuf_l;
  2510. -            if ((dev->rcvidx[channel] + cnt) > 4000) {
  2511. -                printk(KERN_WARNING "icn: bogus packet on ch%d, dropping.\n",
  2512. -                       channel + 1);
  2513. -                dev->rcvidx[channel] = 0;
  2514. -                eflag = 0;
  2515. -            } else {
  2516. -                memcpy(&dev->rcvbuf[channel][dev->rcvidx[channel]], rbuf_d, cnt);
  2517. -                dev->rcvidx[channel] += cnt;
  2518. -                eflag = rbuf_f;
  2519. -            }
  2520. -            rbnext;
  2521. -            icn_maprelease_channel(mch & 2);
  2522. -            if (!eflag) {
  2523. -                save_flags(flags);
  2524. -                cli();
  2525. -#ifdef DEBUG_RCVCALLBACK
  2526. -                rcv_pending1 =
  2527. -                    (dev->shmem->data_control.ecnr > dev->shmem->data_control.ecns) ?
  2528. -                    0xf - dev->shmem->data_control.ecnr + dev->shmem->data_control.ecns :
  2529. -                    dev->shmem->data_control.ecns - dev->shmem->data_control.ecnr;
  2530. -#endif
  2531. -                dev->interface.rcvcallb(dev->myid, channel, dev->rcvbuf[channel],
  2532. -                           dev->rcvidx[channel]);
  2533. -                dev->rcvidx[channel] = 0;
  2534. -#ifdef DEBUG_RCVCALLBACK
  2535. -                rcv_pending2 =
  2536. -                    (dev->shmem->data_control.ecnr > dev->shmem->data_control.ecns) ?
  2537. -                    0xf - dev->shmem->data_control.ecnr + dev->shmem->data_control.ecns :
  2538. -                    dev->shmem->data_control.ecns - dev->shmem->data_control.ecnr;
  2539. -                akt_pending = rcv_pending2 - rcv_pending1;
  2540. -                if (akt_pending > max_pending[channel]) {
  2541. -                    max_pending[channel] = akt_pending;
  2542. -                    printk(KERN_DEBUG "ICN_DEBUG: pend: %d %d\n", max_pending[0], max_pending[1]);
  2543. -                }
  2544. -#endif
  2545. -                restore_flags(flags);
  2546. -            }
  2547. -            if (!icn_trymaplock_channel(mch))
  2548. -                break;
  2549. -        }
  2550. -        icn_maprelease_channel(mch & 2);
  2551. -    }
  2552. +static void icn_pollbchan_receive(int channel, icn_card *card)
  2553. +{
  2554. +        int mch = channel + ((card->secondhalf) ? 2 : 0);
  2555. +        int eflag;
  2556. +        int cnt;
  2557. +    struct sk_buff *skb;
  2558. +
  2559. +        if (icn_trymaplock_channel(card,mch)) {
  2560. +                while (rbavl) {
  2561. +                        cnt = rbuf_l;
  2562. +                        if ((card->rcvidx[channel] + cnt) > 4000) {
  2563. +                                printk(KERN_WARNING 
  2564. +                                       "icn: (%s) bogus packet on ch%d, dropping.\n",
  2565. +                                       CID,
  2566. +                                       channel + 1);
  2567. +                                card->rcvidx[channel] = 0;
  2568. +                                eflag = 0;
  2569. +                        } else {
  2570. +                                memcpy(&card->rcvbuf[channel][card->rcvidx[channel]], rbuf_d, cnt);
  2571. +                                card->rcvidx[channel] += cnt;
  2572. +                                eflag = rbuf_f;
  2573. +                        }
  2574. +                        rbnext;
  2575. +                        icn_maprelease_channel(card, mch & 2);
  2576. +                        if (!eflag) {
  2577. +                                if ((cnt = card->rcvidx[channel])) {
  2578. +                                        if (!(skb = dev_alloc_skb(cnt))) {
  2579. +                                                printk(KERN_WARNING "∩cn: receive out of memory\n");
  2580. +                                                break;
  2581. +                                        }
  2582. +                                        memcpy(skb_put(skb, cnt), card->rcvbuf[channel], cnt); 
  2583. +                                        card->rcvidx[channel] = 0;
  2584. +                                        card->interface.rcvcallb_skb(card->myid, channel, skb);
  2585. +                                }
  2586. +                        }
  2587. +                        if (!icn_trymaplock_channel(card, mch))
  2588. +                                break;
  2589. +                }
  2590. +                icn_maprelease_channel(card, mch & 2);
  2591. +        }
  2592.  }
  2593.  
  2594.  /* Send data-packet to B-Channel, split it up into fragments of
  2595.   * ICN_FRAGSIZE length. If last fragment is sent out, signal
  2596.   * success to upper layers via statcallb with ISDN_STAT_BSENT argument.
  2597. - * This routine is called via timer-callback from pollbchan() or
  2598. - * directly from sendbuf().
  2599. + * This routine is called via timer-callback from icn_pollbchan() or
  2600. + * directly from icn_sendbuf().
  2601.   */
  2602.  
  2603. -static void icn_pollbchan_send(int channel, icn_dev * dev)
  2604. +static void icn_pollbchan_send(int channel, icn_card *card)
  2605.  {
  2606. -    int mch = channel + ((dev->secondhalf) ? 2 : 0);
  2607. -    int eflag = 0;
  2608. -    int cnt;
  2609. -    int left;
  2610. -    int flags;
  2611. -    pqueue *p;
  2612. -    isdn_ctrl cmd;
  2613. -
  2614. -    if (!dev->sndcount[channel])
  2615. -        return;
  2616. -    if (icn_trymaplock_channel(mch)) {
  2617. -        while (sbfree && dev->sndcount[channel]) {
  2618. -            left = dev->spqueue[channel]->length;
  2619. -            cnt =
  2620. -                (sbuf_l =
  2621. -                 (left > ICN_FRAGSIZE) ? ((sbuf_f = 0xff), ICN_FRAGSIZE) : ((sbuf_f = 0), left));
  2622. -            memcpy(sbuf_d, dev->spqueue[channel]->rptr, cnt);
  2623. -            sbnext;    /* switch to next buffer        */
  2624. -            icn_maprelease_channel(mch & 2);
  2625. -            dev->spqueue[channel]->rptr += cnt;
  2626. -            eflag = ((dev->spqueue[channel]->length -= cnt) == 0);
  2627. -            save_flags(flags);
  2628. -            cli();
  2629. -            p = dev->spqueue[channel];
  2630. -            dev->sndcount[channel] -= cnt;
  2631. -            if (eflag)
  2632. -                dev->spqueue[channel] = (pqueue *) dev->spqueue[channel]->next;
  2633. -            restore_flags(flags);
  2634. -            if (eflag) {
  2635. -                kfree_s(p, p->size);
  2636. -                cmd.command = ISDN_STAT_BSENT;
  2637. -                cmd.driver = dev->myid;
  2638. -                cmd.arg = channel;
  2639. -                dev->interface.statcallb(&cmd);
  2640. -            }
  2641. -            if (!icn_trymaplock_channel(mch))
  2642. -                break;
  2643. -        }
  2644. -        icn_maprelease_channel(mch & 2);
  2645. -    }
  2646. +        int mch = channel + ((card->secondhalf) ? 2 : 0);
  2647. +        int cnt;
  2648. +    unsigned long flags;
  2649. +        struct sk_buff *skb;
  2650. +        isdn_ctrl cmd;
  2651. +
  2652. +        if (!card->sndcount[channel])
  2653. +                return;
  2654. +        if (icn_trymaplock_channel(card,mch)) {
  2655. +                while (sbfree && card->sndcount[channel]) {
  2656. +                        save_flags(flags);
  2657. +                        cli();
  2658. +                        skb = skb_peek(&card->spqueue[channel]);
  2659. +                        if (!skb) {
  2660. +                                restore_flags(flags);
  2661. +                                break;
  2662. +                        }
  2663. +                        if (skb->lock) {
  2664. +                                restore_flags(flags);
  2665. +                                break;
  2666. +                        }
  2667. +                        skb->lock = 1;
  2668. +                        restore_flags(flags);
  2669. +                        cnt =
  2670. +                            (sbuf_l =
  2671. +                             (skb->len > ICN_FRAGSIZE) ? ((sbuf_f = 0xff), ICN_FRAGSIZE) : ((sbuf_f = 0), skb->len));
  2672. +                        memcpy(sbuf_d, skb->data, cnt);
  2673. +                        skb_pull(skb, cnt);
  2674. +                        card->sndcount[channel] -= cnt;
  2675. +                        sbnext;        /* switch to next buffer        */
  2676. +                        icn_maprelease_channel(card, mch & 2);
  2677. +                        if (!skb->len) {
  2678. +                                skb = skb_dequeue(&card->spqueue[channel]);
  2679. +                                skb->free = 1;
  2680. +                                skb->lock = 0;
  2681. +                                kfree_skb(skb, FREE_WRITE);
  2682. +                                cmd.command = ISDN_STAT_BSENT;
  2683. +                                cmd.driver = card->myid;
  2684. +                                cmd.arg = channel;
  2685. +                                card->interface.statcallb(&cmd);
  2686. +                        } else
  2687. +                                skb->lock = 0;
  2688. +                        if (!icn_trymaplock_channel(card, mch))
  2689. +                                break;
  2690. +                }
  2691. +                icn_maprelease_channel(card, mch & 2);
  2692. +        }
  2693.  }
  2694.  
  2695.  /* Send/Receive Data to/from the B-Channel.
  2696. @@ -401,253 +402,56 @@
  2697.   * It schedules itself while any B-Channel is open.
  2698.   */
  2699.  
  2700. -static void icn_pollbchan(unsigned long dummy)
  2701. +static void icn_pollbchan(unsigned long data)
  2702.  {
  2703. -    unsigned long flags;
  2704. +        icn_card *card = (icn_card *)data;
  2705. +        unsigned long flags;
  2706.  
  2707. -    dev->flags |= ICN_FLAGS_RBTIMER;
  2708. -    if (dev->flags & ICN_FLAGS_B1ACTIVE) {
  2709. -        icn_pollbchan_receive(0, dev);
  2710. -        icn_pollbchan_send(0, dev);
  2711. -    }
  2712. -    if (dev->flags & ICN_FLAGS_B2ACTIVE) {
  2713. -        icn_pollbchan_receive(1, dev);
  2714. -        icn_pollbchan_send(1, dev);
  2715. -    }
  2716. -    if (dev->doubleS0) {
  2717. -        if (dev2->flags & ICN_FLAGS_B1ACTIVE) {
  2718. -            icn_pollbchan_receive(0, dev2);
  2719. -            icn_pollbchan_send(0, dev2);
  2720. -        }
  2721. -        if (dev2->flags & ICN_FLAGS_B2ACTIVE) {
  2722. -            icn_pollbchan_receive(1, dev2);
  2723. -            icn_pollbchan_send(1, dev2);
  2724. -        }
  2725. -    }
  2726. -    if (dev->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE)) {
  2727. -        /* schedule b-channel polling again */
  2728. -        save_flags(flags);
  2729. -        cli();
  2730. -        del_timer(&dev->rb_timer);
  2731. -        dev->rb_timer.function = icn_pollbchan;
  2732. -        dev->rb_timer.expires = jiffies + ICN_TIMER_BCREAD;
  2733. -        add_timer(&dev->rb_timer);
  2734. -        restore_flags(flags);
  2735. -    } else
  2736. -        dev->flags &= ~ICN_FLAGS_RBTIMER;
  2737. -    if (dev->doubleS0) {
  2738. -        if (dev2->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE)) {
  2739. -            /* schedule b-channel polling again */
  2740. -            save_flags(flags);
  2741. -            cli();
  2742. -            del_timer(&dev2->rb_timer);
  2743. -            dev2->rb_timer.function = icn_pollbchan;
  2744. -            dev2->rb_timer.expires = jiffies + ICN_TIMER_BCREAD;
  2745. -            add_timer(&dev2->rb_timer);
  2746. -            restore_flags(flags);
  2747. -        } else
  2748. -            dev2->flags &= ~ICN_FLAGS_RBTIMER;
  2749. -    }
  2750. -}
  2751. -
  2752. -static void icn_pollit(icn_dev * dev)
  2753. -{
  2754. -    int mch = dev->secondhalf ? 2 : 0;
  2755. -    int avail = 0;
  2756. -    int dflag = 0;
  2757. -    int left;
  2758. -    u_char c;
  2759. -    int ch;
  2760. -    int flags;
  2761. -    int i;
  2762. -    u_char *p;
  2763. -    isdn_ctrl cmd;
  2764. -
  2765. -    if (icn_trymaplock_channel(mch)) {
  2766. -        avail = msg_avail;
  2767. -        for (left = avail, i = msg_o; left > 0; i++, left--) {
  2768. -            c = dev->shmem->comm_buffers.iopc_buf[i & 0xff];
  2769. -            save_flags(flags);
  2770. -            cli();
  2771. -            *dev->msg_buf_write++ = (c == 0xff) ? '\n' : c;
  2772. -                        if (dev->msg_buf_write == dev->msg_buf_read) {
  2773. -                                if (++dev->msg_buf_read > dev->msg_buf_end)
  2774. -                                        dev->msg_buf_read = dev->msg_buf;
  2775. -                        }
  2776. -            if (dev->msg_buf_write > dev->msg_buf_end)
  2777. -                dev->msg_buf_write = dev->msg_buf;
  2778. -            restore_flags(flags);
  2779. -            if (c == 0xff) {
  2780. -                dev->imsg[dev->iptr] = 0;
  2781. -                dev->iptr = 0;
  2782. -                if (dev->imsg[0] == '0' && dev->imsg[1] >= '0' &&
  2783. -                    dev->imsg[1] <= '2' && dev->imsg[2] == ';') {
  2784. -                    ch = dev->imsg[1] - '0';
  2785. -                    p = &dev->imsg[3];
  2786. -                    if (!strncmp(p, "BCON_", 5)) {
  2787. -                        switch (ch) {
  2788. -                        case 1:
  2789. -                            dev->flags |= ICN_FLAGS_B1ACTIVE;
  2790. -                            break;
  2791. -                        case 2:
  2792. -                            dev->flags |= ICN_FLAGS_B2ACTIVE;
  2793. -                            break;
  2794. -                        }
  2795. -                        cmd.command = ISDN_STAT_BCONN;
  2796. -                        cmd.driver = dev->myid;
  2797. -                        cmd.arg = ch - 1;
  2798. -                        dev->interface.statcallb(&cmd);
  2799. -                        continue;
  2800. -                    }
  2801. -                    if (!strncmp(p, "TEI OK", 6)) {
  2802. -                        cmd.command = ISDN_STAT_RUN;
  2803. -                        cmd.driver = dev->myid;
  2804. -                        cmd.arg = ch - 1;
  2805. -                        dev->interface.statcallb(&cmd);
  2806. -                        continue;
  2807. -                    }
  2808. -                    if (!strncmp(p, "BDIS_", 5)) {
  2809. -                        switch (ch) {
  2810. -                        case 1:
  2811. -                            dev->flags &= ~ICN_FLAGS_B1ACTIVE;
  2812. -                            dflag |= 1;
  2813. -                            break;
  2814. -                        case 2:
  2815. -                            dev->flags &= ~ICN_FLAGS_B2ACTIVE;
  2816. -                            dflag |= 2;
  2817. -                            break;
  2818. -                        }
  2819. -                        cmd.command = ISDN_STAT_BHUP;
  2820. -                        cmd.arg = ch - 1;
  2821. -                        cmd.driver = dev->myid;
  2822. -                        dev->interface.statcallb(&cmd);
  2823. -                        continue;
  2824. -                    }
  2825. -                    if (!strncmp(p, "DCON_", 5)) {
  2826. -                        cmd.command = ISDN_STAT_DCONN;
  2827. -                        cmd.arg = ch - 1;
  2828. -                        cmd.driver = dev->myid;
  2829. -                        dev->interface.statcallb(&cmd);
  2830. -                        continue;
  2831. -                    }
  2832. -                    if (!strncmp(p, "DDIS_", 5)) {
  2833. -                        cmd.command = ISDN_STAT_DHUP;
  2834. -                        cmd.arg = ch - 1;
  2835. -                        cmd.driver = dev->myid;
  2836. -                        dev->interface.statcallb(&cmd);
  2837. -                        continue;
  2838. -                    }
  2839. -                    if (!strncmp(p, "E_L1: ACT FAIL", 14)) {
  2840. -                        cmd.command = ISDN_STAT_BHUP;
  2841. -                        cmd.arg = 0;
  2842. -                        cmd.driver = dev->myid;
  2843. -                        dev->interface.statcallb(&cmd);
  2844. -                        cmd.command = ISDN_STAT_DHUP;
  2845. -                        cmd.arg = 0;
  2846. -                        cmd.driver = dev->myid;
  2847. -                        dev->interface.statcallb(&cmd);
  2848. -                        continue;
  2849. -                    }
  2850. -                    if (!strncmp(p, "CIF", 3)) {
  2851. -                        cmd.command = ISDN_STAT_CINF;
  2852. -                        cmd.arg = ch - 1;
  2853. -                        strncpy(cmd.num, p + 3, sizeof(cmd.num) - 1);
  2854. -                        cmd.driver = dev->myid;
  2855. -                        dev->interface.statcallb(&cmd);
  2856. -                        continue;
  2857. -                    }
  2858. -                    if (!strncmp(p, "CAU", 3)) {
  2859. -                        cmd.command = ISDN_STAT_CAUSE;
  2860. -                        cmd.arg = ch - 1;
  2861. -                        strncpy(cmd.num, p + 3, sizeof(cmd.num) - 1);
  2862. -                        cmd.driver = dev->myid;
  2863. -                        dev->interface.statcallb(&cmd);
  2864. -                        continue;
  2865. -                    }
  2866. -                    if (!strncmp(p, "DCAL_I", 6)) {
  2867. -                        cmd.command = ISDN_STAT_ICALL;
  2868. -                        cmd.driver = dev->myid;
  2869. -                        cmd.arg = ch - 1;
  2870. -                        strncpy(cmd.num, p + 6, sizeof(cmd.num) - 1);
  2871. -                        dev->interface.statcallb(&cmd);
  2872. -                        continue;
  2873. -                    }
  2874. -                    if (!strncmp(p, "FCALL", 5)) {
  2875. -                        cmd.command = ISDN_STAT_ICALL;
  2876. -                        cmd.driver = dev->myid;
  2877. -                        cmd.arg = ch - 1;
  2878. -                        strcpy(cmd.num, "LEASED,07,00,1");
  2879. -                        dev->interface.statcallb(&cmd);
  2880. -                        continue;
  2881. -                    }
  2882. -                    if (!strncmp(p, "DSCA_I", 6)) {
  2883. -                        cmd.command = ISDN_STAT_ICALL;
  2884. -                        cmd.driver = dev->myid;
  2885. -                        cmd.arg = ch - 1;
  2886. -                        strncpy(cmd.num, p + 6, sizeof(cmd.num) - 1);
  2887. -                        dev->interface.statcallb(&cmd);
  2888. -                        continue;
  2889. -                    }
  2890. -                    if (!strncmp(p, "NO D-CHAN", 9)) {
  2891. -                        cmd.command = ISDN_STAT_NODCH;
  2892. -                        cmd.driver = dev->myid;
  2893. -                        cmd.arg = ch - 1;
  2894. -                        strncpy(cmd.num, p + 6, sizeof(cmd.num) - 1);
  2895. -                        dev->interface.statcallb(&cmd);
  2896. -                        continue;
  2897. -                    }
  2898. -                } else {
  2899. -                    p = dev->imsg;
  2900. -                    if (!strncmp(p, "DRV1.", 5)) {
  2901. -                                                printk(KERN_INFO "icn: %s\n",p);
  2902. -                        if (!strncmp(p + 7, "TC", 2)) {
  2903. -                            dev->ptype = ISDN_PTYPE_1TR6;
  2904. -                            dev->interface.features |= ISDN_FEATURE_P_1TR6;
  2905. -                            printk(KERN_INFO "icn: 1TR6-Protocol loaded and running\n");
  2906. -                        }
  2907. -                        if (!strncmp(p + 7, "EC", 2)) {
  2908. -                            dev->ptype = ISDN_PTYPE_EURO;
  2909. -                            dev->interface.features |= ISDN_FEATURE_P_EURO;
  2910. -                            printk(KERN_INFO "icn: Euro-Protocol loaded and running\n");
  2911. -                        }
  2912. -                        continue;
  2913. -                    }
  2914. -                }
  2915. -            } else {
  2916. -                dev->imsg[dev->iptr] = c;
  2917. -                if (dev->iptr < 59)
  2918. -                    dev->iptr++;
  2919. -            }
  2920. -        }
  2921. -        msg_o = (msg_o + avail) & 0xff;
  2922. -        icn_release_channel();
  2923. -    }
  2924. -    if (avail) {
  2925. -        cmd.command = ISDN_STAT_STAVAIL;
  2926. -        cmd.driver = dev->myid;
  2927. -        cmd.arg = avail;
  2928. -        dev->interface.statcallb(&cmd);
  2929. -    }
  2930. -    if (dflag & 1)
  2931. -        dev->interface.rcvcallb(dev->myid, 0, dev->rcvbuf[0], 0);
  2932. -    if (dflag & 2)
  2933. -        dev->interface.rcvcallb(dev->myid, 1, dev->rcvbuf[1], 0);
  2934. -    if (dev->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE))
  2935. -        if (!(dev->flags & ICN_FLAGS_RBTIMER)) {
  2936. -            /* schedule b-channel polling */
  2937. -            dev->flags |= ICN_FLAGS_RBTIMER;
  2938. -            save_flags(flags);
  2939. -            cli();
  2940. -            del_timer(&dev->rb_timer);
  2941. -            dev->rb_timer.function = icn_pollbchan;
  2942. -            dev->rb_timer.expires = jiffies + ICN_TIMER_BCREAD;
  2943. -            add_timer(&dev->rb_timer);
  2944. -            restore_flags(flags);
  2945. -        }
  2946. -}
  2947. +                if (card->flags & ICN_FLAGS_B1ACTIVE) {
  2948. +                        icn_pollbchan_receive(0, card);
  2949. +                        icn_pollbchan_send(0, card);
  2950. +                }
  2951. +                if (card->flags & ICN_FLAGS_B2ACTIVE) {
  2952. +                        icn_pollbchan_receive(1, card);
  2953. +                        icn_pollbchan_send(1, card);
  2954. +                }
  2955. +                if (card->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE)) {
  2956. +                        /* schedule b-channel polling again */
  2957. +                        save_flags(flags);
  2958. +                        cli();
  2959. +                        card->rb_timer.expires = jiffies + ICN_TIMER_BCREAD;
  2960. +                        add_timer(&card->rb_timer);
  2961. +                        card->flags |= ICN_FLAGS_RBTIMER;
  2962. +                        restore_flags(flags);
  2963. +                } else
  2964. +                        card->flags &= ~ICN_FLAGS_RBTIMER;
  2965. +}
  2966. +
  2967. +typedef struct icn_stat {
  2968. +        char *statstr;
  2969. +        int  command;
  2970. +        int  action;
  2971. +} icn_stat;
  2972. +
  2973. +static icn_stat icn_stat_table[] = {
  2974. +        {"BCON_",          ISDN_STAT_BCONN, 1}, /* B-Channel connected        */
  2975. +        {"BDIS_",          ISDN_STAT_BHUP,  2}, /* B-Channel disconnected     */
  2976. +        {"DCON_",          ISDN_STAT_DCONN, 0}, /* D-Channel connected        */
  2977. +        {"DDIS_",          ISDN_STAT_DHUP,  0}, /* D-Channel disconnected     */
  2978. +        {"DCAL_I",         ISDN_STAT_ICALL, 3}, /* Incoming call dialup-line  */
  2979. +        {"DSCA_I",         ISDN_STAT_ICALL, 3}, /* Incoming call 1TR6-SPV     */
  2980. +        {"FCALL",          ISDN_STAT_ICALL, 4}, /* Leased line connection up  */
  2981. +        {"CIF",            ISDN_STAT_CINF,  5}, /* Charge-info, 1TR6-type     */
  2982. +        {"AOC",            ISDN_STAT_CINF,  6}, /* Charge-info, DSS1-type     */
  2983. +        {"CAU",            ISDN_STAT_CAUSE, 7}, /* Cause code                 */
  2984. +        {"TEI OK",         ISDN_STAT_RUN,   0}, /* Card connected to wallplug */
  2985. +        {"NO D-CHAN",      ISDN_STAT_NODCH, 0}, /* No D-channel available     */
  2986. +        {"E_L1: ACT FAIL", ISDN_STAT_BHUP,  8}, /* Layer-1 activation failed  */
  2987. +        {NULL,             0             , -1}
  2988. +};
  2989.  
  2990.  /*
  2991. - * Check Statusqueue-Pointer from isdn-card.
  2992. + * Check Statusqueue-Pointer from isdn-cards.
  2993.   * If there are new status-replies from the interface, check
  2994.   * them against B-Channel-connects/disconnects and set flags accordingly.
  2995.   * Wake-Up any processes, who are reading the status-device.
  2996. @@ -656,93 +460,260 @@
  2997.   * This routine is called periodically via timer.
  2998.   */
  2999.  
  3000. -static void icn_pollcard(unsigned long dummy)
  3001. +static int icn_parse_status(u_char *status, int channel, icn_card *card)
  3002.  {
  3003. -    ulong flags;
  3004. -
  3005. -    icn_pollit(dev);
  3006. -    if (dev->doubleS0)
  3007. -        icn_pollit(dev2);
  3008. -    /* schedule again */
  3009. -    save_flags(flags);
  3010. -    cli();
  3011. -    del_timer(&dev->st_timer);
  3012. -    dev->st_timer.function = icn_pollcard;
  3013. -    dev->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
  3014. -    add_timer(&dev->st_timer);
  3015. -    restore_flags(flags);
  3016. +        icn_stat  *s = icn_stat_table;
  3017. +        int       action = -1;
  3018. +        int       dflag  = 0;
  3019. +        unsigned long flags;
  3020. +        isdn_ctrl cmd;
  3021. +
  3022. +        while (s->statstr) {
  3023. +                if (!strncmp(status,s->statstr,strlen(s->statstr))) {
  3024. +                        cmd.command = s->command;
  3025. +                        action = s->action;
  3026. +                        break;
  3027. +                }
  3028. +                s++;
  3029. +        }
  3030. +        if (action==-1)
  3031. +                return 0;
  3032. +        cmd.driver = card->myid;
  3033. +        cmd.arg = channel;
  3034. +        switch (action) {
  3035. +                case 1:
  3036. +                        card->flags |= (channel)?
  3037. +                                ICN_FLAGS_B2ACTIVE:ICN_FLAGS_B1ACTIVE;
  3038. +                        break;
  3039. +                case 2:
  3040. +                        card->flags &= ~((channel)?
  3041. +                                ICN_FLAGS_B2ACTIVE:ICN_FLAGS_B1ACTIVE);
  3042. +                        icn_free_queue(&card->spqueue[channel]);
  3043. +                        save_flags(flags);
  3044. +                        cli();
  3045. +                        card->rcvidx[channel] = 0;
  3046. +                        restore_flags(flags);
  3047. +                        dflag |= (channel+1);
  3048. +                        break;
  3049. +                case 3:
  3050. +                        strncpy(cmd.num, status + 6, sizeof(cmd.num) - 1);
  3051. +                        break;
  3052. +                case 4:
  3053. +                        sprintf(cmd.num,"LEASED%d,07,00,%d",
  3054. +                                 card->myid,channel+1);
  3055. +                        break;
  3056. +                case 5:
  3057. +                        strncpy(cmd.num, status + 3, sizeof(cmd.num) - 1);
  3058. +                        break;
  3059. +                case 6:
  3060. +                        sprintf(cmd.num,"%d",
  3061. +                                (int)simple_strtoul(status + 7,NULL,16));
  3062. +                        break;
  3063. +                case 7:
  3064. +                        status += 3;
  3065. +                        if (strlen(status)==4)
  3066. +                                sprintf(cmd.num,"%s%c%c",
  3067. +                                        status+2,*status,*(status+1));
  3068. +                        else
  3069. +                                strncpy(cmd.num, status+1, sizeof(cmd.num) - 1);
  3070. +                        break;
  3071. +                case 8:
  3072. +                        cmd.arg = 0;
  3073. +                        cmd.driver = card->myid;
  3074. +                        card->interface.statcallb(&cmd);
  3075. +                        cmd.command = ISDN_STAT_DHUP;
  3076. +                        cmd.arg = 0;
  3077. +                        cmd.driver = card->myid;
  3078. +                        card->interface.statcallb(&cmd);
  3079. +                        cmd.command = ISDN_STAT_BHUP;
  3080. +                        cmd.arg = 1;
  3081. +                        cmd.driver = card->myid;
  3082. +                        card->interface.statcallb(&cmd);
  3083. +                        cmd.command = ISDN_STAT_DHUP;
  3084. +                        cmd.arg = 1;
  3085. +                        cmd.driver = card->myid;
  3086. +                        break;
  3087. +        }
  3088. +        card->interface.statcallb(&cmd);
  3089. +        return dflag;
  3090. +}
  3091. +
  3092. +static void icn_polldchan(unsigned long data)
  3093. +{
  3094. +        icn_card *card = (icn_card *)data;
  3095. +        int mch = card->secondhalf ? 2 : 0;
  3096. +        int avail = 0;
  3097. +        int dflag = 0;
  3098. +        int left;
  3099. +        u_char c;
  3100. +        int ch;
  3101. +        int flags;
  3102. +        int i;
  3103. +        u_char *p;
  3104. +        isdn_ctrl cmd;
  3105. +
  3106. +        if (icn_trymaplock_channel(card,mch)) {
  3107. +                avail = msg_avail;
  3108. +                for (left = avail, i = msg_o; left > 0; i++, left--) {
  3109. +                        c = dev.shmem->comm_buffers.iopc_buf[i & 0xff];
  3110. +                        save_flags(flags);
  3111. +                        cli();
  3112. +                        *card->msg_buf_write++ = (c == 0xff) ? '\n' : c;
  3113. +                        if (card->msg_buf_write == card->msg_buf_read) {
  3114. +                                if (++card->msg_buf_read > card->msg_buf_end)
  3115. +                                        card->msg_buf_read = card->msg_buf;
  3116. +                        }
  3117. +                        if (card->msg_buf_write > card->msg_buf_end)
  3118. +                                card->msg_buf_write = card->msg_buf;
  3119. +                        restore_flags(flags);
  3120. +                        if (c == 0xff) {
  3121. +                                card->imsg[card->iptr] = 0;
  3122. +                                card->iptr = 0;
  3123. +                                if (card->imsg[0] == '0' && card->imsg[1] >= '0' &&
  3124. +                                    card->imsg[1] <= '2' && card->imsg[2] == ';') {
  3125. +                                        ch = (card->imsg[1] - '0') - 1;
  3126. +                                        p = &card->imsg[3];
  3127. +                                        dflag |= icn_parse_status(p, ch, card);
  3128. +                                } else {
  3129. +                                        p = card->imsg;
  3130. +                                        if (!strncmp(p, "DRV1.", 5)) {
  3131. +                                                u_char vstr[10];
  3132. +                                                u_char *q = vstr;
  3133. +
  3134. +                                                printk(KERN_INFO "icn: (%s) %s\n",CID,p);
  3135. +                                                if (!strncmp(p + 7, "TC", 2)) {
  3136. +                                                        card->ptype = ISDN_PTYPE_1TR6;
  3137. +                                                        card->interface.features |= ISDN_FEATURE_P_1TR6;
  3138. +                                                        printk(KERN_INFO
  3139. +                                                               "icn: (%s) 1TR6-Protocol loaded and running\n",CID);
  3140. +                                                }
  3141. +                                                if (!strncmp(p + 7, "EC", 2)) {
  3142. +                                                        card->ptype = ISDN_PTYPE_EURO;
  3143. +                                                        card->interface.features |= ISDN_FEATURE_P_EURO;
  3144. +                                                        printk(KERN_INFO
  3145. +                                                               "icn: (%s) Euro-Protocol loaded and running\n",CID);
  3146. +                                                }
  3147. +                                                p = strstr(card->imsg,"BRV") + 3;
  3148. +                                                while (*p) {
  3149. +                                                        if (*p>='0' && *p<='9')
  3150. +                                                                *q++ = *p;
  3151. +                                                        p++;
  3152. +                                                }
  3153. +                                                *q = '\0';
  3154. +                                                strcat(vstr,"000");
  3155. +                                                vstr[3] = '\0';
  3156. +                                                card->fw_rev = (int)simple_strtoul(vstr,NULL,10);
  3157. +                                                continue;
  3158. +                                                
  3159. +                                        }
  3160. +                                }
  3161. +                        } else {
  3162. +                                card->imsg[card->iptr] = c;
  3163. +                                if (card->iptr < 59)
  3164. +                                        card->iptr++;
  3165. +                        }
  3166. +                }
  3167. +                msg_o = (msg_o + avail) & 0xff;
  3168. +                icn_release_channel();
  3169. +        }
  3170. +        if (avail) {
  3171. +                cmd.command = ISDN_STAT_STAVAIL;
  3172. +                cmd.driver = card->myid;
  3173. +                cmd.arg = avail;
  3174. +                card->interface.statcallb(&cmd);
  3175. +        }
  3176. +        if (dflag & 1)
  3177. +                card->interface.rcvcallb(card->myid, 0, card->rcvbuf[0], 0);
  3178. +        if (dflag & 2)
  3179. +                card->interface.rcvcallb(card->myid, 1, card->rcvbuf[1], 0);
  3180. +        if (card->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE))
  3181. +                if (!(card->flags & ICN_FLAGS_RBTIMER)) {
  3182. +                        /* schedule b-channel polling */
  3183. +                        card->flags |= ICN_FLAGS_RBTIMER;
  3184. +                        save_flags(flags);
  3185. +                        cli();
  3186. +                        del_timer(&card->rb_timer);
  3187. +                        card->rb_timer.function = icn_pollbchan;
  3188. +                        card->rb_timer.data = (unsigned long)card;
  3189. +                        card->rb_timer.expires = jiffies + ICN_TIMER_BCREAD;
  3190. +                        add_timer(&card->rb_timer);
  3191. +                        restore_flags(flags);
  3192. +                }
  3193. +        /* schedule again */
  3194. +        save_flags(flags);
  3195. +        cli();
  3196. +        card->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
  3197. +        add_timer(&card->st_timer);
  3198. +        restore_flags(flags);
  3199.  }
  3200.  
  3201. -/* Send a packet to the transmit-buffers, handle fragmentation if necessary.
  3202. +/* Append a packet to the transmit buffer-queue.
  3203.   * Parameters:
  3204. - *            channel = Number of B-channel
  3205. - *            buffer  = pointer to packet
  3206. - *            len     = size of packet (max 4000)
  3207. - *            dev     = pointer to device-struct
  3208. - *            user    = 1 = call from userproc, 0 = call from kernel
  3209. + *   channel = Number of B-channel
  3210. + *   buffer  = pointer to packet
  3211. + *   len     = size of packet (max 4000)
  3212. + *   user    = 1 = call from userproc, 0 = call from kernel
  3213. + *   card    = pointer to card-struct
  3214.   * Return:
  3215. - *        Number of bytes transferred, -E??? on error
  3216. + *   Number of bytes transferred, -E??? on error
  3217.   */
  3218.  
  3219. -static int icn_sendbuf(int channel, const u_char * buffer, int len, int user, icn_dev * dev)
  3220. +static int icn_sendbuf(int channel, struct sk_buff *skb, icn_card * card)
  3221.  {
  3222. -    register u_char *p;
  3223. -    int flags;
  3224. +        int len = skb->len;
  3225. +        unsigned long flags;
  3226.  
  3227. -    if (len > 4000)
  3228. -        return -EINVAL;
  3229. -    if (len) {
  3230. -        if (dev->sndcount[channel] > ICN_MAX_SQUEUE)
  3231. -            return 0;
  3232. -        save_flags(flags);
  3233. -        cli();
  3234. -        p = icn_new_buf(&dev->spqueue[channel], len);
  3235. -        if (!p) {
  3236. -                restore_flags(flags);
  3237. -            return 0;
  3238. -        }
  3239. -        if (user) {
  3240. -            memcpy_fromfs(p, buffer, len);
  3241. -        } else {
  3242. -            memcpy(p, buffer, len);
  3243. -        }
  3244. -        dev->sndcount[channel] += len;
  3245. -        icn_pollbchan_send(channel, dev);
  3246. -        restore_flags(flags);
  3247. -    }
  3248. -    return len;
  3249. +        if (len > 4000) {
  3250. +                skb->free = 1;
  3251. +                kfree_skb(skb, FREE_WRITE);
  3252. +                return -EINVAL;
  3253. +        }
  3254. +        if (len) {
  3255. +                if (!(card->flags & (channel)?ICN_FLAGS_B2ACTIVE:ICN_FLAGS_B1ACTIVE))
  3256. +                        return 0;
  3257. +                if (card->sndcount[channel] > ICN_MAX_SQUEUE)
  3258. +                        return 0;
  3259. +                save_flags(flags);
  3260. +                cli();
  3261. +                card->sndcount[channel] += len;
  3262. +                skb_queue_tail(&card->spqueue[channel], skb);
  3263. +                restore_flags(flags);
  3264. +                icn_pollbchan_send(channel, card);
  3265. +        }
  3266. +        return len;
  3267.  }
  3268.  
  3269. -#ifndef LOADEXTERN
  3270.  static int icn_check_loader(int cardnumber)
  3271.  {
  3272. -    int timer = 0;
  3273. +        int timer = 0;
  3274.  
  3275. -    while (1) {
  3276. +        while (1) {
  3277.  #ifdef BOOT_DEBUG
  3278. -        printk(KERN_DEBUG "Loader %d ?\n", cardnumber);
  3279. +                printk(KERN_DEBUG "Loader %d ?\n", cardnumber);
  3280.  #endif
  3281. -        if (dev->shmem->data_control.scns ||
  3282. -            dev->shmem->data_control.scnr) {
  3283. -            if (timer++ > 5) {
  3284. -                printk(KERN_WARNING "icn: Boot-Loader %d timed out.\n", cardnumber);
  3285. -                icn_release_channel();
  3286. -                return -EIO;
  3287. -            }
  3288. +                if (dev.shmem->data_control.scns ||
  3289. +                    dev.shmem->data_control.scnr) {
  3290. +                        if (timer++ > 5) {
  3291. +                                printk(KERN_WARNING
  3292. +                                       "icn: Boot-Loader %d timed out.\n",
  3293. +                                       cardnumber);
  3294. +                                icn_release_channel();
  3295. +                                return -EIO;
  3296. +                        }
  3297.  #ifdef BOOT_DEBUG
  3298. -            printk(KERN_DEBUG "Loader %d TO?\n", cardnumber);
  3299. +                        printk(KERN_DEBUG "Loader %d TO?\n", cardnumber);
  3300.  #endif
  3301. -            current->state = TASK_INTERRUPTIBLE;
  3302. -            current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  3303. -            schedule();
  3304. -        } else {
  3305. +                        current->state = TASK_INTERRUPTIBLE;
  3306. +                        current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  3307. +                        schedule();
  3308. +                } else {
  3309.  #ifdef BOOT_DEBUG
  3310. -            printk(KERN_DEBUG "Loader %d OK\n", cardnumber);
  3311. +                        printk(KERN_DEBUG "Loader %d OK\n", cardnumber);
  3312.  #endif
  3313. -            icn_release_channel();
  3314. -            return 0;
  3315. -        }
  3316. -    }
  3317. +                        icn_release_channel();
  3318. +                        return 0;
  3319. +                }
  3320. +        }
  3321.  }
  3322.  
  3323.  /* Load the boot-code into the interface-card's memory and start it.
  3324. @@ -769,585 +740,782 @@
  3325.  #define SLEEP(sec)
  3326.  #endif
  3327.  
  3328. -static int icn_loadboot(u_char * buffer, icn_dev * dev)
  3329. +static int icn_loadboot(u_char * buffer, icn_card * card)
  3330.  {
  3331. -    int ret;
  3332. -    ulong flags;
  3333. +        int ret;
  3334. +        ulong flags;
  3335.  
  3336.  #ifdef BOOT_DEBUG
  3337. -    printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) buffer);
  3338. +        printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) buffer);
  3339.  #endif
  3340. -    if ((ret = verify_area(VERIFY_READ, (void *) buffer, ICN_CODE_STAGE1)))
  3341. -        return ret;
  3342. -    save_flags(flags);
  3343. -    cli();
  3344. -    if (!dev->rvalid) {
  3345. -        if (check_region(dev->port, ICN_PORTLEN)) {
  3346. -            printk(KERN_WARNING "icn: ports 0x%03x-0x%03x in use.\n", dev->port,
  3347. -                   dev->port + ICN_PORTLEN);
  3348. -            restore_flags(flags);
  3349. -            return -EBUSY;
  3350. -        }
  3351. -        request_region(dev->port, ICN_PORTLEN, regname);
  3352. -        dev->rvalid = 1;
  3353. -    }
  3354. -    if (!dev->mvalid) {
  3355. -        if (check_shmem((ulong) dev->shmem, 0x4000)) {
  3356. -            printk(KERN_WARNING "icn: memory at 0x%08lx in use.\n", (ulong) dev->shmem);
  3357. -            restore_flags(flags);
  3358. -            return -EBUSY;
  3359. -        }
  3360. -        request_shmem((ulong) dev->shmem, 0x4000, regname);
  3361. -        dev->mvalid = 1;
  3362. -    }
  3363. -    restore_flags(flags);
  3364. -    OUTB_P(0, ICN_RUN);    /* Reset Controller */
  3365. -    OUTB_P(0, ICN_MAPRAM);    /* Disable RAM      */
  3366. -    icn_shiftout(ICN_CFG, 0x0f, 3, 4);    /* Windowsize= 16k */
  3367. -    icn_shiftout(ICN_CFG, (unsigned long) dev->shmem, 23, 10);    /* Set RAM-Addr.   */
  3368. +        if ((ret = verify_area(VERIFY_READ, (void *) buffer, ICN_CODE_STAGE1)))
  3369. +                return ret;
  3370. +        save_flags(flags);
  3371. +        cli();
  3372. +        if (!card->rvalid) {
  3373. +                if (check_region(card->port, ICN_PORTLEN)) {
  3374. +                        printk(KERN_WARNING
  3375. +                               "icn: (%s) ports 0x%03x-0x%03x in use.\n",
  3376. +                               CID,
  3377. +                               card->port,
  3378. +                               card->port + ICN_PORTLEN);
  3379. +                        restore_flags(flags);
  3380. +                        return -EBUSY;
  3381. +                }
  3382. +                request_region(card->port, ICN_PORTLEN, card->regname);
  3383. +                card->rvalid = 1;
  3384. +                if (card->doubleS0)
  3385. +                        card->other->rvalid = 1;
  3386. +        }
  3387. +        if (!dev.mvalid) {
  3388. +                if (check_shmem((ulong) dev.shmem, 0x4000)) {
  3389. +                        printk(KERN_WARNING
  3390. +                               "icn: memory at 0x%08lx in use.\n",
  3391. +                               (ulong) dev.shmem);
  3392. +                        restore_flags(flags);
  3393. +                        return -EBUSY;
  3394. +                }
  3395. +                request_shmem((ulong) dev.shmem, 0x4000, "icn");
  3396. +                dev.mvalid = 1;
  3397. +        }
  3398. +        restore_flags(flags);
  3399. +        OUTB_P(0, ICN_RUN);                                       /* Reset Controller */
  3400. +        OUTB_P(0, ICN_MAPRAM);                                    /* Disable RAM      */
  3401. +        icn_shiftout(ICN_CFG, 0x0f, 3, 4);                        /* Windowsize= 16k  */
  3402. +        icn_shiftout(ICN_CFG, (unsigned long) dev.shmem, 23, 10); /* Set RAM-Addr.    */
  3403.  #ifdef BOOT_DEBUG
  3404. -    printk(KERN_DEBUG "shmem=%08lx\n", (ulong) dev->shmem);
  3405. +        printk(KERN_DEBUG "shmem=%08lx\n", (ulong) dev.shmem);
  3406.  #endif
  3407. -    SLEEP(1);
  3408. -    save_flags(flags);
  3409. -    cli();
  3410. -    dev->channel = 1;    /* Force Mapping   */
  3411. +        SLEEP(1);
  3412. +        save_flags(flags);
  3413. +        cli();
  3414. +        dev.channel = 1;                                           /* Force Mapping    */
  3415. +        dev.mcard   = NULL;
  3416.  #ifdef BOOT_DEBUG
  3417. -    printk(KERN_DEBUG "Map Bank 0\n");
  3418. +        printk(KERN_DEBUG "Map Bank 0\n");
  3419.  #endif
  3420. -    icn_map_channel(0);        /* Select Bank 0   */
  3421. -    icn_lock_channel(0);    /* Lock Bank 0     */
  3422. -    restore_flags(flags);
  3423. -    SLEEP(1);
  3424. -    memcpy_fromfs(dev->shmem, buffer, ICN_CODE_STAGE1);    /* Copy code       */
  3425. +        icn_map_channel(card,0);                                   /* Select Bank 0    */
  3426. +        icn_lock_channel(card,0);                                  /* Lock Bank 0      */
  3427. +        restore_flags(flags);
  3428. +        SLEEP(1);
  3429. +        memcpy_fromfs(dev.shmem, buffer, ICN_CODE_STAGE1);         /* Copy code        */
  3430.  #ifdef BOOT_DEBUG
  3431. -    printk(KERN_DEBUG "Bootloader transfered\n");
  3432. +        printk(KERN_DEBUG "Bootloader transfered\n");
  3433.  #endif
  3434. -    if (dev->doubleS0) {
  3435. -        SLEEP(1);
  3436. -        save_flags(flags);
  3437. -        cli();
  3438. -        icn_release_channel();
  3439. +        if (card->doubleS0) {
  3440. +                SLEEP(1);
  3441. +                save_flags(flags);
  3442. +                cli();
  3443. +                icn_release_channel();
  3444.  #ifdef BOOT_DEBUG
  3445. -        printk(KERN_DEBUG "Map Bank 8\n");
  3446. +                printk(KERN_DEBUG "Map Bank 8\n");
  3447.  #endif
  3448. -        icn_map_channel(2);    /* Select Bank 8   */
  3449. -        icn_lock_channel(2);    /* Lock Bank 8     */
  3450. -        restore_flags(flags);
  3451. -        SLEEP(1);
  3452. -        memcpy_fromfs(dev->shmem, buffer, ICN_CODE_STAGE1);    /* Copy code       */
  3453. +                icn_map_channel(card,2);                           /* Select Bank 8   */
  3454. +                icn_lock_channel(card,2);                          /* Lock Bank 8     */
  3455. +                restore_flags(flags);
  3456. +                SLEEP(1);
  3457. +                memcpy_fromfs(dev.shmem, buffer, ICN_CODE_STAGE1); /* Copy code       */
  3458.  #ifdef BOOT_DEBUG
  3459. -        printk(KERN_DEBUG "Bootloader transfered\n");
  3460. +                printk(KERN_DEBUG "Bootloader transfered\n");
  3461.  #endif
  3462. -    }
  3463. -    SLEEP(1);
  3464. -    OUTB_P(0xff, ICN_RUN);    /* Start Boot-Code */
  3465. -    if ((ret = icn_check_loader(dev->doubleS0 ? 2 : 1)))
  3466. -        return ret;
  3467. -    if (!dev->doubleS0)
  3468. -        return 0;
  3469. -    /* reached only, if we have a Double-S0-Card */
  3470. -    save_flags(flags);
  3471. -    cli();
  3472. +        }
  3473. +        SLEEP(1);
  3474. +        OUTB_P(0xff, ICN_RUN);                                     /* Start Boot-Code */
  3475. +        if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1)))
  3476. +                return ret;
  3477. +        if (!card->doubleS0)
  3478. +                return 0;
  3479. +        /* reached only, if we have a Double-S0-Card */
  3480. +        save_flags(flags);
  3481. +        cli();
  3482.  #ifdef BOOT_DEBUG
  3483. -    printk(KERN_DEBUG "Map Bank 0\n");
  3484. +        printk(KERN_DEBUG "Map Bank 0\n");
  3485.  #endif
  3486. -    icn_map_channel(0);        /* Select Bank 0   */
  3487. -    icn_lock_channel(0);    /* Lock Bank 0     */
  3488. -    restore_flags(flags);
  3489. -    SLEEP(1);
  3490. -    return (icn_check_loader(1));
  3491. -}
  3492. -
  3493. -static int icn_loadproto(u_char * buffer, icn_dev * ldev)
  3494. -{
  3495. -    register u_char *p = buffer;
  3496. -    uint left = ICN_CODE_STAGE2;
  3497. -    uint cnt;
  3498. -    int timer;
  3499. -    int ret;
  3500. -    unsigned long flags;
  3501. +        icn_map_channel(card,0);                                   /* Select Bank 0   */
  3502. +        icn_lock_channel(card,0);                                  /* Lock Bank 0     */
  3503. +        restore_flags(flags);
  3504. +        SLEEP(1);
  3505. +        return (icn_check_loader(1));
  3506. +}
  3507. +
  3508. +static int icn_loadproto(u_char * buffer, icn_card * card)
  3509. +{
  3510. +        register u_char *p = buffer;
  3511. +        uint left = ICN_CODE_STAGE2;
  3512. +        uint cnt;
  3513. +        int timer;
  3514. +        int ret;
  3515. +        unsigned long flags;
  3516.  
  3517.  #ifdef BOOT_DEBUG
  3518. -    printk(KERN_DEBUG "icn_loadproto called\n");
  3519. +        printk(KERN_DEBUG "icn_loadproto called\n");
  3520.  #endif
  3521. -    if ((ret = verify_area(VERIFY_READ, (void *) buffer, ICN_CODE_STAGE2)))
  3522. -        return ret;
  3523. -    timer = 0;
  3524. -    save_flags(flags);
  3525. -    cli();
  3526. -    if (ldev->secondhalf) {
  3527. -        icn_map_channel(2);
  3528. -        icn_lock_channel(2);
  3529. -    } else {
  3530. -        icn_map_channel(0);
  3531. -        icn_lock_channel(0);
  3532. -    }
  3533. -    restore_flags(flags);
  3534. -    while (left) {
  3535. -        if (sbfree) {    /* If there is a free buffer...  */
  3536. -            cnt = MIN(256, left);
  3537. -            memcpy_fromfs(&sbuf_l, p, cnt);        /* copy data                     */
  3538. -            sbnext;    /* switch to next buffer         */
  3539. -            p += cnt;
  3540. -            left -= cnt;
  3541. -            timer = 0;
  3542. -        } else {
  3543. +        if ((ret = verify_area(VERIFY_READ, (void *) buffer, ICN_CODE_STAGE2)))
  3544. +                return ret;
  3545. +        timer = 0;
  3546. +        save_flags(flags);
  3547. +        cli();
  3548. +        if (card->secondhalf) {
  3549. +                icn_map_channel(card, 2);
  3550. +                icn_lock_channel(card, 2);
  3551. +        } else {
  3552. +                icn_map_channel(card, 0);
  3553. +                icn_lock_channel(card, 0);
  3554. +        }
  3555. +        restore_flags(flags);
  3556. +        while (left) {
  3557. +                if (sbfree) {                           /* If there is a free buffer...  */
  3558. +                        cnt = MIN(256, left);
  3559. +                        memcpy_fromfs(&sbuf_l, p, cnt); /* copy data                     */
  3560. +                        sbnext;                         /* switch to next buffer         */
  3561. +                        p += cnt;
  3562. +                        left -= cnt;
  3563. +                        timer = 0;
  3564. +                } else {
  3565.  #ifdef BOOT_DEBUG
  3566. -            printk(KERN_DEBUG "boot 2 !sbfree\n");
  3567. +                        printk(KERN_DEBUG "boot 2 !sbfree\n");
  3568.  #endif
  3569. -            if (timer++ > 5) {
  3570. -                icn_maprelease_channel(0);
  3571. -                return -EIO;
  3572. -            }
  3573. -            current->state = TASK_INTERRUPTIBLE;
  3574. -            current->timeout = jiffies + 10;
  3575. -            schedule();
  3576. -        }
  3577. -    }
  3578. -    sbuf_n = 0x20;
  3579. -    timer = 0;
  3580. -    while (1) {
  3581. -        if (cmd_o || cmd_i) {
  3582. +                        if (timer++ > 5) {
  3583. +                                icn_maprelease_channel(card, 0);
  3584. +                                return -EIO;
  3585. +                        }
  3586. +                        current->state = TASK_INTERRUPTIBLE;
  3587. +                        current->timeout = jiffies + 10;
  3588. +                        schedule();
  3589. +                }
  3590. +        }
  3591. +        sbuf_n = 0x20;
  3592. +        timer = 0;
  3593. +        while (1) {
  3594. +                if (cmd_o || cmd_i) {
  3595.  #ifdef BOOT_DEBUG
  3596. -            printk(KERN_DEBUG "Proto?\n");
  3597. +                        printk(KERN_DEBUG "Proto?\n");
  3598.  #endif
  3599. -            if (timer++ > 5) {
  3600. -                printk(KERN_WARNING "icn: Protocol timed out.\n");
  3601. +                        if (timer++ > 5) {
  3602. +                                printk(KERN_WARNING
  3603. +                                       "icn: (%s) Protocol timed out.\n",
  3604. +                                       CID);
  3605.  #ifdef BOOT_DEBUG
  3606. -                printk(KERN_DEBUG "Proto TO!\n");
  3607. +                                printk(KERN_DEBUG "Proto TO!\n");
  3608.  #endif
  3609. -                icn_maprelease_channel(0);
  3610. -                return -EIO;
  3611. -            }
  3612. +                                icn_maprelease_channel(card, 0);
  3613. +                                return -EIO;
  3614. +                        }
  3615.  #ifdef BOOT_DEBUG
  3616. -            printk(KERN_DEBUG "Proto TO?\n");
  3617. +                        printk(KERN_DEBUG "Proto TO?\n");
  3618.  #endif
  3619. -            current->state = TASK_INTERRUPTIBLE;
  3620. -            current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  3621. -            schedule();
  3622. -        } else {
  3623. -            if ((ldev->secondhalf) || (!dev->doubleS0)) {
  3624. -                save_flags(flags);
  3625. -                cli();
  3626. +                        current->state = TASK_INTERRUPTIBLE;
  3627. +                        current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  3628. +                        schedule();
  3629. +                } else {
  3630. +                        if ((card->secondhalf) || (!card->doubleS0)) {
  3631. +                                save_flags(flags);
  3632. +                                cli();
  3633.  #ifdef BOOT_DEBUG
  3634. -                printk(KERN_DEBUG "Proto loaded, install poll-timer %d\n",
  3635. -                       ldev->secondhalf);
  3636. +                                printk(KERN_DEBUG "Proto loaded, install poll-timer %d\n",
  3637. +                                       card->secondhalf);
  3638.  #endif
  3639. -                init_timer(&dev->st_timer);
  3640. -                dev->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
  3641. -                dev->st_timer.function = icn_pollcard;
  3642. -                add_timer(&dev->st_timer);
  3643. -                restore_flags(flags);
  3644. -            }
  3645. -            icn_maprelease_channel(0);
  3646. -            return 0;
  3647. -        }
  3648. -    }
  3649. +                                init_timer(&card->st_timer);
  3650. +                                card->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
  3651. +                                card->st_timer.function = icn_polldchan;
  3652. +                                card->st_timer.data = (unsigned long)card;
  3653. +                                add_timer(&card->st_timer);
  3654. +                                card->flags |= ICN_FLAGS_RUNNING;
  3655. +                                if (card->doubleS0) {
  3656. +                                        init_timer(&card->other->st_timer);
  3657. +                                        card->other->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
  3658. +                                        card->other->st_timer.function = icn_polldchan;
  3659. +                                        card->other->st_timer.data = (unsigned long)card->other;
  3660. +                                        add_timer(&card->other->st_timer);
  3661. +                                        card->other->flags |= ICN_FLAGS_RUNNING;
  3662. +                                }
  3663. +                                restore_flags(flags);
  3664. +                        }
  3665. +                        icn_maprelease_channel(card, 0);
  3666. +                        return 0;
  3667. +                }
  3668. +        }
  3669.  }
  3670. -#endif                /* !LOADEXTERN */
  3671.  
  3672.  /* Read the Status-replies from the Interface */
  3673. -static int icn_readstatus(u_char * buf, int len, int user, icn_dev * dev)
  3674. +static int icn_readstatus(u_char * buf, int len, int user, icn_card * card)
  3675.  {
  3676. -    int count;
  3677. -    u_char *p;
  3678. +        int count;
  3679. +        u_char *p;
  3680.  
  3681. -    for (p = buf, count = 0; count < len; p++, count++) {
  3682. -                if (dev->msg_buf_read == dev->msg_buf_write)
  3683. +        for (p = buf, count = 0; count < len; p++, count++) {
  3684. +                if (card->msg_buf_read == card->msg_buf_write)
  3685.                          return count;
  3686. -        if (user)
  3687. -            put_fs_byte(*dev->msg_buf_read++, p);
  3688. -        else
  3689. -            *p = *dev->msg_buf_read++;
  3690. -        if (dev->msg_buf_read > dev->msg_buf_end)
  3691. -            dev->msg_buf_read = dev->msg_buf;
  3692. -    }
  3693. -    return count;
  3694. +                if (user)
  3695. +                        put_fs_byte(*card->msg_buf_read++, p);
  3696. +                else
  3697. +                        *p = *card->msg_buf_read++;
  3698. +                if (card->msg_buf_read > card->msg_buf_end)
  3699. +                        card->msg_buf_read = card->msg_buf;
  3700. +        }
  3701. +        return count;
  3702.  }
  3703.  
  3704.  /* Put command-strings into the command-queue of the Interface */
  3705. -static int icn_writecmd(const u_char * buf, int len, int user, icn_dev * dev, int waitflg)
  3706. +static int icn_writecmd(const u_char * buf, int len, int user, icn_card * card, int waitflg)
  3707.  {
  3708. -    int mch = dev->secondhalf ? 2 : 0;
  3709. -    int avail;
  3710. -    int pp;
  3711. -    int i;
  3712. -    int count;
  3713. -    int ocount;
  3714. -    unsigned long flags;
  3715. -    u_char *p;
  3716. -    isdn_ctrl cmd;
  3717. -    u_char msg[0x100];
  3718. -
  3719. -    while (1) {
  3720. -        if (icn_trymaplock_channel(mch)) {
  3721. -            avail = cmd_free;
  3722. -            count = MIN(avail, len);
  3723. -            if (user)
  3724. -                memcpy_fromfs(msg, buf, count);
  3725. -            else
  3726. -                memcpy(msg, buf, count);
  3727. -            save_flags(flags);
  3728. -            cli();
  3729. -            ocount = 1;
  3730. -            *dev->msg_buf_write++ = '>';
  3731. -            if (dev->msg_buf_write > dev->msg_buf_end)
  3732. -                dev->msg_buf_write = dev->msg_buf;
  3733. -            for (p = msg, pp = cmd_i, i = count; i > 0; i--, p++, pp++) {
  3734. -                dev->shmem->comm_buffers.pcio_buf[pp & 0xff] = (*p == '\n') ? 0xff : *p;
  3735. -                *dev->msg_buf_write++ = *p;
  3736. -                if ((*p == '\n') && (i > 1)) {
  3737. -                    *dev->msg_buf_write++ = '>';
  3738. -                    if (dev->msg_buf_write > dev->msg_buf_end)
  3739. -                        dev->msg_buf_write = dev->msg_buf;
  3740. -                    ocount++;
  3741. -                }
  3742. -                /* No checks for buffer overflow of raw-status-device */
  3743. -                if (dev->msg_buf_write > dev->msg_buf_end)
  3744. -                    dev->msg_buf_write = dev->msg_buf;
  3745. -                ocount++;
  3746. -            }
  3747. -            restore_flags(flags);
  3748. -            cmd.command = ISDN_STAT_STAVAIL;
  3749. -            cmd.driver = dev->myid;
  3750. -            cmd.arg = ocount;
  3751. -            dev->interface.statcallb(&cmd);
  3752. -            cmd_i = (cmd_i + count) & 0xff;
  3753. -            icn_release_channel();
  3754. -            waitflg = 0;
  3755. -        } else
  3756. -            count = 0;
  3757. -        if (!waitflg)
  3758. -            break;
  3759. -        current->timeout = jiffies + 10;
  3760. -        schedule();
  3761. -    }
  3762. -    return count;
  3763. +        int mch = card->secondhalf ? 2 : 0;
  3764. +        int avail;
  3765. +        int pp;
  3766. +        int i;
  3767. +        int count;
  3768. +        int ocount;
  3769. +        unsigned long flags;
  3770. +        u_char *p;
  3771. +        isdn_ctrl cmd;
  3772. +        u_char msg[0x100];
  3773. +
  3774. +        while (1) {
  3775. +                if (icn_trymaplock_channel(card, mch)) {
  3776. +                        avail = cmd_free;
  3777. +                        count = MIN(avail, len);
  3778. +                        if (user)
  3779. +                                memcpy_fromfs(msg, buf, count);
  3780. +                        else
  3781. +                                memcpy(msg, buf, count);
  3782. +                        save_flags(flags);
  3783. +                        cli();
  3784. +                        ocount = 1;
  3785. +                        *card->msg_buf_write++ = '>';
  3786. +                        if (card->msg_buf_write > card->msg_buf_end)
  3787. +                                card->msg_buf_write = card->msg_buf;
  3788. +                        for (p = msg, pp = cmd_i, i = count; i > 0; i--, p++, pp++) {
  3789. +                                dev.shmem->comm_buffers.pcio_buf[pp & 0xff] = (*p == '\n') ? 0xff : *p;
  3790. +                                *card->msg_buf_write++ = *p;
  3791. +                                if ((*p == '\n') && (i > 1)) {
  3792. +                                        *card->msg_buf_write++ = '>';
  3793. +                                        if (card->msg_buf_write > card->msg_buf_end)
  3794. +                                                card->msg_buf_write = card->msg_buf;
  3795. +                                        ocount++;
  3796. +                                }
  3797. +                                /* No checks for buffer overflow of raw-status-device */
  3798. +                                if (card->msg_buf_write > card->msg_buf_end)
  3799. +                                        card->msg_buf_write = card->msg_buf;
  3800. +                                ocount++;
  3801. +                        }
  3802. +                        restore_flags(flags);
  3803. +                        cmd.command = ISDN_STAT_STAVAIL;
  3804. +                        cmd.driver = card->myid;
  3805. +                        cmd.arg = ocount;
  3806. +                        card->interface.statcallb(&cmd);
  3807. +                        cmd_i = (cmd_i + count) & 0xff;
  3808. +                        icn_release_channel();
  3809. +                        waitflg = 0;
  3810. +                } else
  3811. +                        count = 0;
  3812. +                if (!waitflg)
  3813. +                        break;
  3814. +                current->timeout = jiffies + 10;
  3815. +                schedule();
  3816. +        }
  3817. +        return count;
  3818.  }
  3819.  
  3820. -static void icn_stopdriver(icn_dev * ldev)
  3821. +/*
  3822. + * Delete card's pending timers, send STOP to linklevel
  3823. + */
  3824. +static void icn_stopcard(icn_card * card)
  3825.  {
  3826. -    unsigned long flags;
  3827. -    isdn_ctrl cmd;
  3828. +        unsigned long flags;
  3829. +        isdn_ctrl cmd;
  3830.  
  3831. -    save_flags(flags);
  3832. -    cli();
  3833. -    del_timer(&dev->st_timer);
  3834. -    del_timer(&ldev->rb_timer);
  3835. -    cmd.command = ISDN_STAT_STOP;
  3836. -    cmd.driver = ldev->myid;
  3837. -    ldev->interface.statcallb(&cmd);
  3838. -    restore_flags(flags);
  3839. -}
  3840. -
  3841. -static int my_atoi(char *s)
  3842. -{
  3843. -    int i, n;
  3844. -
  3845. -    n = 0;
  3846. -    if (!s)
  3847. -        return -1;
  3848. -    for (i = 0; *s >= '0' && *s <= '9'; i++, s++)
  3849. -        n = 10 * n + (*s - '0');
  3850. -    return n;
  3851. -}
  3852. -
  3853. -static int icn_command(isdn_ctrl * c, icn_dev * ldev)
  3854. -{
  3855. -    ulong a;
  3856. -    ulong flags;
  3857. -    int i;
  3858. -    char cbuf[60];
  3859. -    isdn_ctrl cmd;
  3860. -
  3861. -    switch (c->command) {
  3862. -    case ISDN_CMD_IOCTL:
  3863. -        memcpy(&a, c->num, sizeof(ulong));
  3864. -        switch (c->arg) {
  3865. -        case ICN_IOCTL_SETMMIO:
  3866. -            if ((unsigned long) dev->shmem != (a & 0x0ffc000)) {
  3867. -                if (check_shmem((ulong) (a & 0x0ffc000), 0x4000)) {
  3868. -                    printk(KERN_WARNING "icn: memory at 0x%08lx in use.\n",
  3869. -                           (ulong) (a & 0x0ffc000));
  3870. -                    return -EINVAL;
  3871. -                }
  3872. -                icn_stopdriver(dev);
  3873. -                if (dev->doubleS0)
  3874. -                    icn_stopdriver(dev2);
  3875. -                save_flags(flags);
  3876. -                cli();
  3877. -                if (dev->mvalid)
  3878. -                    release_shmem((ulong) dev->shmem, 0x4000);
  3879. -                dev->mvalid = 0;
  3880. -                dev->shmem = (icn_shmem *) (a & 0x0ffc000);
  3881. -                if (dev->doubleS0)
  3882. -                    dev2->shmem = (icn_shmem *) (a & 0x0ffc000);
  3883. -                restore_flags(flags);
  3884. -                printk(KERN_INFO "icn: mmio set to 0x%08lx\n",
  3885. -                       (unsigned long) dev->shmem);
  3886. -            }
  3887. -            break;
  3888. -        case ICN_IOCTL_GETMMIO:
  3889. -            return (int) dev->shmem;
  3890. -        case ICN_IOCTL_SETPORT:
  3891. -            if (a == 0x300 || a == 0x310 || a == 0x320 || a == 0x330
  3892. -                || a == 0x340 || a == 0x350 || a == 0x360 ||
  3893. -                a == 0x308 || a == 0x318 || a == 0x328 || a == 0x338
  3894. -                || a == 0x348 || a == 0x358 || a == 0x368) {
  3895. -                if (dev->port != (unsigned short) a) {
  3896. -                    if (check_region((unsigned short) a, ICN_PORTLEN)) {
  3897. -                        printk(KERN_WARNING "icn: ports 0x%03x-0x%03x in use.\n",
  3898. -                               (int) a, (int) a + ICN_PORTLEN);
  3899. -                        return -EINVAL;
  3900. -                    }
  3901. -                    icn_stopdriver(dev);
  3902. -                    if (dev->doubleS0)
  3903. -                        icn_stopdriver(dev2);
  3904. -                    save_flags(flags);
  3905. -                    cli();
  3906. -                    if (dev->rvalid)
  3907. -                        release_region(dev->port, ICN_PORTLEN);
  3908. -                    dev->port = (unsigned short) a;
  3909. -                    dev->rvalid = 0;
  3910. -                    if (dev->doubleS0) {
  3911. -                        dev2->port = (unsigned short) a;
  3912. -                        dev2->rvalid = 0;
  3913. -                    }
  3914. -                    restore_flags(flags);
  3915. -                    printk(KERN_INFO "icn: port set to 0x%03x\n", dev->port);
  3916. -                }
  3917. -            } else
  3918. -                return -EINVAL;
  3919. -            break;
  3920. -        case ICN_IOCTL_GETPORT:
  3921. -            return (int) dev->port;
  3922. -        case ICN_IOCTL_GETDOUBLE:
  3923. -            return (int) dev->doubleS0;
  3924. -        case ICN_IOCTL_DEBUGVAR:
  3925. -            return (ulong) ldev;
  3926. -#ifndef LOADEXTERN
  3927. -        case ICN_IOCTL_LOADBOOT:
  3928. -            icn_stopdriver(dev);
  3929. -            if (dev->doubleS0)
  3930. -                icn_stopdriver(dev2);
  3931. -            return (icn_loadboot((u_char *) a, dev));
  3932. -        case ICN_IOCTL_LOADPROTO:
  3933. -            icn_stopdriver(dev);
  3934. -            if (dev->doubleS0)
  3935. -                icn_stopdriver(dev2);
  3936. -            if ((i = (icn_loadproto((u_char *) a, dev))))
  3937. -                return i;
  3938. -            if (dev->doubleS0)
  3939. -                i = icn_loadproto((u_char *) (a + ICN_CODE_STAGE2), dev2);
  3940. -            return i;
  3941. -#endif
  3942. -        case ICN_IOCTL_LEASEDCFG:
  3943. -            if (a) {
  3944. -                if (!ldev->leased) {
  3945. -                    ldev->leased = 1;
  3946. -                    while (ldev->ptype == ISDN_PTYPE_UNKNOWN) {
  3947. -                        current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  3948. -                        schedule();
  3949. -                    }
  3950. -                    current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  3951. -                    schedule();
  3952. -                    sprintf(cbuf, "00;FV2ON\n01;EAZ1\n");
  3953. -                    i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  3954. -                    printk(KERN_INFO "icn: Leased-line mode enabled\n");
  3955. -                    cmd.command = ISDN_STAT_RUN;
  3956. -                    cmd.driver = ldev->myid;
  3957. -                    cmd.arg = 0;
  3958. -                    ldev->interface.statcallb(&cmd);
  3959. -                }
  3960. -            } else {
  3961. -                if (ldev->leased) {
  3962. -                    ldev->leased = 0;
  3963. -                    sprintf(cbuf, "00;FV2OFF\n");
  3964. -                    i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  3965. -                    printk(KERN_INFO "icn: Leased-line mode disabled\n");
  3966. -                    cmd.command = ISDN_STAT_RUN;
  3967. -                    cmd.driver = ldev->myid;
  3968. -                    cmd.arg = 0;
  3969. -                    ldev->interface.statcallb(&cmd);
  3970. -                }
  3971. -            }
  3972. -            return 0;
  3973. -        default:
  3974. -            return -EINVAL;
  3975. -        }
  3976. -        break;
  3977. -    case ISDN_CMD_DIAL:
  3978. -        if (ldev->leased)
  3979. -            break;
  3980. -        if ((c->arg & 255) < ICN_BCH) {
  3981. -            char *p;
  3982. -            char *p2;
  3983. -            char dial[50];
  3984. -            char sis[50];
  3985. -            char dcode[4];
  3986. -            int si1, si2;
  3987. -
  3988. -            a = c->arg;
  3989. -            strcpy(sis, c->num);
  3990. -            p = strrchr(sis, ',');
  3991. -            *p++ = '\0';
  3992. -            si2 = my_atoi(p);
  3993. -            p = strrchr(sis, ',') + 1;
  3994. -            si1 = my_atoi(p);
  3995. -            p = c->num;
  3996. -            if (*p == 's' || *p == 'S') {
  3997. -                /* Dial for SPV */
  3998. -                p++;
  3999. -                strcpy(dcode, "SCA");
  4000. -            } else
  4001. -                /* Normal Dial */
  4002. -                strcpy(dcode, "CAL");
  4003. -            strcpy(dial, p);
  4004. -            p = strchr(dial, ',');
  4005. -            *p++ = '\0';
  4006. -            p2 = strchr(p, ',');
  4007. -            *p2 = '\0';
  4008. -            sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), dcode, dial, si1,
  4009. -                si2, p);
  4010. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4011. -        }
  4012. -        break;
  4013. -    case ISDN_CMD_ACCEPTD:
  4014. -        if (c->arg < ICN_BCH) {
  4015. -            a = c->arg + 1;
  4016. -            sprintf(cbuf, "%02d;DCON_R\n", (int) a);
  4017. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4018. -        }
  4019. -        break;
  4020. -    case ISDN_CMD_ACCEPTB:
  4021. -        if (c->arg < ICN_BCH) {
  4022. -            a = c->arg + 1;
  4023. -            sprintf(cbuf, "%02d;BCON_R\n", (int) a);
  4024. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4025. -        }
  4026. -        break;
  4027. -    case ISDN_CMD_HANGUP:
  4028. -        if (c->arg < ICN_BCH) {
  4029. -            a = c->arg + 1;
  4030. -            sprintf(cbuf, "%02d;BDIS_R\n%02d;DDIS_R\n", (int) a, (int) a);
  4031. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4032. -        }
  4033. -        break;
  4034. -    case ISDN_CMD_SETEAZ:
  4035. -        if (ldev->leased)
  4036. -            break;
  4037. -        if (c->arg < ICN_BCH) {
  4038. -            a = c->arg + 1;
  4039. -            if (ldev->ptype == ISDN_PTYPE_EURO) {
  4040. -                sprintf(cbuf, "%02d;MS%s%s\n", (int) a, c->num[0] ? "N" : "ALL", c->num);
  4041. -            } else
  4042. -                sprintf(cbuf, "%02d;EAZ%s\n", (int) a, c->num[0] ? c->num : "0123456789");
  4043. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4044. -        }
  4045. -        break;
  4046. -    case ISDN_CMD_CLREAZ:
  4047. -        if (ldev->leased)
  4048. -            break;
  4049. -        if (c->arg < ICN_BCH) {
  4050. -            a = c->arg + 1;
  4051. -            if (ldev->ptype == ISDN_PTYPE_EURO)
  4052. -                sprintf(cbuf, "%02d;MSNC\n", (int) a);
  4053. -            else
  4054. -                sprintf(cbuf, "%02d;EAZC\n", (int) a);
  4055. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4056. -        }
  4057. -        break;
  4058. -    case ISDN_CMD_SETL2:
  4059. -        if ((c->arg & 255) < ICN_BCH) {
  4060. -            a = c->arg;
  4061. -            switch (a >> 8) {
  4062. -            case ISDN_PROTO_L2_X75I:
  4063. -                sprintf(cbuf, "%02d;BX75\n", (int) (a & 255) + 1);
  4064. -                break;
  4065. -            case ISDN_PROTO_L2_HDLC:
  4066. -                sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1);
  4067. -                break;
  4068. -            default:
  4069. -                return -EINVAL;
  4070. -            }
  4071. -            i = icn_writecmd(cbuf, strlen(cbuf), 0, ldev, 1);
  4072. -            ldev->l2_proto[a & 255] = (a >> 8);
  4073. -        }
  4074. -        break;
  4075. -    case ISDN_CMD_GETL2:
  4076. -        if ((c->arg & 255) < ICN_BCH)
  4077. -            return ldev->l2_proto[c->arg & 255];
  4078. -        else
  4079. -            return -ENODEV;
  4080. -    case ISDN_CMD_SETL3:
  4081. -        return 0;
  4082. -    case ISDN_CMD_GETL3:
  4083. -        if ((c->arg & 255) < ICN_BCH)
  4084. -            return ISDN_PROTO_L3_TRANS;
  4085. -        else
  4086. -            return -ENODEV;
  4087. -    case ISDN_CMD_GETEAZ:
  4088. -        break;
  4089. -    case ISDN_CMD_SETSIL:
  4090. -        break;
  4091. -    case ISDN_CMD_GETSIL:
  4092. -        break;
  4093. -    case ISDN_CMD_LOCK:
  4094. -        MOD_INC_USE_COUNT;
  4095. -        break;
  4096. -    case ISDN_CMD_UNLOCK:
  4097. -        MOD_DEC_USE_COUNT;
  4098. -        break;
  4099. -    default:
  4100. -        return -EINVAL;
  4101. -    }
  4102. -    return 0;
  4103. +        save_flags(flags);
  4104. +        cli();
  4105. +        if (card->flags & ICN_FLAGS_RUNNING) {
  4106. +                card->flags &= ~ICN_FLAGS_RUNNING;
  4107. +                del_timer(&card->st_timer);
  4108. +                del_timer(&card->rb_timer);
  4109. +                cmd.command = ISDN_STAT_STOP;
  4110. +                cmd.driver  = card->myid;
  4111. +                card->interface.statcallb(&cmd);
  4112. +                if (card->doubleS0)
  4113. +                        icn_stopcard(card->other);
  4114. +        }
  4115. +        restore_flags(flags);
  4116. +}
  4117. +
  4118. +static void icn_stopallcards(void)
  4119. +{
  4120. +        icn_card *p = cards;
  4121. +
  4122. +        while (p) {
  4123. +                icn_stopcard(p);
  4124. +                p = p->next;
  4125. +        }
  4126. +}
  4127. +
  4128. +static int icn_command(isdn_ctrl * c, icn_card * card)
  4129. +{
  4130. +        ulong a;
  4131. +        ulong flags;
  4132. +        int i;
  4133. +        char cbuf[60];
  4134. +        isdn_ctrl cmd;
  4135. +        icn_cdef cdef;
  4136. +
  4137. +        switch (c->command) {
  4138. +        case ISDN_CMD_IOCTL:
  4139. +                memcpy(&a, c->num, sizeof(ulong));
  4140. +                switch (c->arg) {
  4141. +                        case ICN_IOCTL_SETMMIO:
  4142. +                                if ((unsigned long) dev.shmem != (a & 0x0ffc000)) {
  4143. +                                        if (check_shmem((ulong) (a & 0x0ffc000), 0x4000)) {
  4144. +                                                printk(KERN_WARNING
  4145. +                                                       "icn: memory at 0x%08lx in use.\n",
  4146. +                                                       (ulong) (a & 0x0ffc000));
  4147. +                                                return -EINVAL;
  4148. +                                        }
  4149. +                                        icn_stopallcards();
  4150. +                                        save_flags(flags);
  4151. +                                        cli();
  4152. +                                        if (dev.mvalid)
  4153. +                                                release_shmem((ulong) dev.shmem, 0x4000);
  4154. +                                        dev.mvalid = 0;
  4155. +                                        dev.shmem = (icn_shmem *) (a & 0x0ffc000);
  4156. +                                        restore_flags(flags);
  4157. +                                        printk(KERN_INFO
  4158. +                                               "icn: (%s) mmio set to 0x%08lx\n",
  4159. +                                               CID,
  4160. +                                               (unsigned long) dev.shmem);
  4161. +                                }
  4162. +                                break;
  4163. +                        case ICN_IOCTL_GETMMIO:
  4164. +                                return (int) dev.shmem;
  4165. +                        case ICN_IOCTL_SETPORT:
  4166. +                                if (a == 0x300 || a == 0x310 || a == 0x320 || a == 0x330
  4167. +                                    || a == 0x340 || a == 0x350 || a == 0x360 ||
  4168. +                                    a == 0x308 || a == 0x318 || a == 0x328 || a == 0x338
  4169. +                                    || a == 0x348 || a == 0x358 || a == 0x368) {
  4170. +                                        if (card->port != (unsigned short) a) {
  4171. +                                                if (check_region((unsigned short) a, ICN_PORTLEN)) {
  4172. +                                                        printk(KERN_WARNING
  4173. +                                                               "icn: (%s) ports 0x%03x-0x%03x in use.\n",
  4174. +                                                               CID, (int) a, (int) a + ICN_PORTLEN);
  4175. +                                                        return -EINVAL;
  4176. +                                                }
  4177. +                                                icn_stopcard(card);
  4178. +                                                save_flags(flags);
  4179. +                                                cli();
  4180. +                                                if (card->rvalid)
  4181. +                                                        release_region(card->port, ICN_PORTLEN);
  4182. +                                                card->port = (unsigned short) a;
  4183. +                                                card->rvalid = 0;
  4184. +                                                if (card->doubleS0) {
  4185. +                                                        card->other->port = (unsigned short) a;
  4186. +                                                        card->other->rvalid = 0;
  4187. +                                                }
  4188. +                                                restore_flags(flags);
  4189. +                                                printk(KERN_INFO
  4190. +                                                       "icn: (%s) port set to 0x%03x\n",
  4191. +                                                       CID, card->port);
  4192. +                                        }
  4193. +                                } else
  4194. +                                        return -EINVAL;
  4195. +                                break;
  4196. +                        case ICN_IOCTL_GETPORT:
  4197. +                                return (int) card->port;
  4198. +                        case ICN_IOCTL_GETDOUBLE:
  4199. +                                return (int) card->doubleS0;
  4200. +                        case ICN_IOCTL_DEBUGVAR:
  4201. +                                return (ulong) card;
  4202. +                        case ICN_IOCTL_LOADBOOT:
  4203. +                                icn_stopcard(card);
  4204. +                                return (icn_loadboot((u_char *) a, card));
  4205. +                        case ICN_IOCTL_LOADPROTO:
  4206. +                                icn_stopcard(card);
  4207. +                                if ((i = (icn_loadproto((u_char *) a, card))))
  4208. +                                        return i;
  4209. +                                if (card->doubleS0)
  4210. +                                        i = icn_loadproto((u_char *) (a + ICN_CODE_STAGE2), card->other);
  4211. +                                return i;
  4212. +                                break;
  4213. +                        case ICN_IOCTL_ADDCARD:
  4214. +                                if ((i = verify_area(VERIFY_READ, (void *) a, sizeof(icn_cdef))))
  4215. +                                        return i;
  4216. +                                memcpy_fromfs((char *)&cdef, (char *)a, sizeof(cdef));
  4217. +                                return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
  4218. +                                break;
  4219. +                        case ICN_IOCTL_LEASEDCFG:
  4220. +                                if (a) {
  4221. +                                        if (!card->leased) {
  4222. +                                                card->leased = 1;
  4223. +                                                while (card->ptype == ISDN_PTYPE_UNKNOWN) {
  4224. +                                                        current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  4225. +                                                        schedule();
  4226. +                                                }
  4227. +                                                current->timeout = jiffies + ICN_BOOT_TIMEOUT1;
  4228. +                                                schedule();
  4229. +                                                sprintf(cbuf, "00;FV2ON\n01;EAZ1\n");
  4230. +                                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4231. +                                                printk(KERN_INFO
  4232. +                                                       "icn: (%s) Leased-line mode enabled\n",
  4233. +                                                       CID);
  4234. +                                                cmd.command = ISDN_STAT_RUN;
  4235. +                                                cmd.driver = card->myid;
  4236. +                                                cmd.arg = 0;
  4237. +                                                card->interface.statcallb(&cmd);
  4238. +                                        }
  4239. +                                } else {
  4240. +                                        if (card->leased) {
  4241. +                                                card->leased = 0;
  4242. +                                                sprintf(cbuf, "00;FV2OFF\n");
  4243. +                                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4244. +                                                printk(KERN_INFO
  4245. +                                                       "icn: (%s) Leased-line mode disabled\n",
  4246. +                                                       CID);
  4247. +                                                cmd.command = ISDN_STAT_RUN;
  4248. +                                                cmd.driver = card->myid;
  4249. +                                                cmd.arg = 0;
  4250. +                                                card->interface.statcallb(&cmd);
  4251. +                                        }
  4252. +                                }
  4253. +                                return 0;
  4254. +                        default:
  4255. +                                return -EINVAL;
  4256. +                }
  4257. +                break;
  4258. +                case ISDN_CMD_DIAL:
  4259. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4260. +                                return -ENODEV;
  4261. +                        if (card->leased)
  4262. +                                break;
  4263. +                        if ((c->arg & 255) < ICN_BCH) {
  4264. +                                char *p;
  4265. +                                char *p2;
  4266. +                                char dial[50];
  4267. +                                char sis[50];
  4268. +                                char dcode[4];
  4269. +                                int si1, si2;
  4270. +                                
  4271. +                                a = c->arg;
  4272. +                                strcpy(sis, c->num);
  4273. +                                p = strrchr(sis, ',');
  4274. +                                *p++ = '\0';
  4275. +                                si2 = simple_strtoul(p,NULL,10);
  4276. +                                p = strrchr(sis, ',') + 1;
  4277. +                                si1 = simple_strtoul(p,NULL,10);
  4278. +                                p = c->num;
  4279. +                                if (*p == 's' || *p == 'S') {
  4280. +                                        /* Dial for SPV */
  4281. +                                        p++;
  4282. +                                        strcpy(dcode, "SCA");
  4283. +                                } else
  4284. +                                        /* Normal Dial */
  4285. +                                        strcpy(dcode, "CAL");
  4286. +                                strcpy(dial, p);
  4287. +                                p = strchr(dial, ',');
  4288. +                                *p++ = '\0';
  4289. +                                p2 = strchr(p, ',');
  4290. +                                *p2 = '\0';
  4291. +                                sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), dcode, dial, si1,
  4292. +                                        si2, p);
  4293. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4294. +                        }
  4295. +                        break;
  4296. +                case ISDN_CMD_ACCEPTD:
  4297. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4298. +                                return -ENODEV;
  4299. +                        if (c->arg < ICN_BCH) {
  4300. +                                a = c->arg + 1;
  4301. +                                if (card->fw_rev >= 300) {
  4302. +                                        switch (card->l2_proto[a-1]) {
  4303. +                                                case ISDN_PROTO_L2_X75I:
  4304. +                                                        sprintf(cbuf, "%02d;BX75\n", (int) a);
  4305. +                                                        break;
  4306. +                                                case ISDN_PROTO_L2_HDLC:
  4307. +                                                        sprintf(cbuf, "%02d;BTRA\n", (int) a);
  4308. +                                                        break;
  4309. +                                        }
  4310. +                                        i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4311. +                                }
  4312. +                                sprintf(cbuf, "%02d;DCON_R\n", (int) a);
  4313. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4314. +                        }
  4315. +                        break;
  4316. +                case ISDN_CMD_ACCEPTB:
  4317. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4318. +                                return -ENODEV;
  4319. +                        if (c->arg < ICN_BCH) {
  4320. +                                a = c->arg + 1;
  4321. +                                if (card->fw_rev >= 300)
  4322. +                                        switch (card->l2_proto[a-1]) {
  4323. +                                                case ISDN_PROTO_L2_X75I:
  4324. +                                                        sprintf(cbuf, "%02d;BCON_R,BX75\n", (int) a);
  4325. +                                                        break;
  4326. +                                                case ISDN_PROTO_L2_HDLC:
  4327. +                                                        sprintf(cbuf, "%02d;BCON_R,BTRA\n", (int) a);
  4328. +                                                        break;
  4329. +                                        }
  4330. +                                else
  4331. +                                        sprintf(cbuf, "%02d;BCON_R\n", (int) a);
  4332. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4333. +                        }
  4334. +                        break;
  4335. +                case ISDN_CMD_HANGUP:
  4336. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4337. +                                return -ENODEV;
  4338. +                        if (c->arg < ICN_BCH) {
  4339. +                                a = c->arg + 1;
  4340. +                                sprintf(cbuf, "%02d;BDIS_R\n%02d;DDIS_R\n", (int) a, (int) a);
  4341. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4342. +                        }
  4343. +                        break;
  4344. +                case ISDN_CMD_SETEAZ:
  4345. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4346. +                                return -ENODEV;
  4347. +                        if (card->leased)
  4348. +                                break;
  4349. +                        if (c->arg < ICN_BCH) {
  4350. +                                a = c->arg + 1;
  4351. +                                if (card->ptype == ISDN_PTYPE_EURO) {
  4352. +                                        sprintf(cbuf, "%02d;MS%s%s\n", (int) a,
  4353. +                                                c->num[0] ? "N" : "ALL", c->num);
  4354. +                                } else
  4355. +                                        sprintf(cbuf, "%02d;EAZ%s\n", (int) a,
  4356. +                                                c->num[0] ? c->num : "0123456789");
  4357. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4358. +                        }
  4359. +                        break;
  4360. +                case ISDN_CMD_CLREAZ:
  4361. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4362. +                                return -ENODEV;
  4363. +                        if (card->leased)
  4364. +                                break;
  4365. +                        if (c->arg < ICN_BCH) {
  4366. +                                a = c->arg + 1;
  4367. +                                if (card->ptype == ISDN_PTYPE_EURO)
  4368. +                                        sprintf(cbuf, "%02d;MSNC\n", (int) a);
  4369. +                                else
  4370. +                                        sprintf(cbuf, "%02d;EAZC\n", (int) a);
  4371. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4372. +                        }
  4373. +                        break;
  4374. +                case ISDN_CMD_SETL2:
  4375. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4376. +                                return -ENODEV;
  4377. +                        if ((c->arg & 255) < ICN_BCH) {
  4378. +                                a = c->arg;
  4379. +                                switch (a >> 8) {
  4380. +                                        case ISDN_PROTO_L2_X75I:
  4381. +                                                sprintf(cbuf, "%02d;BX75\n", (int) (a & 255) + 1);
  4382. +                                                break;
  4383. +                                        case ISDN_PROTO_L2_HDLC:
  4384. +                                                sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1);
  4385. +                                                break;
  4386. +                                        default:
  4387. +                                                return -EINVAL;
  4388. +                                }
  4389. +                                i = icn_writecmd(cbuf, strlen(cbuf), 0, card, 1);
  4390. +                                card->l2_proto[a & 255] = (a >> 8);
  4391. +                        }
  4392. +                        break;
  4393. +                case ISDN_CMD_GETL2:
  4394. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4395. +                                return -ENODEV;
  4396. +                        if ((c->arg & 255) < ICN_BCH)
  4397. +                                return card->l2_proto[c->arg & 255];
  4398. +                        else
  4399. +                                return -ENODEV;
  4400. +                case ISDN_CMD_SETL3:
  4401. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4402. +                                return -ENODEV;
  4403. +                        return 0;
  4404. +                case ISDN_CMD_GETL3:
  4405. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4406. +                                return -ENODEV;
  4407. +                        if ((c->arg & 255) < ICN_BCH)
  4408. +                                return ISDN_PROTO_L3_TRANS;
  4409. +                        else
  4410. +                                return -ENODEV;
  4411. +                case ISDN_CMD_GETEAZ:
  4412. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4413. +                                return -ENODEV;
  4414. +                        break;
  4415. +                case ISDN_CMD_SETSIL:
  4416. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4417. +                                return -ENODEV;
  4418. +                        break;
  4419. +                case ISDN_CMD_GETSIL:
  4420. +                        if (!card->flags & ICN_FLAGS_RUNNING)
  4421. +                                return -ENODEV;
  4422. +                        break;
  4423. +                case ISDN_CMD_LOCK:
  4424. +                        MOD_INC_USE_COUNT;
  4425. +                        break;
  4426. +                case ISDN_CMD_UNLOCK:
  4427. +                        MOD_DEC_USE_COUNT;
  4428. +                        break;
  4429. +                default:
  4430. +                        return -EINVAL;
  4431. +        }
  4432. +        return 0;
  4433.  }
  4434.  
  4435.  /*
  4436. - * For second half of doubleS0-Card add channel-offset.
  4437. + * Find card with given driverId
  4438.   */
  4439. -static int if_command1(isdn_ctrl * c)
  4440. +static inline icn_card *
  4441. +  icn_findcard(int driverid)
  4442.  {
  4443. -    return (icn_command(c, dev));
  4444. -}
  4445. +        icn_card *p = cards;
  4446.  
  4447. -static int if_command2(isdn_ctrl * c)
  4448. -{
  4449. -    return (icn_command(c, dev2));
  4450. +        while (p) {
  4451. +                if (p->myid == driverid)
  4452. +                        return p;
  4453. +                p = p->next;
  4454. +        }
  4455. +        return (icn_card *)0;
  4456.  }
  4457.  
  4458. -static int if_writecmd1(const u_char * buf, int len, int user)
  4459. +/*
  4460. + * Wrapper functions for interface to linklevel
  4461. + */
  4462. +static int if_command(isdn_ctrl * c)
  4463.  {
  4464. -    return (icn_writecmd(buf, len, user, dev, 0));
  4465. -}
  4466. +        icn_card *card = icn_findcard(c->driver);
  4467.  
  4468. -static int if_writecmd2(const u_char * buf, int len, int user)
  4469. -{
  4470. -    return (icn_writecmd(buf, len, user, dev2, 0));
  4471. +        if (card)
  4472. +                return (icn_command(c, card));
  4473. +        printk(KERN_ERR
  4474. +               "icn: if_command called with invalid driverId!\n");
  4475. +        return -ENODEV;
  4476.  }
  4477.  
  4478. -static int if_readstatus1(u_char * buf, int len, int user)
  4479. +static int if_writecmd(const u_char * buf, int len, int user, int id, int channel)
  4480.  {
  4481. -    return (icn_readstatus(buf, len, user, dev));
  4482. +        icn_card *card = icn_findcard(id);
  4483. +
  4484. +        if (card) {
  4485. +                if (!card->flags & ICN_FLAGS_RUNNING)
  4486. +                        return -ENODEV;
  4487. +                return (icn_writecmd(buf, len, user, card, 0));
  4488. +        }
  4489. +        printk(KERN_ERR
  4490. +               "icn: if_writecmd called with invalid driverId!\n");
  4491. +        return -ENODEV;
  4492.  }
  4493.  
  4494. -static int if_readstatus2(u_char * buf, int len, int user)
  4495. +static int if_readstatus(u_char * buf, int len, int user, int id, int channel)
  4496.  {
  4497. -    return (icn_readstatus(buf, len, user, dev2));
  4498. +        icn_card *card = icn_findcard(id);
  4499. +
  4500. +        if (card) {
  4501. +                if (!card->flags & ICN_FLAGS_RUNNING)
  4502. +                        return -ENODEV;
  4503. +                return (icn_readstatus(buf, len, user, card));
  4504. +        }
  4505. +        printk(KERN_ERR
  4506. +               "icn: if_readstatus called with invalid driverId!\n");
  4507. +        return -ENODEV;
  4508.  }
  4509.  
  4510. -static int if_sendbuf1(int id, int channel, const u_char * buffer, int len,
  4511. -               int user)
  4512. +static int if_sendbuf(int id, int channel, struct sk_buff *skb)
  4513.  {
  4514. -    return (icn_sendbuf(channel, buffer, len, user, dev));
  4515. +        icn_card *card = icn_findcard(id);
  4516. +
  4517. +        if (card) {
  4518. +                if (!card->flags & ICN_FLAGS_RUNNING)
  4519. +                        return -ENODEV;
  4520. +                return (icn_sendbuf(channel, skb, card));
  4521. +        }
  4522. +        printk(KERN_ERR
  4523. +               "icn: if_readstatus called with invalid driverId!\n");
  4524. +        return -ENODEV;
  4525.  }
  4526.  
  4527. -static int if_sendbuf2(int id, int channel, const u_char * buffer, int len,
  4528. -               int user)
  4529. -{
  4530. -    return (icn_sendbuf(channel, buffer, len, user, dev2));
  4531. +/*
  4532. + * Allocate a new card-struct, initialize it
  4533. + * link it into cards-list and register it at linklevel.
  4534. + */
  4535. +static icn_card *icn_initcard(int port, char *id) {
  4536. +        icn_card *card;
  4537. +        int i;
  4538. +
  4539. +        if (!(card = (icn_card *) kmalloc(sizeof(icn_card), GFP_KERNEL))) {
  4540. +                printk(KERN_WARNING
  4541. +                       "icn: (%s) Could not allocate card-struct.\n", id);
  4542. +                return (icn_card *)0;
  4543. +        }
  4544. +        memset((char *) card, 0, sizeof(icn_card));
  4545. +        card->port = port;
  4546. +        card->interface.channels = ICN_BCH;
  4547. +        card->interface.maxbufsize = 4000;
  4548. +        card->interface.command = if_command;
  4549. +    /*
  4550. +        card->interface.writebuf = if_sendbuf;
  4551. +    */
  4552. +    card->interface.writebuf_skb = if_sendbuf;
  4553. +        card->interface.writecmd = if_writecmd;
  4554. +        card->interface.readstat = if_readstatus;
  4555. +        card->interface.features = ISDN_FEATURE_L2_X75I |
  4556. +                ISDN_FEATURE_L2_HDLC |
  4557. +                ISDN_FEATURE_L3_TRANS |
  4558. +                ISDN_FEATURE_P_UNKNOWN;
  4559. +        card->ptype = ISDN_PTYPE_UNKNOWN;
  4560. +        strncpy(card->interface.id, id, sizeof(card->interface.id) - 1);
  4561. +        card->msg_buf_write = card->msg_buf;
  4562. +        card->msg_buf_read = card->msg_buf;
  4563. +        card->msg_buf_end = &card->msg_buf[sizeof(card->msg_buf) - 1];
  4564. +        for (i=0;i<ICN_BCH;i++) {
  4565. +                card->l2_proto[i] = ISDN_PROTO_L2_X75I;
  4566. +                skb_queue_head_init(&card->spqueue[i]);
  4567. +        }
  4568. +        card->next = cards;
  4569. +        cards = card;
  4570. +        if (!register_isdn(&card->interface)) {
  4571. +                cards = cards->next;
  4572. +                printk(KERN_WARNING
  4573. +                       "icn: Unable to register %s\n", id);
  4574. +                kfree(card);
  4575. +                return (icn_card*)0;
  4576. +        }
  4577. +        card->myid = card->interface.channels;
  4578. +        sprintf(card->regname, "icn-isdn (%s)", card->interface.id);
  4579. +        return card;
  4580. +}
  4581. +
  4582. +static int icn_addcard(int port, char *id1, char *id2)
  4583. +{
  4584. +        ulong flags;
  4585. +        icn_card *card;
  4586. +        icn_card *card2;
  4587. +
  4588. +        save_flags(flags);
  4589. +        cli();
  4590. +        if (!(card = icn_initcard(port,id1))) {
  4591. +                restore_flags(flags);
  4592. +                return -EIO;
  4593. +        }
  4594. +        if (!strlen(id2)) {
  4595. +                restore_flags(flags);
  4596. +                printk(KERN_INFO
  4597. +                       "icn: (%s) ICN-2B, port 0x%x added\n",
  4598. +                       card->interface.id, port);
  4599. +                return 0;
  4600. +        }
  4601. +        if (!(card2 = icn_initcard(port,id2))) {
  4602. +                restore_flags(flags);
  4603. +                printk(KERN_INFO
  4604. +                       "icn: (%s) half ICN-4B, port 0x%x added\n",
  4605. +                       card2->interface.id, port);
  4606. +                return 0;
  4607. +        }
  4608. +        card->doubleS0 = 1;
  4609. +        card->secondhalf = 0;
  4610. +        card->other = card2;
  4611. +        card2->doubleS0 = 1;
  4612. +        card2->secondhalf = 1;
  4613. +        card2->other = card;
  4614. +        restore_flags(flags);
  4615. +        printk(KERN_INFO
  4616. +               "icn: (%s and %s) ICN-4B, port 0x%x added\n",
  4617. +               card->interface.id, card2->interface.id, port);
  4618. +        return 0;
  4619.  }
  4620.  
  4621.  #ifdef MODULE
  4622. @@ -1355,158 +1523,81 @@
  4623.  #else
  4624.  void icn_setup(char *str, int *ints)
  4625.  {
  4626. -    char *p;
  4627. -    static char sid[20];
  4628. -    static char sid2[20];
  4629. -
  4630. -    if (ints[0])
  4631. -        portbase = ints[1];
  4632. -    if (ints[0]>1)
  4633. -        membase  = ints[2];
  4634. -    if (strlen(str)) {
  4635. -        strcpy(sid,str);
  4636. -        icn_id = sid;
  4637. -        if ((p = strchr(sid,','))) {
  4638. -            *p++ = 0;
  4639. -            strcpy(sid2,p);
  4640. -            icn_id2 = sid2;
  4641. -        }
  4642. -    }
  4643. +        char *p;
  4644. +        static char sid[20];
  4645. +        static char sid2[20];
  4646. +
  4647. +        if (ints[0])
  4648. +                portbase = ints[1];
  4649. +        if (ints[0]>1)
  4650. +                membase = ints[2];
  4651. +        if (strlen(str)) {
  4652. +                strcpy(sid,str);
  4653. +                icn_id = sid;
  4654. +                if ((p = strchr(sid,','))) {
  4655. +                        *p++ = 0;
  4656. +                        strcpy(sid2,p);
  4657. +                        icn_id2 = sid2;
  4658. +                }
  4659. +        }
  4660.  }
  4661.  #endif
  4662.  
  4663.  int icn_init(void)
  4664.  {
  4665. -#ifdef LOADEXTERN
  4666. -    unsigned long flags;
  4667. -#endif
  4668. -    char *p;
  4669. -    isdn_ctrl cmd;
  4670. -    char rev[10];
  4671. -
  4672. -    if (!(dev = (icn_devptr) kmalloc(sizeof(icn_dev), GFP_KERNEL))) {
  4673. -        printk(KERN_WARNING "icn: Could not allocate device-struct.\n");
  4674. -        return -EIO;
  4675. -    }
  4676. -    memset((char *) dev, 0, sizeof(icn_dev));
  4677. -    dev->port = portbase;
  4678. -    dev->shmem = (icn_shmem *) (membase & 0x0ffc000);
  4679. -    if (strlen(icn_id2))
  4680. -        dev->doubleS0 = 1;
  4681. -    dev->interface.channels = ICN_BCH;
  4682. -    dev->interface.maxbufsize = 4000;
  4683. -    dev->interface.command = if_command1;
  4684. -    dev->interface.writebuf = if_sendbuf1;
  4685. -    dev->interface.writecmd = if_writecmd1;
  4686. -    dev->interface.readstat = if_readstatus1;
  4687. -    dev->interface.features = ISDN_FEATURE_L2_X75I |
  4688. -                ISDN_FEATURE_L2_HDLC |
  4689. -                ISDN_FEATURE_L3_TRANS |
  4690. -                ISDN_FEATURE_P_UNKNOWN;
  4691. -    dev->ptype = ISDN_PTYPE_UNKNOWN;
  4692. -    strncpy(dev->interface.id, icn_id, sizeof(dev->interface.id) - 1);
  4693. -    dev->msg_buf_write = dev->msg_buf;
  4694. -    dev->msg_buf_read = dev->msg_buf;
  4695. -    dev->msg_buf_end = &dev->msg_buf[sizeof(dev->msg_buf) - 1];
  4696. -    memset((char *) dev->l2_proto, ISDN_PROTO_L2_X75I, sizeof(dev->l2_proto));
  4697. -    if (strlen(icn_id2)) {
  4698. -        if (!(dev2 = (icn_devptr) kmalloc(sizeof(icn_dev), GFP_KERNEL))) {
  4699. -            printk(KERN_WARNING "icn: Could not allocate device-struct.\n");
  4700. -            kfree(dev);
  4701. -            kfree(dev2);
  4702. -            return -EIO;
  4703. -        }
  4704. -        memcpy((char *) dev2, (char *) dev, sizeof(icn_dev));
  4705. -        dev2->interface.command = if_command2;
  4706. -        dev2->interface.writebuf = if_sendbuf2;
  4707. -        dev2->interface.writecmd = if_writecmd2;
  4708. -        dev2->interface.readstat = if_readstatus2;
  4709. -        strncpy(dev2->interface.id, icn_id2,
  4710. -                        sizeof(dev->interface.id) - 1);
  4711. -        dev2->msg_buf_write = dev2->msg_buf;
  4712. -        dev2->msg_buf_read = dev2->msg_buf;
  4713. -        dev2->msg_buf_end = &dev2->msg_buf[sizeof(dev2->msg_buf) - 1];
  4714. -        dev2->secondhalf = 1;
  4715. -    }
  4716. -    if (!register_isdn(&dev->interface)) {
  4717. -        printk(KERN_WARNING "icn: Unable to register\n");
  4718. -        kfree(dev);
  4719. -        if (dev->doubleS0)
  4720. -            kfree(dev2);
  4721. -        return -EIO;
  4722. -    }
  4723. -    dev->myid = dev->interface.channels;
  4724. -    sprintf(regname, "icn-isdn (%s)", dev->interface.id);
  4725. -    if (dev->doubleS0) {
  4726. -        if (!register_isdn(&dev2->interface)) {
  4727. -            printk(KERN_WARNING "icn: Unable to register\n");
  4728. -            kfree(dev2);
  4729. -            if (dev->doubleS0) {
  4730. -                icn_stopdriver(dev);
  4731. -                cmd.command = ISDN_STAT_UNLOAD;
  4732. -                cmd.driver = dev->myid;
  4733. -                dev->interface.statcallb(&cmd);
  4734. -                kfree(dev);
  4735. -            }
  4736. -            return -EIO;
  4737. -        }
  4738. -        dev2->myid = dev2->interface.channels;
  4739. -    }
  4740. -    
  4741. -    /* No symbols to export, hide all symbols */
  4742. -    register_symtab(NULL);
  4743. -
  4744. -    if ((p = strchr(revision, ':'))) {
  4745. -        strcpy(rev, p + 1);
  4746. -        p = strchr(rev, '$');
  4747. -        *p = 0;
  4748. -    } else
  4749. -        strcpy(rev, " ??? ");
  4750. -    printk(KERN_NOTICE "ICN-ISDN-driver Rev%sport=0x%03x mmio=0x%08x id='%s'\n",
  4751. -           rev, dev->port, (uint) dev->shmem, dev->interface.id);
  4752. -#ifdef LOADEXTERN
  4753. -    save_flags(flags);
  4754. -    cli();
  4755. -    init_timer(&dev->st_timer);
  4756. -    dev->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
  4757. -    dev->st_timer.function = icn_pollcard;
  4758. -    add_timer(&dev->st_timer);
  4759. -    restore_flags(flags);
  4760. -#endif
  4761. -    return 0;
  4762. +        char *p;
  4763. +        char rev[10];
  4764. +
  4765. +        memset(&dev, 0, sizeof(icn_dev));
  4766. +        dev.shmem = (icn_shmem *) (membase & 0x0ffc000);
  4767. +
  4768. +        /* No symbols to export, hide all symbols */
  4769. +        register_symtab(NULL);
  4770. +
  4771. +        if ((p = strchr(revision, ':'))) {
  4772. +                strcpy(rev, p + 1);
  4773. +                p = strchr(rev, '$');
  4774. +                *p = 0;
  4775. +        } else
  4776. +                strcpy(rev, " ??? ");
  4777. +        printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08x\n", rev,
  4778. +               (uint) dev.shmem);
  4779. +        return (icn_addcard(portbase,icn_id,icn_id2));
  4780.  }
  4781.  
  4782.  #ifdef MODULE
  4783.  void cleanup_module(void)
  4784.  {
  4785. -    isdn_ctrl cmd;
  4786. -    int i;
  4787. -
  4788. -    icn_stopdriver(dev);
  4789. -    cmd.command = ISDN_STAT_UNLOAD;
  4790. -    cmd.driver = dev->myid;
  4791. -    dev->interface.statcallb(&cmd);
  4792. -    if (dev->doubleS0) {
  4793. -        icn_stopdriver(dev2);
  4794. -        cmd.command = ISDN_STAT_UNLOAD;
  4795. -        cmd.driver = dev2->myid;
  4796. -        dev2->interface.statcallb(&cmd);
  4797. -    }
  4798. -    if (dev->rvalid) {
  4799. -        OUTB_P(0, ICN_RUN);    /* Reset Controller     */
  4800. -        OUTB_P(0, ICN_MAPRAM);    /* Disable RAM          */
  4801. -        release_region(dev->port, ICN_PORTLEN);
  4802. -    }
  4803. -    if (dev->mvalid)
  4804. -        release_shmem((ulong) dev->shmem, 0x4000);
  4805. -    if (dev->doubleS0) {
  4806. -        for (i = 0; i < ICN_BCH; i++)
  4807. -            icn_free_queue(&dev2->spqueue[1]);
  4808. -        kfree(dev2);
  4809. -    }
  4810. -    for (i = 0; i < ICN_BCH; i++)
  4811. -        icn_free_queue(&dev->spqueue[1]);
  4812. -    kfree(dev);
  4813. -    printk(KERN_NOTICE "ICN-ISDN-driver unloaded\n");
  4814. +        isdn_ctrl cmd;
  4815. +        icn_card *card = cards;
  4816. +        icn_card *last;
  4817. +        int i;
  4818. +
  4819. +        icn_stopallcards();
  4820. +        while (card) {
  4821. +                cmd.command = ISDN_STAT_UNLOAD;
  4822. +                cmd.driver = card->myid;
  4823. +                card->interface.statcallb(&cmd);
  4824. +                if (card->rvalid) {
  4825. +                        OUTB_P(0, ICN_RUN);    /* Reset Controller     */
  4826. +                        OUTB_P(0, ICN_MAPRAM); /* Disable RAM          */
  4827. +                        if (card->secondhalf || (!card->doubleS0)) {
  4828. +                                release_region(card->port, ICN_PORTLEN);
  4829. +                                card->rvalid = 0;
  4830. +                        }
  4831. +                        for (i = 0; i < ICN_BCH; i++)
  4832. +                                icn_free_queue(&card->spqueue[i]);
  4833. +                }
  4834. +                card = card->next;
  4835. +        }
  4836. +        card = card;
  4837. +        while (card) {
  4838. +                last = card;
  4839. +                card = card->next;
  4840. +                kfree(last);
  4841. +        }
  4842. +        if (dev.mvalid)
  4843. +                release_shmem((ulong) dev.shmem, 0x4000);
  4844. +        printk(KERN_NOTICE "ICN-ISDN-driver unloaded\n");
  4845.  }
  4846.  #endif
  4847. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/icn/icn.h linux/drivers/isdn/icn/icn.h
  4848. --- pre2.0.5/linux/drivers/isdn/icn/icn.h    Sun Apr 21 19:22:06 1996
  4849. +++ linux/drivers/isdn/icn/icn.h    Sun May 19 16:15:17 1996
  4850. @@ -1,4 +1,4 @@
  4851. -/* $Id: icn.h,v 1.13 1996/04/20 16:51:41 fritz Exp $
  4852. +/* $Id: icn.h,v 1.17 1996/05/18 00:47:04 fritz Exp $
  4853.   *
  4854.   * ISDN lowlevel-module for the ICN active ISDN-Card.
  4855.   *
  4856. @@ -19,6 +19,21 @@
  4857.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  4858.   *
  4859.   * $Log: icn.h,v $
  4860. + * Revision 1.17  1996/05/18 00:47:04  fritz
  4861. + * Removed callback debug code.
  4862. + *
  4863. + * Revision 1.16  1996/05/17 15:46:43  fritz
  4864. + * Removed own queue management.
  4865. + * Changed queue management to use sk_buffs.
  4866. + *
  4867. + * Revision 1.15  1996/05/02 04:01:57  fritz
  4868. + * Removed ICN_MAXCARDS
  4869. + *
  4870. + * Revision 1.14  1996/05/02 00:40:29  fritz
  4871. + * Major rewrite to support more than one card
  4872. + * with a single module.
  4873. + * Support for new firmware.
  4874. + *
  4875.   * Revision 1.13  1996/04/20 16:51:41  fritz
  4876.   * Increased status buffer.
  4877.   * Misc. typos
  4878. @@ -75,6 +90,14 @@
  4879.  #define ICN_IOCTL_LEASEDCFG 6
  4880.  #define ICN_IOCTL_GETDOUBLE 7
  4881.  #define ICN_IOCTL_DEBUGVAR  8
  4882. +#define ICN_IOCTL_ADDCARD   9
  4883. +
  4884. +/* Struct for adding new cards */
  4885. +typedef struct icn_cdef {
  4886. +        int port;
  4887. +        char id1[10];
  4888. +        char id2[10];
  4889. +} icn_cdef;
  4890.  
  4891.  #if defined(__KERNEL__) || defined(__DEBUGVAR__)
  4892.  
  4893. @@ -98,7 +121,7 @@
  4894.  #include <linux/wait.h>
  4895.  #include <linux/isdnif.h>
  4896.  
  4897. -#endif                /* __KERNEL__ */
  4898. +#endif /* __KERNEL__ */
  4899.  
  4900.  /* some useful macros for debugging */
  4901.  #ifdef ICN_DEBUG_PORT
  4902. @@ -112,177 +135,190 @@
  4903.  #define ICN_PORTLEN (0x04)
  4904.  #define ICN_MEMADDR 0x0d0000
  4905.  
  4906. -/* Macros for accessing ports */
  4907. -#define ICN_CFG    (dev->port)
  4908. -#define ICN_MAPRAM (dev->port+1)
  4909. -#define ICN_RUN    (dev->port+2)
  4910. -#define ICN_BANK   (dev->port+3)
  4911. -
  4912. -#define ICN_FLAGS_B1ACTIVE 1    /* B-Channel-1 is open                 */
  4913. -#define ICN_FLAGS_B2ACTIVE 2    /* B-Channel-2 is open                 */
  4914. -#define ICN_FLAGS_RBTIMER  8    /* cyclic scheduling of B-Channel-poll */
  4915. -
  4916. -#define ICN_BOOT_TIMEOUT1  100    /* Delay for Boot-download (jiffies)   */
  4917. -#define ICN_CHANLOCK_DELAY  10    /* Delay for Channel-mapping (jiffies) */
  4918. -
  4919. -#define ICN_TIMER_BCREAD 3    /* B-Channel poll-cycle                */
  4920. -#define ICN_TIMER_DCREAD 50    /* D-Channel poll-cycle                */
  4921. -
  4922. -#define ICN_CODE_STAGE1 4096    /* Size of bootcode                    */
  4923. -#define ICN_CODE_STAGE2 65536    /* Size of protocol-code               */
  4924. -
  4925. -#define ICN_MAX_SQUEUE 65536    /* Max. outstanding send-data          */
  4926. -#define ICN_FRAGSIZE (250)    /* Max. size of send-fragments         */
  4927. -#define ICN_BCH 2        /* Number of supported channels        */
  4928. +#define ICN_FLAGS_B1ACTIVE 1     /* B-Channel-1 is open                     */
  4929. +#define ICN_FLAGS_B2ACTIVE 2     /* B-Channel-2 is open                     */
  4930. +#define ICN_FLAGS_RUNNING  4     /* Cards driver activated                  */
  4931. +#define ICN_FLAGS_RBTIMER  8     /* cyclic scheduling of B-Channel-poll     */
  4932. +
  4933. +#define ICN_BOOT_TIMEOUT1  100   /* Delay for Boot-download (jiffies)       */
  4934. +#define ICN_CHANLOCK_DELAY  10   /* Delay for Channel-mapping (jiffies)     */
  4935. +
  4936. +#define ICN_TIMER_BCREAD 3       /* B-Channel poll-cycle                    */
  4937. +#define ICN_TIMER_DCREAD 50      /* D-Channel poll-cycle                    */
  4938. +
  4939. +#define ICN_CODE_STAGE1 4096     /* Size of bootcode                        */
  4940. +#define ICN_CODE_STAGE2 65536    /* Size of protocol-code                   */
  4941. +
  4942. +#define ICN_MAX_SQUEUE 65536     /* Max. outstanding send-data              */
  4943. +#define ICN_FRAGSIZE (250)       /* Max. size of send-fragments             */
  4944. +#define ICN_BCH 2                /* Number of supported channels per card   */
  4945.  
  4946.  /* type-definitions for accessing the mmap-io-areas */
  4947.  
  4948. -#define SHM_DCTL_OFFSET (0)    /* Offset to data-controlstructures in shm */
  4949. -#define SHM_CCTL_OFFSET (0x1d2)    /* Offset to comm-controlstructures in shm */
  4950. -#define SHM_CBUF_OFFSET (0x200)    /* Offset to comm-buffers in shm           */
  4951. -#define SHM_DBUF_OFFSET (0x2000)    /* Offset to data-buffers in shm           */
  4952. +#define SHM_DCTL_OFFSET (0)      /* Offset to data-controlstructures in shm */
  4953. +#define SHM_CCTL_OFFSET (0x1d2)  /* Offset to comm-controlstructures in shm */
  4954. +#define SHM_CBUF_OFFSET (0x200)  /* Offset to comm-buffers in shm           */
  4955. +#define SHM_DBUF_OFFSET (0x2000) /* Offset to data-buffers in shm           */
  4956.  
  4957. +/*
  4958. + * Layout of card's data buffers
  4959. + */
  4960.  typedef struct {
  4961. -    unsigned char length;    /* Bytecount of fragment (max 250)     */
  4962. -    unsigned char endflag;    /* 0=last frag., 0xff=frag. continued  */
  4963. -    unsigned char data[ICN_FRAGSIZE];    /* The data                            */
  4964. -    /* Fill to 256 bytes */
  4965. -    char unused[0x100 - ICN_FRAGSIZE - 2];
  4966. +        unsigned char length;             /* Bytecount of fragment (max 250)    */
  4967. +        unsigned char endflag;            /* 0=last frag., 0xff=frag. continued */
  4968. +        unsigned char data[ICN_FRAGSIZE]; /* The data                           */
  4969. +        /* Fill to 256 bytes */
  4970. +        char unused[0x100 - ICN_FRAGSIZE - 2];
  4971.  } frag_buf;
  4972.  
  4973. +/*
  4974. + * Layout of card's shared memory
  4975. + */
  4976.  typedef union {
  4977. -    struct {
  4978. -        unsigned char scns;    /* Index to free SendFrag.             */
  4979. -        unsigned char scnr;    /* Index to active SendFrag   READONLY */
  4980. -        unsigned char ecns;    /* Index to free RcvFrag.     READONLY */
  4981. -        unsigned char ecnr;    /* Index to valid RcvFrag              */
  4982. -        char unused[6];
  4983. -        unsigned short fuell1;    /* Internal Buf Bytecount              */
  4984. -    } data_control;
  4985. -    struct {
  4986. -        char unused[SHM_CCTL_OFFSET];
  4987. -        unsigned char iopc_i;    /* Read-Ptr Status-Queue      READONLY */
  4988. -        unsigned char iopc_o;    /* Write-Ptr Status-Queue              */
  4989. -        unsigned char pcio_i;    /* Write-Ptr Command-Queue             */
  4990. -        unsigned char pcio_o;    /* Read-Ptr Command Queue     READONLY */
  4991. -    } comm_control;
  4992. -    struct {
  4993. -        char unused[SHM_CBUF_OFFSET];
  4994. -        unsigned char pcio_buf[0x100];    /* Ring-Buffer Command-Queue           */
  4995. -        unsigned char iopc_buf[0x100];    /* Ring-Buffer Status-Queue            */
  4996. -    } comm_buffers;
  4997. -    struct {
  4998. -        char unused[SHM_DBUF_OFFSET];
  4999. -        frag_buf receive_buf[0x10];
  5000. -        frag_buf send_buf[0x10];
  5001. -    } data_buffers;
  5002. +        struct {
  5003. +                unsigned char scns;            /* Index to free SendFrag.             */
  5004. +                unsigned char scnr;            /* Index to active SendFrag   READONLY */
  5005. +                unsigned char ecns;            /* Index to free RcvFrag.     READONLY */
  5006. +                unsigned char ecnr;            /* Index to valid RcvFrag              */
  5007. +                char unused[6];
  5008. +                unsigned short fuell1;         /* Internal Buf Bytecount              */
  5009. +        } data_control;
  5010. +        struct {
  5011. +                char unused[SHM_CCTL_OFFSET];
  5012. +                unsigned char iopc_i;          /* Read-Ptr Status-Queue      READONLY */
  5013. +                unsigned char iopc_o;          /* Write-Ptr Status-Queue              */
  5014. +                unsigned char pcio_i;          /* Write-Ptr Command-Queue             */
  5015. +                unsigned char pcio_o;          /* Read-Ptr Command Queue     READONLY */
  5016. +        } comm_control;
  5017. +        struct {
  5018. +                char unused[SHM_CBUF_OFFSET];
  5019. +                unsigned char pcio_buf[0x100]; /* Ring-Buffer Command-Queue           */
  5020. +                unsigned char iopc_buf[0x100]; /* Ring-Buffer Status-Queue            */
  5021. +        } comm_buffers;
  5022. +        struct {
  5023. +                char unused[SHM_DBUF_OFFSET];
  5024. +                frag_buf receive_buf[0x10];
  5025. +                frag_buf send_buf[0x10];
  5026. +        } data_buffers;
  5027.  } icn_shmem;
  5028.  
  5029. -/* Sendbuffer-queue-element */
  5030. -typedef struct {
  5031. -    char *next;
  5032. -    short length;
  5033. -    short size;
  5034. -    u_char *rptr;
  5035. -    u_char buffer[1];
  5036. -} pqueue;
  5037. +/*
  5038. + * Per card driver data
  5039. + */
  5040. +typedef struct icn_card {
  5041. +        struct icn_card *next;        /* Pointer to next device struct    */
  5042. +        struct icn_card *other;       /* Pointer to other card for ICN4B  */
  5043. +        unsigned short port;          /* Base-port-address                */
  5044. +        int myid;                     /* Driver-Nr. assigned by linklevel */
  5045. +        int rvalid;                   /* IO-portregion has been requested */
  5046. +        int leased;                   /* Flag: This Adapter is connected  */
  5047. +                                      /*       to a leased line           */
  5048. +        unsigned short flags;         /* Statusflags                      */
  5049. +        int doubleS0;                 /* Flag: ICN4B                      */
  5050. +        int secondhalf;               /* Flag: Second half of a doubleS0  */
  5051. +        int fw_rev;                   /* Firmware revision loaded         */
  5052. +        int ptype;                    /* Protocol type (1TR6 or Euro)     */
  5053. +        struct timer_list st_timer;   /* Timer for Status-Polls           */
  5054. +        struct timer_list rb_timer;   /* Timer for B-Channel-Polls        */
  5055. +        u_char rcvbuf[ICN_BCH][4096]; /* B-Channel-Receive-Buffers        */
  5056. +        int rcvidx[ICN_BCH];          /* Index for above buffers          */
  5057. +        int l2_proto[ICN_BCH];        /* Current layer-2-protocol         */
  5058. +        isdn_if interface;            /* Interface to upper layer         */
  5059. +        int iptr;                     /* Index to imsg-buffer             */
  5060. +        char imsg[60];                /* Internal buf for status-parsing  */
  5061. +        char msg_buf[2048];           /* Buffer for status-messages       */
  5062. +        char *msg_buf_write;          /* Writepointer for statusbuffer    */
  5063. +        char *msg_buf_read;           /* Readpointer for statusbuffer     */
  5064. +        char *msg_buf_end;            /* Pointer to end of statusbuffer   */
  5065. +        int sndcount[ICN_BCH];        /* Byte-counters for B-Ch.-send     */
  5066. +        struct sk_buff_head
  5067. +                spqueue[ICN_BCH];     /* Sendqueue                        */
  5068. +        char regname[35];             /* Name used for request_region     */
  5069. +} icn_card;
  5070.  
  5071. -typedef struct {
  5072. -    unsigned short port;    /* Base-port-address                */
  5073. -    icn_shmem *shmem;    /* Pointer to memory-mapped-buffers */
  5074. -    int myid;        /* Driver-Nr. assigned by linklevel */
  5075. -    int rvalid;        /* IO-portregion has been requested */
  5076. -    int mvalid;        /* IO-shmem has been requested      */
  5077. -    int leased;        /* Flag: This Adapter is connected  */
  5078. -    /*       to a leased line           */
  5079. -    unsigned short flags;    /* Statusflags                      */
  5080. -    int doubleS0;        /* Flag: Double-S0-Card             */
  5081. -    int secondhalf;        /* Flag: Second half of a doubleS0  */
  5082. -    int ptype;        /* Protocol type (1TR6 or Euro)     */
  5083. -    struct timer_list st_timer;    /* Timer for Status-Polls           */
  5084. -    struct timer_list rb_timer;    /* Timer for B-Channel-Polls        */
  5085. -    int channel;        /* Currently mapped Channel         */
  5086. -    int chanlock;        /* Semaphore for Channel-Mapping    */
  5087. -    u_char rcvbuf[ICN_BCH][4096];    /* B-Channel-Receive-Buffers      */
  5088. -    int rcvidx[ICN_BCH];    /* Index for above buffers          */
  5089. -    int l2_proto[ICN_BCH];    /* Current layer-2-protocol         */
  5090. -    isdn_if interface;    /* Interface to upper layer         */
  5091. -    int iptr;        /* Index to imsg-buffer             */
  5092. -    char imsg[60];        /* Internal buf for status-parsing  */
  5093. -    char msg_buf[2048];    /* Buffer for status-messages       */
  5094. -    char *msg_buf_write;    /* Writepointer for statusbuffer    */
  5095. -    char *msg_buf_read;    /* Readpointer for statusbuffer     */
  5096. -    char *msg_buf_end;    /* Pointer to end of statusbuffer   */
  5097. -    int sndcount[ICN_BCH];    /* Byte-counters for B-Ch.-send     */
  5098. -    pqueue *spqueue[ICN_BCH];    /* Pointers to start of Send-Queue  */
  5099. -#ifdef DEBUG_RCVCALLBACK
  5100. -    int akt_pending[ICN_BCH];
  5101. -    int max_pending[ICN_BCH];
  5102. -#endif
  5103. +/*
  5104. + * Main driver data
  5105. + */
  5106. +typedef struct icn_dev {
  5107. +        icn_shmem *shmem;             /* Pointer to memory-mapped-buffers */
  5108. +        int mvalid;                   /* IO-shmem has been requested      */
  5109. +        int channel;                  /* Currently mapped channel         */
  5110. +        struct icn_card *mcard;       /* Currently mapped card            */
  5111. +        int chanlock;                 /* Semaphore for channel-mapping    */
  5112.  } icn_dev;
  5113.  
  5114.  typedef icn_dev *icn_devptr;
  5115.  
  5116.  #ifdef __KERNEL__
  5117. -static icn_dev *dev = (icn_dev *) 0;
  5118. -static icn_dev *dev2 = (icn_dev *) 0;
  5119. +
  5120. +static icn_card *cards  = (icn_card *) 0;
  5121. +static u_char   chan2bank[] = { 0, 4, 8, 12 }; /* for icn_map_channel() */ 
  5122. +
  5123. +static icn_dev  dev;
  5124.  
  5125.  /* With modutils >= 1.1.67 Integers can be changed while loading a
  5126.   * module. For this reason define the Port-Base an Shmem-Base as
  5127.   * integers.
  5128.   */
  5129. -int portbase = ICN_BASEADDR;
  5130. -int membase = ICN_MEMADDR;
  5131. -char *icn_id = "\0";
  5132. +int portbase  = ICN_BASEADDR;
  5133. +int membase   = ICN_MEMADDR;
  5134. +char *icn_id  = "\0";
  5135.  char *icn_id2 = "\0";
  5136. -static char regname[35];    /* Name used for port/mem-registration */
  5137.  
  5138. -#endif                /* __KERNEL__ */
  5139. +#endif                                /* __KERNEL__ */
  5140.  
  5141.  /* Utility-Macros */
  5142.  
  5143. +/* Macros for accessing ports */
  5144. +#define ICN_CFG    (card->port)
  5145. +#define ICN_MAPRAM (card->port+1)
  5146. +#define ICN_RUN    (card->port+2)
  5147. +#define ICN_BANK   (card->port+3)
  5148. +
  5149.  /* Return true, if there is a free transmit-buffer */
  5150. -#define sbfree (((dev->shmem->data_control.scns+1) & 0xf) != \
  5151. -                dev->shmem->data_control.scnr)
  5152. +#define sbfree (((dev.shmem->data_control.scns+1) & 0xf) != \
  5153. +                dev.shmem->data_control.scnr)
  5154.  
  5155.  /* Switch to next transmit-buffer */
  5156. -#define sbnext (dev->shmem->data_control.scns = \
  5157. -               ((dev->shmem->data_control.scns+1) & 0xf))
  5158. +#define sbnext (dev.shmem->data_control.scns = \
  5159. +               ((dev.shmem->data_control.scns+1) & 0xf))
  5160.  
  5161.  /* Shortcuts for transmit-buffer-access */
  5162. -#define sbuf_n dev->shmem->data_control.scns
  5163. -#define sbuf_d dev->shmem->data_buffers.send_buf[sbuf_n].data
  5164. -#define sbuf_l dev->shmem->data_buffers.send_buf[sbuf_n].length
  5165. -#define sbuf_f dev->shmem->data_buffers.send_buf[sbuf_n].endflag
  5166. +#define sbuf_n dev.shmem->data_control.scns
  5167. +#define sbuf_d dev.shmem->data_buffers.send_buf[sbuf_n].data
  5168. +#define sbuf_l dev.shmem->data_buffers.send_buf[sbuf_n].length
  5169. +#define sbuf_f dev.shmem->data_buffers.send_buf[sbuf_n].endflag
  5170.  
  5171.  /* Return true, if there is receive-data is available */
  5172. -#define rbavl  (dev->shmem->data_control.ecnr != \
  5173. -                dev->shmem->data_control.ecns)
  5174. +#define rbavl  (dev.shmem->data_control.ecnr != \
  5175. +                dev.shmem->data_control.ecns)
  5176.  
  5177.  /* Switch to next receive-buffer */
  5178. -#define rbnext (dev->shmem->data_control.ecnr = \
  5179. -               ((dev->shmem->data_control.ecnr+1) & 0xf))
  5180. +#define rbnext (dev.shmem->data_control.ecnr = \
  5181. +               ((dev.shmem->data_control.ecnr+1) & 0xf))
  5182.  
  5183.  /* Shortcuts for receive-buffer-access */
  5184. -#define rbuf_n dev->shmem->data_control.ecnr
  5185. -#define rbuf_d dev->shmem->data_buffers.receive_buf[rbuf_n].data
  5186. -#define rbuf_l dev->shmem->data_buffers.receive_buf[rbuf_n].length
  5187. -#define rbuf_f dev->shmem->data_buffers.receive_buf[rbuf_n].endflag
  5188. +#define rbuf_n dev.shmem->data_control.ecnr
  5189. +#define rbuf_d dev.shmem->data_buffers.receive_buf[rbuf_n].data
  5190. +#define rbuf_l dev.shmem->data_buffers.receive_buf[rbuf_n].length
  5191. +#define rbuf_f dev.shmem->data_buffers.receive_buf[rbuf_n].endflag
  5192.  
  5193.  /* Shortcuts for command-buffer-access */
  5194. -#define cmd_o (dev->shmem->comm_control.pcio_o)
  5195. -#define cmd_i (dev->shmem->comm_control.pcio_i)
  5196. +#define cmd_o (dev.shmem->comm_control.pcio_o)
  5197. +#define cmd_i (dev.shmem->comm_control.pcio_i)
  5198.  
  5199.  /* Return free space in command-buffer */
  5200.  #define cmd_free ((cmd_i>=cmd_o)?0x100-cmd_i+cmd_o:cmd_o-cmd_i)
  5201.  
  5202.  /* Shortcuts for message-buffer-access */
  5203. -#define msg_o (dev->shmem->comm_control.iopc_o)
  5204. -#define msg_i (dev->shmem->comm_control.iopc_i)
  5205. +#define msg_o (dev.shmem->comm_control.iopc_o)
  5206. +#define msg_i (dev.shmem->comm_control.iopc_i)
  5207.  
  5208.  /* Return length of Message, if avail. */
  5209.  #define msg_avail ((msg_o>msg_i)?0x100-msg_o+msg_i:msg_i-msg_o)
  5210.  
  5211. +#define CID (card->interface.id)
  5212. +
  5213.  #define MIN(a,b) ((a<b)?a:b)
  5214.  #define MAX(a,b) ((a>b)?a:b)
  5215.  
  5216. @@ -294,5 +330,5 @@
  5217.  #define release_shmem release_region
  5218.  #define request_shmem request_region
  5219.  
  5220. -#endif                /* defined(__KERNEL__) || defined(__DEBUGVAR__) */
  5221. -#endif                /* icn_h */
  5222. +#endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */
  5223. +#endif /* icn_h */
  5224. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_audio.c linux/drivers/isdn/isdn_audio.c
  5225. --- pre2.0.5/linux/drivers/isdn/isdn_audio.c    Thu Jan  1 02:00:00 1970
  5226. +++ linux/drivers/isdn/isdn_audio.c    Sun May 19 15:29:29 1996
  5227. @@ -0,0 +1,428 @@
  5228. +/* $Id: isdn_audio.c,v 1.4 1996/05/17 03:48:01 fritz Exp $
  5229. + *
  5230. + * Linux ISDN subsystem, audio conversion and compression (linklevel).
  5231. + *
  5232. + * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de)
  5233. + * 
  5234. + * This program is free software; you can redistribute it and/or modify
  5235. + * it under the terms of the GNU General Public License as published by
  5236. + * the Free Software Foundation; either version 2, or (at your option)
  5237. + * any later version.
  5238. + *
  5239. + * This program is distributed in the hope that it will be useful,
  5240. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5241. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5242. + * GNU General Public License for more details.
  5243. + *
  5244. + * You should have received a copy of the GNU General Public License
  5245. + * along with this program; if not, write to the Free Software
  5246. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  5247. + *
  5248. + * $Log: isdn_audio.c,v $
  5249. + * Revision 1.4  1996/05/17 03:48:01  fritz
  5250. + * Removed some test statements.
  5251. + * Added revision string.
  5252. + *
  5253. + * Revision 1.3  1996/05/10 08:48:11  fritz
  5254. + * Corrected adpcm bugs.
  5255. + *
  5256. + * Revision 1.2  1996/04/30 09:31:17  fritz
  5257. + * General rewrite.
  5258. + *
  5259. + * Revision 1.1.1.1  1996/04/28 12:25:40  fritz
  5260. + * Taken under CVS control
  5261. + *
  5262. + */
  5263. +
  5264. +#define __NO_VERSION__
  5265. +#include <linux/module.h>
  5266. +#include <linux/isdn.h>
  5267. +#include "isdn_audio.h"
  5268. +
  5269. +char *isdn_audio_revision        = "$Revision: 1.4 $";
  5270. +
  5271. +/*
  5272. + * Misc. lookup-tables.
  5273. + */
  5274. +
  5275. +/* ulaw -> signed 16-bit */
  5276. +static short isdn_audio_ulaw_to_s16[] = {
  5277. +        0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84,
  5278. +        0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84,
  5279. +        0xc184, 0xc384, 0xc584, 0xc784, 0xc984, 0xcb84, 0xcd84, 0xcf84,
  5280. +        0xd184, 0xd384, 0xd584, 0xd784, 0xd984, 0xdb84, 0xdd84, 0xdf84,
  5281. +        0xe104, 0xe204, 0xe304, 0xe404, 0xe504, 0xe604, 0xe704, 0xe804,
  5282. +        0xe904, 0xea04, 0xeb04, 0xec04, 0xed04, 0xee04, 0xef04, 0xf004,
  5283. +        0xf0c4, 0xf144, 0xf1c4, 0xf244, 0xf2c4, 0xf344, 0xf3c4, 0xf444,
  5284. +        0xf4c4, 0xf544, 0xf5c4, 0xf644, 0xf6c4, 0xf744, 0xf7c4, 0xf844,
  5285. +        0xf8a4, 0xf8e4, 0xf924, 0xf964, 0xf9a4, 0xf9e4, 0xfa24, 0xfa64,
  5286. +        0xfaa4, 0xfae4, 0xfb24, 0xfb64, 0xfba4, 0xfbe4, 0xfc24, 0xfc64,
  5287. +        0xfc94, 0xfcb4, 0xfcd4, 0xfcf4, 0xfd14, 0xfd34, 0xfd54, 0xfd74,
  5288. +        0xfd94, 0xfdb4, 0xfdd4, 0xfdf4, 0xfe14, 0xfe34, 0xfe54, 0xfe74,
  5289. +        0xfe8c, 0xfe9c, 0xfeac, 0xfebc, 0xfecc, 0xfedc, 0xfeec, 0xfefc,
  5290. +        0xff0c, 0xff1c, 0xff2c, 0xff3c, 0xff4c, 0xff5c, 0xff6c, 0xff7c,
  5291. +        0xff88, 0xff90, 0xff98, 0xffa0, 0xffa8, 0xffb0, 0xffb8, 0xffc0,
  5292. +        0xffc8, 0xffd0, 0xffd8, 0xffe0, 0xffe8, 0xfff0, 0xfff8, 0x0000,
  5293. +        0x7d7c, 0x797c, 0x757c, 0x717c, 0x6d7c, 0x697c, 0x657c, 0x617c,
  5294. +        0x5d7c, 0x597c, 0x557c, 0x517c, 0x4d7c, 0x497c, 0x457c, 0x417c,
  5295. +        0x3e7c, 0x3c7c, 0x3a7c, 0x387c, 0x367c, 0x347c, 0x327c, 0x307c,
  5296. +        0x2e7c, 0x2c7c, 0x2a7c, 0x287c, 0x267c, 0x247c, 0x227c, 0x207c,
  5297. +        0x1efc, 0x1dfc, 0x1cfc, 0x1bfc, 0x1afc, 0x19fc, 0x18fc, 0x17fc,
  5298. +        0x16fc, 0x15fc, 0x14fc, 0x13fc, 0x12fc, 0x11fc, 0x10fc, 0x0ffc,
  5299. +        0x0f3c, 0x0ebc, 0x0e3c, 0x0dbc, 0x0d3c, 0x0cbc, 0x0c3c, 0x0bbc,
  5300. +        0x0b3c, 0x0abc, 0x0a3c, 0x09bc, 0x093c, 0x08bc, 0x083c, 0x07bc,
  5301. +        0x075c, 0x071c, 0x06dc, 0x069c, 0x065c, 0x061c, 0x05dc, 0x059c,
  5302. +        0x055c, 0x051c, 0x04dc, 0x049c, 0x045c, 0x041c, 0x03dc, 0x039c,
  5303. +        0x036c, 0x034c, 0x032c, 0x030c, 0x02ec, 0x02cc, 0x02ac, 0x028c,
  5304. +        0x026c, 0x024c, 0x022c, 0x020c, 0x01ec, 0x01cc, 0x01ac, 0x018c,
  5305. +        0x0174, 0x0164, 0x0154, 0x0144, 0x0134, 0x0124, 0x0114, 0x0104,
  5306. +        0x00f4, 0x00e4, 0x00d4, 0x00c4, 0x00b4, 0x00a4, 0x0094, 0x0084,
  5307. +        0x0078, 0x0070, 0x0068, 0x0060, 0x0058, 0x0050, 0x0048, 0x0040,
  5308. +        0x0038, 0x0030, 0x0028, 0x0020, 0x0018, 0x0010, 0x0008, 0x0000
  5309. +};
  5310. +
  5311. +/* alaw -> signed 16-bit */
  5312. +static short isdn_audio_alaw_to_s16[] = {
  5313. +        0x13fc, 0xec04, 0x0144, 0xfebc, 0x517c, 0xae84, 0x051c, 0xfae4,
  5314. +        0x0a3c, 0xf5c4, 0x0048, 0xffb8, 0x287c, 0xd784, 0x028c, 0xfd74,
  5315. +        0x1bfc, 0xe404, 0x01cc, 0xfe34, 0x717c, 0x8e84, 0x071c, 0xf8e4,
  5316. +        0x0e3c, 0xf1c4, 0x00c4, 0xff3c, 0x387c, 0xc784, 0x039c, 0xfc64,
  5317. +        0x0ffc, 0xf004, 0x0104, 0xfefc, 0x417c, 0xbe84, 0x041c, 0xfbe4,
  5318. +        0x083c, 0xf7c4, 0x0008, 0xfff8, 0x207c, 0xdf84, 0x020c, 0xfdf4,
  5319. +        0x17fc, 0xe804, 0x018c, 0xfe74, 0x617c, 0x9e84, 0x061c, 0xf9e4,
  5320. +        0x0c3c, 0xf3c4, 0x0084, 0xff7c, 0x307c, 0xcf84, 0x030c, 0xfcf4,
  5321. +        0x15fc, 0xea04, 0x0164, 0xfe9c, 0x597c, 0xa684, 0x059c, 0xfa64,
  5322. +        0x0b3c, 0xf4c4, 0x0068, 0xff98, 0x2c7c, 0xd384, 0x02cc, 0xfd34,
  5323. +        0x1dfc, 0xe204, 0x01ec, 0xfe14, 0x797c, 0x8684, 0x07bc, 0xf844,
  5324. +        0x0f3c, 0xf0c4, 0x00e4, 0xff1c, 0x3c7c, 0xc384, 0x03dc, 0xfc24,
  5325. +        0x11fc, 0xee04, 0x0124, 0xfedc, 0x497c, 0xb684, 0x049c, 0xfb64,
  5326. +        0x093c, 0xf6c4, 0x0028, 0xffd8, 0x247c, 0xdb84, 0x024c, 0xfdb4,
  5327. +        0x19fc, 0xe604, 0x01ac, 0xfe54, 0x697c, 0x9684, 0x069c, 0xf964,
  5328. +        0x0d3c, 0xf2c4, 0x00a4, 0xff5c, 0x347c, 0xcb84, 0x034c, 0xfcb4,
  5329. +        0x12fc, 0xed04, 0x0134, 0xfecc, 0x4d7c, 0xb284, 0x04dc, 0xfb24,
  5330. +        0x09bc, 0xf644, 0x0038, 0xffc8, 0x267c, 0xd984, 0x026c, 0xfd94,
  5331. +        0x1afc, 0xe504, 0x01ac, 0xfe54, 0x6d7c, 0x9284, 0x06dc, 0xf924,
  5332. +        0x0dbc, 0xf244, 0x00b4, 0xff4c, 0x367c, 0xc984, 0x036c, 0xfc94,
  5333. +        0x0f3c, 0xf0c4, 0x00f4, 0xff0c, 0x3e7c, 0xc184, 0x03dc, 0xfc24,
  5334. +        0x07bc, 0xf844, 0x0008, 0xfff8, 0x1efc, 0xe104, 0x01ec, 0xfe14,
  5335. +        0x16fc, 0xe904, 0x0174, 0xfe8c, 0x5d7c, 0xa284, 0x05dc, 0xfa24,
  5336. +        0x0bbc, 0xf444, 0x0078, 0xff88, 0x2e7c, 0xd184, 0x02ec, 0xfd14,
  5337. +        0x14fc, 0xeb04, 0x0154, 0xfeac, 0x557c, 0xaa84, 0x055c, 0xfaa4,
  5338. +        0x0abc, 0xf544, 0x0058, 0xffa8, 0x2a7c, 0xd584, 0x02ac, 0xfd54,
  5339. +        0x1cfc, 0xe304, 0x01cc, 0xfe34, 0x757c, 0x8a84, 0x075c, 0xf8a4,
  5340. +        0x0ebc, 0xf144, 0x00d4, 0xff2c, 0x3a7c, 0xc584, 0x039c, 0xfc64,
  5341. +        0x10fc, 0xef04, 0x0114, 0xfeec, 0x457c, 0xba84, 0x045c, 0xfba4,
  5342. +        0x08bc, 0xf744, 0x0018, 0xffe8, 0x227c, 0xdd84, 0x022c, 0xfdd4,
  5343. +        0x18fc, 0xe704, 0x018c, 0xfe74, 0x657c, 0x9a84, 0x065c, 0xf9a4,
  5344. +        0x0cbc, 0xf344, 0x0094, 0xff6c, 0x327c, 0xcd84, 0x032c, 0xfcd4
  5345. +};
  5346. +
  5347. +/* alaw -> ulaw */
  5348. +static char isdn_audio_alaw_to_ulaw[] = {
  5349. +        0xab, 0x2b, 0xe3, 0x63, 0x8b, 0x0b, 0xc9, 0x49,
  5350. +        0xba, 0x3a, 0xf6, 0x76, 0x9b, 0x1b, 0xd7, 0x57,
  5351. +        0xa3, 0x23, 0xdd, 0x5d, 0x83, 0x03, 0xc1, 0x41,
  5352. +        0xb2, 0x32, 0xeb, 0x6b, 0x93, 0x13, 0xcf, 0x4f,
  5353. +        0xaf, 0x2f, 0xe7, 0x67, 0x8f, 0x0f, 0xcd, 0x4d,
  5354. +        0xbe, 0x3e, 0xfe, 0x7e, 0x9f, 0x1f, 0xdb, 0x5b,
  5355. +        0xa7, 0x27, 0xdf, 0x5f, 0x87, 0x07, 0xc5, 0x45,
  5356. +        0xb6, 0x36, 0xef, 0x6f, 0x97, 0x17, 0xd3, 0x53,
  5357. +        0xa9, 0x29, 0xe1, 0x61, 0x89, 0x09, 0xc7, 0x47,
  5358. +        0xb8, 0x38, 0xf2, 0x72, 0x99, 0x19, 0xd5, 0x55,
  5359. +        0xa1, 0x21, 0xdc, 0x5c, 0x81, 0x01, 0xbf, 0x3f,
  5360. +        0xb0, 0x30, 0xe9, 0x69, 0x91, 0x11, 0xce, 0x4e,
  5361. +        0xad, 0x2d, 0xe5, 0x65, 0x8d, 0x0d, 0xcb, 0x4b,
  5362. +        0xbc, 0x3c, 0xfa, 0x7a, 0x9d, 0x1d, 0xd9, 0x59,
  5363. +        0xa5, 0x25, 0xde, 0x5e, 0x85, 0x05, 0xc3, 0x43,
  5364. +        0xb4, 0x34, 0xed, 0x6d, 0x95, 0x15, 0xd1, 0x51,
  5365. +        0xac, 0x2c, 0xe4, 0x64, 0x8c, 0x0c, 0xca, 0x4a,
  5366. +        0xbb, 0x3b, 0xf8, 0x78, 0x9c, 0x1c, 0xd8, 0x58,
  5367. +        0xa4, 0x24, 0xde, 0x5e, 0x84, 0x04, 0xc2, 0x42,
  5368. +        0xb3, 0x33, 0xec, 0x6c, 0x94, 0x14, 0xd0, 0x50,
  5369. +        0xb0, 0x30, 0xe8, 0x68, 0x90, 0x10, 0xce, 0x4e,
  5370. +        0xbf, 0x3f, 0xfe, 0x7e, 0xa0, 0x20, 0xdc, 0x5c,
  5371. +        0xa8, 0x28, 0xe0, 0x60, 0x88, 0x08, 0xc6, 0x46,
  5372. +        0xb7, 0x37, 0xf0, 0x70, 0x98, 0x18, 0xd4, 0x54,
  5373. +        0xaa, 0x2a, 0xe2, 0x62, 0x8a, 0x0a, 0xc8, 0x48,
  5374. +        0xb9, 0x39, 0xf4, 0x74, 0x9a, 0x1a, 0xd6, 0x56,
  5375. +        0xa2, 0x22, 0xdd, 0x5d, 0x82, 0x02, 0xc0, 0x40,
  5376. +        0xb1, 0x31, 0xea, 0x6a, 0x92, 0x12, 0xcf, 0x4f,
  5377. +        0xae, 0x2e, 0xe6, 0x66, 0x8e, 0x0e, 0xcc, 0x4c,
  5378. +        0xbd, 0x3d, 0xfc, 0x7c, 0x9e, 0x1e, 0xda, 0x5a,
  5379. +        0xa6, 0x26, 0xdf, 0x5f, 0x86, 0x06, 0xc4, 0x44,
  5380. +        0xb5, 0x35, 0xee, 0x6e, 0x96, 0x16, 0xd2, 0x52
  5381. +};
  5382. +
  5383. +/* ulaw -> alaw */
  5384. +static char isdn_audio_ulaw_to_alaw[] = {
  5385. +        0xab, 0x55, 0xd5, 0x15, 0x95, 0x75, 0xf5, 0x35,
  5386. +        0xb5, 0x45, 0xc5, 0x05, 0x85, 0x65, 0xe5, 0x25,
  5387. +        0xa5, 0x5d, 0xdd, 0x1d, 0x9d, 0x7d, 0xfd, 0x3d,
  5388. +        0xbd, 0x4d, 0xcd, 0x0d, 0x8d, 0x6d, 0xed, 0x2d,
  5389. +        0xad, 0x51, 0xd1, 0x11, 0x91, 0x71, 0xf1, 0x31,
  5390. +        0xb1, 0x41, 0xc1, 0x01, 0x81, 0x61, 0xe1, 0x21,
  5391. +        0x59, 0xd9, 0x19, 0x99, 0x79, 0xf9, 0x39, 0xb9,
  5392. +        0x49, 0xc9, 0x09, 0x89, 0x69, 0xe9, 0x29, 0xa9,
  5393. +        0xd7, 0x17, 0x97, 0x77, 0xf7, 0x37, 0xb7, 0x47,
  5394. +        0xc7, 0x07, 0x87, 0x67, 0xe7, 0x27, 0xa7, 0xdf,
  5395. +        0x9f, 0x7f, 0xff, 0x3f, 0xbf, 0x4f, 0xcf, 0x0f,
  5396. +        0x8f, 0x6f, 0xef, 0x2f, 0x53, 0x13, 0x73, 0x33,
  5397. +        0xb3, 0x43, 0xc3, 0x03, 0x83, 0x63, 0xe3, 0x23,
  5398. +        0xa3, 0x5b, 0xdb, 0x1b, 0x9b, 0x7b, 0xfb, 0x3b,
  5399. +        0xbb, 0xbb, 0x4b, 0x4b, 0xcb, 0xcb, 0x0b, 0x0b,
  5400. +        0x8b, 0x8b, 0x6b, 0x6b, 0xeb, 0xeb, 0x2b, 0x2b,
  5401. +        0xab, 0x54, 0xd4, 0x14, 0x94, 0x74, 0xf4, 0x34,
  5402. +        0xb4, 0x44, 0xc4, 0x04, 0x84, 0x64, 0xe4, 0x24,
  5403. +        0xa4, 0x5c, 0xdc, 0x1c, 0x9c, 0x7c, 0xfc, 0x3c,
  5404. +        0xbc, 0x4c, 0xcc, 0x0c, 0x8c, 0x6c, 0xec, 0x2c,
  5405. +        0xac, 0x50, 0xd0, 0x10, 0x90, 0x70, 0xf0, 0x30,
  5406. +        0xb0, 0x40, 0xc0, 0x00, 0x80, 0x60, 0xe0, 0x20,
  5407. +        0x58, 0xd8, 0x18, 0x98, 0x78, 0xf8, 0x38, 0xb8,
  5408. +        0x48, 0xc8, 0x08, 0x88, 0x68, 0xe8, 0x28, 0xa8,
  5409. +        0xd6, 0x16, 0x96, 0x76, 0xf6, 0x36, 0xb6, 0x46,
  5410. +        0xc6, 0x06, 0x86, 0x66, 0xe6, 0x26, 0xa6, 0xde,
  5411. +        0x9e, 0x7e, 0xfe, 0x3e, 0xbe, 0x4e, 0xce, 0x0e,
  5412. +        0x8e, 0x6e, 0xee, 0x2e, 0x52, 0x12, 0x72, 0x32,
  5413. +        0xb2, 0x42, 0xc2, 0x02, 0x82, 0x62, 0xe2, 0x22,
  5414. +        0xa2, 0x5a, 0xda, 0x1a, 0x9a, 0x7a, 0xfa, 0x3a,
  5415. +        0xba, 0xba, 0x4a, 0x4a, 0xca, 0xca, 0x0a, 0x0a,
  5416. +        0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a
  5417. +};
  5418. +
  5419. +#if ((CPU == 386) || (CPU == 486) || (CPU == 586))
  5420. +static inline void
  5421. +isdn_audio_tlookup(const void *table, void *buff, unsigned long n)
  5422. +{
  5423. +        __asm__("cld\n"
  5424. +                "1:\tlodsb\n\t"
  5425. +                "xlatb\n\t"
  5426. +                "stosb\n\t"
  5427. +                "loop 1b\n\t"
  5428. +                ::"b" ((long)table), "c" (n), "D" ((long)buff), "S" ((long)buff)
  5429. +                :"bx","cx","di","si","ax");
  5430. +}
  5431. +#else
  5432. +static inline void
  5433. +isdn_audio_tlookup(const char *table, char *buff, unsigned long n)
  5434. +{
  5435. +        while (n--) 
  5436. +                *buff++ = table[*buff];
  5437. +}
  5438. +#endif
  5439. +
  5440. +void
  5441. +isdn_audio_ulaw2alaw(unsigned char *buff, unsigned long len)
  5442. +{
  5443. +        isdn_audio_tlookup(isdn_audio_ulaw_to_alaw, buff, len);
  5444. +}
  5445. +
  5446. +void
  5447. +isdn_audio_alaw2ulaw(unsigned char *buff, unsigned long len)
  5448. +{
  5449. +        isdn_audio_tlookup(isdn_audio_alaw_to_ulaw, buff, len);
  5450. +}
  5451. +
  5452. +/*
  5453. + * linear <-> adpcm conversion stuff
  5454. + * Most parts from the mgetty-package.
  5455. + * (C) by Gert Doering and Klaus Weidner
  5456. + * Used by permission of Gert Doering
  5457. + */
  5458. +
  5459. +
  5460. +#define ZEROTRAP    /* turn on the trap as per the MIL-STD */
  5461. +#undef ZEROTRAP
  5462. +#define BIAS 0x84   /* define the add-in bias for 16 bit samples */
  5463. +#define CLIP 32635
  5464. +
  5465. +static unsigned char
  5466. +isdn_audio_linear2ulaw(int sample) {
  5467. +        static int exp_lut[256] = {
  5468. +                0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
  5469. +                4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  5470. +                5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
  5471. +                5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
  5472. +                6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
  5473. +                6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
  5474. +                6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
  5475. +                6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
  5476. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5477. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5478. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5479. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5480. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5481. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5482. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
  5483. +                7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
  5484. +        };
  5485. +        int sign, exponent, mantissa;
  5486. +        unsigned char ulawbyte;
  5487. +
  5488. +        /* Get the sample into sign-magnitude. */
  5489. +        sign = (sample >> 8) & 0x80;      /* set aside the sign  */
  5490. +        if(sign != 0) sample = -sample;   /* get magnitude       */
  5491. +        if(sample > CLIP) sample = CLIP;  /* clip the magnitude  */
  5492. +
  5493. +        /* Convert from 16 bit linear to ulaw. */
  5494. +        sample = sample + BIAS;
  5495. +        exponent = exp_lut[( sample >> 7 ) & 0xFF];
  5496. +        mantissa = (sample >> (exponent + 3)) & 0x0F;
  5497. +        ulawbyte = ~(sign | (exponent << 4) | mantissa);
  5498. +#ifdef ZEROTRAP
  5499. +        /* optional CCITT trap */
  5500. +        if (ulawbyte == 0) ulawbyte = 0x02;
  5501. +#endif
  5502. +        return(ulawbyte);
  5503. +}
  5504. +
  5505. +
  5506. +static int Mx[3][8] = {
  5507. +        { 0x3800, 0x5600, 0,0,0,0,0,0 },
  5508. +        { 0x399a, 0x3a9f, 0x4d14, 0x6607, 0,0,0,0 },
  5509. +        { 0x3556, 0x3556, 0x399A, 0x3A9F, 0x4200, 0x4D14, 0x6607, 0x6607 },
  5510. +};
  5511. +
  5512. +static int bitmask[9] = {
  5513. +        0, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff
  5514. +}; 
  5515. +
  5516. +static int
  5517. +isdn_audio_get_bits (adpcm_state *s, unsigned char **in, int *len)
  5518. +{
  5519. +        while( s->nleft < s->nbits) {
  5520. +                int d = *((*in)++);
  5521. +                (*len)--;
  5522. +                s->word = (s->word << 8) | d;
  5523. +                s->nleft += 8;
  5524. +        }
  5525. +        s->nleft -= s->nbits;
  5526. +        return (s->word >> s->nleft) & bitmask[s->nbits];
  5527. +}
  5528. +
  5529. +static void
  5530. +isdn_audio_put_bits (int data, int nbits, adpcm_state *s,
  5531. +                     unsigned char **out, int *len)
  5532. +{
  5533. +        s->word = (s->word << nbits) | (data & bitmask[nbits]);
  5534. +        s->nleft += nbits;
  5535. +        while(s->nleft >= 8) {
  5536. +                int d = (s->word >> (s->nleft-8));
  5537. +                *(out[0]++) = d & 255;
  5538. +                (*len)++;
  5539. +                s->nleft -= 8;
  5540. +        }
  5541. +}
  5542. +
  5543. +adpcm_state *
  5544. +isdn_audio_adpcm_init(int nbits)
  5545. +{
  5546. +static adpcm_state *s;
  5547. +
  5548. +#ifdef ATEST
  5549. +        s = (adpcm_state *) malloc(sizeof(adpcm_state));
  5550. +#else
  5551. +        s = (adpcm_state *) kmalloc(sizeof(adpcm_state), GFP_ATOMIC);
  5552. +#endif
  5553. +        if (s) {
  5554. +                s->a     = 0;
  5555. +                s->d     = 5;
  5556. +                s->word  = 0;
  5557. +                s->nleft = 0;
  5558. +                s->nbits = nbits;
  5559. +        }
  5560. +        return s;
  5561. +}
  5562. +
  5563. +/*
  5564. + * Decompression of adpcm data to a/u-law
  5565. + *
  5566. + */
  5567. +int
  5568. +isdn_audio_adpcm2xlaw (adpcm_state *s, int fmt, unsigned char *in,
  5569. +                      unsigned char *out, int len)
  5570. +{
  5571. +        int a = s->a;
  5572. +        int d = s->d;
  5573. +        int nbits = s->nbits;
  5574. +        int olen = 0;
  5575. +        
  5576. +        while (len) {
  5577. +                int e = isdn_audio_get_bits(s, &in, &len);
  5578. +                int sign;
  5579. +
  5580. +                if (nbits == 4 && e == 0)
  5581. +                        d = 4;
  5582. +                sign = (e >> (nbits-1))?-1:1;
  5583. +                e &= bitmask[nbits-1];
  5584. +                a += sign * ((e << 1) + 1) * d >> 1;
  5585. +                if (d & 1)
  5586. +                        a++;
  5587. +                if (fmt)
  5588. +                        *out++ = isdn_audio_ulaw_to_alaw[
  5589. +                                 isdn_audio_linear2ulaw(a << 2)];
  5590. +                else
  5591. +                        *out++ = isdn_audio_linear2ulaw(a << 2);
  5592. +                olen++;
  5593. +                d = (d * Mx[nbits-2][ e ] + 0x2000) >> 14;
  5594. +                if ( d < 5 )
  5595. +                        d = 5;     
  5596. +        }
  5597. +        s->a = a;
  5598. +        s->d = d;
  5599. +        return olen;
  5600. +}
  5601. +
  5602. +int
  5603. +isdn_audio_2adpcm_flush (adpcm_state *s, unsigned char *out)
  5604. +{
  5605. +    int olen = 0;
  5606. +
  5607. +        if (s->nleft)
  5608. +                isdn_audio_put_bits(0, 8-s->nleft, s, &out, &olen);
  5609. +        return olen;
  5610. +}
  5611. +
  5612. +int
  5613. +isdn_audio_xlaw2adpcm (adpcm_state *s, int fmt, unsigned char *in,
  5614. +                      unsigned char *out, int len)
  5615. +{
  5616. +        int a = s->a;
  5617. +        int d = s->d;
  5618. +        int nbits = s->nbits;
  5619. +        int olen = 0;
  5620. +
  5621. +        while (len--) {
  5622. +                int e = 0, nmax = 1 << (nbits - 1);
  5623. +                int sign, delta;
  5624. +              
  5625. +                if (fmt)
  5626. +                        delta = (isdn_audio_alaw_to_s16[*in++] >> 2) - a;
  5627. +                else
  5628. +                        delta = (isdn_audio_ulaw_to_s16[*in++] >> 2) - a;
  5629. +                if (delta < 0) {
  5630. +                        e = nmax;
  5631. +                        delta = -delta;
  5632. +                }
  5633. +                while( --nmax && delta > d ) {
  5634. +                        delta -= d;
  5635. +                        e++;
  5636. +                }
  5637. +                if (nbits == 4 && ((e & 0x0f) == 0))
  5638. +                        e = 8;
  5639. +                isdn_audio_put_bits(e, nbits, s, &out, &olen);
  5640. +                sign = (e >> (nbits-1))?-1:1 ;
  5641. +                e &= bitmask[nbits-1];
  5642. +                
  5643. +                a += sign * ((e << 1) + 1) * d >> 1;
  5644. +                if (d & 1)
  5645. +                        a++;
  5646. +                d = (d * Mx[nbits-2][ e ] + 0x2000) >> 14;
  5647. +                if (d < 5)
  5648. +                        d=5;
  5649. +        }
  5650. +    s->a = a;
  5651. +    s->d = d;
  5652. +        return olen;
  5653. +}
  5654. +
  5655. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_audio.h linux/drivers/isdn/isdn_audio.h
  5656. --- pre2.0.5/linux/drivers/isdn/isdn_audio.h    Thu Jan  1 02:00:00 1970
  5657. +++ linux/drivers/isdn/isdn_audio.h    Sun May 19 15:29:29 1996
  5658. @@ -0,0 +1,43 @@
  5659. +/* $Id: isdn_audio.h,v 1.2 1996/05/10 08:48:32 fritz Exp $
  5660. + *
  5661. + * Linux ISDN subsystem, audio conversion and compression (linklevel).
  5662. + *
  5663. + * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de)
  5664. + * 
  5665. + * This program is free software; you can redistribute it and/or modify
  5666. + * it under the terms of the GNU General Public License as published by
  5667. + * the Free Software Foundation; either version 2, or (at your option)
  5668. + * any later version.
  5669. + *
  5670. + * This program is distributed in the hope that it will be useful,
  5671. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5672. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5673. + * GNU General Public License for more details.
  5674. + *
  5675. + * You should have received a copy of the GNU General Public License
  5676. + * along with this program; if not, write to the Free Software
  5677. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  5678. + *
  5679. + * $Log: isdn_audio.h,v $
  5680. + * Revision 1.2  1996/05/10 08:48:32  fritz
  5681. + * Corrected adpcm bugs.
  5682. + *
  5683. + * Revision 1.1  1996/04/30 09:29:06  fritz
  5684. + * Taken under CVS control.
  5685. + *
  5686. + */
  5687. +
  5688. +typedef struct adpcm_state {
  5689. +        int a;
  5690. +        int d;
  5691. +        int word;
  5692. +        int nleft;
  5693. +        int nbits;
  5694. +} adpcm_state;
  5695. +
  5696. +extern void isdn_audio_ulaw2alaw(unsigned char *, unsigned long);
  5697. +extern void isdn_audio_alaw2ulaw(unsigned char *, unsigned long);
  5698. +extern adpcm_state *isdn_audio_adpcm_init(int);
  5699. +extern int isdn_audio_adpcm2xlaw(adpcm_state *, int, unsigned char *, unsigned char *, int);
  5700. +extern int isdn_audio_xlaw2adpcm(adpcm_state *, int, unsigned char *, unsigned char *, int);
  5701. +extern int isdn_audio_2adpcm_flush(adpcm_state *s, unsigned char *out);
  5702. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_common.c linux/drivers/isdn/isdn_common.c
  5703. --- pre2.0.5/linux/drivers/isdn/isdn_common.c    Tue May  7 16:22:26 1996
  5704. +++ linux/drivers/isdn/isdn_common.c    Sun May 19 15:29:29 1996
  5705. @@ -1,4 +1,4 @@
  5706. -/* $Id: isdn_common.c,v 1.5 1996/04/20 16:19:07 fritz Exp $
  5707. +/* $Id: isdn_common.c,v 1.14 1996/05/18 01:36:55 fritz Exp $
  5708.   *
  5709.   * Linux ISDN subsystem, common used functions (linklevel).
  5710.   *
  5711. @@ -21,6 +21,39 @@
  5712.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  5713.   *
  5714.   * $Log: isdn_common.c,v $
  5715. + * Revision 1.14  1996/05/18 01:36:55  fritz
  5716. + * Added spelling corrections and some minor changes
  5717. + * to stay in sync with kernel.
  5718. + *
  5719. + * Revision 1.13  1996/05/17 15:43:30  fritz
  5720. + * Bugfix: decrement of rcvcount in readbchan() corrected.
  5721. + *
  5722. + * Revision 1.12  1996/05/17 03:55:43  fritz
  5723. + * Changed DLE handling for audio receive.
  5724. + * Some cleanup.
  5725. + * Added display of isdn_audio_revision.
  5726. + *
  5727. + * Revision 1.11  1996/05/11 21:51:32  fritz
  5728. + * Changed queue management to use sk_buffs.
  5729. + *
  5730. + * Revision 1.10  1996/05/10 08:49:16  fritz
  5731. + * Checkin before major changes of tty-code.
  5732. + *
  5733. + * Revision 1.9  1996/05/07 09:19:41  fritz
  5734. + * Adapted to changes in isdn_tty.c
  5735. + *
  5736. + * Revision 1.8  1996/05/06 11:34:51  hipp
  5737. + * fixed a few bugs
  5738. + *
  5739. + * Revision 1.7  1996/05/02 03:55:17  fritz
  5740. + * Bugfixes:
  5741. + *  - B-channel connect message for modem devices
  5742. + *    sometimes did not result in a CONNECT-message.
  5743. + *  - register_isdn did not check for driverId-conflicts.
  5744. + *
  5745. + * Revision 1.6  1996/04/30 20:57:21  fritz
  5746. + * Commit test
  5747. + *
  5748.   * Revision 1.5  1996/04/20 16:19:07  fritz
  5749.   * Changed slow timer handlers to increase accuracy.
  5750.   * Added statistic information for usage by xisdnload.
  5751. @@ -48,9 +81,7 @@
  5752.   *
  5753.   */
  5754.  
  5755. -#ifndef STANDALONE
  5756.  #include <linux/config.h>
  5757. -#endif
  5758.  #include <linux/module.h>
  5759.  #include <linux/version.h>
  5760.  #ifndef __GENKSYMS__      /* Don't want genksyms report unneeded structs */
  5761. @@ -60,17 +91,18 @@
  5762.  #include "isdn_tty.h"
  5763.  #include "isdn_net.h"
  5764.  #include "isdn_ppp.h"
  5765. +#ifdef CONFIG_ISDN_AUDIO
  5766. +#include "isdn_audio.h"
  5767. +#endif
  5768.  #include "isdn_cards.h"
  5769.  
  5770. -
  5771. -
  5772.  /* Debugflags */
  5773.  #undef  ISDN_DEBUG_STATCALLB
  5774.  
  5775.  isdn_dev *dev = (isdn_dev *) 0;
  5776.  
  5777.  static int  has_exported = 0;
  5778. -static char *isdn_revision      = "$Revision: 1.5 $";
  5779. +static char *isdn_revision      = "$Revision: 1.14 $";
  5780.  
  5781.  extern char *isdn_net_revision;
  5782.  extern char *isdn_tty_revision;
  5783. @@ -79,6 +111,11 @@
  5784.  #else
  5785.  static char *isdn_ppp_revision = ": none $";
  5786.  #endif
  5787. +#ifdef CONFIG_ISDN_AUDIO
  5788. +extern char *isdn_audio_revision;
  5789. +#else
  5790. +static char *isdn_audio_revision = ": none $";
  5791. +#endif
  5792.  
  5793.  void isdn_MOD_INC_USE_COUNT(void)
  5794.  {
  5795. @@ -102,45 +139,23 @@
  5796.  }
  5797.  #endif
  5798.  
  5799. -/* Try to allocate a new buffer, link it into queue. */
  5800. -u_char *
  5801. - isdn_new_buf(pqueue ** queue, int length)
  5802. +static __inline void isdn_trash_skb(struct sk_buff *skb, int rw)
  5803.  {
  5804. -    pqueue *p;
  5805. -    pqueue *q;
  5806. -
  5807. -    if ((p = *queue)) {
  5808. -        while (p) {
  5809. -            q = p;
  5810. -            p = (pqueue *) p->next;
  5811. -        }
  5812. -        p = (pqueue *) kmalloc(sizeof(pqueue) + length, GFP_ATOMIC);
  5813. -        q->next = (u_char *) p;
  5814. -    } else
  5815. -        p = *queue = (pqueue *) kmalloc(sizeof(pqueue) + length, GFP_ATOMIC);
  5816. -    if (p) {
  5817. -        p->size = sizeof(pqueue) + length;
  5818. -        p->length = length;
  5819. -        p->next = NULL;
  5820. -        p->rptr = p->buffer;
  5821. -        return p->buffer;
  5822. -    } else {
  5823. -        return (u_char *) NULL;
  5824. -    }
  5825. +        skb->free = 1;
  5826. +        kfree_skb(skb, rw);
  5827.  }
  5828.  
  5829. -static void isdn_free_queue(pqueue ** queue)
  5830. +static void isdn_free_queue(struct sk_buff_head *queue)
  5831.  {
  5832. -    pqueue *p;
  5833. -    pqueue *q;
  5834. +        struct sk_buff *skb;
  5835. +        unsigned long flags;
  5836.  
  5837. -    p = *queue;
  5838. -    while (p) {
  5839. -        q = p;
  5840. -        p = (pqueue *) p->next;
  5841. -        kfree_s(q, q->size);
  5842. -    }
  5843. -    *queue = (pqueue *) 0;
  5844. +        save_flags(flags);
  5845. +        cli();
  5846. +        if (skb_queue_len(queue))
  5847. +                while ((skb = skb_dequeue(queue)))
  5848. +                        isdn_trash_skb(skb, FREE_READ);
  5849. +        restore_flags(flags);
  5850.  }
  5851.  
  5852.  int isdn_dc2minor(int di, int ch)
  5853. @@ -222,75 +237,107 @@
  5854.      restore_flags(flags);
  5855.  }
  5856.  
  5857. -/* Receive a packet from B-Channel. (Called from low-level-module)
  5858. - * Parameters:
  5859. - *
  5860. - * di      = Driver-Index.
  5861. - * channel = Number of B-Channel (0...)
  5862. - * buf     = pointer to packet-data
  5863. - * len     = Length of packet-data
  5864. - *
  5865. +/*
  5866. + * Receive a packet from B-Channel. (Called from low-level-module)
  5867.   */
  5868. -static void isdn_receive_callback(int di, int channel, u_char * buf, int len)
  5869. +static void isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb)
  5870.  {
  5871.      ulong flags;
  5872. -    char *p;
  5873.      int i;
  5874. -    int midx;
  5875. -
  5876. -    if (dev->global_flags & ISDN_GLOBAL_STOPPED)
  5877. -        return;
  5878. -        if ((i = isdn_dc2minor(di,channel))==-1)
  5879. +        int midx;
  5880. +    modem_info *info;
  5881. +        
  5882. +        if ((i = isdn_dc2minor(di,channel))==-1) {
  5883. +                isdn_trash_skb(skb, FREE_READ);
  5884.                  return;
  5885. +        }
  5886.      /* Update statistics */
  5887. -        dev->ibytes[i] += len;
  5888. +        dev->ibytes[i] += skb->len;
  5889.      /* First, try to deliver data to network-device */
  5890. -    if (isdn_net_receive_callback(i, buf, len))
  5891. +    if (isdn_net_rcv_skb(i, skb))
  5892.          return;
  5893.      /* No network-device found, deliver to tty or raw-channel */
  5894. -    if (len) {
  5895. -        save_flags(flags);
  5896. -        cli();
  5897. -                midx = dev->m_idx[i];
  5898. -                if (dev->mdm.atmodem[midx].mdmreg[13] & 2)
  5899. +    if (skb->len) {
  5900. +                if ((midx = dev->m_idx[i])<0) {
  5901. +                        /* if midx is invalid, drop packet */
  5902. +                        isdn_trash_skb(skb, FREE_READ);
  5903. +                        return;
  5904. +                }
  5905. +                info  = &dev->mdm.info[midx];
  5906. +                if ((info->online < 2) &&
  5907. +                    (info->vonline != 1)) {
  5908. +                        /* If Modem not listening, drop data */
  5909. +                        isdn_trash_skb(skb, FREE_READ);
  5910. +                        return;
  5911. +                }
  5912. +                if (info->emu.mdmreg[13] & 2)
  5913.                          /* T.70 decoding: Simply throw away the T.70 header (4 bytes) */
  5914. -                        if ((buf[0] == 1) && ((buf[1] == 0) || (buf[1] == 1))) {
  5915. +                        if ((skb->data[0] == 1) && ((skb->data[1] == 0) || (skb->data[1] == 1))) {
  5916.  #ifdef ISDN_DEBUG_MODEM_DUMP
  5917. -                                isdn_dumppkt("T70strip1:", buf, len, len);
  5918. +                                isdn_dumppkt("T70strip1:", skb->data, skb->len, skb->len);
  5919.  #endif
  5920. -                                buf += 4;
  5921. -                                len -= 4;
  5922. +                                skb_pull(skb,4);
  5923.  #ifdef ISDN_DEBUG_MODEM_DUMP
  5924. -                                isdn_dumppkt("T70strip2:", buf, len, len);
  5925. +                                isdn_dumppkt("T70strip2:", skb->data, skb->len, skb->len);
  5926.  #endif
  5927.                          }
  5928. +                /* The users field of an sk_buff is used in a special way
  5929. +                 * with tty's incoming data:
  5930. +                 *   users is set to the number of DLE codes when in audio mode.
  5931. +                 */
  5932. +                skb->users = 0;
  5933. +#ifdef CONFIG_ISDN_AUDIO
  5934. +                if (info->vonline == 1) {
  5935. +                        int ifmt = 1;
  5936. +                        /* voice conversion/compression */
  5937. +                        switch (info->emu.vpar[3]) {
  5938. +                                case 2:
  5939. +                                case 3:
  5940. +                                case 4:
  5941. +                                        /* adpcm
  5942. +                                         * Since compressed data takes less
  5943. +                                         * space, we can overwrite the buffer.
  5944. +                                         */
  5945. +                                        skb_trim(skb,isdn_audio_xlaw2adpcm(info->adpcmr,
  5946. +                                                                           ifmt,
  5947. +                                                                           skb->data,
  5948. +                                                                           skb->data,
  5949. +                                                                           skb->len));
  5950. +                                        break;
  5951. +                                case 5:
  5952. +                                        /* a-law */
  5953. +                                        if (!ifmt)
  5954. +                                                isdn_audio_ulaw2alaw(skb->data,skb->len);
  5955. +                                        break;
  5956. +                                case 6:
  5957. +                                        /* u-law */
  5958. +                                        if (ifmt)
  5959. +                                                isdn_audio_alaw2ulaw(skb->data,skb->len);
  5960. +                                        break;
  5961. +                        }
  5962. +                        skb->users = isdn_tty_countDLE(skb->data,skb->len);
  5963. +                }
  5964. +#endif
  5965.                  /* Try to deliver directly via tty-flip-buf if queue is empty */
  5966. -                if (!dev->drv[di]->rpqueue[channel])
  5967. -                        if (isdn_tty_try_read(midx, buf, len)) {
  5968. +                save_flags(flags);
  5969. +                cli();
  5970. +                if (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
  5971. +                        if (isdn_tty_try_read(info, skb)) {
  5972.                                  restore_flags(flags);
  5973.                                  return;
  5974.                          }
  5975.                  /* Direct deliver failed or queue wasn't empty.
  5976.                   * Queue up for later dequeueing via timer-irq.
  5977.                   */
  5978. -                p = isdn_new_buf(&dev->drv[di]->rpqueue[channel], len);
  5979. -                if (!p) {
  5980. -                        printk(KERN_WARNING "isdn: malloc of rcvbuf failed, dropping.\n");
  5981. -                        dev->drv[di]->rcverr[channel]++;
  5982. -                        restore_flags(flags);
  5983. -                        return;
  5984. -                } else {
  5985. -                        memcpy(p, buf, len);
  5986. -                        dev->drv[di]->rcvcount[channel] += len;
  5987. -                }
  5988. +                __skb_queue_tail(&dev->drv[di]->rpqueue[channel], skb);
  5989. +                dev->drv[di]->rcvcount[channel] += (skb->len + skb->users);
  5990. +                restore_flags(flags);
  5991.                  /* Schedule dequeuing */
  5992. -                if ((dev->modempoll) && (midx >= 0)) {
  5993. -                        if (dev->mdm.rcvsched[midx])
  5994. -                                isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
  5995. -                }
  5996. +                if ((dev->modempoll) && (info->rcvsched))
  5997. +                        isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
  5998.                  wake_up_interruptible(&dev->drv[di]->rcv_waitq[channel]);
  5999. -        restore_flags(flags);
  6000. -    }
  6001. +    } else
  6002. +                isdn_trash_skb(skb, FREE_READ);
  6003.  }
  6004.  
  6005.  void isdn_all_eaz(int di, int ch)
  6006. @@ -311,6 +358,7 @@
  6007.      ulong flags;
  6008.      int i;
  6009.      int r;
  6010. +        modem_info *info;
  6011.      isdn_ctrl cmd;
  6012.  
  6013.      di = c->driver;
  6014. @@ -323,9 +371,7 @@
  6015.                                  return 0;
  6016.                          if (isdn_net_stat_callback(i, c->command))
  6017.                                  return 0;
  6018. -#if FUTURE
  6019.                          isdn_tty_bsent(di, c->arg);
  6020. -#endif
  6021.                          wake_up_interruptible(&dev->drv[di]->snd_waitq[c->arg]);
  6022.                          break;
  6023.                  case ISDN_STAT_STAVAIL:
  6024. @@ -366,8 +412,9 @@
  6025.                                           * tty and set RI-bit of modem-status.
  6026.                                           */
  6027.                                          if ((mi = isdn_tty_find_icall(di, c->arg, c->num)) >= 0) {
  6028. -                                                dev->mdm.msr[mi] |= UART_MSR_RI;
  6029. -                                                isdn_tty_modem_result(2, &dev->mdm.info[mi]);
  6030. +                                                info = &dev->mdm.info[mi];
  6031. +                                                info->msr |= UART_MSR_RI;
  6032. +                                                isdn_tty_modem_result(2, info);
  6033.                                                  isdn_timer_ctrl(ISDN_TIMER_MODEMRING, 1);
  6034.                                          } else if (dev->drv[di]->reject_bus) {
  6035.                                                  cmd.driver = di;
  6036. @@ -428,12 +475,14 @@
  6037.                          /* Find any network-device, waiting for D-channel setup */
  6038.                          if (isdn_net_stat_callback(i, c->command))
  6039.                                  break;
  6040. -            if ((mi = dev->m_idx[i]) >= 0)
  6041. +
  6042. +            if ((mi = dev->m_idx[i]) >= 0) {
  6043.                  /* If any tty has just dialed-out, setup B-Channel */
  6044. -                if (dev->mdm.info[mi].flags &
  6045. +                                info = &dev->mdm.info[mi];
  6046. +                if (info->flags &
  6047.                      (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) {
  6048. -                    if (dev->mdm.dialing[mi] == 1) {
  6049. -                        dev->mdm.dialing[mi] = 2;
  6050. +                    if (info->dialing == 1) {
  6051. +                        info->dialing = 2;
  6052.                          cmd.driver = di;
  6053.                          cmd.arg = c->arg;
  6054.                          cmd.command = ISDN_CMD_ACCEPTB;
  6055. @@ -441,6 +490,7 @@
  6056.                          return 0;
  6057.                      }
  6058.                  }
  6059. +                        }
  6060.                          break;
  6061.                  case ISDN_STAT_DHUP:
  6062.              if (i<0)
  6063. @@ -457,19 +507,19 @@
  6064.                                  break;
  6065.              if ((mi = dev->m_idx[i]) >= 0) {
  6066.                  /* Signal hangup to tty-device */
  6067. -                if (dev->mdm.info[mi].flags &
  6068. +                                info = &dev->mdm.info[mi];
  6069. +                if (info->flags &
  6070.                      (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) {
  6071. -                    if (dev->mdm.dialing[mi] == 1) {
  6072. -                        dev->mdm.dialing[mi] = 0;
  6073. -                        isdn_tty_modem_result(7, &dev->mdm.info[mi]);
  6074. +                    if (info->dialing == 1) {
  6075. +                        info->dialing = 0;
  6076. +                        isdn_tty_modem_result(7, info);
  6077.                      }
  6078. -                    if (dev->mdm.online[mi])
  6079. -                        isdn_tty_modem_result(3, &dev->mdm.info[mi]);
  6080. +                    if (info->online)
  6081. +                        isdn_tty_modem_result(3, info);
  6082.  #ifdef ISDN_DEBUG_MODEM_HUP
  6083.                      printk(KERN_DEBUG "Mhup in ISDN_STAT_DHUP\n");
  6084.  #endif
  6085. -                    isdn_tty_modem_hup(&dev->mdm.info[mi]);
  6086. -                    dev->mdm.msr[mi] &= ~(UART_MSR_DCD | UART_MSR_RI);
  6087. +                    isdn_tty_modem_hup(info);
  6088.                      return 0;
  6089.                  }
  6090.              }
  6091. @@ -491,13 +541,17 @@
  6092.                  /* Schedule CONNECT-Message to any tty, waiting for it and
  6093.                   * set DCD-bit of its modem-status.
  6094.                   */
  6095. -                if (dev->mdm.info[mi].flags &
  6096. +                                info = &dev->mdm.info[mi];
  6097. +                if (info->flags &
  6098.                      (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) {
  6099. -                    dev->mdm.msr[mi] |= UART_MSR_DCD;
  6100. -                    if (dev->mdm.dialing[mi])
  6101. -                        dev->mdm.dialing[mi] = 0;
  6102. -                    dev->mdm.rcvsched[mi] = 1;
  6103. -                    isdn_tty_modem_result(5, &dev->mdm.info[mi]);
  6104. +                    info->msr |= UART_MSR_DCD;
  6105. +                    if (info->dialing)
  6106. +                        info->dialing = 0;
  6107. +                    info->rcvsched = 1;
  6108. +                                        if (USG_MODEM(dev->usage[i]))
  6109. +                                          isdn_tty_modem_result(5, info);
  6110. +                                        if (USG_VOICE(dev->usage[i]))
  6111. +                                          isdn_tty_modem_result(11, info);
  6112.                  }
  6113.              }
  6114.                          break;
  6115. @@ -513,15 +567,16 @@
  6116.                          isdn_info_update();
  6117.              if ((mi = dev->m_idx[i]) >= 0) {
  6118.                  /* Signal hangup to tty-device, schedule NO CARRIER-message */
  6119. -                if (dev->mdm.info[mi].flags &
  6120. +                                info = &dev->mdm.info[mi];
  6121. +                if (info->flags &
  6122.                      (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) {
  6123. -                    dev->mdm.msr[mi] &= ~(UART_MSR_DCD | UART_MSR_RI);
  6124. -                    if (dev->mdm.online[mi])
  6125. -                        isdn_tty_modem_result(3, &dev->mdm.info[mi]);
  6126. +                    info->msr &= ~(UART_MSR_DCD | UART_MSR_RI);
  6127. +                    if (info->online)
  6128. +                        isdn_tty_modem_result(3, info);
  6129.  #ifdef ISDN_DEBUG_MODEM_HUP
  6130.                      printk(KERN_DEBUG "Mhup in ISDN_STAT_BHUP\n");
  6131.  #endif
  6132. -                    isdn_tty_modem_hup(&dev->mdm.info[mi]);
  6133. +                    isdn_tty_modem_hup(info);
  6134.                  }
  6135.              }
  6136.                          break;
  6137. @@ -536,16 +591,17 @@
  6138.                          if (isdn_net_stat_callback(i, c->command))
  6139.                                  break;
  6140.              if ((mi = dev->m_idx[i]) >= 0) {
  6141. -                if (dev->mdm.info[mi].flags &
  6142. +                                info = &dev->mdm.info[mi];
  6143. +                if (info->flags &
  6144.                      (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) {
  6145. -                    if (dev->mdm.dialing[mi]) {
  6146. -                        dev->mdm.dialing[mi] = 0;
  6147. -                        isdn_tty_modem_result(6, &dev->mdm.info[mi]);
  6148. +                    if (info->dialing) {
  6149. +                        info->dialing = 0;
  6150. +                        isdn_tty_modem_result(6, info);
  6151.                      }
  6152. -                    dev->mdm.msr[mi] &= ~UART_MSR_DCD;
  6153. -                    if (dev->mdm.online[mi]) {
  6154. -                        isdn_tty_modem_result(3, &dev->mdm.info[mi]);
  6155. -                        dev->mdm.online[mi] = 0;
  6156. +                    info->msr &= ~UART_MSR_DCD;
  6157. +                    if (info->online) {
  6158. +                        isdn_tty_modem_result(3, info);
  6159. +                        info->online = 0;
  6160.                      }
  6161.                  }
  6162.              }
  6163. @@ -569,6 +625,7 @@
  6164.                          kfree(dev->drv[di]->rcvcount);
  6165.                          for (i = 0; i < dev->drv[di]->channels; i++)
  6166.                                  isdn_free_queue(&dev->drv[di]->rpqueue[i]);
  6167. +                        kfree(dev->drv[di]->rpqueue);
  6168.                          kfree(dev->drv[di]->rcv_waitq);
  6169.                          kfree(dev->drv[di]->snd_waitq);
  6170.                          kfree(dev->drv[di]);
  6171. @@ -595,66 +652,109 @@
  6172.      return v;
  6173.  }
  6174.  
  6175. +#define DLE 0x10
  6176. +
  6177. +/*
  6178. + * isdn_readbchan() tries to get data from the read-queue.
  6179. + * It MUST be called with interrupts off.
  6180. + */
  6181.  int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int user)
  6182.  {
  6183. -    int avail;
  6184.      int left;
  6185.      int count;
  6186. -    int copy_l;
  6187. +    int count_pull;
  6188. +        int count_put;
  6189.      int dflag;
  6190. -    int flags;
  6191. -    pqueue *p;
  6192. +        struct sk_buff *skb;
  6193.      u_char *cp;
  6194.  
  6195. -    if (!dev->drv[di]->rpqueue[channel]) {
  6196. +    if (!dev->drv[di])
  6197. +        return 0;
  6198. +    if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) {
  6199.          if (user)
  6200.              interruptible_sleep_on(&dev->drv[di]->rcv_waitq[channel]);
  6201.          else
  6202.              return 0;
  6203.      }
  6204. -    if (!dev->drv[di])
  6205. -        return 0;
  6206. -    save_flags(flags);
  6207. -    cli();
  6208. -    avail = dev->drv[di]->rcvcount[channel];
  6209. -    restore_flags(flags);
  6210. -    left = MIN(len, avail);
  6211. +    left = MIN(len, dev->drv[di]->rcvcount[channel]);
  6212.      cp = buf;
  6213.      count = 0;
  6214.      while (left) {
  6215. -        if ((copy_l = dev->drv[di]->rpqueue[channel]->length) > left) {
  6216. -            copy_l = left;
  6217. -            dflag = 0;
  6218. -        } else
  6219. -            dflag = 1;
  6220. -        p = dev->drv[di]->rpqueue[channel];
  6221. -        if (user)
  6222. -            memcpy_tofs(cp, p->rptr, copy_l);
  6223. -        else
  6224. -            memcpy(cp, p->rptr, copy_l);
  6225. -        if (fp) {
  6226. -            memset(fp, 0, copy_l);
  6227. -            fp += copy_l;
  6228. -        }
  6229. -        left -= copy_l;
  6230. -        count += copy_l;
  6231. -        cp += copy_l;
  6232. -        if (dflag) {
  6233. +                if (!(skb = skb_peek(&dev->drv[di]->rpqueue[channel])))
  6234. +                        break;
  6235. +                if (skb->lock)
  6236. +                        break;
  6237. +                skb->lock = 1;
  6238. +                if (skb->users) {
  6239. +                        /* users is the count of DLE's in
  6240. +                         * this buff when in voice mode.
  6241. +                         */
  6242. +                        char *p = skb->data;
  6243. +                        unsigned long DLEmask = (1 << channel);
  6244. +
  6245. +                        dflag = 0;
  6246. +                        count_pull = count_put = 0;
  6247. +                        while ((count_pull < skb->len) && (left-- > 0)) {
  6248. +                                if (dev->drv[di]->DLEflag & DLEmask) {
  6249. +                                        if (user)
  6250. +                                                put_fs_byte(DLE,cp++);
  6251. +                                        else
  6252. +                                                *cp++ = DLE;
  6253. +                                        dev->drv[di]->DLEflag &= ~DLEmask;
  6254. +                                } else {
  6255. +                                        if (user)
  6256. +                                                put_fs_byte(*p,cp++);
  6257. +                                        else
  6258. +                                                *cp++ = *p;
  6259. +                                        if (*p == DLE) {
  6260. +                                                dev->drv[di]->DLEflag |= DLEmask;
  6261. +                                                skb->users--;
  6262. +                                        }
  6263. +                                        p++;
  6264. +                                        count_pull++;
  6265. +                                }
  6266. +                                count_put++;
  6267. +                        }
  6268. +                        if (count_pull >= skb->len)
  6269. +                                dflag = 1;
  6270. +                } else {
  6271. +                        /* No DLE's in buff, so simply copy it */
  6272. +                        dflag = 1;
  6273. +                        if ((count_pull = skb->len) > left) {
  6274. +                                count_pull = left;
  6275. +                                dflag = 0;
  6276. +                        }
  6277. +                        count_put = count_pull;
  6278. +                        if (user)
  6279. +                                memcpy_tofs(cp, skb->data, count_put);
  6280. +                        else
  6281. +                                memcpy(cp, skb->data, count_put);
  6282. +                        cp += count_put;
  6283. +                        left -= count_put;
  6284. +                }
  6285. +                count += count_put;
  6286. +                if (fp) {
  6287. +                        memset(fp, 0, count_put);
  6288. +                        fp += count_put;
  6289. +                }
  6290. +                if (dflag) {
  6291. +                        /* We got all the data in this buff.
  6292. +                         * Now we can dequeue it.
  6293. +                         */
  6294.              if (fp)
  6295.                  *(fp - 1) = 0xff;
  6296. -            save_flags(flags);
  6297. -            cli();
  6298. -            dev->drv[di]->rpqueue[channel] = (pqueue *) p->next;
  6299. -            kfree_s(p, p->size);
  6300. -            restore_flags(flags);
  6301. +                        skb->lock = 0;
  6302. +                        skb = skb_dequeue(&dev->drv[di]->rpqueue[channel]);
  6303. +                        isdn_trash_skb(skb, FREE_READ);
  6304.          } else {
  6305. -            p->rptr += copy_l;
  6306. -            p->length -= copy_l;
  6307. -        }
  6308. -        save_flags(flags);
  6309. -        cli();
  6310. -        dev->drv[di]->rcvcount[channel] -= copy_l;
  6311. -        restore_flags(flags);
  6312. +                        /* Not yet emptied this buff, so it
  6313. +                         * must stay in the queue, for further calls
  6314. +                         * but we pull off the data we got until now.
  6315. +                         */
  6316. +            skb_pull(skb,count_pull);
  6317. +                        skb->lock = 0;
  6318. +                }
  6319. +        dev->drv[di]->rcvcount[channel] -= count_put;
  6320.      }
  6321.      return count;
  6322.  }
  6323. @@ -749,9 +849,7 @@
  6324.                                  return -EAGAIN;
  6325.              interruptible_sleep_on(&(dev->info_waitq));
  6326.                  }
  6327. -        save_flags(flags);
  6328.          p = isdn_statstr();
  6329. -        restore_flags(flags);
  6330.          file->private_data = 0;
  6331.          if ((len = strlen(p)) <= count) {
  6332.              memcpy_tofs(buf, p, len);
  6333. @@ -769,8 +867,11 @@
  6334.          if (!dev->drv[drvidx]->running)
  6335.              return -ENODEV;
  6336.          chidx = isdn_minor2chan(minor);
  6337. +                save_flags(flags);
  6338. +                cli();
  6339.          len = isdn_readbchan(drvidx, chidx, buf, 0, count, 1);
  6340.          file->f_pos += len;
  6341. +                restore_flags(flags);
  6342.          return len;
  6343.      }
  6344.      if (minor <= ISDN_MINOR_CTRLMAX) {
  6345. @@ -784,7 +885,8 @@
  6346.                  }
  6347.          if (dev->drv[drvidx]->interface->readstat)
  6348.              len = dev->drv[drvidx]->interface->
  6349. -                readstat(buf, MIN(count, dev->drv[drvidx]->stavail), 1);
  6350. +                readstat(buf, MIN(count, dev->drv[drvidx]->stavail),
  6351. +                     1, drvidx, isdn_minor2chan(minor));
  6352.          else
  6353.              len = 0;
  6354.          save_flags(flags);
  6355. @@ -826,7 +928,6 @@
  6356.          if (!dev->drv[drvidx]->running)
  6357.              return -ENODEV;
  6358.          chidx = isdn_minor2chan(minor);
  6359. -                dev->obytes[minor] += count;
  6360.          while (isdn_writebuf_stub(drvidx, chidx, buf, count, 1) != count)
  6361.              interruptible_sleep_on(&dev->drv[drvidx]->snd_waitq[chidx]);
  6362.          return count;
  6363. @@ -842,7 +943,8 @@
  6364.           return -ENODEV;
  6365.           */
  6366.          if (dev->drv[drvidx]->interface->writecmd)
  6367. -            return (dev->drv[drvidx]->interface->writecmd(buf, count, 1));
  6368. +            return (dev->drv[drvidx]->interface->
  6369. +                writecmd(buf, count, 1, drvidx, isdn_minor2chan(minor)));
  6370.          else
  6371.              return count;
  6372.      }
  6373. @@ -856,6 +958,7 @@
  6374.  static int isdn_select(struct inode *inode, struct file *file, int type, select_table * st)
  6375.  {
  6376.      uint minor = MINOR(inode->i_rdev);
  6377. +        int drvidx  = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
  6378.  
  6379.      if (minor == ISDN_MINOR_STATUS) {
  6380.          if (file->private_data)
  6381. @@ -866,8 +969,18 @@
  6382.              return 0;
  6383.          }
  6384.      }
  6385. -    if (minor <= ISDN_MINOR_CTRLMAX)
  6386. +    if (minor >= ISDN_MINOR_CTRL && minor <= ISDN_MINOR_CTRLMAX) {
  6387. +        if (drvidx < 0)
  6388. +            return -ENODEV;
  6389. +        if (dev->drv[drvidx]->stavail)
  6390. +                        return 1;
  6391. +                else {
  6392. +                        if (st)
  6393. +                                select_wait(&(dev->drv[drvidx]->st_waitq), st);
  6394. +                        return 0;
  6395. +                }
  6396.          return 1;
  6397. +     }
  6398.  #ifdef CONFIG_ISDN_PPP
  6399.      if (minor <= ISDN_MINOR_PPPMAX)
  6400.          return (isdn_ppp_select(minor - ISDN_MINOR_PPP, file, type, st));
  6401. @@ -1178,8 +1291,15 @@
  6402.                                  memcpy_fromfs(name,(char*)arg,sizeof(name));
  6403.                                  return isdn_ppp_dial_slave(name);
  6404.                          case IIOCNETDLN:
  6405. -                                /* remove one link from bundle; removed for i4l 0.7.1  */
  6406. -                                return 2;
  6407. +                                if(arg) {
  6408. +                                        if ((ret = verify_area(VERIFY_READ,
  6409. +                                                               (void*)arg,
  6410. +                                                               sizeof(name))))
  6411. +                                                return ret;
  6412. +                                } else
  6413. +                                        return -EINVAL;
  6414. +                                memcpy_fromfs(name,(char*)arg,sizeof(name));
  6415. +                                return isdn_ppp_hangup_slave(name);
  6416.  #endif
  6417.                          case IIOCNETHUP:
  6418.                                  /* Force hangup of a network-interface */
  6419. @@ -1212,7 +1332,8 @@
  6420.                                          if ((ret = verify_area(VERIFY_READ, (void *) arg,
  6421.                                                                 sizeof(isdn_ioctl_struct))))
  6422.                                                  return ret;
  6423. -                                        memcpy_fromfs((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct));
  6424. +                                        memcpy_fromfs((char *) &iocts, (char *) arg,
  6425. +                                                      sizeof(isdn_ioctl_struct));
  6426.                                          if (strlen(iocts.drvid)) {
  6427.                                                  if ((p = strchr(iocts.drvid, ',')))
  6428.                                                          *p = 0;
  6429. @@ -1260,9 +1381,10 @@
  6430.                                                  return ret;
  6431.                                          
  6432.                                          for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  6433. -                                                memcpy_tofs(p, dev->mdm.atmodem[i].profile, ISDN_MODEM_ANZREG);
  6434. +                                                memcpy_tofs(p, dev->mdm.info[i].emu.profile,
  6435. +                                                            ISDN_MODEM_ANZREG);
  6436.                                                  p += ISDN_MODEM_ANZREG;
  6437. -                                                memcpy_tofs(p, dev->mdm.atmodem[i].pmsn, ISDN_MSNLEN);
  6438. +                                                memcpy_tofs(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN);
  6439.                                                  p += ISDN_MSNLEN;
  6440.                                          }
  6441.                                          return (ISDN_MODEM_ANZREG + ISDN_MSNLEN) * ISDN_MAX_CHANNELS;
  6442. @@ -1281,9 +1403,10 @@
  6443.                                                  return ret;
  6444.                                          
  6445.                                          for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  6446. -                                                memcpy_fromfs(dev->mdm.atmodem[i].profile, p, ISDN_MODEM_ANZREG);
  6447. +                                                memcpy_fromfs(dev->mdm.info[i].emu.profile, p,
  6448. +                                                              ISDN_MODEM_ANZREG);
  6449.                                                  p += ISDN_MODEM_ANZREG;
  6450. -                                                memcpy_fromfs(dev->mdm.atmodem[i].pmsn, p, ISDN_MSNLEN);
  6451. +                                                memcpy_fromfs(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN);
  6452.                                                  p += ISDN_MSNLEN;
  6453.                                          }
  6454.                                          return 0;
  6455. @@ -1410,6 +1533,7 @@
  6456.  
  6457.      if (minor == ISDN_MINOR_STATUS) {
  6458.          infostruct *p;
  6459. +
  6460.          if ((p = (infostruct *) kmalloc(sizeof(infostruct), GFP_KERNEL))) {
  6461.              MOD_INC_USE_COUNT;
  6462.              p->next = (char *) dev->infochain;
  6463. @@ -1605,7 +1729,8 @@
  6464.                          dev->ibytes[i] = 0;
  6465.                          dev->obytes[i] = 0;
  6466.              isdn_info_update();
  6467. -            restore_flags(flags);
  6468. +                        isdn_free_queue(&dev->drv[di]->rpqueue[ch]);
  6469. +                        restore_flags(flags);
  6470.              return;
  6471.          }
  6472.      restore_flags(flags);
  6473. @@ -1633,54 +1758,62 @@
  6474.  }
  6475.  
  6476.  /*
  6477. - *  receive callback handler for drivers supporting sk_buff's.
  6478. + * receive callback handler for drivers not supporting sk_buff's.
  6479. + * Parameters:
  6480. + *
  6481. + * di      = Driver-Index.
  6482. + * channel = Number of B-Channel (0...)
  6483. + * buf     = pointer to packet-data
  6484. + * len     = Length of packet-data
  6485. + *
  6486.   */
  6487. -
  6488. -void isdn_receive_skb_callback(int drvidx, int chan, struct sk_buff *skb) 
  6489. +void isdn_receive_callback(int drvidx, int chan, u_char *buf, int len) 
  6490.  {
  6491. -        int i, len;
  6492. +        struct sk_buff *skb;
  6493.  
  6494.      if (dev->global_flags & ISDN_GLOBAL_STOPPED)
  6495.          return;
  6496. -        if ((i = isdn_dc2minor(drvidx,chan))==-1)
  6497. -                return;
  6498. -        len = skb->len;
  6499. -    if (isdn_net_rcv_skb(i, skb) == 0) {
  6500. -        isdn_receive_callback(drvidx, chan, skb->data, skb->len);
  6501. -        skb->free = 1;
  6502. -        kfree_skb(skb, FREE_READ);
  6503. -    } else
  6504. -                /* Update statistics */
  6505. -                dev->ibytes[i] += len;
  6506. +        skb = dev_alloc_skb(len);
  6507. +        if (skb) {
  6508. +                memcpy(skb_put(skb, len), buf, len);
  6509. +                isdn_receive_skb_callback(drvidx, chan, skb);
  6510. +        } else
  6511. +                printk(KERN_WARNING "isdn: rcv alloc_skb failed, packet dropped.\n");
  6512.  }
  6513.  
  6514.  /*
  6515.   *  writebuf replacement for SKB_ABLE drivers
  6516.   */
  6517. -
  6518.  int isdn_writebuf_stub(int drvidx, int chan, const u_char *buf, int len, 
  6519.                 int user)
  6520.  {
  6521. +    int ret;
  6522. +
  6523.          if (dev->drv[drvidx]->interface->writebuf)
  6524. -          return dev->drv[drvidx]->interface->writebuf(drvidx, chan, buf,
  6525. -                                                       len, user);
  6526. +                ret = dev->drv[drvidx]->interface->writebuf(drvidx, chan, buf,
  6527. +                                                            len, user);
  6528.          else {
  6529. -          struct sk_buff * skb;
  6530. +                struct sk_buff * skb;
  6531.  
  6532. -          skb = alloc_skb(dev->drv[drvidx]->interface->hl_hdrlen + len, GFP_ATOMIC);
  6533. -          if (skb == NULL)
  6534. -                  return 0;
  6535. +                skb = alloc_skb(dev->drv[drvidx]->interface->hl_hdrlen + len,
  6536. +                                GFP_ATOMIC);
  6537. +                if (skb == NULL)
  6538. +                        return 0;
  6539.  
  6540. -          skb_reserve(skb, dev->drv[drvidx]->interface->hl_hdrlen);
  6541. -          skb->free = 1;
  6542. +                skb_reserve(skb, dev->drv[drvidx]->interface->hl_hdrlen);
  6543. +                skb->free = 1;
  6544.  
  6545. -          if (user)
  6546. -                  memcpy_fromfs(skb_put(skb, len), buf, len);
  6547. -          else
  6548. -                  memcpy(skb_put(skb, len), buf, len);
  6549. +                if (user)
  6550. +                        memcpy_fromfs(skb_put(skb, len), buf, len);
  6551. +                else
  6552. +                        memcpy(skb_put(skb, len), buf, len);
  6553.  
  6554. -          return dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, skb);
  6555. +                ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx,
  6556. +                                                                chan, skb);
  6557.          }
  6558. +        if (ret > 0)
  6559. +                dev->obytes[isdn_dc2minor(drvidx,chan)] += ret;
  6560. +        return ret;
  6561.  }
  6562.  
  6563.  /*
  6564. @@ -1703,6 +1836,8 @@
  6565.                       writebuf(drvidx,chan,skb->data,skb->len,0))==skb->len)
  6566.                  dev_kfree_skb(skb, FREE_WRITE);
  6567.          }
  6568. +        if (ret > 0)
  6569. +                dev->obytes[isdn_dc2minor(drvidx,chan)] += skb->len;
  6570.          return ret;
  6571.  }
  6572.  
  6573. @@ -1750,14 +1885,17 @@
  6574.          return 0;
  6575.      }
  6576.      memset((char *) d->rcvcount, 0, sizeof(int) * n);
  6577. -    if (!(d->rpqueue = (pqueue **) kmalloc(sizeof(pqueue *) * n, GFP_KERNEL))) {
  6578. -        printk(KERN_WARNING "register_isdn: Could not alloc rpqueue\n");
  6579. -        kfree(d->rcvcount);
  6580. -        kfree(d->rcverr);
  6581. -        kfree(d);
  6582. -        return 0;
  6583. -    }
  6584. -    memset((char *) d->rpqueue, 0, sizeof(pqueue *) * n);
  6585. +        if (!(d->rpqueue =
  6586. +              (struct sk_buff_head *) kmalloc(sizeof(struct sk_buff_head) * n, GFP_KERNEL))) {
  6587. +                printk(KERN_WARNING "register_isdn: Could not alloc rpqueue\n");
  6588. +                kfree(d->rcvcount);
  6589. +                kfree(d->rcverr);
  6590. +                kfree(d);
  6591. +                return 0;
  6592. +        }
  6593. +        for (j = 0; j < n; j++) {
  6594. +                skb_queue_head_init(&d->rpqueue[j]);
  6595. +        }
  6596.      if (!(d->rcv_waitq = (struct wait_queue **)
  6597.            kmalloc(sizeof(struct wait_queue *) * n, GFP_KERNEL))) {
  6598.          printk(KERN_WARNING "register_isdn: Could not alloc rcv_waitq\n");
  6599. @@ -1799,6 +1937,9 @@
  6600.          sprintf(i->id, "line%d", drvidx);
  6601.      save_flags(flags);
  6602.      cli();
  6603. +        for (j = 0; j < drvidx; j++)
  6604. +                if (!strcmp(i->id,dev->drvid[j]))
  6605. +                    sprintf(i->id, "line%d", drvidx);                    
  6606.      for (j = 0; j < n; j++)
  6607.          for (k = 0; k < ISDN_MAX_CHANNELS; k++)
  6608.              if (dev->chanmap[k] < 0) {
  6609. @@ -1894,7 +2035,7 @@
  6610.          tty_unregister_driver(&dev->mdm.tty_modem);
  6611.          tty_unregister_driver(&dev->mdm.cua_modem);
  6612.          for (i = 0; i < ISDN_MAX_CHANNELS; i++)
  6613. -            kfree(dev->mdm.info[i].xmit_buf - 4);
  6614. +            kfree(dev->mdm.info[i].xmit_buf);
  6615.          unregister_chrdev(ISDN_MAJOR, "isdn");
  6616.          kfree(dev);
  6617.          return -EIO;
  6618. @@ -1904,11 +2045,11 @@
  6619.          if (!has_exported)
  6620.                  isdn_export_syms();
  6621.  
  6622. -    printk(KERN_NOTICE "ISDN subsystem Rev: %s/%s/%s/%s",
  6623. -           isdn_getrev(isdn_revision),
  6624. -           isdn_getrev(isdn_tty_revision),
  6625. -           isdn_getrev(isdn_net_revision),
  6626. -           isdn_getrev(isdn_ppp_revision));
  6627. +    printk(KERN_NOTICE "ISDN subsystem Rev: %s/", isdn_getrev(isdn_revision));
  6628. +        printk("%s/", isdn_getrev(isdn_tty_revision));
  6629. +        printk("%s/", isdn_getrev(isdn_net_revision));
  6630. +        printk("%s/", isdn_getrev(isdn_ppp_revision));
  6631. +        printk("%s", isdn_getrev(isdn_audio_revision));
  6632.  
  6633.  #ifdef MODULE
  6634.      printk(" loaded\n");
  6635. @@ -1949,8 +2090,10 @@
  6636.          restore_flags(flags);
  6637.          return;
  6638.      }
  6639. -    for (i = 0; i < ISDN_MAX_CHANNELS; i++)
  6640. -        kfree(dev->mdm.info[i].xmit_buf - 4);
  6641. +    for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  6642. +                isdn_tty_cleanup_xmit(&dev->mdm.info[i]);
  6643. +        kfree(dev->mdm.info[i].xmit_buf);
  6644. +        }
  6645.      if (unregister_chrdev(ISDN_MAJOR, "isdn") != 0) {
  6646.          printk(KERN_WARNING "isdn: controldevice busy, remove cancelled\n");
  6647.      } else {
  6648. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_common.h linux/drivers/isdn/isdn_common.h
  6649. --- pre2.0.5/linux/drivers/isdn/isdn_common.h    Sun Apr 21 19:22:06 1996
  6650. +++ linux/drivers/isdn/isdn_common.h    Sun May 19 15:29:29 1996
  6651. @@ -38,7 +38,6 @@
  6652.  #undef  ISDN_DEBUG_AT
  6653.  #undef  ISDN_DEBUG_NET_DUMP
  6654.  #undef  ISDN_DEBUG_NET_DIAL
  6655. -#undef  ISDN_DEBUG_NET_BUILDHDR
  6656.  #undef  ISDN_DEBUG_NET_ICALL
  6657.  
  6658.  /* Prototypes */
  6659. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_net.c linux/drivers/isdn/isdn_net.c
  6660. --- pre2.0.5/linux/drivers/isdn/isdn_net.c    Tue May  7 16:22:26 1996
  6661. +++ linux/drivers/isdn/isdn_net.c    Sun May 19 15:29:29 1996
  6662. @@ -1,4 +1,4 @@
  6663. -/* $Id: isdn_net.c,v 1.5 1996/04/20 16:28:38 fritz Exp $
  6664. +/* $Id: isdn_net.c,v 1.11 1996/05/18 01:36:59 fritz Exp $
  6665.   *
  6666.   * Linux ISDN subsystem, network interfaces and related functions (linklevel).
  6667.   *
  6668. @@ -21,6 +21,25 @@
  6669.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  6670.   *
  6671.   * $Log: isdn_net.c,v $
  6672. + * Revision 1.11  1996/05/18 01:36:59  fritz
  6673. + * Added spelling corrections and some minor changes
  6674. + * to stay in sync with kernel.
  6675. + *
  6676. + * Revision 1.10  1996/05/17 03:49:01  fritz
  6677. + * Some cleanup.
  6678. + *
  6679. + * Revision 1.9  1996/05/06 11:34:57  hipp
  6680. + * fixed a few bugs
  6681. + *
  6682. + * Revision 1.8  1996/04/30 21:04:40  fritz
  6683. + * Test commit
  6684. + *
  6685. + * Revision 1.7  1996/04/30 11:10:42  fritz
  6686. + * Added Michael's ippp-bind patch.
  6687. + *
  6688. + * Revision 1.6  1996/04/30 09:34:35  fritz
  6689. + * Removed compatibility-macros.
  6690. + *
  6691.   * Revision 1.5  1996/04/20 16:28:38  fritz
  6692.   * Made more parameters of the dial statemachine user-configurable and
  6693.   * added hangup after dial for more reliability using callback.
  6694. @@ -55,9 +74,7 @@
  6695.   *
  6696.   */
  6697.  
  6698. -#ifndef STANDALONE
  6699.  #include <linux/config.h>
  6700. -#endif
  6701.  #define __NO_VERSION__
  6702.  #include <linux/module.h>
  6703.  #include <linux/isdn.h>
  6704. @@ -79,7 +96,9 @@
  6705.  static int isdn_net_start_xmit(struct sk_buff *, struct device *);
  6706.  static int isdn_net_xmit(struct device *, isdn_net_local *, struct sk_buff *);
  6707.   
  6708. -char *isdn_net_revision = "$Revision: 1.5 $";
  6709. +extern void dev_purge_queues(struct device *dev);    /* move this to net/core/dev.c */
  6710. +
  6711. +char *isdn_net_revision = "$Revision: 1.11 $";
  6712.  
  6713.   /*
  6714.    * Code for raw-networking over ISDN
  6715. @@ -143,6 +162,32 @@
  6716.  }
  6717.  
  6718.  /*
  6719. + * unbind a net-interface (resets interface after an error)
  6720. + */
  6721. +static void
  6722. +isdn_net_unbind_channel(isdn_net_local * lp)
  6723. +{
  6724. +    ulong flags;
  6725. +
  6726. +    save_flags(flags);
  6727. +    cli();
  6728. +        if (lp->first_skb) {
  6729. +                dev_kfree_skb(lp->first_skb,FREE_WRITE);
  6730. +                lp->first_skb = NULL;
  6731. +        }
  6732. +    dev_purge_queues(&lp->netdev->dev);
  6733. +    lp->dialstate = 0;
  6734. +    dev->rx_netdev[isdn_dc2minor(lp->isdn_device,lp->isdn_channel)] = NULL;
  6735. +    dev->st_netdev[isdn_dc2minor(lp->isdn_device,lp->isdn_channel)] = NULL;
  6736. +    isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET);
  6737. +    lp->flags &= ~ISDN_NET_CONNECTED;
  6738. +    lp->isdn_device = -1;
  6739. +    lp->isdn_channel = -1;
  6740. +
  6741. +        restore_flags(flags);
  6742. +}
  6743. +
  6744. +/*
  6745.   * Perform auto-hangup and cps-calculation for net-interfaces.
  6746.   *
  6747.   * auto-hangup:
  6748. @@ -232,6 +277,8 @@
  6749.                  /* Either D-Channel-hangup or error during dialout */
  6750.                  if ((!lp->dialstate) && (lp->flags & ISDN_NET_CONNECTED)) {
  6751.                      lp->flags &= ~ISDN_NET_CONNECTED;
  6752. +                    if(lp->first_skb)
  6753. +                        dev_kfree_skb(lp->first_skb,FREE_WRITE);
  6754.                      isdn_free_channel(lp->isdn_device, lp->isdn_channel,
  6755.                                                            ISDN_USAGE_NET);
  6756.  #ifdef CONFIG_ISDN_PPP
  6757. @@ -541,6 +588,7 @@
  6758.                  dev_kfree_skb(lp->first_skb,FREE_WRITE);
  6759.                  lp->first_skb = NULL;
  6760.          }
  6761. +    dev_purge_queues(d);
  6762.      if (lp->flags & ISDN_NET_CONNECTED) {
  6763.          printk(KERN_INFO "isdn_net: local hangup %s\n", lp->name);
  6764.          lp->dialstate = 0;
  6765. @@ -695,8 +743,10 @@
  6766.  
  6767.      /* For the other encaps the header has already been built */
  6768.  #ifdef CONFIG_ISDN_PPP
  6769. -    if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
  6770. -        return (isdn_ppp_xmit(skb, ndev));
  6771. +    if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) {
  6772. +        ndev->tbusy = ret = isdn_ppp_xmit(skb, ndev);
  6773. +        return ret;
  6774. +    }
  6775.  #endif        
  6776.      /* Reset hangup-timeout */
  6777.      lp->huptimer = 0;
  6778. @@ -755,7 +805,6 @@
  6779.  {
  6780.      isdn_net_local *lp = (isdn_net_local *) ndev->priv;
  6781.  
  6782. -
  6783.      if (ndev->tbusy) {
  6784.          if (jiffies - ndev->trans_start < 20)
  6785.              return 1;
  6786. @@ -795,6 +844,8 @@
  6787.                                                 "isdn_net_start_xmit: No channel for %s\n",
  6788.                                                 ndev->name);
  6789.                      restore_flags(flags);
  6790. +        /* we probably should drop the skb here and return 0 to omit
  6791. +           'socket destroy delayed' messages */
  6792.                      return 1;
  6793.                  }
  6794.                                  /* Log packet, which triggered dialing */
  6795. @@ -805,15 +856,18 @@
  6796.                  /* Connect interface with channel */
  6797.                  isdn_net_bind_channel(lp, chi);
  6798.  #ifdef CONFIG_ISDN_PPP
  6799. -                if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
  6800. +                if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) {
  6801. +                    /* no 'first_skb' handling for syncPPP */
  6802.                      if (isdn_ppp_bind(lp) < 0) {
  6803. -                        lp->dialstate = 0;
  6804. -                        isdn_free_channel(lp->isdn_device,
  6805. -                                                                  lp->isdn_channel,
  6806. -                                                                  ISDN_USAGE_NET);
  6807. +                        lp->first_skb = skb;    /* net_unbind will free skb */
  6808. +                        isdn_net_unbind_channel(lp);
  6809.                                                  restore_flags(flags);
  6810. -                        return 1;
  6811. +                        return 0;    /* STN (skb to nirvana) ;) */
  6812.                      }
  6813. +                                    isdn_net_dial();    /* Initiate dialing */
  6814. +                    restore_flags(flags);
  6815. +                    return 1;    /* let upper layer requeue skb packet */
  6816. +                }
  6817.  #endif
  6818.                                  /* remember first skb to speed up arp
  6819.                                   * when using encap ETHER
  6820. @@ -1630,9 +1684,7 @@
  6821.  #ifdef CONFIG_ISDN_PPP
  6822.                          if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
  6823.                              if (isdn_ppp_bind(lp) < 0) {
  6824. -                                isdn_free_channel(p->local.isdn_device, p->local.isdn_channel,
  6825. -                                         ISDN_USAGE_NET);
  6826. -                                lp->dialstate = 0;
  6827. +                                isdn_net_unbind_channel(lp);
  6828.                                  restore_flags(flags);
  6829.                                  return 0;
  6830.                              }
  6831. @@ -1647,15 +1699,6 @@
  6832.                  } else {
  6833.                      printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name, nr,
  6834.                             eaz);
  6835. -#if 0
  6836. -/* why is this a CONFIG_ISDN_PPP feature ??? */
  6837. -#ifdef CONFIG_ISDN_PPP
  6838. -                    if (p->local.isdn_device != -1) {
  6839. -                        isdn_free_channel(p->local.isdn_device, p->local.isdn_channel,
  6840. -                             ISDN_USAGE_NET);
  6841. -                    }
  6842. -#endif
  6843. -#endif
  6844.                      /* if this interface is dialing, it does it probably on a different
  6845.                         device, so free this device */
  6846.                      if ((p->local.dialstate == 4) || (p->local.dialstate == 12))
  6847. @@ -1669,6 +1712,7 @@
  6848.                      p->local.isdn_device = di;
  6849.                      p->local.isdn_channel = ch;
  6850.                      p->local.ppp_minor = -1;
  6851. +                    p->local.pppbind = -1;
  6852.                      p->local.flags |= ISDN_NET_CONNECTED;
  6853.                      p->local.dialstate = 7;
  6854.                      p->local.dtimer = 0;
  6855. @@ -1679,9 +1723,7 @@
  6856.  #ifdef CONFIG_ISDN_PPP
  6857.                      if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
  6858.                          if (isdn_ppp_bind(lp) < 0) {
  6859. -                            isdn_free_channel(p->local.isdn_device, p->local.isdn_channel,
  6860. -                             ISDN_USAGE_NET);
  6861. -                            lp->dialstate = 0;
  6862. +                            isdn_net_unbind_channel(lp);
  6863.                              restore_flags(flags);
  6864.                              return 0;
  6865.                          }
  6866. @@ -1745,9 +1787,9 @@
  6867.  #ifdef CONFIG_ISDN_PPP
  6868.              if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
  6869.                  if (isdn_ppp_bind(lp) < 0) {
  6870. -                    lp->dialstate = 0;
  6871. -                    isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET);
  6872. -                    return 1;
  6873. +                    isdn_net_unbind_channel(lp);
  6874. +                    restore_flags(flags);
  6875. +                    return -EAGAIN;
  6876.                  }
  6877.  #endif
  6878.              /* Initiate dialing */
  6879. @@ -1841,6 +1883,7 @@
  6880.      netdev->local.pre_channel = -1;
  6881.      netdev->local.exclusive = -1;
  6882.      netdev->local.ppp_minor = -1;
  6883. +    netdev->local.pppbind = -1;
  6884.      netdev->local.l2_proto = ISDN_PROTO_L2_X75I;
  6885.      netdev->local.l3_proto = ISDN_PROTO_L3_TRANS;
  6886.      netdev->local.slavedelay = 10 * HZ;
  6887. @@ -1987,6 +2030,7 @@
  6888.                  p->local.cbdelay     = cfg->cbdelay;
  6889.                  p->local.dialmax     = cfg->dialmax;
  6890.          p->local.slavedelay  = cfg->slavedelay * HZ;
  6891. +        p->local.pppbind     = cfg->pppbind;
  6892.          if (cfg->secure)
  6893.              p->local.flags |= ISDN_NET_SECURE;
  6894.          else
  6895. @@ -2062,14 +2106,16 @@
  6896.          cfg->l3_proto = p->local.l3_proto;
  6897.          cfg->p_encap = p->local.p_encap;
  6898.          cfg->secure = (p->local.flags & ISDN_NET_SECURE) ? 1 : 0;
  6899. -        cfg->callback = (p->local.flags & ISDN_NET_CALLBACK) ? 1 : 0;
  6900. -        cfg->callback = (p->local.flags & ISDN_NET_CBOUT) ? 2 : 0;
  6901. +        cfg->callback = 0;
  6902. +                if (p->local.flags & ISDN_NET_CALLBACK)
  6903. +                        cfg->callback = (p->local.flags & ISDN_NET_CBOUT)?2:1;
  6904.          cfg->cbhup = (p->local.flags & ISDN_NET_CBHUP) ? 1 : 0;
  6905.          cfg->chargehup = (p->local.hupflags & 4) ? 1 : 0;
  6906.          cfg->ihup = (p->local.hupflags & 8) ? 1 : 0;
  6907.                  cfg->cbdelay = p->local.cbdelay;
  6908.                  cfg->dialmax = p->local.dialmax;
  6909.          cfg->slavedelay = p->local.slavedelay / HZ;
  6910. +        cfg->pppbind = p->local.pppbind;
  6911.          if (p->local.slave)
  6912.              strcpy(cfg->slave, ((isdn_net_local *) p->local.slave->priv)->name);
  6913.          else
  6914. @@ -2287,7 +2333,7 @@
  6915.      restore_flags(flags);
  6916.  
  6917.  #ifdef CONFIG_ISDN_PPP
  6918. -    isdn_ppp_free_mpqueue(p);
  6919. +    isdn_ppp_free_mpqueue(p);    /* still necessary? */
  6920.  #endif
  6921.      kfree(p);
  6922.  
  6923. @@ -2341,6 +2387,26 @@
  6924.      restore_flags(flags);
  6925.      return 0;
  6926.  }
  6927. +
  6928. +/* 
  6929. + * helper function to flush device queues
  6930. + * the better place would be net/core/dev.c
  6931. + */
  6932. +void dev_purge_queues(struct device *dev)
  6933. +{
  6934. +    int i;
  6935. +    for(i=0;i<DEV_NUMBUFFS;i++) {
  6936. +        struct sk_buff *skb;
  6937. +        while((skb=skb_dequeue(&dev->buffs[i])))
  6938. +            if(skb->free)
  6939. +                kfree_skb(skb,FREE_WRITE);
  6940. +        }
  6941. +    
  6942. +}
  6943. +
  6944. +
  6945. +
  6946. +
  6947.  
  6948.  
  6949.  
  6950. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_ppp.c linux/drivers/isdn/isdn_ppp.c
  6951. --- pre2.0.5/linux/drivers/isdn/isdn_ppp.c    Tue May  7 16:22:26 1996
  6952. +++ linux/drivers/isdn/isdn_ppp.c    Sun May 19 15:29:29 1996
  6953. @@ -1,4 +1,4 @@
  6954. -/* $Id: isdn_ppp.c,v 1.5 1996/04/20 16:32:32 fritz Exp $
  6955. +/* $Id: isdn_ppp.c,v 1.9 1996/05/18 01:37:01 fritz Exp $
  6956.   *
  6957.   * Linux ISDN subsystem, functions for synchronous PPP (linklevel).
  6958.   *
  6959. @@ -19,6 +19,19 @@
  6960.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  6961.   *
  6962.   * $Log: isdn_ppp.c,v $
  6963. + * Revision 1.9  1996/05/18 01:37:01  fritz
  6964. + * Added spelling corrections and some minor changes
  6965. + * to stay in sync with kernel.
  6966. + *
  6967. + * Revision 1.8  1996/05/06 11:34:55  hipp
  6968. + * fixed a few bugs
  6969. + *
  6970. + * Revision 1.7  1996/04/30 11:07:42  fritz
  6971. + * Added Michael's ippp-bind patch.
  6972. + *
  6973. + * Revision 1.6  1996/04/30 09:33:09  fritz
  6974. + * Removed compatibility-macros.
  6975. + *
  6976.   * Revision 1.5  1996/04/20 16:32:32  fritz
  6977.   * Changed ippp_table to an array of pointers, allocating each part
  6978.   * separately.
  6979. @@ -43,9 +56,7 @@
  6980.  
  6981.  /* TODO: right tbusy handling when using MP */
  6982.  
  6983. -#ifndef STANDALONE
  6984.  #include <linux/config.h>
  6985. -#endif
  6986.  #define __NO_VERSION__
  6987.  #include <linux/module.h>
  6988.  #include <linux/isdn.h>
  6989. @@ -58,8 +69,8 @@
  6990.  #endif
  6991.   
  6992.  /* Prototypes */
  6993. -static int isdn_ppp_fill_rq(char *buf, int len, int minor);
  6994. -static int isdn_ppp_hangup(int);
  6995. +static int isdn_ppp_fill_rq(char *buf, int len,int proto, int minor);
  6996. +static int isdn_ppp_closewait(int);
  6997.  static void isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp,
  6998.              struct sk_buff *skb, int proto);
  6999.  static int isdn_ppp_if_get_unit(char **namebuf);
  7000. @@ -72,47 +83,53 @@
  7001.          int BEbyte, int *sqno, int min_sqno);
  7002.  #endif
  7003.  
  7004. -char *isdn_ppp_revision              = "$Revision: 1.5 $";
  7005. +char *isdn_ppp_revision              = "$Revision: 1.9 $";
  7006.  struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS];
  7007.  
  7008.  extern int isdn_net_force_dial_lp(isdn_net_local *);
  7009.  
  7010. -int isdn_ppp_free(isdn_net_local * lp)
  7011. +/*
  7012. + * unbind isdn_net_local <=> ippp-device 
  7013. + * note: it can happen, that we hangup/free the master before the slaves
  7014. + */
  7015. +int isdn_ppp_free(isdn_net_local *lp)
  7016.  {
  7017. +    isdn_net_local *master_lp=lp;
  7018. +
  7019.      if (lp->ppp_minor < 0)
  7020.          return 0;
  7021.  
  7022.  #ifdef CONFIG_ISDN_MPP
  7023.      if(lp->master)
  7024. -    {
  7025. -        isdn_net_dev *p = dev->netdev;
  7026. -        lp->last->next = lp->next;
  7027. -        lp->next->last = lp->last;
  7028. -        if(lp->netdev->queue == lp)
  7029. -            lp->netdev->queue = lp->next;
  7030. -                lp->next = lp->last = lp;
  7031. -        while(p) {
  7032. -            if(lp == &p->local) {
  7033. -                lp->netdev = p;
  7034. -                break;
  7035. -            }
  7036. -            p=p->next;
  7037. +        master_lp = (isdn_net_local *) lp->master->priv;
  7038. +
  7039. +    lp->last->next = lp->next;
  7040. +    lp->next->last = lp->last;
  7041. +    if(master_lp->netdev->queue == lp) {
  7042. +        master_lp->netdev->queue = lp->next;
  7043. +        if(lp->next == lp) {    /* last link in queue? */
  7044. +                       master_lp->netdev->ib.bundled = 0;
  7045. +            isdn_ppp_free_mpqueue(master_lp->netdev);
  7046. +            isdn_ppp_free_sqqueue(master_lp->netdev);
  7047.          }
  7048. -    } else {
  7049. -                lp->netdev->ib.bundled = 0;
  7050. -        /* last link: free mpqueue, free sqqueue ? */
  7051.      }
  7052. -
  7053. +    lp->next = lp->last = lp;    /* (re)set own pointers */
  7054.  #endif
  7055.  
  7056. -    isdn_ppp_hangup(lp->ppp_minor);
  7057. -#if 0
  7058. -    printk(KERN_DEBUG "isdn_ppp_free %d %lx %lx\n", lp->ppp_minor, (long) lp,(long) ippp_table[lp->ppp_minor]->lp);
  7059. -#endif
  7060. -    ippp_table[lp->ppp_minor]->lp = NULL;
  7061. +    isdn_ppp_closewait(lp->ppp_minor);    /* force wakeup on ippp device */
  7062. +
  7063. +    if(ippp_table[lp->ppp_minor]->debug & 0x1)
  7064. +        printk(KERN_DEBUG "isdn_ppp_free %d %lx %lx\n", lp->ppp_minor, (long) lp,(long) ippp_table[lp->ppp_minor]->lp);
  7065. +
  7066. +    ippp_table[lp->ppp_minor]->lp = NULL;    /* link is down .. set lp to NULL */
  7067. +    lp->ppp_minor = -1;            /* is this OK ?? */
  7068. +
  7069.      return 0;
  7070.  }
  7071.  
  7072. +/*
  7073. + * bind isdn_net_local <=> ippp-device
  7074. + */
  7075.  int isdn_ppp_bind(isdn_net_local * lp)
  7076.  {
  7077.      int i;
  7078. @@ -126,16 +143,31 @@
  7079.      save_flags(flags);
  7080.      cli();
  7081.  
  7082. -        /* 
  7083. -         * search a free device 
  7084. -         */
  7085. -    for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  7086. -        if (ippp_table[i]->state == IPPP_OPEN) {        /* OPEN, but not connected! */
  7087. -#if 0
  7088. -            printk(KERN_DEBUG "find_minor, %d lp: %08lx\n", i, (long) lp);
  7089. -#endif
  7090. -            break;
  7091. +    if(lp->pppbind < 0)    /* device bounded to ippp device ? */
  7092. +    {
  7093. +         isdn_net_dev *net_dev = dev->netdev;
  7094. +        char exclusive[ISDN_MAX_CHANNELS];    /* exclusive flags */
  7095. +        memset(exclusive,0,ISDN_MAX_CHANNELS);
  7096. +        while (net_dev) {    /* step through net devices to find exclusive minors */
  7097. +            isdn_net_local *lp = &net_dev->local;
  7098. +            if(lp->pppbind >= 0)
  7099. +                exclusive[lp->pppbind] = 1;
  7100. +            net_dev = net_dev->next;
  7101.          }
  7102. +        /*
  7103. +         * search a free device 
  7104. +         */
  7105. +        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  7106. +            if (ippp_table[i]->state == IPPP_OPEN && !exclusive[i]) { /* OPEN, but not connected! */
  7107. +                break;
  7108. +            }
  7109. +        }
  7110. +    }
  7111. +    else {
  7112. +        if (ippp_table[lp->pppbind]->state == IPPP_OPEN) /* OPEN, but not connected! */
  7113. +            i = lp->pppbind;
  7114. +        else
  7115. +            i = ISDN_MAX_CHANNELS;    /* trigger error */
  7116.      }
  7117.  
  7118.      if (i >= ISDN_MAX_CHANNELS) {
  7119. @@ -163,7 +195,12 @@
  7120.      return lp->ppp_minor;
  7121.  }
  7122.  
  7123. -static int isdn_ppp_hangup(int minor)
  7124. +/*
  7125. + * there was a hangup on the netdevice
  7126. + * force wakeup of the ippp device 
  7127. + * go into 'device waits for release' state
  7128. + */
  7129. +static int isdn_ppp_closewait(int minor)
  7130.  {
  7131.      if (minor < 0 || minor >= ISDN_MAX_CHANNELS)
  7132.          return 0;
  7133. @@ -181,9 +218,8 @@
  7134.  
  7135.  int isdn_ppp_open(int minor, struct file *file)
  7136.  {
  7137. -#if 0
  7138. -    printk(KERN_DEBUG "ippp, open, minor: %d state: %04x\n", minor,ippp_table[minor]->state);
  7139. -#endif
  7140. +    if(ippp_table[minor]->debug & 0x1)
  7141. +        printk(KERN_DEBUG "ippp, open, minor: %d state: %04x\n", minor,ippp_table[minor]->state);
  7142.      if (ippp_table[minor]->state)
  7143.          return -EBUSY;
  7144.  
  7145. @@ -219,6 +255,9 @@
  7146.      return 0;
  7147.  }
  7148.  
  7149. +/*
  7150. + * release ippp device
  7151. + */
  7152.  void isdn_ppp_release(int minor, struct file *file)
  7153.  {
  7154.      int i;
  7155. @@ -226,29 +265,24 @@
  7156.      if (minor < 0 || minor >= ISDN_MAX_CHANNELS)
  7157.          return;
  7158.  
  7159. -#if 0
  7160. -    printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", minor, (long) ippp_table[minor]->lp);
  7161. -#endif
  7162. +    if(ippp_table[minor]->debug & 0x1)
  7163. +        printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", minor, (long) ippp_table[minor]->lp);
  7164.  
  7165.      if (ippp_table[minor]->lp) {    /* a lp address says: this link is still up */
  7166.          isdn_net_dev *p = dev->netdev;
  7167. -        while(p) {    /* find interface for our lp; */
  7168. -            if(&p->local == ippp_table[minor]->lp)
  7169. -                break;
  7170. -            p = p->next;
  7171. -        }
  7172. -        if(!p) {
  7173. -            printk(KERN_ERR "isdn_ppp_release: Can't find device for net_local\n");
  7174. -            p = ippp_table[minor]->lp->netdev;
  7175. -        }
  7176. +        p = ippp_table[minor]->lp->netdev;
  7177.          ippp_table[minor]->lp->ppp_minor = -1;
  7178. -        isdn_net_hangup(&p->dev); /* lp->ppp_minor==-1 => no calling of isdn_ppp_hangup() */
  7179. +        isdn_net_hangup(&p->dev); /* lp->ppp_minor==-1 => no calling of isdn_ppp_closewait() */
  7180.          ippp_table[minor]->lp = NULL;
  7181.      }
  7182.      for (i = 0; i < NUM_RCV_BUFFS; i++) {
  7183. -        if (ippp_table[minor]->rq[i].buf)
  7184. +        if (ippp_table[minor]->rq[i].buf) {
  7185.              kfree(ippp_table[minor]->rq[i].buf);
  7186. +            ippp_table[minor]->rq[i].buf = NULL;
  7187. +        }
  7188.      }
  7189. +        ippp_table[minor]->first = ippp_table[minor]->rq + NUM_RCV_BUFFS - 1; /* receive queue */
  7190. +        ippp_table[minor]->last = ippp_table[minor]->rq;
  7191.  
  7192.  #ifdef CONFIG_ISDN_PPP_VJ
  7193.      slhc_free(ippp_table[minor]->slcomp);
  7194. @@ -258,6 +292,9 @@
  7195.      ippp_table[minor]->state = 0;
  7196.  }
  7197.  
  7198. +/*
  7199. + * get_arg .. ioctl helper
  7200. + */
  7201.  static int get_arg(void *b, unsigned long *val)
  7202.  {
  7203.      int r;
  7204. @@ -267,6 +304,9 @@
  7205.      return 0;
  7206.  }
  7207.  
  7208. +/*
  7209. + * set arg .. ioctl helper
  7210. + */
  7211.  static int set_arg(void *b, unsigned long val)
  7212.  {
  7213.      int r;
  7214. @@ -276,15 +316,17 @@
  7215.      return 0;
  7216.  }
  7217.  
  7218. +/*
  7219. + * ippp device ioctl 
  7220. + */
  7221.  int isdn_ppp_ioctl(int minor, struct file *file, unsigned int cmd, unsigned long arg)
  7222.  {
  7223.      unsigned long val;
  7224.      int r;
  7225.  
  7226. -#if 0
  7227. -    printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x",minor,cmd);
  7228. -    printk(KERN_DEBUG " state: %x\n",ippp_table[minor]->state);
  7229. -#endif
  7230. +    if(ippp_table[minor]->debug & 0x1)
  7231. +        printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n",
  7232. +            minor,cmd,ippp_table[minor]->state);
  7233.  
  7234.      if (!(ippp_table[minor]->state & IPPP_OPEN))
  7235.          return -EINVAL;
  7236. @@ -328,8 +370,9 @@
  7237.              return r;
  7238.          }
  7239.          if (val & SC_ENABLE_IP && !(ippp_table[minor]->pppcfg & SC_ENABLE_IP)) {
  7240. -            ippp_table[minor]->lp->netdev->dev.tbusy = 0;
  7241. -            mark_bh(NET_BH); /* OK .. we are ready to send the first buffer */
  7242. +            isdn_net_local *lp = ippp_table[minor]->lp;
  7243. +            lp->netdev->dev.tbusy = 0;
  7244. +            mark_bh(NET_BH); /* OK .. we are ready to send buffers */
  7245.          }
  7246.          ippp_table[minor]->pppcfg = val;
  7247.          break;
  7248. @@ -354,8 +397,13 @@
  7249.          ippp_table[minor]->maxcid = val;
  7250.          break;
  7251.      case PPPIOCGDEBUG:
  7252. +        if ((r = set_arg((void *) arg, ippp_table[minor]->debug)))
  7253. +            return r;
  7254.          break;
  7255.      case PPPIOCSDEBUG:
  7256. +        if ((r = get_arg((void *) arg, &val)))
  7257. +            return r;
  7258. +        ippp_table[minor]->debug = val;
  7259.          break;
  7260.      default:
  7261.          break;
  7262. @@ -368,9 +416,8 @@
  7263.      struct ippp_buf_queue *bf, *bl;
  7264.      unsigned long flags;
  7265.  
  7266. -#if 0
  7267. -    printk(KERN_DEBUG "isdn_ppp_select: minor: %d, type: %d \n",minor,type);
  7268. -#endif
  7269. +    if(ippp_table[minor]->debug & 0x2)
  7270. +        printk(KERN_DEBUG "isdn_ppp_select: minor: %d, type: %d \n",minor,type);
  7271.  
  7272.      if (!(ippp_table[minor]->state & IPPP_OPEN))
  7273.          return -EINVAL;
  7274. @@ -381,6 +428,9 @@
  7275.          cli();
  7276.          bl = ippp_table[minor]->last;
  7277.          bf = ippp_table[minor]->first;
  7278. +        /* 
  7279. +         * if IPPP_NOBLOCK is set we return even if we have nothing to read 
  7280. +         */
  7281.          if (bf->next == bl && !(ippp_table[minor]->state & IPPP_NOBLOCK)) {
  7282.              select_wait(&ippp_table[minor]->wq, st);
  7283.              restore_flags(flags);
  7284. @@ -403,7 +453,7 @@
  7285.   *  fill up isdn_ppp_read() queue ..
  7286.   */
  7287.  
  7288. -static int isdn_ppp_fill_rq(char *buf, int len, int minor)
  7289. +static int isdn_ppp_fill_rq(char *buf, int len,int proto, int minor)
  7290.  {
  7291.      struct ippp_buf_queue *bf, *bl;
  7292.      unsigned long flags;
  7293. @@ -428,15 +478,19 @@
  7294.          kfree(bf->buf);
  7295.          ippp_table[minor]->first = bf;
  7296.      }
  7297. -    bl->buf = (char *) kmalloc(len, GFP_ATOMIC);
  7298. +    bl->buf = (char *) kmalloc(len+4, GFP_ATOMIC);
  7299.      if (!bl->buf) {
  7300.          printk(KERN_WARNING "ippp: Can't alloc buf\n");
  7301.          restore_flags(flags);
  7302.          return 0;
  7303.      }
  7304. -    bl->len = len;
  7305. +    bl->len = len+4;
  7306.  
  7307. -    memcpy(bl->buf, buf, len);
  7308. +    bl->buf[0] = PPP_ALLSTATIONS;
  7309. +    bl->buf[1] = PPP_UI;
  7310. +    bl->buf[2] = proto >> 8;
  7311. +    bl->buf[3] = proto & 0xff;
  7312. +    memcpy(bl->buf+4, buf, len);
  7313.  
  7314.      ippp_table[minor]->last = bl->next;
  7315.      restore_flags(flags);
  7316. @@ -502,6 +556,7 @@
  7317.      if (!lp)
  7318.          printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n");
  7319.      else {
  7320. +        lp->huptimer = 0;
  7321.          if (lp->isdn_device < 0 || lp->isdn_channel < 0)
  7322.              return 0;
  7323.  
  7324. @@ -526,11 +581,11 @@
  7325.              if (!(ippp_table[i] = (struct ippp_struct *)
  7326.                      kmalloc(sizeof(struct ippp_struct), GFP_KERNEL))) {
  7327.                  printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n");
  7328. -                        for (j = 0; j < i; j++)
  7329. -                          kfree(ippp_table[i]);
  7330. +            for (j = 0; j < i; j++)
  7331. +                kfree(ippp_table[i]);
  7332.                  return -1;
  7333.              }
  7334. -                memset((char *) ippp_table[i], 0, sizeof(struct ippp_struct));
  7335. +        memset((char *) ippp_table[i], 0, sizeof(struct ippp_struct));
  7336.          ippp_table[i]->state = 0;
  7337.          ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1;
  7338.          ippp_table[i]->last = ippp_table[i]->rq;
  7339. @@ -559,14 +614,15 @@
  7340.  
  7341.  void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb)
  7342.  {
  7343. -#if 0
  7344. -    printk(KERN_DEBUG "recv, skb %d\n",skb->len);
  7345. -#endif
  7346. +    if(ippp_table[lp->ppp_minor]->debug & 0x4)
  7347. +        printk(KERN_DEBUG "recv skb, len: %ld\n",skb->len);
  7348.  
  7349.      if(skb->data[0] == 0xff && skb->data[1] == 0x03)
  7350.          skb_pull(skb,2);
  7351. -    else if (ippp_table[lp->ppp_minor]->pppcfg & SC_REJ_COMP_AC)
  7352. +    else if (ippp_table[lp->ppp_minor]->pppcfg & SC_REJ_COMP_AC) {
  7353. +        dev_kfree_skb(skb,FREE_WRITE);
  7354.          return;        /* discard it silently */
  7355. +    }
  7356.  
  7357.  #ifdef CONFIG_ISDN_MPP
  7358.      if (!(ippp_table[lp->ppp_minor]->mpppcfg & SC_REJ_MP_PROT)) {
  7359. @@ -583,11 +639,10 @@
  7360.              isdn_net_local *lpq;
  7361.              int sqno, min_sqno, tseq;
  7362.              u_char BEbyte = skb->data[0];
  7363. -#if 0
  7364. -            printk(KERN_DEBUG "recv: %d/%04x/%d -> %02x %02x %02x %02x %02x %02x\n", lp->ppp_minor, proto ,
  7365. -                (int) skb->len, (int) skb->data[0], (int) skb->data[1], (int) skb->data[2], 
  7366. -                (int) skb->data[3], (int) skb->data[4], (int) skb->data[5]);
  7367. -#endif
  7368. +            if(ippp_table[lp->ppp_minor]->debug & 0x8)
  7369. +                 printk(KERN_DEBUG "recv: %d/%04x/%d -> %02x %02x %02x %02x %02x %02x\n", lp->ppp_minor, proto ,
  7370. +                    (int) skb->len, (int) skb->data[0], (int) skb->data[1], (int) skb->data[2], 
  7371. +                    (int) skb->data[3], (int) skb->data[4], (int) skb->data[5]);
  7372.              if (!(ippp_table[lp->ppp_minor]->mpppcfg & SC_IN_SHORT_SEQ)) {
  7373.                  sqno = ((int) skb->data[1] << 16) + ((int) skb->data[2] << 8) + (int) skb->data[3];
  7374.                  skb_pull(skb,4);
  7375. @@ -657,8 +712,9 @@
  7376.  
  7377.                  q = (struct sqqueue *) kmalloc(sizeof(struct sqqueue), GFP_ATOMIC);
  7378.                  if (!q) {
  7379. -                    printk(KERN_WARNING "ippp: err, no memory !!\n");
  7380.                      net_dev->ib.modify = 0;
  7381. +                    printk(KERN_WARNING "ippp/MPPP: Bad! Can't alloc sq node!\n");
  7382. +                    dev_kfree_skb(skb,FREE_WRITE);
  7383.                      return;        /* discard */
  7384.                  }
  7385.                  q->skb = skb;
  7386. @@ -726,9 +782,8 @@
  7387.          }
  7388.      }
  7389.  
  7390. -#if 0
  7391. -    printk(KERN_DEBUG "push, skb %d %04x\n",skb->len,proto);
  7392. -#endif
  7393. +    if(ippp_table[lp->ppp_minor]->debug & 0x10)
  7394. +        printk(KERN_DEBUG "push, skb %ld %04x\n",skb->len,proto);
  7395.  
  7396.      switch (proto) {
  7397.      case PPP_IPX: /* untested */
  7398. @@ -755,6 +810,7 @@
  7399.              if (!skb) {
  7400.                  printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name);
  7401.                  net_dev->local.stats.rx_dropped++;
  7402. +                dev_kfree_skb(skb_old,FREE_WRITE);
  7403.                  return;
  7404.              }
  7405.              skb->dev = dev;
  7406. @@ -770,16 +826,12 @@
  7407.  #else
  7408.          printk(KERN_INFO "isdn: Ooopsa .. VJ-Compression support not compiled into isdn driver.\n");
  7409.          lp->stats.rx_dropped++;
  7410. +        dev_kfree_skb(skb,FREE_WRITE);
  7411.          return;
  7412.  #endif
  7413.          break;
  7414.      default:
  7415. -        skb_push(skb,4);
  7416. -        skb->data[0] = 0xff;
  7417. -        skb->data[1] = 0x03;
  7418. -        skb->data[2] = (proto>>8);
  7419. -        skb->data[3] = proto & 0xff;
  7420. -        isdn_ppp_fill_rq(skb->data, skb->len, lp->ppp_minor);    /* push data to pppd device */
  7421. +        isdn_ppp_fill_rq(skb->data, skb->len,proto, lp->ppp_minor);    /* push data to pppd device */
  7422.          dev_kfree_skb(skb,FREE_WRITE);
  7423.          return;
  7424.      }
  7425. @@ -793,19 +845,32 @@
  7426.  }
  7427.  
  7428.  /*
  7429. - * send ppp frame .. we expect a PIDCOMPable proto -- 
  7430. + * send ppp frame .. we expect a PIDCOMPressable proto -- 
  7431.   *  (here: currently always PPP_IP,PPP_VJC_COMP,PPP_VJC_UNCOMP)
  7432.   */
  7433.  int isdn_ppp_xmit(struct sk_buff *skb, struct device *dev)
  7434.  {
  7435. -    isdn_net_dev *nd = ((isdn_net_local *) dev->priv)->netdev;
  7436. -    isdn_net_local *lp = nd->queue;
  7437. +    struct device *mdev = ((isdn_net_local *) (dev->priv) )->master;    /* get master (for redundancy) */
  7438. +    isdn_net_local *lp,*mlp;
  7439. +    isdn_net_dev *nd;
  7440.      int proto = PPP_IP;    /* 0x21 */
  7441. -    struct ippp_struct *ipt = ippp_table[lp->ppp_minor];
  7442. -#if defined(CONFIG_ISDN_PPP_VJ) || defined(CONFIG_ISDN_MPP)
  7443. -    struct ippp_struct *ipts = ippp_table[lp->netdev->local.ppp_minor];
  7444. -#endif
  7445. +    struct ippp_struct *ipt,*ipts;
  7446.  
  7447. +    if(mdev)
  7448. +        mlp = (isdn_net_local *) (mdev->priv); 
  7449. +    else
  7450. +        mlp = (isdn_net_local *) (dev->priv);
  7451. +    nd = mlp->netdev;    /* get master lp */
  7452. +    lp = nd->queue;        /* get lp on top of queue */
  7453. +    ipt = ippp_table[lp->ppp_minor];
  7454. +    ipts = ippp_table[mlp->ppp_minor];
  7455. +
  7456. +    if (!(ipt->pppcfg & SC_ENABLE_IP)) {    /* PPP connected ? */
  7457. +        printk(KERN_INFO "isdn, xmit: Packet blocked: %d %d\n", lp->isdn_device, lp->isdn_channel);
  7458. +        return 1;
  7459. +        }
  7460. +        lp->huptimer = 0;
  7461.          /* If packet is to be resent, it has already been processed and
  7462.           * therefore its first bytes are already initialized. In this case
  7463.           * send it immediately ...
  7464. @@ -817,17 +882,16 @@
  7465.  
  7466.  /* future: step to next 'lp' when this lp is 'tbusy' */
  7467.  
  7468. -#if 0
  7469. -    printk(KERN_DEBUG  "xmit, skb %d\n",skb->len);
  7470. -#endif
  7471. +    if(ippp_table[lp->ppp_minor]->debug & 0x4)
  7472. +        printk(KERN_DEBUG  "xmit skb, len %ld\n",skb->len);
  7473.  
  7474.  #ifdef CONFIG_ISDN_PPP_VJ
  7475. -    if (ipt->pppcfg & SC_COMP_TCP) {
  7476. +    if (ipt->pppcfg & SC_COMP_TCP) {    /* ipt or ipts ? -> check this again! */
  7477.          u_char *buf = skb->data;
  7478.          int pktlen;
  7479.          int len = 4;
  7480.  #ifdef CONFIG_ISDN_MPP
  7481. -        if (ipt->mpppcfg & SC_MP_PROT) /* sigh */ 
  7482. +        if (ipt->mpppcfg & SC_MP_PROT) /* sigh */     /* ipt or ipts ?? */
  7483.              if (ipt->mpppcfg & SC_OUT_SHORT_SEQ)
  7484.                  len += 3;
  7485.              else
  7486. @@ -851,9 +915,8 @@
  7487.      }
  7488.  #endif
  7489.  
  7490. -#if 0
  7491. -    printk(KERN_DEBUG  "xmit, skb %d %04x\n",skb->len,proto);
  7492. -#endif
  7493. +        if(ippp_table[lp->ppp_minor]->debug & 0x24)
  7494. +         printk(KERN_DEBUG  "xmit2 skb, len %ld, proto %04x\n",skb->len,proto);
  7495.  
  7496.  #ifdef CONFIG_ISDN_MPP
  7497.      if (ipt->mpppcfg & SC_MP_PROT) {
  7498. @@ -883,15 +946,25 @@
  7499.      skb->data[2] = proto >> 8;
  7500.      skb->data[3] = proto & 0xff;
  7501.  
  7502. -    lp->huptimer = 0;
  7503. -    if (!(ipt->pppcfg & SC_ENABLE_IP)) {    /* PPP connected ? */
  7504. -        printk(KERN_INFO "isdn, xmit: Packet blocked: %d %d\n", lp->isdn_device, lp->isdn_channel);
  7505. -        return 1;
  7506. -    }
  7507.          /* tx-stats are now updated via BSENT-callback */
  7508.      return (isdn_net_send_skb(dev , lp , skb));
  7509.  }
  7510.  
  7511. +void isdn_ppp_free_sqqueue(isdn_net_dev * p) 
  7512. +{
  7513. +    struct sqqueue *q = p->ib.sq;
  7514. +
  7515. +    p->ib.sq = NULL;
  7516. +    while(q) {
  7517. +        struct sqqueue *qn = q->next;
  7518. +        if(q->skb)
  7519. +            dev_kfree_skb(q->skb,FREE_WRITE);
  7520. +        kfree(q);
  7521. +        q = qn;
  7522. +    }
  7523. +
  7524. +}
  7525. +
  7526.  void isdn_ppp_free_mpqueue(isdn_net_dev * p)
  7527.  {
  7528.      struct mpqueue *ql, *q = p->mp_last;
  7529. @@ -932,8 +1005,6 @@
  7530.      nlp->next = lp;
  7531.      p->queue = nlp;
  7532.  
  7533. -    nlp->netdev = lp->netdev;
  7534. -
  7535.      ippp_table[nlp->ppp_minor]->unit = ippp_table[lp->ppp_minor]->unit;
  7536.  /* maybe also SC_CCP stuff */
  7537.      ippp_table[nlp->ppp_minor]->pppcfg |= ippp_table[lp->ppp_minor]->pppcfg &
  7538. @@ -1239,4 +1310,34 @@
  7539.  #endif
  7540.  }
  7541.  
  7542. +int isdn_ppp_hangup_slave(char *name)
  7543. +{
  7544. +#ifdef CONFIG_ISDN_MPP
  7545. +        isdn_net_dev *ndev;
  7546. +        isdn_net_local *lp;
  7547. +        struct device *sdev;
  7548. +
  7549. +    if(!(ndev = isdn_net_findif(name)))
  7550. +        return 1;
  7551. +    lp = &ndev->local;
  7552. +    if(!(lp->flags & ISDN_NET_CONNECTED))
  7553. +        return 5;
  7554. +
  7555. +    sdev = lp->slave;
  7556. +    while(sdev)
  7557. +    {
  7558. +        isdn_net_local *mlp = (isdn_net_local *) sdev->priv;
  7559. +        if((mlp->flags & ISDN_NET_CONNECTED))
  7560. +            break;
  7561. +        sdev = mlp->slave;
  7562. +    }
  7563. +    if(!sdev)
  7564. +        return 2;
  7565. +
  7566. +    isdn_net_hangup(sdev);
  7567. +    return 0;
  7568. +#else
  7569. +    return -1;
  7570. +#endif
  7571. +}
  7572.  
  7573. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_ppp.h linux/drivers/isdn/isdn_ppp.h
  7574. --- pre2.0.5/linux/drivers/isdn/isdn_ppp.h    Sun Apr 21 19:22:07 1996
  7575. +++ linux/drivers/isdn/isdn_ppp.h    Sun May 19 15:29:29 1996
  7576. @@ -1,4 +1,4 @@
  7577. -/* $Id: isdn_ppp.h,v 1.2 1996/04/20 16:35:11 fritz Exp $
  7578. +/* $Id: isdn_ppp.h,v 1.4 1996/05/06 11:34:56 hipp Exp $
  7579.   *
  7580.   * header for Linux ISDN subsystem, functions for synchronous PPP (linklevel).
  7581.   *
  7582. @@ -19,6 +19,12 @@
  7583.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  7584.   *
  7585.   * $Log: isdn_ppp.h,v $
  7586. + * Revision 1.4  1996/05/06 11:34:56  hipp
  7587. + * fixed a few bugs
  7588. + *
  7589. + * Revision 1.3  1996/04/30 09:33:10  fritz
  7590. + * Removed compatibility-macros.
  7591. + *
  7592.   * Revision 1.2  1996/04/20 16:35:11  fritz
  7593.   * Changed isdn_ppp_receive to use sk_buff as parameter.
  7594.   * Added definition of isdn_ppp_dial_slave and ippp_table.
  7595. @@ -40,6 +46,7 @@
  7596.  extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
  7597.  extern int  isdn_ppp_dev_ioctl(struct device *, struct ifreq *, int);
  7598.  extern void isdn_ppp_free_mpqueue(isdn_net_dev *);
  7599. +extern void isdn_ppp_free_sqqueue(isdn_net_dev *);
  7600.  extern int  isdn_ppp_select(int, struct file *, int, select_table *);
  7601.  extern int  isdn_ppp_ioctl(int, struct file *, unsigned int, unsigned long);
  7602.  extern void isdn_ppp_release(int, struct file *);
  7603. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_tty.c linux/drivers/isdn/isdn_tty.c
  7604. --- pre2.0.5/linux/drivers/isdn/isdn_tty.c    Mon May 13 23:02:49 1996
  7605. +++ linux/drivers/isdn/isdn_tty.c    Sun May 19 16:14:53 1996
  7606. @@ -1,4 +1,4 @@
  7607. -/* $Id: isdn_tty.c,v 1.4 1996/04/20 16:39:54 fritz Exp $
  7608. +/* $Id: isdn_tty.c,v 1.11 1996/05/18 01:37:03 fritz Exp $
  7609.   *
  7610.   * Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
  7611.   *
  7612. @@ -20,6 +20,35 @@
  7613.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  7614.   *
  7615.   * $Log: isdn_tty.c,v $
  7616. + * Revision 1.11  1996/05/18 01:37:03  fritz
  7617. + * Added spelling corrections and some minor changes
  7618. + * to stay in sync with kernel.
  7619. + *
  7620. + * Revision 1.10  1996/05/17 03:51:49  fritz
  7621. + * Changed DLE handling for audio receive.
  7622. + *
  7623. + * Revision 1.9  1996/05/11 21:52:07  fritz
  7624. + * Changed queue management to use sk_buffs.
  7625. + *
  7626. + * Revision 1.8  1996/05/10 08:49:43  fritz
  7627. + * Checkin before major changes of tty-code.
  7628. + *
  7629. + * Revision 1.7  1996/05/07 09:15:09  fritz
  7630. + * Reorganized and general cleanup.
  7631. + * Bugfixes:
  7632. + *  - Audio-transmit working now.
  7633. + *  - "NO CARRIER" now reported, when hanging up with DTR low.
  7634. + *  - Corrected CTS handling.
  7635. + *
  7636. + * Revision 1.6  1996/05/02 03:59:25  fritz
  7637. + * Bugfixes:
  7638. + *  - On dialout, layer-2 setup had been incomplete
  7639. + *    when using new auto-layer2 feature.
  7640. + *  - On hangup, "NO CARRIER" message sometimes missing.
  7641. + *
  7642. + * Revision 1.5  1996/04/30 21:05:25  fritz
  7643. + * Test commit
  7644. + *
  7645.   * Revision 1.4  1996/04/20 16:39:54  fritz
  7646.   * Changed all io to go through generic routines in isdn_common.c
  7647.   * Fixed a real ugly bug in modem-emulator: 'ATA' had been accepted
  7648. @@ -39,14 +68,22 @@
  7649.  #define __NO_VERSION__
  7650.  #include <linux/module.h>
  7651.  #include <linux/isdn.h>
  7652. +#include <linux/config.h>
  7653.  #include "isdn_common.h"
  7654.  #include "isdn_tty.h"
  7655. +#ifdef CONFIG_ISDN_AUDIO
  7656. +#include "isdn_audio.h"
  7657. +#define VBUF 0x300
  7658. +#define VBUFX (VBUF/16)
  7659. +#endif
  7660.  
  7661.  /* Prototypes */
  7662.  
  7663.  static int  isdn_tty_edit_at(const char *, int, modem_info *, int);
  7664.  static void isdn_tty_check_esc(const u_char *, u_char, int, int *, int *, int);
  7665.  static void isdn_tty_modem_reset_regs(atemu *, int);
  7666. +static void isdn_tty_cmd_ATA(modem_info *);
  7667. +static void isdn_tty_at_cout(char *, modem_info *);
  7668.  
  7669.  /* Leave this unchanged unless you know what you do! */
  7670.  #define MODEM_PARANOIA_CHECK
  7671. @@ -54,31 +91,53 @@
  7672.  
  7673.  static char *isdn_ttyname_ttyI = "ttyI";
  7674.  static char *isdn_ttyname_cui  = "cui";
  7675. -char *isdn_tty_revision        = "$Revision: 1.4 $";
  7676. -
  7677. -int isdn_tty_try_read(int i, u_char * buf, int len)
  7678. +static int bit2si[8] = {1,5,7,7,7,7,7,7};
  7679. +static int si2bit[8] = {4,1,4,4,4,4,4,4};
  7680. +                                
  7681. +char *isdn_tty_revision        = "$Revision: 1.11 $";
  7682. +
  7683. +/* isdn_tty_try_read() is called from within isdn_receive_callback()
  7684. + * to stuff incoming data directly into a tty's flip-buffer. This
  7685. + * is done to speed up tty-receiving if the receive-queue is empty.
  7686. + * This routine MUST be called with interrupts off.
  7687. + * Return:
  7688. + *  1 = Success
  7689. + *  0 = Failure, data has to be bufferd and later processed by
  7690. + *      isdn_tty_readmodem().
  7691. + */
  7692. +#define DLE 0x10
  7693. +#define ETX 0x03
  7694. +int isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
  7695.  {
  7696.          int c;
  7697. +        int len;
  7698.          struct tty_struct *tty;
  7699.  
  7700. -    if (i < 0)
  7701. -        return 0;
  7702. -    if (dev->mdm.online[i]) {
  7703. -        if ((tty = dev->mdm.info[i].tty)) {
  7704. -            if (dev->mdm.info[i].MCR & UART_MCR_RTS) {
  7705. -                c = TTY_FLIPBUF_SIZE - tty->flip.count - 1;
  7706. +    if (info->online) {
  7707. +        if ((tty = info->tty)) {
  7708. +            if (info->mcr & UART_MCR_RTS) {
  7709. +                c = TTY_FLIPBUF_SIZE - tty->flip.count;
  7710. +                                len = skb->len + skb->users;
  7711.                  if (c >= len) {
  7712. -                    if (len > 1) {
  7713. -                        memcpy(tty->flip.char_buf_ptr, buf, len);
  7714. -                        tty->flip.count += len;
  7715. -                        memset(tty->flip.flag_buf_ptr, 0, len);
  7716. -                        if (dev->mdm.atmodem[i].mdmreg[12] & 128)
  7717. -                            tty->flip.flag_buf_ptr[len - 1] = 0xff;
  7718. -                        tty->flip.flag_buf_ptr += len;
  7719. -                        tty->flip.char_buf_ptr += len;
  7720. -                    } else
  7721. -                        tty_insert_flip_char(tty, buf[0], 0);
  7722. +                                        if (skb->users)
  7723. +                                                while (skb->len--) {
  7724. +                                                        if (*skb->data == DLE)
  7725. +                                                                tty_insert_flip_char(tty, DLE, 0);
  7726. +                                                        tty_insert_flip_char(tty, *skb->data++, 0);
  7727. +                                                }
  7728. +                                        else {
  7729. +                                                memcpy(tty->flip.char_buf_ptr,
  7730. +                                                       skb->data, len);
  7731. +                                                tty->flip.count += len;
  7732. +                                                tty->flip.char_buf_ptr += len;
  7733. +                                                memset(tty->flip.flag_buf_ptr, 0, len);
  7734. +                                                tty->flip.flag_buf_ptr += len;
  7735. +                                        }
  7736. +                                        if (info->emu.mdmreg[12] & 128)
  7737. +                                                tty->flip.flag_buf_ptr[len - 1] = 0xff;
  7738.                      queue_task_irq_off(&tty->flip.tqueue, &tq_timer);
  7739. +                                        skb->free = 1;
  7740. +                                        kfree_skb(skb, FREE_READ);
  7741.                      return 1;
  7742.                  }
  7743.              }
  7744. @@ -87,6 +146,10 @@
  7745.      return 0;
  7746.  }
  7747.  
  7748. +/* isdn_tty_readmodem() is called periodically from within timer-interrupt.
  7749. + * It tries getting received data from the receive queue an stuff it into
  7750. + * the tty's flip-buffer.
  7751. + */
  7752.  void isdn_tty_readmodem(void)
  7753.  {
  7754.      int resched = 0;
  7755. @@ -99,43 +162,140 @@
  7756.      modem_info *info;
  7757.  
  7758.      for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  7759. -        if ((midx = dev->m_idx[i]) >= 0)
  7760. -            if (dev->mdm.online[midx]) {
  7761. -                save_flags(flags);
  7762. -                cli();
  7763. +        if ((midx = dev->m_idx[i]) >= 0) {
  7764. +                        info = &dev->mdm.info[midx];
  7765. +            if (info->online) {
  7766.                  r = 0;
  7767. -                info = &dev->mdm.info[midx];
  7768.                  if ((tty = info->tty)) {
  7769. -                    if (info->MCR & UART_MCR_RTS) {
  7770. -                        c = TTY_FLIPBUF_SIZE - tty->flip.count - 1;
  7771. +                    if (info->mcr & UART_MCR_RTS) {
  7772. +                        c = TTY_FLIPBUF_SIZE - tty->flip.count;
  7773.                          if (c > 0) {
  7774. +                                                        save_flags(flags);
  7775. +                                                        cli();
  7776.                              r = isdn_readbchan(info->isdn_driver, info->isdn_channel,
  7777.                                        tty->flip.char_buf_ptr,
  7778.                                        tty->flip.flag_buf_ptr, c, 0);
  7779. -                            if (!(dev->mdm.atmodem[midx].mdmreg[12] & 128))
  7780. +                                                        /* CISCO AsyncPPP Hack */
  7781. +                            if (!(info->emu.mdmreg[12] & 128))
  7782.                                  memset(tty->flip.flag_buf_ptr, 0, r);
  7783.                              tty->flip.count += r;
  7784.                              tty->flip.flag_buf_ptr += r;
  7785.                              tty->flip.char_buf_ptr += r;
  7786.                              if (r)
  7787.                                  queue_task_irq_off(&tty->flip.tqueue, &tq_timer);
  7788. +                                                        restore_flags(flags);
  7789.                          }
  7790.                      } else
  7791.                          r = 1;
  7792.                  } else
  7793.                      r = 1;
  7794. -                restore_flags(flags);
  7795.                  if (r) {
  7796. -                    dev->mdm.rcvsched[midx] = 0;
  7797. +                    info->rcvsched = 0;
  7798.                      resched = 1;
  7799.                  } else
  7800. -                    dev->mdm.rcvsched[midx] = 1;
  7801. +                    info->rcvsched = 1;
  7802.              }
  7803. +                }
  7804.      }
  7805.      if (!resched)
  7806.          isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 0);
  7807.  }
  7808.  
  7809. +void isdn_tty_cleanup_xmit(modem_info *info)
  7810. +{
  7811. +        struct sk_buff *skb;
  7812. +        unsigned long flags;
  7813. +
  7814. +        save_flags(flags);
  7815. +        cli();
  7816. +        if (info->xmit_buf->qlen)
  7817. +                while ((skb = skb_dequeue(info->xmit_buf))) {
  7818. +                        skb->free = 1;
  7819. +                        kfree_skb(skb,FREE_WRITE);
  7820. +                }
  7821. +        restore_flags(flags);
  7822. +}
  7823. +
  7824. +/* isdn_tty_senddown() is called either directly from within isdn_tty_write()
  7825. + * or via timer-interrupt from within isdn_tty_modem_xmit(). It pulls
  7826. + * outgoing data from the tty's xmit-buffer, handles voice-decompression or
  7827. + * T.70 if necessary, and finally sends it out via isdn_writebuf_stub.
  7828. + */
  7829. +static void isdn_tty_senddown(modem_info * info)
  7830. +{
  7831. +        struct tty_struct *tty = info->tty;
  7832. +        struct sk_buff *skb = skb_dequeue(info->xmit_buf);
  7833. +
  7834. +        if (!skb)
  7835. +                return;
  7836. +        if (skb->free > 1) {
  7837. +                /* Post processing only once, if skb->free > 1 */
  7838. +#ifdef CONFIG_ISDN_AUDIO
  7839. +                if (info->vonline==2) {
  7840. +                        char *ptr = skb->data;
  7841. +                        int len = skb->len;
  7842. +
  7843. +                        /* For now, ifmt is fixed to 1 (alaw), since this
  7844. +                         * is used with ISDN everywhere in the world, except
  7845. +                         * US, Canadia and Japan.
  7846. +                         * Later, when US-ISDN protocols are implemented,
  7847. +                         * this setting will depend on the D-channel protocol.
  7848. +                         */
  7849. +                        int ifmt = 1;
  7850. +                        /* voice conversion/decompression */
  7851. +                        switch (info->emu.vpar[3]) {
  7852. +                                case 4:
  7853. +                                        skb_put(skb, len);
  7854. +                                        /* fall through */
  7855. +                                case 3:
  7856. +                                        skb_put(skb, len);
  7857. +                                        /* fall through */
  7858. +                                case 2:
  7859. +                                        skb_put(skb, len * 2);
  7860. +                                        /* adpcm, compatible to ZyXel 1496 modem
  7861. +                                         * with ROM revision 6.01
  7862. +                                         */
  7863. +                                        skb_pull(skb, len);
  7864. +                                        skb_trim(skb, isdn_audio_adpcm2xlaw(info->adpcms,
  7865. +                                                                       ifmt,
  7866. +                                                                       ptr,
  7867. +                                                                       skb->data,
  7868. +                                                                       len));
  7869. +                                        break;
  7870. +                                case 5:
  7871. +                                        /* a-law */
  7872. +                                        if (!ifmt)
  7873. +                                                isdn_audio_alaw2ulaw(ptr,len);
  7874. +                                        break;
  7875. +                                case 6:
  7876. +                                        /* u-law */
  7877. +                                        if (ifmt)
  7878. +                                                isdn_audio_ulaw2alaw(ptr,len);
  7879. +                                        break;
  7880. +                        }
  7881. +                }
  7882. +#endif          /* CONFIG_ISDN_AUDIO */
  7883. +                if (info->emu.mdmreg[13] & 2)
  7884. +                        /* Add T.70 simplified header */
  7885. +                        memcpy(skb_push(skb,4), "\1\0\1\0", 4);
  7886. +                /* Mark skb post-processed */
  7887. +                skb->free = 1;
  7888. +        }
  7889. +        if (isdn_writebuf_skb_stub(info->isdn_driver, info->isdn_channel,
  7890. +                                   skb) > 0) {
  7891. +                if (skb_queue_empty(info->xmit_buf))
  7892. +                        info->xmit_count = 0;
  7893. +                if ((info->send_outstanding++) > 10)
  7894. +                        info->msr &= ~UART_MSR_CTS;
  7895. +                info->lsr |= UART_LSR_TEMT;
  7896. +                if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
  7897. +                    tty->ldisc.write_wakeup)
  7898. +                        (tty->ldisc.write_wakeup) (tty);
  7899. +                wake_up_interruptible(&tty->write_wait);
  7900. +        } else
  7901. +                skb_queue_head(info->xmit_buf,skb);
  7902. +}
  7903. +
  7904.  /************************************************************
  7905.   *
  7906.   * Modem-functions
  7907. @@ -144,78 +304,149 @@
  7908.   *
  7909.   ************************************************************/
  7910.  
  7911. +/* The nex routine is called once from within timer-interrupt
  7912. + * triggered within isdn_tty_modem_ncarrier(). It calls
  7913. + * isdn_tty_modem_result() to stuff a "NO CARRIER" Message
  7914. + * into the tty's flip-buffer.
  7915. + */
  7916. +static void isdn_tty_modem_do_ncarrier(unsigned long data)
  7917. +{
  7918. +        modem_info * info = (modem_info *)data;
  7919. +        isdn_tty_modem_result(3, info);
  7920. +}
  7921. +
  7922. +/* Next routine is called, whenever the DTR-signal is raised.
  7923. + * It checks the ncarrier-flag, and triggers the above routine
  7924. + * when necessary. The ncarrier-flag is set, whenever DTR goes
  7925. + * low.
  7926. + */      
  7927. +static void isdn_tty_modem_ncarrier(modem_info * info)
  7928. +{
  7929. +        if (info->ncarrier) {
  7930. +                info->ncarrier = 0;
  7931. +                info->nc_timer.expires = jiffies + HZ;
  7932. +                info->nc_timer.function = isdn_tty_modem_do_ncarrier;
  7933. +                info->nc_timer.data = (unsigned long)info;
  7934. +                add_timer(&info->nc_timer);
  7935. +        }
  7936. +}
  7937. +
  7938. +/* isdn_tty_dial() performs dialing of a tty an the necessary
  7939. + * setup of the lower levels befor that.
  7940. + */
  7941.  static void isdn_tty_dial(char *n, modem_info * info, atemu * m)
  7942.  {
  7943. +        int usg = ISDN_USAGE_MODEM;
  7944. +        int si = 7;
  7945. +        int l2 = m->mdmreg[14];
  7946.      isdn_ctrl cmd;
  7947.      ulong flags;
  7948.      int i;
  7949. +        int j;
  7950.  
  7951. +        for (j=7;j>=0;j--)
  7952. +                if (m->mdmreg[18] & (1<<j)) {
  7953. +                        si = bit2si[j];
  7954. +                        break;
  7955. +                }
  7956. +#ifdef CONFIG_ISDN_AUDIO
  7957. +                if (si == 1) {
  7958. +                        l2 = 4;
  7959. +                        usg = ISDN_USAGE_VOICE;
  7960. +                }
  7961. +#endif
  7962. +        m->mdmreg[20] = si2bit[si];
  7963.      save_flags(flags);
  7964.      cli();
  7965. -    i = isdn_get_free_channel(ISDN_USAGE_MODEM, m->mdmreg[14], m->mdmreg[15], -1, -1);
  7966. +    i = isdn_get_free_channel(usg, l2, m->mdmreg[15], -1, -1);
  7967.      if (i < 0) {
  7968.          restore_flags(flags);
  7969.          isdn_tty_modem_result(6, info);
  7970.      } else {
  7971. -        if (strlen(m->msn)) {
  7972. -            info->isdn_driver = dev->drvmap[i];
  7973. -            info->isdn_channel = dev->chanmap[i];
  7974. -            info->drv_index = i;
  7975. -            dev->m_idx[i] = info->line;
  7976. -            dev->usage[i] |= ISDN_USAGE_OUTGOING;
  7977. -            isdn_info_update();
  7978. -            restore_flags(flags);
  7979. -            cmd.driver = info->isdn_driver;
  7980. -            cmd.arg = info->isdn_channel;
  7981. -            cmd.command = ISDN_CMD_CLREAZ;
  7982. -            dev->drv[info->isdn_driver]->interface->command(&cmd);
  7983. -            strcpy(cmd.num, isdn_map_eaz2msn(m->msn, info->isdn_driver));
  7984. -            cmd.driver = info->isdn_driver;
  7985. -            cmd.command = ISDN_CMD_SETEAZ;
  7986. -            dev->drv[info->isdn_driver]->interface->command(&cmd);
  7987. -            cmd.driver = info->isdn_driver;
  7988. -            cmd.command = ISDN_CMD_SETL2;
  7989. -            cmd.arg = info->isdn_channel + (m->mdmreg[14] << 8);
  7990. -            dev->drv[info->isdn_driver]->interface->command(&cmd);
  7991. -            cmd.driver = info->isdn_driver;
  7992. -            cmd.command = ISDN_CMD_SETL3;
  7993. -            cmd.arg = info->isdn_channel + (m->mdmreg[15] << 8);
  7994. -            dev->drv[info->isdn_driver]->interface->command(&cmd);
  7995. -            cmd.driver = info->isdn_driver;
  7996. -            cmd.arg = info->isdn_channel;
  7997. -            sprintf(cmd.num, "%s,%s,%d,%d", n, isdn_map_eaz2msn(m->msn, info->isdn_driver),
  7998. -                m->mdmreg[18], m->mdmreg[19]);
  7999. -            cmd.command = ISDN_CMD_DIAL;
  8000. -            dev->mdm.dialing[info->line] = 1;
  8001. -            strcpy(dev->num[i], n);
  8002. -            isdn_info_update();
  8003. -            dev->drv[info->isdn_driver]->interface->command(&cmd);
  8004. -        } else
  8005. -            restore_flags(flags);
  8006. +                info->isdn_driver = dev->drvmap[i];
  8007. +                info->isdn_channel = dev->chanmap[i];
  8008. +                info->drv_index = i;
  8009. +                dev->m_idx[i] = info->line;
  8010. +                dev->usage[i] |= ISDN_USAGE_OUTGOING;
  8011. +                isdn_info_update();
  8012. +                restore_flags(flags);
  8013. +                cmd.driver = info->isdn_driver;
  8014. +                cmd.arg = info->isdn_channel;
  8015. +                cmd.command = ISDN_CMD_CLREAZ;
  8016. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  8017. +                strcpy(cmd.num, isdn_map_eaz2msn(m->msn, info->isdn_driver));
  8018. +                cmd.driver = info->isdn_driver;
  8019. +                cmd.command = ISDN_CMD_SETEAZ;
  8020. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  8021. +                cmd.driver = info->isdn_driver;
  8022. +                cmd.command = ISDN_CMD_SETL2;
  8023. +                cmd.arg = info->isdn_channel + (l2 << 8);
  8024. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  8025. +                cmd.driver = info->isdn_driver;
  8026. +                cmd.command = ISDN_CMD_SETL3;
  8027. +                cmd.arg = info->isdn_channel + (m->mdmreg[15] << 8);
  8028. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  8029. +                cmd.driver = info->isdn_driver;
  8030. +                cmd.arg = info->isdn_channel;
  8031. +                sprintf(cmd.num, "%s,%s,%d,%d", n, isdn_map_eaz2msn(m->msn, info->isdn_driver),
  8032. +                        si, m->mdmreg[19]);
  8033. +                cmd.command = ISDN_CMD_DIAL;
  8034. +                info->dialing = 1;
  8035. +                strcpy(dev->num[i], n);
  8036. +                isdn_info_update();
  8037. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  8038.      }
  8039.  }
  8040.  
  8041. +/* isdn_tty_hangup() disassociates a tty from the real
  8042. + * ISDN-line (hangup). The usage-status is cleared
  8043. + * and some cleanup is done also.
  8044. + */
  8045.  void isdn_tty_modem_hup(modem_info * info)
  8046.  {
  8047.      isdn_ctrl cmd;
  8048. +        int usage;
  8049.  
  8050.          if (!info)
  8051.                  return;
  8052. -        dev->mdm.rcvsched[info->line] = 0;
  8053. -        dev->mdm.online[info->line] = 0;
  8054. +        info->rcvsched = 0;
  8055. +        info->online = 0;
  8056. +        isdn_tty_cleanup_xmit(info);
  8057. +        switch (info->vonline) {
  8058. +                case 1:
  8059. +                        /* voice-recording, add DLE-ETX */
  8060. +                        isdn_tty_at_cout("\020\003", info);
  8061. +                        break;
  8062. +                case 2:
  8063. +                        break;
  8064. +        }
  8065. +        info->vonline = 0;
  8066. +        if (info->adpcms) {
  8067. +                kfree(info->adpcms);
  8068. +                info->adpcms = NULL;
  8069. +        }
  8070. +        if (info->adpcmr) {
  8071. +                kfree(info->adpcmr);
  8072. +                info->adpcmr = NULL;
  8073. +        }
  8074. +        info->msr &= ~(UART_MSR_DCD | UART_MSR_RI);
  8075. +        info->lsr &= ~UART_LSR_TEMT;
  8076.      if (info->isdn_driver >= 0) {
  8077.          cmd.driver = info->isdn_driver;
  8078.          cmd.command = ISDN_CMD_HANGUP;
  8079.          cmd.arg = info->isdn_channel;
  8080.          dev->drv[info->isdn_driver]->interface->command(&cmd);
  8081.          isdn_all_eaz(info->isdn_driver, info->isdn_channel);
  8082. -        isdn_free_channel(info->isdn_driver, info->isdn_channel, ISDN_USAGE_MODEM);
  8083. +                usage = (info->emu.mdmreg[20] == 1)?
  8084. +                        ISDN_USAGE_VOICE:ISDN_USAGE_MODEM;
  8085. +        isdn_free_channel(info->isdn_driver, info->isdn_channel,
  8086. +                                  usage);
  8087.      }
  8088.      info->isdn_driver = -1;
  8089.      info->isdn_channel = -1;
  8090.          if (info->drv_index >= 0) {
  8091. -                info->drv_index = -1;
  8092.                  dev->m_idx[info->drv_index] = -1;
  8093. +                info->drv_index = -1;
  8094.          }
  8095.  }
  8096.  
  8097. @@ -258,17 +489,20 @@
  8098.              i += 15;
  8099.      }
  8100.      if (quot) {
  8101. -        info->MCR |= UART_MCR_DTR;
  8102. +        info->mcr |= UART_MCR_DTR;
  8103. +                isdn_tty_modem_ncarrier(info);                
  8104.      } else {
  8105. -        info->MCR &= ~UART_MCR_DTR;
  8106. -        isdn_tty_modem_reset_regs(&dev->mdm.atmodem[info->line], 0);
  8107. +        info->mcr &= ~UART_MCR_DTR;
  8108. +                if (info->emu.mdmreg[13] & 4) {
  8109.  #ifdef ISDN_DEBUG_MODEM_HUP
  8110. -                printk(KERN_DEBUG "Mhup in changespeed\n");
  8111. +                        printk(KERN_DEBUG "Mhup in changespeed\n");
  8112.  #endif
  8113. -                isdn_tty_modem_hup(info);
  8114. -        if (dev->mdm.online[info->line])
  8115. -            isdn_tty_modem_result(3, info);
  8116. -        return;
  8117. +                        if (info->online)
  8118. +                                info->ncarrier = 1;
  8119. +                        isdn_tty_modem_reset_regs(&info->emu, 0);
  8120. +                        isdn_tty_modem_hup(info);
  8121. +                }
  8122. +                return;
  8123.      }
  8124.      /* byte size and parity */
  8125.      cval = cflag & (CSIZE | CSTOPB);
  8126. @@ -297,11 +531,6 @@
  8127.  
  8128.      if (info->flags & ISDN_ASYNC_INITIALIZED)
  8129.          return 0;
  8130. -    if (!info->type) {
  8131. -        if (info->tty)
  8132. -            set_bit(TTY_IO_ERROR, &info->tty->flags);
  8133. -        return 0;
  8134. -    }
  8135.      save_flags(flags);
  8136.      cli();
  8137.  
  8138. @@ -311,7 +540,7 @@
  8139.      /*
  8140.       * Now, initialize the UART 
  8141.       */
  8142. -    info->MCR = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
  8143. +    info->mcr = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
  8144.      if (info->tty)
  8145.          clear_bit(TTY_IO_ERROR, &info->tty->flags);
  8146.      /*
  8147. @@ -320,10 +549,8 @@
  8148.      isdn_tty_change_speed(info);
  8149.  
  8150.      info->flags |= ISDN_ASYNC_INITIALIZED;
  8151. -    dev->mdm.msr[info->line] |= UART_MSR_DSR;
  8152. -#if FUTURE
  8153. +    info->msr |= (UART_MSR_DSR | UART_MSR_CTS);
  8154.      info->send_outstanding = 0;
  8155. -#endif
  8156.      restore_flags(flags);
  8157.      return 0;
  8158.  }
  8159. @@ -344,12 +571,14 @@
  8160.      save_flags(flags);
  8161.      cli();            /* Disable interrupts */
  8162.      if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
  8163. -        info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS);
  8164. -        isdn_tty_modem_reset_regs(&dev->mdm.atmodem[info->line], 0);
  8165. +        info->mcr &= ~(UART_MCR_DTR | UART_MCR_RTS);
  8166. +                if (info->emu.mdmreg[13] & 4) {
  8167. +                        isdn_tty_modem_reset_regs(&info->emu, 0);
  8168.  #ifdef ISDN_DEBUG_MODEM_HUP
  8169. -                printk(KERN_DEBUG "Mhup in isdn_tty_shutdown\n");
  8170. +                        printk(KERN_DEBUG "Mhup in isdn_tty_shutdown\n");
  8171.  #endif
  8172. -                isdn_tty_modem_hup(info);
  8173. +                        isdn_tty_modem_hup(info);
  8174. +                }
  8175.      }
  8176.      if (info->tty)
  8177.          set_bit(TTY_IO_ERROR, &info->tty->flags);
  8178. @@ -358,12 +587,111 @@
  8179.      restore_flags(flags);
  8180.  }
  8181.  
  8182. +#ifdef CONFIG_ISDN_AUDIO
  8183. +
  8184. +
  8185. +int isdn_tty_countDLE(unsigned char *buf, int len)
  8186. +{
  8187. +        int count = 0;
  8188. +
  8189. +        while (len--)
  8190. +                if (*buf++ == DLE)
  8191. +                        count++;
  8192. +        return count;
  8193. +}
  8194. +
  8195. +/* This routine is called wrom within isdn_tty_write() to perform
  8196. + * DLE-decoding when sending audio-data.
  8197. + */
  8198. +static int isdn_tty_handleDLEdown(modem_info *info, atemu *m, struct sk_buff *skb)
  8199. +{
  8200. +        unsigned char *p = skb->data;
  8201. +        int len = skb->len;
  8202. +        int count = 0;
  8203. +
  8204. +        while (len>0) {
  8205. +                if (m->lastDLE) {
  8206. +                        m->lastDLE = 0;
  8207. +                        switch (*p) {
  8208. +                                case DLE:
  8209. +                                        /* Escape code */
  8210. +                                        if (len>1)
  8211. +                                                memmove(p,p+1,len-1);
  8212. +                                        p--;
  8213. +                                        count++;
  8214. +                                        break;
  8215. +                                case ETX:
  8216. +                                        /* End of data */
  8217. +                                        info->vonline = 0;
  8218. +                                        isdn_tty_at_cout("\r\nVCON\r\n",info);
  8219. +                                        return count;
  8220. +                                case 'q':
  8221. +                                case 's':
  8222. +                                        /* Silence */
  8223. +                                        if (len>1)
  8224. +                                                memmove(p,p+1,len-1);
  8225. +                                        p--;
  8226. +                                        break;
  8227. +                        }
  8228. +                } else {
  8229. +                        if (*p == DLE)
  8230. +                                m->lastDLE = 1;
  8231. +                        else
  8232. +                                count++;
  8233. +                }
  8234. +                p++;
  8235. +                len--;
  8236. +        }
  8237. +        if (len<0) {
  8238. +                printk(KERN_WARNING "isdn_tty: len<0 in DLEdown\n");
  8239. +                return 0;
  8240. +        }
  8241. +        skb_trim(skb,count);
  8242. +        return count;
  8243. +}
  8244. +
  8245. +/* This routine is called from within isdn_tty_write() when receiving
  8246. + * audio-data. It interrupts receiving, if an character other than
  8247. + * ^S or ^Q is sent.
  8248. + */
  8249. +static int isdn_tty_end_vrx(const char *buf, int c, int from_user)
  8250. +{
  8251. +    char tmpbuf[VBUF];
  8252. +        char *p;
  8253. +
  8254. +        if (c > VBUF) {
  8255. +                printk(KERN_ERR "isdn_tty: (end_vrx) BUFFER OVERFLOW!!!\n");
  8256. +                return 1;
  8257. +        }
  8258. +    if (from_user) {
  8259. +        memcpy_fromfs(tmpbuf, buf, c);
  8260. +                p = tmpbuf;
  8261. +        } else
  8262. +                p = (char *)buf;
  8263. +        while (c--) {
  8264. +                if ((*p != 0x11) && (*p != 0x13))
  8265. +                        return 1;
  8266. +                p++;
  8267. +        }
  8268. +        return 0;
  8269. +}
  8270. +#endif        /* CONFIG_ISDN_AUDIO */
  8271. +
  8272. +/* isdn_tty_write() is the main send-routine. It is called from the upper
  8273. + * levels within the kernel to perform sending data. Depending on the
  8274. + * online-flag it either directs output to the at-command-interpreter or
  8275. + * to the lower level. Additional tasks done here:
  8276. + *  - If online, check for escape-sequence (+++)
  8277. + *  - If sending audio-data, call isdn_tty_DLEdown() to parse DLE-codes.
  8278. + *  - If receiving audio-data, call isdn_tty_end_vrx() to abor if needed.
  8279. + *  - If dialing, abort dial.
  8280. + */
  8281.  static int isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int count)
  8282.  {
  8283.      int c, total = 0;
  8284. -    modem_info *info = (modem_info *) tty->driver_data;
  8285.      ulong flags;
  8286. -    int i;
  8287. +    modem_info *info = (modem_info *) tty->driver_data;
  8288. +        struct sk_buff *skb;
  8289.  
  8290.      if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_write"))
  8291.          return 0;
  8292. @@ -372,84 +700,79 @@
  8293.      save_flags(flags);
  8294.      cli();
  8295.      while (1) {
  8296. -        c = MIN(count, info->xmit_size - info->xmit_count - 1);
  8297. -        if (info->isdn_driver >= 0) {
  8298. -#if 0
  8299. -            if (info->isdn_driver != 0) {
  8300. -                printk(KERN_DEBUG "FIDO: Zwei HW-Treiber geladen? Ansonsten ist was faul.\n");
  8301. -                break;
  8302. -            }
  8303. -            int drvidx = info->isdn_driver;
  8304. -            driver *driv = dev->drv[drvidx];
  8305. -            i = driv->maxbufsize;
  8306. -#else
  8307. -            i = dev->drv[info->isdn_driver]->maxbufsize;
  8308. -#endif
  8309. -            c = MIN(c, i);
  8310. -        }
  8311. +        c = MIN(count, info->xmit_size - info->xmit_count);
  8312. +        if (info->isdn_driver >= 0)
  8313. +            c = MIN(c, dev->drv[info->isdn_driver]->maxbufsize);
  8314.          if (c <= 0)
  8315.              break;
  8316. -        i = info->line;
  8317. -        if (dev->mdm.online[i]) {
  8318. -            isdn_tty_check_esc(buf, dev->mdm.atmodem[i].mdmreg[2], c,
  8319. -                       &(dev->mdm.atmodem[i].pluscount),
  8320. -                 &(dev->mdm.atmodem[i].lastplus), from_user);
  8321. -            if (from_user)
  8322. -                memcpy_fromfs(&(info->xmit_buf[info->xmit_count]), buf, c);
  8323. -            else
  8324. -                memcpy(&(info->xmit_buf[info->xmit_count]), buf, c);
  8325. -            info->xmit_count += c;
  8326. -            if (dev->mdm.atmodem[i].mdmreg[13] & 1) {
  8327. -                char *bufptr;
  8328. -                int buflen;
  8329. -#if 0
  8330. -                printk(KERN_DEBUG "WB1: %d\n", info->xmit_count);
  8331. -#endif
  8332. -                bufptr = info->xmit_buf;
  8333. -                buflen = info->xmit_count;
  8334. -                if (dev->mdm.atmodem[i].mdmreg[13] & 2) {
  8335. -                    /* Add T.70 simplified header */
  8336. -
  8337. -#ifdef ISDN_DEBUG_MODEM_DUMP
  8338. -                    isdn_dumppkt("T70pack1:", bufptr, buflen, 40);
  8339. -#endif
  8340. -                    bufptr -= 4;
  8341. -                    buflen += 4;
  8342. -                    memcpy(bufptr, "\1\0\1\0", 4);
  8343. -#ifdef ISDN_DEBUG_MODEM_DUMP
  8344. -                    isdn_dumppkt("T70pack2:", bufptr, buflen, 40);
  8345. -#endif
  8346. -                }
  8347. -                if (isdn_writebuf_stub(info->isdn_driver, info->isdn_channel, bufptr,
  8348. -                                                       buflen, 0) > 0) {
  8349. -                    info->xmit_count = 0;
  8350. -                    info->xmit_size = dev->mdm.atmodem[i].mdmreg[16] * 16;
  8351. -#if FUTURE
  8352. -                    info->send_outstanding++;
  8353. -                    dev->mdm.msr[i] &= ~UART_MSR_CTS;
  8354. -#endif
  8355. -                    if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
  8356. -                        tty->ldisc.write_wakeup)
  8357. -                        (tty->ldisc.write_wakeup) (tty);
  8358. -                    wake_up_interruptible(&tty->write_wait);
  8359. -                }
  8360. -            }
  8361. +                if ((info->online > 1) ||
  8362. +                    (info->vonline == 2)) {
  8363. +                        atemu *m = &info->emu;
  8364. +
  8365. +                        if (info->vonline != 2)
  8366. +                                isdn_tty_check_esc(buf, m->mdmreg[2], c,
  8367. +                                                   &(m->pluscount),
  8368. +                                                   &(m->lastplus),
  8369. +                                                   from_user);
  8370. +                        if ((skb = alloc_skb(((info->vonline == 2)?
  8371. +                                                  (c+(c<<2)):c)+16,GFP_ATOMIC))==NULL) {
  8372. +                                printk(KERN_WARNING "isdn_tty: Cannot alloc skb in tty_write\n");
  8373. +                                restore_flags(flags);
  8374. +                                return total;
  8375. +                        }
  8376. +                        skb_reserve(skb, 4); /* For T.70 header */
  8377. +                        if (from_user)
  8378. +                                memcpy_fromfs(skb_put(skb, c), buf, c);
  8379. +                        else
  8380. +                                memcpy(skb_put(skb, c), buf, c);
  8381. +#ifdef CONFIG_ISDN_AUDIO
  8382. +                        if (info->vonline == 2) {
  8383. +                                int cc = isdn_tty_handleDLEdown(info,m,skb);
  8384. +                                info->xmit_count += cc;
  8385. +                                if ((cc==0) && (c > 0)) {
  8386. +                                        /* If DLE decoding results in zero-transmit, but
  8387. +                                         * c originally was non-zero, do a wakeup.
  8388. +                                         */
  8389. +                                        if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
  8390. +                                            tty->ldisc.write_wakeup)
  8391. +                                                (tty->ldisc.write_wakeup) (tty);
  8392. +                                        wake_up_interruptible(&tty->write_wait);
  8393. +                                }
  8394. +                        } else
  8395. +#endif
  8396. +                                info->xmit_count += c;
  8397. +                        skb->users = c;
  8398. +                        skb_queue_tail(info->xmit_buf,skb);
  8399. +            if (m->mdmreg[13] & 1) {
  8400. +                                sti();
  8401. +                                isdn_tty_senddown(info);
  8402. +                        }
  8403.          } else {
  8404. -            if (dev->mdm.dialing[i]) {
  8405. -                dev->mdm.dialing[i] = 0;
  8406. +                        info->msr |= UART_MSR_CTS;
  8407. +                        info->lsr |= UART_LSR_TEMT;
  8408. +#ifdef CONFIG_ISDN_AUDIO
  8409. +                        if (info->vonline == 1) {
  8410. +                                if (isdn_tty_end_vrx(buf, c, from_user)) {
  8411. +                                        info->vonline = 0;
  8412. +                                        isdn_tty_at_cout("\020\003\r\nVCON\r\n", info);
  8413. +                                }
  8414. +                        } else
  8415. +#endif
  8416. +                                if (info->dialing) {
  8417. +                                        info->dialing = 0;
  8418.  #ifdef ISDN_DEBUG_MODEM_HUP
  8419. -                printk(KERN_DEBUG "Mhup in isdn_tty_write\n");
  8420. +                                        printk(KERN_DEBUG "Mhup in isdn_tty_write\n");
  8421.  #endif
  8422. -                isdn_tty_modem_hup(info);
  8423. -                isdn_tty_modem_result(3, info);
  8424. -            } else
  8425. -                c = isdn_tty_edit_at(buf, c, info, from_user);
  8426. +                                        isdn_tty_modem_result(3, info);
  8427. +                                        isdn_tty_modem_hup(info);
  8428. +                                } else
  8429. +                                        c = isdn_tty_edit_at(buf, c, info, from_user);
  8430.          }
  8431.          buf += c;
  8432.          count -= c;
  8433.          total += c;
  8434.      }
  8435. -    if (info->xmit_count)
  8436. +    if (total)
  8437.          isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, 1);
  8438.      restore_flags(flags);
  8439.      return total;
  8440. @@ -462,9 +785,9 @@
  8441.  
  8442.      if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_write_room"))
  8443.          return 0;
  8444. -    if (!dev->mdm.online[info->line])
  8445. -        return info->xmit_size - 1;
  8446. -    ret = info->xmit_size - info->xmit_count - 1;
  8447. +    if (!info->online)
  8448. +        return info->xmit_size;
  8449. +    ret = info->xmit_size - info->xmit_count;
  8450.      return (ret < 0) ? 0 : ret;
  8451.  }
  8452.  
  8453. @@ -474,7 +797,7 @@
  8454.  
  8455.      if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_chars_in_buffer"))
  8456.          return 0;
  8457. -    if (!dev->mdm.online[info->line])
  8458. +    if (!info->online)
  8459.          return 0;
  8460.      return (info->xmit_count);
  8461.  }
  8462. @@ -482,14 +805,11 @@
  8463.  static void isdn_tty_flush_buffer(struct tty_struct *tty)
  8464.  {
  8465.      modem_info *info = (modem_info *) tty->driver_data;
  8466. -    uint flags;
  8467.  
  8468.      if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_flush_buffer"))
  8469.          return;
  8470. -    save_flags(flags);
  8471. -    cli();
  8472. -    info->xmit_count = 0;
  8473. -    restore_flags(flags);
  8474. +        isdn_tty_cleanup_xmit(info);
  8475. +        info->xmit_count = 0;
  8476.      wake_up_interruptible(&tty->write_wait);
  8477.      if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
  8478.          tty->ldisc.write_wakeup)
  8479. @@ -502,7 +822,7 @@
  8480.  
  8481.      if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_flush_chars"))
  8482.          return;
  8483. -    if (info->xmit_count > 0)
  8484. +    if (skb_queue_len(info->xmit_buf))
  8485.          isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, 1);
  8486.  }
  8487.  
  8488. @@ -522,7 +842,7 @@
  8489.          return;
  8490.      if (I_IXOFF(tty))
  8491.          info->x_char = STOP_CHAR(tty);
  8492. -    info->MCR &= ~UART_MCR_RTS;
  8493. +    info->mcr &= ~UART_MCR_RTS;
  8494.  }
  8495.  
  8496.  static void isdn_tty_unthrottle(struct tty_struct *tty)
  8497. @@ -537,7 +857,7 @@
  8498.          else
  8499.              info->x_char = START_CHAR(tty);
  8500.      }
  8501. -    info->MCR |= UART_MCR_RTS;
  8502. +    info->mcr |= UART_MCR_RTS;
  8503.  }
  8504.  
  8505.  /*
  8506. @@ -564,7 +884,7 @@
  8507.  
  8508.      save_flags(flags);
  8509.      cli();
  8510. -    status = dev->mdm.msr[info->line];
  8511. +    status = info->lsr;
  8512.      restore_flags(flags);
  8513.      result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
  8514.      put_fs_long(result, (ulong *) value);
  8515. @@ -578,10 +898,10 @@
  8516.      uint result;
  8517.      ulong flags;
  8518.  
  8519. -    control = info->MCR;
  8520. +    control = info->mcr;
  8521.      save_flags(flags);
  8522.      cli();
  8523. -    status = dev->mdm.msr[info->line];
  8524. +    status = info->msr;
  8525.      restore_flags(flags);
  8526.      result = ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
  8527.          | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
  8528. @@ -596,47 +916,66 @@
  8529.  static int isdn_tty_set_modem_info(modem_info * info, uint cmd, uint * value)
  8530.  {
  8531.      uint arg = get_fs_long((ulong *) value);
  8532. +        int pre_dtr;
  8533.  
  8534.      switch (cmd) {
  8535. -    case TIOCMBIS:
  8536. -        if (arg & TIOCM_RTS) {
  8537. -            info->MCR |= UART_MCR_RTS;
  8538. -        }
  8539. -        if (arg & TIOCM_DTR) {
  8540. -            info->MCR |= UART_MCR_DTR;
  8541. -        }
  8542. -        break;
  8543. -    case TIOCMBIC:
  8544. -        if (arg & TIOCM_RTS) {
  8545. -            info->MCR &= ~UART_MCR_RTS;
  8546. -        }
  8547. -        if (arg & TIOCM_DTR) {
  8548. -            info->MCR &= ~UART_MCR_DTR;
  8549. -            isdn_tty_modem_reset_regs(&dev->mdm.atmodem[info->line], 0);
  8550. +                case TIOCMBIS:
  8551. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8552. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOCMBIS\n", info->line);
  8553. +#endif
  8554. +                        if (arg & TIOCM_RTS) {
  8555. +                                info->mcr |= UART_MCR_RTS;
  8556. +                        }
  8557. +                        if (arg & TIOCM_DTR) {
  8558. +                                info->mcr |= UART_MCR_DTR;
  8559. +                                isdn_tty_modem_ncarrier(info);
  8560. +                        }
  8561. +                        break;
  8562. +                case TIOCMBIC:
  8563. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8564. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOCMBIC\n", info->line);
  8565. +#endif
  8566. +                        if (arg & TIOCM_RTS) {
  8567. +                                info->mcr &= ~UART_MCR_RTS;
  8568. +                        }
  8569. +                        if (arg & TIOCM_DTR) {
  8570. +                                info->mcr &= ~UART_MCR_DTR;
  8571. +                                if (info->emu.mdmreg[13] & 4) {
  8572. +                                        isdn_tty_modem_reset_regs(&info->emu, 0);
  8573.  #ifdef ISDN_DEBUG_MODEM_HUP
  8574. -                        printk(KERN_DEBUG "Mhup in TIOCMBIC\n");
  8575. +                                        printk(KERN_DEBUG "Mhup in TIOCMBIC\n");
  8576.  #endif
  8577. -                        isdn_tty_modem_hup(info);
  8578. -            if (dev->mdm.online[info->line])
  8579. -                isdn_tty_modem_result(3, info);
  8580. -        }
  8581. -        break;
  8582. -    case TIOCMSET:
  8583. -        info->MCR = ((info->MCR & ~(UART_MCR_RTS | UART_MCR_DTR))
  8584. -                 | ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0)
  8585. -                 | ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0));
  8586. -        if (!(info->MCR & UART_MCR_DTR)) {
  8587. -            isdn_tty_modem_reset_regs(&dev->mdm.atmodem[info->line], 0);
  8588. +                                        if (info->online)
  8589. +                                                info->ncarrier = 1;
  8590. +                                        isdn_tty_modem_hup(info);
  8591. +                                }
  8592. +                        }
  8593. +                        break;
  8594. +                case TIOCMSET:
  8595. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8596. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOCMSET\n", info->line);
  8597. +#endif
  8598. +                        pre_dtr = (info->mcr & UART_MCR_DTR);
  8599. +                        info->mcr = ((info->mcr & ~(UART_MCR_RTS | UART_MCR_DTR))
  8600. +                                     | ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0)
  8601. +                                     | ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0));
  8602. +                        if (pre_dtr |= (info->mcr & UART_MCR_DTR)) {
  8603. +                                if (!(info->mcr & UART_MCR_DTR)) {
  8604. +                                        if (info->emu.mdmreg[13] & 4) {
  8605. +                                                isdn_tty_modem_reset_regs(&info->emu, 0);
  8606.  #ifdef ISDN_DEBUG_MODEM_HUP
  8607. -                        printk(KERN_DEBUG "Mhup in TIOCMSET\n");
  8608. +                                                printk(KERN_DEBUG "Mhup in TIOCMSET\n");
  8609.  #endif
  8610. -                        isdn_tty_modem_hup(info);
  8611. -            if (dev->mdm.online[info->line])
  8612. -                isdn_tty_modem_result(3, info);
  8613. -        }
  8614. -        break;
  8615. -    default:
  8616. -        return -EINVAL;
  8617. +                                                if (info->online)
  8618. +                                                        info->ncarrier = 1;
  8619. +                                                isdn_tty_modem_hup(info);
  8620. +                                        }
  8621. +                                } else
  8622. +                                        isdn_tty_modem_ncarrier(info);
  8623. +                        }
  8624. +                        break;
  8625. +                default:
  8626. +                        return -EINVAL;
  8627.      }
  8628.      return 0;
  8629.  }
  8630. @@ -651,104 +990,72 @@
  8631.      if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_ioctl"))
  8632.          return -ENODEV;
  8633.      switch (cmd) {
  8634. -    case TCSBRK:        /* SVID version: non-zero arg --> no break */
  8635. -        retval = tty_check_change(tty);
  8636. -        if (retval)
  8637. -            return retval;
  8638. -        tty_wait_until_sent(tty, 0);
  8639. -        return 0;
  8640. -    case TCSBRKP:        /* support for POSIX tcsendbreak() */
  8641. -        retval = tty_check_change(tty);
  8642. -        if (retval)
  8643. -            return retval;
  8644. -        tty_wait_until_sent(tty, 0);
  8645. -        return 0;
  8646. -    case TIOCGSOFTCAR:
  8647. -        error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(long));
  8648. -        if (error)
  8649. -            return error;
  8650. -        put_fs_long(C_CLOCAL(tty) ? 1 : 0, (ulong *) arg);
  8651. -        return 0;
  8652. -    case TIOCSSOFTCAR:
  8653. -        arg = get_fs_long((ulong *) arg);
  8654. -        tty->termios->c_cflag =
  8655. -            ((tty->termios->c_cflag & ~CLOCAL) |
  8656. -             (arg ? CLOCAL : 0));
  8657. -        return 0;
  8658. -    case TIOCMGET:
  8659. -        error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint));
  8660. -        if (error)
  8661. -            return error;
  8662. -        return isdn_tty_get_modem_info(info, (uint *) arg);
  8663. -    case TIOCMBIS:
  8664. -    case TIOCMBIC:
  8665. -    case TIOCMSET:
  8666. -        return isdn_tty_set_modem_info(info, cmd, (uint *) arg);
  8667. -    case TIOCSERGETLSR:    /* Get line status register */
  8668. -        error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint));
  8669. -        if (error)
  8670. -            return error;
  8671. -        else
  8672. -            return isdn_tty_get_lsr_info(info, (uint *) arg);
  8673. -
  8674. -    case TIOCGSERIAL:
  8675. -        return -ENOIOCTLCMD;
  8676. -#if 0
  8677. -        error = verify_area(VERIFY_WRITE, (void *) arg,
  8678. -                    sizeof(struct serial_struct));
  8679. -        if (error)
  8680. -            return error;
  8681. -        return get_serial_info(info,
  8682. -                       (struct serial_struct *) arg);
  8683. -#endif
  8684. -    case TIOCSSERIAL:
  8685. -        return -ENOIOCTLCMD;
  8686. -#if 0
  8687. -        return set_serial_info(info,
  8688. -                       (struct serial_struct *) arg);
  8689. -#endif
  8690. -    case TIOCSERCONFIG:
  8691. -        return -ENOIOCTLCMD;
  8692. -#if 0
  8693. -        return do_autoconfig(info);
  8694. -#endif
  8695. -
  8696. -    case TIOCSERGWILD:
  8697. -        return -ENOIOCTLCMD;
  8698. -#if 0
  8699. -        error = verify_area(VERIFY_WRITE, (void *) arg,
  8700. -                    sizeof(int));
  8701. -        if (error)
  8702. -            return error;
  8703. -        put_fs_long(modem_wild_int_mask, (ulong *) arg);
  8704. -        return 0;
  8705. +                case TCSBRK:        /* SVID version: non-zero arg --> no break */
  8706. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8707. +                        printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line);
  8708.  #endif
  8709. -    case TIOCSERSWILD:
  8710. -        return -ENOIOCTLCMD;
  8711. -#if 0
  8712. -        if (!suser())
  8713. -            return -EPERM;
  8714. -        modem_wild_int_mask = get_fs_long((ulong *) arg);
  8715. -        if (modem_wild_int_mask < 0)
  8716. -            modem_wild_int_mask = check_wild_interrupts(0);
  8717. -        return 0;
  8718. +                        retval = tty_check_change(tty);
  8719. +                        if (retval)
  8720. +                                return retval;
  8721. +                        tty_wait_until_sent(tty, 0);
  8722. +                        return 0;
  8723. +                case TCSBRKP:        /* support for POSIX tcsendbreak() */
  8724. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8725. +                        printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line);
  8726.  #endif
  8727. -    case TIOCSERGSTRUCT:
  8728. -        return -ENOIOCTLCMD;
  8729. -#if 0
  8730. -        error = verify_area(VERIFY_WRITE, (void *) arg,
  8731. -                    sizeof(modem_info));
  8732. -        if (error)
  8733. -            return error;
  8734. -        memcpy_tofs((modem_info *) arg,
  8735. -                info, sizeof(modem_info));
  8736. -        return 0;
  8737. +                        retval = tty_check_change(tty);
  8738. +                        if (retval)
  8739. +                                return retval;
  8740. +                        tty_wait_until_sent(tty, 0);
  8741. +                        return 0;
  8742. +                case TIOCGSOFTCAR:
  8743. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8744. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOCGSOFTCAR\n", info->line);
  8745. +#endif
  8746. +                        error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(long));
  8747. +                        if (error)
  8748. +                                return error;
  8749. +                        put_fs_long(C_CLOCAL(tty) ? 1 : 0, (ulong *) arg);
  8750. +                        return 0;
  8751. +                case TIOCSSOFTCAR:
  8752. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8753. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOCSSOFTCAR\n", info->line);
  8754. +#endif
  8755. +                        arg = get_fs_long((ulong *) arg);
  8756. +                        tty->termios->c_cflag =
  8757. +                                ((tty->termios->c_cflag & ~CLOCAL) |
  8758. +                                 (arg ? CLOCAL : 0));
  8759. +                        return 0;
  8760. +                case TIOCMGET:
  8761. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8762. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line);
  8763. +#endif
  8764. +                        error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint));
  8765. +                        if (error)
  8766. +                                return error;
  8767. +                        return isdn_tty_get_modem_info(info, (uint *) arg);
  8768. +                case TIOCMBIS:
  8769. +                case TIOCMBIC:
  8770. +                case TIOCMSET:
  8771. +                        error = verify_area(VERIFY_READ, (void *) arg, sizeof(uint));
  8772. +                        if (error)
  8773. +                                return error;
  8774. +                        return isdn_tty_set_modem_info(info, cmd, (uint *) arg);
  8775. +                case TIOCSERGETLSR:    /* Get line status register */
  8776. +#ifdef ISDN_DEBUG_MODEM_IOCTL
  8777. +                        printk(KERN_DEBUG "ttyI%d ioctl TIOSERGETLSR\n", info->line);
  8778.  #endif
  8779. -    default:
  8780. +                        error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint));
  8781. +                        if (error)
  8782. +                                return error;
  8783. +                        else
  8784. +                                return isdn_tty_get_lsr_info(info, (uint *) arg);
  8785. +                        
  8786. +                default:
  8787.  #ifdef ISDN_DEBUG_MODEM_IOCTL
  8788. -        printk(KERN_DEBUG "unsupp. ioctl 0x%08x on ttyi%d\n", cmd, info->line);
  8789. +                        printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line);
  8790.  #endif
  8791. -        return -ENOIOCTLCMD;
  8792. +                        return -ENOIOCTLCMD;
  8793.      }
  8794.      return 0;
  8795.  }
  8796. @@ -757,13 +1064,17 @@
  8797.  {
  8798.      modem_info *info = (modem_info *) tty->driver_data;
  8799.  
  8800. -    if (tty->termios->c_cflag == old_termios->c_cflag)
  8801. -        return;
  8802. -    isdn_tty_change_speed(info);
  8803. -    if ((old_termios->c_cflag & CRTSCTS) &&
  8804. -        !(tty->termios->c_cflag & CRTSCTS)) {
  8805. -        tty->hw_stopped = 0;
  8806. -    }
  8807. +        if (!old_termios)
  8808. +                isdn_tty_change_speed(info);
  8809. +        else {
  8810. +                if (tty->termios->c_cflag == old_termios->c_cflag)
  8811. +                        return;
  8812. +                isdn_tty_change_speed(info);
  8813. +                if ((old_termios->c_cflag & CRTSCTS) &&
  8814. +                    !(tty->termios->c_cflag & CRTSCTS)) {
  8815. +                        tty->hw_stopped = 0;
  8816. +                }
  8817. +        }
  8818.  }
  8819.  
  8820.  /*
  8821. @@ -817,7 +1128,8 @@
  8822.       * If non-blocking mode is set, then make the check up front
  8823.       * and then exit.
  8824.       */
  8825. -    if (filp->f_flags & O_NONBLOCK) {
  8826. +    if ((filp->f_flags & O_NONBLOCK) ||
  8827. +            (tty->flags & (1 << TTY_IO_ERROR))) {
  8828.          if (info->flags & ISDN_ASYNC_CALLOUT_ACTIVE)
  8829.              return -EBUSY;
  8830.          info->flags |= ISDN_ASYNC_NORMAL_ACTIVE;
  8831. @@ -865,9 +1177,7 @@
  8832.          }
  8833.          if (!(info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
  8834.              !(info->flags & ISDN_ASYNC_CLOSING) &&
  8835. -            (do_clocal || (
  8836. -                      dev->mdm.msr[info->line] &
  8837. -                      UART_MSR_DCD))) {
  8838. +            (do_clocal || (info->msr & UART_MSR_DCD))) {
  8839.              break;
  8840.          }
  8841.          if (current->signal & ~current->blocked) {
  8842. @@ -972,7 +1282,6 @@
  8843.  #endif
  8844.          return;
  8845.      }
  8846. -    dev->modempoll--;
  8847.      if ((tty->count == 1) && (info->count != 1)) {
  8848.          /*
  8849.           * Uh, oh.  tty->count is 1, which means that the tty
  8850. @@ -1007,8 +1316,7 @@
  8851.      if (info->flags & ISDN_ASYNC_CALLOUT_ACTIVE)
  8852.          info->callout_termios = *tty->termios;
  8853.  
  8854. -    tty->closing = 1;
  8855. -
  8856. +        tty->closing = 1;
  8857.      /*
  8858.       * At this point we stop accepting input.  To do this, we
  8859.       * disable the receive line status interrupts, and tell the
  8860. @@ -1023,8 +1331,7 @@
  8861.           * important if there is a transmit FIFO!
  8862.           */
  8863.          timeout = jiffies + HZ;
  8864. -        while (!(dev->mdm.mlr[info->line]
  8865. -             & UART_LSR_TEMT)) {
  8866. +        while (!(info->lsr & UART_LSR_TEMT)) {
  8867.              current->state = TASK_INTERRUPTIBLE;
  8868.              current->timeout = jiffies + 20;
  8869.              schedule();
  8870. @@ -1032,6 +1339,7 @@
  8871.                  break;
  8872.          }
  8873.      }
  8874. +    dev->modempoll--;
  8875.      isdn_tty_shutdown(info);
  8876.      if (tty->driver.flush_buffer)
  8877.          tty->driver.flush_buffer(tty);
  8878. @@ -1039,22 +1347,10 @@
  8879.          tty->ldisc.flush_buffer(tty);
  8880.      info->tty = 0;
  8881.      tty->closing = 0;
  8882. -#if 00
  8883. -    if (tty->ldisc.num != ldiscs[N_TTY].num) {
  8884. -        if (tty->ldisc.close)
  8885. -            (tty->ldisc.close) (tty);
  8886. -        tty->ldisc = ldiscs[N_TTY];
  8887. -        tty->termios->c_line = N_TTY;
  8888. -        if (tty->ldisc.open)
  8889. -            (tty->ldisc.open) (tty);
  8890. -    }
  8891. -#endif
  8892.      if (info->blocked_open) {
  8893. -        if (info->close_delay) {
  8894. -            current->state = TASK_INTERRUPTIBLE;
  8895. -            current->timeout = jiffies + info->close_delay;
  8896. -            schedule();
  8897. -        }
  8898. +                current->state = TASK_INTERRUPTIBLE;
  8899. +                current->timeout = jiffies + 50;
  8900. +                schedule();
  8901.          wake_up_interruptible(&info->open_wait);
  8902.      }
  8903.      info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE |
  8904. @@ -1082,6 +1378,8 @@
  8905.      wake_up_interruptible(&info->open_wait);
  8906.  }
  8907.  
  8908. +/* This routine initializes all emulator-data.
  8909. + */
  8910.  static void isdn_tty_reset_profile(atemu * m)
  8911.  {
  8912.      m->profile[0] = 0;
  8913. @@ -1097,22 +1395,32 @@
  8914.      m->profile[10] = 7;
  8915.      m->profile[11] = 70;
  8916.      m->profile[12] = 0x45;
  8917. -    m->profile[13] = 0;
  8918. +    m->profile[13] = 4;
  8919.      m->profile[14] = ISDN_PROTO_L2_X75I;
  8920.      m->profile[15] = ISDN_PROTO_L3_TRANS;
  8921.      m->profile[16] = ISDN_SERIAL_XMIT_SIZE / 16;
  8922.      m->profile[17] = ISDN_MODEM_WINSIZE;
  8923. -    m->profile[18] = 7;
  8924. +    m->profile[18] = 4;
  8925.      m->profile[19] = 0;
  8926. +    m->profile[20] = 0;
  8927.      m->pmsn[0] = '\0';
  8928.  }
  8929.  
  8930. +static void isdn_tty_modem_reset_vpar(atemu *m)
  8931. +{
  8932. +        m->vpar[0] = 2;  /* Voice-device            (2 = phone line) */
  8933. +        m->vpar[1] = 0;  /* Silence detection level (0 = none      ) */
  8934. +        m->vpar[2] = 70; /* Silence interval        (7 sec.        ) */
  8935. +        m->vpar[3] = 2;  /* Compression type        (1 = ADPCM-2   ) */
  8936. +}
  8937. +
  8938.  static void isdn_tty_modem_reset_regs(atemu * m, int force)
  8939.  {
  8940.      if ((m->mdmreg[12] & 32) || force) {
  8941.          memcpy(m->mdmreg, m->profile, ISDN_MODEM_ANZREG);
  8942.          memcpy(m->msn, m->pmsn, ISDN_MSNLEN);
  8943.      }
  8944. +        isdn_tty_modem_reset_vpar(m);
  8945.      m->mdmcmdl = 0;
  8946.  }
  8947.  
  8948. @@ -1131,10 +1439,6 @@
  8949.      modem_info *info;
  8950.  
  8951.      m = &dev->mdm;
  8952. -    for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  8953. -        isdn_tty_reset_profile(&(m->atmodem[i]));
  8954. -        isdn_tty_modem_reset_regs(&(m->atmodem[i]), 1);
  8955. -    }
  8956.      memset(&m->tty_modem, 0, sizeof(struct tty_driver));
  8957.      m->tty_modem.magic = TTY_DRIVER_MAGIC;
  8958.      m->tty_modem.name = isdn_ttyname_ttyI;
  8959. @@ -1148,8 +1452,8 @@
  8960.      m->tty_modem.flags = TTY_DRIVER_REAL_RAW;
  8961.      m->tty_modem.refcount = &m->refcount;
  8962.      m->tty_modem.table = m->modem_table;
  8963. -    m->tty_modem.termios = m->modem_termios;
  8964. -    m->tty_modem.termios_locked = m->modem_termios_locked;
  8965. +    m->tty_modem.termios = (struct termios **)m->modem_termios;
  8966. +    m->tty_modem.termios_locked = (struct termios **)m->modem_termios_locked;
  8967.      m->tty_modem.open = isdn_tty_open;
  8968.      m->tty_modem.close = isdn_tty_close;
  8969.      m->tty_modem.write = isdn_tty_write;
  8970. @@ -1184,11 +1488,12 @@
  8971.          return -2;
  8972.      }
  8973.      for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  8974. -        info = &(m->info[i]);
  8975. +        info = &m->info[i];
  8976. +        isdn_tty_reset_profile(&info->emu);
  8977. +        isdn_tty_modem_reset_regs(&info->emu, 1);
  8978.          info->magic = ISDN_ASYNC_MAGIC;
  8979.          info->line = i;
  8980.          info->tty = 0;
  8981. -        info->close_delay = 50;
  8982.          info->x_char = 0;
  8983.          info->count = 0;
  8984.          info->blocked_open = 0;
  8985. @@ -1196,16 +1501,15 @@
  8986.          info->normal_termios = m->tty_modem.init_termios;
  8987.          info->open_wait = 0;
  8988.          info->close_wait = 0;
  8989. -        info->type = ISDN_PORT_16550A;
  8990.          info->isdn_driver = -1;
  8991.          info->isdn_channel = -1;
  8992.          info->drv_index = -1;
  8993.          info->xmit_size = ISDN_SERIAL_XMIT_SIZE;
  8994. -        if (!(info->xmit_buf = kmalloc(ISDN_SERIAL_XMIT_SIZE + 5, GFP_KERNEL))) {
  8995. +        if (!(info->xmit_buf = kmalloc(sizeof(struct sk_buff_head), GFP_KERNEL))) {
  8996.              printk(KERN_ERR "Could not allocate modem xmit-buffer\n");
  8997.              return -3;
  8998.          }
  8999. -        info->xmit_buf += 4;    /* Make room for T.70 header */
  9000. +                skb_queue_head_init(info->xmit_buf);
  9001.      }
  9002.      return 0;
  9003.  }
  9004. @@ -1261,16 +1565,16 @@
  9005.      printk(KERN_DEBUG "m_fi: eaz=%s si1=%d si2=%d\n", eaz, si1, si2);
  9006.  #endif
  9007.      for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  9008. +                modem_info *info = &dev->mdm.info[i];
  9009.  #ifdef ISDN_DEBUG_MODEM_ICALL
  9010.          printk(KERN_DEBUG "m_fi: i=%d msn=%s mmsn=%s mreg18=%d mreg19=%d\n", i,
  9011. -               dev->mdm.atmodem[i].msn, isdn_map_eaz2msn(dev->mdm.atmodem[i].msn, di),
  9012. -               dev->mdm.atmodem[i].mdmreg[18], dev->mdm.atmodem[i].mdmreg[19]);
  9013. +               info->emu.msn, isdn_map_eaz2msn(info->emu.msn, di),
  9014. +               info->emu.mdmreg[18], info->emu.mdmreg[19]);
  9015.  #endif
  9016. -        if ((!strcmp(isdn_map_eaz2msn(dev->mdm.atmodem[i].msn, di)
  9017. -                 ,eaz)) &&    /* EAZ is matching   */
  9018. -            (dev->mdm.atmodem[i].mdmreg[18] == si1) &&    /* SI1 is matching   */
  9019. -            (dev->mdm.atmodem[i].mdmreg[19] == si2)) {    /* SI2 is matching   */
  9020. -            modem_info *info = &dev->mdm.info[i];
  9021. +        if ((!strcmp(isdn_map_eaz2msn(info->emu.msn, di),
  9022. +                             eaz)) &&                             /* EAZ is matching      */
  9023. +            (info->emu.mdmreg[18] & si2bit[si1]) &&       /* SI1 is matching      */
  9024. +            ((info->emu.mdmreg[19] == si2) || !si2)) {    /* SI2 is matching or 0 */
  9025.              idx = isdn_dc2minor(di, ch);
  9026.  #ifdef ISDN_DEBUG_MODEM_ICALL
  9027.              printk(KERN_DEBUG "m_fi: match1\n");
  9028. @@ -1287,8 +1591,9 @@
  9029.                  info->drv_index = idx;
  9030.                  dev->m_idx[idx] = info->line;
  9031.                  dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE;
  9032. -                dev->usage[idx] |= ISDN_USAGE_MODEM;
  9033. +                dev->usage[idx] |= (si1==1)?ISDN_USAGE_VOICE:ISDN_USAGE_MODEM;
  9034.                  strcpy(dev->num[idx], nr);
  9035. +                                info->emu.mdmreg[20] = si2bit[si1];
  9036.                  isdn_info_update();
  9037.                  restore_flags(flags);
  9038.                  printk(KERN_INFO "isdn_tty: call from %s, -> RING on ttyI%d\n", nr,
  9039. @@ -1316,7 +1621,7 @@
  9040.  static void isdn_tty_at_cout(char *msg, modem_info * info)
  9041.  {
  9042.      struct tty_struct *tty;
  9043. -    atemu *m = &(dev->mdm.atmodem[info->line]);
  9044. +    atemu *m = &info->emu;
  9045.      char *p;
  9046.      char c;
  9047.      ulong flags;
  9048. @@ -1330,17 +1635,17 @@
  9049.      tty = info->tty;
  9050.      for (p = msg; *p; p++) {
  9051.          switch (*p) {
  9052. -        case '\r':
  9053. -            c = m->mdmreg[3];
  9054. -            break;
  9055. -        case '\n':
  9056. -            c = m->mdmreg[4];
  9057. -            break;
  9058. -        case '\b':
  9059. -            c = m->mdmreg[5];
  9060. -            break;
  9061. -        default:
  9062. -            c = *p;
  9063. +                        case '\r':
  9064. +                                c = m->mdmreg[3];
  9065. +                                break;
  9066. +                        case '\n':
  9067. +                                c = m->mdmreg[4];
  9068. +                                break;
  9069. +                        case '\b':
  9070. +                                c = m->mdmreg[5];
  9071. +                                break;
  9072. +                        default:
  9073. +                                c = *p;
  9074.          }
  9075.          if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) {
  9076.              restore_flags(flags);
  9077. @@ -1363,8 +1668,8 @@
  9078.  #ifdef ISDN_DEBUG_MODEM_HUP
  9079.          printk(KERN_DEBUG "Mhup in isdn_tty_on_hook\n");
  9080.  #endif
  9081. -        isdn_tty_modem_hup(info);
  9082.          isdn_tty_modem_result(3, info);
  9083. +        isdn_tty_modem_hup(info);
  9084.      }
  9085.  }
  9086.  
  9087. @@ -1433,43 +1738,45 @@
  9088.   */
  9089.  void isdn_tty_modem_result(int code, modem_info * info)
  9090.  {
  9091. -    atemu *m = &dev->mdm.atmodem[info->line];
  9092. +    atemu *m = &info->emu;
  9093.      static char *msg[] =
  9094.      {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR",
  9095.       "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER",
  9096. -     "RINGING", "NO MSN/EAZ"};
  9097. +     "RINGING", "NO MSN/EAZ", "VCON"};
  9098.      ulong flags;
  9099.      char s[4];
  9100.  
  9101.      switch (code) {
  9102. -    case 2:
  9103. -        m->mdmreg[1]++;    /* RING */
  9104. -        if (m->mdmreg[1] == m->mdmreg[0]) {
  9105. -            /* Accept incoming call */
  9106. -            isdn_ctrl cmd;
  9107. -            m->mdmreg[1] = 0;
  9108. -            dev->mdm.msr[info->line] &= ~UART_MSR_RI;
  9109. -            cmd.driver = info->isdn_driver;
  9110. -            cmd.arg = info->isdn_channel;
  9111. -            cmd.command = ISDN_CMD_ACCEPTD;
  9112. -            dev->drv[info->isdn_driver]->interface->command(&cmd);
  9113. -        }
  9114. -        break;
  9115. -    case 3:
  9116. -        /* NO CARRIER */
  9117. -        save_flags(flags);
  9118. -        cli();
  9119. -        dev->mdm.msr[info->line] &= ~(UART_MSR_DCD | UART_MSR_RI);
  9120. -        if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
  9121. -            restore_flags(flags);
  9122. -            return;
  9123. -        }
  9124. -        restore_flags(flags);
  9125. -        break;
  9126. -    case 1:
  9127. -    case 5:
  9128. -        dev->mdm.online[info->line] = 1;
  9129. -        break;
  9130. +                case 2:
  9131. +                        m->mdmreg[1]++;    /* RING */
  9132. +                        if (m->mdmreg[1] == m->mdmreg[0])
  9133. +                                /* Automatically accept incoming call */
  9134. +                                isdn_tty_cmd_ATA(info);
  9135. +                        break;
  9136. +                case 3:
  9137. +                        /* NO CARRIER */
  9138. +                        save_flags(flags);
  9139. +                        cli();
  9140. +#ifdef ISDN_DEBUG_MODEM_HUP
  9141. +                        printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n",
  9142. +                               (info->flags & ISDN_ASYNC_CLOSING),
  9143. +                               (!info->tty));
  9144. +#endif
  9145. +                        if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
  9146. +                                restore_flags(flags);
  9147. +                                return;
  9148. +                        }
  9149. +                        restore_flags(flags);
  9150. +                        break;
  9151. +                case 1:
  9152. +                case 5:
  9153. +                        if (!info->online)
  9154. +                                info->online = 2;
  9155. +                        break;
  9156. +                case 11:
  9157. +                        if (!info->online)
  9158. +                                info->online = 1;
  9159. +                        break;
  9160.      }
  9161.      if (m->mdmreg[12] & 1) {
  9162.          /* Show results */
  9163. @@ -1503,8 +1810,9 @@
  9164.          }
  9165.          if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
  9166.              (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
  9167. -               (info->flags & ISDN_ASYNC_CALLOUT_NOHUP))))
  9168. +               (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
  9169.              tty_hangup(info->tty);
  9170. +                }
  9171.          restore_flags(flags);
  9172.      }
  9173.  }
  9174. @@ -1516,7 +1824,7 @@
  9175.  {
  9176.      char v[6];
  9177.  
  9178. -    sprintf(v, "%d\r\n", dev->mdm.atmodem[info->line].mdmreg[ridx]);
  9179. +    sprintf(v, "\r\n%d", info->emu.mdmreg[ridx]);
  9180.      isdn_tty_at_cout(v, info);
  9181.  }
  9182.  
  9183. @@ -1546,319 +1854,594 @@
  9184.      *q = 0;
  9185.  }
  9186.  
  9187. +#define PARSE_ERROR { isdn_tty_modem_result(4, info); return; }
  9188. +#define PARSE_ERROR1 { isdn_tty_modem_result(4, info); return 1; }
  9189. +
  9190. +/*
  9191. + * Parse AT&.. commands.
  9192. + */
  9193. +static int isdn_tty_cmd_ATand(char **p, modem_info * info)
  9194. +{
  9195. +        atemu *m = &info->emu;
  9196. +        int i;
  9197. +        char rb[100];
  9198. +
  9199. +        switch (*p[0]) {
  9200. +                case 'B':
  9201. +                        /* &B - Set Buffersize */
  9202. +                        p[0]++;
  9203. +                        i = isdn_getnum(p);
  9204. +                        if ((i < 0) || (i > ISDN_SERIAL_XMIT_SIZE))
  9205. +                                PARSE_ERROR1;
  9206. +#ifdef CONFIG_ISDN_AUDIO
  9207. +                        if ((m->mdmreg[18] & 1) && (i > VBUF))
  9208. +                                PARSE_ERROR1;
  9209. +#endif
  9210. +                        m->mdmreg[16] = i / 16;
  9211. +                        info->xmit_size = m->mdmreg[16] * 16;
  9212. +                        break;
  9213. +                case 'D':
  9214. +                        /* &D - Set DCD-Low-behavior */
  9215. +                        p[0]++;
  9216. +                        switch (isdn_getnum(p)) {
  9217. +                                case 0:
  9218. +                                        m->mdmreg[13] &= ~4;
  9219. +                                        break;
  9220. +                                case 2:
  9221. +                                        m->mdmreg[13] |= 4;
  9222. +                                        m->mdmreg[12] &= ~32;
  9223. +                                        break;
  9224. +                                case 3:
  9225. +                                        m->mdmreg[13] |= 4;
  9226. +                                        m->mdmreg[12] |= 32;
  9227. +                                        break;
  9228. +                                default:
  9229. +                                        PARSE_ERROR1
  9230. +                        }
  9231. +                        break;
  9232. +                case 'E':
  9233. +                        /* &E -Set EAZ/MSN */
  9234. +                        p[0]++;
  9235. +                        isdn_tty_get_msnstr(m->msn, p);
  9236. +                        break;
  9237. +                case 'F':
  9238. +                        /* &F -Set Factory-Defaults */
  9239. +                        p[0]++;
  9240. +                        isdn_tty_reset_profile(m);
  9241. +                        isdn_tty_modem_reset_regs(m, 1);
  9242. +                        break;
  9243. +                case 'S':
  9244. +                        /* &S - Set Windowsize */
  9245. +                        p[0]++;
  9246. +                        i = isdn_getnum(p);
  9247. +                        if ((i > 0) && (i < 9))
  9248. +                                m->mdmreg[17] = i;
  9249. +                        else
  9250. +                                PARSE_ERROR1;
  9251. +                        break;
  9252. +                case 'V':
  9253. +                        /* &V - Show registers */
  9254. +                        p[0]++;
  9255. +                        for (i = 0; i < ISDN_MODEM_ANZREG; i++) {
  9256. +                                sprintf(rb, "S%d=%d%s", i, 
  9257. +                                        m->mdmreg[i], (i == 6) ? "\r\n" : " ");
  9258. +                                isdn_tty_at_cout(rb, info);
  9259. +                        }
  9260. +                        sprintf(rb, "\r\nEAZ/MSN: %s\r\n",
  9261. +                                strlen(m->msn) ? m->msn : "None");
  9262. +                        isdn_tty_at_cout(rb, info);
  9263. +                        break;
  9264. +                case 'W':
  9265. +                        /* &W - Write Profile */
  9266. +                        p[0]++;
  9267. +                        switch (*p[0]) {
  9268. +                                case '0':
  9269. +                                        p[0]++;
  9270. +                                        modem_write_profile(m);
  9271. +                                        break;
  9272. +                                default:
  9273. +                                        PARSE_ERROR1;
  9274. +                        }
  9275. +                        break;
  9276. +                case 'X':
  9277. +                        /* &X - Switch to BTX-Mode */
  9278. +                        p[0]++;
  9279. +                        switch (isdn_getnum(p)) {
  9280. +                                case 0:
  9281. +                                        m->mdmreg[13] &= ~2;
  9282. +                                        break;
  9283. +                                case 1:
  9284. +                                        m->mdmreg[13] |= 2;
  9285. +                                        m->mdmreg[14] = 0;
  9286. +                                        m->mdmreg[16] = 7;
  9287. +                                        info->xmit_size = 112;
  9288. +                                        m->mdmreg[18] = 4;
  9289. +                                        m->mdmreg[19] = 0;
  9290. +                                        break;
  9291. +                                default:
  9292. +                                        PARSE_ERROR1;
  9293. +                        }
  9294. +                        break;
  9295. +                default:
  9296. +                        PARSE_ERROR1;
  9297. +        }
  9298. +        return 0;
  9299. +}
  9300. +
  9301. +/*
  9302. + * Perform ATS command
  9303. + */
  9304. +static int isdn_tty_cmd_ATS(char **p, modem_info * info)
  9305. +{
  9306. +        atemu *m = &info->emu;
  9307. +        int mreg;
  9308. +        int mval;
  9309. +
  9310. +        mreg = isdn_getnum(p);
  9311. +        if (mreg < 0 || mreg > ISDN_MODEM_ANZREG)
  9312. +                PARSE_ERROR1;
  9313. +        switch (*p[0]) {
  9314. +                case '=':
  9315. +                        p[0]++;
  9316. +                        mval = isdn_getnum(p);
  9317. +                        if (mval < 0 || mval > 255)
  9318. +                                PARSE_ERROR1;
  9319. +                        switch (mreg) {
  9320. +                                /* Some plausibility checks */
  9321. +                                case 14:
  9322. +                                        if (mval > ISDN_PROTO_L2_TRANS)
  9323. +                                                PARSE_ERROR1;
  9324. +                                        break;
  9325. +                                case 16:
  9326. +                                        if ((mval * 16) > ISDN_SERIAL_XMIT_SIZE)
  9327. +                                                PARSE_ERROR1;
  9328. +#ifdef CONFIG_ISDN_AUDIO
  9329. +                                        if ((m->mdmreg[18] & 1) && (mval > VBUFX))
  9330. +                                                PARSE_ERROR1;
  9331. +#endif
  9332. +                                        info->xmit_size = mval * 16;
  9333. +                                        break;
  9334. +                                case 20:
  9335. +                                        PARSE_ERROR1;
  9336. +                        }
  9337. +                        m->mdmreg[mreg] = mval;
  9338. +                        break;
  9339. +                case '?':
  9340. +                        p[0]++;
  9341. +                        isdn_tty_show_profile(mreg, info);
  9342. +                        break;
  9343. +                default:
  9344. +                        PARSE_ERROR1;
  9345. +                        break;
  9346. +        }
  9347. +        return 0;
  9348. +}
  9349. +
  9350. +/*
  9351. + * Perform ATA command
  9352. + */
  9353. +static void isdn_tty_cmd_ATA(modem_info * info)
  9354. +{
  9355. +        atemu *m = &info->emu;
  9356. +        isdn_ctrl cmd;
  9357. +        int l2;
  9358. +
  9359. +        if (info->msr & UART_MSR_RI) {
  9360. +                /* Accept incoming call */
  9361. +                m->mdmreg[1] = 0;
  9362. +                info->msr &= ~UART_MSR_RI;
  9363. +                l2 = m->mdmreg[14];
  9364. +#ifdef CONFIG_ISDN_AUDIO
  9365. +                /* If more than one bit set in reg18, autoselect Layer2 */
  9366. +                if ((m->mdmreg[18] & m->mdmreg[20]) != m->mdmreg[18])
  9367. +                        if (m->mdmreg[20] == 1) l2 = 4;
  9368. +#endif
  9369. +                cmd.driver = info->isdn_driver;
  9370. +                cmd.command = ISDN_CMD_SETL2;
  9371. +                cmd.arg = info->isdn_channel + (l2 << 8);
  9372. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  9373. +                cmd.driver = info->isdn_driver;
  9374. +                cmd.command = ISDN_CMD_SETL3;
  9375. +                cmd.arg = info->isdn_channel + (m->mdmreg[15] << 8);
  9376. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  9377. +                cmd.driver = info->isdn_driver;
  9378. +                cmd.arg = info->isdn_channel;
  9379. +                cmd.command = ISDN_CMD_ACCEPTD;
  9380. +                dev->drv[info->isdn_driver]->interface->command(&cmd);
  9381. +        } else
  9382. +                isdn_tty_modem_result(8, info);
  9383. +}
  9384. +
  9385. +#ifdef CONFIG_ISDN_AUDIO
  9386. +/*
  9387. + * Parse AT+V.. commands
  9388. + */
  9389. +static int isdn_tty_cmd_PLUSV(char **p, modem_info * info)
  9390. +{
  9391. +        atemu *m = &info->emu;
  9392. +        static char *vcmd[] = {"NH","IP","LS","RX","SD","SM","TX",NULL};
  9393. +        int i;
  9394. +    int par1;
  9395. +    int par2;
  9396. +    char rs[20];
  9397. +
  9398. +        i = 0;
  9399. +        while (vcmd[i]) {
  9400. +                if (!strncmp(vcmd[i],p[0],2)) {
  9401. +                        p[0] += 2;
  9402. +                        break;
  9403. +                }
  9404. +                i++;
  9405. +        }
  9406. +        switch (i) {
  9407. +                case 0:
  9408. +                        /* AT+VNH - Auto hangup feature */
  9409. +                        switch (*p[0]) {
  9410. +                                case '?':
  9411. +                                        p[0]++;
  9412. +                                        isdn_tty_at_cout("\r\n1", info);
  9413. +                                        break;
  9414. +                                case '=':
  9415. +                                        p[0]++;
  9416. +                                        switch (*p[0]) {
  9417. +                                                case '1':
  9418. +                                                        p[0]++;
  9419. +                                                        break;
  9420. +                                                case '?':
  9421. +                                                        p[0]++;
  9422. +                                                        isdn_tty_at_cout("\r\n1", info);
  9423. +                                                        break;
  9424. +                                                default:
  9425. +                                                        PARSE_ERROR1;
  9426. +                                        }
  9427. +                                        break;
  9428. +                                default:
  9429. +                                        PARSE_ERROR1;
  9430. +                        }
  9431. +                        break;
  9432. +                case 1:
  9433. +                        /* AT+VIP - Reset all voice parameters */
  9434. +                        isdn_tty_modem_reset_vpar(m);
  9435. +                        break;
  9436. +                case 2:
  9437. +                        /* AT+VLS - Select device, accept incoming call */
  9438. +                        switch (*p[0]) {
  9439. +                                case '?':
  9440. +                                        p[0]++;
  9441. +                                        sprintf(rs,"\r\n%d",m->vpar[0]);
  9442. +                                        isdn_tty_at_cout(rs, info);
  9443. +                                        break;
  9444. +                                case '=':
  9445. +                                        p[0]++;
  9446. +                                        switch (*p[0]) {
  9447. +                                                case '0':
  9448. +                                                        p[0]++;
  9449. +                                                        m->vpar[0] = 0;
  9450. +                                                        break;
  9451. +                                                case '2':
  9452. +                                                        p[0]++;
  9453. +                                                        m->vpar[0] = 2;
  9454. +                                                        break;
  9455. +                                                case '?':
  9456. +                                                        p[0]++;
  9457. +                                                        isdn_tty_at_cout("\r\n0,2", info);
  9458. +                                                        break;
  9459. +                                                default:
  9460. +                                                        PARSE_ERROR1;
  9461. +                                        }
  9462. +                                        break;
  9463. +                                default:
  9464. +                                        PARSE_ERROR1;
  9465. +                        }
  9466. +                        break;
  9467. +                case 3:
  9468. +                        /* AT+VRX - Start recording */
  9469. +                        if (!m->vpar[0])
  9470. +                                PARSE_ERROR1;
  9471. +                        if (m->vpar[3] < 5) {
  9472. +                                info->adpcmr = isdn_audio_adpcm_init(m->vpar[3]);
  9473. +                                if (!info->adpcmr) {
  9474. +                                        printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n");
  9475. +                                        PARSE_ERROR1;
  9476. +                                }
  9477. +                        }
  9478. +                        info->vonline = 1;
  9479. +                        isdn_tty_modem_result(1, info);
  9480. +                        return 1;
  9481. +                        break;
  9482. +                case 4:
  9483. +                        /* AT+VSD - Silence detection */
  9484. +                        switch (*p[0]) {
  9485. +                                case '?':
  9486. +                                        p[0]++;
  9487. +                                        sprintf(rs,"\r\n<%d>,<%d>",
  9488. +                                                m->vpar[1],
  9489. +                                                m->vpar[2]);
  9490. +                                        isdn_tty_at_cout(rs, info);
  9491. +                                        break;
  9492. +                                case '=':
  9493. +                                        p[0]++;
  9494. +                                        switch (*p[0]) {
  9495. +                                                case '0':
  9496. +                                                case '1':
  9497. +                                                case '2':
  9498. +                                                case '3':
  9499. +                                                        par1 = isdn_getnum(p);
  9500. +                                                        if ((par1 < 0) || (par1 > 31))
  9501. +                                                                PARSE_ERROR1;
  9502. +                                                        if (*p[0] != ',')
  9503. +                                                                PARSE_ERROR1;
  9504. +                                                        p[0]++;
  9505. +                                                        par2 = isdn_getnum(p);
  9506. +                                                        if ((par2 < 0) || (par2 > 255))
  9507. +                                                                PARSE_ERROR1;
  9508. +                                                        m->vpar[1] = par1;
  9509. +                                                        m->vpar[2] = par2;
  9510. +                                                        break;
  9511. +                                                case '?':
  9512. +                                                        p[0]++;
  9513. +                                                        isdn_tty_at_cout("\r\n<0-31>,<0-255>",
  9514. +                                                                         info);
  9515. +                                                        break;
  9516. +                                                default:
  9517. +                                                        PARSE_ERROR1;
  9518. +                                        }
  9519. +                                        break;
  9520. +                                default:
  9521. +                                        PARSE_ERROR1;
  9522. +                        }
  9523. +                        break;
  9524. +                case 5:
  9525. +                        /* AT+VSM - Select compression */
  9526. +                        switch (*p[0]) {
  9527. +                                case '?':
  9528. +                                        p[0]++;
  9529. +                                        sprintf(rs,"\r\n<%d>,<%d><8000>",
  9530. +                                                m->vpar[3],
  9531. +                                                m->vpar[1]);
  9532. +                                        isdn_tty_at_cout(rs, info);
  9533. +                                        break;
  9534. +                                case '=':
  9535. +                                        p[0]++;
  9536. +                                        switch (*p[0]) {
  9537. +                                                case '2':
  9538. +                                                case '3':
  9539. +                                                case '4':
  9540. +                                                case '5':
  9541. +                                                case '6':
  9542. +                                                        par1 = isdn_getnum(p);
  9543. +                                                        if ((par1 < 2) || (par1 > 6))
  9544. +                                                                PARSE_ERROR1;
  9545. +                                                        m->vpar[3] = par1;
  9546. +                                                        break;
  9547. +                                                case '?':
  9548. +                                                        p[0]++;
  9549. +                                                        isdn_tty_at_cout("\r\n2;ADPCM;2;0;(8000)\r\n",
  9550. +                                                                         info);
  9551. +                                                        isdn_tty_at_cout("3;ADPCM;3;0;(8000)\r\n",
  9552. +                                                                         info);
  9553. +                                                        isdn_tty_at_cout("4;ADPCM;4;0;(8000)\r\n",
  9554. +                                                                         info);
  9555. +                                                        isdn_tty_at_cout("5;ALAW;8;0;(8000)",
  9556. +                                                                         info);
  9557. +                                                        isdn_tty_at_cout("6;ULAW;8;0;(8000)",
  9558. +                                                                         info);
  9559. +                                                        break;
  9560. +                                                default:
  9561. +                                                        PARSE_ERROR1;
  9562. +                                        }
  9563. +                                        break;
  9564. +                                default:
  9565. +                                        PARSE_ERROR1;
  9566. +                        }
  9567. +                        break;
  9568. +                case 6:
  9569. +                        /* AT+VTX - Start sending */
  9570. +                        if (!m->vpar[0])
  9571. +                                PARSE_ERROR1;
  9572. +                        if (m->vpar[3] < 5) {
  9573. +                                info->adpcms = isdn_audio_adpcm_init(m->vpar[3]);
  9574. +                                if (!info->adpcms) {
  9575. +                                        printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n");
  9576. +                                        PARSE_ERROR1;
  9577. +                                }
  9578. +                        }
  9579. +                        info->vonline = 2;
  9580. +                        isdn_tty_modem_result(1, info);
  9581. +                        return 1;
  9582. +                        break;
  9583. +                default:
  9584. +                        PARSE_ERROR1;
  9585. +        }
  9586. +        return 0;
  9587. +}
  9588. +#endif        /* CONFIG_ISDN_AUDIO */
  9589. +
  9590.  /*
  9591.   * Parse and perform an AT-command-line.
  9592. - *
  9593. - * Parameter:
  9594. - *   channel   index to line (minor-device)
  9595.   */
  9596.  static void isdn_tty_parse_at(modem_info * info)
  9597.  {
  9598. -    atemu *m = &dev->mdm.atmodem[info->line];
  9599. -    char *p;
  9600. -    int mreg;
  9601. -    int mval;
  9602. -    int i;
  9603. -    char rb[100];
  9604. -    char ds[40];
  9605. -    isdn_ctrl cmd;
  9606. +        atemu *m = &info->emu;
  9607. +        char *p;
  9608. +        char ds[40];
  9609.  
  9610.  #ifdef ISDN_DEBUG_AT
  9611. -    printk(KERN_DEBUG "AT: '%s'\n", m->mdmcmd);
  9612. -#endif
  9613. -    for (p = &m->mdmcmd[2]; *p;) {
  9614. -        switch (*p) {
  9615. -        case 'A':
  9616. -            /* A - Accept incoming call */
  9617. -            p++;
  9618. -                        if (dev->mdm.msr[info->line] & UART_MSR_RI) {
  9619. -#define FIDOBUG
  9620. -#ifdef FIDOBUG
  9621. -/* Variables fido... defined temporarily for finding a strange bug */
  9622. -                driver *fido_drv;
  9623. -                isdn_if *fido_if;
  9624. -                int fido_isdn_driver;
  9625. -                modem_info *fido_modem_info;
  9626. -                int (*fido_command) (isdn_ctrl *);
  9627. -#endif
  9628. -                /* Accept incoming call */
  9629. -                m->mdmreg[1] = 0;
  9630. -                dev->mdm.msr[info->line] &= ~UART_MSR_RI;
  9631. -                cmd.driver = info->isdn_driver;
  9632. -                cmd.command = ISDN_CMD_SETL2;
  9633. -                cmd.arg = info->isdn_channel + (m->mdmreg[14] << 8);
  9634. -                dev->drv[info->isdn_driver]->interface->command(&cmd);
  9635. -                cmd.driver = info->isdn_driver;
  9636. -                cmd.command = ISDN_CMD_SETL3;
  9637. -                cmd.arg = info->isdn_channel + (m->mdmreg[15] << 8);
  9638. -                dev->drv[info->isdn_driver]->interface->command(&cmd);
  9639. -                cmd.driver = info->isdn_driver;
  9640. -                cmd.arg = info->isdn_channel;
  9641. -                cmd.command = ISDN_CMD_ACCEPTD;
  9642. -#ifdef FIDOBUG
  9643. -                fido_modem_info = info;
  9644. -                fido_isdn_driver = fido_modem_info->isdn_driver;
  9645. -                fido_drv = dev->drv[fido_isdn_driver];
  9646. -                fido_if = fido_drv->interface;
  9647. -                fido_command = fido_if->command;
  9648. -                fido_command(&cmd);
  9649. -#else
  9650. -                dev->drv[info->isdn_driver]->interface->command(&cmd);
  9651. +        printk(KERN_DEBUG "AT: '%s'\n", m->mdmcmd);
  9652.  #endif
  9653. -            } else {
  9654. -                isdn_tty_modem_result(8, info);
  9655. -                return;
  9656. -            }
  9657. -            break;
  9658. -        case 'D':
  9659. -            /* D - Dial */
  9660. -            isdn_tty_getdial(++p, ds);
  9661. -            p += strlen(p);
  9662. -            if (!strlen(m->msn))
  9663. -                isdn_tty_modem_result(10, info);
  9664. -            else if (strlen(ds))
  9665. -                isdn_tty_dial(ds, info, m);
  9666. -            else
  9667. -                isdn_tty_modem_result(4, info);
  9668. -            return;
  9669. -        case 'E':
  9670. -            /* E - Turn Echo on/off */
  9671. -            p++;
  9672. -            switch (*p) {
  9673. -            case '0':
  9674. -                p++;
  9675. -                m->mdmreg[12] &= ~4;
  9676. -                break;
  9677. -            case '1':
  9678. -                p++;
  9679. -                m->mdmreg[12] |= 4;
  9680. -                break;
  9681. -            default:
  9682. -                isdn_tty_modem_result(4, info);
  9683. -                return;
  9684. -            }
  9685. -            break;
  9686. -        case 'H':
  9687. -            /* H - On/Off-hook */
  9688. -            p++;
  9689. -            switch (*p) {
  9690. -            case '0':
  9691. -                p++;
  9692. -                isdn_tty_on_hook(info);
  9693. -                break;
  9694. -            case '1':
  9695. -                p++;
  9696. -                isdn_tty_off_hook();
  9697. -                break;
  9698. -            default:
  9699. -                isdn_tty_on_hook(info);
  9700. -                break;
  9701. -            }
  9702. -            break;
  9703. -        case 'I':
  9704. -            /* I - Information */
  9705. -            p++;
  9706. -            isdn_tty_at_cout("ISDN for Linux  (c) by Fritz Elfert\r\n", info);
  9707. -            switch (*p) {
  9708. -            case '0':
  9709. -            case '1':
  9710. -                p++;
  9711. -                break;
  9712. -            default:
  9713. -            }
  9714. -            break;
  9715. -        case 'O':
  9716. -            /* O - Go online */
  9717. -            p++;
  9718. -            if (dev->mdm.msr[info->line] & UART_MSR_DCD)    /* if B-Channel is up */
  9719. -                isdn_tty_modem_result(5, info);
  9720. -            else
  9721. -                isdn_tty_modem_result(3, info);
  9722. -            return;
  9723. -        case 'Q':
  9724. -            /* Q - Turn Emulator messages on/off */
  9725. -            p++;
  9726. -            switch (*p) {
  9727. -            case '0':
  9728. -                p++;
  9729. -                m->mdmreg[12] |= 1;
  9730. -                break;
  9731. -            case '1':
  9732. -                p++;
  9733. -                m->mdmreg[12] &= ~1;
  9734. -                break;
  9735. -            default:
  9736. -                isdn_tty_modem_result(4, info);
  9737. -                return;
  9738. -            }
  9739. -            break;
  9740. -        case 'S':
  9741. -            /* S - Set/Get Register */
  9742. -            p++;
  9743. -            mreg = isdn_getnum(&p);
  9744. -            if (mreg < 0 || mreg > ISDN_MODEM_ANZREG) {
  9745. -                isdn_tty_modem_result(4, info);
  9746. -                return;
  9747. -            }
  9748. -            switch (*p) {
  9749. -            case '=':
  9750. -                p++;
  9751. -                mval = isdn_getnum(&p);
  9752. -                if (mval >= 0 && mval <= 255) {
  9753. -                    if ((mreg == 16) && ((mval * 16) > ISDN_SERIAL_XMIT_SIZE)) {
  9754. -                        isdn_tty_modem_result(4, info);
  9755. -                        return;
  9756. -                    }
  9757. -                    m->mdmreg[mreg] = mval;
  9758. -                } else {
  9759. -                    isdn_tty_modem_result(4, info);
  9760. -                    return;
  9761. -                }
  9762. -                break;
  9763. -            case '?':
  9764. -                p++;
  9765. -                isdn_tty_show_profile(mreg, info);
  9766. -                return;
  9767. -                break;
  9768. -            default:
  9769. -                isdn_tty_modem_result(4, info);
  9770. -                return;
  9771. -            }
  9772. -            break;
  9773. -        case 'V':
  9774. -            /* V - Numeric or ASCII Emulator-messages */
  9775. -            p++;
  9776. -            switch (*p) {
  9777. -            case '0':
  9778. -                p++;
  9779. -                m->mdmreg[12] |= 2;
  9780. -                break;
  9781. -            case '1':
  9782. -                p++;
  9783. -                m->mdmreg[12] &= ~2;
  9784. -                break;
  9785. -            default:
  9786. -                isdn_tty_modem_result(4, info);
  9787. -                return;
  9788. -            }
  9789. -            break;
  9790. -        case 'Z':
  9791. -            /* Z - Load Registers from Profile */
  9792. -            p++;
  9793. -            isdn_tty_modem_reset_regs(m, 1);
  9794. -            break;
  9795. -        case '+':
  9796. -            p++;
  9797. -            switch (*p) {
  9798. -            case 'F':
  9799. -                break;
  9800. -            }
  9801. -            break;
  9802. -        case '&':
  9803. -            p++;
  9804. -            switch (*p) {
  9805. -            case 'B':
  9806. -                /* &B - Set Buffersize */
  9807. -                p++;
  9808. -                i = isdn_getnum(&p);
  9809. -                if ((i < 0) || (i > ISDN_SERIAL_XMIT_SIZE)) {
  9810. -                    isdn_tty_modem_result(4, info);
  9811. -                    return;
  9812. -                }
  9813. -                m->mdmreg[16] = i / 16;
  9814. -                break;
  9815. -            case 'D':
  9816. -                /* &D - Set DCD-Low-behavior */
  9817. -                p++;
  9818. -                switch (isdn_getnum(&p)) {
  9819. -                case 2:
  9820. -                    m->mdmreg[12] &= ~32;
  9821. -                    break;
  9822. -                case 3:
  9823. -                    m->mdmreg[12] |= 32;
  9824. -                    break;
  9825. -                default:
  9826. -                    isdn_tty_modem_result(4, info);
  9827. -                    return;
  9828. -                }
  9829. -                break;
  9830. -            case 'E':
  9831. -                /* &E -Set EAZ/MSN */
  9832. -                p++;
  9833. -                isdn_tty_get_msnstr(m->msn, &p);
  9834. -                break;
  9835. -            case 'F':
  9836. -                /* &F -Set Factory-Defaults */
  9837. -                p++;
  9838. -                isdn_tty_reset_profile(m);
  9839. -                isdn_tty_modem_reset_regs(m, 1);
  9840. -                break;
  9841. -            case 'S':
  9842. -                /* &S - Set Windowsize */
  9843. -                p++;
  9844. -                i = isdn_getnum(&p);
  9845. -                if ((i > 0) && (i < 9))
  9846. -                    m->mdmreg[17] = i;
  9847. -                else {
  9848. -                    isdn_tty_modem_result(4, info);
  9849. -                    return;
  9850. -                }
  9851. -                break;
  9852. -            case 'V':
  9853. -                /* &V - Show registers */
  9854. -                p++;
  9855. -                for (i = 0; i < ISDN_MODEM_ANZREG; i++) {
  9856. -                    sprintf(rb, "S%d=%d%s", i, m->mdmreg[i], (i == 6) ? "\r\n" : " ");
  9857. -                    isdn_tty_at_cout(rb, info);
  9858. -                }
  9859. -                sprintf(rb, "\r\nEAZ/MSN: %s\r\n", strlen(m->msn) ? m->msn : "None");
  9860. -                isdn_tty_at_cout(rb, info);
  9861. -                break;
  9862. -            case 'W':
  9863. -                /* &W - Write Profile */
  9864. -                p++;
  9865. -                switch (*p) {
  9866. -                case '0':
  9867. -                    p++;
  9868. -                    modem_write_profile(m);
  9869. -                    break;
  9870. -                default:
  9871. -                    isdn_tty_modem_result(4, info);
  9872. -                    return;
  9873. -                }
  9874. -                break;
  9875. -            case 'X':
  9876. -                /* &X - Switch to BTX-Mode */
  9877. -                p++;
  9878. -                switch (*p) {
  9879. -                case '0':
  9880. -                    p++;
  9881. -                    m->mdmreg[13] &= ~2;
  9882. -                    break;
  9883. -                case '1':
  9884. -                    p++;
  9885. -                    m->mdmreg[13] |= 2;
  9886. -                    m->mdmreg[14] = 0;
  9887. -                    m->mdmreg[16] = 7;
  9888. -                    m->mdmreg[18] = 7;
  9889. -                    m->mdmreg[19] = 0;
  9890. -                    break;
  9891. -                default:
  9892. -                    isdn_tty_modem_result(4, info);
  9893. -                    return;
  9894. -                }
  9895. -                break;
  9896. -            default:
  9897. -                isdn_tty_modem_result(4, info);
  9898. -                return;
  9899. -            }
  9900. -            break;
  9901. -        default:
  9902. -            isdn_tty_modem_result(4, info);
  9903. -            return;
  9904. -        }
  9905. -    }
  9906. -    isdn_tty_modem_result(0, info);
  9907. +        for (p = &m->mdmcmd[2]; *p;) {
  9908. +                switch (*p) {
  9909. +                        case 'A':
  9910. +                                /* A - Accept incoming call */
  9911. +                                p++;
  9912. +                                isdn_tty_cmd_ATA(info);
  9913. +                                return;
  9914. +                                break;
  9915. +                        case 'D':
  9916. +                                /* D - Dial */
  9917. +                                isdn_tty_getdial(++p, ds);
  9918. +                                p += strlen(p);
  9919. +                                if (!strlen(m->msn))
  9920. +                                        isdn_tty_modem_result(10, info);
  9921. +                                else if (strlen(ds))
  9922. +                                        isdn_tty_dial(ds, info, m);
  9923. +                                else
  9924. +                                        isdn_tty_modem_result(4, info);
  9925. +                                return;
  9926. +                        case 'E':
  9927. +                                /* E - Turn Echo on/off */
  9928. +                                p++;
  9929. +                                switch (isdn_getnum(&p)) {
  9930. +                                        case 0:
  9931. +                                                m->mdmreg[12] &= ~4;
  9932. +                                                break;
  9933. +                                        case 1:
  9934. +                                                m->mdmreg[12] |= 4;
  9935. +                                                break;
  9936. +                                        default:
  9937. +                                                PARSE_ERROR;
  9938. +                                }
  9939. +                                break;
  9940. +                        case 'H':
  9941. +                                /* H - On/Off-hook */
  9942. +                                p++;
  9943. +                                switch (*p) {
  9944. +                                        case '0':
  9945. +                                                p++;
  9946. +                                                isdn_tty_on_hook(info);
  9947. +                                                break;
  9948. +                                        case '1':
  9949. +                                                p++;
  9950. +                                                isdn_tty_off_hook();
  9951. +                                                break;
  9952. +                                        default:
  9953. +                                                isdn_tty_on_hook(info);
  9954. +                                                break;
  9955. +                                }
  9956. +                                break;
  9957. +                        case 'I':
  9958. +                                /* I - Information */
  9959. +                                p++;
  9960. +                                isdn_tty_at_cout("\r\nLinux ISDN", info);
  9961. +                                switch (*p) {
  9962. +                                        case '0':
  9963. +                                        case '1':
  9964. +                                                p++;
  9965. +                                                break;
  9966. +                                        default:
  9967. +                                }
  9968. +                                break;
  9969. +                        case 'O':
  9970. +                                /* O - Go online */
  9971. +                                p++;
  9972. +                                if (info->msr & UART_MSR_DCD)
  9973. +                                        /* if B-Channel is up */
  9974. +                                        isdn_tty_modem_result(5, info);
  9975. +                                else
  9976. +                                        isdn_tty_modem_result(3, info);
  9977. +                                return;
  9978. +                        case 'Q':
  9979. +                                /* Q - Turn Emulator messages on/off */
  9980. +                                p++;
  9981. +                                switch (isdn_getnum(&p)) {
  9982. +                                        case 0:
  9983. +                                                m->mdmreg[12] |= 1;
  9984. +                                                break;
  9985. +                                        case 1:
  9986. +                                                m->mdmreg[12] &= ~1;
  9987. +                                                break;
  9988. +                                        default:
  9989. +                                                PARSE_ERROR;
  9990. +                                }
  9991. +                                break;
  9992. +                        case 'S':
  9993. +                                /* S - Set/Get Register */
  9994. +                                p++;
  9995. +                                if (isdn_tty_cmd_ATS(&p, info))
  9996. +                                        return;
  9997. +                                break;
  9998. +                        case 'V':
  9999. +                                /* V - Numeric or ASCII Emulator-messages */
  10000. +                                p++;
  10001. +                                switch (isdn_getnum(&p)) {
  10002. +                                        case 0:
  10003. +                                                m->mdmreg[12] |= 2;
  10004. +                                                break;
  10005. +                                        case 1:
  10006. +                                                m->mdmreg[12] &= ~2;
  10007. +                                                break;
  10008. +                                        default:
  10009. +                                                PARSE_ERROR;
  10010. +                                }
  10011. +                                break;
  10012. +                        case 'Z':
  10013. +                                /* Z - Load Registers from Profile */
  10014. +                                p++;
  10015. +                                isdn_tty_modem_reset_regs(m, 1);
  10016. +                                break;
  10017. +#ifdef CONFIG_ISDN_AUDIO
  10018. +                        case '+':
  10019. +                                p++;
  10020. +                                switch (*p) {
  10021. +                                        case 'F':
  10022. +                                                if (strncmp(p,"FCLASS",6))
  10023. +                                                        PARSE_ERROR;
  10024. +                                                p += 6;
  10025. +                                                switch (*p) {
  10026. +                                                        case '?':
  10027. +                                                                p++;
  10028. +                                                                sprintf(ds,"\r\n%d",
  10029. +                                                                        (m->mdmreg[18]&1)?8:0);
  10030. +                                                                isdn_tty_at_cout(ds, info);
  10031. +                                                                break;
  10032. +                                                        case '=':
  10033. +                                                                p++;
  10034. +                                                                switch (*p) {
  10035. +                                                                        case '0':
  10036. +                                                                                p++;
  10037. +                                                                                m->mdmreg[18] = 4;
  10038. +                                                                                break;
  10039. +                                                                        case '8':
  10040. +                                                                                p++;
  10041. +                                                                                m->mdmreg[18] = 5;
  10042. +                                                                                m->mdmreg[16] = VBUFX;
  10043. +                                                                                info->xmit_size = VBUF;
  10044. +                                                                                break;
  10045. +                                                                        case '?':
  10046. +                                                                                p++;
  10047. +                                                                                isdn_tty_at_cout("\r\n0,8",
  10048. +                                                                                                 info);
  10049. +                                                                                break;
  10050. +                                                                        default:
  10051. +                                                                                PARSE_ERROR;
  10052. +                                                                }
  10053. +                                                                break;
  10054. +                                                        default:
  10055. +                                                                PARSE_ERROR;
  10056. +                                                                
  10057. +                                                }
  10058. +                                                break;
  10059. +                                        case 'V':
  10060. +                                                if (!(m->mdmreg[18] & 1))
  10061. +                                                        PARSE_ERROR;
  10062. +                                                p++;
  10063. +                                                if (isdn_tty_cmd_PLUSV(&p, info))
  10064. +                                                        return;
  10065. +                                                break;
  10066. +                                }
  10067. +                                break;
  10068. +#endif        /* CONFIG_ISDN_AUDIO */
  10069. +                        case '&':
  10070. +                                p++;
  10071. +                                if (isdn_tty_cmd_ATand(&p, info))
  10072. +                                        return;
  10073. +                                break;
  10074. +                        default:
  10075. +                                isdn_tty_modem_result(4, info);
  10076. +                                return;
  10077. +                }
  10078. +        }
  10079. +        isdn_tty_modem_result(0, info);
  10080.  }
  10081.  
  10082.  /* Need own toupper() because standard-toupper is not available
  10083. @@ -1877,7 +2460,7 @@
  10084.   */
  10085.  static int isdn_tty_edit_at(const char *p, int count, modem_info * info, int user)
  10086.  {
  10087. -    atemu *m = &dev->mdm.atmodem[info->line];
  10088. +    atemu *m = &info->emu;
  10089.      int total = 0;
  10090.      u_char c;
  10091.      char eb[2];
  10092. @@ -1921,16 +2504,16 @@
  10093.              if (m->mdmcmdl < 255) {
  10094.                  c = my_toupper(c);
  10095.                  switch (m->mdmcmdl) {
  10096. -                case 0:
  10097. -                    if (c == 'A')
  10098. -                        m->mdmcmd[m->mdmcmdl++] = c;
  10099. -                    break;
  10100. -                case 1:
  10101. -                    if (c == 'T')
  10102. -                        m->mdmcmd[m->mdmcmdl++] = c;
  10103. -                    break;
  10104. -                default:
  10105. -                    m->mdmcmd[m->mdmcmdl++] = c;
  10106. +                                        case 0:
  10107. +                                                if (c == 'A')
  10108. +                                                        m->mdmcmd[m->mdmcmdl++] = c;
  10109. +                                                break;
  10110. +                                        case 1:
  10111. +                                                if (c == 'T')
  10112. +                                                        m->mdmcmd[m->mdmcmdl++] = c;
  10113. +                                                break;
  10114. +                                        default:
  10115. +                                                m->mdmcmd[m->mdmcmdl++] = c;
  10116.                  }
  10117.              }
  10118.          }
  10119. @@ -1952,16 +2535,18 @@
  10120.  
  10121.      for (i = 0; i < ISDN_MAX_CHANNELS; i++)
  10122.          if (USG_MODEM(dev->usage[i]))
  10123. -            if ((midx = dev->m_idx[i]) >= 0)
  10124. -                if (dev->mdm.online[midx]) {
  10125. +            if ((midx = dev->m_idx[i]) >= 0) {
  10126. +                                modem_info *info = &dev->mdm.info[midx];
  10127. +                if (info->online) {
  10128.                      ton = 1;
  10129. -                    if ((dev->mdm.atmodem[midx].pluscount == 3) &&
  10130. -                        ((jiffies - dev->mdm.atmodem[midx].lastplus) > PLUSWAIT2)) {
  10131. -                        dev->mdm.atmodem[midx].pluscount = 0;
  10132. -                        dev->mdm.online[midx] = 0;
  10133. -                        isdn_tty_modem_result(0, &dev->mdm.info[midx]);
  10134. +                    if ((info->emu.pluscount == 3) &&
  10135. +                        ((jiffies - info->emu.lastplus) > PLUSWAIT2)) {
  10136. +                        info->emu.pluscount = 0;
  10137. +                        info->online = 0;
  10138. +                        isdn_tty_modem_result(0, info);
  10139.                      }
  10140.                  }
  10141. +                        }
  10142.      isdn_timer_ctrl(ISDN_TIMER_MODEMPLUS, ton);
  10143.  }
  10144.  
  10145. @@ -1977,76 +2562,46 @@
  10146.      int midx;
  10147.  
  10148.      for (i = 0; i < ISDN_MAX_CHANNELS; i++)
  10149. -        if (USG_MODEM(dev->usage[i]))
  10150. -            if ((midx = dev->m_idx[i]) >= 0)
  10151. -                if (dev->mdm.msr[midx] & UART_MSR_RI) {
  10152. +        if (USG_MODEMORVOICE(dev->usage[i]))
  10153. +            if ((midx = dev->m_idx[i]) >= 0) {
  10154. +                                modem_info *info = &dev->mdm.info[midx];
  10155. +                if (info->msr & UART_MSR_RI) {
  10156.                      ton = 1;
  10157. -                    isdn_tty_modem_result(2, &dev->mdm.info[midx]);
  10158. +                    isdn_tty_modem_result(2, info);
  10159.                  }
  10160. +                        }
  10161.      isdn_timer_ctrl(ISDN_TIMER_MODEMRING, ton);
  10162.  }
  10163.  
  10164. +/*
  10165. + * For all online tty's, try sending data to
  10166. + * the lower levels.
  10167. + */
  10168.  void isdn_tty_modem_xmit(void)
  10169.  {
  10170.      int ton = 0;
  10171.      int i;
  10172.      int midx;
  10173. -    char *bufptr;
  10174. -    int buflen;
  10175.  
  10176.      for (i = 0; i < ISDN_MAX_CHANNELS; i++)
  10177. -        if (USG_MODEM(dev->usage[i]))
  10178. -            if ((midx = dev->m_idx[i]) >= 0)
  10179. -                if (dev->mdm.online[midx]) {
  10180. -                    modem_info *info = &(dev->mdm.info[midx]);
  10181. -                    ulong flags;
  10182. -
  10183. -                    save_flags(flags);
  10184. -                    cli();
  10185. -                    if (info->xmit_count > 0) {
  10186. -                        struct tty_struct *tty = info->tty;
  10187. +        if (USG_MODEMORVOICE(dev->usage[i]))
  10188. +            if ((midx = dev->m_idx[i]) >= 0) {
  10189. +                                modem_info *info = &dev->mdm.info[midx];
  10190. +                if ((info->online > 1) ||
  10191. +                                    (info->vonline ==2 )) {
  10192. +                    if (skb_queue_len(info->xmit_buf)) {
  10193.                          ton = 1;
  10194. -#if 0
  10195. -                        printk(KERN_DEBUG "WB2: %d\n", info->xmit_count);
  10196. -#endif
  10197. -                        bufptr = info->xmit_buf;
  10198. -                        buflen = info->xmit_count;
  10199. -                        if (dev->mdm.atmodem[midx].mdmreg[13] & 2) {
  10200. -                            /* Add T.70 simplified header */
  10201. -#ifdef ISDN_DEBUG_MODEM_DUMP
  10202. -                            isdn_dumppkt("T70pack3:", bufptr, buflen, 40);
  10203. -#endif
  10204. -                            bufptr -= 4;
  10205. -                            buflen += 4;
  10206. -                            memcpy(bufptr, "\1\0\1\0", 4);
  10207. -#ifdef ISDN_DEBUG_MODEM_DUMP
  10208. -                            isdn_dumppkt("T70pack4:", bufptr, buflen, 40);
  10209. -#endif
  10210. -                        }
  10211. -                        if (isdn_writebuf_stub(info->isdn_driver, info->isdn_channel,
  10212. -                                                                       bufptr, buflen, 0) > 0) {
  10213. -                            info->xmit_count = 0;
  10214. -                            info->xmit_size = dev->mdm.atmodem[midx].mdmreg[16] * 16;
  10215. -#if FUTURE
  10216. -                            info->send_outstanding++;
  10217. -                            dev->mdm.msr[midx] &= ~UART_MSR_CTS;
  10218. -#endif
  10219. -                            if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
  10220. -                                tty->ldisc.write_wakeup)
  10221. -                                (tty->ldisc.write_wakeup) (tty);
  10222. -                            wake_up_interruptible(&tty->write_wait);
  10223. -                        }
  10224. +                                                isdn_tty_senddown(info);
  10225.                      }
  10226. -                    restore_flags(flags);
  10227.                  }
  10228. +                        }
  10229.      isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, ton);
  10230.  }
  10231.  
  10232. -#if FUTURE
  10233.  /*
  10234.   * A packet has been output successfully.
  10235.   * Search the tty-devices for an appropriate device, decrement its
  10236. - * counter for outstanding packets, and set CTS if this counter reaches 0.
  10237. + * counter for outstanding packets, and set CTS.
  10238.   */
  10239.  void isdn_tty_bsent(int drv, int chan)
  10240.  {
  10241. @@ -2058,15 +2613,13 @@
  10242.      for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
  10243.          modem_info *info = &dev->mdm.info[i];
  10244.          if ((info->isdn_driver == drv) &&
  10245. -            (info->isdn_channel == chan) &&
  10246. -            (info->send_outstanding)) {
  10247. -            if (!(--info->send_outstanding))
  10248. -                dev->mdm.msr[i] |= UART_MSR_CTS;
  10249. -            restore_flags(flags);
  10250. -            return;
  10251. -        }
  10252. +            (info->isdn_channel == chan) ) {
  10253. +                        info->msr |= UART_MSR_CTS;
  10254. +                        if (info->send_outstanding)
  10255. +                                if (!(--info->send_outstanding))
  10256. +                                        info->lsr &= ~UART_LSR_TEMT;
  10257. +                }
  10258.      }
  10259.      restore_flags(flags);
  10260.      return;
  10261.  }
  10262. -#endif                /* FUTURE */
  10263. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/isdn_tty.h linux/drivers/isdn/isdn_tty.h
  10264. --- pre2.0.5/linux/drivers/isdn/isdn_tty.h    Mon Feb 26 11:58:05 1996
  10265. +++ linux/drivers/isdn/isdn_tty.h    Sun May 19 15:29:29 1996
  10266. @@ -1,4 +1,4 @@
  10267. -/* $Id: isdn_tty.h,v 1.1 1996/01/10 21:39:22 fritz Exp fritz $
  10268. +/* $Id: isdn_tty.h,v 1.5 1996/05/17 03:52:31 fritz Exp $
  10269.   *
  10270.   * header for Linux ISDN subsystem, tty related functions (linklevel).
  10271.   *
  10272. @@ -20,6 +20,18 @@
  10273.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  10274.   *
  10275.   * $Log: isdn_tty.h,v $
  10276. + * Revision 1.5  1996/05/17 03:52:31  fritz
  10277. + * Changed DLE handling for audio receive.
  10278. + *
  10279. + * Revision 1.4  1996/05/11 21:52:34  fritz
  10280. + * Changed queue management to use sk_buffs.
  10281. + *
  10282. + * Revision 1.3  1996/05/07 09:16:34  fritz
  10283. + * Changed isdn_try_read parameter.
  10284. + *
  10285. + * Revision 1.2  1996/04/30 21:05:27  fritz
  10286. + * Test commit
  10287. + *
  10288.   * Revision 1.1  1996/01/10 21:39:22  fritz
  10289.   * Initial revision
  10290.   *
  10291. @@ -32,8 +44,8 @@
  10292.  extern void  isdn_tty_modem_hup(modem_info *);
  10293.  extern int   isdn_tty_modem_init(void);
  10294.  extern void  isdn_tty_readmodem(void);
  10295. -extern int   isdn_tty_try_read(int, u_char *, int);
  10296. +extern int   isdn_tty_try_read(modem_info *, struct sk_buff *);
  10297.  extern int   isdn_tty_find_icall(int, int, char *);
  10298. -#if FUTURE
  10299. +extern int   isdn_tty_countDLE(unsigned char *, int);
  10300.  extern void  isdn_tty_bsent(int, int);
  10301. -#endif
  10302. +extern void  isdn_tty_cleanup_xmit(modem_info *);
  10303. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/pcbit/drv.c linux/drivers/isdn/pcbit/drv.c
  10304. --- pre2.0.5/linux/drivers/isdn/pcbit/drv.c    Wed Apr 24 17:00:39 1996
  10305. +++ linux/drivers/isdn/pcbit/drv.c    Sun May 19 15:29:30 1996
  10306. @@ -52,9 +52,9 @@
  10307.   */
  10308.  
  10309.  int pcbit_command(isdn_ctrl* ctl);
  10310. -int pcbit_stat(u_char* buf, int len, int user);
  10311. +int pcbit_stat(u_char* buf, int len, int user, int, int);
  10312.  int pcbit_xmit(int driver, int chan, struct sk_buff *skb);
  10313. -int pcbit_writecmd(const u_char*, int, int);
  10314. +int pcbit_writecmd(const u_char*, int, int, int, int);
  10315.  
  10316.  static int set_protocol_running(struct pcbit_dev * dev);
  10317.  
  10318. @@ -390,19 +390,16 @@
  10319.  }
  10320.  
  10321.  
  10322. -int pcbit_writecmd(const u_char* buf, int len, int user)
  10323. +int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel)
  10324.  {
  10325.      struct pcbit_dev * dev;
  10326. -    int board, i, j;
  10327. +    int i, j;
  10328.      const u_char * loadbuf;
  10329.      u_char * ptr = NULL;
  10330.  
  10331.      int errstat;
  10332.  
  10333. -    /* we should have the driver id as input here too - let's say it's 0 */
  10334. -    board = 0;
  10335. -
  10336. -    dev = dev_pcbit[board];
  10337. +    dev = finddev(driver);
  10338.  
  10339.      if (!dev)
  10340.      {
  10341. @@ -760,7 +757,7 @@
  10342.  (flag ? memcpy_tofs(d, s, len) : memcpy(d, s, len))
  10343.  
  10344.  
  10345. -int pcbit_stat(u_char* buf, int len, int user)
  10346. +int pcbit_stat(u_char* buf, int len, int user, int driver, int channel)
  10347.  {
  10348.      int stat_count;
  10349.      stat_count = stat_end - stat_st;
  10350. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/buffers.c linux/drivers/isdn/teles/buffers.c
  10351. --- pre2.0.5/linux/drivers/isdn/teles/buffers.c    Sun Apr 21 19:22:07 1996
  10352. +++ linux/drivers/isdn/teles/buffers.c    Sun May 19 15:29:30 1996
  10353. @@ -1,6 +1,9 @@
  10354. -/* $Id: buffers.c,v 1.1 1996/04/13 10:19:28 fritz Exp $
  10355. +/* $Id: buffers.c,v 1.2 1996/04/29 22:48:14 fritz Exp $
  10356.   *
  10357.   * $Log: buffers.c,v $
  10358. + * Revision 1.2  1996/04/29 22:48:14  fritz
  10359. + * Removed compatibility-macros. No longer needed.
  10360. + *
  10361.   * Revision 1.1  1996/04/13 10:19:28  fritz
  10362.   * Initial revision
  10363.   *
  10364. @@ -47,7 +50,7 @@
  10365.      printk(KERN_DEBUG "BufPoolAdd bp %x\n", bp);
  10366.  #endif
  10367.  
  10368. -    ptr = (struct Pages *) __get_free_pages(priority,bp->pageorder,0);
  10369. +    ptr = (struct Pages *) __get_free_pages(priority, bp->pageorder, 0);
  10370.      if (!ptr) {
  10371.          printk(KERN_WARNING "BufPoolAdd couldn't get pages!\n");
  10372.          return (-1);
  10373. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/callc.c linux/drivers/isdn/teles/callc.c
  10374. --- pre2.0.5/linux/drivers/isdn/teles/callc.c    Sun Apr 21 19:22:07 1996
  10375. +++ linux/drivers/isdn/teles/callc.c    Sun May 19 15:29:30 1996
  10376. @@ -1,6 +1,24 @@
  10377. -/* $Id: callc.c,v 1.2 1996/04/20 16:42:29 fritz Exp fritz $
  10378. +/* $Id: callc.c,v 1.7 1996/05/17 03:40:37 fritz Exp $
  10379.   *
  10380.   * $Log: callc.c,v $
  10381. + * Revision 1.7  1996/05/17 03:40:37  fritz
  10382. + * General cleanup.
  10383. + *
  10384. + * Revision 1.6  1996/05/10 22:42:07  fritz
  10385. + * Added entry for EV_RELEASE_CNF in ST_OUT (if no D-Channel avail.)
  10386. + *
  10387. + * Revision 1.5  1996/05/06 10:16:15  fritz
  10388. + * Added voice stuff.
  10389. + *
  10390. + * Revision 1.4  1996/04/30 22:04:05  isdn4dev
  10391. + *   improved callback  Karsten Keil
  10392. + *
  10393. + * Revision 1.3  1996/04/30 10:04:19  fritz
  10394. + * Started voice support.
  10395. + * Added printk() to debug-switcher for easier
  10396. + * synchronization between printk()'s and output
  10397. + * of /dev/isdnctrl.
  10398. + *
  10399.   * Revision 1.2  1996/04/20 16:42:29  fritz
  10400.   * Changed statemachine to allow reject of incoming calls.
  10401.   *
  10402. @@ -43,17 +61,6 @@
  10403.      teles_putstatus(tmp);
  10404.  }
  10405.  
  10406. -#ifdef DEFINED_BUT_NOT_USED
  10407. -static void
  10408. -stat_error(struct Channel *chanp, char *s)
  10409. -{
  10410. -        char            tmp[100];
  10411. -
  10412. -        sprintf(tmp, "Channel %d: %s\n", chanp->chan, s);
  10413. -        teles_putstatus(tmp);
  10414. -}
  10415. -#endif
  10416. -
  10417.  enum {
  10418.          ST_NULL,           /*  0 inactive                                               */
  10419.          ST_OUT,            /*  1 outgoing, awaiting SETUP confirm                       */
  10420. @@ -237,6 +244,7 @@
  10421.                    chanp->lc_b.l2_establish = !0;
  10422.                    break;
  10423.            case (ISDN_PROTO_L2_HDLC):
  10424. +          case (ISDN_PROTO_L2_TRANS):
  10425.                    chanp->lc_b.l2_establish = 0;
  10426.                    break;
  10427.            default:
  10428. @@ -419,6 +427,7 @@
  10429.                    chanp->lc_b.l2_establish = !0;
  10430.                    break;
  10431.            case (ISDN_PROTO_L2_HDLC):
  10432. +          case (ISDN_PROTO_L2_TRANS):
  10433.                    chanp->lc_b.l2_establish = 0;
  10434.                    break;
  10435.            default:
  10436. @@ -467,16 +476,6 @@
  10437.          iif.statcallb(&ic);
  10438.  }
  10439.  
  10440. -#ifdef DEFINED_BUT_NOT_USED
  10441. -static void
  10442. -prp(byte * p, int size)
  10443. -{
  10444. -        while (size--)
  10445. -                printk("%2x ", *p++);
  10446. -        printk("\n");
  10447. -}
  10448. -#endif
  10449. -
  10450.  static void
  10451.  r15(struct FsmInst *fi, int event, void *arg)
  10452.  {
  10453. @@ -664,6 +663,7 @@
  10454.          {ST_OUT,              EV_SETUP_CNF,           r10},
  10455.          {ST_OUT,              EV_HANGUP,              r2_1},
  10456.          {ST_OUT,              EV_RELEASE_IND,         r20},
  10457. +        {ST_OUT,              EV_RELEASE_CNF,         r20},
  10458.          {ST_OUT,              EV_DLRL,                r2_2},
  10459.          {ST_OUT_W_HANGUP,     EV_RELEASE_IND,         r2_2},
  10460.          {ST_OUT_W_HANGUP,     EV_DLRL,                r20},
  10461. @@ -674,7 +674,7 @@
  10462.          {ST_IN_W,             EV_DLEST,               r7},
  10463.          {ST_IN_W,             EV_DLRL,                r3_1},
  10464.          {ST_IN,               EV_DLRL,                r3_1},
  10465. -        {ST_IN,               EV_HANGUP,              r3_1},
  10466. +        {ST_IN,               EV_HANGUP,              r2_1},
  10467.          {ST_IN,               EV_RELEASE_IND,         r2_2},
  10468.          {ST_IN,               EV_RELEASE_CNF,         r2_2},
  10469.          {ST_IN,               EV_ACCEPTD,             r8},
  10470. @@ -830,6 +830,7 @@
  10471.                    releasestack_isdnl2(st);
  10472.                    break;
  10473.            case (ISDN_PROTO_L2_HDLC):
  10474. +          case (ISDN_PROTO_L2_TRANS):
  10475.                    releasestack_transl2(st);
  10476.                    break;
  10477.          }
  10478. @@ -1121,22 +1122,13 @@
  10479.          BufQueueRelease(&st->l2.i_queue);
  10480.  }
  10481.  
  10482. -static void
  10483. -release_chan(int chan)
  10484. -{
  10485. -#if 0
  10486. -        release_ds(chan);
  10487. -#endif
  10488. -        release_is(chan);
  10489. -}
  10490. -
  10491.  void
  10492.  CallcFreeChan(void)
  10493.  {
  10494.          int             i;
  10495.  
  10496.          for (i = 0; i < chancount; i++)
  10497. -                release_chan(i);
  10498. +                release_is(i);
  10499.          Sfree((void *) chanlist);
  10500.  }
  10501.  
  10502. @@ -1248,6 +1240,14 @@
  10503.                    st->l1.hscxmode = 2;
  10504.                    st->l1.hscxchannel = chanlist[chan].para.bchannel - 1;
  10505.                    break;
  10506. +          case (ISDN_PROTO_L2_TRANS):
  10507. +                  st->l1.l1l2 = lltrans_handler;
  10508. +                  st->l1.l1man = dcc_l1man;
  10509. +                  st->l4.userdata = chanlist + chan;
  10510. +                  st->l4.l1writewakeup = ll_writewakeup;
  10511. +                  st->l1.hscxmode = 1;
  10512. +                  st->l1.hscxchannel = chanlist[chan].para.bchannel - 1;
  10513. +                  break;
  10514.          }
  10515.  
  10516.          return (0);
  10517. @@ -1345,6 +1345,7 @@
  10518.                              distr_debug();
  10519.                              sprintf(tmp, "debugging flags set to %x\n", debugflags);
  10520.                              teles_putstatus(tmp);
  10521. +                printk(KERN_DEBUG "%s", tmp);
  10522.                              break;
  10523.                      case (2):
  10524.                              num = *(unsigned int *) ic->num;
  10525. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/card.c linux/drivers/isdn/teles/card.c
  10526. --- pre2.0.5/linux/drivers/isdn/teles/card.c    Mon Apr 29 18:05:17 1996
  10527. +++ linux/drivers/isdn/teles/card.c    Sun May 19 15:29:30 1996
  10528. @@ -1,4 +1,4 @@
  10529. -/* $Id: card.c,v 1.1 1996/04/13 10:22:42 fritz Exp $
  10530. +/* $Id: card.c,v 1.5 1996/05/17 03:45:02 fritz Exp $
  10531.   *
  10532.   * card.c     low level stuff for the Teles S0 isdn card
  10533.   * 
  10534. @@ -7,6 +7,28 @@
  10535.   * Beat Doebeli         log all D channel traffic
  10536.   * 
  10537.   * $Log: card.c,v $
  10538. + * Revision 1.5  1996/05/17 03:45:02  fritz
  10539. + * Made error messages more clearly.
  10540. + * Bugfix: Only 31 bytes of 32-byte audio frames
  10541. + *         have been transfered to upper layers.
  10542. + *
  10543. + * Revision 1.4  1996/05/06 10:17:57  fritz
  10544. + * Added voice-send stuff
  10545. + *  (Not reporting EXIR when in voice-mode, since it's normal).
  10546. + *
  10547. + * Revision 1.3  1996/04/30 22:02:40  isdn4dev
  10548. + * Bugfixes for 16.3
  10549. + *     -improved IO allocation
  10550. + *     -fix second B channel problem
  10551. + *     -correct ph_command patch
  10552. + *
  10553. + * Revision 1.2  1996/04/30 10:00:59  fritz
  10554. + * Bugfix: Added ph_command(8) for 16.3.
  10555. + * Bugfix: Ports did not get registered correctly
  10556. + *         when using a 16.3.
  10557. + *         Started voice support.
  10558. + *         Some experimental changes of waitforXFW().
  10559. + *
  10560.   * Revision 1.1  1996/04/13 10:22:42  fritz
  10561.   * Initial revision
  10562.   *
  10563. @@ -21,6 +43,7 @@
  10564.  #include <linux/interrupt.h>
  10565.  
  10566.  #undef DCHAN_VERBOSE
  10567. +#define FRITZ_EXPERIMENTAL
  10568.  
  10569.  extern void     tei_handler(struct PStack *st, byte pr,
  10570.                  struct BufHeader *ibh);
  10571. @@ -183,11 +206,16 @@
  10572.  static inline void
  10573.  waitforXFW_0(byte * base, byte hscx)
  10574.  {
  10575. +#ifdef FRITZ_EXPERIMENTAL
  10576. +    long            to = 20;
  10577. +
  10578. +    while ((!(readhscx_0(base, hscx, HSCX_STAR) & 0x44)==0x40) && to) {
  10579. +#else
  10580.      long            to = 10;
  10581.  
  10582.      waitforCEC_0(base, hscx);
  10583. -
  10584.      while ((!(readhscx_0(base, hscx, HSCX_STAR) & 0x40)) && to) {
  10585. +#endif
  10586.          udelay(5);
  10587.          to--;
  10588.      }
  10589. @@ -198,11 +226,16 @@
  10590.  static inline void
  10591.  waitforXFW_3(int iobase, byte hscx)
  10592.  {
  10593. +#ifdef FRITZ_EXPERIMENTAL
  10594. +    long            to = 20;
  10595. +
  10596. +    while ((!(readhscx_3(iobase, hscx, HSCX_STAR) & 0x44)==0x40) && to) {
  10597. +#else
  10598.      long            to = 10;
  10599.  
  10600.      waitforCEC_3(iobase, hscx);
  10601. -
  10602.      while ((!(readhscx_3(iobase, hscx, HSCX_STAR) & 0x40)) && to) {
  10603. +#endif
  10604.          udelay(5);
  10605.          to--;
  10606.      }
  10607. @@ -332,15 +365,6 @@
  10608.                  readhscx_s(hsp->iobase, hsp->hscx, 0x3e, ptr, count);
  10609.                  writehscxCMDR_3(hsp->iobase, hsp->hscx, 0x80);
  10610.          }
  10611. -#ifdef BCHAN_VERBOSE
  10612. -        {
  10613. -                int i;
  10614. -                printk(KERN_DEBUG "hscx_empty_fifo");
  10615. -                for (i = 0; i < count; i++)
  10616. -                        printk(" %2x", ptr[i]);
  10617. -                printk("\n");
  10618. -        }
  10619. -#endif                /* BCHAN_VERBOSE */
  10620.  }
  10621.  
  10622.  static void
  10623. @@ -361,15 +385,7 @@
  10624.      if (count <= 0)
  10625.          return;
  10626.  
  10627. -#if 0
  10628. -    if (!hsp->sendptr) {
  10629. -        ptr = DATAPTR(ibh);
  10630. -        printk(KERN_DEBUG "snd bytes %2x %2x %2x %2x %2x\n", ptr[0], ptr[1], ptr[2],
  10631. -               ptr[3], ptr[4]);
  10632. -    }
  10633. -#endif
  10634. -
  10635. -    more = 0;
  10636. +    more = (hsp->mode == 1)?1:0;
  10637.      if (count > 32) {
  10638.          more = !0;
  10639.          count = 32;
  10640. @@ -417,7 +433,7 @@
  10641.                  printk(KERN_WARNING
  10642.                                         "Teles: HSCX invalid frame\n");
  10643.              if (r & 0x40)
  10644. -                printk(KERN_WARNING "Teles: HSCX RDO\n");
  10645. +                printk(KERN_WARNING "Teles: HSCX RDO mode=%d\n",hsp->mode);
  10646.              if (!r & 0x20)
  10647.                  printk(KERN_WARNING "Teles: HSCX CRC error\n");
  10648.              if (hsp->rcvibh)
  10649. @@ -455,7 +471,7 @@
  10650.              if (BufPoolGet(&hsp->rcvibh, &hsp->rbufpool,
  10651.                         GFP_ATOMIC, (void *) 1, 2)) {
  10652.                  printk(KERN_WARNING
  10653. -                                       "HSCX RME out of buffers at %ld\n",
  10654. +                                       "HSCX RPF out of buffers at %ld\n",
  10655.                                         jiffies);
  10656.                  WRITEHSCX_CMDR(hsp->membase, hsp->iobase,
  10657.                                                 hsp->hscx, 0x80);
  10658. @@ -464,12 +480,14 @@
  10659.                  hsp->rcvptr = 0;
  10660.  
  10661.          hscx_empty_fifo(hsp, 32);
  10662. -#ifdef VOICE
  10663. -        hsp->rcvibh->datasize = hsp->rcvptr - 1;
  10664. -        BufQueueLink(&hsp->rq, hsp->rcvibh);
  10665. -        hsp->rcvibh = NULL;
  10666. -        hscx_sched_event(hsp, HSCX_RCVBUFREADY);
  10667. -#endif
  10668. +                if (hsp->mode == 1) {
  10669. +                        /* receive audio data */
  10670. +                        hsp->rcvibh->datasize = hsp->rcvptr;
  10671. +                        BufQueueLink(&hsp->rq, hsp->rcvibh);
  10672. +                        hsp->rcvibh = NULL;
  10673. +                        hscx_sched_event(hsp, HSCX_RCVBUFREADY);
  10674. +                }
  10675. +                
  10676.      }
  10677.        afterRPF:
  10678.      if (val & 0x10) {    /* XPR */
  10679. @@ -651,8 +669,17 @@
  10680.                ph_command(sp, 9);
  10681.            break;
  10682.        case (12):
  10683. +              ph_command(sp, 8);
  10684. +          sp->ph_active = 5;
  10685. +          isac_sched_event(sp, ISAC_PHCHANGE);
  10686. +          if (!sp->xmtibh)
  10687. +              if (!BufQueueUnlink(&sp->xmtibh, &sp->sq))
  10688. +                  sp->sendptr = 0;
  10689. +          if (sp->xmtibh)
  10690. +              fill_fifo(sp);
  10691. +          break;
  10692.        case (13):
  10693. -            ph_command(sp, 8);
  10694. +              ph_command(sp, 9);
  10695.            sp->ph_active = 5;
  10696.            isac_sched_event(sp, ISAC_PHCHANGE);
  10697.            if (!sp->xmtibh)
  10698. @@ -673,7 +700,7 @@
  10699.  static void
  10700.  teles_interrupt(int intno, void *dev_id, struct pt_regs *regs)
  10701.  {
  10702. -    byte                 val, val2, r;
  10703. +    byte                 val, val2, r, exval;
  10704.      struct IsdnCardState *sp;
  10705.      unsigned int         count;
  10706.      struct HscxState     *hsp;
  10707. @@ -688,10 +715,12 @@
  10708.  
  10709.      if (val & 0x01) {
  10710.          hsp = sp->hs + 1;
  10711. -        printk(KERN_WARNING "HSCX B EXIR %x xmitbh %lx rcvibh %lx\n",
  10712. -                       READHSCX(sp->membase, sp->iobase, 1, HSCX_EXIR),
  10713. -                       (long) hsp->xmtibh,
  10714. -               (long) hsp->rcvibh);
  10715. +                exval = READHSCX(sp->membase, sp->iobase, 1, HSCX_EXIR);
  10716. +                if ((hsp->mode == 1) || (exval == 0x40))
  10717. +                        hscx_fill_fifo(hsp);
  10718. +                else
  10719. +                        printk(KERN_WARNING "HSCX B EXIR %x xmitbh %lx rcvibh %lx\n",
  10720. +                               exval, (long) hsp->xmtibh, (long) hsp->rcvibh);
  10721.      }
  10722.      if (val & 0xf8) {
  10723.          if (sp->debug)
  10724. @@ -699,8 +728,12 @@
  10725.          hscx_interrupt(sp, val, 1);
  10726.      }
  10727.      if (val & 0x02) {
  10728. -        printk(KERN_WARNING "HSCX A EXIR %x\n",
  10729. -                       READHSCX(sp->membase, sp->iobase, 0, HSCX_EXIR));
  10730. +        hsp = sp->hs;
  10731. +                exval = READHSCX(sp->membase, sp->iobase, 0, HSCX_EXIR);
  10732. +                if ((hsp->mode == 1) && (exval == 0x40))
  10733. +                        hscx_fill_fifo(hsp);
  10734. +                else
  10735. +                        printk(KERN_WARNING "HSCX A EXIR %x\n",exval);
  10736.      }
  10737.  
  10738.  /* ??? Why do that vvvvvvvvvvvvvvvvvvvvv different on Teles 16-3 ??? */
  10739. @@ -1057,17 +1090,46 @@
  10740.                          case 0x180:
  10741.                          case 0x280:
  10742.                          case 0x380:
  10743. -                                printk(KERN_INFO "teles: port 0x%x specified, assuming 0x%x\n",
  10744. -                                       card->iobase, (card->iobase | 0xc00));
  10745.                                  card->iobase |= 0xc00;
  10746.                                  break;
  10747.                  }
  10748. -                if (check_region(card->iobase, 8)) {
  10749. -                        printk(KERN_WARNING
  10750. -                               "teles: ports %x-%x already in use\n",
  10751. -                               card->iobase,
  10752. -                               card->iobase + 8 );
  10753. -                        return -1;
  10754. +                if (card->membase) {  /* 16.0 */
  10755. +                    if (check_region(card->iobase, 8)) {
  10756. +                            printk(KERN_WARNING
  10757. +                                       "teles: ports %x-%x already in use\n",
  10758. +                                       card->iobase,
  10759. +                                       card->iobase + 8 );
  10760. +                            return -1;
  10761. +                    }
  10762. +                } else { /* 16.3 */
  10763. +                    if (check_region(card->iobase, 16)) {
  10764. +                            printk(KERN_WARNING
  10765. +                                       "teles: 16.3 ports %x-%x already in use\n",
  10766. +                                       card->iobase,
  10767. +                                       card->iobase + 16 );
  10768. +                            return -1;
  10769. +                    }
  10770. +                    if (check_region((card->iobase - 0xc00) , 32)) {
  10771. +                            printk(KERN_WARNING
  10772. +                              "teles: 16.3 ports %x-%x already in use\n",
  10773. +                                       card->iobase - 0xc00,
  10774. +                                       card->iobase - 0xc00 + 32);
  10775. +                            return -1;
  10776. +                        }
  10777. +                    if (check_region((card->iobase - 0x800) , 32)) {
  10778. +                            printk(KERN_WARNING
  10779. +                              "teles: 16.3 ports %x-%x already in use\n",
  10780. +                                       card->iobase - 0x800,
  10781. +                                       card->iobase - 0x800 + 32);
  10782. +                            return -1;
  10783. +                        }
  10784. +                    if (check_region((card->iobase - 0x400) , 32)) {
  10785. +                            printk(KERN_WARNING
  10786. +                              "teles: 16.3 ports %x-%x already in use\n",
  10787. +                                       card->iobase - 0x400,
  10788. +                                       card->iobase - 0x400 + 32);
  10789. +                            return -1;
  10790. +                        }
  10791.                  }
  10792.                  switch (card->interrupt) {
  10793.                  case 2:
  10794. @@ -1100,30 +1162,37 @@
  10795.                  }
  10796.                  if (card->membase) {
  10797.                          cfval |= (((unsigned int) card->membase >> 9) & 0xF0);
  10798. -                        
  10799. -                        if (bytein(card->iobase + 0) != 0x51) {
  10800. -                                printk(KERN_INFO "XXX Byte at %x is %x\n",
  10801. -                                       card->iobase + 0,
  10802. -                                       bytein(card->iobase + 0));
  10803. -                                return -2;
  10804. -                        }
  10805. -                        if (bytein(card->iobase + 1) != 0x93) {
  10806. -                                printk(KERN_INFO "XXX Byte at %x is %x\n",
  10807. -                                       card->iobase + 1,
  10808. -                                       bytein(card->iobase + 1));
  10809. -                                return -2;
  10810. -                        }
  10811. -                        val = bytein(card->iobase + 2);    /* 0x1e=without AB
  10812. -                                                         * 0x1f=with AB
  10813. -                                                         */
  10814. -                        if (val != 0x1e && val != 0x1f) {
  10815. -                                printk(KERN_INFO "XXX Byte at %x is %x\n",
  10816. -                                       card->iobase + 2,
  10817. -                                       bytein(card->iobase + 2));
  10818. -                                return -2;
  10819. -                        }
  10820. +                }   
  10821. +                if (bytein(card->iobase + 0) != 0x51) {
  10822. +                        printk(KERN_INFO "XXX Byte at %x is %x\n",
  10823. +                                card->iobase + 0,
  10824. +                                bytein(card->iobase + 0));
  10825. +                        return -2;
  10826. +                }
  10827. +                if (bytein(card->iobase + 1) != 0x93) {
  10828. +                        printk(KERN_INFO "XXX Byte at %x is %x\n",
  10829. +                                card->iobase + 1,
  10830. +                                bytein(card->iobase + 1));
  10831. +                        return -2;
  10832. +                }
  10833. +                val = bytein(card->iobase + 2);    /* 0x1e=without AB
  10834. +                                                 * 0x1f=with AB
  10835. +                                                 * 0x1c 16.3 ???
  10836. +                                                 */
  10837. +                if (val != 0x1c && val != 0x1e && val != 0x1f) {
  10838. +                        printk(KERN_INFO "XXX Byte at %x is %x\n",
  10839. +                                card->iobase + 2,
  10840. +                                bytein(card->iobase + 2));
  10841. +                        return -2;
  10842. +                }
  10843. +                if (card->membase) {  /* 16.0 */
  10844. +                        request_region(card->iobase, 8, "teles 16.0");
  10845. +                } else {
  10846. +                    request_region(card->iobase, 16, "teles 16.3");
  10847. +                    request_region(card->iobase - 0xC00, 32, "teles HSCX0");
  10848. +                    request_region(card->iobase - 0x800, 32, "teles HSCX1");
  10849. +                    request_region(card->iobase - 0x400, 32, "teles ISAC");
  10850.                  }
  10851. -                request_region(card->iobase, 8, "teles");
  10852.                  cli();
  10853.                  timout = jiffies + (HZ / 10) + 1;
  10854.                  byteout(card->iobase + 4, cfval);
  10855. @@ -1182,10 +1251,11 @@
  10856.      printk(KERN_DEBUG "modehscx hscx %d mode %d ichan %d\n",
  10857.             hscx, mode, ichan);
  10858.  
  10859. -    if (hscx == 0)
  10860. -        ichan = 1 - ichan;    /* raar maar waar... */
  10861. -
  10862. +        hs->mode = mode;
  10863.          if (sp->membase) {
  10864. +                /* What's that ??? KKeil */
  10865. +        if (hscx == 0)
  10866. +            ichan = 1 - ichan;    /* raar maar waar... */
  10867.                  writehscx_0(sp->membase, hscx, HSCX_CCR1, 0x85);
  10868.                  writehscx_0(sp->membase, hscx, HSCX_XAD1, 0xFF);
  10869.                  writehscx_0(sp->membase, hscx, HSCX_XAD2, 0xFF);
  10870. @@ -1547,7 +1617,7 @@
  10871.  static void
  10872.  release_irq(int cardnr)
  10873.  {
  10874. -    struct IsdnCard *card = cards + cardnr;
  10875. +    struct    IsdnCard *card = cards + cardnr;
  10876.  
  10877.      irq2dev_map[card->interrupt] = NULL;
  10878.      free_irq(card->interrupt, NULL);
  10879. @@ -1584,7 +1654,14 @@
  10880.      close_hscxstate(sp->hs);
  10881.  
  10882.      if (cards[cardnr].iobase)
  10883. -        release_region(cards[cardnr].iobase, 8);
  10884. +            if (cards[cardnr].membase) {  /* 16.0 */
  10885. +            release_region(cards[cardnr].iobase, 8);
  10886. +            } else {
  10887. +            release_region(cards[cardnr].iobase, 16);
  10888. +                    release_region(cards[cardnr].iobase - 0xC00, 32);
  10889. +                    release_region(cards[cardnr].iobase - 0x800, 32);
  10890. +                    release_region(cards[cardnr].iobase - 0x400, 32);
  10891. +                }
  10892.  
  10893.      Sfree((void *) sp);
  10894.  }
  10895. @@ -1652,35 +1729,35 @@
  10896.      struct HscxState *hsp = sp->hs + st->l1.hscx;
  10897.  
  10898.      switch (pr) {
  10899. -      case (PH_DATA):
  10900. -          if (hsp->xmtibh)
  10901. -              BufQueueLink(&hsp->sq, ibh);
  10902. -          else {
  10903. -              hsp->xmtibh = ibh;
  10904. -              hsp->sendptr = 0;
  10905. -              hsp->releasebuf = !0;
  10906. -              hscx_fill_fifo(hsp);
  10907. -          }
  10908. -          break;
  10909. -      case (PH_DATA_PULLED):
  10910. -          if (hsp->xmtibh) {
  10911. -              printk(KERN_DEBUG "hscx_l2l1: this shouldn't happen\n");
  10912. -              break;
  10913. -          }
  10914. -          hsp->xmtibh = ibh;
  10915. -          hsp->sendptr = 0;
  10916. -          hsp->releasebuf = 0;
  10917. -          hscx_fill_fifo(hsp);
  10918. -          break;
  10919. -      case (PH_REQUEST_PULL):
  10920. -          if (!hsp->xmtibh) {
  10921. -              st->l1.requestpull = 0;
  10922. -              st->l1.l1l2(st, PH_PULL_ACK, NULL);
  10923. -          } else
  10924. -              st->l1.requestpull = !0;
  10925. -          break;
  10926. +                case (PH_DATA):
  10927. +                        if (hsp->xmtibh)
  10928. +                                BufQueueLink(&hsp->sq, ibh);
  10929. +                        else {
  10930. +                                hsp->xmtibh = ibh;
  10931. +                                hsp->sendptr = 0;
  10932. +                                hsp->releasebuf = !0;
  10933. +                                hscx_fill_fifo(hsp);
  10934. +                        }
  10935. +                        break;
  10936. +                case (PH_DATA_PULLED):
  10937. +                        if (hsp->xmtibh) {
  10938. +                                printk(KERN_DEBUG "hscx_l2l1: this shouldn't happen\n");
  10939. +                                break;
  10940. +                        }
  10941. +                        hsp->xmtibh = ibh;
  10942. +                        hsp->sendptr = 0;
  10943. +                        hsp->releasebuf = 0;
  10944. +                        hscx_fill_fifo(hsp);
  10945. +                        break;
  10946. +                case (PH_REQUEST_PULL):
  10947. +                        if (!hsp->xmtibh) {
  10948. +                                st->l1.requestpull = 0;
  10949. +                                st->l1.l1l2(st, PH_PULL_ACK, NULL);
  10950. +                        } else
  10951. +                                st->l1.requestpull = !0;
  10952. +                        break;
  10953.      }
  10954. -
  10955. +        
  10956.  }
  10957.  
  10958.  extern struct IsdnBuffers *tracebuf;
  10959. @@ -1778,7 +1855,5 @@
  10960.  void
  10961.  teles_reportcard(int cardnr)
  10962.  {
  10963. -
  10964.      printk(KERN_DEBUG "teles_reportcard\n");
  10965. -
  10966.  }
  10967. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/fsm.c linux/drivers/isdn/teles/fsm.c
  10968. --- pre2.0.5/linux/drivers/isdn/teles/fsm.c    Sun Apr 21 19:22:07 1996
  10969. +++ linux/drivers/isdn/teles/fsm.c    Sun May 19 15:29:30 1996
  10970. @@ -1,6 +1,9 @@
  10971. -/* $Id: fsm.c,v 1.1 1996/04/13 10:23:41 fritz Exp $
  10972. +/* $Id: fsm.c,v 1.2 1996/04/29 22:49:57 fritz Exp $
  10973.   *
  10974.   * $Log: fsm.c,v $
  10975. + * Revision 1.2  1996/04/29 22:49:57  fritz
  10976. + * Removed compatibility-macros.
  10977. + *
  10978.   * Revision 1.1  1996/04/13 10:23:41  fritz
  10979.   * Initial revision
  10980.   *
  10981. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/isdnl2.c linux/drivers/isdn/teles/isdnl2.c
  10982. --- pre2.0.5/linux/drivers/isdn/teles/isdnl2.c    Sun Apr 21 19:22:07 1996
  10983. +++ linux/drivers/isdn/teles/isdnl2.c    Sun May 19 15:29:31 1996
  10984. @@ -1,6 +1,9 @@
  10985. -/* $Id: isdnl2.c,v 1.1 1996/04/13 10:24:16 fritz Exp $
  10986. +/* $Id: isdnl2.c,v 1.2 1996/05/17 03:46:15 fritz Exp $
  10987.   *
  10988.   * $Log: isdnl2.c,v $
  10989. + * Revision 1.2  1996/05/17 03:46:15  fritz
  10990. + * General cleanup.
  10991. + *
  10992.   * Revision 1.1  1996/04/13 10:24:16  fritz
  10993.   * Initial revision
  10994.   *
  10995. @@ -16,43 +19,6 @@
  10996.  struct Fsm      l2fsm =
  10997.  {NULL, 0, 0};
  10998.  
  10999. -#if 0
  11000. -
  11001. -
  11002. -enum {
  11003. -    ST_PH_NULL,
  11004. -    ST_PH_ACTIVATED,
  11005. -    ST_PH_ACTIVE,
  11006. -};
  11007. -
  11008. -#define PH_STATE_COUNT (ST_PH_ACTIVE+1)
  11009. -
  11010. -static char    *strPhState[] =
  11011. -{
  11012. -    "ST_PH_NULL",
  11013. -    "ST_PH_ACTIVATED",
  11014. -    "ST_PH_ACTIVE",
  11015. -};
  11016. -
  11017. -enum {
  11018. -    EV_PH_ACTIVATE_REQ,
  11019. -    EV_PH_ACTIVATE,
  11020. -    EV_PH_DEACTIVATE_REQ,
  11021. -    EV_PH_DEACTIVATE,
  11022. -};
  11023. -
  11024. -#define PH_EVENT_COUNT (EV_PH_DEACTIVATE+1)
  11025. -
  11026. -static char    *strPhEvent[] =
  11027. -{
  11028. -    "EV_PH_ACTIVATE_REQ",
  11029. -    "EV_PH_ACTIVATE",
  11030. -    "EV_PH_DEACTIVATE_REQ",
  11031. -    "EV_PH_DEACTIVATE",
  11032. -};
  11033. -
  11034. -#endif
  11035. -
  11036.  enum {
  11037.      ST_L2_1,
  11038.      ST_L2_3,
  11039. @@ -121,54 +87,6 @@
  11040.      "EV_L2_RNR",
  11041.  };
  11042.  
  11043. -#if 0
  11044. -static void
  11045. -ph_r1(struct FsmInst *fi, int event, void *arg)
  11046. -{
  11047. -    struct PStack  *st = fi->userdata;
  11048. -
  11049. -    FsmChangeState(fi, ST_PH_ACTIVATED);
  11050. -    st->l1.service_down(st, PH_ACTIVATE, NULL);
  11051. -}
  11052. -
  11053. -static void
  11054. -ph_r2(struct FsmInst *fi, int event, void *arg)
  11055. -{
  11056. -    struct PStack  *st = fi->userdata;
  11057. -
  11058. -    FsmChangeState(fi, ST_PH_ACTIVE);
  11059. -    st->l3.service_up(st, DL_ACTIVATE_CNF, NULL);
  11060. -}
  11061. -
  11062. -static void
  11063. -ph_r3(struct FsmInst *fi, int event, void *arg)
  11064. -{
  11065. -    struct PStack  *st = fi->userdata;
  11066. -
  11067. -    FsmChangeState(fi, ST_PH_NULL);
  11068. -    st->l1.service_down(st, PH_DEACTIVATE, NULL);
  11069. -}
  11070. -
  11071. -static void
  11072. -ph_r4(struct FsmInst *fi, int event, void *arg)
  11073. -{
  11074. -    struct PStack  *st = fi->userdata;
  11075. -
  11076. -    FsmChangeState(fi, ST_PH_NULL);
  11077. -    st->l3.service_up(st, DL_DEACTIVATE_IND, NULL);
  11078. -}
  11079. -
  11080. -static struct FsmNode PhFnList[] =
  11081. -{
  11082. -    {ST_PH_NULL, EV_PH_ACTIVATE_REQ, ph_r1},
  11083. -    {ST_PH_ACTIVATED, EV_PH_ACTIVATE, ph_r2},
  11084. -    {ST_PH_ACTIVATED, EV_PH_DEACTIVATE, ph_r4},
  11085. -    {ST_PH_ACTIVE, EV_PH_DEACTIVATE_REQ, ph_r3},
  11086. -};
  11087. -
  11088. -#define PH_FN_COUNT (sizeof(PhFnList)/sizeof(struct FsmNode))
  11089. -#endif
  11090. -
  11091.  int             errcount = 0;
  11092.  
  11093.  static int      l2addrsize(struct Layer2 *tsp);
  11094. @@ -191,27 +109,6 @@
  11095.          BufPoolRelease(ibh);
  11096.  }
  11097.  
  11098. -#ifdef DEFINED_BUT_NOT_USED
  11099. -static void
  11100. -discard_window(struct PStack *st)
  11101. -{
  11102. -    struct BufHeader *ibh;
  11103. -    struct Layer2  *l2;
  11104. -    int             i, p1, p2;
  11105. -
  11106. -    l2 = &st->l2;
  11107. -    p1 = l2->vs - l2->va;
  11108. -    if (p1 < 0)
  11109. -        p1 += l2->extended ? 128 : 8;
  11110. -
  11111. -    for (i = 0; i < p1; i++) {
  11112. -        p2 = (i + l2->sow) % l2->window;
  11113. -        ibh = l2->windowar[p2];
  11114. -        BufPoolRelease(ibh);
  11115. -    }
  11116. -}
  11117. -#endif
  11118. -
  11119.  int
  11120.  l2headersize(struct Layer2 *tsp, int UI)
  11121.  {
  11122. @@ -254,12 +151,6 @@
  11123.  enqueue_ui(struct PStack *st,
  11124.         struct BufHeader *ibh)
  11125.  {
  11126. -#ifdef FRITZDEBUG
  11127. -    static char     tmp[100];
  11128. -
  11129. -    sprintf(tmp, "enqueue_ui: %d bytes\n", ibh->datasize);
  11130. -    teles_putstatus(tmp);
  11131. -#endif
  11132.      st->l2.l2l1(st, PH_DATA, ibh);
  11133.  }
  11134.  
  11135. @@ -267,12 +158,6 @@
  11136.  enqueue_super(struct PStack *st,
  11137.            struct BufHeader *ibh)
  11138.  {
  11139. -#ifdef FRITZDEBUG
  11140. -    static char     tmp[100];
  11141. -
  11142. -    sprintf(tmp, "enqueue_super: %d bytes\n", ibh->datasize);
  11143. -    teles_putstatus(tmp);
  11144. -#endif
  11145.      st->l2.l2l1(st, PH_DATA, ibh);
  11146.  }
  11147.  
  11148. @@ -1405,36 +1290,9 @@
  11149.      st->l2.t200_running = 0;
  11150.  }
  11151.  
  11152. -#ifdef DEFINED_BUT_NOT_USED
  11153. -static void
  11154. -trans_acceptph(struct PStack *st, struct BufHeader *ibh)
  11155. -{
  11156. -#if 0
  11157. -    st->l3.service_up(st, DL_DATA, ibh);
  11158. -#endif
  11159. -}
  11160. -
  11161. -
  11162. -static void
  11163. -transdown(struct PStack *st, int pr,
  11164. -      struct BufHeader *ibh)
  11165. -{
  11166. -    if (pr == DL_DATA) {
  11167. -        ibh->primitive = !0;
  11168. -        st->l2.l2l1(st, PH_DATA, ibh);
  11169. -    }
  11170. -}
  11171. -#endif
  11172. -
  11173.  void
  11174.  setstack_transl2(struct PStack *st)
  11175.  {
  11176. -#if 0
  11177. -    st->l2.phdata_up = trans_acceptph;
  11178. -    st->l2.service_down = (void *) transdown;
  11179. -    st->l2.ihsize = 0;
  11180. -    st->l2.debug = 0;
  11181. -#endif
  11182.  }
  11183.  
  11184.  void
  11185. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/isdnl3.c linux/drivers/isdn/teles/isdnl3.c
  11186. --- pre2.0.5/linux/drivers/isdn/teles/isdnl3.c    Wed Apr 24 17:00:40 1996
  11187. +++ linux/drivers/isdn/teles/isdnl3.c    Sun May 19 15:29:31 1996
  11188. @@ -1,6 +1,16 @@
  11189. -/* $Id: isdnl3.c,v 1.2 1996/04/20 16:45:05 fritz Exp $
  11190. +/* $Id: isdnl3.c,v 1.5 1996/05/18 01:37:16 fritz Exp $
  11191.   *
  11192.   * $Log: isdnl3.c,v $
  11193. + * Revision 1.5  1996/05/18 01:37:16  fritz
  11194. + * Added spelling corrections and some minor changes
  11195. + * to stay in sync with kernel.
  11196. + *
  11197. + * Revision 1.4  1996/05/17 03:46:16  fritz
  11198. + * General cleanup.
  11199. + *
  11200. + * Revision 1.3  1996/04/30 21:57:53  isdn4dev
  11201. + * remove some debugging code, improve callback   Karsten Keil
  11202. + *
  11203.   * Revision 1.2  1996/04/20 16:45:05  fritz
  11204.   * Changed to report all incoming calls to Linklevel, not just those
  11205.   * with Service 7.
  11206. @@ -123,17 +133,9 @@
  11207.            *p++ = 0x90;    /* Packet-Mode 64kbps                      */
  11208.            break;
  11209.      }
  11210. -/*
  11211. - * What about info2? Mapping to High-Layer-Compatibility?
  11212. - */
  11213. -
  11214. -#if 0                /* user-user not allowed in The Netherlands! */
  11215. -    *p++ = 0x7f;
  11216. -    *p++ = 0x2;
  11217. -    *p++ = 0x0;
  11218. -    *p++ = 66;
  11219. -#endif
  11220. -
  11221. +    /*
  11222. +     * What about info2? Mapping to High-Layer-Compatibility?
  11223. +     */
  11224.      if (st->pa->calling[0] != '\0') {
  11225.          *p++ = 0x6c;
  11226.          *p++ = strlen(st->pa->calling) + 1;
  11227. @@ -308,15 +310,6 @@
  11228.      newl3state(st, 0);
  11229.  }
  11230.  
  11231. -#ifdef DEFINED_BUT_NOT_USED
  11232. -static void
  11233. -l3s15(struct PStack *st, byte pr, void *arg)
  11234. -{
  11235. -    newl3state(st, 0);
  11236. -    st->l3.l3l4(st, CC_REJECT, NULL);
  11237. -}
  11238. -#endif
  11239. -
  11240.  static void
  11241.  l3s16(struct PStack *st, byte pr,
  11242.        void *arg)
  11243. @@ -475,11 +468,6 @@
  11244.          ptr = DATAPTR(ibh);
  11245.          ptr += st->l2.ihsize;
  11246.          size = ibh->datasize - st->l2.ihsize;
  11247. -        if (DEBUG_1TR6 > 6) {
  11248. -            printk(KERN_INFO "isdnl3/l3up DL_DATA size=%d\n", size);
  11249. -            for (i = 0; i < size; i++)
  11250. -                printk(KERN_INFO "l3up data %x\n", ptr[i]);
  11251. -        }
  11252.          mt = ptr[3];
  11253.          switch (ptr[0]) {
  11254.  #ifdef P_1TR6
  11255. @@ -494,8 +482,8 @@
  11256.                if (i == datasl_1tr6t_len) {
  11257.                    BufPoolRelease(ibh);
  11258.                    if (DEBUG_1TR6 > 0)
  11259. -                      printk(KERN_INFO "isdnl3up unhandled 1tr6 state %d MT %s\n",
  11260. -                         st->l3.state, mt_trans(PROTO_DIS_N1, mt));
  11261. +                      printk(KERN_INFO "isdnl3up unhandled 1tr6 state %d MT %x\n",
  11262. +                         st->l3.state, mt);
  11263.                } else
  11264.                    datastatelist_1tr6t[i].rout(st, pr, ibh);
  11265.                break;
  11266. @@ -507,6 +495,9 @@
  11267.                        break;
  11268.                if (i == datasllen) {
  11269.                    BufPoolRelease(ibh);
  11270. +                  if (DEBUG_1TR6 > 0)
  11271. +                        printk(KERN_INFO "isdnl3up unhandled E-DSS1 state %d MT %x\n",
  11272. +                         st->l3.state, mt);
  11273.                } else
  11274.                    datastatelist[i].rout(st, pr, ibh);
  11275.          }
  11276. @@ -514,11 +505,6 @@
  11277.          ptr = DATAPTR(ibh);
  11278.          ptr += st->l2.uihsize;
  11279.          size = ibh->datasize - st->l2.uihsize;
  11280. -        if (DEBUG_1TR6 > 6) {
  11281. -            printk(KERN_INFO "isdnl3/l3up DL_UNIT_DATA size=%d\n", size);
  11282. -            for (i = 0; i < size; i++)
  11283. -                printk(KERN_INFO "l3up data %x\n", ptr[i]);
  11284. -        }
  11285.          mt = ptr[3];
  11286.          switch (ptr[0]) {
  11287.  #ifdef P_1TR6
  11288. @@ -532,8 +518,8 @@
  11289.                        break;
  11290.                if (i == datasl_1tr6t_len) {
  11291.                    if (DEBUG_1TR6 > 0) {
  11292. -                      printk(KERN_INFO "isdnl3up unhandled 1tr6 state %d MT %s\n"
  11293. -                         ,st->l3.state, mt_trans(PROTO_DIS_N1, mt));
  11294. +                      printk(KERN_INFO "isdnl3up unhandled 1tr6 state %d MT %x\n"
  11295. +                         ,st->l3.state, mt);
  11296.                    }
  11297.                    BufPoolRelease(ibh);
  11298.                } else
  11299. @@ -547,6 +533,9 @@
  11300.                        break;
  11301.                if (i == datasllen) {
  11302.                    BufPoolRelease(ibh);
  11303. +                  if (DEBUG_1TR6 > 0)
  11304. +                        printk(KERN_INFO "isdnl3up unhandled E-DSS1 state %d MT %x\n",
  11305. +                         st->l3.state, mt);
  11306.                } else
  11307.                    datastatelist[i].rout(st, pr, ibh);
  11308.          }
  11309. @@ -581,6 +570,9 @@
  11310.                    (pr == downstatelist[i].primitive))
  11311.                    break;
  11312.            if (i == downsllen) {
  11313. +              if (DEBUG_1TR6 > 0) {
  11314. +                  printk(KERN_INFO "isdnl3down unhandled E-DSS1 state %d primitiv %x\n", st->l3.state, pr);
  11315. +              }
  11316.            } else
  11317.                downstatelist[i].rout(st, pr, ibh);
  11318.      }
  11319. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/l3_1TR6.c linux/drivers/isdn/teles/l3_1TR6.c
  11320. --- pre2.0.5/linux/drivers/isdn/teles/l3_1TR6.c    Sun Apr 21 19:22:07 1996
  11321. +++ linux/drivers/isdn/teles/l3_1TR6.c    Sun May 19 15:29:31 1996
  11322. @@ -1,6 +1,9 @@
  11323. -/* $Id: l3_1TR6.c,v 1.2 1996/04/20 16:47:23 fritz Exp $
  11324. +/* $Id: l3_1TR6.c,v 1.3 1996/04/30 21:54:42 isdn4dev Exp $
  11325.   *
  11326.   * $Log: l3_1TR6.c,v $
  11327. + * Revision 1.3  1996/04/30 21:54:42  isdn4dev
  11328. + * SPV, callback , remove some debugging code  Karsten Keil
  11329. + *
  11330.   * Revision 1.2  1996/04/20 16:47:23  fritz
  11331.   * Changed statemachine to allow reject of an incoming call.
  11332.   * Report all incoming calls, not just those with Service = 7.
  11333. @@ -12,27 +15,6 @@
  11334.   *
  11335.   */
  11336.  
  11337. -char           *
  11338. -mt_trans(int pd, int mt)
  11339. -{
  11340. -    int             i;
  11341. -
  11342. -    if (pd == PROTO_DIS_N0) {
  11343. -        for (i = 0; i < (sizeof(mtdesc_n0) / sizeof(struct MTypeDesc)); i++) {
  11344. -            if (mt == mtdesc_n0[i].mt)
  11345. -                return (mtdesc_n0[i].descr);
  11346. -        }
  11347. -        return ("unknown Message Type PD=N0");
  11348. -    } else if (pd == PROTO_DIS_N1) {
  11349. -        for (i = 0; i < (sizeof(mtdesc_n1) / sizeof(struct MTypeDesc)); i++) {
  11350. -            if (mt == mtdesc_n1[i].mt)
  11351. -                return (mtdesc_n1[i].descr);
  11352. -        }
  11353. -        return ("unknown Message Type PD=N1");
  11354. -    }
  11355. -    return ("unknown Protokolldiscriminator");
  11356. -}
  11357. -
  11358.  static void
  11359.  l3_1TR6_message(struct PStack *st, int mt, int pd)
  11360.  {
  11361. @@ -59,10 +41,6 @@
  11362.      byte           *p;
  11363.      char           *teln;
  11364.  
  11365. -#if DEBUG_1TR6
  11366. -    printk(KERN_INFO "1tr6: sent SETUP\n");
  11367. -#endif
  11368. -
  11369.      st->l3.callref = st->pa->callref;
  11370.      BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 19);
  11371.      p = DATAPTR(dibh);
  11372. @@ -73,7 +51,21 @@
  11373.      *p++ = st->l3.callref;
  11374.      *p++ = MT_N1_SETUP;
  11375.  
  11376. -
  11377. +    if ('S' == (st->pa->called[0] & 0x5f)) {    /* SPV ??? */
  11378. +        /* NSF SPV */
  11379. +        *p++ = WE0_netSpecFac;
  11380. +        *p++ = 4;    /* Laenge */
  11381. +        *p++ = 0;
  11382. +        *p++ = FAC_SPV;    /* SPV */
  11383. +        *p++ = st->pa->info; /* 0 for all Services */
  11384. +        *p++ = st->pa->info2; /* 0 for all Services */
  11385. +        *p++ = WE0_netSpecFac;
  11386. +        *p++ = 4;    /* Laenge */
  11387. +        *p++ = 0;
  11388. +        *p++ = FAC_Activate;    /* aktiviere SPV (default) */
  11389. +        *p++ = st->pa->info; /* 0 for all Services */
  11390. +        *p++ = st->pa->info2; /* 0 for all Services */
  11391. +    }
  11392.      if (st->pa->calling[0] != '\0') {
  11393.          *p++ = WE0_origAddr;
  11394.          *p++ = strlen(st->pa->calling) + 1;
  11395. @@ -84,11 +76,17 @@
  11396.              *p++ = *teln++ & 0x7f;
  11397.      }
  11398.      *p++ = WE0_destAddr;
  11399. -    *p++ = strlen(st->pa->called) + 1;
  11400. +    teln = st->pa->called;
  11401. +    if ('S' != (st->pa->called[0] & 0x5f)) {    /* Keine SPV ??? */
  11402. +        *p++ = strlen(st->pa->called) + 1;
  11403. +        st->pa->spv = 0;
  11404. +    } else {        /* SPV */
  11405. +        *p++ = strlen(st->pa->called);
  11406. +        teln++;        /* skip S */
  11407. +        st->pa->spv = 1;
  11408. +    }
  11409.      /* Classify as AnyPref. */
  11410.      *p++ = 0x81;        /* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
  11411. -
  11412. -    teln = st->pa->called;
  11413.      while (*teln)
  11414.          *p++ = *teln++ & 0x7f;
  11415.  
  11416. @@ -106,7 +104,6 @@
  11417.  
  11418.  }
  11419.  
  11420. -
  11421.  static void
  11422.  l3_1tr6_tu_setup(struct PStack *st, byte pr, void *arg)
  11423.  {
  11424. @@ -118,13 +115,7 @@
  11425.      st->pa->callref = getcallref(p);
  11426.      st->l3.callref = 0x80 + st->pa->callref;
  11427.  
  11428. -#if DEBUG_1TR6
  11429. -        printk(KERN_INFO "1tr6: TU_SETUP cr=%d\n",st->l3.callref);
  11430. -#endif
  11431. -
  11432. -    /*
  11433. -         * Channel Identification
  11434. -         */
  11435. +    /* Channel Identification */
  11436.      p = DATAPTR(ibh);
  11437.      if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
  11438.              WE0_chanID, 0))) {
  11439. @@ -154,6 +145,13 @@
  11440.      } else
  11441.          strcpy(st->pa->calling, "");
  11442.  
  11443. +    p = DATAPTR(ibh);
  11444. +    st->pa->spv = 0;
  11445. +    if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
  11446. +            WE0_netSpecFac, 0))) {
  11447. +        if ((FAC_SPV == p[3]) || (FAC_Activate == p[3]))
  11448. +            st->pa->spv = 1;
  11449. +    }
  11450.      BufPoolRelease(ibh);
  11451.  
  11452.          /* Signal all services, linklevel takes care of Service-Indicator */
  11453. @@ -172,10 +170,6 @@
  11454.      byte           *p;
  11455.      struct BufHeader *ibh = arg;
  11456.  
  11457. -#if DEBUG_1TR6
  11458. -    printk(KERN_INFO "1tr6: SETUP_ACK\n");
  11459. -#endif
  11460. -
  11461.      p = DATAPTR(ibh);
  11462.      if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
  11463.              WE0_chanID, 0))) {
  11464. @@ -183,6 +177,7 @@
  11465.      } else
  11466.          printk(KERN_INFO "octect 3 not found\n");
  11467.  
  11468. +
  11469.      BufPoolRelease(ibh);
  11470.      newl3state(st, 2);
  11471.  }
  11472. @@ -193,10 +188,6 @@
  11473.      byte           *p;
  11474.      struct BufHeader *ibh = arg;
  11475.  
  11476. -#if DEBUG_1TR6
  11477. -    printk(KERN_INFO "1tr6: CALL_SENT\n");
  11478. -#endif
  11479. -
  11480.      p = DATAPTR(ibh);
  11481.      if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
  11482.              WE0_chanID, 0))) {
  11483. @@ -215,9 +206,6 @@
  11484.      byte           *p;
  11485.      struct BufHeader *ibh = arg;
  11486.  
  11487. -#if DEBUG_1TR6
  11488. -    printk(KERN_INFO "1tr6: TU_ALERT\n");
  11489. -#endif
  11490.  
  11491.      p = DATAPTR(ibh);
  11492.      if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
  11493. @@ -236,24 +224,22 @@
  11494.  l3_1tr6_tu_info(struct PStack *st, byte pr, void *arg)
  11495.  {
  11496.      byte           *p;
  11497. -    int             i;
  11498. +    int             i,tmpcharge=0;
  11499.      char            a_charge[8];
  11500.      struct BufHeader *ibh = arg;
  11501.  
  11502. -#if DEBUG_1TR6
  11503. -    printk(KERN_INFO "1tr6: TU_INFO\n");
  11504. -#endif
  11505. -
  11506.      p = DATAPTR(ibh);
  11507.      if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
  11508.              WE6_chargingInfo, 6))) {
  11509.          iecpy(a_charge, p, 1);
  11510. -        st->pa->chargeinfo = 0;
  11511. -        for (i = 0; i < strlen(a_charge); i++) {
  11512. -            st->pa->chargeinfo *= 10;
  11513. -            st->pa->chargeinfo += a_charge[i] & 0xf;
  11514. -            st->l3.l3l4(st, CC_INFO_CHARGE, NULL);
  11515. -        }
  11516. +                for (i = 0; i < strlen (a_charge); i++) {
  11517. +                         tmpcharge *= 10;
  11518. +                         tmpcharge += a_charge[i] & 0xf;
  11519. +                 }
  11520. +                if (tmpcharge > st->pa->chargeinfo) {
  11521. +                         st->pa->chargeinfo = tmpcharge;
  11522. +                         st->l3.l3l4 (st, CC_INFO_CHARGE, NULL);
  11523. +                 }
  11524.          if (DEBUG_1TR6 > 2)
  11525.              printk(KERN_INFO "chargingInfo %d\n", st->pa->chargeinfo);
  11526.      } else if (DEBUG_1TR6 > 2)
  11527. @@ -269,10 +255,6 @@
  11528.      int             i;
  11529.      struct BufHeader *ibh = arg;
  11530.  
  11531. -#if DEBUG_1TR6
  11532. -    printk(KERN_INFO "1tr6: TU_INFO 2\n");
  11533. -#endif
  11534. -
  11535.      if (DEBUG_1TR6 > 4) {
  11536.          p = DATAPTR(ibh);
  11537.          for (i = 0; i < ibh->datasize; i++) {
  11538. @@ -287,10 +269,7 @@
  11539.  {
  11540.      struct BufHeader *ibh = arg;
  11541.  
  11542. -#if DEBUG_1TR6
  11543. -    printk(KERN_INFO "1tr6: CONNECT\n");
  11544. -#endif
  11545. -
  11546. +        st->pa->chargeinfo=0;
  11547.      BufPoolRelease(ibh);
  11548.      st->l3.l3l4(st, CC_SETUP_CNF, NULL);
  11549.      newl3state(st, 10);
  11550. @@ -301,11 +280,6 @@
  11551.  {
  11552.      struct BufHeader *ibh = arg;
  11553.  
  11554. -#if DEBUG_1TR6
  11555. -    printk(KERN_INFO "1tr6: REL\n");
  11556. -#endif
  11557. -
  11558. -
  11559.      BufPoolRelease(ibh);
  11560.      l3_1TR6_message(st, MT_N1_REL_ACK, PROTO_DIS_N1);
  11561.      st->l3.l3l4(st, CC_RELEASE_IND, NULL);
  11562. @@ -317,11 +291,6 @@
  11563.  {
  11564.      struct BufHeader *ibh = arg;
  11565.  
  11566. -#if DEBUG_1TR6
  11567. -    printk(KERN_INFO "1tr6: REL_ACK\n");
  11568. -#endif
  11569. -
  11570. -
  11571.      BufPoolRelease(ibh);
  11572.      newl3state(st, 0);
  11573.      st->l3.l3l4(st, CC_RELEASE_CNF, NULL);
  11574. @@ -332,25 +301,21 @@
  11575.  {
  11576.      struct BufHeader *ibh = arg;
  11577.      byte           *p;
  11578. -    int             i;
  11579. +    int             i,tmpcharge=0;
  11580.      char            a_charge[8];
  11581.  
  11582. -
  11583. -#if DEBUG_1TR6
  11584. -    printk(KERN_INFO "1tr6: TU_DISC\n");
  11585. -#endif
  11586. -
  11587. -
  11588.      p = DATAPTR(ibh);
  11589.      if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
  11590.              WE6_chargingInfo, 6))) {
  11591.          iecpy(a_charge, p, 1);
  11592. -        st->pa->chargeinfo = 0;
  11593. -        for (i = 0; i < strlen(a_charge); i++) {
  11594. -            st->pa->chargeinfo *= 10;
  11595. -            st->pa->chargeinfo += a_charge[i] & 0xf;
  11596. -            st->l3.l3l4(st, CC_INFO_CHARGE, NULL);
  11597. -        }
  11598. +                for (i = 0; i < strlen (a_charge); i++) {
  11599. +                         tmpcharge *= 10;
  11600. +                         tmpcharge += a_charge[i] & 0xf;
  11601. +                 }
  11602. +                if (tmpcharge > st->pa->chargeinfo) {
  11603. +                         st->pa->chargeinfo = tmpcharge;
  11604. +                         st->l3.l3l4 (st, CC_INFO_CHARGE, NULL);
  11605. +                 }
  11606.          if (DEBUG_1TR6 > 2)
  11607.              printk(KERN_INFO "chargingInfo %d\n", st->pa->chargeinfo);
  11608.      } else if (DEBUG_1TR6 > 2)
  11609. @@ -380,12 +345,8 @@
  11610.  {
  11611.      struct BufHeader *ibh = arg;
  11612.  
  11613. -#if DEBUG_1TR6
  11614. -    printk(KERN_INFO "1tr6: CONN_ACK\n");
  11615. -#endif
  11616. -
  11617. -
  11618.      BufPoolRelease(ibh);
  11619. +    st->pa->chargeinfo = 0;
  11620.      st->l3.l3l4(st, CC_SETUP_COMPLETE_IND, NULL);
  11621.      newl3state(st, 10);
  11622.  }
  11623. @@ -394,10 +355,6 @@
  11624.  l3_1tr6_alert(struct PStack *st, byte pr,
  11625.            void *arg)
  11626.  {
  11627. -#if DEBUG_1TR6
  11628. -    printk(KERN_INFO "1tr6: send ALERT\n");
  11629. -#endif
  11630. -
  11631.      l3_1TR6_message(st, MT_N1_ALERT, PROTO_DIS_N1);
  11632.      newl3state(st, 7);
  11633.  }
  11634. @@ -406,22 +363,45 @@
  11635.  l3_1tr6_conn(struct PStack *st, byte pr,
  11636.           void *arg)
  11637.  {
  11638. -#if DEBUG_1TR6
  11639. -    printk(KERN_INFO "1tr6: send CONNECT\n");
  11640. -#endif
  11641. +    struct BufHeader *dibh;
  11642. +    byte *p;
  11643.  
  11644.      st->l3.callref = 0x80 + st->pa->callref;
  11645. -    l3_1TR6_message(st, MT_N1_CONN, PROTO_DIS_N1);
  11646. +
  11647. +    BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 20);
  11648. +    p = DATAPTR(dibh);
  11649. +    p += st->l2.ihsize;
  11650. +
  11651. +    *p++ = PROTO_DIS_N1;
  11652. +    *p++ = 0x1;
  11653. +    *p++ = st->l3.callref;
  11654. +    *p++ = MT_N1_CONN;
  11655. +
  11656. +    if (st->pa->spv) {    /* SPV ??? */
  11657. +        /* NSF SPV */
  11658. +        *p++ = WE0_netSpecFac;
  11659. +        *p++ = 4;    /* Laenge */
  11660. +        *p++ = 0;
  11661. +        *p++ = FAC_SPV;    /* SPV */
  11662. +        *p++ = st->pa->info;
  11663. +        *p++ = st->pa->info2;
  11664. +        *p++ = WE0_netSpecFac;
  11665. +        *p++ = 4;    /* Laenge */
  11666. +        *p++ = 0;
  11667. +        *p++ = FAC_Activate;    /* aktiviere SPV */
  11668. +        *p++ = st->pa->info;
  11669. +        *p++ = st->pa->info2;
  11670. +    }
  11671. +    dibh->datasize = p - DATAPTR(dibh);
  11672. +
  11673. +    i_down(st, dibh);
  11674. +
  11675.      newl3state(st, 8);
  11676.  }
  11677.  
  11678.  static void
  11679.  l3_1tr6_ignore(struct PStack *st, byte pr, void *arg)
  11680.  {
  11681. -#if DEBUG_1TR6
  11682. -    printk(KERN_INFO "1tr6: IGNORE\n");
  11683. -#endif
  11684. -
  11685.      newl3state(st, 0);
  11686.  }
  11687.  
  11688. @@ -432,10 +412,6 @@
  11689.      byte             *p;
  11690.          byte             rejflg;
  11691.  
  11692. -#if DEBUG_1TR6
  11693. -    printk(KERN_INFO "1tr6: send DISCON\n");
  11694. -#endif
  11695. -
  11696.      BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 21);
  11697.      p = DATAPTR(dibh);
  11698.      p += st->l2.ihsize;
  11699. @@ -460,10 +436,7 @@
  11700.  
  11701.      i_down(st, dibh);
  11702.  
  11703. -        if (rejflg)
  11704. -                newl3state(st, 0);
  11705. -        else
  11706. -                newl3state(st, 11);
  11707. +        newl3state(st, 11);
  11708.  }
  11709.  
  11710.  static void
  11711. @@ -472,8 +445,6 @@
  11712.      l3_1TR6_message(st, MT_N1_REL, PROTO_DIS_N1);
  11713.      newl3state(st, 19);
  11714.  }
  11715. -
  11716. -
  11717.  
  11718.  static struct stateentry downstatelist_1tr6t[] =
  11719.  {
  11720. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/l3_1TR6.h linux/drivers/isdn/teles/l3_1TR6.h
  11721. --- pre2.0.5/linux/drivers/isdn/teles/l3_1TR6.h    Sun Apr 21 19:22:07 1996
  11722. +++ linux/drivers/isdn/teles/l3_1TR6.h    Sun May 19 15:29:31 1996
  11723. @@ -1,6 +1,9 @@
  11724. -/* $Id: l3_1TR6.h,v 1.1 1996/04/13 10:25:42 fritz Exp $
  11725. +/* $Id: l3_1TR6.h,v 1.3 1996/04/30 21:53:48 isdn4dev Exp $
  11726.   *
  11727.   * $Log: l3_1TR6.h,v $
  11728. + * Revision 1.3  1996/04/30 21:53:48  isdn4dev
  11729. + * Bugs, SPV, Logging in q931.c  Karsten Keil
  11730. + *
  11731.   * Revision 1.1  1996/04/13 10:25:42  fritz
  11732.   * Initial revision
  11733.   *
  11734. @@ -15,16 +18,16 @@
  11735.  /*
  11736.   * MsgType N0
  11737.   */
  11738. -#define MT_N0_REG_IND 61
  11739. -#define MT_N0_CANC_IND 62
  11740. -#define MT_N0_FAC_STA 63
  11741. -#define MT_N0_STA_ACK 64
  11742. -#define MT_N0_STA_REJ 65
  11743. -#define MT_N0_FAC_INF 66
  11744. -#define MT_N0_INF_ACK 67
  11745. -#define MT_N0_INF_REJ 68
  11746. -#define MT_N0_CLOSE 75
  11747. -#define MT_N0_CLO_ACK 77
  11748. +#define MT_N0_REG_IND 0x61
  11749. +#define MT_N0_CANC_IND 0x62
  11750. +#define MT_N0_FAC_STA 0x63
  11751. +#define MT_N0_STA_ACK 0x64
  11752. +#define MT_N0_STA_REJ 0x65
  11753. +#define MT_N0_FAC_INF 0x66
  11754. +#define MT_N0_INF_ACK 0x67
  11755. +#define MT_N0_INF_REJ 0x68
  11756. +#define MT_N0_CLOSE   0x75
  11757. +#define MT_N0_CLO_ACK 0x77
  11758.  
  11759.  
  11760.  /*
  11761. @@ -63,59 +66,6 @@
  11762.  #define MT_N1_STAT 0x63
  11763.  
  11764.  
  11765. -struct MTypeDesc {
  11766. -    byte            mt;
  11767. -    char           *descr;
  11768. -};
  11769. -
  11770. -static struct MTypeDesc mtdesc_n0[] =
  11771. -{
  11772. -    {MT_N0_REG_IND, "MT_N0_REG_IND"},
  11773. -    {MT_N0_CANC_IND, "MT_N0_CANC_IND"},
  11774. -    {MT_N0_FAC_STA, "MT_N0_FAC_STA"},
  11775. -    {MT_N0_STA_ACK, "MT_N0_STA_ACK"},
  11776. -    {MT_N0_STA_REJ, "MT_N0_STA_REJ"},
  11777. -    {MT_N0_FAC_INF, "MT_N0_FAC_INF"},
  11778. -    {MT_N0_INF_ACK, "MT_N0_INF_ACK"},
  11779. -    {MT_N0_INF_REJ, "MT_N0_INF_REJ"},
  11780. -    {MT_N0_CLOSE, "MT_N0_CLOSE"},
  11781. -    {MT_N0_CLO_ACK, "MT_N0_CLO_ACK"}
  11782. -};
  11783. -
  11784. -static struct MTypeDesc mtdesc_n1[] =
  11785. -{
  11786. -    {MT_N1_ESC, "MT_N1_ESC"},
  11787. -    {MT_N1_ALERT, "MT_N1_ALERT"},
  11788. -    {MT_N1_CALL_SENT, "MT_N1_CALL_SENT"},
  11789. -    {MT_N1_CONN, "MT_N1_CONN"},
  11790. -    {MT_N1_CONN_ACK, "MT_N1_CONN_ACK"},
  11791. -    {MT_N1_SETUP, "MT_N1_SETUP"},
  11792. -    {MT_N1_SETUP_ACK, "MT_N1_SETUP_ACK"},
  11793. -    {MT_N1_RES, "MT_N1_RES"},
  11794. -    {MT_N1_RES_ACK, "MT_N1_RES_ACK"},
  11795. -    {MT_N1_RES_REJ, "MT_N1_RES_REJ"},
  11796. -    {MT_N1_SUSP, "MT_N1_SUSP"},
  11797. -    {MT_N1_SUSP_ACK, "MT_N1_SUSP_ACK"},
  11798. -    {MT_N1_SUSP_REJ, "MT_N1_SUSP_REJ"},
  11799. -    {MT_N1_USER_INFO, "MT_N1_USER_INFO"},
  11800. -    {MT_N1_DET, "MT_N1_DET"},
  11801. -    {MT_N1_DISC, "MT_N1_DISC"},
  11802. -    {MT_N1_REL, "MT_N1_REL"},
  11803. -    {MT_N1_REL_ACK, "MT_N1_REL_ACK"},
  11804. -    {MT_N1_CANC_ACK, "MT_N1_CANC_ACK"},
  11805. -    {MT_N1_CANC_REJ, "MT_N1_CANC_REJ"},
  11806. -    {MT_N1_CON_CON, "MT_N1_CON_CON"},
  11807. -    {MT_N1_FAC, "MT_N1_FAC"},
  11808. -    {MT_N1_FAC_ACK, "MT_N1_FAC_ACK"},
  11809. -    {MT_N1_FAC_CAN, "MT_N1_FAC_CAN"},
  11810. -    {MT_N1_FAC_REG, "MT_N1_FAC_REG"},
  11811. -    {MT_N1_FAC_REJ, "MT_N1_FAC_REJ"},
  11812. -    {MT_N1_INFO, "MT_N1_INFO"},
  11813. -    {MT_N1_REG_ACK, "MT_N1_REG_ACK"},
  11814. -    {MT_N1_REG_REJ, "MT_N1_REG_REJ"},
  11815. -    {MT_N1_STAT, "MT_N1_STAT"}
  11816. -};
  11817. -
  11818.  
  11819.  /*
  11820.   * W Elemente
  11821. @@ -172,7 +122,7 @@
  11822.  #define FAC_Unterdruecke 0x1B
  11823.  #define FAC_Deactivate 0x1E
  11824.  #define FAC_Activate 0x1D
  11825. -#define FAC_SVC 0x1F
  11826. +#define FAC_SPV 0x1F
  11827.  #define FAC_Rueckwechsel 0x23
  11828.  #define FAC_Umleitung 0x24
  11829.  
  11830. @@ -187,7 +137,7 @@
  11831.  #define CAUSE_FacNotImpl 0x10
  11832.  #define CAUSE_FacNotSubscr 0x11
  11833.  #define CAUSE_OutgoingBarred 0x20
  11834. -#define CAUSE_UserAssessBusy 0x21
  11835. +#define CAUSE_UserAccessBusy 0x21
  11836.  #define CAUSE_NegativeGBG 0x22
  11837.  #define CAUSE_UnknownGBG 0x23
  11838.  #define CAUSE_NoSPVknown 0x25
  11839. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/llglue.c linux/drivers/isdn/teles/llglue.c
  11840. --- pre2.0.5/linux/drivers/isdn/teles/llglue.c    Sun Apr 21 19:22:07 1996
  11841. +++ linux/drivers/isdn/teles/llglue.c    Sun May 19 15:29:31 1996
  11842. @@ -1,6 +1,12 @@
  11843. -/* $Id: llglue.c,v 1.1 1996/04/13 10:26:29 fritz Exp $
  11844. +/* $Id: llglue.c,v 1.3 1996/05/01 14:19:57 fritz Exp $
  11845.   *
  11846.   * $Log: llglue.c,v $
  11847. + * Revision 1.3  1996/05/01 14:19:57  fritz
  11848. + * Added ISDN_FEADTURE_L2_TRANS
  11849. + *
  11850. + * Revision 1.2  1996/04/29 23:01:46  fritz
  11851. + * Added driverId and channel to readstatus().
  11852. + *
  11853.   * Revision 1.1  1996/04/13 10:26:29  fritz
  11854.   * Initial revision
  11855.   *
  11856. @@ -25,7 +31,7 @@
  11857.  static byte    *teles_status_end = NULL;
  11858.  
  11859.  int
  11860. -teles_readstatus(byte * buf, int len, int user)
  11861. +teles_readstatus(byte * buf, int len, int user, int id, int channel)
  11862.  {
  11863.      int             count;
  11864.      byte           *p;
  11865. @@ -90,6 +96,7 @@
  11866.      iif.features =
  11867.          ISDN_FEATURE_L2_X75I |
  11868.          ISDN_FEATURE_L2_HDLC |
  11869. +        ISDN_FEATURE_L2_TRANS |
  11870.          ISDN_FEATURE_L3_TRANS |
  11871.          ISDN_FEATURE_P_1TR6 |
  11872.          ISDN_FEATURE_P_EURO;
  11873. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/q931.c linux/drivers/isdn/teles/q931.c
  11874. --- pre2.0.5/linux/drivers/isdn/teles/q931.c    Sun Apr 21 19:22:07 1996
  11875. +++ linux/drivers/isdn/teles/q931.c    Sun May 19 15:29:31 1996
  11876. @@ -1,4 +1,4 @@
  11877. -/* $Id: q931.c,v 1.2 1996/04/20 16:48:19 fritz Exp $
  11878. +/* $Id: q931.c,v 1.4 1996/05/17 03:46:17 fritz Exp $
  11879.   *
  11880.   * q931.c               code to decode ITU Q.931 call control messages
  11881.   * 
  11882. @@ -10,7 +10,16 @@
  11883.   * 
  11884.   * Beat Doebeli         cause texts, display information element
  11885.   * 
  11886. + * Karsten Keil         cause texts, display information element for 1TR6 
  11887. + *
  11888. + * 
  11889.   * $Log: q931.c,v $
  11890. + * Revision 1.4  1996/05/17 03:46:17  fritz
  11891. + * General cleanup.
  11892. + *
  11893. + * Revision 1.3  1996/04/30 22:06:50  isdn4dev
  11894. + *   logging 1TR6 messages correctly   Karsten Keil
  11895. + *
  11896.   * Revision 1.2  1996/04/20 16:48:19  fritz
  11897.   * Misc. typos
  11898.   *
  11899. @@ -23,6 +32,7 @@
  11900.  
  11901.  #define __NO_VERSION__
  11902.  #include "teles.h"
  11903. +#include "l3_1TR6.h"
  11904.  
  11905.  byte           *
  11906.  findie(byte * p, int size, byte ie, int wanted_set)
  11907. @@ -174,9 +184,87 @@
  11908.  
  11909.  #define MTSIZE sizeof(mtlist)/sizeof(struct MessageType)
  11910.  
  11911. +static
  11912. +struct MessageType mt_n0[] =
  11913. +{
  11914. +    {MT_N0_REG_IND, "REGister INDication"},
  11915. +    {MT_N0_CANC_IND, "CANCel INDication"},
  11916. +    {MT_N0_FAC_STA, "FACility STAtus"},
  11917. +    {MT_N0_STA_ACK, "STAtus ACKnowledge"},
  11918. +    {MT_N0_STA_REJ, "STAtus REJect"},
  11919. +    {MT_N0_FAC_INF, "FACility INFormation"},
  11920. +    {MT_N0_INF_ACK, "INFormation ACKnowledge"},
  11921. +    {MT_N0_INF_REJ, "INFormation REJect"},
  11922. +    {MT_N0_CLOSE, "CLOSE"},
  11923. +    {MT_N0_CLO_ACK, "CLOse ACKnowledge"}
  11924. +};
  11925. +
  11926. +int mt_n0_len = (sizeof(mt_n0) / sizeof(struct MessageType));
  11927.  
  11928.  static
  11929. -int
  11930. +struct MessageType mt_n1[] =
  11931. +{
  11932. +    {MT_N1_ESC, "ESCape"},
  11933. +    {MT_N1_ALERT, "ALERT"},
  11934. +    {MT_N1_CALL_SENT, "CALL SENT"},
  11935. +    {MT_N1_CONN, "CONNect"},
  11936. +    {MT_N1_CONN_ACK, "CONNect ACKnowledge"},
  11937. +    {MT_N1_SETUP, "SETUP"},
  11938. +    {MT_N1_SETUP_ACK, "SETUP ACKnowledge"},
  11939. +    {MT_N1_RES, "RESume"},
  11940. +    {MT_N1_RES_ACK, "RESume ACKnowledge"},
  11941. +    {MT_N1_RES_REJ, "RESume REJect"},
  11942. +    {MT_N1_SUSP, "SUSPend"},
  11943. +    {MT_N1_SUSP_ACK, "SUSPend ACKnowledge"},
  11944. +    {MT_N1_SUSP_REJ, "SUSPend REJect"},
  11945. +    {MT_N1_USER_INFO, "USER INFO"},
  11946. +    {MT_N1_DET, "DETach"},
  11947. +    {MT_N1_DISC, "DISConnect"},
  11948. +    {MT_N1_REL, "RELease"},
  11949. +    {MT_N1_REL_ACK, "RELease ACKnowledge"},
  11950. +    {MT_N1_CANC_ACK, "CANCel ACKnowledge"},
  11951. +    {MT_N1_CANC_REJ, "CANCel REJect"},
  11952. +    {MT_N1_CON_CON, "CONgestion CONtrol"},
  11953. +    {MT_N1_FAC, "FACility"},
  11954. +    {MT_N1_FAC_ACK, "FACility ACKnowledge"},
  11955. +    {MT_N1_FAC_CAN, "FACility CANcel"},
  11956. +    {MT_N1_FAC_REG, "FACility REGister"},
  11957. +    {MT_N1_FAC_REJ, "FACility REJect"},
  11958. +    {MT_N1_INFO, "INFOmation"},
  11959. +    {MT_N1_REG_ACK, "REGister ACKnowledge"},
  11960. +    {MT_N1_REG_REJ, "REGister REJect"},
  11961. +    {MT_N1_STAT, "STATus"}
  11962. +};
  11963. +
  11964. +int mt_n1_len = (sizeof(mt_n1) / sizeof(struct MessageType));
  11965. +
  11966. +static struct MessageType fac_1tr6[] =
  11967. +{
  11968. +    {FAC_Sperre, "Sperre"},
  11969. +    {FAC_Forward1, "Forward 1"},
  11970. +    {FAC_Forward2, "Forward 2"},
  11971. +    {FAC_Konferenz, "Konferenz"},
  11972. +    {FAC_GrabBchan, "Grab Bchannel"},
  11973. +    {FAC_Reactivate, "Reactivate"},
  11974. +    {FAC_Konferenz3, "Dreier Konferenz"},
  11975. +    {FAC_Dienstwechsel1, "Einseitiger Dienstwechsel"},
  11976. +    {FAC_Dienstwechsel2, "Zweiseitiger Dienstwechsel"},
  11977. +    {FAC_NummernIdent, "Rufnummer-Identifizierung"},
  11978. +    {FAC_GBG, "GBG"},
  11979. +    {FAC_DisplayUebergeben, "Display Uebergeben"},
  11980. +    {FAC_DisplayUmgeleitet, "Display Umgeleitet"},
  11981. +    {FAC_Unterdruecke, "Unterdruecke Rufnummer"},
  11982. +    {FAC_Deactivate, "Deactivate"},
  11983. +    {FAC_Activate, "Activate"},
  11984. +    {FAC_SPV, "SPV"},
  11985. +    {FAC_Rueckwechsel, "Rueckwechsel"},
  11986. +    {FAC_Umleitung, "Umleitung"}
  11987. +};
  11988. +int fac_1tr6_len = (sizeof(fac_1tr6) / sizeof(struct MessageType));
  11989. +
  11990. +
  11991. +
  11992. +static int 
  11993.  prbits(char *dest, byte b, int start, int len)
  11994.  {
  11995.      char           *dp = dest;
  11996. @@ -449,12 +537,6 @@
  11997.      else
  11998.          dp += sprintf(dp, "  cause value %x : %s \n", cause, cvlist[i].edescr);
  11999.  
  12000. -
  12001. -#if 0
  12002. -    dp += sprintf(dp,"    cause value ");
  12003. -        dp += prbits(dp,*p++,7,7);
  12004. -        *dp++ = '\n';
  12005. -#endif
  12006.      while (!0) {
  12007.          if (p > end)
  12008.              break;
  12009. @@ -471,10 +553,76 @@
  12010.  }
  12011.  
  12012.  static
  12013. -int
  12014. -prchident(char *dest, byte * p)
  12015. +struct MessageType cause_1tr6[] =
  12016. +{
  12017. +    {CAUSE_InvCRef, "Invalid Call Reference"},
  12018. +    {CAUSE_BearerNotImpl, "Bearer Service Not Implemented"},
  12019. +    {CAUSE_CIDunknown, "Caller Identity unknown"},
  12020. +    {CAUSE_CIDinUse, "Caller Identity in Use"},
  12021. +    {CAUSE_NoChans, "No Channels available"},
  12022. +    {CAUSE_FacNotImpl, "Facility Not Implemented"},
  12023. +    {CAUSE_FacNotSubscr, "Facility Not Subscribed"},
  12024. +    {CAUSE_OutgoingBarred, "Outgoing calls barred"},
  12025. +    {CAUSE_UserAccessBusy, "User Access Busy"},
  12026. +    {CAUSE_NegativeGBG, "Negative GBG"},
  12027. +    {CAUSE_UnknownGBG, "Unknown  GBG"},
  12028. +    {CAUSE_NoSPVknown, "No SPV known"},
  12029. +    {CAUSE_DestNotObtain, "Destination not obtainable"},
  12030. +    {CAUSE_NumberChanged, "Number changed"},
  12031. +    {CAUSE_OutOfOrder, "Out Of Order"},
  12032. +    {CAUSE_NoUserResponse, "No User Response"},
  12033. +    {CAUSE_UserBusy, "User Busy"},
  12034. +    {CAUSE_IncomingBarred, "Incoming Barred"},
  12035. +    {CAUSE_CallRejected, "Call Rejected"},
  12036. +    {CAUSE_NetworkCongestion, "Network Congestion"},
  12037. +    {CAUSE_RemoteUser, "Remote User initiated"},
  12038. +    {CAUSE_LocalProcErr, "Local Procedure Error"},
  12039. +    {CAUSE_RemoteProcErr, "Remote Procedure Error"},
  12040. +    {CAUSE_RemoteUserSuspend, "Remote User Suspend"},
  12041. +    {CAUSE_RemoteUserResumed, "Remote User Resumed"},
  12042. +    {CAUSE_UserInfoDiscarded, "User Info Discarded"}
  12043. +};
  12044. +
  12045. +int cause_1tr6_len = (sizeof(cause_1tr6) / sizeof(struct MessageType));
  12046. +
  12047. +static int
  12048. +prcause_1tr6(char *dest, byte * p) 
  12049.  {
  12050.      char           *dp = dest;
  12051. +    int i, cause;
  12052. +
  12053. +    p++;
  12054. +    if (0 == *p) {
  12055. +        dp += sprintf(dp, "   OK (cause length=0)\n");
  12056. +        return (dp - dest);
  12057. +    } else if (*p > 1) {
  12058. +        dp += sprintf(dp, "    coding ");
  12059. +        dp += prbits(dp, p[2], 7, 2);
  12060. +        dp += sprintf(dp, " location ");
  12061. +        dp += prbits(dp, p[2], 4, 4);
  12062. +        *dp++ = '\n';
  12063. +    }
  12064. +    p++;
  12065. +    cause = 0x7f & *p;
  12066. +
  12067. +    /* locate cause value */
  12068. +    for (i = 0; i < cause_1tr6_len; i++)
  12069. +        if (cause_1tr6[i].nr == cause)
  12070. +            break;
  12071. +
  12072. +    /* display cause value if it exists */
  12073. +    if (i == cause_1tr6_len)
  12074. +        dp += sprintf(dp, "Unknown cause type %x!\n", cause);
  12075. +    else
  12076. +        dp += sprintf(dp, "  cause value %x : %s \n", cause, cause_1tr6[i].descr);
  12077. +
  12078. +    return (dp - dest);
  12079. +
  12080. +}
  12081. +
  12082. +static int
  12083. +prchident(char *dest, byte * p) {
  12084. +    char *dp = dest;
  12085.  
  12086.      p += 2;
  12087.      dp += sprintf(dp, "    octet 3 ");
  12088. @@ -482,10 +630,9 @@
  12089.      *dp++ = '\n';
  12090.      return (dp - dest);
  12091.  }
  12092. -static
  12093. -int
  12094. -prcalled(char *dest, byte * p)
  12095. -{
  12096. +
  12097. +static int
  12098. +prcalled(char *dest, byte * p) {
  12099.      int             l;
  12100.      char           *dp = dest;
  12101.  
  12102. @@ -500,10 +647,8 @@
  12103.      *dp++ = '\n';
  12104.      return (dp - dest);
  12105.  }
  12106. -static
  12107. -int
  12108. -prcalling(char *dest, byte * p)
  12109. -{
  12110. +static int
  12111. +prcalling(char *dest, byte * p) {
  12112.      int             l;
  12113.      char           *dp = dest;
  12114.  
  12115. @@ -518,7 +663,6 @@
  12116.          *dp++ = '\n';
  12117.          l--;
  12118.      };
  12119. -
  12120.      p++;
  12121.  
  12122.      dp += sprintf(dp, "    number digits ");
  12123. @@ -575,10 +719,8 @@
  12124.      return (dp - dest);
  12125.  }
  12126.  
  12127. -static
  12128. -int
  12129. -general(char *dest, byte * p)
  12130. -{
  12131. +static int
  12132. +general(char *dest, byte * p) {
  12133.      char           *dp = dest;
  12134.      char            ch = ' ';
  12135.      int             l, octet = 3;
  12136. @@ -597,17 +739,44 @@
  12137.              ch = ' ';
  12138.          } else if (ch == ' ')
  12139.              ch = 'a';
  12140. -
  12141.          else
  12142.              ch++;
  12143.      }
  12144.      return (dp - dest);
  12145.  }
  12146.  
  12147. -static
  12148. -int
  12149. -display(char *dest, byte * p)
  12150. -{
  12151. +static int
  12152. +prcharge(char *dest, byte * p) {
  12153. +    char *dp = dest;
  12154. +    int l;
  12155. +
  12156. +    p++;
  12157. +    l = *p++ - 1;
  12158. +    dp += sprintf(dp, "    GEA ");
  12159. +    dp += prbits(dp, *p++, 8, 8);
  12160. +    dp += sprintf(dp, "  Anzahl: ");
  12161. +    /* Iterate over all octets in the * information element */
  12162. +    while (l--)
  12163. +        *dp++ = *p++;
  12164. +    *dp++ = '\n';
  12165. +    return (dp - dest);
  12166. +} 
  12167. +static int
  12168. +prtext(char *dest, byte * p) {
  12169. +    char *dp = dest;
  12170. +    int l;
  12171. +
  12172. +    p++;
  12173. +    l = *p++;
  12174. +    dp += sprintf(dp, "    ");
  12175. +    /* Iterate over all octets in the * information element */
  12176. +    while (l--)
  12177. +        *dp++ = *p++;
  12178. +    *dp++ = '\n';
  12179. +    return (dp - dest);
  12180. +}
  12181. +static int
  12182. +display(char *dest, byte * p) {
  12183.      char           *dp = dest;
  12184.      char            ch = ' ';
  12185.      int             l, octet = 3;
  12186. @@ -772,107 +941,206 @@
  12187.      },
  12188.  };
  12189.  
  12190. +
  12191.  #define IESIZE sizeof(ielist)/sizeof(struct InformationElement)
  12192.  
  12193. -#ifdef FRITZDEBUG
  12194. -void
  12195. -hexdump(byte * buf, int len, char *comment)
  12196. +static struct InformationElement we_0[] =
  12197.  {
  12198. -    static char     dbuf[1024];
  12199. -    char           *p = dbuf;
  12200. +    {WE0_cause, "Cause", prcause_1tr6},
  12201. +    {WE0_connAddr, "Connecting Address", prcalled},
  12202. +    {WE0_callID, "Call IDentity", general},
  12203. +    {WE0_chanID, "Channel IDentity", general},
  12204. +    {WE0_netSpecFac, "Network Specific Facility", general},
  12205. +    {WE0_display, "Display", general},
  12206. +    {WE0_keypad, "Keypad", general},
  12207. +    {WE0_origAddr, "Origination Address", prcalled},
  12208. +    {WE0_destAddr, "Destination Address", prcalled},
  12209. +    {WE0_userInfo, "User Info", general}
  12210. +};
  12211.  
  12212. -    p += sprintf(p, "%s: ", comment);
  12213. -    while (len) {
  12214. -        p += sprintf(p, "%02x ", *p++);
  12215. -        len--;
  12216. -    }
  12217. -    p += sprintf(p, "\n");
  12218. +static int we_0_len = (sizeof(we_0) / sizeof(struct InformationElement));
  12219.  
  12220. -    teles_putstatus(dbuf);
  12221. -}
  12222. -#endif
  12223. +static struct InformationElement we_6[] =
  12224. +{
  12225. +    {WE6_serviceInd, "Service Indicator", general},
  12226. +    {WE6_chargingInfo, "Charging Information", prcharge},
  12227. +    {WE6_date, "Date", prtext},
  12228. +    {WE6_facSelect, "Facility Select", general},
  12229. +    {WE6_facStatus, "Facility Status", general},
  12230. +    {WE6_statusCalled, "Status Called", general},
  12231. +    {WE6_addTransAttr, "Additional Transmission Attributes", general}
  12232. +};
  12233. +static int we_6_len = (sizeof(we_6) / sizeof(struct InformationElement));
  12234.  
  12235.  void
  12236. -dlogframe(struct IsdnCardState *sp, byte * buf, int size, char *comment)
  12237. -{
  12238. +dlogframe(struct IsdnCardState *sp, byte * buf, int size, char *comment) {
  12239.      byte           *bend = buf + size;
  12240.      char           *dp;
  12241. -    int             i;
  12242. +    int i, cs = 0, cs_old = 0, cs_fest = 0;
  12243.  
  12244.      /* display header */
  12245.      dp = sp->dlogspace;
  12246.      dp += sprintf(dp, "%s\n", comment);
  12247.  
  12248.      {
  12249. -        byte           *p = buf;
  12250. -
  12251. +        byte *p = buf;
  12252.          dp += sprintf(dp, "hex: ");
  12253.          while (p < bend)
  12254. -            dp += sprintf(dp, "%02x ", *p++);
  12255. +        dp += sprintf(dp, "%02x ", *p++);
  12256.          dp += sprintf(dp, "\n");
  12257.          teles_putstatus(sp->dlogspace);
  12258.          dp = sp->dlogspace;
  12259. -    }
  12260. -    /* locate message type */
  12261. -    for (i = 0; i < MTSIZE; i++)
  12262. -        if (mtlist[i].nr == buf[3])
  12263. -            break;
  12264. -
  12265. -    /* display message type iff it exists */
  12266. -    if (i == MTSIZE)
  12267. -        dp += sprintf(dp, "Unknown message type %x!\n", buf[3]);
  12268. -    else
  12269. -        dp += sprintf(dp, "call reference %d size %d message type %s\n",
  12270. -                  buf[2], size, mtlist[i].descr);
  12271. +    } 
  12272. +    if ((0xfe & buf[0]) == PROTO_DIS_N0) {    /* 1TR6 */
  12273. +        /* locate message type */
  12274. +        if (buf[0] == PROTO_DIS_N0) {    /* N0 */
  12275. +            for (i = 0; i < mt_n0_len; i++)
  12276. +                if (mt_n0[i].nr == buf[3])
  12277. +                    break;
  12278. +            /* display message type iff it exists */
  12279. +            if (i == mt_n0_len)
  12280. +                dp += sprintf(dp, "Unknown message type N0 %x!\n", buf[3]);
  12281. +            else
  12282. +                dp += sprintf(dp, "call reference %d size %d message type %s\n",
  12283. +                          buf[2], size, mt_n0[i].descr);
  12284. +        } else {    /* N1 */
  12285. +            for (i = 0; i < mt_n1_len; i++)
  12286. +                if (mt_n1[i].nr == buf[3])
  12287. +                    break;
  12288. +            /* display message type iff it exists */
  12289. +            if (i == mt_n1_len)
  12290. +                dp += sprintf(dp, "Unknown message type N1 %x!\n", buf[3]);
  12291. +            else
  12292. +                dp += sprintf(dp, "call reference %d size %d message type %s\n",
  12293. +                          buf[2], size, mt_n1[i].descr);
  12294. +        }
  12295.  
  12296. -    /* display each information element */
  12297. -    buf += 4;
  12298. -    while (buf < bend) {
  12299. -        /* Is it a single octet information element? */
  12300. -        if (*buf & 0x80) {
  12301. -            switch ((*buf >> 4) & 7) {
  12302. -              case 1:
  12303. -                  dp += sprintf(dp, "  Shift %x\n", *buf & 0xf);
  12304. -                  break;
  12305. -              case 3:
  12306. -                  dp += sprintf(dp, "  Congestion level %x\n", *buf & 0xf);
  12307. -                  break;
  12308. -              case 5:
  12309. -                  dp += sprintf(dp, "  Repeat indicator %x\n", *buf & 0xf);
  12310. -                  break;
  12311. -              case 2:
  12312. -                  if (*buf == 0xa0) {
  12313. -                      dp += sprintf(dp, "  More data\n");
  12314. -                      break;
  12315. -                  }
  12316. -                  if (*buf == 0xa1) {
  12317. -                      dp += sprintf(dp, "  Sending complete\n");
  12318. -                  }
  12319. -                  break;
  12320. +        /* display each information element */
  12321. +        buf += 4;
  12322. +        while (buf < bend) {
  12323. +            /* Is it a single octet information element? */
  12324. +            if (*buf & 0x80) {
  12325. +                switch ((*buf >> 4) & 7) {
  12326. +                  case 1:
  12327. +                    dp += sprintf(dp, "  Shift %x\n", *buf & 0xf);
  12328. +                    cs_old = cs;
  12329. +                    cs = *buf & 7;
  12330. +                    cs_fest = *buf & 8;
  12331. +                    break;
  12332. +                  case 3:
  12333. +                    dp += sprintf(dp, "  Congestion level %x\n", *buf & 0xf);
  12334. +                    break;
  12335. +                  case 2:
  12336. +                    if (*buf == 0xa0) {
  12337. +                        dp += sprintf(dp, "  More data\n");
  12338. +                        break;
  12339. +                    }
  12340. +                    if (*buf == 0xa1) {
  12341. +                        dp += sprintf(dp, "  Sending complete\n");
  12342. +                    }
  12343. +                    break;
  12344.                    /* fall through */
  12345. -              default:
  12346. -                  dp += sprintf(dp, "  Reserved %x\n", *buf);
  12347. -                  break;
  12348. +                  default:
  12349. +                    dp += sprintf(dp, "  Reserved %x\n", *buf);
  12350. +                    break;
  12351. +                }
  12352. +                buf++;
  12353. +                continue;
  12354. +            }
  12355. +            /* No, locate it in the table */
  12356. +            if (cs == 0) {
  12357. +                for (i = 0; i < we_0_len; i++)
  12358. +                    if (*buf == we_0[i].nr)
  12359. +                        break;
  12360. +
  12361. +                /* When found, give appropriate msg */
  12362. +                if (i != we_0_len) {
  12363. +                    dp += sprintf(dp, "  %s\n", we_0[i].descr);
  12364. +                    dp += we_0[i].f(dp, buf);
  12365. +                } else
  12366. +                    dp += sprintf(dp, "  Codeset %d attribute %x attribute size %d\n", cs, *buf, buf[1]);
  12367. +            } else if (cs == 6) {
  12368. +                for (i = 0; i < we_6_len; i++)
  12369. +                    if (*buf == we_6[i].nr)
  12370. +                        break;
  12371. +
  12372. +                /* When found, give appropriate msg */
  12373. +                if (i != we_6_len) {
  12374. +                    dp += sprintf(dp, "  %s\n", we_6[i].descr);
  12375. +                    dp += we_6[i].f(dp, buf);
  12376. +                } else
  12377. +                    dp += sprintf(dp, "  Codeset %d attribute %x attribute size %d\n", cs, *buf, buf[1]);
  12378. +            } else
  12379. +                dp += sprintf(dp, "  Unknown Codeset %d attribute %x attribute size %d\n", cs, *buf, buf[1]);
  12380. +            /* Skip to next element */
  12381. +            if (cs_fest == 8) {
  12382. +                cs = cs_old;
  12383. +                cs_old = 0;
  12384. +                cs_fest = 0;
  12385.              }
  12386. -            buf++;
  12387. -            continue;
  12388. +            buf += buf[1] + 2;
  12389.          }
  12390. -        /* No, locate it in the table */
  12391. -        for (i = 0; i < IESIZE; i++)
  12392. -            if (*buf == ielist[i].nr)
  12393. +    } else {    /* EURO */
  12394. +        /* locate message type */
  12395. +        for (i = 0; i < MTSIZE; i++)
  12396. +            if (mtlist[i].nr == buf[3])
  12397.                  break;
  12398.  
  12399. -        /* When not found, give appropriate msg */
  12400. -        if (i != IESIZE) {
  12401. -            dp += sprintf(dp, "  %s\n", ielist[i].descr);
  12402. -            dp += ielist[i].f(dp, buf);
  12403. -        } else
  12404. -            dp += sprintf(dp, "  attribute %x attribute size %d\n", *buf, buf[1]);
  12405. +        /* display message type iff it exists */
  12406. +        if (i == MTSIZE)
  12407. +            dp += sprintf(dp, "Unknown message type %x!\n", buf[3]);
  12408. +        else
  12409. +            dp += sprintf(dp, "call reference %d size %d message type %s\n",
  12410. +        buf[2], size, mtlist[i].descr);
  12411.  
  12412. -        /* Skip to next element */
  12413. -        buf += buf[1] + 2;
  12414. -    }
  12415. +        /* display each information element */
  12416. +        buf += 4;
  12417. +        while (buf < bend) {
  12418. +            /* Is it a single octet information element? */
  12419. +            if (*buf & 0x80) {
  12420. +                switch ((*buf >> 4) & 7) {
  12421. +                  case 1:
  12422. +                    dp += sprintf(dp, "  Shift %x\n", *buf & 0xf);
  12423. +                    break;
  12424. +                  case 3:
  12425. +                    dp += sprintf(dp, "  Congestion level %x\n", *buf & 0xf);
  12426. +                    break;
  12427. +                  case 5:
  12428. +                    dp += sprintf(dp, "  Repeat indicator %x\n", *buf & 0xf);
  12429. +                    break;
  12430. +                  case 2:
  12431. +                    if (*buf == 0xa0) {
  12432. +                        dp += sprintf(dp, "  More data\n");
  12433. +                        break;
  12434. +                    }
  12435. +                    if (*buf == 0xa1) {
  12436. +                        dp += sprintf(dp, "  Sending complete\n");
  12437. +                    }
  12438. +                    break;
  12439. +                  /* fall through */
  12440. +                  default:
  12441. +                    dp += sprintf(dp, "  Reserved %x\n", *buf);
  12442. +                    break;
  12443. +                }
  12444. +                buf++;
  12445. +                continue;
  12446. +            }
  12447. +            /* No, locate it in the table */
  12448. +            for (i = 0; i < IESIZE; i++)
  12449. +                if (*buf == ielist[i].nr)
  12450. +                    break;
  12451. +
  12452. +            /* When not found, give appropriate msg */
  12453. +            if (i != IESIZE) {
  12454. +                dp += sprintf(dp, "  %s\n", ielist[i].descr);
  12455. +                dp += ielist[i].f(dp, buf);
  12456. +            } else
  12457. +                dp += sprintf(dp, "  attribute %x attribute size %d\n", *buf, buf[1]);
  12458.  
  12459. +            /* Skip to next element */
  12460. +            buf += buf[1] + 2;
  12461. +        }
  12462. +    }
  12463.      dp += sprintf(dp, "\n");
  12464.      teles_putstatus(sp->dlogspace);
  12465.  }
  12466. diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/teles.h linux/drivers/isdn/teles/teles.h
  12467. --- pre2.0.5/linux/drivers/isdn/teles/teles.h    Sun Apr 21 19:22:07 1996
  12468. +++ linux/drivers/isdn/teles/teles.h    Sun May 19 15:29:31 1996
  12469. @@ -1,6 +1,9 @@
  12470. -/* $Id: teles.h,v 1.1 1996/04/13 10:29:00 fritz Exp $
  12471. +/* $Id: teles.h,v 1.2 1996/04/30 21:52:04 isdn4dev Exp $
  12472.   *
  12473.   * $Log: teles.h,v $
  12474. + * Revision 1.2  1996/04/30 21:52:04  isdn4dev
  12475. + * SPV for 1TR6 - Karsten
  12476. + *
  12477.   * Revision 1.1  1996/04/13 10:29:00  fritz
  12478.   * Initial revision
  12479.   *
  12480. @@ -288,6 +291,7 @@
  12481.      int             chargeinfo;  /* Charge Info - only for 1tr6 in
  12482.                        * the moment 
  12483.                        */
  12484. +    int        spv;         /* SPV Flag */
  12485.  };
  12486.  
  12487.  struct PStack {
  12488. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/8390.c linux/drivers/net/8390.c
  12489. --- pre2.0.5/linux/drivers/net/8390.c    Fri May 17 15:32:15 1996
  12490. +++ linux/drivers/net/8390.c    Sat May 18 11:15:09 1996
  12491. @@ -617,7 +617,7 @@
  12492.      /* 
  12493.       * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
  12494.       * Early datasheets said to poll the reset bit, but now they say that
  12495. -     * it "is not a reliable indicator and subequently should be ignored."
  12496. +     * it "is not a reliable indicator and subsequently should be ignored."
  12497.       * We wait at least 10ms.
  12498.       */
  12499.      wait_start_time = jiffies;
  12500. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/dummy.c linux/drivers/net/dummy.c
  12501. --- pre2.0.5/linux/drivers/net/dummy.c    Tue May  7 16:22:27 1996
  12502. +++ linux/drivers/net/dummy.c    Sat May 18 20:08:04 1996
  12503. @@ -58,7 +58,6 @@
  12504.  static struct enet_statistics *dummy_get_stats(struct device *dev);
  12505.  #endif
  12506.  
  12507. -#ifdef MODULE
  12508.  static int dummy_open(struct device *dev)
  12509.  {
  12510.      MOD_INC_USE_COUNT;
  12511. @@ -70,7 +69,6 @@
  12512.      MOD_DEC_USE_COUNT;
  12513.      return 0;
  12514.  }
  12515. -#endif
  12516.  
  12517.  
  12518.  int dummy_init(struct device *dev)
  12519. @@ -89,10 +87,9 @@
  12520.      memset(dev->priv, 0, sizeof(struct enet_statistics));
  12521.      dev->get_stats        = dummy_get_stats;
  12522.  #endif
  12523. -#ifdef MODULE
  12524. +
  12525.      dev->open = &dummy_open;
  12526.      dev->stop = &dummy_close;
  12527. -#endif
  12528.  
  12529.      /* Fill in the fields of the device structure with ethernet-generic values. */
  12530.      ether_setup(dev);
  12531. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/loopback.c linux/drivers/net/loopback.c
  12532. --- pre2.0.5/linux/drivers/net/loopback.c    Tue May  7 16:22:29 1996
  12533. +++ linux/drivers/net/loopback.c    Sat May 18 11:58:33 1996
  12534. @@ -17,6 +17,9 @@
  12535.   *        Larry McVoy    :    Tiny tweak to double performance
  12536.   *        Alan Cox    :    Backed out LMV's tweak - the linux mm
  12537.   *                    can't take it...
  12538. + *              Michael Griffith:       Don't bother computing the checksums
  12539. + *                                      on packets received on the loopback
  12540. + *                                      interface.
  12541.   *
  12542.   *        This program is free software; you can redistribute it and/or
  12543.   *        modify it under the terms of the GNU General Public License
  12544. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/plip.c linux/drivers/net/plip.c
  12545. --- pre2.0.5/linux/drivers/net/plip.c    Mon Apr  8 19:01:43 1996
  12546. +++ linux/drivers/net/plip.c    Sun May 19 14:57:51 1996
  12547. @@ -271,6 +271,7 @@
  12548.      dev->get_stats         = plip_get_stats;
  12549.      dev->set_config        = plip_config;
  12550.      dev->do_ioctl        = plip_ioctl;
  12551. +    dev->tx_queue_len    = 10;
  12552.      dev->flags            = IFF_POINTOPOINT|IFF_NOARP;
  12553.  
  12554.      /* Set the private structure */
  12555. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/ppp.c linux/drivers/net/ppp.c
  12556. --- pre2.0.5/linux/drivers/net/ppp.c    Tue May  7 16:22:30 1996
  12557. +++ linux/drivers/net/ppp.c    Fri May 17 18:43:34 1996
  12558. @@ -400,6 +400,7 @@
  12559.      dev->get_stats          = ppp_dev_stats;
  12560.      dev->do_ioctl          = ppp_dev_ioctl;
  12561.      dev->addr_len          = 0;
  12562. +    dev->tx_queue_len     = 10;
  12563.      dev->type          = ARPHRD_PPP;
  12564.  
  12565.      for (indx = 0; indx < DEV_NUMBUFFS; indx++)
  12566. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/sdla.c linux/drivers/net/sdla.c
  12567. --- pre2.0.5/linux/drivers/net/sdla.c    Fri May 17 15:32:15 1996
  12568. +++ linux/drivers/net/sdla.c    Sat May 18 11:15:09 1996
  12569. @@ -367,7 +367,7 @@
  12570.                       state = "active";
  12571.                    else
  12572.                    {
  12573. -                     sprintf(line, "uknown status: %02X", pstatus->flags);
  12574. +                     sprintf(line, "unknown status: %02X", pstatus->flags);
  12575.                       state = line;
  12576.                    }
  12577.              printk(KERN_INFO "%s: DLCI %i: %s.\n", dev->name, pstatus->dlci, state);
  12578. diff -u --recursive --new-file pre2.0.5/linux/drivers/net/slhc.c linux/drivers/net/slhc.c
  12579. --- pre2.0.5/linux/drivers/net/slhc.c    Tue May  7 16:22:31 1996
  12580. +++ linux/drivers/net/slhc.c    Sun May 19 13:29:22 1996
  12581. @@ -79,10 +79,7 @@
  12582.  #include <linux/mm.h>
  12583.  #include <net/checksum.h>
  12584.  #include <net/slhc_vj.h>
  12585. -
  12586. -#ifdef __alpha__
  12587. -# include <asm/unaligned.h>
  12588. -#endif
  12589. +#include <asm/unaligned.h>
  12590.  
  12591.  int last_retran;
  12592.  
  12593. @@ -619,11 +616,8 @@
  12594.        cp += (ip->ihl - 5) * 4;
  12595.      }
  12596.  
  12597. -#ifdef __alpha__
  12598. -    stw_u(ip_fast_csum(icp, ip->ihl), &((struct iphdr *)icp)->check);
  12599. -#else
  12600. -    ((struct iphdr *)icp)->check = ip_fast_csum(icp, ((struct iphdr*)icp)->ihl);
  12601. -#endif
  12602. +    put_unaligned(ip_fast_csum(icp, ip->ihl),
  12603. +              &((struct iphdr *)icp)->check);
  12604.  
  12605.      memcpy(cp, thp, 20);
  12606.      cp += 20;
  12607. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/Config.in linux/drivers/scsi/Config.in
  12608. --- pre2.0.5/linux/drivers/scsi/Config.in    Sat May 11 10:42:05 1996
  12609. +++ linux/drivers/scsi/Config.in    Sat May 18 11:58:33 1996
  12610. @@ -42,7 +42,12 @@
  12611.  fi
  12612.  dep_tristate 'Always IN2000 SCSI support' CONFIG_SCSI_IN2000 $CONFIG_SCSI
  12613.  dep_tristate 'PAS16 SCSI support' CONFIG_SCSI_PAS16 $CONFIG_SCSI
  12614. -dep_tristate 'QLOGIC SCSI support' CONFIG_SCSI_QLOGIC $CONFIG_SCSI
  12615. +dep_tristate 'Qlogic FAS SCSI support' CONFIG_SCSI_QLOGIC_FAS $CONFIG_SCSI
  12616. +if [ "$CONFIG_PCI" = "y" ]; then
  12617. +  if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
  12618. +     dep_tristate 'Qlogic ISP SCSI support (EXPERIMENTAL)' CONFIG_SCSI_QLOGIC_ISP $CONFIG_SCSI
  12619. +  fi
  12620. +fi
  12621.  dep_tristate 'Seagate ST-02 and Future Domain TMC-8xx SCSI support' CONFIG_SCSI_SEAGATE $CONFIG_SCSI
  12622.  dep_tristate 'Trantor T128/T128F/T228 SCSI support' CONFIG_SCSI_T128 $CONFIG_SCSI
  12623.  dep_tristate 'UltraStor SCSI support' CONFIG_SCSI_ULTRASTOR $CONFIG_SCSI
  12624. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/Makefile linux/drivers/scsi/Makefile
  12625. --- pre2.0.5/linux/drivers/scsi/Makefile    Sat Apr 27 15:19:56 1996
  12626. +++ linux/drivers/scsi/Makefile    Sat May 18 11:58:33 1996
  12627. @@ -124,13 +124,23 @@
  12628.    endif
  12629.  endif
  12630.  
  12631. -ifeq ($(CONFIG_SCSI_QLOGIC),y)
  12632. -L_OBJS += qlogic.o
  12633. +ifeq ($(CONFIG_SCSI_QLOGIC_FAS),y)
  12634. +L_OBJS += qlogicfas.o
  12635.  else
  12636. -  ifeq ($(CONFIG_SCSI_QLOGIC),m)
  12637. -  M_OBJS += qlogic.o
  12638. +  ifeq ($(CONFIG_SCSI_QLOGIC_FAS),m)
  12639. +  M_OBJS += qlogicfas.o
  12640.    endif
  12641.  endif
  12642. +
  12643. +
  12644. +ifeq ($(CONFIG_SCSI_QLOGIC_ISP),y)
  12645. +L_OBJS += qlogicisp.o 
  12646. +else
  12647. +  ifeq ($(CONFIG_SCSI_QLOGIC_ISP),m)
  12648. +  M_OBJS += qlogicisp.o 
  12649. +  endif
  12650. +endif
  12651. +
  12652.  
  12653.  ifeq ($(CONFIG_SCSI_AHA152X),y)
  12654.  L_OBJS += aha152x.o
  12655. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/README.qlogic linux/drivers/scsi/README.qlogic
  12656. --- pre2.0.5/linux/drivers/scsi/README.qlogic    Sat Nov 26 18:22:36 1994
  12657. +++ linux/drivers/scsi/README.qlogic    Thu Jan  1 02:00:00 1970
  12658. @@ -1,65 +0,0 @@
  12659. -
  12660. -RANDOM NOTES ON THE QLOGIC SCSI DRIVER
  12661. -
  12662. -This driver does NOT support the PCI version.  It is a different chip.
  12663. -
  12664. -It DOES support the ISA, VLB, and PCMCIA versions of the Qlogic FastSCSI!
  12665. -cards as well as any other card based on the chip (including the Control
  12666. -Concepts SCSI/IDE/SIO/PIO/FDC cards).
  12667. -
  12668. -PCMCIA SUPPORT
  12669. -
  12670. -This currently only works if the card is enabled first from DOS.  This means
  12671. -you will have to load your socket and card services, and QL41DOS.SYS and
  12672. -QL40ENBL.SYS.  These are a minimum, but loading the rest of the modules
  12673. -won't interfere with the operation.  The next thing to do is load the kernel
  12674. -without resetting the hardware, which can be a simple ctrl-alt-delete with
  12675. -a boot floppy, or by using loadlin with the kernel image accessible from
  12676. -DOS.  If you are using the Linux PCMCIA driver, you will have to adjust
  12677. -it or otherwise stop it from configuring the card.
  12678. -
  12679. -I am working with the PCMCIA group to make it more flexible, but that may
  12680. -take a while.
  12681. -
  12682. -ALL CARDS
  12683. -
  12684. -The top of the qlogic.c file has a number of defines that controls 
  12685. -configuration.  As shipped, it provides a balance between speed and
  12686. -function.  If there are any problems, try setting SLOW_CABLE to 1, and
  12687. -then try changing USE_IRQ and TURBO_PDMA to zero.  If you are familiar 
  12688. -with SCSI, there are other settings which can tune the bus.
  12689. -
  12690. -It may be a good idea to enable RESET_AT_START, especially if the devices
  12691. -may not have been just powered up, or if you are restarting after a crash,
  12692. -since they may be busy trying to complete the last command or something.
  12693. -It comes up faster if this is set to zero, and if you have reliable
  12694. -hardware and connections it may be more useful to not reset things.
  12695. -
  12696. -SOME TROUBLESHOOTING TIPS
  12697. -
  12698. -Make sure it works properly under DOS.  You should also do an initial FDISK
  12699. -on a new drive if you want partitions.
  12700. -
  12701. -Don't enable all the speedups first.  If anything is wrong, they will make
  12702. -any problem worse.
  12703. -
  12704. -IMPORTANT
  12705. -
  12706. -The best way to test if your cables, termination, etc. are good is to copy
  12707. -a very big file (e.g. a doublespace container file, or a very large executable
  12708. -or archive).  It should be at least 5 megabytes, but you can do multiple tests
  12709. -on smaller files.  Then do a COMP to verify that the file copied properly.
  12710. -(Turn off all caching when doing these tests, otherwise you will test your
  12711. -RAM and not the files).  Then do 10 COMPs, comparing the same file on the
  12712. -SCSI hard drive, i.e. "COMP realbig.doc realbig.doc".  Then do it after the
  12713. -computer gets warm.
  12714. -
  12715. -I noticed my system which seems to work 100% would fail this test if the
  12716. -computer was left on for a few hours.  It was worse with longer cables, and
  12717. -more devices on the SCSI bus.  What seems to happen is that it gets a false
  12718. -ACK causing an extra byte to be inserted into the stream (and this is not
  12719. -detected).  This can be caused by bad termination (the ACK can be reflected),
  12720. -or by noise when the chips work less well because of the heat, or when cables
  12721. -get too long for the speed.
  12722. -
  12723. -If it doesn't work under DOS, it won't work under Linux.
  12724. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/README.qlogicfas linux/drivers/scsi/README.qlogicfas
  12725. --- pre2.0.5/linux/drivers/scsi/README.qlogicfas    Thu Jan  1 02:00:00 1970
  12726. +++ linux/drivers/scsi/README.qlogicfas    Sat May 18 11:58:33 1996
  12727. @@ -0,0 +1,73 @@
  12728. +
  12729. +RANDOM NOTES ON THE QLOGICFAS SCSI DRIVER
  12730. +
  12731. +This driver supports the Qlogic FASXXX family of chips.  This driver
  12732. +only works with the ISA, VLB, and PCMCIA versions of the Qlogic
  12733. +FastSCSI!  cards as well as any other card based on the FASXX chip
  12734. +(including the Control Concepts SCSI/IDE/SIO/PIO/FDC cards).
  12735. +
  12736. +This driver does NOT support the PCI version.  Support for these PCI
  12737. +Qlogic boards:
  12738. +
  12739. +    IQ-PCI
  12740. +    IQ-PCI-10
  12741. +    IQ-PCI-D
  12742. +
  12743. +is provided by the qlogicisp.c driver.   Check README.qlogicisp for details.
  12744. +
  12745. +PCMCIA SUPPORT
  12746. +
  12747. +This currently only works if the card is enabled first from DOS.  This means
  12748. +you will have to load your socket and card services, and QL41DOS.SYS and
  12749. +QL40ENBL.SYS.  These are a minimum, but loading the rest of the modules
  12750. +won't interfere with the operation.  The next thing to do is load the kernel
  12751. +without resetting the hardware, which can be a simple ctrl-alt-delete with
  12752. +a boot floppy, or by using loadlin with the kernel image accessible from
  12753. +DOS.  If you are using the Linux PCMCIA driver, you will have to adjust
  12754. +it or otherwise stop it from configuring the card.
  12755. +
  12756. +I am working with the PCMCIA group to make it more flexible, but that may
  12757. +take a while.
  12758. +
  12759. +ALL CARDS
  12760. +
  12761. +The top of the qlogic.c file has a number of defines that controls 
  12762. +configuration.  As shipped, it provides a balance between speed and
  12763. +function.  If there are any problems, try setting SLOW_CABLE to 1, and
  12764. +then try changing USE_IRQ and TURBO_PDMA to zero.  If you are familiar 
  12765. +with SCSI, there are other settings which can tune the bus.
  12766. +
  12767. +It may be a good idea to enable RESET_AT_START, especially if the devices
  12768. +may not have been just powered up, or if you are restarting after a crash,
  12769. +since they may be busy trying to complete the last command or something.
  12770. +It comes up faster if this is set to zero, and if you have reliable
  12771. +hardware and connections it may be more useful to not reset things.
  12772. +
  12773. +SOME TROUBLESHOOTING TIPS
  12774. +
  12775. +Make sure it works properly under DOS.  You should also do an initial FDISK
  12776. +on a new drive if you want partitions.
  12777. +
  12778. +Don't enable all the speedups first.  If anything is wrong, they will make
  12779. +any problem worse.
  12780. +
  12781. +IMPORTANT
  12782. +
  12783. +The best way to test if your cables, termination, etc. are good is to copy
  12784. +a very big file (e.g. a doublespace container file, or a very large executable
  12785. +or archive).  It should be at least 5 megabytes, but you can do multiple tests
  12786. +on smaller files.  Then do a COMP to verify that the file copied properly.
  12787. +(Turn off all caching when doing these tests, otherwise you will test your
  12788. +RAM and not the files).  Then do 10 COMPs, comparing the same file on the
  12789. +SCSI hard drive, i.e. "COMP realbig.doc realbig.doc".  Then do it after the
  12790. +computer gets warm.
  12791. +
  12792. +I noticed my system which seems to work 100% would fail this test if the
  12793. +computer was left on for a few hours.  It was worse with longer cables, and
  12794. +more devices on the SCSI bus.  What seems to happen is that it gets a false
  12795. +ACK causing an extra byte to be inserted into the stream (and this is not
  12796. +detected).  This can be caused by bad termination (the ACK can be reflected),
  12797. +or by noise when the chips work less well because of the heat, or when cables
  12798. +get too long for the speed.
  12799. +
  12800. +Remember, if it doesn't work under DOS, it probably won't work under Linux.
  12801. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/README.qlogicisp linux/drivers/scsi/README.qlogicisp
  12802. --- pre2.0.5/linux/drivers/scsi/README.qlogicisp    Thu Jan  1 02:00:00 1970
  12803. +++ linux/drivers/scsi/README.qlogicisp    Sat May 18 11:58:33 1996
  12804. @@ -0,0 +1,26 @@
  12805. +Notes for the QLogic ISP1020 PCI SCSI Driver revision 0.6.
  12806. +
  12807. +This software should be considered ***BETA***.
  12808. +
  12809. +Be sure to include PCI BIOS support when rebuilding the kernel.
  12810. +
  12811. +The QLogic Corporation produces several PCI SCSI adapters:
  12812. +
  12813. +    PCI-basic
  12814. +    IQ-PCI
  12815. +    IQ-PCI-10
  12816. +    IQ-PCI-D
  12817. +
  12818. +This driver should work for all these adpaters, except for the PCI-basic which
  12819. +does not use the ISP1020 chip.  If you have the QLogic PCI-basic there is a
  12820. +an am53c974 driver that supports your adapter.
  12821. +
  12822. +Much thanks to QLogic's tech support for providing the latest ISP1020 firmware,
  12823. +and for taking the time to review my code.
  12824. +
  12825. +Erik Moe
  12826. +ehm@cris.com
  12827. +
  12828. +Revised:
  12829. +Michael A. Griffith
  12830. +grif@cs.ucr.edu
  12831. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/atari_NCR5380.c linux/drivers/scsi/atari_NCR5380.c
  12832. --- pre2.0.5/linux/drivers/scsi/atari_NCR5380.c    Fri May 17 15:32:16 1996
  12833. +++ linux/drivers/scsi/atari_NCR5380.c    Sat May 18 11:15:09 1996
  12834. @@ -631,7 +631,7 @@
  12835.  
  12836.  #else /* !NDEBUG */
  12837.  
  12838. -/* dummys... */
  12839. +/* dummies... */
  12840.  __inline__ void NCR5380_print(struct Scsi_Host *instance) { };
  12841.  __inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
  12842.  
  12843. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/atari_scsi.h linux/drivers/scsi/atari_scsi.h
  12844. --- pre2.0.5/linux/drivers/scsi/atari_scsi.h    Fri May 17 15:32:16 1996
  12845. +++ linux/drivers/scsi/atari_scsi.h    Sat May 18 11:15:09 1996
  12846. @@ -107,7 +107,7 @@
  12847.   *  MAIN -> NCR5380_main() control flow
  12848.   *  NDAT -> no data-out phase
  12849.   *  NWR  -> no write commands
  12850. - *  PIO  -> PIO tansfers
  12851. + *  PIO  -> PIO transfers
  12852.   *  PDMA -> pseudo DMA (unused on Atari)
  12853.   *  QU   -> queues
  12854.   *  RSL  -> reselections
  12855. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/constants.c linux/drivers/scsi/constants.c
  12856. --- pre2.0.5/linux/drivers/scsi/constants.c    Thu Dec 14 06:44:58 1995
  12857. +++ linux/drivers/scsi/constants.c    Sat May 18 22:18:56 1996
  12858. @@ -365,13 +365,29 @@
  12859.  
  12860.  #if (CONSTANTS & CONST_SENSE)
  12861.  static const char *snstext[] = {
  12862. -    "None","Recovered Error","Not Ready","Medium Error","Hardware Error",
  12863. -    "Illegal Request","Unit Attention","Data Protect","Blank Check",
  12864. -    "Key=9","Copy Aborted","Aborted Command","End-Of-Medium",
  12865. -    "Volume Overflow", "Miscompare", "Key=15"};
  12866. +    "None",                     /* There is no sense information */
  12867. +    "Recovered Error",          /* The last command completed successfully
  12868. +                                   but used error correction */
  12869. +    "Not Ready",                /* The addressed target is not ready */
  12870. +    "Medium Error",             /* Data error detected on the medium */
  12871. +    "Hardware Error",           /* Controller or device failure */
  12872. +    "Illegal Request",
  12873. +    "Unit Attention",           /* Removable medium was changed, or
  12874. +                                   the target has been reset */
  12875. +    "Data Protect",             /* Access to the data is blocked */
  12876. +    "Blank Check",              /* Reached unexpected written or unwritten
  12877. +                                   region of the medium */
  12878. +    "Key=9",                    /* Vendor specific */
  12879. +    "Copy Aborted",             /* COPY or COMPARE was aborted */
  12880. +    "Aborted Command",          /* The target aborted the command */
  12881. +    "Equal",                    /* A SEARCH DATA command found data equal */
  12882. +    "Volume Overflow",          /* Medium full with still data to be written */
  12883. +    "Miscompare",               /* Source data and data on the medium
  12884. +                                   do not agree */
  12885. +    "Key=15"                    /* Reserved */
  12886. +};
  12887.  #endif
  12888.  
  12889. -
  12890.  /* Print sense information */
  12891.  void print_sense(const char * devclass, Scsi_Cmnd * SCpnt)
  12892.  {
  12893. @@ -384,23 +400,29 @@
  12894.      code = sense_buffer[0] & 0xf;
  12895.      valid = sense_buffer[0] & 0x80;
  12896.      
  12897. -    if (sense_class == 7) { 
  12898. +    if (sense_class == 7) {    /* extended sense data */
  12899.      s = sense_buffer[7] + 8;
  12900. -    if(s > sizeof(SCpnt->sense_buffer)) s = sizeof(SCpnt->sense_buffer);
  12901. +    if(s > sizeof(SCpnt->sense_buffer))
  12902. +           s = sizeof(SCpnt->sense_buffer);
  12903.      
  12904.      if (!valid)
  12905.          printk("extra data not valid ");
  12906.      
  12907. -    if (sense_buffer[2] & 0x80) printk( "FMK ");
  12908. -    if (sense_buffer[2] & 0x40) printk( "EOM ");
  12909. -    if (sense_buffer[2] & 0x20) printk( "ILI ");
  12910. +    if (sense_buffer[2] & 0x80)
  12911. +           printk( "FMK ");    /* current command has read a filemark */
  12912. +    if (sense_buffer[2] & 0x40)
  12913. +           printk( "EOM ");    /* end-of-medium condition exists */
  12914. +    if (sense_buffer[2] & 0x20)
  12915. +           printk( "ILI ");    /* incorrect block length requested */
  12916.      
  12917.      switch (code) {
  12918.      case 0x0:
  12919. -        error = "Current";
  12920. +        error = "Current";    /* error concerns current command */
  12921.          break;
  12922.      case 0x1:
  12923. -        error = "Deferred";
  12924. +        error = "Deferred";    /* error concerns some earlier command */
  12925. +                /* e.g., an earlier write to disk cache succeeded, but
  12926. +                   now the disk discovers that it cannot write the data */
  12927.          break;
  12928.      default:
  12929.          error = "Invalid";
  12930. @@ -437,7 +459,15 @@
  12931.  #else
  12932.      printk("ASC=%2x ASCQ=%2x\n", sense_buffer[12], sense_buffer[13]);
  12933.  #endif
  12934. -    } else { 
  12935. +    } else {    /* non-extended sense data */
  12936. +
  12937. +         /*
  12938. +          * Standard says:
  12939. +          *    sense_buffer[0] & 0200 : address valid
  12940. +          *    sense_buffer[0] & 0177 : vendor-specific error code
  12941. +          *    sense_buffer[1] & 0340 : vendor-specific
  12942. +          *    sense_buffer[1..3] : 21-bit logical block address
  12943. +          */
  12944.      
  12945.  #if (CONSTANTS & CONST_SENSE)
  12946.      if (sense_buffer[0] < 15)
  12947. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c
  12948. --- pre2.0.5/linux/drivers/scsi/hosts.c    Tue May  7 16:22:34 1996
  12949. +++ linux/drivers/scsi/hosts.c    Sat May 18 11:58:34 1996
  12950. @@ -109,8 +109,12 @@
  12951.  #include "pas16.h"
  12952.  #endif
  12953.  
  12954. -#ifdef CONFIG_SCSI_QLOGIC
  12955. -#include "qlogic.h"
  12956. +#ifdef CONFIG_SCSI_QLOGIC_FAS
  12957. +#include "qlogicfas.h"
  12958. +#endif
  12959. +
  12960. +#ifdef CONFIG_SCSI_QLOGIC_ISP
  12961. +#include "qlogicisp.h"
  12962.  #endif
  12963.  
  12964.  #ifdef CONFIG_SCSI_SEAGATE
  12965. @@ -250,8 +254,11 @@
  12966.  #ifdef CONFIG_SCSI_NCR53C406A    /* 53C406A should come before QLOGIC */
  12967.      NCR53c406a,
  12968.  #endif
  12969. -#ifdef CONFIG_SCSI_QLOGIC
  12970. -    QLOGIC,
  12971. +#ifdef CONFIG_SCSI_QLOGIC_FAS
  12972. +    QLOGICFAS,
  12973. +#endif
  12974. +#ifdef CONFIG_SCSI_QLOGIC_ISP
  12975. +    QLOGICISP,
  12976.  #endif
  12977.  #ifdef CONFIG_SCSI_PAS16
  12978.      MV_PAS16,
  12979. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/hosts.h linux/drivers/scsi/hosts.h
  12980. --- pre2.0.5/linux/drivers/scsi/hosts.h    Mon Apr 15 12:20:19 1996
  12981. +++ linux/drivers/scsi/hosts.h    Sat May 18 22:19:00 1996
  12982. @@ -235,7 +235,7 @@
  12983.   * Scsi_Host_Template, except that we have one entry for each
  12984.   * actual physical host adapter on the system, stored as a linked
  12985.   * list.  Note that if there are 2 aha1542 boards, then there will
  12986. - * be two Scsi_Host entries, but only 1 Scsi_Host_Template entries.
  12987. + * be two Scsi_Host entries, but only 1 Scsi_Host_Template entry.
  12988.   */
  12989.  
  12990.  struct Scsi_Host
  12991. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogic.c linux/drivers/scsi/qlogic.c
  12992. --- pre2.0.5/linux/drivers/scsi/qlogic.c    Fri Mar  1 07:50:53 1996
  12993. +++ linux/drivers/scsi/qlogic.c    Thu Jan  1 02:00:00 1970
  12994. @@ -1,678 +0,0 @@
  12995. -/*----------------------------------------------------------------*/
  12996. -/*
  12997. -   Qlogic linux driver - work in progress. No Warranty express or implied.
  12998. -   Use at your own risk.  Support Tort Reform so you won't have to read all
  12999. -   these silly disclaimers.
  13000. -
  13001. -   Copyright 1994, Tom Zerucha.   
  13002. -   zerucha@shell.portal.com
  13003. -
  13004. -   Additional Code, and much appreciated help by
  13005. -   Michael A. Griffith
  13006. -   grif@cs.ucr.edu
  13007. -
  13008. -   Thanks to Eric Youngdale and Dave Hinds for loadable module and PCMCIA
  13009. -   help respectively, and for suffering through my foolishness during the
  13010. -   debugging process.
  13011. -
  13012. -   Reference Qlogic FAS408 Technical Manual, 53408-510-00A, May 10, 1994
  13013. -   (you can reference it, but it is incomplete and inaccurate in places)
  13014. -
  13015. -   Version 0.43 4/6/95 - kernel 1.2.0+, pcmcia 2.5.4+
  13016. -
  13017. -   Functions as standalone, loadable, and PCMCIA driver, the latter from
  13018. -   Dave Hind's PCMCIA package.
  13019. -
  13020. -   Redistributable under terms of the GNU Public License
  13021. -
  13022. -*/
  13023. -/*----------------------------------------------------------------*/
  13024. -/* Configuration */
  13025. -
  13026. -/* Set the following to 2 to use normal interrupt (active high/totempole-
  13027. -   tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open
  13028. -   drain */
  13029. -#define QL_INT_ACTIVE_HIGH 2
  13030. -
  13031. -/* Set the following to 1 to enable the use of interrupts.  Note that 0 tends
  13032. -   to be more stable, but slower (or ties up the system more) */
  13033. -#define QL_USE_IRQ 1
  13034. -
  13035. -/* Set the following to max out the speed of the PIO PseudoDMA transfers,
  13036. -   again, 0 tends to be slower, but more stable.  */
  13037. -#define QL_TURBO_PDMA 1
  13038. -
  13039. -/* This should be 1 to enable parity detection */
  13040. -#define QL_ENABLE_PARITY 1
  13041. -
  13042. -/* This will reset all devices when the driver is initialized (during bootup).
  13043. -   The other linux drivers don't do this, but the DOS drivers do, and after
  13044. -   using DOS or some kind of crash or lockup this will bring things back
  13045. -   without requiring a cold boot.  It does take some time to recover from a
  13046. -   reset, so it is slower, and I have seen timeouts so that devices weren't
  13047. -   recognized when this was set. */
  13048. -#define QL_RESET_AT_START 0
  13049. -
  13050. -/* crystal frequency in megahertz (for offset 5 and 9)
  13051. -   Please set this for your card.  Most Qlogic cards are 40 Mhz.  The
  13052. -   Control Concepts ISA (not VLB) is 24 Mhz */
  13053. -#define XTALFREQ    40
  13054. -
  13055. -/**********/
  13056. -/* DANGER! modify these at your own risk */
  13057. -/* SLOWCABLE can usually be reset to zero if you have a clean setup and
  13058. -   proper termination.  The rest are for synchronous transfers and other
  13059. -   advanced features if your device can transfer faster than 5Mb/sec.
  13060. -   If you are really curious, email me for a quick howto until I have
  13061. -   something official */
  13062. -/**********/
  13063. -
  13064. -/*****/
  13065. -/* config register 1 (offset 8) options */
  13066. -/* This needs to be set to 1 if your cabling is long or noisy */
  13067. -#define SLOWCABLE 1
  13068. -
  13069. -/*****/
  13070. -/* offset 0xc */
  13071. -/* This will set fast (10Mhz) synchronous timing when set to 1
  13072. -   For this to have an effect, FASTCLK must also be 1 */
  13073. -#define FASTSCSI 0
  13074. -
  13075. -/* This when set to 1 will set a faster sync transfer rate */
  13076. -#define FASTCLK 0
  13077. -/*(XTALFREQ>25?1:0)*/
  13078. -
  13079. -/*****/
  13080. -/* offset 6 */
  13081. -/* This is the sync transfer divisor, XTALFREQ/X will be the maximum
  13082. -   achievable data rate (assuming the rest of the system is capable
  13083. -   and set properly) */
  13084. -#define SYNCXFRPD 5
  13085. -/*(XTALFREQ/5)*/
  13086. -
  13087. -/*****/
  13088. -/* offset 7 */
  13089. -/* This is the count of how many synchronous transfers can take place
  13090. -    i.e. how many reqs can occur before an ack is given.
  13091. -    The maximum value for this is 15, the upper bits can modify
  13092. -    REQ/ACK assertion and deassertion during synchronous transfers
  13093. -    If this is 0, the bus will only transfer asynchronously */
  13094. -#define SYNCOFFST 0
  13095. -/* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles
  13096. -    of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will
  13097. -    cause the deassertion to be early by 1/2 clock.  Bits 5&4 control
  13098. -    the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */
  13099. -
  13100. -/*----------------------------------------------------------------*/
  13101. -#ifdef PCMCIA
  13102. -#undef QL_INT_ACTIVE_HIGH
  13103. -#define QL_INT_ACTIVE_HIGH 0
  13104. -#define MODULE
  13105. -#endif 
  13106. -
  13107. -#include <linux/module.h>
  13108. -
  13109. -#ifdef PCMCIA
  13110. -#undef MODULE
  13111. -#endif 
  13112. -
  13113. -#include <linux/blk.h>    /* to get disk capacity */
  13114. -#include <linux/kernel.h>
  13115. -#include <linux/string.h>
  13116. -#include <linux/ioport.h>
  13117. -#include <linux/sched.h>
  13118. -#include <linux/proc_fs.h>
  13119. -#include <linux/unistd.h>
  13120. -#include <asm/io.h>
  13121. -#include <asm/irq.h>
  13122. -#include "sd.h"
  13123. -#include "hosts.h"
  13124. -#include "qlogic.h"
  13125. -#include<linux/stat.h>
  13126. -
  13127. -struct proc_dir_entry proc_scsi_qlogic = {
  13128. -    PROC_SCSI_QLOGIC, 6, "qlogic",
  13129. -    S_IFDIR | S_IRUGO | S_IXUGO, 2
  13130. -};
  13131. -
  13132. -/*----------------------------------------------------------------*/
  13133. -/* driver state info, local to driver */
  13134. -static int        qbase = 0;    /* Port */
  13135. -static int        qinitid;    /* initiator ID */
  13136. -static int        qabort;    /* Flag to cause an abort */
  13137. -static int        qlirq = -1;    /* IRQ being used */
  13138. -static char        qinfo[80];    /* description */
  13139. -static Scsi_Cmnd   *qlcmd;    /* current command being processed */
  13140. -
  13141. -static int        qlcfg5 = ( XTALFREQ << 5 );    /* 15625/512 */
  13142. -static int        qlcfg6 = SYNCXFRPD;
  13143. -static int        qlcfg7 = SYNCOFFST;
  13144. -static int        qlcfg8 = ( SLOWCABLE << 7 ) | ( QL_ENABLE_PARITY << 4 );
  13145. -static int        qlcfg9 = ( ( XTALFREQ + 4 ) / 5 );
  13146. -static int        qlcfgc = ( FASTCLK << 3 ) | ( FASTSCSI << 4 );
  13147. -
  13148. -/*----------------------------------------------------------------*/
  13149. -/* The qlogic card uses two register maps - These macros select which one */
  13150. -#define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd ))
  13151. -#define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | QL_INT_ACTIVE_HIGH , qbase + 0xd ))
  13152. -
  13153. -/* following is watchdog timeout in microseconds */
  13154. -#define WATCHDOG 5000000
  13155. -
  13156. -/*----------------------------------------------------------------*/
  13157. -/* the following will set the monitor border color (useful to find
  13158. -   where something crashed or gets stuck at and as a simple profiler) */
  13159. -
  13160. -#if 0
  13161. -#define rtrc(i) {inb(0x3da);outb(0x31,0x3c0);outb((i),0x3c0);}
  13162. -#else
  13163. -#define rtrc(i) {}
  13164. -#endif
  13165. -
  13166. -/*----------------------------------------------------------------*/
  13167. -/* local functions */
  13168. -/*----------------------------------------------------------------*/
  13169. -static void    ql_zap(void);
  13170. -/* error recovery - reset everything */
  13171. -void    ql_zap()
  13172. -{
  13173. -int    x;
  13174. -unsigned long    flags;
  13175. -    save_flags( flags );
  13176. -    cli();
  13177. -    x = inb(qbase + 0xd);
  13178. -    REG0;
  13179. -    outb(3, qbase + 3);                /* reset SCSI */
  13180. -    outb(2, qbase + 3);                /* reset chip */
  13181. -    if (x & 0x80)
  13182. -        REG1;
  13183. -    restore_flags( flags );
  13184. -}
  13185. -
  13186. -/*----------------------------------------------------------------*/
  13187. -/* do pseudo-dma */
  13188. -static int    ql_pdma(int phase, char *request, int reqlen)
  13189. -{
  13190. -int    j;
  13191. -    j = 0;
  13192. -    if (phase & 1) {    /* in */
  13193. -#if QL_TURBO_PDMA
  13194. -rtrc(4)
  13195. -        /* empty fifo in large chunks */
  13196. -        if( reqlen >= 128 && (inb( qbase + 8 ) & 2) ) { /* full */
  13197. -            insl( qbase + 4, request, 32 );
  13198. -            reqlen -= 128;
  13199. -            request += 128;
  13200. -        }
  13201. -        while( reqlen >= 84 && !( j & 0xc0 ) ) /* 2/3 */
  13202. -            if( (j=inb( qbase + 8 )) & 4 ) {
  13203. -                insl( qbase + 4, request, 21 );
  13204. -                reqlen -= 84;
  13205. -                request += 84;
  13206. -            }
  13207. -        if( reqlen >= 44 && (inb( qbase + 8 ) & 8) ) {    /* 1/3 */
  13208. -            insl( qbase + 4, request, 11 );
  13209. -            reqlen -= 44;
  13210. -            request += 44;
  13211. -        }
  13212. -#endif
  13213. -        /* until both empty and int (or until reclen is 0) */
  13214. -rtrc(7)
  13215. -        j = 0;
  13216. -        while( reqlen && !( (j & 0x10) && (j & 0xc0) ) ) {
  13217. -            /* while bytes to receive and not empty */
  13218. -            j &= 0xc0;
  13219. -            while ( reqlen && !( (j=inb(qbase + 8)) & 0x10 ) ) {
  13220. -                *request++ = inb(qbase + 4);
  13221. -                reqlen--;
  13222. -            }
  13223. -            if( j & 0x10 )
  13224. -                j = inb(qbase+8);
  13225. -
  13226. -        }
  13227. -    }
  13228. -    else {    /* out */
  13229. -#if QL_TURBO_PDMA
  13230. -rtrc(4)
  13231. -        if( reqlen >= 128 && inb( qbase + 8 ) & 0x10 ) { /* empty */
  13232. -            outsl(qbase + 4, request, 32 );
  13233. -            reqlen -= 128;
  13234. -            request += 128;
  13235. -        }
  13236. -        while( reqlen >= 84 && !( j & 0xc0 ) ) /* 1/3 */
  13237. -            if( !((j=inb( qbase + 8 )) & 8) ) {
  13238. -                outsl( qbase + 4, request, 21 );
  13239. -                reqlen -= 84;
  13240. -                request += 84;
  13241. -            }
  13242. -        if( reqlen >= 40 && !(inb( qbase + 8 ) & 4 ) ) { /* 2/3 */
  13243. -            outsl( qbase + 4, request, 10 );
  13244. -            reqlen -= 40;
  13245. -            request += 40;
  13246. -        }
  13247. -#endif
  13248. -        /* until full and int (or until reclen is 0) */
  13249. -rtrc(7)
  13250. -        j = 0;
  13251. -        while( reqlen && !( (j & 2) && (j & 0xc0) ) ) {
  13252. -            /* while bytes to send and not full */
  13253. -            while ( reqlen && !( (j=inb(qbase + 8)) & 2 ) ) {
  13254. -                outb(*request++, qbase + 4);
  13255. -                reqlen--;
  13256. -            }
  13257. -            if( j & 2 )
  13258. -                j = inb(qbase+8);
  13259. -        }
  13260. -    }
  13261. -/* maybe return reqlen */
  13262. -    return inb( qbase + 8 ) & 0xc0;
  13263. -}
  13264. -
  13265. -/*----------------------------------------------------------------*/
  13266. -/* wait for interrupt flag (polled - not real hardware interrupt) */
  13267. -static int    ql_wai(void)
  13268. -{
  13269. -int    i,k;
  13270. -    k = 0;
  13271. -    i = jiffies + WATCHDOG;
  13272. -    while ( i > jiffies && !qabort && !((k = inb(qbase + 4)) & 0xe0))
  13273. -        barrier();
  13274. -    if (i <= jiffies)
  13275. -        return (DID_TIME_OUT);
  13276. -    if (qabort)
  13277. -        return (qabort == 1 ? DID_ABORT : DID_RESET);
  13278. -    if (k & 0x60)
  13279. -        ql_zap();
  13280. -    if (k & 0x20)
  13281. -        return (DID_PARITY);
  13282. -    if (k & 0x40)
  13283. -        return (DID_ERROR);
  13284. -    return 0;
  13285. -}
  13286. -
  13287. -/*----------------------------------------------------------------*/
  13288. -/* initiate scsi command - queueing handler */
  13289. -static void    ql_icmd(Scsi_Cmnd * cmd)
  13290. -{
  13291. -unsigned int        i;
  13292. -unsigned long    flags;
  13293. -
  13294. -    qabort = 0;
  13295. -
  13296. -    save_flags( flags );
  13297. -    cli();
  13298. -    REG0;
  13299. -/* clearing of interrupts and the fifo is needed */
  13300. -    inb(qbase + 5);             /* clear interrupts */
  13301. -    if (inb(qbase + 5))            /* if still interrupting */
  13302. -        outb(2, qbase + 3);        /* reset chip */
  13303. -    else if (inb(qbase + 7) & 0x1f)
  13304. -        outb(1, qbase + 3);        /* clear fifo */
  13305. -    while (inb(qbase + 5));         /* clear ints */
  13306. -    REG1;
  13307. -    outb(1, qbase + 8);            /* set for PIO pseudo DMA */
  13308. -    outb(0, qbase + 0xb);            /* disable ints */
  13309. -    inb(qbase + 8);             /* clear int bits */
  13310. -    REG0;
  13311. -    outb(0x40, qbase + 0xb);        /* enable features */
  13312. -
  13313. -/* configurables */
  13314. -    outb( qlcfgc , qbase + 0xc);
  13315. -/* config: no reset interrupt, (initiator) bus id */
  13316. -    outb( 0x40 | qlcfg8 | qinitid, qbase + 8);
  13317. -    outb( qlcfg7 , qbase + 7 );
  13318. -    outb( qlcfg6 , qbase + 6 );
  13319. -/**/
  13320. -    outb(qlcfg5, qbase + 5);        /* select timer */
  13321. -    outb(qlcfg9 & 7, qbase + 9);            /* prescaler */
  13322. -/*    outb(0x99, qbase + 5);    */
  13323. -    outb(cmd->target, qbase + 4);
  13324. -
  13325. -    for (i = 0; i < cmd->cmd_len; i++)
  13326. -        outb(cmd->cmnd[i], qbase + 2);
  13327. -    qlcmd = cmd;
  13328. -    outb(0x41, qbase + 3);    /* select and send command */
  13329. -    restore_flags( flags );
  13330. -}
  13331. -/*----------------------------------------------------------------*/
  13332. -/* process scsi command - usually after interrupt */
  13333. -static unsigned int    ql_pcmd(Scsi_Cmnd * cmd)
  13334. -{
  13335. -unsigned int    i, j, k;
  13336. -unsigned int    result;         /* ultimate return result */
  13337. -unsigned int    status;         /* scsi returned status */
  13338. -unsigned int    message;        /* scsi returned message */
  13339. -unsigned int    phase;            /* recorded scsi phase */
  13340. -unsigned int    reqlen;         /* total length of transfer */
  13341. -struct scatterlist    *sglist;    /* scatter-gather list pointer */
  13342. -unsigned int    sgcount;        /* sg counter */
  13343. -
  13344. -rtrc(1)
  13345. -    j = inb(qbase + 6);
  13346. -    i = inb(qbase + 5);
  13347. -    if (i == 0x20) {
  13348. -        return (DID_NO_CONNECT << 16);
  13349. -    }
  13350. -    i |= inb(qbase + 5);    /* the 0x10 bit can be set after the 0x08 */
  13351. -    if (i != 0x18) {
  13352. -        printk("Ql:Bad Interrupt status:%02x\n", i);
  13353. -        ql_zap();
  13354. -        return (DID_BAD_INTR << 16);
  13355. -    }
  13356. -    j &= 7; /* j = inb( qbase + 7 ) >> 5; */
  13357. -/* correct status is supposed to be step 4 */
  13358. -/* it sometimes returns step 3 but with 0 bytes left to send */
  13359. -/* We can try stuffing the FIFO with the max each time, but we will get a
  13360. -   sequence of 3 if any bytes are left (but we do flush the FIFO anyway */
  13361. -    if(j != 3 && j != 4) {
  13362. -        printk("Ql:Bad sequence for command %d, int %02X, cmdleft = %d\n", j, i, inb( qbase+7 ) & 0x1f );
  13363. -        ql_zap();
  13364. -        return (DID_ERROR << 16);
  13365. -    }
  13366. -    result = DID_OK;
  13367. -    if (inb(qbase + 7) & 0x1f)    /* if some bytes in fifo */
  13368. -        outb(1, qbase + 3);        /* clear fifo */
  13369. -/* note that request_bufflen is the total xfer size when sg is used */
  13370. -    reqlen = cmd->request_bufflen;
  13371. -/* note that it won't work if transfers > 16M are requested */
  13372. -    if (reqlen && !((phase = inb(qbase + 4)) & 6)) {    /* data phase */
  13373. -rtrc(2)
  13374. -        outb(reqlen, qbase);            /* low-mid xfer cnt */
  13375. -        outb(reqlen >> 8, qbase+1);            /* low-mid xfer cnt */
  13376. -        outb(reqlen >> 16, qbase + 0xe);    /* high xfer cnt */
  13377. -        outb(0x90, qbase + 3);            /* command do xfer */
  13378. -/* PIO pseudo DMA to buffer or sglist */
  13379. -        REG1;
  13380. -        if (!cmd->use_sg)
  13381. -            ql_pdma(phase, cmd->request_buffer, cmd->request_bufflen);
  13382. -        else {
  13383. -            sgcount = cmd->use_sg;
  13384. -            sglist = cmd->request_buffer;
  13385. -            while (sgcount--) {
  13386. -                if (qabort) {
  13387. -                    REG0;
  13388. -                    return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16);
  13389. -                }
  13390. -                if (ql_pdma(phase, sglist->address, sglist->length))
  13391. -                    break;
  13392. -                sglist++;
  13393. -            }
  13394. -        }
  13395. -        REG0;
  13396. -rtrc(2)
  13397. -/* wait for irq (split into second state of irq handler if this can take time) */
  13398. -        if ((k = ql_wai()))
  13399. -            return (k << 16);
  13400. -        k = inb(qbase + 5);    /* should be 0x10, bus service */
  13401. -    }
  13402. -/*** Enter Status (and Message In) Phase ***/
  13403. -    k = jiffies + WATCHDOG;
  13404. -    while ( k > jiffies && !qabort && !(inb(qbase + 4) & 6));    /* wait for status phase */
  13405. -    if ( k <= jiffies ) {
  13406. -        ql_zap();
  13407. -        return (DID_TIME_OUT << 16);
  13408. -    }
  13409. -    while (inb(qbase + 5));                 /* clear pending ints */
  13410. -    if (qabort)
  13411. -        return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16);
  13412. -    outb(0x11, qbase + 3);                    /* get status and message */
  13413. -    if ((k = ql_wai()))
  13414. -        return (k << 16);
  13415. -    i = inb(qbase + 5);                    /* get chip irq stat */
  13416. -    j = inb(qbase + 7) & 0x1f;                /* and bytes rec'd */
  13417. -    status = inb(qbase + 2);
  13418. -    message = inb(qbase + 2);
  13419. -/* should get function complete int if Status and message, else bus serv if only status */
  13420. -    if (!((i == 8 && j == 2) || (i == 0x10 && j == 1))) {
  13421. -        printk("Ql:Error during status phase, int=%02X, %d bytes recd\n", i, j);
  13422. -        result = DID_ERROR;
  13423. -    }
  13424. -    outb(0x12, qbase + 3);    /* done, disconnect */
  13425. -rtrc(1)
  13426. -    if ((k = ql_wai()))
  13427. -        return (k << 16);
  13428. -/* should get bus service interrupt and disconnect interrupt */
  13429. -    i = inb(qbase + 5);    /* should be bus service */
  13430. -    while (!qabort && ((i & 0x20) != 0x20)) {
  13431. -        barrier();
  13432. -        i |= inb(qbase + 5);
  13433. -    }
  13434. -rtrc(0)
  13435. -    if (qabort)
  13436. -        return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16);
  13437. -    return (result << 16) | (message << 8) | (status & STATUS_MASK);
  13438. -}
  13439. -
  13440. -#if QL_USE_IRQ
  13441. -/*----------------------------------------------------------------*/
  13442. -/* interrupt handler */
  13443. -static void           ql_ihandl(int irq, void *dev_id, struct pt_regs * regs)
  13444. -{
  13445. -Scsi_Cmnd       *icmd;
  13446. -    REG0;
  13447. -    if (!(inb(qbase + 4) & 0x80))    /* false alarm? */
  13448. -        return;
  13449. -    if (qlcmd == NULL) {        /* no command to process? */
  13450. -        int    i;
  13451. -        i = 16;
  13452. -        while (i-- && inb(qbase + 5)); /* maybe also ql_zap() */
  13453. -        return;
  13454. -    }
  13455. -    icmd = qlcmd;
  13456. -    icmd->result = ql_pcmd(icmd);
  13457. -    qlcmd = NULL;
  13458. -/* if result is CHECK CONDITION done calls qcommand to request sense */
  13459. -    (icmd->scsi_done) (icmd);
  13460. -}
  13461. -#endif
  13462. -
  13463. -/*----------------------------------------------------------------*/
  13464. -/* global functions */
  13465. -/*----------------------------------------------------------------*/
  13466. -/* non queued command */
  13467. -#if QL_USE_IRQ
  13468. -static void    qlidone(Scsi_Cmnd * cmd) {};        /* null function */
  13469. -#endif
  13470. -
  13471. -/* command process */
  13472. -int    qlogic_command(Scsi_Cmnd * cmd)
  13473. -{
  13474. -int    k;
  13475. -#if QL_USE_IRQ
  13476. -    if (qlirq >= 0) {
  13477. -        qlogic_queuecommand(cmd, qlidone);
  13478. -        while (qlcmd != NULL);
  13479. -        return cmd->result;
  13480. -    }
  13481. -#endif
  13482. -/* non-irq version */
  13483. -    if (cmd->target == qinitid)
  13484. -        return (DID_BAD_TARGET << 16);
  13485. -    ql_icmd(cmd);
  13486. -    if ((k = ql_wai()))
  13487. -        return (k << 16);
  13488. -    return ql_pcmd(cmd);
  13489. -
  13490. -}
  13491. -
  13492. -#if QL_USE_IRQ
  13493. -/*----------------------------------------------------------------*/
  13494. -/* queued command */
  13495. -int    qlogic_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
  13496. -{
  13497. -    if(cmd->target == qinitid) {
  13498. -        cmd->result = DID_BAD_TARGET << 16;
  13499. -        done(cmd);
  13500. -        return 0;
  13501. -    }
  13502. -
  13503. -    cmd->scsi_done = done;
  13504. -/* wait for the last command's interrupt to finish */
  13505. -    while (qlcmd != NULL)
  13506. -        barrier();
  13507. -    ql_icmd(cmd);
  13508. -    return 0;
  13509. -}
  13510. -#else
  13511. -int    qlogic_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
  13512. -{
  13513. -    return 1;
  13514. -}
  13515. -#endif
  13516. -
  13517. -#ifdef PCMCIA
  13518. -/*----------------------------------------------------------------*/
  13519. -/* allow PCMCIA code to preset the port */
  13520. -/* port should be 0 and irq to -1 respectively for autoprobing */
  13521. -void    qlogic_preset(int port, int irq)
  13522. -{
  13523. -    qbase=port;
  13524. -    qlirq=irq;
  13525. -}
  13526. -#endif
  13527. -
  13528. -/*----------------------------------------------------------------*/
  13529. -/* look for qlogic card and init if found */
  13530. -int    qlogic_detect(Scsi_Host_Template * host)
  13531. -{
  13532. -int    i, j;            /* these are only used by IRQ detect */
  13533. -int    qltyp;            /* type of chip */
  13534. -struct    Scsi_Host    *hreg;    /* registered host structure */
  13535. -unsigned long    flags;
  13536. -
  13537. -host->proc_dir =  &proc_scsi_qlogic;
  13538. -
  13539. -/* Qlogic Cards only exist at 0x230 or 0x330 (the chip itself decodes the
  13540. -   address - I check 230 first since MIDI cards are typically at 330
  13541. -
  13542. -   Theoretically, two Qlogic cards can coexist in the same system.  This
  13543. -   should work by simply using this as a loadable module for the second
  13544. -   card, but I haven't tested this.
  13545. -*/
  13546. -
  13547. -    if( !qbase ) {
  13548. -        for (qbase = 0x230; qbase < 0x430; qbase += 0x100) {
  13549. -            if( check_region( qbase , 0x10 ) )
  13550. -                continue;
  13551. -            REG1;
  13552. -            if ( ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 )
  13553. -              && ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 ) )
  13554. -                break;
  13555. -        }
  13556. -        if (qbase == 0x430)
  13557. -            return 0;
  13558. -    }
  13559. -    else
  13560. -        printk( "Ql: Using preset base address of %03x\n", qbase );
  13561. -
  13562. -    qltyp = inb(qbase + 0xe) & 0xf8;
  13563. -    qinitid = host->this_id;
  13564. -    if (qinitid < 0)
  13565. -        qinitid = 7;            /* if no ID, use 7 */
  13566. -    outb(1, qbase + 8);            /* set for PIO pseudo DMA */
  13567. -    REG0;
  13568. -    outb(0x40 | qlcfg8 | qinitid, qbase + 8);    /* (ini) bus id, disable scsi rst */
  13569. -    outb(qlcfg5, qbase + 5);        /* select timer */
  13570. -    outb(qlcfg9, qbase + 9);            /* prescaler */
  13571. -#if QL_RESET_AT_START
  13572. -    outb( 3 , qbase + 3 );
  13573. -    REG1;
  13574. -    while( inb( qbase + 0xf ) & 4 );
  13575. -    REG0;
  13576. -#endif
  13577. -#if QL_USE_IRQ
  13578. -/* IRQ probe - toggle pin and check request pending */
  13579. -
  13580. -    if( qlirq == -1 ) {
  13581. -        save_flags( flags );
  13582. -        cli();
  13583. -        i = 0xffff;
  13584. -        j = 3;
  13585. -        outb(0x90, qbase + 3);    /* illegal command - cause interrupt */
  13586. -        REG1;
  13587. -        outb(10, 0x20); /* access pending interrupt map */
  13588. -        outb(10, 0xa0);
  13589. -        while (j--) {
  13590. -            outb(0xb0 | QL_INT_ACTIVE_HIGH , qbase + 0xd);    /* int pin off */
  13591. -            i &= ~(inb(0x20) | (inb(0xa0) << 8));    /* find IRQ off */
  13592. -            outb(0xb4 | QL_INT_ACTIVE_HIGH , qbase + 0xd);    /* int pin on */
  13593. -            i &= inb(0x20) | (inb(0xa0) << 8);    /* find IRQ on */
  13594. -        }
  13595. -        REG0;
  13596. -        while (inb(qbase + 5));             /* purge int */
  13597. -        j = -1;
  13598. -        while (i)                    /* find on bit */
  13599. -            i >>= 1, j++;    /* should check for exactly 1 on */
  13600. -        qlirq = j;
  13601. -        restore_flags( flags );
  13602. -    }
  13603. -    else
  13604. -        printk( "Ql: Using preset IRQ %d\n", qlirq );
  13605. -
  13606. -    if (qlirq >= 0 && !request_irq(qlirq, ql_ihandl, 0, "qlogic", NULL))
  13607. -        host->can_queue = 1;
  13608. -#endif
  13609. -    request_region( qbase , 0x10 ,"qlogic");
  13610. -    hreg = scsi_register( host , 0 );    /* no host data */
  13611. -    hreg->io_port = qbase;
  13612. -    hreg->n_io_port = 16;
  13613. -    hreg->dma_channel = -1;
  13614. -    if( qlirq != -1 )
  13615. -        hreg->irq = qlirq;
  13616. -
  13617. -    sprintf(qinfo, "Qlogic Driver version 0.43, chip %02X at %03X, IRQ %d, TPdma:%d",
  13618. -        qltyp, qbase, qlirq, QL_TURBO_PDMA );
  13619. -    host->name = qinfo;
  13620. -
  13621. -    return 1;
  13622. -}
  13623. -
  13624. -/*----------------------------------------------------------------*/
  13625. -/* return bios parameters */
  13626. -int    qlogic_biosparam(Disk * disk, kdev_t dev, int ip[])
  13627. -{
  13628. -/* This should mimic the DOS Qlogic driver's behavior exactly */
  13629. -    ip[0] = 0x40;
  13630. -    ip[1] = 0x20;
  13631. -    ip[2] = disk->capacity / (ip[0] * ip[1]);
  13632. -    if (ip[2] > 1024) {
  13633. -        ip[0] = 0xff;
  13634. -        ip[1] = 0x3f;
  13635. -        ip[2] = disk->capacity / (ip[0] * ip[1]);
  13636. -        if (ip[2] > 1023)
  13637. -            ip[2] = 1023;
  13638. -    }
  13639. -    return 0;
  13640. -}
  13641. -
  13642. -/*----------------------------------------------------------------*/
  13643. -/* abort command in progress */
  13644. -int    qlogic_abort(Scsi_Cmnd * cmd)
  13645. -{
  13646. -    qabort = 1;
  13647. -    ql_zap();
  13648. -    return 0;
  13649. -}
  13650. -
  13651. -/*----------------------------------------------------------------*/
  13652. -/* reset SCSI bus */
  13653. -int    qlogic_reset(Scsi_Cmnd * cmd)
  13654. -{
  13655. -    qabort = 2;
  13656. -    ql_zap();
  13657. -    return 1;
  13658. -}
  13659. -
  13660. -/*----------------------------------------------------------------*/
  13661. -/* return info string */
  13662. -const char    *qlogic_info(struct Scsi_Host * host)
  13663. -{
  13664. -    return qinfo;
  13665. -}
  13666. -
  13667. -#ifdef MODULE
  13668. -/* Eventually this will go into an include file, but this will be later */
  13669. -Scsi_Host_Template driver_template = QLOGIC;
  13670. -
  13671. -#include "scsi_module.c"
  13672. -#endif
  13673. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogic.h linux/drivers/scsi/qlogic.h
  13674. --- pre2.0.5/linux/drivers/scsi/qlogic.h    Mon Sep 18 08:54:09 1995
  13675. +++ linux/drivers/scsi/qlogic.h    Thu Jan  1 02:00:00 1970
  13676. @@ -1,40 +0,0 @@
  13677. -#ifndef _QLOGIC_H
  13678. -#define _QLOGIC_H
  13679. -
  13680. -int qlogic_detect(Scsi_Host_Template * );
  13681. -const char * qlogic_info(struct Scsi_Host *);
  13682. -int qlogic_command(Scsi_Cmnd *);
  13683. -int qlogic_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
  13684. -int qlogic_abort(Scsi_Cmnd *);
  13685. -int qlogic_reset(Scsi_Cmnd *);
  13686. -int qlogic_biosparam(Disk *, kdev_t, int[]);
  13687. -
  13688. -#ifndef NULL
  13689. -#define NULL (0)
  13690. -#endif
  13691. -
  13692. -#define QLOGIC {        \
  13693. -    NULL,            \
  13694. -    NULL,            \
  13695. -    NULL,            \
  13696. -    NULL,                \
  13697. -    NULL,            \
  13698. -    qlogic_detect,        \
  13699. -    NULL,            \
  13700. -    qlogic_info,        \
  13701. -    qlogic_command,     \
  13702. -    qlogic_queuecommand,    \
  13703. -    qlogic_abort,        \
  13704. -    qlogic_reset,        \
  13705. -    NULL,            \
  13706. -    qlogic_biosparam,    \
  13707. -    0,            \
  13708. -    -1,            \
  13709. -    SG_ALL,            \
  13710. -    1,            \
  13711. -    0,            \
  13712. -    0,            \
  13713. -    DISABLE_CLUSTERING    \
  13714. -}
  13715. -
  13716. -#endif /* _QLOGIC_H */
  13717. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogicfas.c linux/drivers/scsi/qlogicfas.c
  13718. --- pre2.0.5/linux/drivers/scsi/qlogicfas.c    Thu Jan  1 02:00:00 1970
  13719. +++ linux/drivers/scsi/qlogicfas.c    Sat May 18 11:58:34 1996
  13720. @@ -0,0 +1,679 @@
  13721. +/*----------------------------------------------------------------*/
  13722. +/*
  13723. +   Qlogic linux driver - work in progress. No Warranty express or implied.
  13724. +   Use at your own risk.  Support Tort Reform so you won't have to read all
  13725. +   these silly disclaimers.
  13726. +
  13727. +   Copyright 1994, Tom Zerucha.   
  13728. +   zerucha@shell.portal.com
  13729. +
  13730. +   Additional Code, and much appreciated help by
  13731. +   Michael A. Griffith
  13732. +   grif@cs.ucr.edu
  13733. +
  13734. +   Thanks to Eric Youngdale and Dave Hinds for loadable module and PCMCIA
  13735. +   help respectively, and for suffering through my foolishness during the
  13736. +   debugging process.
  13737. +
  13738. +   Reference Qlogic FAS408 Technical Manual, 53408-510-00A, May 10, 1994
  13739. +   (you can reference it, but it is incomplete and inaccurate in places)
  13740. +
  13741. +   Version 0.44 5/7/96 - kernel 1.2.0+, pcmcia 2.5.4+
  13742. +
  13743. +   Functions as standalone, loadable, and PCMCIA driver, the latter from
  13744. +   Dave Hind's PCMCIA package.
  13745. +
  13746. +   Redistributable under terms of the GNU Public License
  13747. +
  13748. +*/
  13749. +/*----------------------------------------------------------------*/
  13750. +/* Configuration */
  13751. +
  13752. +/* Set the following to 2 to use normal interrupt (active high/totempole-
  13753. +   tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open
  13754. +   drain */
  13755. +#define QL_INT_ACTIVE_HIGH 2
  13756. +
  13757. +/* Set the following to 1 to enable the use of interrupts.  Note that 0 tends
  13758. +   to be more stable, but slower (or ties up the system more) */
  13759. +#define QL_USE_IRQ 1
  13760. +
  13761. +/* Set the following to max out the speed of the PIO PseudoDMA transfers,
  13762. +   again, 0 tends to be slower, but more stable.  */
  13763. +#define QL_TURBO_PDMA 1
  13764. +
  13765. +/* This should be 1 to enable parity detection */
  13766. +#define QL_ENABLE_PARITY 1
  13767. +
  13768. +/* This will reset all devices when the driver is initialized (during bootup).
  13769. +   The other linux drivers don't do this, but the DOS drivers do, and after
  13770. +   using DOS or some kind of crash or lockup this will bring things back
  13771. +   without requiring a cold boot.  It does take some time to recover from a
  13772. +   reset, so it is slower, and I have seen timeouts so that devices weren't
  13773. +   recognized when this was set. */
  13774. +#define QL_RESET_AT_START 0
  13775. +
  13776. +/* crystal frequency in megahertz (for offset 5 and 9)
  13777. +   Please set this for your card.  Most Qlogic cards are 40 Mhz.  The
  13778. +   Control Concepts ISA (not VLB) is 24 Mhz */
  13779. +#define XTALFREQ    40
  13780. +
  13781. +/**********/
  13782. +/* DANGER! modify these at your own risk */
  13783. +/* SLOWCABLE can usually be reset to zero if you have a clean setup and
  13784. +   proper termination.  The rest are for synchronous transfers and other
  13785. +   advanced features if your device can transfer faster than 5Mb/sec.
  13786. +   If you are really curious, email me for a quick howto until I have
  13787. +   something official */
  13788. +/**********/
  13789. +
  13790. +/*****/
  13791. +/* config register 1 (offset 8) options */
  13792. +/* This needs to be set to 1 if your cabling is long or noisy */
  13793. +#define SLOWCABLE 1
  13794. +
  13795. +/*****/
  13796. +/* offset 0xc */
  13797. +/* This will set fast (10Mhz) synchronous timing when set to 1
  13798. +   For this to have an effect, FASTCLK must also be 1 */
  13799. +#define FASTSCSI 0
  13800. +
  13801. +/* This when set to 1 will set a faster sync transfer rate */
  13802. +#define FASTCLK 0
  13803. +/*(XTALFREQ>25?1:0)*/
  13804. +
  13805. +/*****/
  13806. +/* offset 6 */
  13807. +/* This is the sync transfer divisor, XTALFREQ/X will be the maximum
  13808. +   achievable data rate (assuming the rest of the system is capable
  13809. +   and set properly) */
  13810. +#define SYNCXFRPD 5
  13811. +/*(XTALFREQ/5)*/
  13812. +
  13813. +/*****/
  13814. +/* offset 7 */
  13815. +/* This is the count of how many synchronous transfers can take place
  13816. +    i.e. how many reqs can occur before an ack is given.
  13817. +    The maximum value for this is 15, the upper bits can modify
  13818. +    REQ/ACK assertion and deassertion during synchronous transfers
  13819. +    If this is 0, the bus will only transfer asynchronously */
  13820. +#define SYNCOFFST 0
  13821. +/* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles
  13822. +    of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will
  13823. +    cause the deassertion to be early by 1/2 clock.  Bits 5&4 control
  13824. +    the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */
  13825. +
  13826. +/*----------------------------------------------------------------*/
  13827. +#ifdef PCMCIA
  13828. +#undef QL_INT_ACTIVE_HIGH
  13829. +#define QL_INT_ACTIVE_HIGH 0
  13830. +#define MODULE
  13831. +#endif 
  13832. +
  13833. +#include <linux/module.h>
  13834. +
  13835. +#ifdef PCMCIA
  13836. +#undef MODULE
  13837. +#endif 
  13838. +
  13839. +#include <linux/blk.h>    /* to get disk capacity */
  13840. +#include <linux/kernel.h>
  13841. +#include <linux/string.h>
  13842. +#include <linux/ioport.h>
  13843. +#include <linux/sched.h>
  13844. +#include <linux/proc_fs.h>
  13845. +#include <linux/unistd.h>
  13846. +#include <asm/io.h>
  13847. +#include <asm/irq.h>
  13848. +#include "sd.h"
  13849. +#include "hosts.h"
  13850. +#include "qlogicfas.h"
  13851. +#include<linux/stat.h>
  13852. +
  13853. +struct proc_dir_entry proc_scsi_qlogicfas = {
  13854. +    PROC_SCSI_QLOGICFAS, 6, "qlogicfas",
  13855. +    S_IFDIR | S_IRUGO | S_IXUGO, 2
  13856. +};
  13857. +
  13858. +/*----------------------------------------------------------------*/
  13859. +/* driver state info, local to driver */
  13860. +static int        qbase = 0;    /* Port */
  13861. +static int        qinitid;    /* initiator ID */
  13862. +static int        qabort;    /* Flag to cause an abort */
  13863. +static int        qlirq = -1;    /* IRQ being used */
  13864. +static char        qinfo[80];    /* description */
  13865. +static Scsi_Cmnd   *qlcmd;    /* current command being processed */
  13866. +
  13867. +static int        qlcfg5 = ( XTALFREQ << 5 );    /* 15625/512 */
  13868. +static int        qlcfg6 = SYNCXFRPD;
  13869. +static int        qlcfg7 = SYNCOFFST;
  13870. +static int        qlcfg8 = ( SLOWCABLE << 7 ) | ( QL_ENABLE_PARITY << 4 );
  13871. +static int        qlcfg9 = ( ( XTALFREQ + 4 ) / 5 );
  13872. +static int        qlcfgc = ( FASTCLK << 3 ) | ( FASTSCSI << 4 );
  13873. +
  13874. +/*----------------------------------------------------------------*/
  13875. +/* The qlogic card uses two register maps - These macros select which one */
  13876. +#define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd ))
  13877. +#define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | QL_INT_ACTIVE_HIGH , qbase + 0xd ))
  13878. +
  13879. +/* following is watchdog timeout in microseconds */
  13880. +#define WATCHDOG 5000000
  13881. +
  13882. +/*----------------------------------------------------------------*/
  13883. +/* the following will set the monitor border color (useful to find
  13884. +   where something crashed or gets stuck at and as a simple profiler) */
  13885. +
  13886. +#if 0
  13887. +#define rtrc(i) {inb(0x3da);outb(0x31,0x3c0);outb((i),0x3c0);}
  13888. +#else
  13889. +#define rtrc(i) {}
  13890. +#endif
  13891. +
  13892. +/*----------------------------------------------------------------*/
  13893. +/* local functions */
  13894. +/*----------------------------------------------------------------*/
  13895. +static void    ql_zap(void);
  13896. +/* error recovery - reset everything */
  13897. +void    ql_zap()
  13898. +{
  13899. +int    x;
  13900. +unsigned long    flags;
  13901. +    save_flags( flags );
  13902. +    cli();
  13903. +    x = inb(qbase + 0xd);
  13904. +    REG0;
  13905. +    outb(3, qbase + 3);                /* reset SCSI */
  13906. +    outb(2, qbase + 3);                /* reset chip */
  13907. +    if (x & 0x80)
  13908. +        REG1;
  13909. +    restore_flags( flags );
  13910. +}
  13911. +
  13912. +/*----------------------------------------------------------------*/
  13913. +/* do pseudo-dma */
  13914. +static int    ql_pdma(int phase, char *request, int reqlen)
  13915. +{
  13916. +int    j;
  13917. +    j = 0;
  13918. +    if (phase & 1) {    /* in */
  13919. +#if QL_TURBO_PDMA
  13920. +rtrc(4)
  13921. +        /* empty fifo in large chunks */
  13922. +        if( reqlen >= 128 && (inb( qbase + 8 ) & 2) ) { /* full */
  13923. +            insl( qbase + 4, request, 32 );
  13924. +            reqlen -= 128;
  13925. +            request += 128;
  13926. +        }
  13927. +        while( reqlen >= 84 && !( j & 0xc0 ) ) /* 2/3 */
  13928. +            if( (j=inb( qbase + 8 )) & 4 ) {
  13929. +                insl( qbase + 4, request, 21 );
  13930. +                reqlen -= 84;
  13931. +                request += 84;
  13932. +            }
  13933. +        if( reqlen >= 44 && (inb( qbase + 8 ) & 8) ) {    /* 1/3 */
  13934. +            insl( qbase + 4, request, 11 );
  13935. +            reqlen -= 44;
  13936. +            request += 44;
  13937. +        }
  13938. +#endif
  13939. +        /* until both empty and int (or until reclen is 0) */
  13940. +rtrc(7)
  13941. +        j = 0;
  13942. +        while( reqlen && !( (j & 0x10) && (j & 0xc0) ) ) {
  13943. +            /* while bytes to receive and not empty */
  13944. +            j &= 0xc0;
  13945. +            while ( reqlen && !( (j=inb(qbase + 8)) & 0x10 ) ) {
  13946. +                *request++ = inb(qbase + 4);
  13947. +                reqlen--;
  13948. +            }
  13949. +            if( j & 0x10 )
  13950. +                j = inb(qbase+8);
  13951. +
  13952. +        }
  13953. +    }
  13954. +    else {    /* out */
  13955. +#if QL_TURBO_PDMA
  13956. +rtrc(4)
  13957. +        if( reqlen >= 128 && inb( qbase + 8 ) & 0x10 ) { /* empty */
  13958. +            outsl(qbase + 4, request, 32 );
  13959. +            reqlen -= 128;
  13960. +            request += 128;
  13961. +        }
  13962. +        while( reqlen >= 84 && !( j & 0xc0 ) ) /* 1/3 */
  13963. +            if( !((j=inb( qbase + 8 )) & 8) ) {
  13964. +                outsl( qbase + 4, request, 21 );
  13965. +                reqlen -= 84;
  13966. +                request += 84;
  13967. +            }
  13968. +        if( reqlen >= 40 && !(inb( qbase + 8 ) & 4 ) ) { /* 2/3 */
  13969. +            outsl( qbase + 4, request, 10 );
  13970. +            reqlen -= 40;
  13971. +            request += 40;
  13972. +        }
  13973. +#endif
  13974. +        /* until full and int (or until reclen is 0) */
  13975. +rtrc(7)
  13976. +        j = 0;
  13977. +        while( reqlen && !( (j & 2) && (j & 0xc0) ) ) {
  13978. +            /* while bytes to send and not full */
  13979. +            while ( reqlen && !( (j=inb(qbase + 8)) & 2 ) ) {
  13980. +                outb(*request++, qbase + 4);
  13981. +                reqlen--;
  13982. +            }
  13983. +            if( j & 2 )
  13984. +                j = inb(qbase+8);
  13985. +        }
  13986. +    }
  13987. +/* maybe return reqlen */
  13988. +    return inb( qbase + 8 ) & 0xc0;
  13989. +}
  13990. +
  13991. +/*----------------------------------------------------------------*/
  13992. +/* wait for interrupt flag (polled - not real hardware interrupt) */
  13993. +static int    ql_wai(void)
  13994. +{
  13995. +int    i,k;
  13996. +    k = 0;
  13997. +    i = jiffies + WATCHDOG;
  13998. +    while ( i > jiffies && !qabort && !((k = inb(qbase + 4)) & 0xe0))
  13999. +        barrier();
  14000. +    if (i <= jiffies)
  14001. +        return (DID_TIME_OUT);
  14002. +    if (qabort)
  14003. +        return (qabort == 1 ? DID_ABORT : DID_RESET);
  14004. +    if (k & 0x60)
  14005. +        ql_zap();
  14006. +    if (k & 0x20)
  14007. +        return (DID_PARITY);
  14008. +    if (k & 0x40)
  14009. +        return (DID_ERROR);
  14010. +    return 0;
  14011. +}
  14012. +
  14013. +/*----------------------------------------------------------------*/
  14014. +/* initiate scsi command - queueing handler */
  14015. +static void    ql_icmd(Scsi_Cmnd * cmd)
  14016. +{
  14017. +unsigned int        i;
  14018. +unsigned long    flags;
  14019. +
  14020. +    qabort = 0;
  14021. +
  14022. +    save_flags( flags );
  14023. +    cli();
  14024. +    REG0;
  14025. +/* clearing of interrupts and the fifo is needed */
  14026. +    inb(qbase + 5);             /* clear interrupts */
  14027. +    if (inb(qbase + 5))            /* if still interrupting */
  14028. +        outb(2, qbase + 3);        /* reset chip */
  14029. +    else if (inb(qbase + 7) & 0x1f)
  14030. +        outb(1, qbase + 3);        /* clear fifo */
  14031. +    while (inb(qbase + 5));         /* clear ints */
  14032. +    REG1;
  14033. +    outb(1, qbase + 8);            /* set for PIO pseudo DMA */
  14034. +    outb(0, qbase + 0xb);            /* disable ints */
  14035. +    inb(qbase + 8);             /* clear int bits */
  14036. +    REG0;
  14037. +    outb(0x40, qbase + 0xb);        /* enable features */
  14038. +
  14039. +/* configurables */
  14040. +    outb( qlcfgc , qbase + 0xc);
  14041. +/* config: no reset interrupt, (initiator) bus id */
  14042. +    outb( 0x40 | qlcfg8 | qinitid, qbase + 8);
  14043. +    outb( qlcfg7 , qbase + 7 );
  14044. +    outb( qlcfg6 , qbase + 6 );
  14045. +/**/
  14046. +    outb(qlcfg5, qbase + 5);        /* select timer */
  14047. +    outb(qlcfg9 & 7, qbase + 9);            /* prescaler */
  14048. +/*    outb(0x99, qbase + 5);    */
  14049. +    outb(cmd->target, qbase + 4);
  14050. +
  14051. +    for (i = 0; i < cmd->cmd_len; i++)
  14052. +        outb(cmd->cmnd[i], qbase + 2);
  14053. +    qlcmd = cmd;
  14054. +    outb(0x41, qbase + 3);    /* select and send command */
  14055. +    restore_flags( flags );
  14056. +}
  14057. +/*----------------------------------------------------------------*/
  14058. +/* process scsi command - usually after interrupt */
  14059. +static unsigned int    ql_pcmd(Scsi_Cmnd * cmd)
  14060. +{
  14061. +unsigned int    i, j, k;
  14062. +unsigned int    result;         /* ultimate return result */
  14063. +unsigned int    status;         /* scsi returned status */
  14064. +unsigned int    message;        /* scsi returned message */
  14065. +unsigned int    phase;            /* recorded scsi phase */
  14066. +unsigned int    reqlen;         /* total length of transfer */
  14067. +struct scatterlist    *sglist;    /* scatter-gather list pointer */
  14068. +unsigned int    sgcount;        /* sg counter */
  14069. +
  14070. +rtrc(1)
  14071. +    j = inb(qbase + 6);
  14072. +    i = inb(qbase + 5);
  14073. +    if (i == 0x20) {
  14074. +        return (DID_NO_CONNECT << 16);
  14075. +    }
  14076. +    i |= inb(qbase + 5);    /* the 0x10 bit can be set after the 0x08 */
  14077. +    if (i != 0x18) {
  14078. +        printk("Ql:Bad Interrupt status:%02x\n", i);
  14079. +        ql_zap();
  14080. +        return (DID_BAD_INTR << 16);
  14081. +    }
  14082. +    j &= 7; /* j = inb( qbase + 7 ) >> 5; */
  14083. +/* correct status is supposed to be step 4 */
  14084. +/* it sometimes returns step 3 but with 0 bytes left to send */
  14085. +/* We can try stuffing the FIFO with the max each time, but we will get a
  14086. +   sequence of 3 if any bytes are left (but we do flush the FIFO anyway */
  14087. +    if(j != 3 && j != 4) {
  14088. +        printk("Ql:Bad sequence for command %d, int %02X, cmdleft = %d\n", j, i, inb( qbase+7 ) & 0x1f );
  14089. +        ql_zap();
  14090. +        return (DID_ERROR << 16);
  14091. +    }
  14092. +    result = DID_OK;
  14093. +    if (inb(qbase + 7) & 0x1f)    /* if some bytes in fifo */
  14094. +        outb(1, qbase + 3);        /* clear fifo */
  14095. +/* note that request_bufflen is the total xfer size when sg is used */
  14096. +    reqlen = cmd->request_bufflen;
  14097. +/* note that it won't work if transfers > 16M are requested */
  14098. +    if (reqlen && !((phase = inb(qbase + 4)) & 6)) {    /* data phase */
  14099. +rtrc(2)
  14100. +        outb(reqlen, qbase);            /* low-mid xfer cnt */
  14101. +        outb(reqlen >> 8, qbase+1);            /* low-mid xfer cnt */
  14102. +        outb(reqlen >> 16, qbase + 0xe);    /* high xfer cnt */
  14103. +        outb(0x90, qbase + 3);            /* command do xfer */
  14104. +/* PIO pseudo DMA to buffer or sglist */
  14105. +        REG1;
  14106. +        if (!cmd->use_sg)
  14107. +            ql_pdma(phase, cmd->request_buffer, cmd->request_bufflen);
  14108. +        else {
  14109. +            sgcount = cmd->use_sg;
  14110. +            sglist = cmd->request_buffer;
  14111. +            while (sgcount--) {
  14112. +                if (qabort) {
  14113. +                    REG0;
  14114. +                    return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16);
  14115. +                }
  14116. +                if (ql_pdma(phase, sglist->address, sglist->length))
  14117. +                    break;
  14118. +                sglist++;
  14119. +            }
  14120. +        }
  14121. +        REG0;
  14122. +rtrc(2)
  14123. +/* wait for irq (split into second state of irq handler if this can take time) */
  14124. +        if ((k = ql_wai()))
  14125. +            return (k << 16);
  14126. +        k = inb(qbase + 5);    /* should be 0x10, bus service */
  14127. +    }
  14128. +/*** Enter Status (and Message In) Phase ***/
  14129. +    k = jiffies + WATCHDOG;
  14130. +    while ( k > jiffies && !qabort && !(inb(qbase + 4) & 6));    /* wait for status phase */
  14131. +    if ( k <= jiffies ) {
  14132. +        ql_zap();
  14133. +        return (DID_TIME_OUT << 16);
  14134. +    }
  14135. +    while (inb(qbase + 5));                 /* clear pending ints */
  14136. +    if (qabort)
  14137. +        return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16);
  14138. +    outb(0x11, qbase + 3);                    /* get status and message */
  14139. +    if ((k = ql_wai()))
  14140. +        return (k << 16);
  14141. +    i = inb(qbase + 5);                    /* get chip irq stat */
  14142. +    j = inb(qbase + 7) & 0x1f;                /* and bytes rec'd */
  14143. +    status = inb(qbase + 2);
  14144. +    message = inb(qbase + 2);
  14145. +/* should get function complete int if Status and message, else bus serv if only status */
  14146. +    if (!((i == 8 && j == 2) || (i == 0x10 && j == 1))) {
  14147. +        printk("Ql:Error during status phase, int=%02X, %d bytes recd\n", i, j);
  14148. +        result = DID_ERROR;
  14149. +    }
  14150. +    outb(0x12, qbase + 3);    /* done, disconnect */
  14151. +rtrc(1)
  14152. +    if ((k = ql_wai()))
  14153. +        return (k << 16);
  14154. +/* should get bus service interrupt and disconnect interrupt */
  14155. +    i = inb(qbase + 5);    /* should be bus service */
  14156. +    while (!qabort && ((i & 0x20) != 0x20)) {
  14157. +        barrier();
  14158. +        i |= inb(qbase + 5);
  14159. +    }
  14160. +rtrc(0)
  14161. +    if (qabort)
  14162. +        return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16);
  14163. +    return (result << 16) | (message << 8) | (status & STATUS_MASK);
  14164. +}
  14165. +
  14166. +#if QL_USE_IRQ
  14167. +/*----------------------------------------------------------------*/
  14168. +/* interrupt handler */
  14169. +static void           ql_ihandl(int irq, void *dev_id, struct pt_regs * regs)
  14170. +{
  14171. +Scsi_Cmnd       *icmd;
  14172. +    REG0;
  14173. +    if (!(inb(qbase + 4) & 0x80))    /* false alarm? */
  14174. +        return;
  14175. +    if (qlcmd == NULL) {        /* no command to process? */
  14176. +        int    i;
  14177. +        i = 16;
  14178. +        while (i-- && inb(qbase + 5)); /* maybe also ql_zap() */
  14179. +        return;
  14180. +    }
  14181. +    icmd = qlcmd;
  14182. +    icmd->result = ql_pcmd(icmd);
  14183. +    qlcmd = NULL;
  14184. +/* if result is CHECK CONDITION done calls qcommand to request sense */
  14185. +    (icmd->scsi_done) (icmd);
  14186. +}
  14187. +#endif
  14188. +
  14189. +/*----------------------------------------------------------------*/
  14190. +/* global functions */
  14191. +/*----------------------------------------------------------------*/
  14192. +/* non queued command */
  14193. +#if QL_USE_IRQ
  14194. +static void    qlidone(Scsi_Cmnd * cmd) {};        /* null function */
  14195. +#endif
  14196. +
  14197. +/* command process */
  14198. +int    qlogicfas_command(Scsi_Cmnd * cmd)
  14199. +{
  14200. +int    k;
  14201. +#if QL_USE_IRQ
  14202. +    if (qlirq >= 0) {
  14203. +        qlogicfas_queuecommand(cmd, qlidone);
  14204. +        while (qlcmd != NULL);
  14205. +        return cmd->result;
  14206. +    }
  14207. +#endif
  14208. +/* non-irq version */
  14209. +    if (cmd->target == qinitid)
  14210. +        return (DID_BAD_TARGET << 16);
  14211. +    ql_icmd(cmd);
  14212. +    if ((k = ql_wai()))
  14213. +        return (k << 16);
  14214. +    return ql_pcmd(cmd);
  14215. +
  14216. +}
  14217. +
  14218. +#if QL_USE_IRQ
  14219. +/*----------------------------------------------------------------*/
  14220. +/* queued command */
  14221. +int    qlogicfas_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
  14222. +{
  14223. +    if(cmd->target == qinitid) {
  14224. +        cmd->result = DID_BAD_TARGET << 16;
  14225. +        done(cmd);
  14226. +        return 0;
  14227. +    }
  14228. +
  14229. +    cmd->scsi_done = done;
  14230. +/* wait for the last command's interrupt to finish */
  14231. +    while (qlcmd != NULL)
  14232. +        barrier();
  14233. +    ql_icmd(cmd);
  14234. +    return 0;
  14235. +}
  14236. +#else
  14237. +int    qlogicfas_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
  14238. +{
  14239. +    return 1;
  14240. +}
  14241. +#endif
  14242. +
  14243. +#ifdef PCMCIA
  14244. +/*----------------------------------------------------------------*/
  14245. +/* allow PCMCIA code to preset the port */
  14246. +/* port should be 0 and irq to -1 respectively for autoprobing */
  14247. +void    qlogicfas_preset(int port, int irq)
  14248. +{
  14249. +    qbase=port;
  14250. +    qlirq=irq;
  14251. +}
  14252. +#endif
  14253. +
  14254. +/*----------------------------------------------------------------*/
  14255. +/* look for qlogic card and init if found */
  14256. +int    qlogicfas_detect(Scsi_Host_Template * host)
  14257. +{
  14258. +int    i, j;            /* these are only used by IRQ detect */
  14259. +int    qltyp;            /* type of chip */
  14260. +struct    Scsi_Host    *hreg;    /* registered host structure */
  14261. +unsigned long    flags;
  14262. +
  14263. +host->proc_dir =  &proc_scsi_qlogicfas;
  14264. +
  14265. +/* Qlogic Cards only exist at 0x230 or 0x330 (the chip itself decodes the
  14266. +   address - I check 230 first since MIDI cards are typically at 330
  14267. +
  14268. +   Theoretically, two Qlogic cards can coexist in the same system.  This
  14269. +   should work by simply using this as a loadable module for the second
  14270. +   card, but I haven't tested this.
  14271. +*/
  14272. +
  14273. +    if( !qbase ) {
  14274. +        for (qbase = 0x230; qbase < 0x430; qbase += 0x100) {
  14275. +            if( check_region( qbase , 0x10 ) )
  14276. +                continue;
  14277. +            REG1;
  14278. +            if ( ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 )
  14279. +              && ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 ) )
  14280. +                break;
  14281. +        }
  14282. +        if (qbase == 0x430)
  14283. +            return 0;
  14284. +    }
  14285. +    else
  14286. +        printk( "Ql: Using preset base address of %03x\n", qbase );
  14287. +
  14288. +    qltyp = inb(qbase + 0xe) & 0xf8;
  14289. +    qinitid = host->this_id;
  14290. +    if (qinitid < 0)
  14291. +        qinitid = 7;            /* if no ID, use 7 */
  14292. +    outb(1, qbase + 8);            /* set for PIO pseudo DMA */
  14293. +    REG0;
  14294. +    outb(0x40 | qlcfg8 | qinitid, qbase + 8);    /* (ini) bus id, disable scsi rst */
  14295. +    outb(qlcfg5, qbase + 5);        /* select timer */
  14296. +    outb(qlcfg9, qbase + 9);            /* prescaler */
  14297. +#if QL_RESET_AT_START
  14298. +    outb( 3 , qbase + 3 );
  14299. +    REG1;
  14300. +    while( inb( qbase + 0xf ) & 4 );
  14301. +    REG0;
  14302. +#endif
  14303. +#if QL_USE_IRQ
  14304. +/* IRQ probe - toggle pin and check request pending */
  14305. +
  14306. +    if( qlirq == -1 ) {
  14307. +        save_flags( flags );
  14308. +        cli();
  14309. +        i = 0xffff;
  14310. +        j = 3;
  14311. +        outb(0x90, qbase + 3);    /* illegal command - cause interrupt */
  14312. +        REG1;
  14313. +        outb(10, 0x20); /* access pending interrupt map */
  14314. +        outb(10, 0xa0);
  14315. +        while (j--) {
  14316. +            outb(0xb0 | QL_INT_ACTIVE_HIGH , qbase + 0xd);    /* int pin off */
  14317. +            i &= ~(inb(0x20) | (inb(0xa0) << 8));    /* find IRQ off */
  14318. +            outb(0xb4 | QL_INT_ACTIVE_HIGH , qbase + 0xd);    /* int pin on */
  14319. +            i &= inb(0x20) | (inb(0xa0) << 8);    /* find IRQ on */
  14320. +        }
  14321. +        REG0;
  14322. +        while (inb(qbase + 5));             /* purge int */
  14323. +        j = -1;
  14324. +        while (i)                    /* find on bit */
  14325. +            i >>= 1, j++;    /* should check for exactly 1 on */
  14326. +        qlirq = j;
  14327. +        restore_flags( flags );
  14328. +    }
  14329. +    else
  14330. +        printk( "Ql: Using preset IRQ %d\n", qlirq );
  14331. +
  14332. +    if (qlirq >= 0 && !request_irq(qlirq, ql_ihandl, 0, "qlogicfas", NULL))
  14333. +        host->can_queue = 1;
  14334. +#endif
  14335. +    request_region( qbase , 0x10 ,"qlogic");
  14336. +    hreg = scsi_register( host , 0 );    /* no host data */
  14337. +    hreg->io_port = qbase;
  14338. +    hreg->n_io_port = 16;
  14339. +    hreg->dma_channel = -1;
  14340. +    if( qlirq != -1 )
  14341. +        hreg->irq = qlirq;
  14342. +
  14343. +    sprintf(qinfo, "Qlogicfas Driver version 0.44, chip %02X at %03X, IRQ %d, TPdma:%d",
  14344. +        qltyp, qbase, qlirq, QL_TURBO_PDMA );
  14345. +    host->name = qinfo;
  14346. +
  14347. +    return 1;
  14348. +}
  14349. +
  14350. +/*----------------------------------------------------------------*/
  14351. +/* return bios parameters */
  14352. +int    qlogicfas_biosparam(Disk * disk, kdev_t dev, int ip[])
  14353. +{
  14354. +/* This should mimic the DOS Qlogic driver's behavior exactly */
  14355. +    ip[0] = 0x40;
  14356. +    ip[1] = 0x20;
  14357. +    ip[2] = disk->capacity / (ip[0] * ip[1]);
  14358. +    if (ip[2] > 1024) {
  14359. +        ip[0] = 0xff;
  14360. +        ip[1] = 0x3f;
  14361. +        ip[2] = disk->capacity / (ip[0] * ip[1]);
  14362. +        if (ip[2] > 1023)
  14363. +            ip[2] = 1023;
  14364. +    }
  14365. +    return 0;
  14366. +}
  14367. +
  14368. +/*----------------------------------------------------------------*/
  14369. +/* abort command in progress */
  14370. +int    qlogicfas_abort(Scsi_Cmnd * cmd)
  14371. +{
  14372. +    qabort = 1;
  14373. +    ql_zap();
  14374. +    return 0;
  14375. +}
  14376. +
  14377. +/*----------------------------------------------------------------*/
  14378. +/* reset SCSI bus */
  14379. +int    qlogicfas_reset(Scsi_Cmnd * cmd)
  14380. +{
  14381. +    qabort = 2;
  14382. +    ql_zap();
  14383. +    return 1;
  14384. +}
  14385. +
  14386. +/*----------------------------------------------------------------*/
  14387. +/* return info string */
  14388. +const char    *qlogicfas_info(struct Scsi_Host * host)
  14389. +{
  14390. +    return qinfo;
  14391. +}
  14392. +
  14393. +#ifdef MODULE
  14394. +/* Eventually this will go into an include file, but this will be later */
  14395. +Scsi_Host_Template driver_template = QLOGICFAS;
  14396. +
  14397. +#include "scsi_module.c"
  14398. +#endif
  14399. +
  14400. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogicfas.h linux/drivers/scsi/qlogicfas.h
  14401. --- pre2.0.5/linux/drivers/scsi/qlogicfas.h    Thu Jan  1 02:00:00 1970
  14402. +++ linux/drivers/scsi/qlogicfas.h    Sat May 18 11:58:34 1996
  14403. @@ -0,0 +1,43 @@
  14404. +#ifndef _QLOGICFAS_H
  14405. +#define _QLOGICFAS_H
  14406. +
  14407. +int qlogicfas_detect(Scsi_Host_Template * );
  14408. +const char * qlogicfas_info(struct Scsi_Host *);
  14409. +int qlogicfas_command(Scsi_Cmnd *);
  14410. +int qlogicfas_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
  14411. +int qlogicfas_abort(Scsi_Cmnd *);
  14412. +int qlogicfas_reset(Scsi_Cmnd *);
  14413. +int qlogicfas_biosparam(Disk *, kdev_t, int[]);
  14414. +
  14415. +#ifndef NULL
  14416. +#define NULL (0)
  14417. +#endif
  14418. +
  14419. +#define QLOGICFAS {        \
  14420. +    NULL,            \
  14421. +    NULL,            \
  14422. +    NULL,            \
  14423. +    NULL,                \
  14424. +    NULL,            \
  14425. +    qlogicfas_detect,        \
  14426. +    NULL,            \
  14427. +    qlogicfas_info,        \
  14428. +    qlogicfas_command,     \
  14429. +    qlogicfas_queuecommand,    \
  14430. +    qlogicfas_abort,        \
  14431. +    qlogicfas_reset,        \
  14432. +    NULL,            \
  14433. +    qlogicfas_biosparam,    \
  14434. +    0,            \
  14435. +    -1,            \
  14436. +    SG_ALL,            \
  14437. +    1,            \
  14438. +    0,            \
  14439. +    0,            \
  14440. +    DISABLE_CLUSTERING    \
  14441. +}
  14442. +
  14443. +#endif /* _QLOGICFAS_H */
  14444. +
  14445. +
  14446. +
  14447. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogicisp.c linux/drivers/scsi/qlogicisp.c
  14448. --- pre2.0.5/linux/drivers/scsi/qlogicisp.c    Thu Jan  1 02:00:00 1970
  14449. +++ linux/drivers/scsi/qlogicisp.c    Sun May 19 15:45:19 1996
  14450. @@ -0,0 +1,1599 @@
  14451. +/*
  14452. + * QLogic ISP1020 Intelligent SCSI Processor Driver (PCI)
  14453. + * Written by Erik H. Moe, ehm@cris.com
  14454. + * Copyright 1995, Erik H. Moe
  14455. + *
  14456. + * This program is free software; you can redistribute it and/or modify it
  14457. + * under the terms of the GNU General Public License as published by the
  14458. + * Free Software Foundation; either version 2, or (at your option) any
  14459. + * later version.
  14460. + *
  14461. + * This program is distributed in the hope that it will be useful, but
  14462. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  14463. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14464. + * General Public License for more details.
  14465. + */
  14466. +
  14467. +/* Renamed and updated to 1.3.x by Michael Griffith <grif@cs.ucr.edu> */
  14468. +
  14469. +/*
  14470. + * $Date: 1995/09/22 02:23:15 $
  14471. + * $Revision: 0.5 $
  14472. + *
  14473. + * $Log: isp1020.c,v $
  14474. + * Revision 0.5  1995/09/22  02:23:15  root
  14475. + * do auto request sense
  14476. + *
  14477. + * Revision 0.4  1995/08/07  04:44:33  root
  14478. + * supply firmware with driver.
  14479. + * numerous bug fixes/general cleanup of code.
  14480. + *
  14481. + * Revision 0.3  1995/07/16  16:15:39  root
  14482. + * added reset/abort code.
  14483. + *
  14484. + * Revision 0.2  1995/06/29  03:14:19  root
  14485. + * fixed biosparam.
  14486. + * added queue protocol.
  14487. + *
  14488. + * Revision 0.1  1995/06/25  01:55:45  root
  14489. + * Initial release.
  14490. + *
  14491. + */
  14492. +
  14493. +#include <linux/blk.h>
  14494. +#include <linux/kernel.h>
  14495. +#include <linux/string.h>
  14496. +#include <linux/ioport.h>
  14497. +#include <linux/sched.h>
  14498. +#include <linux/types.h>
  14499. +#include <linux/bios32.h>
  14500. +#include <linux/pci.h>
  14501. +#include <unistd.h>
  14502. +#include <asm/io.h>
  14503. +#include <asm/irq.h>
  14504. +
  14505. +#include "sd.h"
  14506. +#include "hosts.h"
  14507. +#include "qlogicisp.h"
  14508. +
  14509. +/* Configuration section *****************************************************/
  14510. +
  14511. +/* Set the following macro to 1 to reload the ISP1020's firmware.  This is
  14512. +   the latest firmware provided by QLogic.  This may be an earlier/later
  14513. +   revision than supplied by your board. */
  14514. +
  14515. +#define RELOAD_FIRMWARE        1
  14516. +
  14517. +/* Set the following macro to 1 to reload the ISP1020's defaults from nvram.
  14518. +   If you are not sure of your settings, leave this alone, the driver will
  14519. +   use a set of 'safe' defaults */
  14520. +
  14521. +#define USE_NVRAM_DEFAULTS    0
  14522. +
  14523. +/*  Set this macro to 1 if you want to create a scsi loadable module. */
  14524. +
  14525. +#define MODULE            0
  14526. +
  14527. +/*  Macros used for debuging */
  14528. +
  14529. +#define DEBUG_ISP1020        0
  14530. +#define DEBUG_ISP1020_INT    0
  14531. +#define DEBUG_ISP1020_SETUP    0
  14532. +
  14533. +/* End Configuration section *************************************************/
  14534. +
  14535. +#include <linux/module.h>
  14536. +
  14537. +#if DEBUG_ISP1020
  14538. +#define ENTER(x)    printk("isp1020 : entering %s()\n", x);
  14539. +#define LEAVE(x)    printk("isp1020 : leaving %s()\n", x);
  14540. +#define DEBUG(x)    x
  14541. +#else
  14542. +#define ENTER(x)
  14543. +#define LEAVE(x)
  14544. +#define DEBUG(x)
  14545. +#endif /* DEBUG_ISP1020 */
  14546. +
  14547. +#if DEBUG_ISP1020_INTR
  14548. +#define ENTER_INTR(x)    printk("isp1020 : entering %s()\n", x);
  14549. +#define LEAVE_INTR(x)    printk("isp1020 : leaving %s()\n", x);
  14550. +#define DEBUG_INTR(x)    x
  14551. +#else
  14552. +#define ENTER_INTR(x)
  14553. +#define LEAVE_INTR(x)
  14554. +#define DEBUG_INTR(x)
  14555. +#endif /* DEBUG ISP1020_INTR */
  14556. +
  14557. +#define ISP1020_REV_ID    1
  14558. +
  14559. +/* host configuration and control registers */
  14560. +#define HOST_HCCR    0xc0    /* host command and control */
  14561. +
  14562. +/* pci bus interface registers */
  14563. +#define PCI_ID_LOW    0x00    /* vendor id */
  14564. +#define PCI_ID_HIGH    0x02    /* device id */
  14565. +#define ISP_CFG0    0x04    /* configuration register #0 */
  14566. +#define ISP_CFG1    0x08    /* configuration register #1 */
  14567. +#define PCI_INTF_CTL    0x08    /* pci interface control */
  14568. +#define PCI_INTF_STS    0x0a    /* pci interface status */
  14569. +#define PCI_SEMAPHORE    0x0c    /* pci semaphore */
  14570. +#define PCI_NVRAM    0x0e    /* pci nvram interface */
  14571. +
  14572. +/* mailbox registers */
  14573. +#define MBOX0        0x70    /* mailbox 0 */
  14574. +#define MBOX1        0x72    /* mailbox 1 */
  14575. +#define MBOX2        0x74    /* mailbox 2 */
  14576. +#define MBOX3        0x76    /* mailbox 3 */
  14577. +#define MBOX4        0x78    /* mailbox 4 */
  14578. +#define MBOX5        0x7a    /* mailbox 5 */
  14579. +
  14580. +/* mailbox command complete status codes */
  14581. +#define MBOX_COMMAND_COMPLETE        0x4000
  14582. +#define INVALID_COMMAND            0x4001
  14583. +#define HOST_INTERFACE_ERROR        0x4002
  14584. +#define TEST_FAILED            0x4003
  14585. +#define COMMAND_ERROR            0x4005
  14586. +#define COMMAND_PARAM_ERROR        0x4006
  14587. +
  14588. +/* async event status codes */
  14589. +#define ASYNC_SCSI_BUS_RESET        0x8001
  14590. +#define SYSTEM_ERROR            0x8002
  14591. +#define REQUEST_TRANSFER ERROR        0x8003
  14592. +#define RESPONSE_TRANSFER_ERROR        0x8004
  14593. +#define REQUEST_QUEUE_WAKEUP        0x8005
  14594. +#define EXECUTION_TIMEOUT_RESET        0x8006
  14595. +
  14596. +struct Entry_header {
  14597. +    u_char    entry_type;
  14598. +    u_char    entry_cnt;
  14599. +    u_char    sys_def_1;
  14600. +    u_char    flags;
  14601. +};
  14602. +
  14603. +/* entry header type commands */
  14604. +#define ENTRY_COMMAND        1
  14605. +#define ENTRY_CONTINUATION    2
  14606. +#define ENTRY_STATUS        3
  14607. +#define ENTRY_MARKER        4
  14608. +#define ENTRY_EXTENDED_COMMAND    5
  14609. +
  14610. +/* entry header flag definitions */
  14611. +#define EFLAG_CONTINUATION    1
  14612. +#define EFLAG_BUSY        2
  14613. +#define EFLAG_BAD_HEADER    4
  14614. +#define EFLAG_BAD_PAYLOAD    8
  14615. +
  14616. +struct dataseg {
  14617. +    caddr_t   d_base;
  14618. +    u_long    d_count;
  14619. +};
  14620. +
  14621. +struct Command_Entry {
  14622. +    struct    Entry_header    hdr;
  14623. +    caddr_t   handle;
  14624. +    u_char    target_lun;
  14625. +    u_char    target_id;
  14626. +    u_short   cdb_length;
  14627. +    u_short   control_flags;
  14628. +    u_short   rsvd;
  14629. +    u_short   time_out;
  14630. +    u_short   segment_cnt;
  14631. +    u_char    cdb[12];
  14632. +    struct    dataseg    dataseg0;
  14633. +    struct    dataseg    dataseg1;
  14634. +    struct    dataseg    dataseg2;
  14635. +    struct    dataseg    dataseg3;
  14636. +};
  14637. +
  14638. +/* command entry control flag definitions */
  14639. +#define CFLAG_NODISC        0x01
  14640. +#define CFLAG_HEAD_TAG        0x02
  14641. +#define CFLAG_ORDERED_TAG    0x04
  14642. +#define CFLAG_SIMPLE_TAG    0x08
  14643. +#define CFLAG_TAR_RTN        0x10
  14644. +#define CFLAG_READ        0x20
  14645. +#define CFLAG_WRITE        0x40
  14646. +
  14647. +struct Ext_Command_Entry {
  14648. +    struct    Entry_header    hdr;
  14649. +    caddr_t   handle;
  14650. +    u_char    target_lun;
  14651. +    u_char    target_id;
  14652. +    u_short   cdb_length;
  14653. +    u_short   control_flags;
  14654. +    u_short   rsvd;
  14655. +    u_short   time_out;
  14656. +    u_short   segment_cnt;
  14657. +    u_char    cdb[44];
  14658. +};
  14659. +
  14660. +struct Continuation_Entry {
  14661. +    struct    Entry_header    hdr;
  14662. +    u_long    reserved;
  14663. +    struct    dataseg    dataseg0;
  14664. +    struct    dataseg    dataseg1;
  14665. +    struct    dataseg    dataseg2;
  14666. +    struct    dataseg    dataseg3;
  14667. +    struct    dataseg    dataseg4;
  14668. +    struct    dataseg    dataseg5;
  14669. +    struct    dataseg    dataseg6;
  14670. +};
  14671. +
  14672. +struct Marker_Entry {
  14673. +    struct    Entry_header    hdr;
  14674. +    caddr_t   reserved;
  14675. +    u_char    target_lun;
  14676. +    u_char    target_id;
  14677. +    u_char    modifier;
  14678. +    u_char    rsvd;
  14679. +    u_char    rsvds[52];
  14680. +};
  14681. +
  14682. +/* marker entry modifier definitions */
  14683. +#define SYNC_DEVICE    0
  14684. +#define SYNC_TARGET    1
  14685. +#define SYNC_ALL    2
  14686. +
  14687. +struct Status_Entry {
  14688. +    struct    Entry_header    hdr;
  14689. +    caddr_t   handle;
  14690. +    u_short   scsi_status;
  14691. +    u_short   completion_status;
  14692. +    u_short   state_flags;
  14693. +    u_short   status_flags;
  14694. +    u_short   time;
  14695. +    u_short   req_sense_len;
  14696. +    u_long    residual;
  14697. +    u_char    rsvd[8];
  14698. +    u_char    req_sense_data[32];
  14699. +};
  14700. +
  14701. +/* status entry completion status definitions */
  14702. +#define CS_COMPLETE            0x0000
  14703. +#define CS_INCOMPLETE            0x0001
  14704. +#define CS_DMA_ERROR            0x0002
  14705. +#define CS_TRANSPORT_ERROR        0x0003
  14706. +#define CS_RESET_OCCURRED        0x0004
  14707. +#define CS_ABORTED            0x0005
  14708. +#define CS_TIMEOUT            0x0006
  14709. +#define CS_DATA_OVERRUN            0x0007
  14710. +#define CS_COMMAND_OVERRUN        0x0008
  14711. +#define CS_STATUS_OVERRUN        0x0009
  14712. +#define CS_BAD_MESSAGE            0x000a
  14713. +#define CS_NO_MESSAGE_OUT        0x000b
  14714. +#define CS_EXT_ID_FAILED        0x000c
  14715. +#define CS_IDE_MSG_FAILED        0x000d
  14716. +#define CS_ABORT_MSG_FAILED        0x000e
  14717. +#define CS_REJECT_MSG_FAILED        0x000f
  14718. +#define CS_NOP_MSG_FAILED        0x0010
  14719. +#define CS_PARITY_ERROR_MSG_FAILED    0x0011
  14720. +#define CS_DEVICE_RESET_MSG_FAILED    0x0012
  14721. +#define CS_ID_MSG_FAILED        0x0013
  14722. +#define CS_UNEXP_BUS_FREE        0x0014
  14723. +#define CS_DATA_UNDERRUN        0x0015
  14724. +
  14725. +/* status entry state flag definitions */
  14726. +#define SF_GOT_BUS            0x0100
  14727. +#define SF_GOT_TARGET            0x0200
  14728. +#define SF_SENT_CDB            0x0400
  14729. +#define SF_TRANSFERRED_DATA        0x0800
  14730. +#define SF_GOT_STATUS            0x1000
  14731. +#define SF_GOT_SENSE            0x2000
  14732. +
  14733. +/* status entry status flag definitions */
  14734. +#define STF_DISCONNECT            0x0001
  14735. +#define STF_SYNCHRONOUS            0x0002
  14736. +#define STF_PARITY_ERROR        0x0004
  14737. +#define STF_BUS_RESET            0x0008
  14738. +#define STF_DEVICE_RESET        0x0010
  14739. +#define STF_ABORTED            0x0020
  14740. +#define STF_TIMEOUT            0x0040
  14741. +#define STF_NEGOTIATION            0x0080
  14742. +
  14743. +/* host control commands */
  14744. +#define HCCR_NOP            0x0000
  14745. +#define HCCR_RESET            0x1000
  14746. +#define HCCR_PAUSE            0x2000
  14747. +#define HCCR_RELEASE            0x3000
  14748. +#define HCCR_SINGLE_STEP        0x4000
  14749. +#define HCCR_SET_HOST_INTR        0x5000
  14750. +#define HCCR_CLEAR_HOST_INTR        0x6000
  14751. +#define HCCR_CLEAR_RISC_INTR        0x7000
  14752. +#define HCCR_BP_ENABLE            0x8000
  14753. +#define HCCR_BIOS_ENABLE        0x9000
  14754. +#define HCCR_TEST_MODE            0xf000
  14755. +
  14756. +/* mailbox commands */
  14757. +#define MBOX_NO_OP            0x0000
  14758. +#define MBOX_LOAD_RAM            0x0001
  14759. +#define MBOX_EXEC_FIRMWARE        0x0002
  14760. +#define MBOX_DUMP_RAM            0x0003
  14761. +#define MBOX_WRITE_RAM_WORD        0x0004
  14762. +#define MBOX_READ_RAM_WORD        0x0005
  14763. +#define MBOX_MAILBOX_REG_TEST        0x0006
  14764. +#define MBOX_VERIFY_CHECKSUM        0x0007
  14765. +#define MBOX_ABOUT_FIRMWARE        0x0008
  14766. +#define MBOX_CHECK_FIRMWARE        0x000e
  14767. +#define MBOX_INIT_REQ_QUEUE        0x0010
  14768. +#define MBOX_INIT_RES_QUEUE        0x0011
  14769. +#define MBOX_EXECUTE_IOCB        0x0012
  14770. +#define MBOX_WAKE_UP            0x0013
  14771. +#define MBOX_STOP_FIRMWARE        0x0014
  14772. +#define MBOX_ABORT            0x0015
  14773. +#define MBOX_ABORT_DEVICE        0x0016
  14774. +#define MBOX_ABORT_TARGET        0x0017
  14775. +#define MBOX_BUS_RESET            0x0018
  14776. +#define MBOX_STOP_QUEUE            0x0019
  14777. +#define MBOX_START_QUEUE        0x001a
  14778. +#define MBOX_SINGLE_STEP_QUEUE        0x001b
  14779. +#define MBOX_ABORT_QUEUE        0x001c
  14780. +#define MBOX_GET_DEV_QUEUE_STATUS    0x001d
  14781. +#define MBOX_GET_FIRMWARE_STATUS    0x001f
  14782. +#define MBOX_GET_INIT_SCSI_ID        0x0020
  14783. +#define MBOX_GET_SELECT_TIMEOUT        0x0021
  14784. +#define MBOX_GET_RETRY_COUNT        0x0022
  14785. +#define MBOX_GET_TAG_AGE_LIMIT        0x0023
  14786. +#define MBOX_GET_CLOCK_RATE        0x0024
  14787. +#define MBOX_GET_ACT_NEG_STATE        0x0025
  14788. +#define MBOX_GET_ASYNC_DATA_SETUP_TIME    0x0026
  14789. +#define MBOX_GET_PCI_PARAMS        0x0027
  14790. +#define MBOX_GET_TARGET_PARAMS        0x0028
  14791. +#define MBOX_GET_DEV_QUEUE_PARAMS    0x0029
  14792. +#define MBOX_SET_INIT_SCSI_ID        0x0030
  14793. +#define MBOX_SET_SELECT_TIMEOUT        0x0031
  14794. +#define MBOX_SET_RETRY_COUNT        0x0032
  14795. +#define MBOX_SET_TAG_AGE_LIMIT        0x0033
  14796. +#define MBOX_SET_CLOCK_RATE        0x0034
  14797. +#define MBOX_SET_ACTIVE_NEG_STATE    0x0035
  14798. +#define MBOX_SET_ASYNC_DATA_SETUP_TIME    0x0036
  14799. +#define MBOX_SET_PCI_CONTROL_PARAMS    0x0037
  14800. +#define MBOX_SET_TARGET_PARAMS        0x0038
  14801. +#define MBOX_SET_DEV_QUEUE_PARAMS    0x0039
  14802. +#define MBOX_RETURN_BIOS_BLOCK_ADDR    0x0040
  14803. +#define MBOX_WRITE_FOUR_RAM_WORDS    0x0041
  14804. +#define MBOX_EXEC_BIOS_IOCB        0x0042
  14805. +
  14806. +#include "qlogicisp_asm.c"
  14807. +
  14808. +#define PACKB(a, b)            (((a)<<4)|(b))
  14809. +
  14810. +u_char mbox_param[] = {
  14811. +    PACKB(1, 1),    /* MBOX_NO_OP */
  14812. +    PACKB(5, 5),    /* MBOX_LOAD_RAM */
  14813. +    PACKB(2, 0),    /* MBOX_EXEC_FIRMWARE */
  14814. +    PACKB(5, 5),    /* MBOX_DUMP_RAM */
  14815. +    PACKB(3, 3),    /* MBOX_WRITE_RAM_WORD */
  14816. +    PACKB(2, 3),    /* MBOX_READ_RAM_WORD */
  14817. +    PACKB(6, 6),    /* MBOX_MAILBOX_REG_TEST */
  14818. +    PACKB(2, 3),    /* MBOX_VERIFY_CHECKSUM    */
  14819. +    PACKB(1, 3),    /* MBOX_ABOUT_FIRMWARE */
  14820. +    PACKB(0, 0),    /* 0x0009 */
  14821. +    PACKB(0, 0),    /* 0x000a */
  14822. +    PACKB(0, 0),    /* 0x000b */
  14823. +    PACKB(0, 0),    /* 0x000c */
  14824. +    PACKB(0, 0),    /* 0x000d */
  14825. +    PACKB(1, 2),    /* MBOX_CHECK_FIRMWARE */
  14826. +    PACKB(0, 0),    /* 0x000f */
  14827. +    PACKB(5, 5),    /* MBOX_INIT_REQ_QUEUE */
  14828. +    PACKB(6, 6),    /* MBOX_INIT_RES_QUEUE */
  14829. +    PACKB(4, 4),    /* MBOX_EXECUTE_IOCB */
  14830. +    PACKB(2, 2),    /* MBOX_WAKE_UP    */
  14831. +    PACKB(1, 6),    /* MBOX_STOP_FIRMWARE */
  14832. +    PACKB(4, 4),    /* MBOX_ABORT */
  14833. +    PACKB(2, 2),    /* MBOX_ABORT_DEVICE */
  14834. +    PACKB(3, 3),    /* MBOX_ABORT_TARGET */
  14835. +    PACKB(2, 2),    /* MBOX_BUS_RESET */
  14836. +    PACKB(2, 3),    /* MBOX_STOP_QUEUE */
  14837. +    PACKB(2, 3),    /* MBOX_START_QUEUE */
  14838. +    PACKB(2, 3),    /* MBOX_SINGLE_STEP_QUEUE */
  14839. +    PACKB(2, 3),    /* MBOX_ABORT_QUEUE */
  14840. +    PACKB(2, 4),    /* MBOX_GET_DEV_QUEUE_STATUS */
  14841. +    PACKB(0, 0),    /* 0x001e */
  14842. +    PACKB(1, 3),    /* MBOX_GET_FIRMWARE_STATUS */
  14843. +    PACKB(1, 2),    /* MBOX_GET_INIT_SCSI_ID */
  14844. +    PACKB(1, 2),    /* MBOX_GET_SELECT_TIMEOUT */
  14845. +    PACKB(1, 3),    /* MBOX_GET_RETRY_COUNT    */
  14846. +    PACKB(1, 2),    /* MBOX_GET_TAG_AGE_LIMIT */
  14847. +    PACKB(1, 2),    /* MBOX_GET_CLOCK_RATE */
  14848. +    PACKB(1, 2),    /* MBOX_GET_ACT_NEG_STATE */
  14849. +    PACKB(1, 2),    /* MBOX_GET_ASYNC_DATA_SETUP_TIME */
  14850. +    PACKB(1, 3),    /* MBOX_GET_PCI_PARAMS */
  14851. +    PACKB(2, 4),    /* MBOX_GET_TARGET_PARAMS */
  14852. +    PACKB(2, 4),    /* MBOX_GET_DEV_QUEUE_PARAMS */
  14853. +    PACKB(0, 0),    /* 0x002a */
  14854. +    PACKB(0, 0),    /* 0x002b */
  14855. +    PACKB(0, 0),    /* 0x002c */
  14856. +    PACKB(0, 0),    /* 0x002d */
  14857. +    PACKB(0, 0),    /* 0x002e */
  14858. +    PACKB(0, 0),    /* 0x002f */
  14859. +    PACKB(2, 2),    /* MBOX_SET_INIT_SCSI_ID */
  14860. +    PACKB(2, 2),    /* MBOX_SET_SELECT_TIMEOUT */
  14861. +    PACKB(3, 3),    /* MBOX_SET_RETRY_COUNT    */
  14862. +    PACKB(2, 2),    /* MBOX_SET_TAG_AGE_LIMIT */
  14863. +    PACKB(2, 2),    /* MBOX_SET_CLOCK_RATE */
  14864. +    PACKB(2, 2),    /* MBOX_SET_ACTIVE_NEG_STATE */
  14865. +    PACKB(2, 2),    /* MBOX_SET_ASYNC_DATA_SETUP_TIME */
  14866. +    PACKB(3, 3),    /* MBOX_SET_PCI_CONTROL_PARAMS */
  14867. +    PACKB(4, 4),    /* MBOX_SET_TARGET_PARAMS */
  14868. +    PACKB(4, 4),    /* MBOX_SET_DEV_QUEUE_PARAMS */
  14869. +    PACKB(0, 0),    /* 0x003a */
  14870. +    PACKB(0, 0),    /* 0x003b */
  14871. +    PACKB(0, 0),    /* 0x003c */
  14872. +    PACKB(0, 0),    /* 0x003d */
  14873. +    PACKB(0, 0),    /* 0x003e */
  14874. +    PACKB(0, 0),    /* 0x003f */
  14875. +    PACKB(1, 2),    /* MBOX_RETURN_BIOS_BLOCK_ADDR */
  14876. +    PACKB(6, 1),    /* MBOX_WRITE_FOUR_RAM_WORDS */
  14877. +    PACKB(2, 3)        /* MBOX_EXEC_BIOS_IOCB */
  14878. +};
  14879. +
  14880. +#define MAX_MBOX_COMMAND    (sizeof(mbox_param)/sizeof(u_short))
  14881. +
  14882. +struct host_param {
  14883. +    u_short    fifo_threshold;
  14884. +    u_short    host_adapter_enable;
  14885. +    u_short    initiator_scsi_id;
  14886. +    u_short    bus_reset_delay;
  14887. +    u_short    retry_count;
  14888. +    u_short    retry_delay;
  14889. +    u_short    async_data_setup_time;
  14890. +    u_short    req_ack_active_negation;
  14891. +    u_short    data_line_active_negation;
  14892. +    u_short    data_dma_burst_enable;
  14893. +    u_short    command_dma_burst_enable;
  14894. +    u_short    tag_aging;
  14895. +    u_short    selection_timeout;
  14896. +    u_short    max_queue_depth;
  14897. +};
  14898. +
  14899. +/*
  14900. + * Device Flags:
  14901. + *
  14902. + * Bit  Name
  14903. + * ---------
  14904. + *  7   Disconnect Privilege
  14905. + *  6   Parity Checking
  14906. + *  5   Wide Data Transfers
  14907. + *  4   Syncronous Data Transfers
  14908. + *  3   Tagged Queuing
  14909. + *  2   Automatic Request Sense
  14910. + *  1   Stop Queue on Check Condition
  14911. + *  0   Renegotiate on Error
  14912. + */
  14913. +
  14914. +struct dev_param {
  14915. +    u_short    device_flags;
  14916. +    u_short    execution_throttle;
  14917. +    u_short    synchronous_period;
  14918. +    u_short    synchronous_offset;
  14919. +    u_short    device_enable;
  14920. +};
  14921. +
  14922. +#define REQ_QUEUE_LEN        32
  14923. +#define RES_QUEUE_LEN        32
  14924. +#define QUEUE_ENTRY_LEN        64
  14925. +
  14926. +struct isp1020_hostdata {
  14927. +    u_char    irq;
  14928. +    u_char    bus;
  14929. +    u_long    io_base;
  14930. +    u_char    revision;
  14931. +    u_char    device_fn;
  14932. +    u_short   res_queue_in_ptr;
  14933. +    u_short   res_queue_out_ptr;
  14934. +    u_short   req_queue_in_ptr;
  14935. +    u_short   req_queue_out_ptr;
  14936. +    struct    host_param host_param;
  14937. +    struct    dev_param dev_param[16];
  14938. +    char      res_queue[RES_QUEUE_LEN][QUEUE_ENTRY_LEN];
  14939. +    char      req_queue[REQ_QUEUE_LEN][QUEUE_ENTRY_LEN];
  14940. +};
  14941. +
  14942. +struct isp1020_hostdata *irq2host[16];
  14943. +
  14944. +void isp1020_enable_irqs(struct isp1020_hostdata *);
  14945. +void isp1020_disable_irqs(struct isp1020_hostdata *);
  14946. +int isp1020_init(struct Scsi_Host *);
  14947. +int isp1020_reset_hardware(struct isp1020_hostdata *);
  14948. +int isp1020_get_defaults(struct isp1020_hostdata *);
  14949. +int isp1020_set_defaults(struct isp1020_hostdata *);
  14950. +int isp1020_load_parameters(struct isp1020_hostdata *);
  14951. +int isp1020_mbox_command(struct isp1020_hostdata *, u_short []); 
  14952. +u_short isp1020_read_nvram_word(struct isp1020_hostdata *, u_short);
  14953. +int isp1020_verify_nvram(struct isp1020_hostdata *);
  14954. +void isp1020_print_status_entry(struct Status_Entry *);
  14955. +void isp1020_print_scsi_cmd(Scsi_Cmnd *);
  14956. +void isp1020_scsi_done(Scsi_Cmnd *);
  14957. +int isp1020_return_status(struct Status_Entry *);
  14958. +void isp1020_intr_handler(int, struct pt_regs *);
  14959. +
  14960. +
  14961. +int isp1020_detect(Scsi_Host_Template *tmpt)
  14962. +{
  14963. +    int hosts = 0;
  14964. +    u_short index;
  14965. +    u_char bus, device_fn;
  14966. +    struct Scsi_Host *scsihost;
  14967. +    struct isp1020_hostdata *hostdata;
  14968. +
  14969. +    ENTER("isp1020_detect");
  14970. +
  14971. +    if (pcibios_present() == 0) {
  14972. +        printk("qlogicisp : PCI bios not present\n");
  14973. +        return 0;
  14974. +    }
  14975. +
  14976. +    memset(irq2host, 0, sizeof(irq2host));
  14977. +
  14978. +    for (index = 0; pcibios_find_device(PCI_VENDOR_ID_QLOGIC,
  14979. +            PCI_DEVICE_ID_QLOGIC_ISP1020, index, &bus, &device_fn) == 0;
  14980. +                index++) {
  14981. +
  14982. +        scsihost = scsi_register(tmpt, sizeof(struct isp1020_hostdata));
  14983. +        hostdata = (struct isp1020_hostdata *) scsihost->hostdata;
  14984. +
  14985. +        memset(hostdata, 0, sizeof(struct isp1020_hostdata));
  14986. +        hostdata->bus = bus;
  14987. +        hostdata->device_fn = device_fn;
  14988. +
  14989. +        if (isp1020_init(scsihost) || isp1020_reset_hardware(hostdata)
  14990. +#if USE_NVRAM_DEFAULTS
  14991. +                || isp1020_get_defaults(hostdata)
  14992. +#else
  14993. +                || isp1020_set_defaults(hostdata)
  14994. +#endif /* USE_NVRAM_DEFAULTS */
  14995. +                || isp1020_load_parameters(hostdata)) {
  14996. +            scsi_unregister(scsihost);
  14997. +            continue;
  14998. +        }
  14999. +
  15000. +        scsihost->this_id = hostdata->host_param.initiator_scsi_id;
  15001. +
  15002. +        if (request_irq(hostdata->irq, isp1020_intr_handler, 0,
  15003. +                "qlogicisp", NULL)) {
  15004. +            printk("qlogicisp : interrupt %d already in use\n", hostdata->irq);
  15005. +            scsi_unregister(scsihost);
  15006. +            continue;
  15007. +        }
  15008. +
  15009. +        if (check_region(hostdata->io_base, 0xff)) {
  15010. +            printk("qlogicisp : i/o region 0x%04lx-0x%04lx already in use\n",
  15011. +                hostdata->io_base, hostdata->io_base + 0xff);
  15012. +            free_irq(hostdata->irq, NULL);
  15013. +            scsi_unregister(scsihost);
  15014. +            continue;
  15015. +        }
  15016. +
  15017. +        request_region(hostdata->io_base, 0xff, "qlogicisp");
  15018. +        irq2host[hostdata->irq] = hostdata;
  15019. +
  15020. +        isp1020_enable_irqs(hostdata);
  15021. +
  15022. +        hosts++;
  15023. +    }
  15024. +
  15025. +    LEAVE("isp1020_detect");
  15026. +
  15027. +    return hosts;
  15028. +}
  15029. +
  15030. +
  15031. +int isp1020_release(struct Scsi_Host *host)
  15032. +{
  15033. +    struct isp1020_hostdata *hostdata;
  15034. +
  15035. +    ENTER("isp1020_release");
  15036. +
  15037. +    hostdata = (struct isp1020_hostdata *) host->hostdata;
  15038. +
  15039. +    outw(0x0, hostdata->io_base + PCI_INTF_CTL);
  15040. +    free_irq(hostdata->irq, NULL);
  15041. +
  15042. +    release_region(hostdata->io_base, 0xff);
  15043. +
  15044. +    LEAVE("isp1020_release");
  15045. +
  15046. +    return 0;
  15047. +}
  15048. +
  15049. +
  15050. +const char *isp1020_info(struct Scsi_Host *host)
  15051. +{
  15052. +    static char buf[80];
  15053. +    struct isp1020_hostdata *hostdata;
  15054. +
  15055. +    ENTER("isp1020_info");
  15056. +
  15057. +    hostdata = (struct isp1020_hostdata *) host->hostdata;
  15058. +    sprintf(buf, "QLogic ISP1020 SCSI on PCI bus %d, device %d, irq %d",
  15059. +        hostdata->bus, (hostdata->device_fn & 0xf8) >> 3, hostdata->irq);
  15060. +
  15061. +    LEAVE("isp1020_info");
  15062. +
  15063. +    return buf;
  15064. +}
  15065. +
  15066. +
  15067. +#define REQ_QUEUE_DEPTH() \
  15068. +    (hostdata->req_queue_in_ptr >= hostdata->req_queue_out_ptr \
  15069. +        ? hostdata->req_queue_in_ptr - hostdata->req_queue_out_ptr \
  15070. +        : (REQ_QUEUE_LEN - hostdata->req_queue_out_ptr) \
  15071. +        + hostdata->req_queue_in_ptr)
  15072. +    
  15073. +
  15074. +int isp1020_queuecommand(Scsi_Cmnd *Cmnd, void (* done)(Scsi_Cmnd *))
  15075. +{
  15076. +    int i, *iptr, sg_count;
  15077. +    struct scatterlist *sg;
  15078. +    struct Command_Entry *cmd;
  15079. +    struct isp1020_hostdata *hostdata;
  15080. +
  15081. +    ENTER("isp1020_queuecommand");
  15082. +
  15083. +    hostdata = (struct isp1020_hostdata *) Cmnd->host->hostdata;
  15084. +    Cmnd->scsi_done = done;
  15085. +
  15086. +    DEBUG(isp1020_print_scsi_cmd(Cmnd);)
  15087. +
  15088. +    hostdata->req_queue_out_ptr = inw(hostdata->io_base + MBOX4);
  15089. +
  15090. +    if ((hostdata->req_queue_in_ptr + 1) % REQ_QUEUE_LEN ==
  15091. +            hostdata->req_queue_out_ptr) {
  15092. +        printk("qlogicisp : request queue overflow\n");
  15093. +        return 1;
  15094. +    }
  15095. +
  15096. +    DEBUG(printk("qlogicisp : request queue depth %d\n", REQ_QUEUE_DEPTH()));
  15097. +
  15098. +    cmd = (struct Command_Entry *)
  15099. +        &hostdata->req_queue[hostdata->req_queue_in_ptr][0];
  15100. +
  15101. +    memset(cmd, 0, sizeof(struct Command_Entry));
  15102. +
  15103. +    cmd->hdr.entry_type = ENTRY_COMMAND;
  15104. +    cmd->hdr.entry_cnt = 1;
  15105. +
  15106. +    cmd->handle = (caddr_t) Cmnd;
  15107. +    cmd->target_lun = Cmnd->lun;
  15108. +    cmd->target_id = Cmnd->target;
  15109. +    cmd->cdb_length = Cmnd->cmd_len;
  15110. +    cmd->control_flags = CFLAG_READ | CFLAG_WRITE;
  15111. +
  15112. +    for (i = 0; i < Cmnd->cmd_len; i++)
  15113. +        cmd->cdb[i] = Cmnd->cmnd[i];
  15114. +
  15115. +    if (Cmnd->use_sg) {
  15116. +        cmd->segment_cnt = sg_count = Cmnd->use_sg;
  15117. +        sg = (struct scatterlist *) Cmnd->request_buffer;
  15118. +        iptr = (int *) &cmd->dataseg0.d_base;
  15119. +
  15120. +        for (i = 0; sg_count > 0; sg_count--, i++) {
  15121. +            *iptr++ = (int) sg[i].address;
  15122. +            *iptr++ = sg[i].length;
  15123. +        }
  15124. +    }
  15125. +    else {
  15126. +        cmd->dataseg0.d_base = (caddr_t) Cmnd->request_buffer;
  15127. +        cmd->dataseg0.d_count = (u_long) Cmnd->request_bufflen;
  15128. +        cmd->segment_cnt = 1;
  15129. +    }
  15130. +
  15131. +    hostdata->req_queue_in_ptr = (hostdata->req_queue_in_ptr + 1)
  15132. +        % REQ_QUEUE_LEN;
  15133. +
  15134. +    outw(hostdata->req_queue_in_ptr, hostdata->io_base + MBOX4);
  15135. +
  15136. +    LEAVE("isp1020_queuecommand");
  15137. +
  15138. +    return 0;
  15139. +}
  15140. +
  15141. +
  15142. +#define RES_QUEUE_DEPTH() \
  15143. +    (hostdata->res_queue_in_ptr >= hostdata->res_queue_out_ptr \
  15144. +        ? hostdata->res_queue_in_ptr - hostdata->res_queue_out_ptr \
  15145. +        : (RES_QUEUE_LEN - hostdata->res_queue_out_ptr) \
  15146. +        + hostdata->res_queue_in_ptr)
  15147. +
  15148. +int isp1020_abort(Scsi_Cmnd *Cmnd)
  15149. +{
  15150. +    u_short param[6];
  15151. +    struct isp1020_hostdata *hostdata;
  15152. +    int return_status = SCSI_ABORT_SUCCESS;
  15153. +
  15154. +    ENTER("isp1020_abort");
  15155. +
  15156. +    hostdata = (struct isp1020_hostdata *) Cmnd->host->hostdata;
  15157. +
  15158. +    isp1020_disable_irqs(hostdata);
  15159. +
  15160. +    DEBUG(printk("qlogicisp : response queue depth %d\n", RES_QUEUE_DEPTH()));
  15161. +
  15162. +    param[0] = MBOX_ABORT;
  15163. +    param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
  15164. +    param[2] = (u_long) Cmnd >> 16;
  15165. +    param[3] = (u_long) Cmnd & 0xffff;
  15166. +
  15167. +    isp1020_mbox_command(hostdata, param);
  15168. +
  15169. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15170. +        printk("qlogicisp : scsi abort failure: %x\n", param[0]);
  15171. +        return_status = SCSI_ABORT_ERROR;
  15172. +    }
  15173. +
  15174. +    isp1020_enable_irqs(hostdata);
  15175. +
  15176. +    LEAVE("isp1020_abort");
  15177. +
  15178. +    return return_status;
  15179. +}
  15180. +
  15181. +
  15182. +int isp1020_reset(Scsi_Cmnd *Cmnd)
  15183. +{
  15184. +    u_short param[6];
  15185. +    struct isp1020_hostdata *hostdata;
  15186. +    int return_status = SCSI_RESET_SUCCESS;
  15187. +
  15188. +    ENTER("isp1020_reset");
  15189. +
  15190. +    hostdata = (struct isp1020_hostdata *) Cmnd->host->hostdata;
  15191. +
  15192. +    param[0] = MBOX_BUS_RESET;
  15193. +    param[1] = hostdata->host_param.bus_reset_delay;
  15194. +
  15195. +    isp1020_disable_irqs(hostdata);
  15196. +
  15197. +    isp1020_mbox_command(hostdata, param);
  15198. +
  15199. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15200. +        printk("qlogicisp : scsi bus reset failure: %x\n", param[0]);
  15201. +        return_status = SCSI_RESET_ERROR;
  15202. +    }
  15203. +    
  15204. +    isp1020_enable_irqs(hostdata);
  15205. +
  15206. +    LEAVE("isp1020_reset");
  15207. +
  15208. +    return SCSI_RESET_SUCCESS;
  15209. +}
  15210. +
  15211. +
  15212. +int isp1020_biosparam(Disk *disk, int n, int ip[])
  15213. +{
  15214. +    int size = disk->capacity;
  15215. +
  15216. +    ENTER("isp1020_biosparam");
  15217. +
  15218. +    ip[0] = 64;
  15219. +    ip[1] = 32;
  15220. +    ip[2] = size >> 11;
  15221. +    if (ip[2] > 1024) {
  15222. +        ip[0] = 255;
  15223. +        ip[1] = 63;
  15224. +        ip[2] = size / (ip[0] * ip[1]);
  15225. +        if (ip[2] > 1023)
  15226. +            ip[2] = 1023;
  15227. +    }
  15228. +
  15229. +    LEAVE("isp1020_biosparam");
  15230. +
  15231. +    return 0;
  15232. +}
  15233. +
  15234. +
  15235. +int isp1020_reset_hardware(struct isp1020_hostdata *hostdata)
  15236. +{
  15237. +    u_short param[6];
  15238. +
  15239. +    ENTER("isp1020_reset_hardware");
  15240. +
  15241. +    outw(0x0001, hostdata->io_base + PCI_INTF_CTL);
  15242. +    outw(HCCR_RESET, hostdata->io_base + HOST_HCCR);
  15243. +    outw(HCCR_RELEASE, hostdata->io_base + HOST_HCCR);
  15244. +    outw(HCCR_BIOS_ENABLE, hostdata->io_base + HOST_HCCR);
  15245. +
  15246. +    while (inw(hostdata->io_base + MBOX0))
  15247. +        barrier();
  15248. +
  15249. +#if DEBUG_ISP1020
  15250. +    printk("qlogicisp : mbox 0 0x%04x \n", inw(hostdata->io_base + MBOX0));
  15251. +    printk("qlogicisp : mbox 1 0x%04x \n", inw(hostdata->io_base + MBOX1));
  15252. +    printk("qlogicisp : mbox 2 0x%04x \n", inw(hostdata->io_base + MBOX2));
  15253. +    printk("qlogicisp : mbox 3 0x%04x \n", inw(hostdata->io_base + MBOX3));
  15254. +    printk("qlogicisp : mbox 4 0x%04x \n", inw(hostdata->io_base + MBOX4));
  15255. +    printk("qlogicisp : mbox 5 0x%04x \n", inw(hostdata->io_base + MBOX5));
  15256. +#endif /* DEBUG_ISP1020 */
  15257. +
  15258. +    DEBUG(printk("qlogicisp : loading risc ram\n");)
  15259. +
  15260. +#if RELOAD_FIRMWARE
  15261. +    { int i;
  15262. +        for (i = 0; i < risc_code_length01; i++) {
  15263. +            param[0] = MBOX_WRITE_RAM_WORD;
  15264. +            param[1] = risc_code_addr01 + i;
  15265. +            param[2] = risc_code01[i];
  15266. +
  15267. +            isp1020_mbox_command(hostdata, param);
  15268. +
  15269. +            if (param[0] != MBOX_COMMAND_COMPLETE) {
  15270. +                printk("qlogicisp : firmware load failure\n");
  15271. +                return 1;
  15272. +            }
  15273. +        }
  15274. +    }
  15275. +#endif /* RELOAD_FIRMEARE */
  15276. +
  15277. +    DEBUG(printk("qlogicisp : verifing checksum\n");)
  15278. +
  15279. +    param[0] = MBOX_VERIFY_CHECKSUM;
  15280. +    param[1] = risc_code_addr01;
  15281. +
  15282. +    isp1020_mbox_command(hostdata, param);
  15283. +
  15284. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15285. +        printk("qlogicisp : ram checksum failure\n");
  15286. +        return 1;
  15287. +    }
  15288. +
  15289. +    DEBUG(printk("qlogicisp : executing firmware\n");)
  15290. +
  15291. +    param[0] = MBOX_EXEC_FIRMWARE;
  15292. +    param[1] = risc_code_addr01;
  15293. +
  15294. +    isp1020_mbox_command(hostdata, param);
  15295. +
  15296. +    param[0] = MBOX_ABOUT_FIRMWARE;
  15297. +
  15298. +    isp1020_mbox_command(hostdata, param);
  15299. +
  15300. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15301. +        printk("qlogicisp : about firmware failure\n");
  15302. +        return 1;
  15303. +    }
  15304. +
  15305. +    DEBUG(printk("qlogicisp : firmware major revision %d\n", param[1]);)
  15306. +    DEBUG(printk("qlogicisp : firmware minor revision %d\n", param[2]);)
  15307. +
  15308. +    LEAVE("isp1020_reset_hardware");
  15309. +
  15310. +    return 0;
  15311. +}
  15312. +
  15313. +
  15314. +int isp1020_init(struct Scsi_Host *sh)
  15315. +{
  15316. +    u_long io_base;
  15317. +    struct isp1020_hostdata *hostdata;
  15318. +    u_char bus, device_fn, revision, irq;
  15319. +    u_short vendor_id, device_id, command;
  15320. +
  15321. +    ENTER("isp1020_init");
  15322. +
  15323. +    hostdata = (struct isp1020_hostdata *) sh->hostdata;
  15324. +    bus = hostdata->bus;
  15325. +    device_fn = hostdata->device_fn;
  15326. +
  15327. +    if (pcibios_read_config_word(bus, device_fn, PCI_VENDOR_ID, &vendor_id)
  15328. +            || pcibios_read_config_word(bus, device_fn,
  15329. +                PCI_DEVICE_ID, &device_id)
  15330. +            || pcibios_read_config_word(bus, device_fn,
  15331. +                PCI_COMMAND, &command)
  15332. +            || pcibios_read_config_dword(bus, device_fn,
  15333. +                PCI_BASE_ADDRESS_0, &io_base)
  15334. +        || pcibios_read_config_byte(bus, device_fn,
  15335. +                PCI_CLASS_REVISION, &revision)
  15336. +            || pcibios_read_config_byte(bus, device_fn,
  15337. +                PCI_INTERRUPT_LINE, &irq)) {
  15338. +        printk("qlogicisp : error reading PCI configuration\n");
  15339. +        return 1;
  15340. +    }
  15341. +
  15342. +    if (vendor_id != PCI_VENDOR_ID_QLOGIC) {
  15343. +        printk("qlogicisp : 0x%04x is not QLogic vendor ID\n", vendor_id);
  15344. +        return 1;
  15345. +    }
  15346. +
  15347. +    if (device_id != PCI_DEVICE_ID_QLOGIC_ISP1020) {
  15348. +        printk("qlogicisp : 0x%04x does not match ISP1020 device id\n",
  15349. +            device_id);
  15350. +        return 1;
  15351. +    }
  15352. +
  15353. +    if (command & PCI_COMMAND_IO && (io_base & 3) == 1)
  15354. +        io_base &= PCI_BASE_ADDRESS_IO_MASK;
  15355. +    else {
  15356. +        printk("qlogicisp : i/o mapping is disabled\n");
  15357. +        return 1;
  15358. +    }
  15359. +
  15360. +    if (!(command & PCI_COMMAND_MASTER)) {
  15361. +        printk("qlogicisp : bus mastering is disabled\n");
  15362. +        return 1;
  15363. +    }
  15364. +
  15365. +    if (revision != ISP1020_REV_ID)
  15366. +       printk("qlogicisp : warning : new isp1020 revision id\n");
  15367. +
  15368. +    if (inw(io_base + PCI_ID_LOW) != PCI_VENDOR_ID_QLOGIC
  15369. +            || inw(io_base + PCI_ID_HIGH) != PCI_DEVICE_ID_QLOGIC_ISP1020) {
  15370. +        printk("qlogicisp : can't decode i/o address space\n");
  15371. +        return 1;
  15372. +    }
  15373. +
  15374. +    hostdata->io_base = io_base;
  15375. +    hostdata->revision = revision;
  15376. +    hostdata->irq = irq;
  15377. +
  15378. +    LEAVE("isp1020_init");
  15379. +
  15380. +    return 0;
  15381. +}
  15382. +
  15383. +
  15384. +int isp1020_get_defaults(struct isp1020_hostdata *hostdata)
  15385. +{
  15386. +    int i;
  15387. +    u_short value;
  15388. +
  15389. +    ENTER("isp1020_get_defaults");
  15390. +
  15391. +    if (!isp1020_verify_nvram(hostdata)) {
  15392. +        printk("qlogicisp : nvram checksum failure\n");
  15393. +        return 1;
  15394. +    }
  15395. +
  15396. +    value = isp1020_read_nvram_word(hostdata, 2);
  15397. +    hostdata->host_param.fifo_threshold = (value >> 8) & 0x03;
  15398. +    hostdata->host_param.host_adapter_enable = (value >> 11) & 0x01;
  15399. +    hostdata->host_param.initiator_scsi_id = (value >> 12) & 0x0f;
  15400. +
  15401. +    value = isp1020_read_nvram_word(hostdata, 3);
  15402. +    hostdata->host_param.bus_reset_delay = value & 0xff;
  15403. +    hostdata->host_param.retry_count = value >> 8;
  15404. +
  15405. +    value = isp1020_read_nvram_word(hostdata, 4);
  15406. +    hostdata->host_param.retry_delay = value & 0xff;
  15407. +    hostdata->host_param.async_data_setup_time = (value >> 8) & 0x0f;
  15408. +    hostdata->host_param.req_ack_active_negation = (value >> 12) & 0x01;
  15409. +    hostdata->host_param.data_line_active_negation = (value >> 13) & 0x01;
  15410. +    hostdata->host_param.data_dma_burst_enable = (value >> 14) & 0x01;
  15411. +    hostdata->host_param.command_dma_burst_enable = (value >> 15);
  15412. +
  15413. +    value = isp1020_read_nvram_word(hostdata, 5);
  15414. +    hostdata->host_param.tag_aging = value & 0xff;
  15415. +
  15416. +    value = isp1020_read_nvram_word(hostdata, 6);
  15417. +    hostdata->host_param.selection_timeout = value & 0xffff;
  15418. +
  15419. +    value = isp1020_read_nvram_word(hostdata, 7);
  15420. +    hostdata->host_param.max_queue_depth = value & 0xffff;
  15421. +
  15422. +#if DEBUG_ISP1020_SETUP
  15423. +    printk("qlogicisp : fifo threshold=%d\n",
  15424. +        hostdata->host_param.fifo_threshold);
  15425. +    printk("qlogicisp : initiator scsi id=%d\n",
  15426. +        hostdata->host_param.initiator_scsi_id);
  15427. +    printk("qlogicisp : bus reset delay=%d\n",
  15428. +        hostdata->host_param.bus_reset_delay);
  15429. +    printk("qlogicisp : retry count=%d\n",
  15430. +    hostdata->host_param.retry_count);
  15431. +    printk("qlogicisp : retry delay=%d\n",
  15432. +        hostdata->host_param.retry_delay);
  15433. +    printk("qlogicisp : async data setup time=%d\n",
  15434. +        hostdata->host_param.async_data_setup_time);
  15435. +    printk("qlogicisp : req/ack active negation=%d\n",
  15436. +        hostdata->host_param.req_ack_active_negation);
  15437. +    printk("qlogicisp : data line active negation=%d\n",
  15438. +        hostdata->host_param.data_line_active_negation);
  15439. +    printk("qlogicisp : data DMA burst enable=%d\n",
  15440. +        hostdata->host_param.data_dma_burst_enable);
  15441. +    printk("qlogicisp : command DMA burst enable=%d\n",
  15442. +        hostdata->host_param.command_dma_burst_enable);
  15443. +    printk("qlogicisp : tag age limit=%d\n",
  15444. +        hostdata->host_param.tag_aging);
  15445. +    printk("qlogicisp : selection timeout limit=%d\n",
  15446. +        hostdata->host_param.selection_timeout);
  15447. +    printk("qlogicisp : max queue depth=%d\n",
  15448. +        hostdata->host_param.max_queue_depth);
  15449. +#endif /* DEBUG_ISP1020_SETUP */
  15450. +
  15451. +    for (i = 0; i < 16; i++) {
  15452. +
  15453. +        value = isp1020_read_nvram_word(hostdata, 14 + i * 3);
  15454. +        hostdata->dev_param[i].device_flags = value & 0xff;
  15455. +        hostdata->dev_param[i].execution_throttle = value >> 8;
  15456. +
  15457. +        value = isp1020_read_nvram_word(hostdata, 15 + i * 3);
  15458. +        hostdata->dev_param[i].synchronous_period = value & 0xff;
  15459. +        hostdata->dev_param[i].synchronous_offset = (value >> 8) & 0x0f;
  15460. +        hostdata->dev_param[i].device_enable = (value >> 12) & 0x01;
  15461. +
  15462. +#if DEBUG_ISP1020_SETUP
  15463. +        printk("qlogicisp : target 0x%02x\n", i);
  15464. +        printk("qlogicisp :     device flags=0x%02x\n",
  15465. +            hostdata->dev_param[i].device_flags);
  15466. +        printk("qlogicisp :     execution throttle=%d\n",
  15467. +            hostdata->dev_param[i].execution_throttle);
  15468. +        printk("qlogicisp :     synchronous period=%d\n",
  15469. +            hostdata->dev_param[i].synchronous_period);
  15470. +        printk("qlogicisp :     synchronous offset=%d\n",
  15471. +            hostdata->dev_param[i].synchronous_offset);
  15472. +        printk("qlogicisp :     device enable=%d\n",
  15473. +            hostdata->dev_param[i].device_enable);
  15474. +#endif /* DEBUG_ISP1020_SETUP */
  15475. +    }
  15476. +
  15477. +    LEAVE("isp1020_get_defaults");
  15478. +
  15479. +    return 0;
  15480. +}
  15481. +
  15482. +
  15483. +int isp1020_set_defaults(struct isp1020_hostdata *hostdata)
  15484. +{
  15485. +    int i;
  15486. +
  15487. +    ENTER("isp1020_set_defaults");
  15488. +
  15489. +    hostdata->host_param.fifo_threshold = 2;
  15490. +    hostdata->host_param.host_adapter_enable = 1;
  15491. +    hostdata->host_param.initiator_scsi_id = 7;
  15492. +    hostdata->host_param.bus_reset_delay = 3;
  15493. +    hostdata->host_param.retry_count = 0;
  15494. +    hostdata->host_param.retry_delay = 0;
  15495. +    hostdata->host_param.async_data_setup_time = 6;
  15496. +    hostdata->host_param.req_ack_active_negation = 1;
  15497. +    hostdata->host_param.data_line_active_negation = 1;
  15498. +    hostdata->host_param.data_dma_burst_enable = 1;
  15499. +    hostdata->host_param.command_dma_burst_enable = 1;
  15500. +    hostdata->host_param.tag_aging = 8;
  15501. +    hostdata->host_param.selection_timeout = 250;
  15502. +    hostdata->host_param.max_queue_depth = 256;
  15503. +
  15504. +    for (i = 0; i < 16; i++) {
  15505. +        hostdata->dev_param[i].device_flags = 0xc4;
  15506. +        hostdata->dev_param[i].execution_throttle = 16;
  15507. +        hostdata->dev_param[i].synchronous_period = 25;
  15508. +        hostdata->dev_param[i].synchronous_offset = 12;
  15509. +        hostdata->dev_param[i].device_enable = 1;
  15510. +    }
  15511. +
  15512. +    LEAVE("isp1020_set_defaults");
  15513. +
  15514. +    return 0;
  15515. +}
  15516. +
  15517. +
  15518. +int isp1020_load_parameters(struct isp1020_hostdata *hostdata)
  15519. +{
  15520. +    int i, k;
  15521. +    u_long queue_addr;
  15522. +    u_short param[6];
  15523. +    u_short isp_cfg1;
  15524. +
  15525. +    ENTER("isp1020_load_parameters");
  15526. +
  15527. +    outw(hostdata->host_param.fifo_threshold, hostdata->io_base + ISP_CFG1);
  15528. +
  15529. +    param[0] = MBOX_SET_INIT_SCSI_ID;
  15530. +    param[1] = hostdata->host_param.initiator_scsi_id;
  15531. +
  15532. +    isp1020_mbox_command(hostdata, param);
  15533. +
  15534. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15535. +        printk("qlogicisp : set initiator id failure\n");
  15536. +        return 1;
  15537. +    }
  15538. +
  15539. +    param[0] = MBOX_SET_RETRY_COUNT;
  15540. +    param[1] = hostdata->host_param.retry_count;
  15541. +    param[2] = hostdata->host_param.retry_delay;
  15542. +
  15543. +    isp1020_mbox_command(hostdata, param);
  15544. +
  15545. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15546. +        printk("qlogicisp : set retry count failure\n");
  15547. +        return 1;
  15548. +    }
  15549. +
  15550. +    param[0] = MBOX_SET_ASYNC_DATA_SETUP_TIME;
  15551. +    param[1] = hostdata->host_param.async_data_setup_time;
  15552. +
  15553. +    isp1020_mbox_command(hostdata, param);
  15554. +
  15555. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15556. +        printk("qlogicisp : async data setup time failure\n");
  15557. +        return 1;
  15558. +    }
  15559. +
  15560. +    param[0] = MBOX_SET_ACTIVE_NEG_STATE;
  15561. +    param[1] = (hostdata->host_param.req_ack_active_negation << 4)
  15562. +        | (hostdata->host_param.data_line_active_negation << 5);
  15563. +
  15564. +    isp1020_mbox_command(hostdata, param);
  15565. +
  15566. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15567. +        printk("qlogicisp : set active negation state failure\n");
  15568. +        return 1;
  15569. +    }
  15570. +
  15571. +    param[0] = MBOX_SET_PCI_CONTROL_PARAMS;
  15572. +    param[1] = hostdata->host_param.data_dma_burst_enable << 1;
  15573. +    param[2] = hostdata->host_param.command_dma_burst_enable << 1;
  15574. +
  15575. +    isp1020_mbox_command(hostdata, param);
  15576. +
  15577. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15578. +        printk("qlogicisp : set pci control parameter failure\n");
  15579. +        return 1;
  15580. +    }
  15581. +
  15582. +    isp_cfg1 = inw(hostdata->io_base + ISP_CFG1);
  15583. +
  15584. +    if (hostdata->host_param.data_dma_burst_enable 
  15585. +            || hostdata->host_param.command_dma_burst_enable)
  15586. +        isp_cfg1 |= 0x0004;
  15587. +    else
  15588. +        isp_cfg1 &= 0xfffb;
  15589. +
  15590. +    outw(isp_cfg1, hostdata->io_base + ISP_CFG1);
  15591. +            
  15592. +    param[0] = MBOX_SET_TAG_AGE_LIMIT;
  15593. +    param[1] = hostdata->host_param.tag_aging;
  15594. +
  15595. +    isp1020_mbox_command(hostdata, param);
  15596. +
  15597. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15598. +        printk("qlogicisp : set tag age limit failure\n");
  15599. +        return 1;
  15600. +    }
  15601. +
  15602. +    param[0] = MBOX_SET_SELECT_TIMEOUT;
  15603. +    param[1] = hostdata->host_param.selection_timeout;
  15604. +
  15605. +    isp1020_mbox_command(hostdata, param);
  15606. +
  15607. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15608. +        printk("qlogicisp : set selection timeout failure\n");
  15609. +        return 1;
  15610. +    }
  15611. +
  15612. +    for (i = 0; i < 16; i++) {
  15613. +
  15614. +        if (!hostdata->dev_param[i].device_enable)
  15615. +            continue;
  15616. +
  15617. +        param[0] = MBOX_SET_TARGET_PARAMS;
  15618. +        param[1] = i << 8;
  15619. +        param[2] = hostdata->dev_param[i].device_flags << 8;
  15620. +        param[3] = (hostdata->dev_param[i].synchronous_offset << 8)
  15621. +            | hostdata->dev_param[i].synchronous_period;
  15622. +
  15623. +        isp1020_mbox_command(hostdata, param);
  15624. +
  15625. +        if (param[0] != MBOX_COMMAND_COMPLETE) {
  15626. +            printk("qlogicisp : set target parameter failure\n");
  15627. +            return 1;
  15628. +        }
  15629. +
  15630. +        for (k = 0; k < 8; k++) {
  15631. +
  15632. +            param[0] = MBOX_SET_DEV_QUEUE_PARAMS;
  15633. +            param[1] = (i << 8) | k;
  15634. +            param[2] = hostdata->host_param.max_queue_depth;
  15635. +            param[3] = hostdata->dev_param[i].execution_throttle;
  15636. +
  15637. +            isp1020_mbox_command(hostdata, param);
  15638. +
  15639. +            if (param[0] != MBOX_COMMAND_COMPLETE) {
  15640. +                printk("qlogicisp : set device queue parameter failure\n");
  15641. +                return 1;
  15642. +            }
  15643. +        }
  15644. +    }
  15645. +
  15646. +    queue_addr = (u_long) &hostdata->res_queue[0][0];
  15647. +
  15648. +    param[0] = MBOX_INIT_RES_QUEUE;
  15649. +    param[1] = RES_QUEUE_LEN;
  15650. +    param[2] = (u_short) (queue_addr >> 16);
  15651. +    param[3] = (u_short) (queue_addr & 0xffff);
  15652. +    param[4] = 0;
  15653. +    param[5] = 0;
  15654. +
  15655. +    isp1020_mbox_command(hostdata, param);
  15656. +
  15657. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15658. +        printk("qlogicisp : set response queue failure\n");
  15659. +        return 1;
  15660. +    }
  15661. +
  15662. +    queue_addr = (u_long) &hostdata->req_queue[0][0];
  15663. +
  15664. +    param[0] = MBOX_INIT_REQ_QUEUE;
  15665. +    param[1] = REQ_QUEUE_LEN;
  15666. +    param[2] = (u_short) (queue_addr >> 16);
  15667. +    param[3] = (u_short) (queue_addr & 0xffff);
  15668. +    param[4] = 0;
  15669. +
  15670. +    isp1020_mbox_command(hostdata, param);
  15671. +
  15672. +    if (param[0] != MBOX_COMMAND_COMPLETE) {
  15673. +        printk("qlogicisp : set request queue failure\n");
  15674. +        return 1;
  15675. +    }
  15676. +
  15677. +    LEAVE("isp1020_load_parameters");
  15678. +
  15679. +    return 0;
  15680. +}
  15681. +
  15682. +
  15683. +int isp1020_mbox_command(struct isp1020_hostdata *hostdata, u_short param[])
  15684. +{
  15685. +    if (mbox_param[param[0]] == 0)
  15686. +        return 1;
  15687. +
  15688. +    while (inw(hostdata->io_base + HOST_HCCR) & 0x0080)
  15689. +        barrier();
  15690. +
  15691. +    switch(mbox_param[param[0]] >> 4) {
  15692. +        case 6: outw(param[5], hostdata->io_base + MBOX5);
  15693. +        case 5: outw(param[4], hostdata->io_base + MBOX4);
  15694. +        case 4: outw(param[3], hostdata->io_base + MBOX3);
  15695. +        case 3: outw(param[2], hostdata->io_base + MBOX2);
  15696. +        case 2: outw(param[1], hostdata->io_base + MBOX1);
  15697. +        case 1: outw(param[0], hostdata->io_base + MBOX0);
  15698. +    }
  15699. +
  15700. +    outw(HCCR_CLEAR_RISC_INTR, hostdata->io_base + HOST_HCCR);
  15701. +    outw(0x0, hostdata->io_base + PCI_SEMAPHORE);
  15702. +
  15703. +    outw(HCCR_SET_HOST_INTR, hostdata->io_base + HOST_HCCR);
  15704. +
  15705. +    while (!(inw(hostdata->io_base + PCI_INTF_STS) & 0x04))
  15706. +        barrier();
  15707. +
  15708. +    while (inw(hostdata->io_base + MBOX0) == 0x04)
  15709. +        barrier();
  15710. +
  15711. +    outw(HCCR_CLEAR_RISC_INTR, hostdata->io_base + HOST_HCCR);
  15712. +    outw(0x0, hostdata->io_base + PCI_SEMAPHORE);
  15713. +
  15714. +    switch(mbox_param[param[0]] & 0xf) {
  15715. +        case 6: param[5] = inw(hostdata->io_base + MBOX5);
  15716. +        case 5: param[4] = inw(hostdata->io_base + MBOX4);
  15717. +        case 4: param[3] = inw(hostdata->io_base + MBOX3);
  15718. +        case 3: param[2] = inw(hostdata->io_base + MBOX2);
  15719. +        case 2: param[1] = inw(hostdata->io_base + MBOX1);
  15720. +        case 1: param[0] = inw(hostdata->io_base + MBOX0);
  15721. +    }
  15722. +
  15723. +    return 0;
  15724. +}
  15725. +
  15726. +
  15727. +#define RESPONSE_QUEUE_UPDATE    0x01
  15728. +
  15729. +void isp1020_intr_handler(int irq, struct pt_regs *regs)
  15730. +{
  15731. +    Scsi_Cmnd *Cmnd;
  15732. +    struct Status_Entry *sts;
  15733. +    struct Marker_Entry *marker;
  15734. +    u_short status, add_marker = 0;
  15735. +    struct isp1020_hostdata *hostdata;
  15736. +
  15737. +    ENTER_INTR("isp1020_intr_handler");
  15738. +
  15739. +    if ((hostdata = irq2host[irq]) == NULL) {
  15740. +        printk("qlogicisp : unexpected interrupt on line %d\n", irq);
  15741. +        return;
  15742. +    }
  15743. +
  15744. +    DEBUG_INTR(printk("qlogicisp : interrupt on line %d\n", irq);)
  15745. +
  15746. +    while (!(inw(hostdata->io_base + PCI_INTF_STS) & 0x04))
  15747. +        barrier();
  15748. +
  15749. +    hostdata->res_queue_in_ptr = inw(hostdata->io_base + MBOX5);
  15750. +    outw(HCCR_CLEAR_RISC_INTR, hostdata->io_base + HOST_HCCR);
  15751. +    status = inw(hostdata->io_base + PCI_SEMAPHORE);
  15752. +
  15753. +    if ((status & RESPONSE_QUEUE_UPDATE) == 0) {
  15754. +
  15755. +        DEBUG_INTR(printk("qlogicisp : response queue update\n");)
  15756. +        DEBUG_INTR(printk("qlogicisp : response queue depth %d\n",
  15757. +            RES_QUEUE_DEPTH());)
  15758. +
  15759. +        while (hostdata->res_queue_out_ptr != hostdata->res_queue_in_ptr) {
  15760. +
  15761. +            sts = (struct Status_Entry *)
  15762. +                &hostdata->res_queue[hostdata->res_queue_out_ptr][0];
  15763. +
  15764. +            Cmnd = (Scsi_Cmnd *) sts->handle;
  15765. +
  15766. +            if (sts->completion_status == CS_RESET_OCCURRED
  15767. +                    || sts->completion_status == CS_ABORTED
  15768. +                    || (sts->status_flags & STF_BUS_RESET))
  15769. +                add_marker++;
  15770. +
  15771. +            if (sts->state_flags & SF_GOT_SENSE)
  15772. +                memcpy(Cmnd->sense_buffer, sts->req_sense_data,
  15773. +                    sizeof(Cmnd->sense_buffer));
  15774. +
  15775. +            DEBUG_INTR(isp1020_print_status_entry(sts);)
  15776. +
  15777. +            if (sts->hdr.entry_type == ENTRY_STATUS)
  15778. +                Cmnd->result = isp1020_return_status(sts);
  15779. +            else
  15780. +                Cmnd->result = DID_ERROR << 16;
  15781. +
  15782. +            hostdata->res_queue_out_ptr = (hostdata->res_queue_out_ptr + 1)
  15783. +                % RES_QUEUE_LEN;
  15784. +
  15785. +            outw(hostdata->res_queue_out_ptr, hostdata->io_base + MBOX5);
  15786. +
  15787. +            (Cmnd->scsi_done)(Cmnd);
  15788. +        }
  15789. +    }
  15790. +    else {
  15791. +
  15792. +        DEBUG_INTR(printk("qlogicisp : mbox completion\n");)
  15793. +
  15794. +        status = inw(hostdata->io_base + MBOX0);
  15795. +        outw(0x0, hostdata->io_base + PCI_SEMAPHORE);
  15796. +
  15797. +        DEBUG_INTR(printk("qlogicisp : mbox completion status: %x\n", status);)
  15798. +
  15799. +        switch (status) {
  15800. +            case ASYNC_SCSI_BUS_RESET:
  15801. +            case EXECUTION_TIMEOUT_RESET:
  15802. +                add_marker++;
  15803. +                break;
  15804. +            case INVALID_COMMAND:
  15805. +            case HOST_INTERFACE_ERROR:
  15806. +            case COMMAND_ERROR:
  15807. +            case COMMAND_PARAM_ERROR:
  15808. +                printk("qlogicisp : bad mailbox return status\n");
  15809. +                break;
  15810. +        }
  15811. +    }
  15812. +
  15813. +    if (add_marker) {
  15814. +
  15815. +        DEBUG_INTR(printk("qlogicisp : adding marker entry\n");)
  15816. +
  15817. +        if ((hostdata->req_queue_in_ptr + 1) % REQ_QUEUE_LEN
  15818. +                == hostdata->req_queue_out_ptr) {
  15819. +            printk("qlogicisp : request queue overflow\n");
  15820. +            return;
  15821. +        }
  15822. +
  15823. +        marker = (struct Marker_Entry *)
  15824. +            &hostdata->req_queue[hostdata->req_queue_in_ptr][0];
  15825. +
  15826. +        memset(marker, 0, sizeof(struct Marker_Entry));
  15827. +
  15828. +        marker->hdr.entry_type = ENTRY_MARKER;
  15829. +        marker->hdr.entry_cnt = 1;
  15830. +        marker->modifier = SYNC_ALL;
  15831. +
  15832. +        hostdata->req_queue_in_ptr = (hostdata->req_queue_in_ptr + 1)
  15833. +            % REQ_QUEUE_LEN;
  15834. +
  15835. +        outw(hostdata->req_queue_in_ptr, hostdata->io_base + MBOX4);
  15836. +    }
  15837. +
  15838. +    LEAVE_INTR("isp1020_intr_handler");
  15839. +}
  15840. +
  15841. +
  15842. +#define NVRAM_DELAY() { \
  15843. +    int counter = 0; while (counter++ < 0xc8) barrier(); }
  15844. +
  15845. +
  15846. +u_short isp1020_read_nvram_word(struct isp1020_hostdata *hostdata, u_short byte)
  15847. +{
  15848. +    int i;
  15849. +    u_short value, output, input;
  15850. +
  15851. +    byte &= 0x3f; byte |= 0x0180;
  15852. +
  15853. +    for (i = 8; i >= 0; i--) {
  15854. +        output = ((byte >> i) & 0x1) ? 0x4 : 0x0;
  15855. +        outw(output | 0x2, hostdata->io_base + PCI_NVRAM); NVRAM_DELAY();
  15856. +        outw(output | 0x3, hostdata->io_base + PCI_NVRAM); NVRAM_DELAY();
  15857. +        outw(output | 0x2, hostdata->io_base + PCI_NVRAM); NVRAM_DELAY();
  15858. +    }
  15859. +
  15860. +    for (i = 0xf, value = 0; i >= 0; i--) {
  15861. +        value = value << 0x1;
  15862. +        outw(0x3, hostdata->io_base + PCI_NVRAM); NVRAM_DELAY();
  15863. +        input = inw(hostdata->io_base + PCI_NVRAM); NVRAM_DELAY();
  15864. +        outw(0x2, hostdata->io_base + PCI_NVRAM); NVRAM_DELAY();
  15865. +        if (input & 0x8) value |= 0x1;
  15866. +    }
  15867. +
  15868. +    outw(0x0, hostdata->io_base + PCI_NVRAM);
  15869. +
  15870. +    return(value);
  15871. +}
  15872. +
  15873. +#define ISP1020_NVRAM_LEN    0x40
  15874. +#define ISP1020_NVRAM_SIG1    0x5349
  15875. +#define ISP1020_NVRAM_SIG2    0x2050
  15876. +
  15877. +int isp1020_verify_nvram(struct isp1020_hostdata *hostdata)
  15878. +{
  15879. +    int    i;
  15880. +    u_short value;
  15881. +    u_char checksum = 0;
  15882. +
  15883. +    for (i = 0; i < ISP1020_NVRAM_LEN; i++) {
  15884. +        value = isp1020_read_nvram_word(hostdata, i);
  15885. +
  15886. +        switch (i) {
  15887. +            case 0:
  15888. +                if (value != ISP1020_NVRAM_SIG1) return 0;
  15889. +                break;
  15890. +            case 1:
  15891. +                if (value != ISP1020_NVRAM_SIG2) return 0;
  15892. +                break;
  15893. +            case 2:
  15894. +                if ((value & 0xff) != 0x02) return 0;
  15895. +                break;
  15896. +        }
  15897. +        checksum += value & 0xff;
  15898. +        checksum += value >> 8;
  15899. +    }
  15900. +
  15901. +    return (checksum == 0);
  15902. +}
  15903. +
  15904. +
  15905. +void isp1020_enable_irqs(struct isp1020_hostdata *hostdata)
  15906. +{
  15907. +    outw(0x6, hostdata->io_base + PCI_INTF_CTL);
  15908. +}
  15909. +
  15910. +
  15911. +void isp1020_disable_irqs(struct isp1020_hostdata *hostdata)
  15912. +{
  15913. +    outw(0x0, hostdata->io_base + PCI_INTF_CTL);
  15914. +}
  15915. +
  15916. +
  15917. +#if DEBUG_ISP1020_INTR
  15918. +
  15919. +void isp1020_print_status_entry(struct Status_Entry *status)
  15920. +{
  15921. +    int i;
  15922. +
  15923. +    printk("qlogicisp : entry count = 0x%02x, type = 0x%02x, flags = 0x%02x\n",
  15924. +        status->hdr.entry_cnt, status->hdr.entry_type, status->hdr.flags);
  15925. +    printk("qlogicisp : scsi status = 0x%04x, compeltion status = 0x%04x\n",
  15926. +        status->scsi_status, status->completion_status);
  15927. +    printk("qlogicisp : state flags = 0x%04x, status flags = 0x%04x\n",
  15928. +        status->state_flags, status->status_flags);
  15929. +    printk("qlogicisp : time = 0x%04x, request sense length = 0x%04x\n",
  15930. +        status->time, status->req_sense_len);
  15931. +    printk("qlogicisp : residual transfer length = 0x%08lx\n", status->residual);
  15932. +
  15933. +    for (i = 0; i < status->req_sense_len; i++)
  15934. +        printk("qlogicisp : sense data = 0x%02x\n", status->req_sense_data[i]);
  15935. +}
  15936. +
  15937. +#endif /* DEBUG_ISP1020_INTR */
  15938. +
  15939. +
  15940. +#if DEBUG_ISP1020
  15941. +
  15942. +void isp1020_print_scsi_cmd(Scsi_Cmnd *cmd)
  15943. +{
  15944. +    int i;
  15945. +
  15946. +    printk("qlogicisp : target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n",
  15947. +    cmd->target, cmd->lun, cmd->cmd_len);
  15948. +    printk("qlogicisp : command = ");
  15949. +    for (i = 0; i < cmd->cmd_len; i++)
  15950. +        printk("0x%02x ", cmd->cmnd[i]);
  15951. +    printk("\n");
  15952. +}
  15953. +
  15954. +#endif /* DEBUG_ISP1020 */
  15955. +
  15956. +
  15957. +int isp1020_return_status(struct Status_Entry *sts)
  15958. +{
  15959. +    int host_status = DID_ERROR;
  15960. +#if DEBUG_ISP1020_INTR
  15961. +    static char *reason[] = {
  15962. +        "DID_OK",
  15963. +        "DID_NO_CONNECT",
  15964. +        "DID_BUS_BUSY",
  15965. +        "DID_TIME_OUT",
  15966. +        "DID_BAD_TARGET",
  15967. +        "DID_ABORT",
  15968. +        "DID_PARITY",
  15969. +        "DID_ERROR",
  15970. +        "DID_RESET",
  15971. +        "DID_BAD_INTR"
  15972. +    };
  15973. +#endif /* DEBUG_ISP1020_INTR */
  15974. +
  15975. +    ENTER("isp1020_return_status");
  15976. +
  15977. +    DEBUG(printk("qlogicisp : completion status = 0x%04x\n",
  15978. +        sts->completion_status);)
  15979. +
  15980. +    switch(sts->completion_status) {
  15981. +        case CS_COMPLETE:
  15982. +            host_status = DID_OK;
  15983. +            break;
  15984. +        case CS_INCOMPLETE:
  15985. +            if (!(sts->state_flags & SF_GOT_BUS))
  15986. +                host_status = DID_NO_CONNECT;
  15987. +            else if (!(sts->state_flags & SF_GOT_TARGET))
  15988. +                host_status = DID_BAD_TARGET;
  15989. +            else if (!(sts->state_flags & SF_SENT_CDB))
  15990. +                host_status = DID_ERROR;
  15991. +            else if (!(sts->state_flags & SF_TRANSFERRED_DATA))
  15992. +                host_status = DID_ERROR;
  15993. +            else if (!(sts->state_flags & SF_GOT_STATUS))
  15994. +                host_status = DID_ERROR;
  15995. +            else if (!(sts->state_flags & SF_GOT_SENSE))
  15996. +                host_status = DID_ERROR;
  15997. +                break;
  15998. +        case CS_DMA_ERROR:
  15999. +        case CS_TRANSPORT_ERROR:
  16000. +            host_status = DID_ERROR;
  16001. +            break;
  16002. +        case CS_RESET_OCCURRED:
  16003. +            host_status = DID_RESET;
  16004. +            break;
  16005. +        case CS_ABORTED:
  16006. +            host_status = DID_ABORT;
  16007. +            break;
  16008. +        case CS_TIMEOUT:
  16009. +            host_status = DID_TIME_OUT;
  16010. +            break;
  16011. +        case CS_DATA_OVERRUN:
  16012. +        case CS_COMMAND_OVERRUN:
  16013. +        case CS_STATUS_OVERRUN:
  16014. +        case CS_BAD_MESSAGE:
  16015. +        case CS_NO_MESSAGE_OUT:
  16016. +        case CS_EXT_ID_FAILED:
  16017. +        case CS_IDE_MSG_FAILED:
  16018. +        case CS_ABORT_MSG_FAILED:
  16019. +        case CS_NOP_MSG_FAILED:
  16020. +        case CS_PARITY_ERROR_MSG_FAILED:
  16021. +        case CS_DEVICE_RESET_MSG_FAILED:
  16022. +        case CS_ID_MSG_FAILED:
  16023. +        case CS_UNEXP_BUS_FREE:
  16024. +            host_status = DID_ERROR;
  16025. +            break;
  16026. +        case CS_DATA_UNDERRUN:
  16027. +            host_status = DID_OK;
  16028. +            break;
  16029. +        default:
  16030. +            printk("qlogicisp : unknown completion status 0x%04x\n",
  16031. +                sts->completion_status);
  16032. +            host_status = DID_ERROR;
  16033. +            break;
  16034. +    }
  16035. +
  16036. +    DEBUG_INTR(printk("qlogicisp : host status (%s) scsi status %x\n",
  16037. +        reason[host_status], sts->scsi_status);)
  16038. +
  16039. +    LEAVE("isp1020_return_status");
  16040. +
  16041. +    return (sts->scsi_status & STATUS_MASK) | (host_status << 16);
  16042. +}
  16043. +
  16044. +#if MODULE
  16045. +Scsi_Host_Template driver_template = ISP1020;
  16046. +
  16047. +#include "scsi_module.c"
  16048. +#endif /* MODULE */
  16049. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogicisp.h linux/drivers/scsi/qlogicisp.h
  16050. --- pre2.0.5/linux/drivers/scsi/qlogicisp.h    Thu Jan  1 02:00:00 1970
  16051. +++ linux/drivers/scsi/qlogicisp.h    Sat May 18 11:58:34 1996
  16052. @@ -0,0 +1,82 @@
  16053. +/*
  16054. + * QLogic ISP1020 Intelligent SCSI Processor Driver (PCI)
  16055. + * Written by Erik H. Moe, ehm@cris.com
  16056. + * Copyright 1995, Erik H. Moe
  16057. + *
  16058. + * This program is free software; you can redistribute it and/or modify it
  16059. + * under the terms of the GNU General Public License as published by the
  16060. + * Free Software Foundation; either version 2, or (at your option) any
  16061. + * later version.
  16062. + *
  16063. + * This program is distributed in the hope that it will be useful, but
  16064. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  16065. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16066. + * General Public License for more details.
  16067. + */
  16068. +
  16069. +/* Renamed and updated to 1.3.x by Michael Griffith <grif@cs.ucr.edu> */
  16070. +
  16071. +/*
  16072. + * $Date: 1995/09/22 02:32:56 $
  16073. + * $Revision: 0.5 $
  16074. + *
  16075. + * $Log: isp1020.h,v $
  16076. + * Revision 0.5  1995/09/22  02:32:56  root
  16077. + * do auto request sense
  16078. + *
  16079. + * Revision 0.4  1995/08/07  04:48:28  root
  16080. + * supply firmware with driver.
  16081. + * numerous bug fixes/general cleanup of code.
  16082. + *
  16083. + * Revision 0.3  1995/07/16  16:17:16  root
  16084. + * added reset/abort code.
  16085. + *
  16086. + * Revision 0.2  1995/06/29  03:19:43  root
  16087. + * fixed biosparam.
  16088. + * added queue protocol.
  16089. + *
  16090. + * Revision 0.1  1995/06/25  01:56:13  root
  16091. + * Initial release.
  16092. + *
  16093. + */
  16094. +
  16095. +#ifndef _QLOGICISP_H
  16096. +#define _QLOGICISP_H
  16097. +
  16098. +int isp1020_detect(Scsi_Host_Template *);
  16099. +int isp1020_release(struct Scsi_Host *);
  16100. +const char * isp1020_info(struct Scsi_Host *);
  16101. +int isp1020_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
  16102. +int isp1020_abort(Scsi_Cmnd *);
  16103. +int isp1020_reset(Scsi_Cmnd *);
  16104. +int isp1020_biosparam(Disk *, int, int[]);
  16105. +
  16106. +#ifndef NULL
  16107. +#define NULL (0)
  16108. +#endif
  16109. +
  16110. +#define QLOGICISP {                    \
  16111. +    /* next */        NULL,            \
  16112. +    /* usage_count */    NULL,            \
  16113. +        /* proc dir */          NULL,                   \
  16114. +        /* procfs info */       NULL,                   \
  16115. +    /* name */        NULL,            \
  16116. +    /* detect */        isp1020_detect,        \
  16117. +    /* release */        isp1020_release,    \
  16118. +    /* info */        isp1020_info,        \
  16119. +    /* command */        NULL,             \
  16120. +    /* queuecommand */    isp1020_queuecommand,    \
  16121. +    /* abort */        isp1020_abort,        \
  16122. +    /* reset */        isp1020_reset,        \
  16123. +    /* slave_attach */    NULL,            \
  16124. +    /* bios_param */    isp1020_biosparam,    \
  16125. +    /* can_queue */        8,            \
  16126. +    /* this_id */        -1,            \
  16127. +    /* sg_tablesize */    4,            \
  16128. +    /* cmd_per_lun */    1,            \
  16129. +    /* present */        0,            \
  16130. +    /* unchecked_isa_dma */    0,            \
  16131. +    /* use_clustering */    DISABLE_CLUSTERING    \
  16132. +}
  16133. +
  16134. +#endif /* _QLOGICISP_H */
  16135. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/qlogicisp_asm.c linux/drivers/scsi/qlogicisp_asm.c
  16136. --- pre2.0.5/linux/drivers/scsi/qlogicisp_asm.c    Thu Jan  1 02:00:00 1970
  16137. +++ linux/drivers/scsi/qlogicisp_asm.c    Sat May 18 11:58:34 1996
  16138. @@ -0,0 +1,1273 @@
  16139. +/* 
  16140. + *    Version 2.02 (10:42 June 16, 1995)
  16141. + */    
  16142. +
  16143. +unsigned short risc_code_version = 2*1024+02;
  16144. +
  16145. +unsigned short risc_code_addr01 = 0x1000 ;
  16146. +
  16147. +#if RELOAD_FIRMWARE
  16148. +
  16149. +unsigned short risc_code01[] = { 
  16150. +    0x0078, 0x1041, 0x0000, 0x2744, 0x0000, 0x2043, 0x4f50, 0x5952,
  16151. +    0x4947, 0x4854, 0x2031, 0x3939, 0x312c, 0x3139, 0x3932, 0x2c31,
  16152. +    0x3939, 0x332c, 0x3139, 0x3934, 0x2051, 0x4c4f, 0x4749, 0x4320,
  16153. +    0x434f, 0x5250, 0x4f52, 0x4154, 0x494f, 0x4e00, 0x2049, 0x5350,
  16154. +    0x3130, 0x3230, 0x2046, 0x6972, 0x6d77, 0x6172, 0x6520, 0x2056,
  16155. +    0x6572, 0x7369, 0x6f6e, 0x2030, 0x322e, 0x3032, 0x2020, 0x2043,
  16156. +    0x7573, 0x746f, 0x6d65, 0x7220, 0x4e6f, 0x2e20, 0x3030, 0x2050,
  16157. +    0x726f, 0x6475, 0x6374, 0x204e, 0x6f2e, 0x2020, 0x3030, 0x2020,
  16158. +    0x2400, 0x20b9, 0x1212, 0x2071, 0x0010, 0x70c3, 0x0004, 0x20c9,
  16159. +    0x42ff, 0x2089, 0x1159, 0x70c7, 0x4953, 0x70cb, 0x5020, 0x70cf,
  16160. +    0x2020, 0x70d3, 0x0002, 0x3f00, 0x70d6, 0x20c1, 0x0008, 0x2019,
  16161. +    0x0000, 0x2009, 0xfeff, 0x2100, 0x200b, 0xa5a5, 0xa1ec, 0x7fff,
  16162. +    0x2d64, 0x206b, 0x0a0a, 0xaddc, 0x3fff, 0x2b54, 0x205b, 0x5050,
  16163. +    0x2114, 0xa286, 0xa5a5, 0x0040, 0x10b3, 0xa386, 0x000f, 0x0040,
  16164. +    0x1079, 0x2c6a, 0x2a5a, 0x20c1, 0x0000, 0x2019, 0x000f, 0x0078,
  16165. +    0x1059, 0x2c6a, 0x2a5a, 0x20c1, 0x0008, 0x2009, 0x7fff, 0x2148,
  16166. +    0x2944, 0x204b, 0x0a0a, 0xa9bc, 0x3fff, 0x2734, 0x203b, 0x5050,
  16167. +    0x2114, 0xa286, 0x0a0a, 0x0040, 0x109d, 0x284a, 0x263a, 0x20c1,
  16168. +    0x0004, 0x2009, 0x3fff, 0x2134, 0x200b, 0x5050, 0x2114, 0xa286,
  16169. +    0x5050, 0x0040, 0x109e, 0x0078, 0x1161, 0x284a, 0x263a, 0x98c0,
  16170. +    0xa188, 0x1000, 0x212c, 0x200b, 0xa5a5, 0x2114, 0xa286, 0xa5a5,
  16171. +    0x0040, 0x10b0, 0x250a, 0xa18a, 0x1000, 0x98c1, 0x0078, 0x10b5,
  16172. +    0x250a, 0x0078, 0x10b5, 0x2c6a, 0x2a5a, 0x2130, 0xa18a, 0x0040,
  16173. +    0x2128, 0xa1a2, 0x3800, 0x8424, 0x8424, 0x8424, 0x8424, 0x8424,
  16174. +    0x8424, 0xa192, 0x4300, 0x2009, 0x0000, 0x2001, 0x002f, 0x1078,
  16175. +    0x19ee, 0x2218, 0x2079, 0x3800, 0x2fa0, 0x2408, 0x2011, 0x0000,
  16176. +    0x20a9, 0x0040, 0x42a4, 0x8109, 0x00c0, 0x10d0, 0x7eda, 0x7dce,
  16177. +    0x8528, 0x7dca, 0x7cd2, 0x7bd6, 0x2031, 0x0030, 0x78b3, 0x0101,
  16178. +    0x780b, 0x0002, 0x780f, 0x0002, 0x784f, 0x0003, 0x2069, 0x3840,
  16179. +    0x681b, 0x0028, 0x6807, 0x0007, 0x680b, 0x00fa, 0x680f, 0x0008,
  16180. +    0x6813, 0x0005, 0x681f, 0x0000, 0x6823, 0x0006, 0x6817, 0x0008,
  16181. +    0x6827, 0x0000, 0x2069, 0x3900, 0x2011, 0x0020, 0x2009, 0x0010,
  16182. +    0x680b, 0x0c19, 0x680f, 0x0019, 0x6803, 0xfd00, 0x6807, 0x0018,
  16183. +    0x6a1a, 0x2d00, 0xa0e8, 0x0008, 0xa290, 0x0004, 0x8109, 0x00c0,
  16184. +    0x1100, 0x2069, 0x3980, 0x20a9, 0x0080, 0x680b, 0x0040, 0x7bd8,
  16185. +    0xa386, 0xfeff, 0x00c0, 0x1122, 0x6817, 0x0100, 0x681f, 0x0064,
  16186. +    0x0078, 0x1126, 0x6817, 0x0064, 0x681f, 0x0002, 0xade8, 0x0010,
  16187. +    0x0070, 0x112c, 0x0078, 0x1115, 0x1078, 0x1c93, 0x1078, 0x3266,
  16188. +    0x1078, 0x182c, 0x1078, 0x3706, 0x3200, 0xa085, 0x000d, 0x2090,
  16189. +    0x70c3, 0x0000, 0x0090, 0x1143, 0x70c0, 0xa086, 0x0002, 0x00c0,
  16190. +    0x1143, 0x1078, 0x1272, 0x1078, 0x1184, 0x78b0, 0xa005, 0x00c0,
  16191. +    0x114f, 0x1078, 0x1a17, 0x0068, 0x1153, 0x1078, 0x1bed, 0x0068,
  16192. +    0x1153, 0x1078, 0x191f, 0x00e0, 0x1143, 0x1078, 0x35a4, 0x0078,
  16193. +    0x1143, 0x1161, 0x1163, 0x1e39, 0x1e39, 0x32c6, 0x32c6, 0x1e39,
  16194. +    0x1e39, 0x0078, 0x1161, 0x0078, 0x1163, 0x0078, 0x1165, 0x0078,
  16195. +    0x1167, 0x2009, 0x0022, 0x2104, 0xa086, 0x4000, 0x0040, 0x117f,
  16196. +    0x7008, 0x800b, 0x00c8, 0x117f, 0x7007, 0x0002, 0xa08c, 0x0060,
  16197. +    0x00c0, 0x1180, 0xa084, 0x0008, 0x0040, 0x117f, 0x087a, 0x097a,
  16198. +    0x70c3, 0x4002, 0x0078, 0x1275, 0x0068, 0x11ef, 0x2061, 0x0000,
  16199. +    0x6018, 0xa084, 0x0001, 0x00c0, 0x11ef, 0x7814, 0xa005, 0x00c0,
  16200. +    0x1195, 0x0010, 0x11f0, 0x0078, 0x11ef, 0x2009, 0x3868, 0x2104,
  16201. +    0xa005, 0x00c0, 0x11ef, 0x2009, 0x3871, 0x200b, 0x0000, 0x7914,
  16202. +    0xa186, 0x0042, 0x00c0, 0x11ba, 0x7816, 0x2009, 0x386f, 0x2164,
  16203. +    0x200b, 0x0000, 0x6018, 0x70c6, 0x6014, 0x70ca, 0x611c, 0xa18c,
  16204. +    0xff00, 0x6020, 0xa084, 0x00ff, 0xa105, 0x70ce, 0x1078, 0x181e,
  16205. +    0x0078, 0x11ed, 0x7814, 0xa086, 0x0018, 0x00c0, 0x11c1, 0x1078,
  16206. +    0x15ce, 0x7817, 0x0000, 0x2009, 0x386f, 0x2104, 0xa065, 0x0040,
  16207. +    0x11dd, 0x0c7e, 0x609c, 0x2060, 0x1078, 0x187e, 0x0c7f, 0x609f,
  16208. +    0x0000, 0x1078, 0x1695, 0x2009, 0x001c, 0x6087, 0x0103, 0x1078,
  16209. +    0x17a5, 0x00c0, 0x11e9, 0x1078, 0x181e, 0x2009, 0x386f, 0x200b,
  16210. +    0x0000, 0x2009, 0x3869, 0x2104, 0x200b, 0x0000, 0xa005, 0x0040,
  16211. +    0x11ed, 0x2001, 0x4005, 0x0078, 0x1274, 0x0078, 0x1272, 0x007c,
  16212. +    0x70c3, 0x0000, 0x70c7, 0x0000, 0x70cb, 0x0000, 0x70cf, 0x0000,
  16213. +    0x70c0, 0xa0bc, 0xffc0, 0x00c0, 0x1240, 0x2038, 0x0079, 0x1200,
  16214. +    0x1272, 0x12cd, 0x1291, 0x12cd, 0x1336, 0x1336, 0x1288, 0x16a9,
  16215. +    0x1341, 0x1280, 0x1295, 0x1297, 0x1299, 0x129b, 0x16ae, 0x1280,
  16216. +    0x1353, 0x137e, 0x15e6, 0x16a3, 0x129d, 0x1546, 0x1568, 0x157e,
  16217. +    0x159b, 0x1503, 0x1511, 0x1525, 0x1539, 0x13f1, 0x1280, 0x139f,
  16218. +    0x13a5, 0x13aa, 0x13af, 0x13b5, 0x13ba, 0x13bf, 0x13c4, 0x13c9,
  16219. +    0x13cd, 0x13e2, 0x13ee, 0x1280, 0x1280, 0x1280, 0x1280, 0x13fd,
  16220. +    0x1406, 0x1415, 0x143b, 0x1445, 0x144c, 0x1472, 0x1481, 0x1490,
  16221. +    0x14a2, 0x14e3, 0x14f3, 0x1280, 0x1280, 0x1280, 0x1280, 0x14f8,
  16222. +    0xa0bc, 0xffa0, 0x00c0, 0x1280, 0x2038, 0xa084, 0x001f, 0x0079,
  16223. +    0x1249, 0x16c5, 0x16c8, 0x16d8, 0x1754, 0x178d, 0x1280, 0x1280,
  16224. +    0x1280, 0x1280, 0x1280, 0x1280, 0x1280, 0x1280, 0x1280, 0x1280,
  16225. +    0x1280, 0x12c3, 0x132c, 0x1349, 0x1374, 0x15dc, 0x1280, 0x1280,
  16226. +    0x1280, 0x1280, 0x1280, 0x1280, 0x1280, 0x1280, 0x1280, 0x1280,
  16227. +    0x1280, 0x72ca, 0x71c6, 0x2001, 0x4006, 0x0078, 0x1274, 0x73ce,
  16228. +    0x72ca, 0x71c6, 0x2001, 0x4000, 0x70c2, 0x0068, 0x1275, 0x2061,
  16229. +    0x0000, 0x601b, 0x0001, 0x2091, 0x5000, 0x2091, 0x4080, 0x007c,
  16230. +    0x70c3, 0x4001, 0x0078, 0x1275, 0x70c3, 0x4006, 0x0078, 0x1275,
  16231. +    0x2099, 0x0041, 0x20a1, 0x0041, 0x20a9, 0x0005, 0x53a3, 0x0078,
  16232. +    0x1272, 0x70c4, 0x70c3, 0x0004, 0x007a, 0x0078, 0x1272, 0x0078,
  16233. +    0x1272, 0x0078, 0x1272, 0x0078, 0x1272, 0x2091, 0x8000, 0x70c3,
  16234. +    0x0000, 0x70c7, 0x4953, 0x70cb, 0x5020, 0x70cf, 0x2020, 0x70d3,
  16235. +    0x0002, 0x3f00, 0x70d6, 0x2079, 0x0000, 0x781b, 0x0001, 0x2031,
  16236. +    0x0030, 0x2059, 0x1000, 0x2029, 0x0457, 0x2051, 0x0470, 0x2061,
  16237. +    0x0472, 0x20b9, 0xffff, 0x20c1, 0x0000, 0x2091, 0x5000, 0x2091,
  16238. +    0x4080, 0x0078, 0x0455, 0x1078, 0x198c, 0x00c0, 0x1284, 0x75d8,
  16239. +    0x74dc, 0x75da, 0x74de, 0x0078, 0x12d0, 0x2029, 0x0000, 0x2520,
  16240. +    0x71d0, 0x72c8, 0x73cc, 0x70c4, 0x20a0, 0x2098, 0x2031, 0x0030,
  16241. +    0x81ff, 0x0040, 0x1272, 0x7007, 0x0004, 0x731a, 0x721e, 0x7422,
  16242. +    0x7526, 0x2051, 0x0012, 0x2049, 0x130b, 0x2041, 0x1272, 0x7003,
  16243. +    0x0002, 0xa786, 0x0001, 0x0040, 0x12f3, 0xa786, 0x0050, 0x0040,
  16244. +    0x12f3, 0x0078, 0x12f9, 0x2049, 0x1318, 0x2041, 0x1324, 0x7003,
  16245. +    0x0003, 0x7017, 0x0000, 0x810b, 0x7112, 0x00c8, 0x1301, 0x7017,
  16246. +    0x0001, 0x7007, 0x0001, 0xa786, 0x0001, 0x0040, 0x1318, 0xa786,
  16247. +    0x0050, 0x0040, 0x1318, 0x700c, 0xa084, 0x007f, 0x2009, 0x0040,
  16248. +    0xa102, 0x8004, 0x094a, 0x20a8, 0x26a0, 0x53a6, 0x0078, 0x1169,
  16249. +    0x700c, 0xa084, 0x007f, 0x0040, 0x1318, 0x80ac, 0x0048, 0x1318,
  16250. +    0x2698, 0x53a5, 0x0078, 0x1169, 0x700c, 0xa084, 0x007f, 0x80ac,
  16251. +    0x2698, 0x53a5, 0x0078, 0x1272, 0x1078, 0x198c, 0x00c0, 0x1284,
  16252. +    0x75d8, 0x74dc, 0x75da, 0x74de, 0x0078, 0x12d0, 0x71c4, 0x70c8,
  16253. +    0x2114, 0xa79e, 0x0004, 0x00c0, 0x133e, 0x200a, 0x72ca, 0x0078,
  16254. +    0x1271, 0x70c7, 0x0002, 0x70cb, 0x0002, 0x70cf, 0x0000, 0x0078,
  16255. +    0x1272, 0x1078, 0x198c, 0x00c0, 0x1284, 0x75d8, 0x76dc, 0x75da,
  16256. +    0x76de, 0x0078, 0x1356, 0x2029, 0x0000, 0x2530, 0x70c4, 0x72c8,
  16257. +    0x73cc, 0x74d0, 0x70c6, 0x72ca, 0x73ce, 0x74d2, 0xa005, 0x0040,
  16258. +    0x136e, 0x8001, 0x787a, 0x7a82, 0x7b86, 0x7d8a, 0x7e8e, 0x7c7e,
  16259. +    0x78b0, 0xa084, 0xfffc, 0x78b2, 0x0078, 0x1372, 0x78b0, 0xa085,
  16260. +    0x0001, 0x78b2, 0x0078, 0x1272, 0x1078, 0x198c, 0x00c0, 0x1284,
  16261. +    0x75d8, 0x76dc, 0x75da, 0x76de, 0x0078, 0x1381, 0x2029, 0x0000,
  16262. +    0x2530, 0x70c4, 0x72c8, 0x73cc, 0x74d4, 0x70c6, 0x72ca, 0x73ce,
  16263. +    0x74d6, 0xa005, 0x0040, 0x1399, 0x8001, 0x7896, 0x7a9e, 0x7ba2,
  16264. +    0x7da6, 0x7eaa, 0x7c9a, 0x78b0, 0xa084, 0xfcff, 0x78b2, 0x0078,
  16265. +    0x139d, 0x78b0, 0xa085, 0x0100, 0x78b2, 0x0078, 0x1272, 0x2009,
  16266. +    0x385b, 0x210c, 0x7ad4, 0x0078, 0x1270, 0x2009, 0x3841, 0x210c,
  16267. +    0x0078, 0x1271, 0x2009, 0x3842, 0x210c, 0x0078, 0x1271, 0x2061,
  16268. +    0x3840, 0x610c, 0x6210, 0x0078, 0x1270, 0x2009, 0x3845, 0x210c,
  16269. +    0x0078, 0x1271, 0x2009, 0x3846, 0x210c, 0x0078, 0x1271, 0x2009,
  16270. +    0x3847, 0x210c, 0x0078, 0x1271, 0x2009, 0x3848, 0x210c, 0x0078,
  16271. +    0x1271, 0x7908, 0x7a0c, 0x0078, 0x1270, 0x71c4, 0x8107, 0xa084,
  16272. +    0x000f, 0x8003, 0x8003, 0x8003, 0xa0e8, 0x3900, 0x6a00, 0x6804,
  16273. +    0xa084, 0x0008, 0x0040, 0x13df, 0x6b08, 0x0078, 0x13e0, 0x6b0c,
  16274. +    0x0078, 0x126f, 0x77c4, 0x1078, 0x183c, 0x2091, 0x8000, 0x6b1c,
  16275. +    0x6a14, 0x2091, 0x8001, 0x2708, 0x0078, 0x126f, 0x794c, 0x0078,
  16276. +    0x1271, 0x77c4, 0x1078, 0x183c, 0x2091, 0x8000, 0x6908, 0x6a18,
  16277. +    0x6b10, 0x2091, 0x8001, 0x0078, 0x126f, 0x71c4, 0xa182, 0x0010,
  16278. +    0x00c8, 0x126a, 0x1078, 0x1d19, 0x0078, 0x126f, 0x71c4, 0xa182,
  16279. +    0x0010, 0x00c8, 0x126a, 0x2011, 0x3841, 0x2204, 0x007e, 0x2112,
  16280. +    0x1078, 0x1cd2, 0x017f, 0x0078, 0x1271, 0x71c4, 0x2011, 0x1433,
  16281. +    0x20a9, 0x0008, 0x2204, 0xa106, 0x0040, 0x1425, 0x8210, 0x0070,
  16282. +    0x1423, 0x0078, 0x141a, 0x0078, 0x126a, 0xa292, 0x1433, 0x027e,
  16283. +    0x2011, 0x3842, 0x2204, 0x2112, 0x017f, 0x007e, 0x1078, 0x1cde,
  16284. +    0x017f, 0x0078, 0x1271, 0x03e8, 0x00fa, 0x01f4, 0x02ee, 0x0064,
  16285. +    0x0019, 0x0032, 0x004b, 0x2061, 0x3840, 0x610c, 0x6210, 0x70c4,
  16286. +    0x600e, 0x70c8, 0x6012, 0x0078, 0x1270, 0x2061, 0x3840, 0x6114,
  16287. +    0x70c4, 0x6016, 0x0078, 0x1271, 0x71c4, 0x2011, 0x0004, 0x2019,
  16288. +    0x1212, 0xa186, 0x0028, 0x0040, 0x1465, 0x2011, 0x0005, 0x2019,
  16289. +    0x1212, 0xa186, 0x0032, 0x0040, 0x1465, 0x2011, 0x0006, 0x2019,
  16290. +    0x2323, 0xa186, 0x003c, 0x00c0, 0x126a, 0x2061, 0x3840, 0x6018,
  16291. +    0x007e, 0x611a, 0x23b8, 0x1078, 0x1cef, 0x1078, 0x3706, 0x017f,
  16292. +    0x0078, 0x1271, 0x71c4, 0xa184, 0xffcf, 0x00c0, 0x126a, 0x2011,
  16293. +    0x3847, 0x2204, 0x2112, 0x007e, 0x1078, 0x1d11, 0x017f, 0x0078,
  16294. +    0x1271, 0x71c4, 0xa182, 0x0010, 0x00c8, 0x126a, 0x2011, 0x3848,
  16295. +    0x2204, 0x007e, 0x2112, 0x1078, 0x1d00, 0x017f, 0x0078, 0x1271,
  16296. +    0x71c4, 0x72c8, 0xa184, 0xfffd, 0x00c0, 0x1269, 0xa284, 0xfffd,
  16297. +    0x00c0, 0x1269, 0x2100, 0x7908, 0x780a, 0x2200, 0x7a0c, 0x780e,
  16298. +    0x0078, 0x1270, 0x71c4, 0x8107, 0xa084, 0x000f, 0x8003, 0x8003,
  16299. +    0x8003, 0xa0e8, 0x3900, 0x2019, 0x0000, 0x72c8, 0x6800, 0x007e,
  16300. +    0xa226, 0x0040, 0x14d1, 0x6a02, 0xa484, 0x2000, 0x0040, 0x14ba,
  16301. +    0xa39d, 0x0010, 0xa484, 0x1000, 0x0040, 0x14c0, 0xa39d, 0x0008,
  16302. +    0xa484, 0x4000, 0x0040, 0x14d1, 0x810f, 0xa284, 0x4000, 0x0040,
  16303. +    0x14cd, 0x1078, 0x1d33, 0x0078, 0x14d1, 0x1078, 0x1d25, 0x0078,
  16304. +    0x14d1, 0x72cc, 0x82ff, 0x0040, 0x14dc, 0x6808, 0xa206, 0x0040,
  16305. +    0x14dc, 0x6a0a, 0xa39d, 0x000a, 0x6804, 0xa305, 0x6806, 0x027f,
  16306. +    0x6b0c, 0x0078, 0x126f, 0x77c4, 0x1078, 0x183c, 0x2091, 0x8000,
  16307. +    0x6a14, 0x6b1c, 0x2091, 0x8001, 0x70c8, 0x6816, 0x70cc, 0x681e,
  16308. +    0x2708, 0x0078, 0x126f, 0x70c4, 0x794c, 0x784e, 0x0078, 0x1271,
  16309. +    0x71c4, 0x72c8, 0x73cc, 0xa182, 0x0010, 0x00c8, 0x126a, 0x1078,
  16310. +    0x1d41, 0x0078, 0x126f, 0x77c4, 0x1078, 0x183c, 0x2091, 0x8000,
  16311. +    0x6a08, 0xa295, 0x0002, 0x6a0a, 0x2091, 0x8001, 0x2708, 0x0078,
  16312. +    0x1270, 0x77c4, 0x1078, 0x183c, 0x2091, 0x8000, 0x6a08, 0xa294,
  16313. +    0xfff9, 0x6a0a, 0x6804, 0xa005, 0x0040, 0x1520, 0x1078, 0x1c74,
  16314. +    0x2091, 0x8001, 0x2708, 0x0078, 0x1270, 0x77c4, 0x1078, 0x183c,
  16315. +    0x2091, 0x8000, 0x6a08, 0xa295, 0x0004, 0x6a0a, 0x6804, 0xa005,
  16316. +    0x0040, 0x1534, 0x1078, 0x1c74, 0x2091, 0x8001, 0x2708, 0x0078,
  16317. +    0x1270, 0x77c4, 0x2041, 0x0001, 0x2049, 0x0005, 0x2051, 0x0020,
  16318. +    0x1078, 0x1849, 0x2708, 0x6a08, 0x0078, 0x1270, 0x77c4, 0x73c8,
  16319. +    0x72cc, 0x77c6, 0x73ca, 0x72ce, 0x1078, 0x18c4, 0x00c0, 0x1564,
  16320. +    0x6818, 0xa005, 0x0040, 0x155e, 0x2708, 0x1078, 0x1d51, 0x00c0,
  16321. +    0x155e, 0x7817, 0x0015, 0x2091, 0x8001, 0x007c, 0x2091, 0x8001,
  16322. +    0x2001, 0x4005, 0x0078, 0x1274, 0x2091, 0x8001, 0x0078, 0x1272,
  16323. +    0x77c4, 0x77c6, 0x2061, 0x3840, 0x60a3, 0x0003, 0x67b6, 0x60c7,
  16324. +    0x0005, 0x2041, 0x0021, 0x2049, 0x0005, 0x2051, 0x0020, 0x1078,
  16325. +    0x1849, 0x7817, 0x0016, 0x1078, 0x1c74, 0x007c, 0x77c4, 0x77c6,
  16326. +    0xa7bc, 0xff00, 0x2061, 0x3840, 0x60a3, 0x0002, 0x67b6, 0x60c7,
  16327. +    0x0005, 0x7817, 0x0017, 0x1078, 0x1c74, 0x2041, 0x0021, 0x2049,
  16328. +    0x0004, 0x2051, 0x0010, 0x1078, 0x1849, 0x8738, 0xa784, 0x0007,
  16329. +    0x00c0, 0x1593, 0x007c, 0x78b0, 0xa084, 0x0003, 0x00c0, 0x15bf,
  16330. +    0x2039, 0x0000, 0x2041, 0x0021, 0x2049, 0x0004, 0x2051, 0x0008,
  16331. +    0x1078, 0x183c, 0x2091, 0x8000, 0x6808, 0xa80d, 0x690a, 0x2091,
  16332. +    0x8001, 0x8738, 0xa784, 0x0007, 0x00c0, 0x15a8, 0xa7bc, 0xff00,
  16333. +    0x873f, 0x8738, 0x873f, 0xa784, 0x0f00, 0x00c0, 0x15a8, 0x7817,
  16334. +    0x0018, 0x2061, 0x3840, 0x60a3, 0x0001, 0x60c7, 0x0005, 0x1078,
  16335. +    0x1c74, 0x78b0, 0xa085, 0x0002, 0x78b2, 0x007c, 0x78b0, 0xa084,
  16336. +    0xfffd, 0x78b2, 0xa084, 0x0001, 0x00c0, 0x15d8, 0x1078, 0x1906,
  16337. +    0x71c4, 0x71c6, 0x794a, 0x007c, 0x1078, 0x198c, 0x00c0, 0x1284,
  16338. +    0x75d8, 0x74dc, 0x75da, 0x74de, 0x0078, 0x15e9, 0x2029, 0x0000,
  16339. +    0x2520, 0x71c4, 0x73c8, 0x72cc, 0x71c6, 0x73ca, 0x72ce, 0x2079,
  16340. +    0x3800, 0x1078, 0x1815, 0x0040, 0x1691, 0x20a9, 0x0005, 0x20a1,
  16341. +    0x3816, 0x41a1, 0x2009, 0x0040, 0x1078, 0x17df, 0x0040, 0x1604,
  16342. +    0x1078, 0x181e, 0x0078, 0x1691, 0x6004, 0xa084, 0xff00, 0x8007,
  16343. +    0x8009, 0x0040, 0x1665, 0x0c7e, 0x2c68, 0x1078, 0x1815, 0x0040,
  16344. +    0x1634, 0x2c00, 0x689e, 0x8109, 0x00c0, 0x160c, 0x609f, 0x0000,
  16345. +    0x0c7f, 0x0c7e, 0x7218, 0x731c, 0x7420, 0x7524, 0x2c68, 0x689c,
  16346. +    0xa065, 0x0040, 0x1664, 0x2009, 0x0040, 0x1078, 0x17df, 0x00c0,
  16347. +    0x164d, 0x6004, 0xa084, 0x00ff, 0xa086, 0x0002, 0x00c0, 0x1634,
  16348. +    0x2d00, 0x6002, 0x0078, 0x161a, 0x0c7f, 0x0c7e, 0x609c, 0x2060,
  16349. +    0x1078, 0x187e, 0x0c7f, 0x609f, 0x0000, 0x1078, 0x1695, 0x2009,
  16350. +    0x001c, 0x6008, 0xa085, 0x0200, 0x600a, 0x6004, 0x6086, 0x1078,
  16351. +    0x17a5, 0x1078, 0x181e, 0x0078, 0x1691, 0x0c7f, 0x0c7e, 0x609c,
  16352. +    0x2060, 0x1078, 0x187e, 0x0c7f, 0x609f, 0x0000, 0x1078, 0x1695,
  16353. +    0x2009, 0x001c, 0x6087, 0x0103, 0x601b, 0x0003, 0x1078, 0x17a5,
  16354. +    0x1078, 0x181e, 0x0078, 0x1691, 0x0c7f, 0x74c4, 0x73c8, 0x72cc,
  16355. +    0x6014, 0x7817, 0x0012, 0x0e7e, 0x2071, 0x3840, 0x70a3, 0x0005,
  16356. +    0x70a7, 0x0000, 0x73aa, 0x72ae, 0x74b2, 0x70b6, 0x70bb, 0x0000,
  16357. +    0x2c00, 0x70be, 0x70c3, 0x0000, 0xa02e, 0x2530, 0x611c, 0xa184,
  16358. +    0x0060, 0x0040, 0x1685, 0x1078, 0x320a, 0x0e7f, 0x6596, 0x65a6,
  16359. +    0x669a, 0x669a, 0x60af, 0x0000, 0x60b3, 0x0000, 0x1078, 0x1c74,
  16360. +    0x007c, 0x70c3, 0x4005, 0x0078, 0x1275, 0x20a9, 0x0005, 0x2099,
  16361. +    0x3816, 0x530a, 0x2100, 0xa210, 0xa399, 0x0000, 0xa4a1, 0x0000,
  16362. +    0xa5a9, 0x0000, 0x007c, 0x71c4, 0x70c7, 0x0000, 0x7906, 0x0078,
  16363. +    0x1272, 0x71c4, 0x71c6, 0x2168, 0x0078, 0x16b0, 0x2069, 0x1000,
  16364. +    0x690c, 0xa016, 0x2d04, 0xa210, 0x8d68, 0x8109, 0x00c0, 0x16b2,
  16365. +    0xa285, 0x0000, 0x00c0, 0x16c0, 0x70c3, 0x4000, 0x0078, 0x16c2,
  16366. +    0x70c3, 0x4003, 0x70ca, 0x0078, 0x1275, 0x79c8, 0x0078, 0x1271,
  16367. +    0x71c4, 0x71c6, 0x2198, 0x20a1, 0x0042, 0x20a9, 0x0004, 0x53a3,
  16368. +    0x21a0, 0x2099, 0x0042, 0x20a9, 0x0004, 0x53a3, 0x0078, 0x1272,
  16369. +    0x70c4, 0x2068, 0x2079, 0x3800, 0x1078, 0x1815, 0x0040, 0x1750,
  16370. +    0x6007, 0x0001, 0x600b, 0x0000, 0x602b, 0x0000, 0x601b, 0x0006,
  16371. +    0x6a10, 0xa28c, 0x0007, 0xa284, 0x00f0, 0x8003, 0x8003, 0x8003,
  16372. +    0x8003, 0xa105, 0x6016, 0xa284, 0x0800, 0x0040, 0x16fb, 0x601b,
  16373. +    0x000a, 0x0078, 0x1701, 0xa284, 0x1000, 0x0040, 0x1701, 0x601b,
  16374. +    0x000c, 0xa284, 0x0300, 0x0040, 0x170a, 0x602b, 0x0001, 0x8004,
  16375. +    0x8004, 0x8004, 0xa085, 0x0001, 0x601e, 0x6023, 0x0000, 0x6027,
  16376. +    0x000a, 0xa284, 0x0400, 0x0040, 0x1717, 0x602b, 0x0000, 0x20a9,
  16377. +    0x0006, 0xac80, 0x000b, 0x20a0, 0xad80, 0x0005, 0x2098, 0x53a3,
  16378. +    0xa284, 0x0300, 0x00c0, 0x172c, 0x6046, 0x604a, 0x604e, 0x6052,
  16379. +    0x6096, 0x609a, 0x0078, 0x1736, 0x6800, 0x6046, 0x6804, 0x604a,
  16380. +    0x6e08, 0x664e, 0x6d0c, 0x6552, 0x6596, 0x669a, 0x6014, 0x7817,
  16381. +    0x0042, 0x2c08, 0x2061, 0x3840, 0x60a3, 0x0005, 0x60a7, 0x0000,
  16382. +    0x60ab, 0x0000, 0x60af, 0x0000, 0x60b3, 0x0000, 0x60b6, 0x61be,
  16383. +    0xa284, 0x0400, 0x60c2, 0x1078, 0x31f5, 0x1078, 0x1c74, 0x007c,
  16384. +    0x70c3, 0x4005, 0x0078, 0x1275, 0x78e0, 0xa005, 0x0040, 0x1280,
  16385. +    0x2091, 0x8000, 0x70c4, 0x800a, 0x2011, 0x0010, 0x810c, 0x0048,
  16386. +    0x1766, 0x3a00, 0xa084, 0xfff7, 0x0078, 0x1769, 0x3a00, 0xa085,
  16387. +    0x0008, 0x20d0, 0x0005, 0x0005, 0xa084, 0xfffb, 0x20d0, 0x0005,
  16388. +    0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0xa085,
  16389. +    0x0004, 0x20d0, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005,
  16390. +    0x0005, 0x0005, 0x8211, 0x00c0, 0x175e, 0x3a00, 0xa085, 0x0008,
  16391. +    0x20d0, 0x2091, 0x8001, 0x0078, 0x1272, 0x2011, 0x04fd, 0x2204,
  16392. +    0xa082, 0x0004, 0x0048, 0x17a1, 0x78e3, 0x0001, 0x2009, 0xff01,
  16393. +    0x200a, 0x2001, 0x000c, 0x20d8, 0x2001, 0x000c, 0x20d0, 0x0078,
  16394. +    0x1272, 0x2001, 0x4005, 0x0078, 0x1274, 0x700c, 0xa084, 0x00ff,
  16395. +    0x0040, 0x17b1, 0x7007, 0x0004, 0x7004, 0xa084, 0x0004, 0x00c0,
  16396. +    0x17ac, 0x7017, 0x0000, 0x7112, 0x721a, 0x731e, 0x7422, 0x7526,
  16397. +    0xac80, 0x0001, 0x8108, 0x810c, 0x81a9, 0x8098, 0x20a1, 0x0030,
  16398. +    0x6084, 0x20a2, 0x53a6, 0x780c, 0xa085, 0x0000, 0x7002, 0x7007,
  16399. +    0x0001, 0x2009, 0x0022, 0x2104, 0xa084, 0x4000, 0x00c0, 0x17c9,
  16400. +    0x7108, 0x8103, 0x00c8, 0x17c9, 0x7014, 0xa005, 0x0040, 0x17c9,
  16401. +    0x7007, 0x0002, 0xa184, 0x0060, 0x7003, 0x0000, 0x007c, 0x700c,
  16402. +    0xa084, 0x00ff, 0x0040, 0x17eb, 0x7007, 0x0004, 0x7004, 0xa084,
  16403. +    0x0004, 0x00c0, 0x17e6, 0x7017, 0x0000, 0x7112, 0x721a, 0x7422,
  16404. +    0x7526, 0x731e, 0x2099, 0x0030, 0x8108, 0x81ac, 0x780c, 0xa085,
  16405. +    0x0001, 0x7002, 0x7007, 0x0001, 0x2009, 0x0022, 0x2104, 0xa084,
  16406. +    0x4000, 0x00c0, 0x17fc, 0x7008, 0x800b, 0x00c8, 0x17fc, 0x7007,
  16407. +    0x0002, 0xa08c, 0x0060, 0x00c0, 0x1812, 0xac80, 0x0001, 0x20a0,
  16408. +    0x53a5, 0xa006, 0x7003, 0x0000, 0x007c, 0x7850, 0xa065, 0x0040,
  16409. +    0x181d, 0x2c04, 0x7852, 0x2063, 0x0000, 0x007c, 0x0f7e, 0x2079,
  16410. +    0x3800, 0x7850, 0x2062, 0x2c00, 0xa005, 0x00c0, 0x1829, 0x1078,
  16411. +    0x1e2a, 0x7852, 0x0f7f, 0x007c, 0x2011, 0x4300, 0x7a52, 0x7bd4,
  16412. +    0x8319, 0x0040, 0x1839, 0xa280, 0x002f, 0x2012, 0x2010, 0x0078,
  16413. +    0x1830, 0x2013, 0x0000, 0x007c, 0xa784, 0x0f00, 0x800c, 0xa784,
  16414. +    0x0007, 0x8003, 0x8003, 0x8003, 0x8003, 0xa105, 0xa0e8, 0x3980,
  16415. +    0x007c, 0x1078, 0x183c, 0x2900, 0x682a, 0x2a00, 0x682e, 0x6808,
  16416. +    0xa084, 0xffef, 0xa80d, 0x690a, 0x2091, 0x8000, 0x2009, 0x384f,
  16417. +    0x210c, 0x6804, 0xa005, 0x0040, 0x1866, 0xa116, 0x00c0, 0x1866,
  16418. +    0x2060, 0x6000, 0x6806, 0x017e, 0x0078, 0x1869, 0x2009, 0x0000,
  16419. +    0x017e, 0x6804, 0xa065, 0x0040, 0x1878, 0x6000, 0x6806, 0x1078,
  16420. +    0x188b, 0x1078, 0x1992, 0x6810, 0x8001, 0x6812, 0x00c0, 0x1869,
  16421. +    0x017f, 0x6902, 0x6906, 0x2091, 0x8001, 0x007c, 0xa065, 0x0040,
  16422. +    0x188a, 0x609c, 0x609f, 0x0000, 0x2008, 0x1078, 0x181e, 0x2100,
  16423. +    0x0078, 0x187e, 0x007c, 0x6007, 0x0103, 0x20a9, 0x001c, 0xac80,
  16424. +    0x0005, 0x20a0, 0x2001, 0x0000, 0x40a4, 0x6828, 0x601a, 0x682c,
  16425. +    0x6022, 0x007c, 0x0e7e, 0x2071, 0x3840, 0x7040, 0xa08c, 0x0080,
  16426. +    0x00c0, 0x18a8, 0xa088, 0x3880, 0x2d0a, 0x8000, 0x7042, 0xa006,
  16427. +    0x0e7f, 0x007c, 0x0e7e, 0x2071, 0x3840, 0x2009, 0x3880, 0x7240,
  16428. +    0x8221, 0x8211, 0x0048, 0x18c2, 0x2104, 0x8108, 0xad06, 0x00c0,
  16429. +    0x18b1, 0x8119, 0x211e, 0x8108, 0x8318, 0x8211, 0x00c8, 0x18ba,
  16430. +    0x7442, 0xa006, 0x0e7f, 0x007c, 0x1078, 0x183c, 0x2091, 0x8000,
  16431. +    0x6804, 0x781e, 0xa065, 0x0040, 0x1905, 0x0078, 0x18d5, 0x2c00,
  16432. +    0x781e, 0x6000, 0xa065, 0x0040, 0x1905, 0x6010, 0xa306, 0x00c0,
  16433. +    0x18cf, 0x600c, 0xa206, 0x00c0, 0x18cf, 0x2c28, 0x6804, 0xac06,
  16434. +    0x00c0, 0x18ec, 0x6000, 0x2060, 0x6806, 0xa005, 0x00c0, 0x18ec,
  16435. +    0x6803, 0x0000, 0x0078, 0x18f6, 0x6400, 0x781c, 0x2060, 0x6402,
  16436. +    0xa486, 0x0000, 0x00c0, 0x18f6, 0x2c00, 0x6802, 0x2560, 0x1078,
  16437. +    0x188b, 0x601b, 0x0005, 0x6023, 0x0020, 0x1078, 0x1992, 0x6810,
  16438. +    0x8001, 0x6812, 0x2001, 0xffff, 0xa005, 0x007c, 0x2039, 0x0000,
  16439. +    0x2041, 0x0021, 0x2049, 0x0004, 0x2051, 0x0008, 0x1078, 0x1849,
  16440. +    0x8738, 0xa784, 0x0007, 0x00c0, 0x190e, 0xa7bc, 0xff00, 0x873f,
  16441. +    0x8738, 0x873f, 0xa784, 0x0f00, 0x00c0, 0x190e, 0x007c, 0x2061,
  16442. +    0x0000, 0x6018, 0xa084, 0x0001, 0x00c0, 0x1930, 0x2091, 0x8000,
  16443. +    0x78c4, 0x78c7, 0x0000, 0x2091, 0x8001, 0xa005, 0x00c0, 0x1931,
  16444. +    0x007c, 0xa08c, 0xfff0, 0x0040, 0x1937, 0x1078, 0x1e2a, 0x0079,
  16445. +    0x1939, 0x1949, 0x194b, 0x1951, 0x1955, 0x1949, 0x1959, 0x1949,
  16446. +    0x1960, 0x1964, 0x1968, 0x1949, 0x1949, 0x1949, 0x1949, 0x1949,
  16447. +    0x1949, 0x1078, 0x1e2a, 0x1078, 0x1906, 0x2001, 0x8001, 0x0078,
  16448. +    0x1274, 0x2001, 0x8003, 0x0078, 0x1274, 0x2001, 0x8004, 0x0078,
  16449. +    0x1274, 0x1078, 0x1906, 0x2001, 0x8006, 0x007c, 0x0078, 0x1274,
  16450. +    0x2001, 0x8008, 0x0078, 0x1274, 0x2001, 0x8009, 0x0078, 0x1274,
  16451. +    0x2091, 0x8000, 0x2069, 0x3840, 0x6800, 0xa086, 0x0000, 0x0040,
  16452. +    0x1976, 0x2091, 0x8001, 0x78c7, 0x0009, 0x007c, 0x68b4, 0xa0bc,
  16453. +    0xff00, 0x2091, 0x8000, 0x2041, 0x0021, 0x2049, 0x0004, 0x2051,
  16454. +    0x0010, 0x1078, 0x1849, 0x8738, 0xa784, 0x0007, 0x00c0, 0x1981,
  16455. +    0x2001, 0x800a, 0x0078, 0x1274, 0x2001, 0x04fd, 0x2004, 0xa086,
  16456. +    0x0004, 0x007c, 0x6004, 0x6086, 0x2c08, 0x2063, 0x0000, 0x786c,
  16457. +    0x8000, 0x786e, 0x7870, 0xa005, 0x7972, 0x0040, 0x19a2, 0x2c02,
  16458. +    0x0078, 0x19a3, 0x7976, 0x007c, 0x0c7e, 0x2061, 0x3800, 0x6887,
  16459. +    0x0103, 0x2d08, 0x206b, 0x0000, 0x606c, 0x8000, 0x606e, 0x6070,
  16460. +    0xa005, 0x6172, 0x0040, 0x19b7, 0x2d02, 0x0078, 0x19b8, 0x6176,
  16461. +    0x0c7f, 0x007c, 0x1078, 0x19cb, 0x0040, 0x19ca, 0x0c7e, 0x609c,
  16462. +    0xa065, 0x0040, 0x19c5, 0x1078, 0x187e, 0x0c7f, 0x609f, 0x0000,
  16463. +    0x1078, 0x181e, 0x007c, 0x7874, 0xa065, 0x0040, 0x19dd, 0x2091,
  16464. +    0x8000, 0x786c, 0x8001, 0x786e, 0x2c04, 0x7876, 0xa005, 0x00c0,
  16465. +    0x19db, 0x7872, 0x8000, 0x2091, 0x8001, 0x007c, 0x20a9, 0x0010,
  16466. +    0xa006, 0x8004, 0x8086, 0x818e, 0x00c8, 0x19e7, 0xa200, 0x0070,
  16467. +    0x19eb, 0x0078, 0x19e2, 0x8086, 0x818e, 0x007c, 0x157e, 0x20a9,
  16468. +    0x0010, 0xa005, 0x0040, 0x1a11, 0xa11a, 0x00c8, 0x1a11, 0x8213,
  16469. +    0x818d, 0x0048, 0x1a02, 0xa11a, 0x00c8, 0x1a03, 0x0070, 0x1a09,
  16470. +    0x0078, 0x19f7, 0xa11a, 0x2308, 0x8210, 0x0070, 0x1a09, 0x0078,
  16471. +    0x19f7, 0x007e, 0x3200, 0xa084, 0xf7ff, 0x2080, 0x007f, 0x157f,
  16472. +    0x007c, 0x007e, 0x3200, 0xa085, 0x0800, 0x0078, 0x1a0d, 0x797c,
  16473. +    0x70d0, 0x007e, 0x007f, 0xa106, 0x0040, 0x1a67, 0x2091, 0x8000,
  16474. +    0x2071, 0x0020, 0x7004, 0xa005, 0x00c0, 0x1a67, 0x7008, 0x7208,
  16475. +    0xa206, 0x00c0, 0x1a67, 0xa286, 0x0008, 0x00c0, 0x1a67, 0x2071,
  16476. +    0x0010, 0x1078, 0x1815, 0x0040, 0x1a67, 0x7a84, 0x7b80, 0x7c8c,
  16477. +    0x7d88, 0x8107, 0x8004, 0x8004, 0xa210, 0xa399, 0x0000, 0x2009,
  16478. +    0x0040, 0x1078, 0x17df, 0x2091, 0x8001, 0x0040, 0x1a5e, 0x1078,
  16479. +    0x181e, 0x7890, 0x8000, 0x7892, 0xa086, 0x0002, 0x00c0, 0x1a67,
  16480. +    0x2091, 0x8000, 0x78c7, 0x0002, 0x7893, 0x0000, 0x78b0, 0xa085,
  16481. +    0x0003, 0x78b2, 0x2091, 0x8001, 0x0078, 0x1a67, 0x7893, 0x0000,
  16482. +    0x1078, 0x1bb6, 0x6004, 0xa084, 0x000f, 0x0079, 0x1a6c, 0x2071,
  16483. +    0x0010, 0x2091, 0x8001, 0x007c, 0x1a7c, 0x1a9e, 0x1ac4, 0x1a7c,
  16484. +    0x1ad6, 0x1a8b, 0x1a7c, 0x1a7c, 0x1a7c, 0x1a98, 0x1abe, 0x1a7c,
  16485. +    0x1a7c, 0x1a7c, 0x1a7c, 0x1a7c, 0x2039, 0x0400, 0x78c0, 0xa705,
  16486. +    0x78c2, 0x6008, 0xa705, 0x600a, 0x1078, 0x1b14, 0x609c, 0x78be,
  16487. +    0x1078, 0x1b9e, 0x007c, 0x78c0, 0xa084, 0x0100, 0x0040, 0x1a92,
  16488. +    0x0078, 0x1a7c, 0x601c, 0xa085, 0x0080, 0x601e, 0x0078, 0x1aa5,
  16489. +    0x1078, 0x198c, 0x00c0, 0x1a7c, 0x1078, 0x1bd0, 0x78c0, 0xa084,
  16490. +    0x0100, 0x0040, 0x1aa5, 0x0078, 0x1a7c, 0x78c3, 0x0000, 0x6004,
  16491. +    0x8007, 0xa084, 0x00ff, 0x78b6, 0x8001, 0x609f, 0x0000, 0x0040,
  16492. +    0x1abb, 0x1078, 0x1b14, 0x0040, 0x1abb, 0x78c0, 0xa085, 0x0100,
  16493. +    0x78c2, 0x0078, 0x1abd, 0x1078, 0x1b38, 0x007c, 0x1078, 0x198c,
  16494. +    0x00c0, 0x1a7c, 0x1078, 0x1bcc, 0x78c0, 0xa08c, 0x0e00, 0x00c0,
  16495. +    0x1acd, 0xa084, 0x0100, 0x00c0, 0x1acf, 0x0078, 0x1a7c, 0x1078,
  16496. +    0x1b14, 0x00c0, 0x1ad5, 0x1078, 0x1b38, 0x007c, 0x78c0, 0xa084,
  16497. +    0x0100, 0x0040, 0x1add, 0x0078, 0x1a7c, 0x78c3, 0x0000, 0x6714,
  16498. +    0x20a9, 0x0001, 0x6018, 0xa005, 0x0040, 0x1af8, 0xa7bc, 0xff00,
  16499. +    0x20a9, 0x0008, 0xa08e, 0x0001, 0x0040, 0x1af8, 0x2039, 0x0000,
  16500. +    0x20a9, 0x0080, 0xa08e, 0x0002, 0x0040, 0x1af8, 0x0078, 0x1b11,
  16501. +    0x1078, 0x183c, 0x2d00, 0xa088, 0x0002, 0x2091, 0x8000, 0x2168,
  16502. +    0x682b, 0x0000, 0x682f, 0x0000, 0x2104, 0xa084, 0xffde, 0x200a,
  16503. +    0x2100, 0xa088, 0x0010, 0x2091, 0x8001, 0x0070, 0x1b11, 0x0078,
  16504. +    0x1afd, 0x1078, 0x181e, 0x007c, 0x78b8, 0xa06d, 0x00c0, 0x1b1f,
  16505. +    0x2c00, 0x78ba, 0x78be, 0x609f, 0x0000, 0x0078, 0x1b2b, 0x2c00,
  16506. +    0x689e, 0x609f, 0x0000, 0x78ba, 0x2d00, 0x6002, 0x78bc, 0xad06,
  16507. +    0x00c0, 0x1b2b, 0x6002, 0x78b4, 0x8001, 0x78b6, 0x00c0, 0x1b37,
  16508. +    0x78c0, 0xa084, 0x0000, 0x78c2, 0x78bc, 0x2060, 0xa006, 0x007c,
  16509. +    0xa02e, 0x2530, 0x611c, 0x61a2, 0xa184, 0xc1ff, 0x601e, 0xa184,
  16510. +    0x0060, 0x0040, 0x1b47, 0x0e7e, 0x1078, 0x320a, 0x0e7f, 0x6596,
  16511. +    0x669a, 0x6714, 0x1078, 0x183c, 0x2091, 0x8000, 0x6808, 0xa084,
  16512. +    0x0001, 0x0040, 0x1b63, 0x2091, 0x8001, 0x1078, 0x188b, 0x2091,
  16513. +    0x8000, 0x1078, 0x1992, 0x2091, 0x8001, 0x78bb, 0x0000, 0x78bf,
  16514. +    0x0000, 0x0078, 0x1b9d, 0x6024, 0xa096, 0x0001, 0x00c0, 0x1b6a,
  16515. +    0x8000, 0x6026, 0x6a10, 0x6814, 0x2091, 0x8001, 0xa202, 0x0048,
  16516. +    0x1b79, 0x0040, 0x1b79, 0x2039, 0x0200, 0x1078, 0x1b9e, 0x0078,
  16517. +    0x1b9d, 0x2c08, 0x2091, 0x8000, 0x6800, 0xa065, 0x0040, 0x1b81,
  16518. +    0x6102, 0x6902, 0x00c0, 0x1b85, 0x6906, 0x2160, 0x6003, 0x0000,
  16519. +    0x6810, 0x8000, 0x6812, 0x2091, 0x8001, 0x6808, 0xa08c, 0x0040,
  16520. +    0x0040, 0x1b97, 0xa086, 0x0040, 0x680a, 0x1078, 0x189a, 0x1078,
  16521. +    0x1c74, 0x78bf, 0x0000, 0x78bb, 0x0000, 0x007c, 0x6008, 0xa705,
  16522. +    0x600a, 0x2091, 0x8000, 0x1078, 0x1992, 0x2091, 0x8001, 0x78bc,
  16523. +    0xa065, 0x0040, 0x1bb1, 0x609c, 0x78be, 0x609f, 0x0000, 0x0078,
  16524. +    0x1ba1, 0x78bb, 0x0000, 0x78bf, 0x0000, 0x007c, 0x7978, 0x787c,
  16525. +    0x8000, 0xa10a, 0x00c8, 0x1bbd, 0xa006, 0x787e, 0x70d2, 0x7804,
  16526. +    0xa005, 0x0040, 0x1bcb, 0x8001, 0x7806, 0x00c0, 0x1bcb, 0x0068,
  16527. +    0x1bcb, 0x2091, 0x4080, 0x007c, 0x2039, 0x1be4, 0x0078, 0x1bd2,
  16528. +    0x2039, 0x1bea, 0x2704, 0xa005, 0x0040, 0x1be3, 0xac00, 0x2068,
  16529. +    0x6b08, 0x6c0c, 0x6910, 0x6a14, 0x690a, 0x6a0e, 0x6b12, 0x6c16,
  16530. +    0x8738, 0x0078, 0x1bd2, 0x007c, 0x0003, 0x0009, 0x000f, 0x0015,
  16531. +    0x001b, 0x0000, 0x0015, 0x001b, 0x0000, 0x0068, 0x1c05, 0x2029,
  16532. +    0x0000, 0x7874, 0xa065, 0x0040, 0x1c00, 0x1078, 0x1c06, 0x0040,
  16533. +    0x1c00, 0x1078, 0x1c17, 0x00c0, 0x1c00, 0x8528, 0x0078, 0x1bf1,
  16534. +    0x85ff, 0x0040, 0x1c05, 0x2091, 0x4080, 0x007c, 0x7b94, 0x7998,
  16535. +    0x70d4, 0x007e, 0x007f, 0xa102, 0x00c0, 0x1c11, 0x2300, 0xa005,
  16536. +    0x007c, 0x0048, 0x1c15, 0xa302, 0x007c, 0x8002, 0x007c, 0x2091,
  16537. +    0x8000, 0x2071, 0x0020, 0x7004, 0xa005, 0x00c0, 0x1c5b, 0x7008,
  16538. +    0x7208, 0xa206, 0x00c0, 0x1c5b, 0xa286, 0x0008, 0x00c0, 0x1c5b,
  16539. +    0x2071, 0x0010, 0x1078, 0x1c60, 0x2009, 0x001c, 0x6028, 0xa005,
  16540. +    0x0040, 0x1c34, 0x2009, 0x0040, 0x1078, 0x17a5, 0x0040, 0x1c4d,
  16541. +    0x78ac, 0x8000, 0x78ae, 0xa086, 0x0002, 0x00c0, 0x1c5b, 0x2091,
  16542. +    0x8000, 0x78c7, 0x0003, 0x78af, 0x0000, 0x78b0, 0xa085, 0x0300,
  16543. +    0x78b2, 0x2091, 0x8001, 0x0078, 0x1c5b, 0x78af, 0x0000, 0x1078,
  16544. +    0x19ba, 0x7994, 0x7898, 0x8000, 0xa10a, 0x00c8, 0x1c58, 0xa006,
  16545. +    0x789a, 0x70d6, 0xa006, 0x2071, 0x0010, 0x2091, 0x8001, 0x007c,
  16546. +    0x8107, 0x8004, 0x8004, 0x7aa0, 0x7b9c, 0x7ca8, 0x7da4, 0xa210,
  16547. +    0xa399, 0x0000, 0xa4a1, 0x0000, 0xa5a9, 0x0000, 0x007c, 0x2009,
  16548. +    0x3868, 0x2091, 0x8000, 0x200a, 0x0f7e, 0x2079, 0x0100, 0x2009,
  16549. +    0x3840, 0x2091, 0x8000, 0x2104, 0xa086, 0x0000, 0x00c0, 0x1c8f,
  16550. +    0x2009, 0x3812, 0x2104, 0xa005, 0x00c0, 0x1c8f, 0x7830, 0xa084,
  16551. +    0x00c0, 0x00c0, 0x1c8f, 0x0018, 0x1c8f, 0x781b, 0x0045, 0x2091,
  16552. +    0x8001, 0x0f7f, 0x007c, 0x127e, 0x2091, 0x2300, 0x2071, 0x3840,
  16553. +    0x2079, 0x0100, 0x784b, 0x000f, 0x2019, 0x3105, 0x20a1, 0x012b,
  16554. +    0x2304, 0xa005, 0x0040, 0x1cad, 0x789a, 0x8318, 0x23ac, 0x8318,
  16555. +    0x2398, 0x53a6, 0x3318, 0x0078, 0x1ca0, 0x789b, 0x0020, 0x20a9,
  16556. +    0x0010, 0x78af, 0x0000, 0x78af, 0x0020, 0x0070, 0x1cb9, 0x0078,
  16557. +    0x1cb1, 0x7003, 0x0000, 0x1078, 0x1dbe, 0x7004, 0xa084, 0x000f,
  16558. +    0xa085, 0x6280, 0x7806, 0x780f, 0x9200, 0x7843, 0x00d8, 0x7853,
  16559. +    0x0080, 0x780b, 0x0008, 0x7047, 0x387f, 0x7043, 0x0000, 0x127f,
  16560. +    0x2000, 0x007c, 0xa18c, 0x000f, 0x2011, 0x0101, 0x2204, 0xa084,
  16561. +    0xfff0, 0xa105, 0x2012, 0x1078, 0x1dbe, 0x007c, 0x2011, 0x0101,
  16562. +    0x20a9, 0x0009, 0x810b, 0x0070, 0x1ce7, 0x0078, 0x1ce2, 0xa18c,
  16563. +    0x0e00, 0x2204, 0xa084, 0xf1ff, 0xa105, 0x2012, 0x007c, 0x2009,
  16564. +    0x0101, 0x20a9, 0x0005, 0x8213, 0x0070, 0x1cf8, 0x0078, 0x1cf3,
  16565. +    0xa294, 0x00e0, 0x2104, 0xa084, 0xff1f, 0xa205, 0x200a, 0x007c,
  16566. +    0x2011, 0x0101, 0x20a9, 0x000c, 0x810b, 0x0070, 0x1d09, 0x0078,
  16567. +    0x1d04, 0xa18c, 0xf000, 0x2204, 0xa084, 0x0fff, 0xa105, 0x2012,
  16568. +    0x007c, 0x2011, 0x0102, 0x2204, 0xa084, 0xffcf, 0xa105, 0x2012,
  16569. +    0x007c, 0x8103, 0x8003, 0xa080, 0x0020, 0x0c7e, 0x2061, 0x0100,
  16570. +    0x609a, 0x62ac, 0x63ac, 0x0c7f, 0x007c, 0x8103, 0x8003, 0xa080,
  16571. +    0x0022, 0x0c7e, 0x2061, 0x0100, 0x609a, 0x60a4, 0xa084, 0xffdf,
  16572. +    0x60ae, 0x0c7f, 0x007c, 0x8103, 0x8003, 0xa080, 0x0022, 0x0c7e,
  16573. +    0x2061, 0x0100, 0x609a, 0x60a4, 0xa085, 0x0020, 0x60ae, 0x0c7f,
  16574. +    0x007c, 0x8103, 0x8003, 0xa080, 0x0020, 0x0c7e, 0x2061, 0x0100,
  16575. +    0x609a, 0x60a4, 0x62ae, 0x2010, 0x60a4, 0x63ae, 0x2018, 0x0c7f,
  16576. +    0x007c, 0x0c7e, 0x0e7e, 0x6818, 0xa005, 0x0040, 0x1d9a, 0x2061,
  16577. +    0x4280, 0x1078, 0x1da0, 0x0040, 0x1d84, 0x20a9, 0x0000, 0x2061,
  16578. +    0x4180, 0x0c7e, 0x1078, 0x1da0, 0x0040, 0x1d6e, 0x0c7f, 0x8c60,
  16579. +    0x0070, 0x1d6c, 0x0078, 0x1d61, 0x0078, 0x1d9a, 0x007f, 0xa082,
  16580. +    0x4180, 0x2071, 0x3840, 0x70ba, 0x6020, 0xa085, 0x0800, 0x6022,
  16581. +    0x2091, 0x8001, 0x71b6, 0x2001, 0x0004, 0x70a2, 0x70c7, 0x0005,
  16582. +    0x1078, 0x1c6f, 0x0078, 0x1d96, 0x2071, 0x3840, 0x6020, 0xa085,
  16583. +    0x0800, 0x6022, 0x2091, 0x8001, 0x71b6, 0x2c00, 0x70be, 0x2001,
  16584. +    0x0006, 0x70a2, 0x70c7, 0x0005, 0x1078, 0x1c6f, 0x2001, 0x0000,
  16585. +    0x0078, 0x1d9c, 0x2001, 0x0001, 0xa005, 0x0e7f, 0x0c7f, 0x007c,
  16586. +    0x2091, 0x8000, 0x2c04, 0xa005, 0x0040, 0x1db9, 0x2060, 0x6010,
  16587. +    0xa306, 0x00c0, 0x1db6, 0x600c, 0xa206, 0x00c0, 0x1db6, 0x6014,
  16588. +    0xa106, 0x00c0, 0x1db6, 0xa006, 0x0078, 0x1dbd, 0x6000, 0x0078,
  16589. +    0x1da3, 0xa085, 0x0001, 0x2091, 0x8001, 0x007c, 0x2011, 0x3841,
  16590. +    0x220c, 0xa18c, 0x000f, 0x2011, 0x013b, 0x2204, 0xa084, 0x0100,
  16591. +    0x0040, 0x1dd4, 0x2021, 0xff04, 0x2122, 0x810b, 0x810b, 0x810b,
  16592. +    0x810b, 0xa18d, 0x0f00, 0x2104, 0x007c, 0x0e7e, 0x68e4, 0xa08c,
  16593. +    0x0020, 0x0040, 0x1e28, 0xa084, 0x0006, 0x00c0, 0x1e28, 0x6014,
  16594. +    0x8007, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0f0, 0x3900,
  16595. +    0x7004, 0xa084, 0x000a, 0x00c0, 0x1e28, 0x7108, 0xa194, 0xff00,
  16596. +    0x0040, 0x1e28, 0xa18c, 0x00ff, 0x2001, 0x000c, 0xa106, 0x0040,
  16597. +    0x1e0f, 0x2001, 0x0012, 0xa106, 0x0040, 0x1e13, 0x2001, 0x0014,
  16598. +    0xa106, 0x0040, 0x1e17, 0x2001, 0x0019, 0xa106, 0x0040, 0x1e1b,
  16599. +    0x2001, 0x0032, 0xa106, 0x0040, 0x1e1f, 0x0078, 0x1e23, 0x2009,
  16600. +    0x0012, 0x0078, 0x1e25, 0x2009, 0x0014, 0x0078, 0x1e25, 0x2009,
  16601. +    0x0019, 0x0078, 0x1e25, 0x2009, 0x0020, 0x0078, 0x1e25, 0x2009,
  16602. +    0x003f, 0x0078, 0x1e25, 0x2011, 0x0000, 0x2100, 0xa205, 0x700a,
  16603. +    0x0e7f, 0x007c, 0x2071, 0x0010, 0x70ca, 0x007f, 0x70c6, 0x70c3,
  16604. +    0x8002, 0x2071, 0x0000, 0x701b, 0x0001, 0x2091, 0x4080, 0x0078,
  16605. +    0x1e37, 0x107e, 0x007e, 0x127e, 0x2091, 0x2300, 0x7f3c, 0x7e58,
  16606. +    0x7c30, 0x7d38, 0x2009, 0x3874, 0x78a0, 0x200a, 0x8108, 0x250a,
  16607. +    0x8108, 0x240a, 0x8108, 0x260a, 0x8108, 0x270a, 0xa594, 0x003f,
  16608. +    0xa484, 0x4000, 0x0040, 0x1e5a, 0xa784, 0x007c, 0x00c0, 0x308f,
  16609. +    0x1078, 0x1e2a, 0xa49c, 0x000f, 0xa382, 0x0004, 0x0050, 0x1e62,
  16610. +    0x1078, 0x1e2a, 0x8507, 0xa084, 0x000f, 0x0079, 0x1e67, 0x22d0,
  16611. +    0x236f, 0x238c, 0x25f7, 0x283b, 0x287e, 0x28c7, 0x2925, 0x29bc,
  16612. +    0x2a49, 0x1e8f, 0x1e77, 0x2139, 0x21fe, 0x281a, 0x1e77, 0x1078,
  16613. +    0x1e2a, 0x0018, 0x1e3e, 0x127f, 0x2091, 0x8001, 0x007f, 0x107f,
  16614. +    0x007c, 0x7003, 0x0000, 0x703f, 0x0000, 0x7030, 0xa005, 0x0040,
  16615. +    0x1e8b, 0x7033, 0x0000, 0x1078, 0x306a, 0x0018, 0x1e3e, 0x2009,
  16616. +    0x380f, 0x200b, 0x0000, 0x705c, 0xa005, 0x00c0, 0x1f58, 0x70a0,
  16617. +    0xa084, 0x0007, 0x0079, 0x1e9c, 0x1f7b, 0x1ea4, 0x1eb2, 0x1ecd,
  16618. +    0x1eed, 0x1f36, 0x1f11, 0x1ea4, 0x7808, 0xa084, 0xfffd, 0x780a,
  16619. +    0x2009, 0x0047, 0x1078, 0x271f, 0x00c0, 0x1eb0, 0x7003, 0x0004,
  16620. +    0x0078, 0x1e79, 0x1078, 0x3051, 0x00c0, 0x1ecb, 0x70b4, 0x8007,
  16621. +    0x7882, 0x789b, 0x0010, 0x78ab, 0x000c, 0x789b, 0x0060, 0x78ab,
  16622. +    0x0001, 0x785b, 0x0004, 0x2009, 0x00fb, 0x1078, 0x271d, 0x00c0,
  16623. +    0x1ecb, 0x7003, 0x0004, 0x0078, 0x1e79, 0x1078, 0x3051, 0x00c0,
  16624. +    0x1eeb, 0x71b4, 0x8107, 0x7882, 0x789b, 0x0010, 0xa18c, 0x0007,
  16625. +    0xa18d, 0x00c0, 0x79aa, 0x78ab, 0x0006, 0x789b, 0x0060, 0x78ab,
  16626. +    0x0002, 0x785b, 0x0004, 0x2009, 0x00fb, 0x1078, 0x271d, 0x00c0,
  16627. +    0x1eeb, 0x7003, 0x0004, 0x0078, 0x1e79, 0x1078, 0x3051, 0x00c0,
  16628. +    0x1f0f, 0x71b4, 0x8107, 0x7882, 0x789b, 0x0010, 0xa18c, 0x0007,
  16629. +    0xa18d, 0x00c0, 0x79aa, 0x78ab, 0x0020, 0x71b8, 0x79aa, 0x78ab,
  16630. +    0x000d, 0x789b, 0x0060, 0x78ab, 0x0004, 0x785b, 0x0004, 0x2009,
  16631. +    0x00fb, 0x1078, 0x271d, 0x00c0, 0x1f0f, 0x7003, 0x0004, 0x0078,
  16632. +    0x1e79, 0x1078, 0x3051, 0x00c0, 0x1f34, 0x71b4, 0x8107, 0x7882,
  16633. +    0x789b, 0x0010, 0xa18c, 0x0007, 0xa18d, 0x00c0, 0x79aa, 0x78ab,
  16634. +    0x0006, 0x789b, 0x0060, 0x78ab, 0x0002, 0x785b, 0x0004, 0x2009,
  16635. +    0x00fb, 0x1078, 0x271d, 0x00c0, 0x1f34, 0x70bc, 0x70bf, 0x0000,
  16636. +    0x2068, 0x703e, 0x7003, 0x0002, 0x0078, 0x1e79, 0x1078, 0x3051,
  16637. +    0x00c0, 0x1e79, 0x70bc, 0x2068, 0x1078, 0x30f3, 0x789b, 0x0010,
  16638. +    0x6814, 0xa084, 0x0007, 0xa085, 0x0080, 0x007e, 0x007f, 0x78aa,
  16639. +    0x6e1c, 0x067e, 0x067f, 0x2041, 0x0001, 0x70c0, 0xa084, 0x0400,
  16640. +    0x2001, 0x0004, 0x0040, 0x1f56, 0x2001, 0x0006, 0x0078, 0x2057,
  16641. +    0x1078, 0x3051, 0x00c0, 0x1e79, 0x789b, 0x0010, 0x705c, 0x2068,
  16642. +    0x1078, 0x30f3, 0x6f14, 0x1078, 0x2f99, 0x6008, 0xa085, 0x0010,
  16643. +    0x600a, 0xad80, 0x0009, 0x2003, 0x0005, 0x6814, 0xa084, 0x0007,
  16644. +    0xa085, 0x0080, 0x78aa, 0x2031, 0x0020, 0x2041, 0x0001, 0x2001,
  16645. +    0x0003, 0x0078, 0x2057, 0x0018, 0x1e3e, 0x7440, 0xa485, 0x0000,
  16646. +    0x0040, 0x1f95, 0xa080, 0x3880, 0x2030, 0x7144, 0x8108, 0xa12a,
  16647. +    0x0048, 0x1f8c, 0x2009, 0x3880, 0x2164, 0x6504, 0x85ff, 0x00c0,
  16648. +    0x1fa2, 0x8421, 0x00c0, 0x1f86, 0x7146, 0x7003, 0x0000, 0x703f,
  16649. +    0x0000, 0x0078, 0x1e79, 0x7640, 0xa6b0, 0x3880, 0x7144, 0x2600,
  16650. +    0x0078, 0x1f91, 0x7146, 0x2568, 0x2558, 0x753e, 0x2c50, 0x6708,
  16651. +    0x7736, 0xa784, 0x013f, 0x0040, 0x1fcf, 0xa784, 0x0021, 0x00c0,
  16652. +    0x1f9f, 0xa784, 0x0002, 0x0040, 0x1fbc, 0xa784, 0x0004, 0x0040,
  16653. +    0x1f9f, 0xa7bc, 0xfffb, 0x670a, 0xa784, 0x0008, 0x00c0, 0x1f9f,
  16654. +    0xa784, 0x0010, 0x00c0, 0x1f9f, 0xa784, 0x0100, 0x0040, 0x1fcf,
  16655. +    0x6018, 0xa005, 0x00c0, 0x1f9f, 0xa7bc, 0xfeff, 0x670a, 0x6823,
  16656. +    0x0000, 0x6e1c, 0xa684, 0x000e, 0x6118, 0x0040, 0x1fdf, 0x601c,
  16657. +    0xa102, 0x0048, 0x1fe2, 0x0040, 0x1fe2, 0x0078, 0x1f9b, 0x81ff,
  16658. +    0x00c0, 0x1f9b, 0xa784, 0x0080, 0x00c0, 0x1fe8, 0x700c, 0x6022,
  16659. +    0x1078, 0x30f3, 0x0018, 0x1e3e, 0x789b, 0x0010, 0xa046, 0x1078,
  16660. +    0x3051, 0x00c0, 0x1e79, 0x6b14, 0xa39c, 0x0007, 0xa39d, 0x00c0,
  16661. +    0x704c, 0xa084, 0x8000, 0x0040, 0x2001, 0xa684, 0x0001, 0x0040,
  16662. +    0x2003, 0xa39c, 0xffbf, 0xa684, 0x0010, 0x0040, 0x2009, 0xa39d,
  16663. +    0x0020, 0x7baa, 0x8840, 0xa684, 0x000e, 0x00c0, 0x2014, 0xa7bd,
  16664. +    0x0010, 0x670a, 0x0078, 0x2055, 0x714c, 0xa18c, 0x0800, 0x0040,
  16665. +    0x2c2b, 0x2011, 0x0021, 0x8004, 0x8004, 0x0048, 0x202b, 0x2011,
  16666. +    0x0022, 0x8004, 0x0048, 0x202b, 0x2011, 0x0020, 0x8004, 0x0048,
  16667. +    0x202b, 0x0040, 0x2055, 0x7aaa, 0x8840, 0x1078, 0x306a, 0x6a14,
  16668. +    0x610c, 0x8108, 0xa18c, 0x00ff, 0xa1e0, 0x4180, 0x2c64, 0x8cff,
  16669. +    0x0040, 0x204c, 0x6014, 0xa206, 0x00c0, 0x2036, 0x60b8, 0x8001,
  16670. +    0x60ba, 0x00c0, 0x2031, 0x0c7e, 0x2a60, 0x6008, 0xa085, 0x0100,
  16671. +    0x600a, 0x0c7f, 0x0078, 0x1f7b, 0x1078, 0x3051, 0x00c0, 0x1e79,
  16672. +    0x2a60, 0x610e, 0x79aa, 0x8840, 0x712e, 0x2001, 0x0001, 0x007e,
  16673. +    0x7150, 0xa184, 0x0018, 0x0040, 0x2072, 0xa184, 0x0010, 0x0040,
  16674. +    0x2065, 0x1078, 0x2de3, 0x00c0, 0x2095, 0xa184, 0x0008, 0x0040,
  16675. +    0x2072, 0x69a0, 0xa184, 0x0600, 0x00c0, 0x2072, 0x1078, 0x2cdf,
  16676. +    0x0078, 0x2095, 0x69a0, 0xa184, 0x0800, 0x0040, 0x2089, 0x0c7e,
  16677. +    0x027e, 0x2960, 0x6000, 0xa085, 0x2000, 0x6002, 0x6104, 0xa18d,
  16678. +    0x0010, 0x6106, 0x027f, 0x0c7f, 0x1078, 0x2de3, 0x00c0, 0x2095,
  16679. +    0x69a0, 0xa184, 0x0200, 0x0040, 0x2091, 0x1078, 0x2d2e, 0x0078,
  16680. +    0x2095, 0xa184, 0x0400, 0x00c0, 0x206e, 0x69a0, 0xa184, 0x1000,
  16681. +    0x0040, 0x20a0, 0x6914, 0xa18c, 0xff00, 0x810f, 0x1078, 0x1d25,
  16682. +    0x007f, 0x7002, 0xa68c, 0x00e0, 0xa684, 0x0060, 0x0040, 0x20ae,
  16683. +    0xa086, 0x0060, 0x00c0, 0x20ae, 0xa18d, 0x4000, 0x88ff, 0x0040,
  16684. +    0x20b3, 0xa18d, 0x0004, 0x795a, 0x69b6, 0x789b, 0x0060, 0x2800,
  16685. +    0x78aa, 0x789b, 0x0061, 0x6818, 0xa08d, 0x8000, 0xa084, 0x7fff,
  16686. +    0x691a, 0xa68c, 0x0080, 0x0040, 0x20d2, 0x70cb, 0x0000, 0xa08a,
  16687. +    0x000d, 0x0050, 0x20d0, 0xa08a, 0x000c, 0x71ca, 0x2001, 0x000c,
  16688. +    0x800c, 0x71ce, 0x78aa, 0x8008, 0x810c, 0x0040, 0x2c36, 0xa18c,
  16689. +    0x00f8, 0x00c0, 0x2c36, 0x157e, 0x137e, 0x147e, 0x20a1, 0x012b,
  16690. +    0x789b, 0x0000, 0x8000, 0x80ac, 0xad80, 0x000b, 0x2098, 0x53a6,
  16691. +    0x147f, 0x137f, 0x157f, 0x6814, 0x8007, 0x7882, 0x6d94, 0x7dd6,
  16692. +    0x7dde, 0x6e98, 0x7ed2, 0x7eda, 0x7830, 0xa084, 0x00c0, 0x00c0,
  16693. +    0x20fb, 0x0098, 0x2103, 0x6008, 0xa084, 0xffef, 0x600a, 0x1078,
  16694. +    0x306a, 0x0078, 0x1e81, 0x7200, 0xa284, 0x0007, 0xa086, 0x0001,
  16695. +    0x00c0, 0x2110, 0x781b, 0x004a, 0x1078, 0x306a, 0x0078, 0x2121,
  16696. +    0x6ab4, 0xa295, 0x2000, 0x7a5a, 0x781b, 0x004a, 0x1078, 0x306a,
  16697. +    0x7200, 0x2500, 0xa605, 0x0040, 0x2121, 0xa284, 0x0007, 0x1079,
  16698. +    0x212f, 0xa284, 0x0007, 0xa086, 0x0001, 0x00c0, 0x1e79, 0x6018,
  16699. +    0x8000, 0x601a, 0xad80, 0x0009, 0x7032, 0x0078, 0x1e79, 0x2137,
  16700. +    0x347d, 0x347d, 0x346c, 0x347d, 0x2137, 0x346c, 0x2137, 0x1078,
  16701. +    0x1e2a, 0x7808, 0xa084, 0xfffd, 0x780a, 0x0f7e, 0x2079, 0x3800,
  16702. +    0x78b0, 0x0f7f, 0xa084, 0x0001, 0x0040, 0x215f, 0x70a0, 0xa086,
  16703. +    0x0001, 0x00c0, 0x214e, 0x70a2, 0x0078, 0x21e2, 0x70a0, 0xa086,
  16704. +    0x0005, 0x00c0, 0x215d, 0x70bc, 0x2068, 0x681b, 0x0004, 0x6817,
  16705. +    0x0000, 0x6820, 0xa085, 0x0008, 0x6822, 0x70a3, 0x0000, 0x157e,
  16706. +    0x2011, 0x0004, 0x71a0, 0xa186, 0x0001, 0x0040, 0x217d, 0xa186,
  16707. +    0x0007, 0x00c0, 0x2171, 0x2009, 0x3831, 0x200b, 0x0005, 0x0078,
  16708. +    0x217d, 0x2009, 0x3813, 0x2104, 0x2009, 0x3812, 0x200a, 0x2009,
  16709. +    0x3831, 0x200b, 0x0001, 0x0078, 0x217f, 0x70a3, 0x0000, 0x1078,
  16710. +    0x31f5, 0x20a9, 0x0010, 0x2039, 0x0000, 0x1078, 0x2e9a, 0xa7b8,
  16711. +    0x0100, 0x0070, 0x218d, 0x0078, 0x2185, 0x7000, 0x0079, 0x2190,
  16712. +    0x21be, 0x21a7, 0x21a7, 0x219a, 0x21be, 0x21be, 0x21be, 0x2198,
  16713. +    0x1078, 0x1e2a, 0x2021, 0x3857, 0x2404, 0xa005, 0x0040, 0x21be,
  16714. +    0xad06, 0x00c0, 0x21a7, 0x6800, 0x2022, 0x0078, 0x21b7, 0x6820,
  16715. +    0xa084, 0x0001, 0x00c0, 0x21b3, 0x6f14, 0x1078, 0x2f99, 0x1078,
  16716. +    0x2bf8, 0x0078, 0x21b7, 0x7054, 0x2060, 0x6800, 0x6002, 0x6a1a,
  16717. +    0x6820, 0xa085, 0x0008, 0x6822, 0x1078, 0x19a4, 0x2021, 0x4280,
  16718. +    0x1078, 0x21e8, 0x2021, 0x3857, 0x1078, 0x21e8, 0x20a9, 0x0000,
  16719. +    0x2021, 0x4180, 0x1078, 0x21e8, 0x8420, 0x0070, 0x21d1, 0x0078,
  16720. +    0x21ca, 0x20a9, 0x0080, 0x2061, 0x3980, 0x6018, 0x6110, 0xa102,
  16721. +    0x6012, 0x601b, 0x0000, 0xace0, 0x0010, 0x0070, 0x21e1, 0x0078,
  16722. +    0x21d5, 0x157f, 0x7003, 0x0000, 0x703f, 0x0000, 0x0078, 0x1e79,
  16723. +    0x047e, 0x2404, 0xa005, 0x0040, 0x21fa, 0x2068, 0x6800, 0x007e,
  16724. +    0x6a1a, 0x6820, 0xa085, 0x0008, 0x6822, 0x1078, 0x19a4, 0x007f,
  16725. +    0x0078, 0x21ea, 0x047f, 0x2023, 0x0000, 0x007c, 0xa282, 0x0003,
  16726. +    0x0050, 0x2204, 0x1078, 0x1e2a, 0x2300, 0x0079, 0x2207, 0x220a,
  16727. +    0x2271, 0x228e, 0xa282, 0x0002, 0x0040, 0x2210, 0x1078, 0x1e2a,
  16728. +    0x70a0, 0x70a3, 0x0000, 0x0079, 0x2215, 0x221d, 0x221d, 0x221f,
  16729. +    0x2251, 0x224f, 0x221d, 0x2251, 0x221d, 0x1078, 0x1e2a, 0x77b4,
  16730. +    0x1078, 0x2e9a, 0x77b4, 0xa7bc, 0x0f00, 0x1078, 0x2f99, 0x6018,
  16731. +    0xa005, 0x0040, 0x2248, 0x2021, 0x4280, 0x1078, 0x22a9, 0x0040,
  16732. +    0x2248, 0x157e, 0x20a9, 0x0000, 0x2021, 0x4180, 0x047e, 0x1078,
  16733. +    0x22a9, 0x047f, 0x0040, 0x2241, 0x8420, 0x0070, 0x2241, 0x0078,
  16734. +    0x2236, 0x157f, 0x2021, 0x3857, 0x1078, 0x22a9, 0x0040, 0x2248,
  16735. +    0x8738, 0xa784, 0x0007, 0x00c0, 0x2225, 0x0078, 0x1e81, 0x0078,
  16736. +    0x1e81, 0x77b4, 0x1078, 0x2f99, 0x6018, 0xa005, 0x0040, 0x226f,
  16737. +    0x2021, 0x4280, 0x1078, 0x22a9, 0x0040, 0x226f, 0x157e, 0x20a9,
  16738. +    0x0000, 0x2021, 0x4180, 0x047e, 0x1078, 0x22a9, 0x047f, 0x0040,
  16739. +    0x226e, 0x8420, 0x0070, 0x226e, 0x0078, 0x2263, 0x157f, 0x0078,
  16740. +    0x1e81, 0x2200, 0x0079, 0x2274, 0x2277, 0x2279, 0x2279, 0x1078,
  16741. +    0x1e2a, 0x2009, 0x0012, 0x70a0, 0xa086, 0x0002, 0x0040, 0x2282,
  16742. +    0x2009, 0x000e, 0x6818, 0xa084, 0x8000, 0x0040, 0x2288, 0x691a,
  16743. +    0x70a3, 0x0000, 0x70a7, 0x0001, 0x0078, 0x301c, 0x2200, 0x0079,
  16744. +    0x2291, 0x2296, 0x2279, 0x2294, 0x1078, 0x1e2a, 0x1078, 0x272c,
  16745. +    0x7000, 0xa086, 0x0001, 0x00c0, 0x2bce, 0x1078, 0x2c0e, 0x6008,
  16746. +    0xa084, 0xffef, 0x600a, 0x1078, 0x2bc1, 0x0040, 0x2bce, 0x0078,
  16747. +    0x1f7b, 0x2404, 0xa005, 0x0040, 0x22cc, 0x2068, 0x2d04, 0x007e,
  16748. +    0x6814, 0xa706, 0x0040, 0x22b8, 0x2d20, 0x007f, 0x0078, 0x22aa,
  16749. +    0x007f, 0x2022, 0x681b, 0x0004, 0x6820, 0xa085, 0x0010, 0x6822,
  16750. +    0x1078, 0x19a4, 0x6010, 0x8001, 0x6012, 0x6008, 0xa084, 0xffef,
  16751. +    0x600a, 0x1078, 0x2c0e, 0x007c, 0xa085, 0x0001, 0x0078, 0x22cb,
  16752. +    0x2300, 0x0079, 0x22d3, 0x22d8, 0x22d6, 0x2324, 0x1078, 0x1e2a,
  16753. +    0x78e4, 0xa005, 0x00d0, 0x22ec, 0x0018, 0x22ec, 0xa084, 0x0007,
  16754. +    0x0079, 0x22e2, 0x22fd, 0x230a, 0x22f0, 0x22ea, 0x3044, 0x3044,
  16755. +    0x22ea, 0x2317, 0x1078, 0x1e2a, 0x2001, 0x0003, 0x0078, 0x260b,
  16756. +    0x6818, 0xa084, 0x8000, 0x0040, 0x22f7, 0x681b, 0x001d, 0x1078,
  16757. +    0x2e7d, 0x781b, 0x0053, 0x0078, 0x1e79, 0x6818, 0xa084, 0x8000,
  16758. +    0x0040, 0x2304, 0x681b, 0x001d, 0x1078, 0x2e7d, 0x781b, 0x00de,
  16759. +    0x0078, 0x1e79, 0x6818, 0xa084, 0x8000, 0x0040, 0x2311, 0x681b,
  16760. +    0x001d, 0x1078, 0x2e7d, 0x781b, 0x00e5, 0x0078, 0x1e79, 0x6818,
  16761. +    0xa084, 0x8000, 0x0040, 0x231e, 0x681b, 0x001d, 0x1078, 0x2e7d,
  16762. +    0x781b, 0x009c, 0x0078, 0x1e79, 0xa584, 0x000f, 0x00c0, 0x2343,
  16763. +    0x1078, 0x272c, 0x7000, 0x0079, 0x232d, 0x2335, 0x2337, 0x2335,
  16764. +    0x2bce, 0x2bce, 0x2bce, 0x2bce, 0x2335, 0x1078, 0x1e2a, 0x1078,
  16765. +    0x2c0e, 0x6008, 0xa084, 0xffef, 0x600a, 0x1078, 0x2bc1, 0x0040,
  16766. +    0x2bce, 0x0078, 0x1f7b, 0x79e4, 0xa005, 0x00d0, 0x22ec, 0x0018,
  16767. +    0x22ec, 0xa184, 0x0007, 0x0079, 0x234d, 0x235d, 0x2363, 0x2357,
  16768. +    0x2355, 0x3044, 0x3044, 0x2355, 0x303c, 0x1078, 0x1e2a, 0x1078,
  16769. +    0x2e85, 0x781b, 0x0053, 0x0078, 0x1e79, 0x1078, 0x2e85, 0x781b,
  16770. +    0x00de, 0x0078, 0x1e79, 0x1078, 0x2e85, 0x781b, 0x00e5, 0x0078,
  16771. +    0x1e79, 0x1078, 0x2e85, 0x781b, 0x009c, 0x0078, 0x1e79, 0x2300,
  16772. +    0x0079, 0x2372, 0x2377, 0x2375, 0x2379, 0x1078, 0x1e2a, 0x0078,
  16773. +    0x2925, 0x681b, 0x0008, 0x78a3, 0x0000, 0x79e4, 0xa184, 0x0007,
  16774. +    0x0079, 0x2382, 0x238a, 0x2363, 0x22f0, 0x301c, 0x3044, 0x3044,
  16775. +    0x238a, 0x303c, 0x1078, 0x1e2a, 0xa282, 0x0005, 0x0050, 0x2392,
  16776. +    0x1078, 0x1e2a, 0x2300, 0x0079, 0x2395, 0x2398, 0x25bc, 0x25c8,
  16777. +    0x2200, 0x0079, 0x239b, 0x23b5, 0x23a2, 0x23b5, 0x23a0, 0x25a1,
  16778. +    0x1078, 0x1e2a, 0x789b, 0x0018, 0x78a8, 0xa084, 0x00ff, 0xa082,
  16779. +    0x0020, 0x0048, 0x2e69, 0xa08a, 0x0004, 0x00c8, 0x2e69, 0x0079,
  16780. +    0x23b1, 0x2e69, 0x2e69, 0x2e69, 0x2e23, 0x789b, 0x0018, 0x79a8,
  16781. +    0xa184, 0x0080, 0x0040, 0x23ca, 0xa184, 0x0018, 0x0040, 0x23c6,
  16782. +    0x0078, 0x2e69, 0x7000, 0xa005, 0x00c0, 0x23c0, 0x2011, 0x0004,
  16783. +    0x0078, 0x2a57, 0xa184, 0x00ff, 0xa08a, 0x0010, 0x00c8, 0x2e69,
  16784. +    0x0079, 0x23d2, 0x23e4, 0x23e2, 0x23fc, 0x2400, 0x24b8, 0x2e69,
  16785. +    0x2e69, 0x24ba, 0x2e69, 0x2e69, 0x259d, 0x259d, 0x2e69, 0x2e69,
  16786. +    0x2e69, 0x259f, 0x1078, 0x1e2a, 0xa684, 0x1000, 0x0040, 0x23f1,
  16787. +    0x2001, 0x0300, 0x8000, 0x8000, 0x783a, 0x781b, 0x0099, 0x0078,
  16788. +    0x1e79, 0x6818, 0xa084, 0x8000, 0x0040, 0x23fa, 0x681b, 0x001d,
  16789. +    0x0078, 0x23e8, 0x0078, 0x301c, 0x681b, 0x001d, 0x0078, 0x2e75,
  16790. +    0x6920, 0xa184, 0x8000, 0x00c0, 0x240c, 0x68af, 0x0000, 0x68b3,
  16791. +    0x0000, 0xa18d, 0x8000, 0x6922, 0xa684, 0x1800, 0x00c0, 0x244b,
  16792. +    0x6820, 0xa084, 0x0001, 0x00c0, 0x2451, 0x6818, 0xa086, 0x0008,
  16793. +    0x00c0, 0x241c, 0x681b, 0x0000, 0xa684, 0x0400, 0x0040, 0x24b4,
  16794. +    0xa684, 0x0080, 0x0040, 0x2447, 0x70cb, 0x0000, 0x6818, 0xa084,
  16795. +    0x003f, 0xa08a, 0x000d, 0x0050, 0x2447, 0xa08a, 0x000c, 0x71ca,
  16796. +    0x2001, 0x000c, 0x800c, 0x71ce, 0x789b, 0x0061, 0x78aa, 0x157e,
  16797. +    0x137e, 0x147e, 0x20a1, 0x012b, 0x789b, 0x0000, 0x8000, 0x80ac,
  16798. +    0xad80, 0x000b, 0x2098, 0x53a6, 0x147f, 0x137f, 0x157f, 0x781b,
  16799. +    0x0056, 0x0078, 0x1e79, 0xa684, 0x1000, 0x0040, 0x2451, 0x0078,
  16800. +    0x1e79, 0xa684, 0x0060, 0x0040, 0x24b0, 0xa684, 0x0800, 0x0040,
  16801. +    0x24b0, 0xa684, 0x8000, 0x00c0, 0x2461, 0x69b0, 0x6aac, 0x0078,
  16802. +    0x247b, 0xa6b4, 0x7fff, 0x7e5a, 0x6eb6, 0x789b, 0x0074, 0x7aac,
  16803. +    0x79ac, 0x78ac, 0x801b, 0x00c8, 0x246e, 0x8000, 0xa084, 0x003f,
  16804. +    0xa108, 0xa291, 0x0000, 0x6b98, 0x2100, 0xa302, 0x68b2, 0x6b94,
  16805. +    0x2200, 0xa303, 0x68ae, 0xa684, 0x4000, 0x0040, 0x2483, 0xa6b4,
  16806. +    0xbfff, 0x7e5a, 0x6eb6, 0xa006, 0x1078, 0x353b, 0x6ab0, 0x69ac,
  16807. +    0x6c98, 0x6b94, 0x2200, 0xa105, 0x0040, 0x2492, 0x2200, 0xa422,
  16808. +    0x2100, 0xa31b, 0x6caa, 0x7cd2, 0x6ba6, 0x7bd6, 0x2300, 0xa405,
  16809. +    0x00c0, 0x24a2, 0xa6b5, 0x4000, 0x7e5a, 0x6eb6, 0x781b, 0x0065,
  16810. +    0x0078, 0x1e79, 0x781b, 0x0065, 0x2200, 0xa115, 0x00c0, 0x24ac,
  16811. +    0x1078, 0x347d, 0x0078, 0x1e79, 0x1078, 0x34b2, 0x0078, 0x1e79,
  16812. +    0x781b, 0x0068, 0x0078, 0x1e79, 0x781b, 0x0056, 0x0078, 0x1e79,
  16813. +    0x1078, 0x1e2a, 0x0078, 0x250f, 0x6920, 0xa184, 0x0100, 0x0040,
  16814. +    0x24ce, 0xa18c, 0xfeff, 0x6922, 0x0c7e, 0x7048, 0x2060, 0x6004,
  16815. +    0xa084, 0xfff5, 0x6006, 0x0c7f, 0x0078, 0x24fe, 0xa184, 0x0200,
  16816. +    0x0040, 0x24fe, 0xa18c, 0xfdff, 0x6922, 0x0c7e, 0x7048, 0x2060,
  16817. +    0x6004, 0xa084, 0xffef, 0x6006, 0x2008, 0x2c48, 0x0c7f, 0xa184,
  16818. +    0x0008, 0x0040, 0x24fe, 0x1078, 0x2f95, 0x1078, 0x2cdf, 0x88ff,
  16819. +    0x0040, 0x24fe, 0x789b, 0x0060, 0x2800, 0x78aa, 0x7e58, 0xa6b5,
  16820. +    0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x24fa, 0x781b, 0x0053,
  16821. +    0x0078, 0x1e79, 0x781b, 0x0067, 0x0078, 0x1e79, 0x7e58, 0xa684,
  16822. +    0x0400, 0x00c0, 0x2507, 0x781b, 0x0056, 0x0078, 0x1e79, 0x781b,
  16823. +    0x0068, 0x0078, 0x1e79, 0x0078, 0x2e6f, 0x0078, 0x2e6f, 0x2019,
  16824. +    0x0000, 0x7990, 0xa18c, 0x0007, 0x0040, 0x250d, 0x789b, 0x0010,
  16825. +    0x78a8, 0xa094, 0x00ff, 0xa286, 0x0001, 0x00c0, 0x2532, 0x2300,
  16826. +    0x7ca8, 0xa400, 0x2018, 0xa102, 0x0040, 0x252a, 0x0048, 0x252a,
  16827. +    0x0078, 0x252c, 0x0078, 0x24bc, 0x24a8, 0x7aa8, 0x00f0, 0x252c,
  16828. +    0x0078, 0x2518, 0xa284, 0x00f0, 0xa086, 0x0020, 0x00c0, 0x258e,
  16829. +    0x8318, 0x8318, 0x2300, 0xa102, 0x0040, 0x2542, 0x0048, 0x2542,
  16830. +    0x0078, 0x258b, 0xa286, 0x0023, 0x0040, 0x250d, 0x681c, 0xa084,
  16831. +    0xfff1, 0x681e, 0x7e58, 0xa684, 0xfff1, 0xa085, 0x0010, 0x2030,
  16832. +    0x7e5a, 0x6008, 0xa085, 0x0010, 0x600a, 0x0c7e, 0x7048, 0x2060,
  16833. +    0x6004, 0x2008, 0x2c48, 0x0c7f, 0xa184, 0x0010, 0x0040, 0x2566,
  16834. +    0x1078, 0x2f95, 0x1078, 0x2de3, 0x0078, 0x2575, 0x0c7e, 0x7048,
  16835. +    0x2060, 0x6004, 0x2008, 0x2c48, 0x0c7f, 0xa184, 0x0008, 0x0040,
  16836. +    0x24fe, 0x1078, 0x2f95, 0x1078, 0x2cdf, 0x88ff, 0x0040, 0x24fe,
  16837. +    0x789b, 0x0060, 0x2800, 0x78aa, 0xa6b5, 0x0004, 0x7e5a, 0xa684,
  16838. +    0x0400, 0x00c0, 0x2587, 0x781b, 0x0053, 0x0078, 0x1e79, 0x781b,
  16839. +    0x0067, 0x0078, 0x1e79, 0x7aa8, 0x0078, 0x2518, 0x8318, 0x2300,
  16840. +    0xa102, 0x0040, 0x2597, 0x0048, 0x2597, 0x0078, 0x2518, 0xa284,
  16841. +    0x0080, 0x00c0, 0x2e75, 0x0078, 0x2e6f, 0x0078, 0x2e75, 0x0078,
  16842. +    0x2e69, 0x789b, 0x0018, 0x78a8, 0xa084, 0x00ff, 0xa08e, 0x0001,
  16843. +    0x0040, 0x25ac, 0x1078, 0x1e2a, 0x7aa8, 0xa294, 0x00ff, 0x78a8,
  16844. +    0xa084, 0x00ff, 0xa08a, 0x0004, 0x00c8, 0x2e69, 0x0079, 0x25b8,
  16845. +    0x2e69, 0x2c4f, 0x2e69, 0x2d7e, 0xa282, 0x0000, 0x00c0, 0x25c2,
  16846. +    0x1078, 0x1e2a, 0x1078, 0x2e7d, 0x781b, 0x0067, 0x0078, 0x1e79,
  16847. +    0xa282, 0x0003, 0x00c0, 0x25ce, 0x1078, 0x1e2a, 0xa484, 0x8000,
  16848. +    0x00c0, 0x25f1, 0x70a0, 0xa005, 0x0040, 0x25d8, 0x1078, 0x1e2a,
  16849. +    0x6f14, 0x77b6, 0xa7bc, 0x0f00, 0x1078, 0x2f99, 0x6008, 0xa085,
  16850. +    0x0021, 0x600a, 0x8738, 0xa784, 0x0007, 0x00c0, 0x25dc, 0x1078,
  16851. +    0x2e81, 0x70a3, 0x0002, 0x2009, 0x3831, 0x200b, 0x0009, 0x0078,
  16852. +    0x25f3, 0x1078, 0x2e8d, 0x781b, 0x0067, 0x0078, 0x1e79, 0xa282,
  16853. +    0x0004, 0x0050, 0x25fd, 0x1078, 0x1e2a, 0x2300, 0x0079, 0x2600,
  16854. +    0x2603, 0x26df, 0x2707, 0xa286, 0x0003, 0x0040, 0x2609, 0x1078,
  16855. +    0x1e2a, 0x2001, 0x0000, 0x703a, 0x7000, 0xa084, 0x0007, 0x0079,
  16856. +    0x2611, 0x2619, 0x261b, 0x261b, 0x27cf, 0x2800, 0x1e81, 0x2800,
  16857. +    0x2619, 0x1078, 0x1e2a, 0xa684, 0x1000, 0x00c0, 0x2623, 0x1078,
  16858. +    0x31f5, 0x0040, 0x26b9, 0x7868, 0xa08c, 0x00ff, 0x0040, 0x266b,
  16859. +    0xa186, 0x0008, 0x00c0, 0x263a, 0x1078, 0x2c0e, 0x6008, 0xa084,
  16860. +    0xffef, 0x600a, 0x1078, 0x2bc1, 0x0040, 0x266b, 0x1078, 0x31f5,
  16861. +    0x0078, 0x2652, 0xa186, 0x0028, 0x00c0, 0x266b, 0x1078, 0x31f5,
  16862. +    0x6008, 0xa084, 0xffef, 0x600a, 0x6018, 0xa005, 0x0040, 0x2652,
  16863. +    0x8001, 0x601a, 0xa005, 0x0040, 0x2652, 0x8001, 0xa005, 0x0040,
  16864. +    0x2652, 0x601e, 0x6820, 0xa084, 0x0001, 0x0040, 0x1e81, 0x6820,
  16865. +    0xa084, 0xfffe, 0x6822, 0x7054, 0x0c7e, 0x2060, 0x6800, 0x6002,
  16866. +    0x0c7f, 0x6004, 0x6802, 0xa005, 0x2d00, 0x00c0, 0x2668, 0x6002,
  16867. +    0x6006, 0x0078, 0x1e81, 0x017e, 0x1078, 0x272c, 0x017f, 0xa684,
  16868. +    0xdf00, 0x681e, 0x682b, 0x0000, 0x6f14, 0x81ff, 0x0040, 0x26b9,
  16869. +    0xa186, 0x0002, 0x00c0, 0x26b1, 0xa684, 0x0800, 0x00c0, 0x2688,
  16870. +    0xa684, 0x0060, 0x0040, 0x2688, 0x78d8, 0x7adc, 0x682e, 0x6a32,
  16871. +    0x6820, 0xa084, 0x0800, 0x00c0, 0x26b9, 0x8717, 0xa294, 0x000f,
  16872. +    0x8213, 0x8213, 0x8213, 0xa290, 0x3900, 0xa290, 0x0000, 0x221c,
  16873. +    0x8210, 0x2204, 0xa085, 0x0018, 0x2012, 0x8211, 0xa384, 0x0400,
  16874. +    0x0040, 0x26ab, 0x68a0, 0xa084, 0x0100, 0x00c0, 0x26ab, 0x1078,
  16875. +    0x278e, 0x0078, 0x1e81, 0x6008, 0xa085, 0x0002, 0x600a, 0x0078,
  16876. +    0x26b9, 0xa186, 0x0018, 0x0040, 0x26b9, 0xa186, 0x0014, 0x0040,
  16877. +    0x1e81, 0x6916, 0x6818, 0xa084, 0x8000, 0x0040, 0x26c1, 0x7038,
  16878. +    0x681a, 0xa68c, 0xdf00, 0x691e, 0x1078, 0x2bff, 0x1078, 0x2c0e,
  16879. +    0x00c0, 0x26ce, 0x6008, 0xa084, 0xffef, 0x600a, 0x6820, 0xa084,
  16880. +    0x0001, 0x00c0, 0x26d7, 0x1078, 0x2bf8, 0x0078, 0x26db, 0x7054,
  16881. +    0x2060, 0x6800, 0x6002, 0x1078, 0x19a4, 0x0078, 0x1e81, 0xa282,
  16882. +    0x0004, 0x0048, 0x26e5, 0x1078, 0x1e2a, 0x2200, 0x0079, 0x26e8,
  16883. +    0x26e3, 0x26ec, 0x26f2, 0x26ec, 0x1078, 0x2e7d, 0x781b, 0x0067,
  16884. +    0x0078, 0x1e79, 0x7890, 0x8007, 0x8001, 0xa084, 0x0007, 0xa080,
  16885. +    0x0018, 0x789a, 0x79a8, 0xa18c, 0x00ff, 0xa186, 0x0003, 0x0040,
  16886. +    0x2703, 0x0078, 0x2e69, 0x781b, 0x0068, 0x0078, 0x1e79, 0x6820,
  16887. +    0xa085, 0x0004, 0x6822, 0x82ff, 0x00c0, 0x2712, 0x1078, 0x2e7d,
  16888. +    0x0078, 0x2719, 0x8211, 0x0040, 0x2717, 0x1078, 0x1e2a, 0x1078,
  16889. +    0x2e8d, 0x781b, 0x0067, 0x0078, 0x1e79, 0x1078, 0x306a, 0x7830,
  16890. +    0xa084, 0x00c0, 0x00c0, 0x2729, 0x0018, 0x2729, 0x791a, 0xa006,
  16891. +    0x007c, 0xa085, 0x0001, 0x007c, 0xa684, 0x0060, 0x00c0, 0x2736,
  16892. +    0x682f, 0x0000, 0x6833, 0x0000, 0x0078, 0x278d, 0xa684, 0x0800,
  16893. +    0x00c0, 0x2746, 0x6998, 0x6a94, 0x692e, 0x6a32, 0x7000, 0xa086,
  16894. +    0x0006, 0x0040, 0x2745, 0x1078, 0x31f5, 0x007c, 0xa684, 0x0020,
  16895. +    0x0040, 0x2760, 0xa684, 0x4000, 0x0040, 0x2754, 0x682f, 0x0000,
  16896. +    0x6833, 0x0000, 0x0078, 0x273e, 0x7038, 0xa005, 0x00c0, 0x275a,
  16897. +    0x703b, 0x0015, 0x79d8, 0x7adc, 0x692e, 0x6a32, 0x0078, 0x273e,
  16898. +    0xa684, 0x4000, 0x0040, 0x276a, 0x682f, 0x0000, 0x6833, 0x0000,
  16899. +    0x0078, 0x273e, 0x7038, 0xa005, 0x00c0, 0x2770, 0x703b, 0x0015,
  16900. +    0x79d8, 0x7adc, 0x78d0, 0x80fb, 0x00c8, 0x2777, 0x8000, 0xa084,
  16901. +    0x003f, 0xa108, 0xa291, 0x0000, 0x692e, 0x6a32, 0x2100, 0xa205,
  16902. +    0x00c0, 0x2784, 0x0078, 0x273e, 0x7000, 0xa086, 0x0006, 0x0040,
  16903. +    0x278d, 0x1078, 0x353b, 0x0078, 0x273e, 0x007c, 0xa384, 0x0200,
  16904. +    0x0040, 0x2796, 0x6008, 0xa085, 0x0002, 0x600a, 0x681b, 0x0006,
  16905. +    0x6a30, 0x692c, 0x6a3e, 0x6942, 0x682f, 0x0003, 0x6833, 0x0000,
  16906. +    0x6837, 0x0020, 0x6897, 0x0000, 0x689b, 0x0020, 0x7000, 0x0079,
  16907. +    0x27a9, 0x27b1, 0x27b3, 0x27bc, 0x27b1, 0x27b1, 0x27b1, 0x27b1,
  16908. +    0x27b1, 0x1078, 0x1e2a, 0x6820, 0xa084, 0x0001, 0x00c0, 0x27bc,
  16909. +    0x1078, 0x2bf8, 0x0078, 0x27c2, 0x7054, 0x2c50, 0x2060, 0x6800,
  16910. +    0x6002, 0x2a60, 0x2021, 0x3857, 0x2404, 0xa005, 0x0040, 0x27cb,
  16911. +    0x2020, 0x0078, 0x27c4, 0x2d22, 0x206b, 0x0000, 0x007c, 0x1078,
  16912. +    0x2bff, 0x1078, 0x2c0e, 0x682b, 0x0000, 0x789b, 0x000e, 0x6f14,
  16913. +    0x6817, 0x0002, 0x1078, 0x3575, 0xa684, 0x0800, 0x0040, 0x27e4,
  16914. +    0x691c, 0xa18d, 0x2000, 0x691e, 0x6818, 0xa084, 0x8000, 0x0040,
  16915. +    0x27f4, 0x7868, 0xa08c, 0x00ff, 0x0040, 0x27f2, 0x681b, 0x001e,
  16916. +    0x0078, 0x27f4, 0x681b, 0x0000, 0x2021, 0x3857, 0x6800, 0x2022,
  16917. +    0x6a3c, 0x6940, 0x6a32, 0x692e, 0x1078, 0x19a4, 0x0078, 0x1e81,
  16918. +    0x1078, 0x272c, 0x682b, 0x0000, 0x789b, 0x000e, 0x6f14, 0x1078,
  16919. +    0x306f, 0xa08c, 0x00ff, 0x6916, 0x6818, 0xa084, 0x8000, 0x0040,
  16920. +    0x2813, 0x7038, 0x681a, 0xa68c, 0xdf00, 0x691e, 0x70a3, 0x0000,
  16921. +    0x0078, 0x1e81, 0xa006, 0x1078, 0x31f5, 0x6817, 0x0000, 0x681b,
  16922. +    0x0001, 0xa68c, 0xdf00, 0x691e, 0x682b, 0x0000, 0x7000, 0x0079,
  16923. +    0x2829, 0x2831, 0x2833, 0x2833, 0x2835, 0x2835, 0x2835, 0x2835,
  16924. +    0x2831, 0x1078, 0x1e2a, 0x1078, 0x2c0e, 0x6008, 0xa084, 0xffef,
  16925. +    0x600a, 0x0078, 0x2bd9, 0x2300, 0x0079, 0x283e, 0x2841, 0x2843,
  16926. +    0x287c, 0x1078, 0x1e2a, 0x7000, 0x0079, 0x2846, 0x284e, 0x2850,
  16927. +    0x2850, 0x286b, 0x2850, 0x2878, 0x286b, 0x284e, 0x1078, 0x1e2a,
  16928. +    0xa684, 0x0060, 0xa086, 0x0060, 0x00c0, 0x2867, 0xa6b4, 0xffdf,
  16929. +    0xa6b4, 0xbfff, 0xa6b5, 0x2000, 0x7e5a, 0x681c, 0xa084, 0xffdf,
  16930. +    0x681e, 0x1078, 0x31f5, 0x1078, 0x347d, 0x0078, 0x301c, 0xa684,
  16931. +    0x2000, 0x0040, 0x285a, 0x6818, 0xa084, 0x8000, 0x0040, 0x2878,
  16932. +    0x681b, 0x0015, 0xa684, 0x4000, 0x0040, 0x2878, 0x681b, 0x0007,
  16933. +    0x781b, 0x00df, 0x0078, 0x1e79, 0x1078, 0x1e2a, 0x2300, 0x0079,
  16934. +    0x2881, 0x2884, 0x2886, 0x28b9, 0x1078, 0x1e2a, 0x7000, 0x0079,
  16935. +    0x2889, 0x2891, 0x2893, 0x2893, 0x28ae, 0x2893, 0x28b5, 0x28ae,
  16936. +    0x2891, 0x1078, 0x1e2a, 0xa684, 0x0060, 0xa086, 0x0060, 0x00c0,
  16937. +    0x28aa, 0xa6b4, 0xffbf, 0xa6b4, 0xbfff, 0xa6b5, 0x2000, 0x7e5a,
  16938. +    0x681c, 0xa084, 0xffbf, 0x681e, 0x1078, 0x31f5, 0x1078, 0x347d,
  16939. +    0x0078, 0x301c, 0xa684, 0x2000, 0x0040, 0x289d, 0x6818, 0xa084,
  16940. +    0x8000, 0x0040, 0x28b5, 0x681b, 0x0007, 0x781b, 0x00e6, 0x0078,
  16941. +    0x1e79, 0x6820, 0xa085, 0x0004, 0x6822, 0x1078, 0x2fe7, 0xa6b5,
  16942. +    0x0800, 0x1078, 0x2e7d, 0x781b, 0x0067, 0x0078, 0x1e79, 0x2300,
  16943. +    0x0079, 0x28ca, 0x28cd, 0x28cf, 0x28d1, 0x1078, 0x1e2a, 0x1078,
  16944. +    0x1e2a, 0x782b, 0x3009, 0xa684, 0x0400, 0x00c0, 0x28eb, 0x789b,
  16945. +    0x0060, 0x78ab, 0x0000, 0xa684, 0xfffb, 0x785a, 0x79e4, 0xa184,
  16946. +    0x0020, 0x00c0, 0x28e7, 0x2001, 0x0014, 0x0078, 0x260b, 0xa184,
  16947. +    0x0007, 0x0079, 0x291b, 0x7a90, 0xa294, 0x0007, 0x789b, 0x0060,
  16948. +    0x79a8, 0x81ff, 0x0040, 0x2919, 0x789b, 0x0010, 0x7ba8, 0xa384,
  16949. +    0x0001, 0x00c0, 0x2912, 0x7ba8, 0x7ba8, 0xa386, 0x0001, 0x00c0,
  16950. +    0x2905, 0x2009, 0xfff7, 0x0078, 0x290b, 0xa386, 0x0003, 0x00c0,
  16951. +    0x2912, 0x2009, 0xffef, 0x0c7e, 0x7048, 0x2060, 0x6004, 0xa104,
  16952. +    0x6006, 0x0c7f, 0x789b, 0x0060, 0x78ab, 0x0000, 0xa684, 0xfffb,
  16953. +    0x785a, 0x0078, 0x301c, 0x22fd, 0x230a, 0x3024, 0x3024, 0x2923,
  16954. +    0x2923, 0x2923, 0x3024, 0x1078, 0x1e2a, 0x79e4, 0xa184, 0x0030,
  16955. +    0x00c0, 0x293b, 0x70a0, 0xa086, 0x0002, 0x00c0, 0x2933, 0x2011,
  16956. +    0x0002, 0x0078, 0x21fe, 0x6818, 0xa085, 0x8000, 0x681a, 0x2001,
  16957. +    0x0014, 0x0078, 0x260b, 0xa18c, 0x0007, 0xa186, 0x0002, 0x00c0,
  16958. +    0x3044, 0xa684, 0x0080, 0x0040, 0x2970, 0x71c8, 0x81ff, 0x0040,
  16959. +    0x2970, 0xa182, 0x000d, 0x00d0, 0x2951, 0x70cb, 0x0000, 0x0078,
  16960. +    0x2956, 0xa182, 0x000c, 0x70ca, 0x2009, 0x000c, 0x789b, 0x0061,
  16961. +    0x79aa, 0x157e, 0x137e, 0x147e, 0x70cc, 0x8114, 0xa210, 0x72ce,
  16962. +    0xa080, 0x000b, 0xad00, 0x2098, 0x20a1, 0x012b, 0x789b, 0x0000,
  16963. +    0x8108, 0x81ac, 0x53a6, 0x147f, 0x137f, 0x157f, 0x0078, 0x3024,
  16964. +    0xa684, 0x0400, 0x00c0, 0x29b1, 0x6820, 0xa084, 0x0001, 0x0040,
  16965. +    0x3024, 0xa68c, 0x0060, 0xa684, 0x0060, 0x0040, 0x2985, 0xa086,
  16966. +    0x0060, 0x00c0, 0x2985, 0xa18d, 0x4000, 0xa18c, 0xfffb, 0x795a,
  16967. +    0x69b6, 0x789b, 0x0060, 0x78ab, 0x0000, 0x789b, 0x0061, 0x6818,
  16968. +    0xa085, 0x8000, 0x681a, 0x78aa, 0x8008, 0x810c, 0x0040, 0x2c36,
  16969. +    0xa18c, 0x00f8, 0x00c0, 0x2c36, 0x157e, 0x137e, 0x147e, 0x20a1,
  16970. +    0x012b, 0x789b, 0x0000, 0x8000, 0x80ac, 0xad80, 0x000b, 0x2098,
  16971. +    0x53a6, 0x147f, 0x137f, 0x157f, 0x6814, 0x8007, 0x7882, 0x0078,
  16972. +    0x3024, 0x6818, 0xa084, 0x8000, 0x0040, 0x29b8, 0x681b, 0x0008,
  16973. +    0x781b, 0x00da, 0x0078, 0x1e79, 0x2300, 0x0079, 0x29bf, 0x29c4,
  16974. +    0x2a47, 0x29c2, 0x1078, 0x1e2a, 0x7000, 0xa084, 0x0007, 0x0079,
  16975. +    0x29c9, 0x29d1, 0x29d3, 0x29ef, 0x29d1, 0x29d1, 0x1e81, 0x29d1,
  16976. +    0x29d1, 0x1078, 0x1e2a, 0x6920, 0xa18d, 0x0001, 0x6922, 0x6800,
  16977. +    0x6006, 0xa005, 0x00c0, 0x29dd, 0x6002, 0x681c, 0xa084, 0x000e,
  16978. +    0x0040, 0x29e9, 0x7014, 0x68ba, 0x712c, 0xa188, 0x4180, 0x0078,
  16979. +    0x29eb, 0x2009, 0x4280, 0x2104, 0x6802, 0x2d0a, 0x7156, 0x6920,
  16980. +    0xa184, 0x8000, 0x00c0, 0x29fb, 0x68af, 0x0000, 0x68b3, 0x0000,
  16981. +    0xa18d, 0x8000, 0x6922, 0x6eb6, 0xa684, 0x0060, 0x0040, 0x2a45,
  16982. +    0xa684, 0x0800, 0x00c0, 0x2a0c, 0x6894, 0x68a6, 0x6898, 0x68aa,
  16983. +    0x1078, 0x31f5, 0x0078, 0x2a45, 0xa684, 0x0020, 0x0040, 0x2a19,
  16984. +    0xa006, 0x1078, 0x353b, 0x79d8, 0x7adc, 0x69aa, 0x6aa6, 0x0078,
  16985. +    0x2a1f, 0x1078, 0x2fa6, 0x69aa, 0x6aa6, 0x1078, 0x353b, 0xa684,
  16986. +    0x8000, 0x0040, 0x2a45, 0xa684, 0x7fff, 0x68b6, 0x789b, 0x0074,
  16987. +    0x1078, 0x306f, 0x2010, 0x1078, 0x306f, 0x2008, 0xa684, 0x0020,
  16988. +    0x00c0, 0x2a3d, 0x1078, 0x306f, 0x801b, 0x00c8, 0x2a38, 0x8000,
  16989. +    0xa084, 0x003f, 0xa108, 0xa291, 0x0000, 0x6b98, 0x2100, 0xa302,
  16990. +    0x68b2, 0x6b94, 0x2200, 0xa303, 0x68ae, 0x0078, 0x1e81, 0x0078,
  16991. +    0x2e75, 0x7033, 0x0000, 0xa282, 0x0006, 0x0050, 0x2a51, 0x1078,
  16992. +    0x1e2a, 0x2300, 0x0079, 0x2a54, 0x2a57, 0x2a7d, 0x2aa1, 0x2200,
  16993. +    0x0079, 0x2a5a, 0x2a60, 0x2e75, 0x2a62, 0x2a60, 0x2acb, 0x2b1c,
  16994. +    0x1078, 0x1e2a, 0x7003, 0x0005, 0x2001, 0x4290, 0x2068, 0x703e,
  16995. +    0x157e, 0x20a9, 0x002f, 0x2003, 0x0000, 0x8000, 0x0070, 0x2a72,
  16996. +    0x0078, 0x2a6b, 0x157f, 0x6817, 0x0000, 0x68b7, 0x0700, 0x6823,
  16997. +    0x0800, 0x6827, 0x0003, 0x0078, 0x2e69, 0x7000, 0xa086, 0x0001,
  16998. +    0x00c0, 0x2a8a, 0x1078, 0x2c0e, 0x1078, 0x31f5, 0x7034, 0x600a,
  16999. +    0x0078, 0x2a8f, 0x7000, 0xa086, 0x0003, 0x0040, 0x2a84, 0x7003,
  17000. +    0x0005, 0x2001, 0x4290, 0x2068, 0x703e, 0x7032, 0x2200, 0x0079,
  17001. +    0x2a99, 0x2e75, 0x2a9f, 0x2a9f, 0x2acb, 0x2a9f, 0x2e75, 0x1078,
  17002. +    0x1e2a, 0x7000, 0xa086, 0x0001, 0x00c0, 0x2aae, 0x1078, 0x2c0e,
  17003. +    0x1078, 0x31f5, 0x7034, 0x600a, 0x0078, 0x2ab3, 0x7000, 0xa086,
  17004. +    0x0003, 0x0040, 0x2aa8, 0x7003, 0x0005, 0x2001, 0x4290, 0x2068,
  17005. +    0x703e, 0x7032, 0x2200, 0x0079, 0x2abd, 0x2ac5, 0x2ac3, 0x2ac3,
  17006. +    0x2ac5, 0x2ac3, 0x2ac5, 0x1078, 0x1e2a, 0x1078, 0x2e8d, 0x781b,
  17007. +    0x0067, 0x0078, 0x1e79, 0x7000, 0xa086, 0x0001, 0x00c0, 0x2ad8,
  17008. +    0x1078, 0x2c0e, 0x1078, 0x31f5, 0x7034, 0x600a, 0x0078, 0x2add,
  17009. +    0x7000, 0xa086, 0x0003, 0x0040, 0x2ad2, 0x7003, 0x0002, 0x7a80,
  17010. +    0xa294, 0x0f00, 0x789b, 0x0018, 0x7ca8, 0xa484, 0x0007, 0xa215,
  17011. +    0x2069, 0x4280, 0x2d04, 0x2d08, 0x7156, 0x2068, 0xa005, 0x0040,
  17012. +    0x2af8, 0x6814, 0xa206, 0x0040, 0x2b11, 0x6800, 0x0078, 0x2aeb,
  17013. +    0x7003, 0x0005, 0x2001, 0x4290, 0x2068, 0x703e, 0x7032, 0x157e,
  17014. +    0x20a9, 0x002f, 0x2003, 0x0000, 0x8000, 0x0070, 0x2b09, 0x0078,
  17015. +    0x2b02, 0x157f, 0x6a16, 0x68b7, 0x0700, 0x6823, 0x0800, 0x6827,
  17016. +    0x0003, 0x6eb4, 0x7e5a, 0x6820, 0xa084, 0x0c00, 0x0040, 0x2b7a,
  17017. +    0x1078, 0x2e85, 0x0078, 0x2b7a, 0x7000, 0xa086, 0x0001, 0x00c0,
  17018. +    0x2b29, 0x1078, 0x2c0e, 0x1078, 0x31f5, 0x7034, 0x600a, 0x0078,
  17019. +    0x2b2e, 0x7000, 0xa086, 0x0003, 0x0040, 0x2b23, 0x7003, 0x0002,
  17020. +    0x7a80, 0xa294, 0x0f00, 0x789b, 0x0018, 0x7ca8, 0xa484, 0x0007,
  17021. +    0xa215, 0x79a8, 0x79a8, 0xa18c, 0x00ff, 0xa1e8, 0x4180, 0x2d04,
  17022. +    0x2d08, 0x7156, 0x2068, 0xa005, 0x0040, 0x2b4d, 0x6814, 0xa206,
  17023. +    0x0040, 0x2b65, 0x6800, 0x0078, 0x2b40, 0x7003, 0x0005, 0x2001,
  17024. +    0x4290, 0x2068, 0x703e, 0x157e, 0x20a9, 0x002f, 0x2003, 0x0000,
  17025. +    0x8000, 0x0070, 0x2b5d, 0x0078, 0x2b56, 0x157f, 0x6a16, 0x68b7,
  17026. +    0x0700, 0x6823, 0x0800, 0x6827, 0x0003, 0x6eb4, 0x7e5a, 0x6820,
  17027. +    0xa084, 0x0c00, 0x0040, 0x2b7a, 0xa084, 0x0800, 0x0040, 0x2b74,
  17028. +    0x1078, 0x2e89, 0x0078, 0x2b7a, 0x1078, 0x2e85, 0x70bf, 0x0000,
  17029. +    0x0078, 0x2b7a, 0x027e, 0x8207, 0xa084, 0x000f, 0x8003, 0x8003,
  17030. +    0x8003, 0xa080, 0x3900, 0x2060, 0x704a, 0x6000, 0x704e, 0x6004,
  17031. +    0x7052, 0xa684, 0x0060, 0x0040, 0x2b93, 0x68a8, 0x78d2, 0x78da,
  17032. +    0x68a4, 0x78d6, 0x78de, 0x077f, 0x1078, 0x2f99, 0x2009, 0x0068,
  17033. +    0xa684, 0x0008, 0x0040, 0x2b9e, 0x2009, 0x0067, 0xa6b5, 0x2000,
  17034. +    0x7e5a, 0x791a, 0xa684, 0x0060, 0x0040, 0x2bb4, 0xa684, 0x0800,
  17035. +    0x00c0, 0x2bae, 0x1078, 0x347d, 0x0078, 0x2bb4, 0xa684, 0x4000,
  17036. +    0x00c0, 0x2bb4, 0x1078, 0x340e, 0x2d00, 0x703e, 0x8207, 0xa084,
  17037. +    0x000f, 0x8003, 0x8003, 0x8003, 0xa080, 0x3900, 0x2048, 0x0078,
  17038. +    0x1e79, 0x6020, 0xa005, 0x0040, 0x2bcd, 0x8001, 0x6022, 0x6008,
  17039. +    0xa085, 0x0008, 0x600a, 0x7010, 0x6026, 0x007c, 0xa006, 0x1078,
  17040. +    0x31f5, 0x6817, 0x0000, 0x681b, 0x0001, 0x6823, 0x0040, 0x681f,
  17041. +    0x0100, 0x7000, 0xa084, 0x0007, 0x0079, 0x2bde, 0x2be6, 0x2be8,
  17042. +    0x2be8, 0x2bf4, 0x2bf0, 0x2be6, 0x2bf0, 0x2be6, 0x1078, 0x1e2a,
  17043. +    0x1078, 0x2bff, 0x1078, 0x2bf8, 0x1078, 0x19a4, 0x0078, 0x1e81,
  17044. +    0x70a3, 0x0000, 0x0078, 0x1e81, 0x681b, 0x0000, 0x0078, 0x27cf,
  17045. +    0x6800, 0xa005, 0x00c0, 0x2bfd, 0x6002, 0x6006, 0x007c, 0x6010,
  17046. +    0xa005, 0x0040, 0x2c08, 0x8001, 0x00d0, 0x2c08, 0x1078, 0x1e2a,
  17047. +    0x6012, 0x6008, 0xa084, 0xffef, 0x600a, 0x007c, 0x6018, 0xa005,
  17048. +    0x0040, 0x2c14, 0x8001, 0x601a, 0x007c, 0x1078, 0x306a, 0x6818,
  17049. +    0xa084, 0x8000, 0x0040, 0x2c1e, 0x681b, 0x0018, 0x0078, 0x2c43,
  17050. +    0x1078, 0x306a, 0x6818, 0xa084, 0x8000, 0x0040, 0x2c29, 0x681b,
  17051. +    0x0019, 0x0078, 0x2c43, 0x1078, 0x306a, 0x6818, 0xa084, 0x8000,
  17052. +    0x0040, 0x2c34, 0x681b, 0x001a, 0x0078, 0x2c43, 0x1078, 0x306a,
  17053. +    0x681b, 0x0003, 0x0078, 0x2c43, 0x6818, 0xa084, 0x8000, 0x0040,
  17054. +    0x2c43, 0x681b, 0x0005, 0x681f, 0x0000, 0x6823, 0x0020, 0x1078,
  17055. +    0x2bff, 0x1078, 0x2bf8, 0x1078, 0x19a4, 0x0078, 0x1e81, 0xa282,
  17056. +    0x0003, 0x00c0, 0x2e69, 0x7da8, 0xa5ac, 0x00ff, 0x7ea8, 0xa6b4,
  17057. +    0x00ff, 0x6920, 0xa18d, 0x0080, 0x6922, 0xa184, 0x0100, 0x0040,
  17058. +    0x2c92, 0xa18c, 0xfeff, 0x6922, 0xa6b4, 0x00ff, 0x0040, 0x2c7c,
  17059. +    0xa682, 0x000c, 0x0048, 0x2c70, 0x0040, 0x2c70, 0x2031, 0x000c,
  17060. +    0x852b, 0x852b, 0x1078, 0x2f18, 0x0040, 0x2c7a, 0x1078, 0x2d4a,
  17061. +    0x0078, 0x2c85, 0x1078, 0x2ed3, 0x0c7e, 0x2960, 0x6004, 0xa084,
  17062. +    0xfff5, 0x6006, 0x1078, 0x2d6e, 0x0c7f, 0x7e58, 0xa684, 0x0400,
  17063. +    0x00c0, 0x2c8e, 0x781b, 0x0056, 0x0078, 0x1e79, 0x781b, 0x0068,
  17064. +    0x0078, 0x1e79, 0x0c7e, 0x7048, 0x2060, 0x6100, 0xa18c, 0x1000,
  17065. +    0x0040, 0x2cd2, 0x6208, 0x8217, 0xa294, 0x00ff, 0xa282, 0x000c,
  17066. +    0x0048, 0x2ca6, 0x0040, 0x2ca6, 0x2011, 0x000c, 0x2600, 0xa202,
  17067. +    0x00c8, 0x2cab, 0x2230, 0x6208, 0xa294, 0x00ff, 0x7018, 0xa086,
  17068. +    0x0028, 0x00c0, 0x2cbb, 0xa282, 0x0019, 0x00c8, 0x2cc1, 0x2011,
  17069. +    0x0019, 0x0078, 0x2cc1, 0xa282, 0x000c, 0x00c8, 0x2cc1, 0x2011,
  17070. +    0x000c, 0x2200, 0xa502, 0x00c8, 0x2cc6, 0x2228, 0x1078, 0x2ed7,
  17071. +    0x852b, 0x852b, 0x1078, 0x2f18, 0x0040, 0x2cd2, 0x1078, 0x2d4a,
  17072. +    0x0078, 0x2cd6, 0x1078, 0x2ed3, 0x1078, 0x2d6e, 0x7858, 0xa085,
  17073. +    0x0004, 0x785a, 0x0c7f, 0x781b, 0x0067, 0x0078, 0x1e79, 0x0c7e,
  17074. +    0x2960, 0x6000, 0xa084, 0x1000, 0x00c0, 0x2cf7, 0x6010, 0xa084,
  17075. +    0x000f, 0x00c0, 0x2cf1, 0x6104, 0xa18c, 0xfff5, 0x6106, 0x0c7f,
  17076. +    0x007c, 0x2011, 0x0032, 0x2019, 0x0000, 0x0078, 0x2d1e, 0x68a0,
  17077. +    0xa084, 0x0200, 0x00c0, 0x2cf1, 0x6208, 0xa294, 0x00ff, 0x7018,
  17078. +    0xa086, 0x0028, 0x00c0, 0x2d0c, 0xa282, 0x0019, 0x00c8, 0x2d12,
  17079. +    0x2011, 0x0019, 0x0078, 0x2d12, 0xa282, 0x000c, 0x00c8, 0x2d12,
  17080. +    0x2011, 0x000c, 0x6308, 0x831f, 0xa39c, 0x00ff, 0xa382, 0x000c,
  17081. +    0x0048, 0x2d1e, 0x0040, 0x2d1e, 0x2019, 0x000c, 0x78ab, 0x0001,
  17082. +    0x78ab, 0x0003, 0x78ab, 0x0001, 0x7aaa, 0x7baa, 0xa8c0, 0x0005,
  17083. +    0x6820, 0xa085, 0x0100, 0x6822, 0x0c7f, 0x007c, 0x0c7e, 0x2960,
  17084. +    0x6104, 0xa18c, 0xfff5, 0x6106, 0x2011, 0x0032, 0x2019, 0x0000,
  17085. +    0x0078, 0x2d3a, 0x78ab, 0x0001, 0x78ab, 0x0003, 0x78ab, 0x0001,
  17086. +    0x7aaa, 0x7baa, 0xa8c0, 0x0005, 0x6820, 0xa085, 0x0100, 0x6822,
  17087. +    0x0c7f, 0x007c, 0x0c7e, 0x7148, 0x2160, 0x2008, 0xa084, 0xfff0,
  17088. +    0xa635, 0x7e86, 0x6018, 0x789a, 0x7eae, 0x6612, 0x78a4, 0xa084,
  17089. +    0xfff8, 0xa18c, 0x0007, 0xa105, 0x78a6, 0x6016, 0x788a, 0xa6b4,
  17090. +    0x000f, 0x8637, 0x8204, 0x8004, 0xa084, 0x00ff, 0xa605, 0x600e,
  17091. +    0x6004, 0xa084, 0xfff5, 0x6006, 0x0c7f, 0x007c, 0x0c7e, 0x7048,
  17092. +    0x2060, 0x6018, 0x789a, 0x78a4, 0xa084, 0xfff0, 0x78a6, 0x6012,
  17093. +    0x7884, 0xa084, 0xfff0, 0x7886, 0x0c7f, 0x007c, 0xa282, 0x0002,
  17094. +    0x00c0, 0x2e69, 0x7aa8, 0x6920, 0xa18d, 0x0080, 0x6922, 0xa184,
  17095. +    0x0200, 0x0040, 0x2dc3, 0xa18c, 0xfdff, 0x6922, 0xa294, 0x00ff,
  17096. +    0xa282, 0x0002, 0x00c8, 0x2e69, 0x1078, 0x2e0a, 0x1078, 0x2d6e,
  17097. +    0xa980, 0x0001, 0x200c, 0x1078, 0x2f95, 0x1078, 0x2cdf, 0x88ff,
  17098. +    0x0040, 0x2db6, 0x789b, 0x0060, 0x2800, 0x78aa, 0x7e58, 0xa6b5,
  17099. +    0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x2db2, 0x781b, 0x0053,
  17100. +    0x0078, 0x1e79, 0x781b, 0x0067, 0x0078, 0x1e79, 0x7e58, 0xa684,
  17101. +    0x0400, 0x00c0, 0x2dbf, 0x781b, 0x0056, 0x0078, 0x1e79, 0x781b,
  17102. +    0x0068, 0x0078, 0x1e79, 0xa282, 0x0002, 0x00c8, 0x2dcb, 0xa284,
  17103. +    0x0001, 0x0040, 0x2dd5, 0x7148, 0xa188, 0x0000, 0x210c, 0xa18c,
  17104. +    0x2000, 0x00c0, 0x2dd5, 0x2011, 0x0000, 0x1078, 0x2ec5, 0x1078,
  17105. +    0x2e0a, 0x1078, 0x2d6e, 0x7858, 0xa085, 0x0004, 0x785a, 0x781b,
  17106. +    0x0067, 0x0078, 0x1e79, 0x0c7e, 0x027e, 0x2960, 0x6000, 0x2011,
  17107. +    0x0001, 0xa084, 0x2000, 0x00c0, 0x2dfa, 0x6014, 0xa084, 0x0040,
  17108. +    0x00c0, 0x2df8, 0xa18c, 0xffef, 0x6106, 0xa006, 0x0078, 0x2e07,
  17109. +    0x2011, 0x0000, 0x78ab, 0x0001, 0x78ab, 0x0002, 0x78ab, 0x0003,
  17110. +    0x7aaa, 0xa8c0, 0x0004, 0x6820, 0xa085, 0x0200, 0x6822, 0x027f,
  17111. +    0x0c7f, 0x007c, 0x0c7e, 0x7048, 0x2060, 0x82ff, 0x0040, 0x2e12,
  17112. +    0x2011, 0x0040, 0x6018, 0xa080, 0x0002, 0x789a, 0x78a4, 0xa084,
  17113. +    0xffbf, 0xa205, 0x78a6, 0x6016, 0x788a, 0x6004, 0xa084, 0xffef,
  17114. +    0x6006, 0x0c7f, 0x007c, 0xa684, 0x0020, 0x0040, 0x2e65, 0x7888,
  17115. +    0xa084, 0x0040, 0x0040, 0x2e65, 0x7bb8, 0xa384, 0x003f, 0x831b,
  17116. +    0x00c8, 0x2e33, 0x8000, 0xa005, 0x0040, 0x2e4c, 0x831b, 0x00c8,
  17117. +    0x2e3c, 0x8001, 0x0040, 0x2e61, 0xa684, 0x4000, 0x0040, 0x2e4c,
  17118. +    0x78b8, 0x801b, 0x00c8, 0x2e45, 0x8000, 0xa084, 0x003f, 0x00c0,
  17119. +    0x2e61, 0xa6b4, 0xbfff, 0x7e5a, 0x79d8, 0x7adc, 0x2001, 0x0001,
  17120. +    0xa108, 0x00c8, 0x2e55, 0xa291, 0x0000, 0x79d2, 0x79da, 0x7ad6,
  17121. +    0x7ade, 0x1078, 0x353b, 0x781b, 0x0065, 0x1078, 0x340e, 0x0078,
  17122. +    0x1e79, 0x781b, 0x0065, 0x0078, 0x1e79, 0x781b, 0x0068, 0x0078,
  17123. +    0x1e79, 0x1078, 0x2e91, 0x781b, 0x0067, 0x0078, 0x1e79, 0x1078,
  17124. +    0x2e7d, 0x781b, 0x0067, 0x0078, 0x1e79, 0x6827, 0x0002, 0x1078,
  17125. +    0x2e85, 0x781b, 0x0067, 0x0078, 0x1e79, 0x2001, 0x0005, 0x0078,
  17126. +    0x2e93, 0x2001, 0x000c, 0x0078, 0x2e93, 0x2001, 0x0006, 0x0078,
  17127. +    0x2e93, 0x2001, 0x000d, 0x0078, 0x2e93, 0x2001, 0x0009, 0x0078,
  17128. +    0x2e93, 0x2001, 0x0007, 0x789b, 0x007e, 0x78aa, 0xa6b5, 0x0008,
  17129. +    0x7e5a, 0x007c, 0x077e, 0x873f, 0xa7bc, 0x000f, 0x873b, 0x873b,
  17130. +    0x8703, 0xa0e0, 0x3900, 0xa7b8, 0x0020, 0x7f9a, 0x79a4, 0xa184,
  17131. +    0x000f, 0x0040, 0x2eb3, 0xa184, 0xfff0, 0x78a6, 0x6012, 0x6004,
  17132. +    0xa085, 0x0008, 0x6006, 0x8738, 0x8738, 0x7f9a, 0x79a4, 0xa184,
  17133. +    0x0040, 0x0040, 0x2ec3, 0xa184, 0xffbf, 0x78a6, 0x6016, 0x6004,
  17134. +    0xa085, 0x0010, 0x6006, 0x077f, 0x007c, 0x789b, 0x0010, 0x78ab,
  17135. +    0x0001, 0x78ab, 0x0002, 0x78ab, 0x0003, 0x7aaa, 0x789b, 0x0060,
  17136. +    0x78ab, 0x0004, 0x007c, 0x2031, 0x0000, 0x2029, 0x0032, 0x789b,
  17137. +    0x0010, 0x78ab, 0x0001, 0x78ab, 0x0003, 0x78ab, 0x0001, 0x7daa,
  17138. +    0x7eaa, 0x789b, 0x0060, 0x78ab, 0x0005, 0x007c, 0x157e, 0x8007,
  17139. +    0xa084, 0x00ff, 0x8003, 0x8003, 0xa080, 0x0020, 0x789a, 0x79a4,
  17140. +    0xa18c, 0xfff0, 0x2001, 0x3846, 0x2004, 0xa082, 0x0028, 0x0040,
  17141. +    0x2f01, 0x2021, 0x2f7c, 0x2019, 0x0014, 0x20a9, 0x000c, 0x0078,
  17142. +    0x2f07, 0x2021, 0x2f88, 0x2019, 0x0019, 0x20a9, 0x000d, 0x2011,
  17143. +    0x0064, 0x2404, 0xa084, 0xfff0, 0xa106, 0x0040, 0x2f16, 0x8420,
  17144. +    0x2300, 0xa210, 0x0070, 0x2f16, 0x0078, 0x2f09, 0x157f, 0x007c,
  17145. +    0x157e, 0x2011, 0x3846, 0x2214, 0xa282, 0x0032, 0x0048, 0x2f2c,
  17146. +    0x0040, 0x2f30, 0x2021, 0x2f6e, 0x2019, 0x0011, 0x20a9, 0x000e,
  17147. +    0x2011, 0x0032, 0x0078, 0x2f42, 0xa282, 0x0028, 0x0040, 0x2f3a,
  17148. +    0x2021, 0x2f7c, 0x2019, 0x0014, 0x20a9, 0x000c, 0x2011, 0x0064,
  17149. +    0x0078, 0x2f42, 0x2021, 0x2f88, 0x2019, 0x0019, 0x20a9, 0x000d,
  17150. +    0x2011, 0x0064, 0x2200, 0xa502, 0x0040, 0x2f52, 0x0048, 0x2f52,
  17151. +    0x8420, 0x2300, 0xa210, 0x0070, 0x2f4f, 0x0078, 0x2f42, 0x157f,
  17152. +    0xa006, 0x007c, 0x157f, 0x7a08, 0xa582, 0x00c8, 0x00c8, 0x2f5d,
  17153. +    0xa285, 0x0040, 0x780a, 0x0078, 0x2f5d, 0x78ec, 0xa084, 0x0300,
  17154. +    0x0040, 0x2f6b, 0x2404, 0xa09e, 0x2002, 0x00c0, 0x2f6b, 0x2001,
  17155. +    0x2101, 0x0078, 0x2f6c, 0x2404, 0xa005, 0x007c, 0x2002, 0x3002,
  17156. +    0x3202, 0x4203, 0x4403, 0x5404, 0x5604, 0x6605, 0x6805, 0x7806,
  17157. +    0x7a06, 0x0a07, 0x0c07, 0x0e07, 0x3202, 0x4202, 0x5202, 0x6202,
  17158. +    0x7202, 0x6605, 0x7605, 0x7805, 0x7a05, 0x7c05, 0x7e05, 0x7f05,
  17159. +    0x2202, 0x3202, 0x4202, 0x5202, 0x5404, 0x6404, 0x7404, 0x7604,
  17160. +    0x7804, 0x7a04, 0x7c04, 0x7e04, 0x7f04, 0x789b, 0x0010, 0xa046,
  17161. +    0x007c, 0xa784, 0x0f00, 0x800c, 0xa784, 0x0007, 0x8003, 0x8003,
  17162. +    0x8003, 0x8003, 0xa105, 0xa0e0, 0x3980, 0x007c, 0x79d8, 0x7adc,
  17163. +    0x78d0, 0x801b, 0x00c8, 0x2fad, 0x8000, 0xa084, 0x003f, 0xa108,
  17164. +    0xa291, 0x0000, 0x007c, 0x0f7e, 0x2079, 0x0100, 0x2009, 0x3840,
  17165. +    0x2091, 0x8000, 0x2104, 0x0079, 0x2fbd, 0x2fe3, 0x2fc7, 0x2fc7,
  17166. +    0x2fc7, 0x2fc7, 0x2fc7, 0x2fc7, 0x2fc5, 0x1078, 0x1e2a, 0x784b,
  17167. +    0x0004, 0x68b4, 0xa085, 0x4000, 0x68b6, 0x7858, 0xa085, 0x4000,
  17168. +    0x785a, 0x7830, 0xa084, 0x0080, 0x00c0, 0x2fe3, 0x0018, 0x2fe3,
  17169. +    0x681c, 0xa084, 0x0020, 0x00c0, 0x2fe1, 0x781b, 0x00df, 0x0078,
  17170. +    0x2fe3, 0x781b, 0x00e6, 0x2091, 0x8001, 0x0f7f, 0x007c, 0x0c7e,
  17171. +    0x6814, 0x8007, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0e0,
  17172. +    0x3900, 0x6004, 0xa084, 0x000a, 0x00c0, 0x301a, 0x6108, 0xa194,
  17173. +    0xff00, 0x0040, 0x301a, 0xa18c, 0x00ff, 0x2001, 0x0019, 0xa106,
  17174. +    0x0040, 0x3009, 0x2001, 0x0032, 0xa106, 0x0040, 0x300d, 0x0078,
  17175. +    0x3011, 0x2009, 0x0020, 0x0078, 0x3013, 0x2009, 0x003f, 0x0078,
  17176. +    0x3013, 0x2011, 0x0000, 0x2100, 0xa205, 0x600a, 0x6004, 0xa085,
  17177. +    0x0002, 0x6006, 0x0c7f, 0x007c, 0x781b, 0x0068, 0x0078, 0x1e79,
  17178. +    0x781b, 0x0067, 0x0078, 0x1e79, 0x781b, 0x0056, 0x0078, 0x1e79,
  17179. +    0x781b, 0x0053, 0x0078, 0x1e79, 0x781b, 0x00df, 0x0078, 0x1e79,
  17180. +    0x781b, 0x00de, 0x0078, 0x1e79, 0x781b, 0x00e6, 0x0078, 0x1e79,
  17181. +    0x781b, 0x00e5, 0x0078, 0x1e79, 0x781b, 0x009d, 0x0078, 0x1e79,
  17182. +    0x781b, 0x009c, 0x0078, 0x1e79, 0x6818, 0xa084, 0x8000, 0x0040,
  17183. +    0x304b, 0x681b, 0x001d, 0x70a3, 0x0001, 0x781b, 0x0047, 0x0078,
  17184. +    0x1e79, 0x007e, 0x7830, 0xa084, 0x00c0, 0x00c0, 0x3068, 0x7808,
  17185. +    0xa084, 0xfffd, 0x780a, 0x0005, 0x0005, 0x0005, 0x0005, 0x78ec,
  17186. +    0xa084, 0x0021, 0x0040, 0x3068, 0x7808, 0xa085, 0x0002, 0x780a,
  17187. +    0x007f, 0x007c, 0x7808, 0xa085, 0x0002, 0x780a, 0x007c, 0x7830,
  17188. +    0xa084, 0x0040, 0x00c0, 0x306f, 0x0098, 0x3078, 0x78ac, 0x007c,
  17189. +    0x7808, 0xa084, 0xfffd, 0x780a, 0x0005, 0x0005, 0x0005, 0x0005,
  17190. +    0x78ec, 0xa084, 0x0021, 0x0040, 0x3087, 0x0098, 0x3085, 0x78ac,
  17191. +    0x007e, 0x7808, 0xa085, 0x0002, 0x780a, 0x007f, 0x007c, 0xa784,
  17192. +    0x0070, 0x0040, 0x309b, 0x0c7e, 0x2d60, 0x2f68, 0x1078, 0x1dd5,
  17193. +    0x2d78, 0x2c68, 0x0c7f, 0xa784, 0x0008, 0x0040, 0x30a8, 0x784b,
  17194. +    0x0008, 0x78ec, 0xa084, 0x0003, 0x0040, 0x1e81, 0x0078, 0x301c,
  17195. +    0xa784, 0x0004, 0x0040, 0x30db, 0x78b8, 0xa084, 0x4001, 0x0040,
  17196. +    0x30db, 0x784b, 0x0008, 0x78ec, 0xa084, 0x0003, 0x0040, 0x1e81,
  17197. +    0x78e4, 0xa084, 0x0007, 0xa086, 0x0001, 0x00c0, 0x30db, 0x78c0,
  17198. +    0xa685, 0x4800, 0x2030, 0x7e5a, 0x781b, 0x00e6, 0x0078, 0x1e79,
  17199. +    0x784b, 0x0008, 0x6818, 0xa084, 0x8000, 0x0040, 0x30d7, 0x681b,
  17200. +    0x0015, 0xa684, 0x4000, 0x0040, 0x30d7, 0x681b, 0x0007, 0x781b,
  17201. +    0x00df, 0x0078, 0x1e79, 0x681b, 0x0003, 0x7858, 0xa084, 0x3f00,
  17202. +    0x681e, 0x682f, 0x0000, 0x6833, 0x0000, 0x784b, 0x0008, 0x78e4,
  17203. +    0xa005, 0x00d0, 0x22ec, 0xa084, 0x0020, 0x0040, 0x22ec, 0x0018,
  17204. +    0x22ec, 0x0078, 0x2e6f, 0x6b14, 0x8307, 0xa084, 0x000f, 0x8003,
  17205. +    0x8003, 0x8003, 0xa080, 0x3900, 0x2060, 0x2048, 0x704a, 0x6000,
  17206. +    0x704e, 0x6004, 0x7052, 0x2a60, 0x007c, 0x0020, 0x0020, 0x0000,
  17207. +    0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000,
  17208. +    0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000,
  17209. +    0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000,
  17210. +    0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0062,
  17211. +    0x0009, 0x0014, 0x0014, 0x9848, 0x0014, 0x0014, 0x98f9, 0x98e9,
  17212. +    0x0014, 0x0014, 0x0080, 0x00c0, 0x0100, 0x0402, 0x2008, 0xf880,
  17213. +    0x0018, 0xa20a, 0x0014, 0x300b, 0xa20c, 0x0014, 0xa200, 0x8838,
  17214. +    0x3806, 0x8839, 0x28c2, 0x9cc2, 0xa805, 0x0864, 0xa83d, 0x3008,
  17215. +    0x28c1, 0x9cc2, 0xa201, 0x300c, 0x2847, 0x8161, 0x846a, 0x8000,
  17216. +    0x84a4, 0x1856, 0x883a, 0xa808, 0x28e2, 0x9c9f, 0xa8f3, 0x0864,
  17217. +    0xa82b, 0x300c, 0xa801, 0x3008, 0x28e1, 0x9c9f, 0x280d, 0xa204,
  17218. +    0x64c0, 0x67a0, 0x6fc0, 0x1814, 0x883b, 0x7023, 0x8576, 0x8677,
  17219. +    0xa80f, 0x786e, 0x883e, 0xa80c, 0x282b, 0xa205, 0x64a0, 0x67a0,
  17220. +    0x6fc0, 0x1814, 0x883b, 0x7023, 0x8576, 0x8677, 0xa801, 0x883e,
  17221. +    0x206b, 0x28c1, 0x9cc2, 0x2044, 0x2103, 0x20a2, 0x2081, 0xa8dc,
  17222. +    0xa207, 0x2901, 0xa80a, 0x0014, 0xa203, 0x8000, 0x85a4, 0x1872,
  17223. +    0x879a, 0x883c, 0x1fe2, 0xf601, 0xa208, 0x856e, 0x866f, 0x0704,
  17224. +    0x3008, 0x9c9f, 0x0014, 0xa202, 0x8000, 0x85a4, 0x3009, 0x84a8,
  17225. +    0x19e2, 0xf848, 0x8174, 0x86eb, 0x85eb, 0x872e, 0x87a9, 0x883f,
  17226. +    0x08e6, 0xa8f1, 0xf861, 0xa8e8, 0xf801, 0x0014, 0xf881, 0x0016,
  17227. +    0x85b2, 0x80f0, 0x9532, 0xfaa2, 0x1de2, 0x0014, 0x8532, 0xf221,
  17228. +    0x0014, 0x1de2, 0x84a8, 0xd6e0, 0x1fe6, 0x0014, 0xa206, 0x6865,
  17229. +    0x817e, 0x842a, 0x1dc1, 0x8823, 0x0016, 0x6042, 0x8008, 0xa8fa,
  17230. +    0x8000, 0x84a4, 0x8160, 0x842a, 0xf021, 0x3008, 0x84a8, 0x11d6,
  17231. +    0x7042, 0x20dd, 0x0011, 0x20d4, 0x8822, 0x0016, 0x8000, 0x2848,
  17232. +    0x1011, 0xa8fc, 0x3008, 0x8000, 0xa000, 0x2802, 0x1011, 0xa8fd,
  17233. +    0xa883, 0x3008, 0x283d, 0x1011, 0xa8fd, 0xa209, 0x0017, 0x300c,
  17234. +    0x8000, 0x85a4, 0x1de2, 0xdac1, 0x0014, 0xd301, 0x0014, 0x26e0,
  17235. +    0x873a, 0xfaa2, 0x19f2, 0x1fe2, 0x0014, 0xa20b, 0x0014, 0xa20d,
  17236. +    0x3806, 0x0210, 0x9ccc, 0x0704, 0x0000, 0x127e, 0x2091, 0x2200,
  17237. +    0x2049, 0x31f5, 0x7000, 0x7204, 0xa205, 0x720c, 0xa215, 0x7008,
  17238. +    0xa084, 0xfff7, 0xa205, 0x0040, 0x3207, 0x1078, 0x3280, 0x127f,
  17239. +    0x2000, 0x007c, 0x6428, 0x84ff, 0x0040, 0x3236, 0x2c70, 0x7004,
  17240. +    0xa0bc, 0x000f, 0xa7b8, 0x3246, 0x273c, 0x87fb, 0x00c0, 0x3224,
  17241. +    0x0048, 0x321c, 0x1078, 0x1e2a, 0x609c, 0xa075, 0x0040, 0x3236,
  17242. +    0x0078, 0x320f, 0x2039, 0x323b, 0x2704, 0xae68, 0x6808, 0xa630,
  17243. +    0x680c, 0xa529, 0x8421, 0x0040, 0x3236, 0x8738, 0x2704, 0xa005,
  17244. +    0x00c0, 0x3225, 0x709c, 0xa075, 0x00c0, 0x320f, 0x007c, 0x0000,
  17245. +    0x0005, 0x0009, 0x000d, 0x0011, 0x0015, 0x0019, 0x001d, 0x0000,
  17246. +    0x0003, 0x0009, 0x000f, 0x0015, 0x001b, 0x0000, 0x0000, 0x323b,
  17247. +    0x3238, 0x0000, 0x0000, 0x8000, 0x0000, 0x323b, 0x0000, 0x3243,
  17248. +    0x3240, 0x0000, 0x0000, 0x0000, 0x0000, 0x3243, 0x0000, 0x323e,
  17249. +    0x323e, 0x0000, 0x0000, 0x8000, 0x0000, 0x323e, 0x0000, 0x3244,
  17250. +    0x3244, 0x0000, 0x0000, 0x0000, 0x0000, 0x3244, 0x127e, 0x2091,
  17251. +    0x2200, 0x2079, 0x3800, 0x2071, 0x0010, 0x7007, 0x000a, 0x7007,
  17252. +    0x0002, 0x7003, 0x0000, 0x2071, 0x0020, 0x7007, 0x000a, 0x7007,
  17253. +    0x0002, 0x7003, 0x0000, 0x2049, 0x0000, 0x127f, 0x2000, 0x007c,
  17254. +    0x2049, 0x3280, 0x2019, 0x0000, 0x7004, 0x8004, 0x00c8, 0x32b2,
  17255. +    0x7007, 0x0012, 0x7108, 0x7008, 0xa106, 0x00c0, 0x328a, 0xa184,
  17256. +    0x01e0, 0x0040, 0x3295, 0x1078, 0x1e2a, 0xa184, 0x4000, 0x00c0,
  17257. +    0x328a, 0xa19c, 0x300c, 0xa386, 0x2004, 0x0040, 0x32a7, 0xa386,
  17258. +    0x0008, 0x0040, 0x32b2, 0xa386, 0x200c, 0x00c0, 0x328a, 0x7200,
  17259. +    0x8204, 0x0048, 0x32b2, 0x730c, 0xa384, 0x00ff, 0x0040, 0x32b2,
  17260. +    0x1078, 0x1e2a, 0x7007, 0x0012, 0x7007, 0x0008, 0x7004, 0xa084,
  17261. +    0x0008, 0x00c0, 0x32b6, 0x7007, 0x0012, 0x7108, 0x8103, 0x0048,
  17262. +    0x32bb, 0x7003, 0x0000, 0x2049, 0x0000, 0x007c, 0x107e, 0x007e,
  17263. +    0x127e, 0x157e, 0x2091, 0x2200, 0x7108, 0x1078, 0x32d6, 0x157f,
  17264. +    0x127f, 0x2091, 0x8001, 0x007f, 0x107f, 0x007c, 0x7204, 0x7500,
  17265. +    0x730c, 0xa384, 0x0300, 0x00c0, 0x3315, 0xa184, 0x0060, 0x00c0,
  17266. +    0x334e, 0x7008, 0x7108, 0xa106, 0x00c0, 0x32e1, 0xa184, 0x01e0,
  17267. +    0x00c0, 0x334e, 0xa184, 0x4000, 0x00c0, 0x32e1, 0xa986, 0x353b,
  17268. +    0x00c0, 0x3309, 0xa19c, 0x300c, 0xa386, 0x2004, 0x0040, 0x3300,
  17269. +    0xa386, 0x0008, 0x0040, 0x3309, 0xa386, 0x200c, 0x00c0, 0x32e1,
  17270. +    0x7200, 0x8204, 0x0048, 0x3309, 0x730c, 0xa384, 0x00ff, 0x00c0,
  17271. +    0x3315, 0xa184, 0x0007, 0x0079, 0x330d, 0x3317, 0x3342, 0x3315,
  17272. +    0x3342, 0x3315, 0x339b, 0x3315, 0x3399, 0x1078, 0x1e2a, 0x7007,
  17273. +    0x0002, 0x8aff, 0x00c0, 0x3320, 0x2049, 0x0000, 0x0078, 0x3324,
  17274. +    0x1078, 0x3512, 0x00c0, 0x3320, 0x2704, 0xac00, 0xa088, 0x0002,
  17275. +    0x2104, 0x8108, 0x6892, 0x2104, 0x688e, 0x8a07, 0x077e, 0x007e,
  17276. +    0x6004, 0xa084, 0x0008, 0x0040, 0x3339, 0xa7ba, 0x3240, 0x0078,
  17277. +    0x333b, 0xa7ba, 0x3238, 0x007f, 0xa73d, 0x2c00, 0x6886, 0x6f8a,
  17278. +    0x077f, 0x007c, 0x7007, 0x0002, 0x8aff, 0x00c0, 0x3349, 0x0078,
  17279. +    0x334d, 0x1078, 0x3512, 0x00c0, 0x3349, 0x007c, 0x7108, 0x7008,
  17280. +    0xa106, 0x00c0, 0x334e, 0xa184, 0x4000, 0x00c0, 0x334e, 0x7007,
  17281. +    0x0012, 0x7108, 0x7008, 0xa106, 0x00c0, 0x3359, 0xa184, 0x4000,
  17282. +    0x00c0, 0x3359, 0x00e0, 0x3362, 0x2091, 0x6000, 0x00e0, 0x3366,
  17283. +    0x2091, 0x6000, 0x7007, 0x0012, 0x7007, 0x0008, 0x7004, 0xa084,
  17284. +    0x0008, 0x00c0, 0x336e, 0x7007, 0x0012, 0x7108, 0x8103, 0x0048,
  17285. +    0x3373, 0x7003, 0x0000, 0x7000, 0xa005, 0x00c0, 0x3387, 0x7004,
  17286. +    0xa005, 0x00c0, 0x3387, 0x700c, 0xa005, 0x0040, 0x3389, 0x0078,
  17287. +    0x336a, 0x2049, 0x0000, 0x1078, 0x2fb3, 0x6818, 0xa084, 0x8000,
  17288. +    0x0040, 0x3394, 0x681b, 0x0002, 0x007c, 0x1078, 0x1e2a, 0x1078,
  17289. +    0x1e2a, 0x1078, 0x33f9, 0x7210, 0x7114, 0x700c, 0xa09c, 0x00ff,
  17290. +    0x2800, 0xa300, 0xa211, 0xa189, 0x0000, 0x1078, 0x33f9, 0x2704,
  17291. +    0x2c58, 0xac60, 0x6308, 0x2200, 0xa322, 0x630c, 0x2100, 0xa31b,
  17292. +    0x2400, 0xa305, 0x0040, 0x33be, 0x00c8, 0x33be, 0x8412, 0x8210,
  17293. +    0x830a, 0xa189, 0x0000, 0x2b60, 0x0078, 0x33a5, 0x2b60, 0x8a07,
  17294. +    0x007e, 0x6004, 0xa084, 0x0008, 0x0040, 0x33ca, 0xa7ba, 0x3240,
  17295. +    0x0078, 0x33cc, 0xa7ba, 0x3238, 0x007f, 0xa73d, 0x2c00, 0x6886,
  17296. +    0x6f8a, 0x6c92, 0x6b8e, 0x1078, 0x3280, 0x007c, 0x8738, 0x2704,
  17297. +    0xa005, 0x00c0, 0x33e9, 0x609c, 0xa005, 0x0040, 0x33f6, 0x2060,
  17298. +    0x6004, 0xa084, 0x000f, 0xa080, 0x3246, 0x203c, 0x87fb, 0x1040,
  17299. +    0x1e2a, 0x8a51, 0x0040, 0x33f5, 0x7008, 0x7508, 0xa52e, 0x00c0,
  17300. +    0x33ec, 0xa084, 0x0003, 0xa086, 0x0003, 0x007c, 0x2051, 0x0000,
  17301. +    0x007c, 0x8a50, 0x8739, 0x2704, 0xa004, 0x00c0, 0x340d, 0x6000,
  17302. +    0xa064, 0x00c0, 0x3404, 0x2d60, 0x6004, 0xa084, 0x000f, 0xa080,
  17303. +    0x3256, 0x203c, 0x87fb, 0x1040, 0x1e2a, 0x007c, 0x127e, 0x0d7e,
  17304. +    0x2091, 0x2200, 0x0d7f, 0x6884, 0x2060, 0x6888, 0x6b8c, 0x6c90,
  17305. +    0x8057, 0xaad4, 0x00ff, 0xa084, 0x00ff, 0x007e, 0x6804, 0xa084,
  17306. +    0x0008, 0x007f, 0x0040, 0x3428, 0xa0b8, 0x3240, 0x0078, 0x342a,
  17307. +    0xa0b8, 0x3238, 0x7e08, 0xa6b5, 0x000c, 0x681c, 0xa084, 0x0040,
  17308. +    0x0040, 0x3434, 0xa6b5, 0x0001, 0x7007, 0x0004, 0x7004, 0xa084,
  17309. +    0x0004, 0x00c0, 0x3436, 0x2400, 0xa305, 0x00c0, 0x3441, 0x0078,
  17310. +    0x3465, 0x2c58, 0x2704, 0x6104, 0xac60, 0x6000, 0xa400, 0x701a,
  17311. +    0x6004, 0xa301, 0x701e, 0xa184, 0x0008, 0x0040, 0x3455, 0x6010,
  17312. +    0xa001, 0x7022, 0x6014, 0xa001, 0x7026, 0x6208, 0x2400, 0xa202,
  17313. +    0x7012, 0x620c, 0x2300, 0xa203, 0x7016, 0x7602, 0x7007, 0x0001,
  17314. +    0x2b60, 0x1078, 0x33d6, 0x0078, 0x3467, 0x1078, 0x3512, 0x00c0,
  17315. +    0x3465, 0x127f, 0x2000, 0x007c, 0x127e, 0x0d7e, 0x2091, 0x2200,
  17316. +    0x0d7f, 0x7007, 0x0004, 0x7004, 0xa084, 0x0004, 0x00c0, 0x3473,
  17317. +    0x7003, 0x0008, 0x127f, 0x2000, 0x007c, 0x127e, 0x0d7e, 0x2091,
  17318. +    0x2200, 0x0d7f, 0x2049, 0x347d, 0x7007, 0x0004, 0x7004, 0xa084,
  17319. +    0x0004, 0x00c0, 0x3486, 0x7e08, 0xa6b5, 0x000c, 0x681c, 0xa084,
  17320. +    0x0020, 0x00c0, 0x3495, 0xa6b5, 0x0001, 0x6828, 0x2050, 0x2d60,
  17321. +    0x6004, 0xa0bc, 0x000f, 0xa7b8, 0x3246, 0x273c, 0x87fb, 0x00c0,
  17322. +    0x34ab, 0x0048, 0x34a5, 0x1078, 0x1e2a, 0x689c, 0xa065, 0x0040,
  17323. +    0x34af, 0x0078, 0x3498, 0x1078, 0x3512, 0x00c0, 0x34ab, 0x127f,
  17324. +    0x2000, 0x007c, 0x127e, 0x007e, 0x017e, 0x0d7e, 0x2091, 0x2200,
  17325. +    0x0d7f, 0x037f, 0x047f, 0x7e08, 0xa6b5, 0x000c, 0x681c, 0xa084,
  17326. +    0x0040, 0x0040, 0x34c5, 0xa6b5, 0x0001, 0x2049, 0x34b2, 0x6828,
  17327. +    0xa055, 0x0040, 0x350f, 0x2d70, 0x2e60, 0x7004, 0xa0bc, 0x000f,
  17328. +    0xa7b8, 0x3246, 0x273c, 0x87fb, 0x00c0, 0x34e1, 0x0048, 0x34da,
  17329. +    0x1078, 0x1e2a, 0x709c, 0xa075, 0x2060, 0x0040, 0x350f, 0x0078,
  17330. +    0x34cd, 0x2704, 0xae68, 0x6808, 0xa422, 0x680c, 0xa31b, 0x0048,
  17331. +    0x34fc, 0x8a51, 0x00c0, 0x34ee, 0x1078, 0x1e2a, 0x8738, 0x2704,
  17332. +    0xa005, 0x00c0, 0x34e2, 0x709c, 0xa075, 0x2060, 0x0040, 0x350f,
  17333. +    0x2039, 0x3238, 0x0078, 0x34cd, 0x8422, 0x8420, 0x831a, 0xa399,
  17334. +    0x0000, 0x6908, 0x2400, 0xa122, 0x690c, 0x2300, 0xa11b, 0x00c8,
  17335. +    0x350b, 0x1078, 0x1e2a, 0x2071, 0x0020, 0x0078, 0x3434, 0x127f,
  17336. +    0x2000, 0x007c, 0x7008, 0x7508, 0xa52e, 0x00c0, 0x3512, 0xa084,
  17337. +    0x0003, 0xa086, 0x0003, 0x0040, 0x353a, 0x2704, 0xac08, 0x2104,
  17338. +    0x701a, 0x8108, 0x2104, 0x701e, 0x8108, 0x2104, 0x7012, 0x8108,
  17339. +    0x2104, 0x7016, 0x6004, 0xa084, 0x0008, 0x0040, 0x3535, 0x8108,
  17340. +    0x2104, 0x7022, 0x8108, 0x2104, 0x7026, 0x7602, 0x7007, 0x0001,
  17341. +    0x1078, 0x33d6, 0x007c, 0x127e, 0x007e, 0x0d7e, 0x2091, 0x2200,
  17342. +    0x2049, 0x353b, 0x0d7f, 0x087f, 0x7108, 0x7008, 0xa106, 0x00c0,
  17343. +    0x3544, 0xa184, 0x4000, 0x00c0, 0x3544, 0xa184, 0x0003, 0x00c0,
  17344. +    0x355b, 0x6828, 0xa005, 0x0040, 0x3569, 0x0020, 0x355b, 0x1078,
  17345. +    0x339b, 0x0078, 0x3569, 0x00a0, 0x3562, 0x7108, 0x1078, 0x32d6,
  17346. +    0x0078, 0x3544, 0x7007, 0x0010, 0x00a0, 0x3564, 0x7108, 0x1078,
  17347. +    0x32d6, 0x7008, 0xa086, 0x0008, 0x00c0, 0x3544, 0x7003, 0x0000,
  17348. +    0x2049, 0x0000, 0x127f, 0x2000, 0x007c, 0x127e, 0x147e, 0x137e,
  17349. +    0x157e, 0x0d7e, 0x2091, 0x2200, 0x0d7f, 0x2049, 0x3575, 0xad80,
  17350. +    0x0011, 0x20a0, 0x2099, 0x0031, 0x700c, 0xa084, 0x00ff, 0x682a,
  17351. +    0x7007, 0x0008, 0x7007, 0x0002, 0x7003, 0x0001, 0x0040, 0x3593,
  17352. +    0x8000, 0x80ac, 0x53a5, 0x7007, 0x0004, 0x7004, 0xa084, 0x0004,
  17353. +    0x00c0, 0x3595, 0x2049, 0x0000, 0x7003, 0x0000, 0x157f, 0x137f,
  17354. +    0x147f, 0x127f, 0x2000, 0x007c, 0x2091, 0x6000, 0x78b0, 0xa005,
  17355. +    0x0040, 0x35b9, 0x797c, 0x70d0, 0xa106, 0x00c0, 0x35b9, 0x7804,
  17356. +    0xa005, 0x0040, 0x35b9, 0x7807, 0x0000, 0x0068, 0x35b9, 0x2091,
  17357. +    0x4080, 0x7820, 0x8001, 0x7822, 0x00c0, 0x3619, 0x7824, 0x7822,
  17358. +    0x2091, 0x8000, 0x78e0, 0xa005, 0x0040, 0x35e6, 0x78c4, 0xa005,
  17359. +    0x00c0, 0x35e6, 0x3a10, 0xa284, 0x0002, 0x00c0, 0x35d6, 0x78c7,
  17360. +    0x0007, 0x2009, 0xff01, 0x200a, 0x0078, 0x35e6, 0xa284, 0x0001,
  17361. +    0x00c0, 0x35de, 0x78df, 0x0000, 0x0078, 0x35e6, 0x78dc, 0xa005,
  17362. +    0x00c0, 0x35e6, 0x78c7, 0x0008, 0x78df, 0x0001, 0x2069, 0x3840,
  17363. +    0x6800, 0xa084, 0x0007, 0x0040, 0x35fd, 0xa086, 0x0002, 0x0040,
  17364. +    0x35fd, 0x6830, 0xa00d, 0x0040, 0x35fd, 0x2104, 0xa005, 0x0040,
  17365. +    0x35fd, 0x8001, 0x200a, 0x0040, 0x36bb, 0x7848, 0xa005, 0x0040,
  17366. +    0x3619, 0x8001, 0x784a, 0x00c0, 0x3619, 0x0f7e, 0x2079, 0x0100,
  17367. +    0x1078, 0x306a, 0x0f7f, 0x1078, 0x1c74, 0x68c4, 0xa005, 0x0040,
  17368. +    0x3619, 0x8001, 0x68c6, 0x00c0, 0x3619, 0x68a3, 0x0000, 0x68a7,
  17369. +    0x0001, 0x1078, 0x3620, 0x1078, 0x3645, 0x2091, 0x8001, 0x007c,
  17370. +    0x7834, 0x8001, 0x7836, 0x00c0, 0x3644, 0x7838, 0x7836, 0x2091,
  17371. +    0x8000, 0x7844, 0xa005, 0x00c0, 0x362f, 0x2001, 0x0101, 0x8001,
  17372. +    0x7846, 0xa080, 0x4180, 0x2040, 0x2004, 0xa065, 0x0040, 0x3644,
  17373. +    0x6024, 0xa005, 0x0040, 0x3640, 0x8001, 0x6026, 0x0040, 0x3674,
  17374. +    0x6000, 0x2c40, 0x0078, 0x3635, 0x007c, 0x7828, 0x8001, 0x782a,
  17375. +    0x00c0, 0x3673, 0x782c, 0x782a, 0x7830, 0xa005, 0x00c0, 0x3652,
  17376. +    0x2001, 0x0080, 0x8001, 0x7832, 0x8003, 0x8003, 0x8003, 0x8003,
  17377. +    0xa090, 0x3980, 0xa298, 0x0002, 0x2304, 0xa084, 0x0008, 0x0040,
  17378. +    0x3673, 0xa290, 0x0009, 0x2204, 0xa005, 0x0040, 0x366b, 0x8001,
  17379. +    0x2012, 0x00c0, 0x3673, 0x2304, 0xa084, 0xfff7, 0xa085, 0x0080,
  17380. +    0x201a, 0x1078, 0x1c74, 0x007c, 0x2069, 0x3840, 0x6800, 0xa005,
  17381. +    0x0040, 0x367e, 0x683c, 0xac06, 0x0040, 0x36bb, 0x601b, 0x0006,
  17382. +    0x60b4, 0xa084, 0x3f00, 0x601e, 0x6020, 0xa084, 0x00ff, 0xa085,
  17383. +    0x0060, 0x6022, 0x6000, 0x2042, 0x6714, 0x6fb6, 0x1078, 0x183c,
  17384. +    0x6818, 0xa005, 0x0040, 0x3696, 0x8001, 0x681a, 0x6808, 0xa084,
  17385. +    0xffef, 0x680a, 0x6810, 0x8001, 0x00d0, 0x36a0, 0x1078, 0x1e2a,
  17386. +    0x6812, 0x602f, 0x0000, 0x6033, 0x0000, 0x2c68, 0x1078, 0x19a4,
  17387. +    0x2069, 0x3840, 0x2001, 0x0006, 0x68a2, 0x7944, 0xa184, 0x0100,
  17388. +    0x00c0, 0x36b6, 0x69ba, 0x2001, 0x0004, 0x68a2, 0x1078, 0x1c6f,
  17389. +    0x2091, 0x8001, 0x007c, 0x2009, 0x384f, 0x2164, 0x2069, 0x0100,
  17390. +    0x1078, 0x1dd5, 0x601b, 0x0006, 0x6858, 0xa084, 0x3f00, 0x601e,
  17391. +    0x6020, 0xa084, 0x00ff, 0xa085, 0x0048, 0x6022, 0x602f, 0x0000,
  17392. +    0x6033, 0x0000, 0x6830, 0xa084, 0x0040, 0x0040, 0x36f7, 0x684b,
  17393. +    0x0004, 0x20a9, 0x0014, 0x6848, 0xa084, 0x0004, 0x0040, 0x36e4,
  17394. +    0x0070, 0x36e4, 0x0078, 0x36db, 0x684b, 0x0009, 0x20a9, 0x0014,
  17395. +    0x6848, 0xa084, 0x0001, 0x0040, 0x36f1, 0x0070, 0x36f1, 0x0078,
  17396. +    0x36e8, 0x20a9, 0x00fa, 0x0070, 0x36f7, 0x0078, 0x36f3, 0x6808,
  17397. +    0xa084, 0xfffd, 0x680a, 0x681b, 0x0047, 0x2009, 0x3868, 0x200b,
  17398. +    0x0007, 0x784c, 0x784a, 0x2091, 0x8001, 0x007c, 0x2079, 0x3800,
  17399. +    0x1078, 0x3731, 0x1078, 0x3715, 0x1078, 0x3723, 0x7833, 0x0000,
  17400. +    0x7847, 0x0000, 0x784b, 0x0000, 0x007c, 0x2019, 0x000c, 0x2011,
  17401. +    0x3846, 0x2204, 0xa086, 0x003c, 0x0040, 0x3720, 0x2019, 0x0008,
  17402. +    0x7b2a, 0x7b2e, 0x007c, 0x2019, 0x0039, 0x2011, 0x3846, 0x2204,
  17403. +    0xa086, 0x003c, 0x0040, 0x372e, 0x2019, 0x0027, 0x7b36, 0x7b3a,
  17404. +    0x007c, 0x2019, 0x3971, 0x2011, 0x3846, 0x2204, 0xa086, 0x003c,
  17405. +    0x0040, 0x373c, 0x2019, 0x2626, 0x7b22, 0x7b26, 0x783f, 0x0000,
  17406. +    0x7843, 0x000a, 0x007c, 0xe0c5
  17407. +};
  17408. +
  17409. +#endif /* RELOAD_FIRMWARE */
  17410. +
  17411. +unsigned short risc_code_length01 = 0x2744;
  17412. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h
  17413. --- pre2.0.5/linux/drivers/scsi/scsi.h    Sun May  5 08:52:02 1996
  17414. +++ linux/drivers/scsi/scsi.h    Sat May 18 22:19:04 1996
  17415. @@ -521,7 +521,7 @@
  17416.      if (req->bh){
  17417.      req->buffer = bh->b_data;
  17418.      return SCpnt;
  17419. -    };
  17420. +    }
  17421.      DEVICE_OFF(req->rq_dev);
  17422.      if (req->sem != NULL) {
  17423.      up(req->sem);
  17424. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/scsi_ioctl.c linux/drivers/scsi/scsi_ioctl.c
  17425. --- pre2.0.5/linux/drivers/scsi/scsi_ioctl.c    Sun May  5 08:52:02 1996
  17426. +++ linux/drivers/scsi/scsi_ioctl.c    Sat May 18 22:19:09 1996
  17427. @@ -298,7 +298,7 @@
  17428.  
  17429.  /*
  17430.   * the scsi_ioctl() function differs from most ioctls in that it does
  17431. - * not take a major/minor number as the dev filed.  Rather, it takes
  17432. + * not take a major/minor number as the dev field.  Rather, it takes
  17433.   * a pointer to a scsi_devices[] element, a structure. 
  17434.   */
  17435.  int scsi_ioctl (Scsi_Device *dev, int cmd, void *arg)
  17436. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c
  17437. --- pre2.0.5/linux/drivers/scsi/sd.c    Tue May  7 16:22:34 1996
  17438. +++ linux/drivers/scsi/sd.c    Sat May 18 22:19:14 1996
  17439. @@ -106,28 +106,23 @@
  17440.       */
  17441.      
  17442.      while (rscsi_disks[target].device->busy)
  17443. -    barrier();   
  17444. +        barrier();   
  17445.      if(rscsi_disks[target].device->removable) {
  17446.      check_disk_change(inode->i_rdev);
  17447.      
  17448.      /*
  17449.       * If the drive is empty, just let the open fail.
  17450.       */
  17451. -    if ( !rscsi_disks[target].ready ) {
  17452. +    if ( !rscsi_disks[target].ready )
  17453.          return -ENXIO;
  17454. -    }
  17455.  
  17456.      /*
  17457.       * Similarly, if the device has the write protect tab set,
  17458.       * have the open fail if the user expects to be able to write
  17459.       * to the thing.
  17460.       */
  17461. -    if ( (rscsi_disks[target].write_prot) && (filp->f_mode & 2) ) { 
  17462. +    if ( (rscsi_disks[target].write_prot) && (filp->f_mode & 2) )
  17463.          return -EROFS;
  17464. -    }
  17465. -
  17466. -    if(!rscsi_disks[target].device->access_count)
  17467. -        sd_ioctl(inode, NULL, SCSI_IOCTL_DOORLOCK, 0);
  17468.      }
  17469.  
  17470.      /*
  17471. @@ -137,6 +132,10 @@
  17472.      if(sd_sizes[MINOR(inode->i_rdev)] == 0)
  17473.      return -ENXIO;
  17474.      
  17475. +    if(rscsi_disks[target].device->removable)
  17476. +    if(!rscsi_disks[target].device->access_count)
  17477. +        sd_ioctl(inode, NULL, SCSI_IOCTL_DOORLOCK, 0);
  17478. +
  17479.      rscsi_disks[target].device->access_count++;
  17480.      if (rscsi_disks[target].device->host->hostt->usage_count)
  17481.      (*rscsi_disks[target].device->host->hostt->usage_count)++;
  17482. @@ -208,9 +207,9 @@
  17483.  }
  17484.  
  17485.  /*
  17486. - * rw_intr is the interrupt routine for the device driver.  It will
  17487. - * be notified on the end of a SCSI read / write, and
  17488. - * will take on of several actions based on success or failure.
  17489. + * rw_intr is the interrupt routine for the device driver.
  17490. + * It will be notified on the end of a SCSI read / write, and
  17491. + * will take one of several actions based on success or failure.
  17492.   */
  17493.  
  17494.  static void rw_intr (Scsi_Cmnd *SCpnt)
  17495. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
  17496. --- pre2.0.5/linux/drivers/scsi/sr_ioctl.c    Sun May  5 08:52:02 1996
  17497. +++ linux/drivers/scsi/sr_ioctl.c    Sat May 18 22:19:19 1996
  17498. @@ -554,21 +554,30 @@
  17499.      return (0);
  17500.      }
  17501.      
  17502. +    case BLKRAGET:
  17503. +    if (!arg)
  17504. +        return -EINVAL;
  17505. +    err = verify_area(VERIFY_WRITE, (int *) arg, sizeof(int));
  17506. +    if (err)
  17507. +        return err;
  17508. +    put_user(read_ahead[MAJOR(inode->i_rdev)], (int *) arg);
  17509. +    return 0;
  17510. +
  17511.      case BLKRASET:
  17512. -    {
  17513. -    if(!suser())  return -EACCES;
  17514. -    if(!(inode->i_rdev)) return -EINVAL;
  17515. -    if(arg > 0xff) return -EINVAL;
  17516. +    if(!suser())
  17517. +            return -EACCES;
  17518. +    if(!(inode->i_rdev))
  17519. +            return -EINVAL;
  17520. +    if(arg > 0xff)
  17521. +            return -EINVAL;
  17522.      read_ahead[MAJOR(inode->i_rdev)] = arg;
  17523.      return 0;
  17524. -    RO_IOCTLS(dev,arg);
  17525. -    }
  17526. +
  17527. +    RO_IOCTLS(dev,arg);
  17528.  
  17529.      case CDROMRESET:
  17530. -    {
  17531. -    invalidate_buffers(MKDEV(MAJOR(inode->i_rdev),MINOR(inode->i_rdev)));
  17532. +    invalidate_buffers(inode->i_rdev);
  17533.      return 0;
  17534. -    }
  17535.  
  17536.      default:
  17537.      return scsi_ioctl(scsi_CDs[target].device,cmd,(void *) arg);
  17538. diff -u --recursive --new-file pre2.0.5/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
  17539. --- pre2.0.5/linux/drivers/scsi/st.c    Sun May  5 08:52:02 1996
  17540. +++ linux/drivers/scsi/st.c    Sat May 18 13:25:09 1996
  17541. @@ -11,7 +11,7 @@
  17542.    Copyright 1992 - 1996 Kai Makisara
  17543.           email Kai.Makisara@metla.fi
  17544.  
  17545. -  Last modified: Thu May  2 19:41:34 1996 by makisara@kai.makisara.fi
  17546. +  Last modified: Tue May 14 17:58:12 1996 by makisara@kai.makisara.fi
  17547.    Some small formal changes - aeb, 950809
  17548.  */
  17549.  
  17550. @@ -530,8 +530,6 @@
  17551.      printk(ST_DEB_MSG "st%d: Mode change from %d to %d.\n",
  17552.             dev, STp->current_mode, mode);
  17553.  #endif
  17554. -      /*      if (!STp->modes[mode].defined)
  17555. -    return (-ENXIO); */
  17556.        new_session = TRUE;
  17557.        STp->current_mode = mode;
  17558.      }
  17559. @@ -570,12 +568,20 @@
  17560.      STp->nbr_waits = STp->nbr_finished = 0;
  17561.  #endif
  17562.  
  17563. +    if (scsi_tapes[dev].device->host->hostt->usage_count)
  17564. +    (*scsi_tapes[dev].device->host->hostt->usage_count)++;
  17565. +    if(st_template.usage_count) (*st_template.usage_count)++;
  17566. +
  17567.      memset ((void *) &cmd[0], 0, 10);
  17568.      cmd[0] = TEST_UNIT_READY;
  17569.  
  17570.      SCpnt = st_do_scsi(NULL, STp, cmd, 0, ST_LONG_TIMEOUT, MAX_READY_RETRIES);
  17571. -    if (!SCpnt)
  17572. +    if (!SCpnt) {
  17573. +      if (scsi_tapes[dev].device->host->hostt->usage_count)
  17574. +      (*scsi_tapes[dev].device->host->hostt->usage_count)--;
  17575. +      if(st_template.usage_count) (*st_template.usage_count)--;
  17576.        return (-EBUSY);
  17577. +    }
  17578.  
  17579.      if ((SCpnt->sense_buffer[0] & 0x70) == 0x70 &&
  17580.      (SCpnt->sense_buffer[2] & 0x0f) == UNIT_ATTENTION) { /* New media? */
  17581. @@ -619,9 +625,6 @@
  17582.        STp->partition = STp->new_partition = 0;
  17583.        STp->door_locked = ST_UNLOCKED;
  17584.        STp->in_use = 1;
  17585. -      if (scsi_tapes[dev].device->host->hostt->usage_count)
  17586. -    (*scsi_tapes[dev].device->host->hostt->usage_count)++;
  17587. -      if(st_template.usage_count) (*st_template.usage_count)++;
  17588.        return 0;
  17589.      }
  17590.  
  17591. @@ -698,6 +701,9 @@
  17592.             STp->block_size);
  17593.      (STp->buffer)->in_use = 0;
  17594.      STp->buffer = NULL;
  17595. +    if (scsi_tapes[dev].device->host->hostt->usage_count)
  17596. +        (*scsi_tapes[dev].device->host->hostt->usage_count)--;
  17597. +    if(st_template.usage_count) (*st_template.usage_count)--;
  17598.      return (-EIO);
  17599.        }
  17600.        STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0;
  17601. @@ -726,6 +732,9 @@
  17602.        if ((flags & O_ACCMODE) == O_WRONLY || (flags & O_ACCMODE) == O_RDWR) {
  17603.      (STp->buffer)->in_use = 0;
  17604.      STp->buffer = NULL;
  17605. +    if (scsi_tapes[dev].device->host->hostt->usage_count)
  17606. +        (*scsi_tapes[dev].device->host->hostt->usage_count)--;
  17607. +    if(st_template.usage_count) (*st_template.usage_count)--;
  17608.      return (-EROFS);
  17609.        }
  17610.      }
  17611. @@ -741,6 +750,9 @@
  17612.        if ((STp->partition = find_partition(inode)) < 0) {
  17613.      (STp->buffer)->in_use = 0;
  17614.      STp->buffer = NULL;
  17615. +    if (scsi_tapes[dev].device->host->hostt->usage_count)
  17616. +        (*scsi_tapes[dev].device->host->hostt->usage_count)--;
  17617. +    if(st_template.usage_count) (*st_template.usage_count)--;
  17618.      return STp->partition;
  17619.        }
  17620.        STp->new_partition = STp->partition;
  17621. @@ -754,6 +766,9 @@
  17622.        (i = set_mode_densblk(inode, STp, STm)) < 0) {
  17623.      (STp->buffer)->in_use = 0;
  17624.      STp->buffer = NULL;
  17625. +    if (scsi_tapes[dev].device->host->hostt->usage_count)
  17626. +        (*scsi_tapes[dev].device->host->hostt->usage_count)--;
  17627. +    if(st_template.usage_count) (*st_template.usage_count)--;
  17628.      return i;
  17629.        }
  17630.        if (STp->default_drvbuffer != 0xff) {
  17631. @@ -764,9 +779,6 @@
  17632.      }
  17633.  
  17634.      STp->in_use = 1;
  17635. -    if (scsi_tapes[dev].device->host->hostt->usage_count)
  17636. -      (*scsi_tapes[dev].device->host->hostt->usage_count)++;
  17637. -    if(st_template.usage_count) (*st_template.usage_count)++;
  17638.  
  17639.      return 0;
  17640.  }
  17641. @@ -3050,5 +3062,6 @@
  17642.      }
  17643.    }
  17644.    st_template.dev_max = 0;
  17645. +  printk(KERN_INFO "st: Unloaded.\n");
  17646.  }
  17647.  #endif /* MODULE */
  17648. diff -u --recursive --new-file pre2.0.5/linux/fs/Config.in linux/fs/Config.in
  17649. --- pre2.0.5/linux/fs/Config.in    Fri May 17 15:32:17 1996
  17650. +++ linux/fs/Config.in    Sun May 19 15:22:19 1996
  17651. @@ -35,11 +35,10 @@
  17652.  tristate 'ISO9660 cdrom filesystem support' CONFIG_ISO9660_FS
  17653.  tristate 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS
  17654.  tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS
  17655. -# AFFS disabled until they can get that BYTE/WORD/LONG crap sorted out
  17656. -#tristate 'Amiga FFS filesystem support (EXPERIMENTAL)' CONFIG_AFFS_FS
  17657. -#if [ "$CONFIG_AFFS_FS" = "y" -o "$CONFIG_AFFS_FS" = "m" ]; then
  17658. -#  define_bool CONFIG_AMIGA_PARTITION y
  17659. -#fi
  17660. +tristate 'Amiga FFS filesystem support (EXPERIMENTAL)' CONFIG_AFFS_FS
  17661. +if [ "$CONFIG_AFFS_FS" = "y" -o "$CONFIG_AFFS_FS" = "m" ]; then
  17662. +  define_bool CONFIG_AMIGA_PARTITION y
  17663. +fi
  17664.  tristate 'UFS filesystem support (read only)' CONFIG_UFS_FS
  17665.  if [ "$CONFIG_UFS_FS" != "n" ]; then
  17666.    bool "BSD disklabel (FreeBSD partition tables) support" CONFIG_BSD_DISKLABEL
  17667. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/amigaffs.c linux/fs/affs/amigaffs.c
  17668. --- pre2.0.5/linux/fs/affs/amigaffs.c    Fri May 17 15:32:17 1996
  17669. +++ linux/fs/affs/amigaffs.c    Sun May 19 15:22:19 1996
  17670. @@ -1,7 +1,7 @@
  17671.  /*
  17672.   *  linux/fs/affs/amigaffs.c
  17673.   *
  17674. - *  (c) 1996  Hans-Joachim Widmaier - rewritten
  17675. + *  (c) 1996  Hans-Joachim Widmaier - Rewritten
  17676.   *
  17677.   *  (C) 1993  Ray Burr - Amiga FFS filesystem.
  17678.   *
  17679. @@ -29,10 +29,10 @@
  17680.     is returned. */
  17681.  
  17682.  int
  17683. -affs_find_next_hash_entry(int hsize, void *dir_data, ULONG *hash_pos)
  17684. +affs_find_next_hash_entry(int hsize, void *dir_data, int *hash_pos)
  17685.  {
  17686.      struct dir_front *dir_front = dir_data;
  17687. -    ULONG i;
  17688. +    int i;
  17689.  
  17690.      for (i = *hash_pos; i < hsize; i++)
  17691.          if (dir_front->hashtable[i] != 0)
  17692. @@ -67,11 +67,11 @@
  17693.  /* Find the predecessor in the hash chain */
  17694.  
  17695.  int
  17696. -affs_fix_hash_pred(struct inode *startino, int startoffset, LONG key, LONG newkey)
  17697. +affs_fix_hash_pred(struct inode *startino, int startoffset, int key, int newkey)
  17698.  {
  17699.      struct buffer_head    *bh = NULL;
  17700. -    ULONG             nextkey;
  17701. -    LONG             ptype, stype;
  17702. +    int             nextkey;
  17703. +    int             ptype, stype;
  17704.      int             retval;
  17705.  
  17706.      nextkey = startino->i_ino;
  17707. @@ -92,9 +92,9 @@
  17708.              affs_brelse(bh);
  17709.              break;
  17710.          }
  17711. -        nextkey = htonl(((ULONG *)bh->b_data)[startoffset]);
  17712. +        nextkey = htonl(((__u32 *)bh->b_data)[startoffset]);
  17713.          if (nextkey == key) {
  17714. -            ((ULONG *)bh->b_data)[startoffset] = newkey;
  17715. +            ((__u32 *)bh->b_data)[startoffset] = newkey;
  17716.              affs_fix_checksum(AFFS_I2BSIZE(startino),bh->b_data,5);
  17717.              mark_buffer_dirty(bh,1);
  17718.              affs_brelse(bh);
  17719. @@ -112,13 +112,13 @@
  17720.  /* Remove inode from link chain */
  17721.  
  17722.  int
  17723. -affs_fix_link_pred(struct inode *startino, LONG key, LONG newkey)
  17724. +affs_fix_link_pred(struct inode *startino, int key, int newkey)
  17725.  {
  17726.      struct buffer_head    *bh = NULL;
  17727. -    ULONG             nextkey;
  17728. -    ULONG             offset;
  17729. -    LONG             etype = 0;
  17730. -    LONG             ptype, stype;
  17731. +    int             nextkey;
  17732. +    int             offset;
  17733. +    int             etype = 0;
  17734. +    int             ptype, stype;
  17735.      int             retval;
  17736.  
  17737.      offset  = AFFS_I2BSIZE(startino) / 4 - 10;
  17738. @@ -150,7 +150,7 @@
  17739.              retval = -EPERM;
  17740.              break;
  17741.          }
  17742. -        nextkey = htonl(((ULONG *)bh->b_data)[offset]);
  17743. +        nextkey = htonl(((__u32 *)bh->b_data)[offset]);
  17744.          if (nextkey == key) {
  17745.              FILE_END(bh->b_data,startino)->link_chain = newkey;
  17746.              affs_fix_checksum(AFFS_I2BSIZE(startino),bh->b_data,5);
  17747. @@ -172,17 +172,17 @@
  17748.     (which lets us calculate the block size).
  17749.     Returns non-zero if the block is not consistent. */
  17750.  
  17751. -ULONG
  17752. -affs_checksum_block(int bsize, void *data, LONG *ptype, LONG *stype)
  17753. +__u32
  17754. +affs_checksum_block(int bsize, void *data, int *ptype, int *stype)
  17755.  {
  17756. -    ULONG sum;
  17757. -    ULONG *p;
  17758. +    __u32     sum;
  17759. +    __u32    *p;
  17760.  
  17761.      bsize /= 4;
  17762.      if (ptype)
  17763. -        *ptype = htonl(((LONG *)data)[0]);
  17764. +        *ptype = htonl(((__s32 *)data)[0]);
  17765.      if (stype)
  17766. -        *stype = htonl(((LONG *)data)[bsize - 1]);
  17767. +        *stype = htonl(((__s32 *)data)[bsize - 1]);
  17768.  
  17769.      sum    = 0;
  17770.      p      = data;
  17771. @@ -194,20 +194,20 @@
  17772.  void
  17773.  affs_fix_checksum(int bsize, void *data, int cspos)
  17774.  {
  17775. -    ULONG     ocs;
  17776. -    ULONG     cs;
  17777. +    __u32     ocs;
  17778. +    __u32     cs;
  17779.  
  17780.      cs   = affs_checksum_block(bsize,data,NULL,NULL);
  17781. -    ocs  = htonl (((ULONG *)data)[cspos]);
  17782. +    ocs  = htonl (((__u32 *)data)[cspos]);
  17783.      ocs -= cs;
  17784. -    ((ULONG *)data)[cspos] = htonl(ocs);
  17785. +    ((__u32 *)data)[cspos] = htonl(ocs);
  17786.  }
  17787.  
  17788.  void
  17789.  secs_to_datestamp(int secs, struct DateStamp *ds)
  17790.  {
  17791. -    ULONG     days;
  17792. -    ULONG     minute;
  17793. +    __u32     days;
  17794. +    __u32     minute;
  17795.  
  17796.      secs -= sys_tz.tz_minuteswest * 60 +((8 * 365 + 2) * 24 * 60 * 60);
  17797.      if (secs < 0)
  17798. @@ -223,7 +223,7 @@
  17799.  }
  17800.  
  17801.  int
  17802. -prot_to_mode(ULONG prot)
  17803. +prot_to_mode(__u32 prot)
  17804.  {
  17805.      int     mode = 0;
  17806.  
  17807. @@ -249,10 +249,10 @@
  17808.      return mode;
  17809.  }
  17810.  
  17811. -ULONG
  17812. +unsigned int
  17813.  mode_to_prot(int mode)
  17814.  {
  17815. -    ULONG     prot = 0;
  17816. +    unsigned int     prot = 0;
  17817.  
  17818.      if (mode & S_IXUSR)
  17819.          prot |= FIBF_SCRIPT;
  17820. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/bitmap.c linux/fs/affs/bitmap.c
  17821. --- pre2.0.5/linux/fs/affs/bitmap.c    Fri May 17 15:32:17 1996
  17822. +++ linux/fs/affs/bitmap.c    Sun May 19 15:22:19 1996
  17823. @@ -2,24 +2,28 @@
  17824.   *  linux/fs/affs/bitmap.c
  17825.   *
  17826.   *  (c) 1996 Hans-Joachim Widmaier
  17827. + *
  17828. + *
  17829. + *  bitmap.c contains the code that handles all bitmap related stuff -
  17830. + *  block allocation, deallocation, calculation of free space.
  17831.   */
  17832.  
  17833. -/* bitmap.c contains the code that handles the inode and block bitmaps */
  17834. -
  17835.  #include <linux/sched.h>
  17836.  #include <linux/affs_fs.h>
  17837.  #include <linux/stat.h>
  17838.  #include <linux/kernel.h>
  17839.  #include <linux/string.h>
  17840. -#include <linux/amigaffs.h>
  17841.  #include <linux/locks.h>
  17842. +#include <linux/amigaffs.h>
  17843.  
  17844.  #include <asm/bitops.h>
  17845.  
  17846. +/* This is, of course, shamelessly stolen from fs/minix */
  17847. +
  17848.  static int nibblemap[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 };
  17849.  
  17850.  int
  17851. -affs_count_free_bits(int blocksize, const UBYTE *data)
  17852. +affs_count_free_bits(int blocksize, const char *data)
  17853.  {
  17854.    int     free;
  17855.    int     i;
  17856. @@ -42,94 +46,111 @@
  17857.  
  17858.      free = 0;
  17859.      if (s->u.affs_sb.s_flags & SF_BM_VALID) {
  17860. -        for (i = 0; i < s->u.affs_sb.s_bm_count; i++) {
  17861. -            free += s->u.affs_sb.s_bitmap[i].bm_free;
  17862. +        for (i = 0; i < s->u.affs_sb.s_num_az; i++) {
  17863. +            free += s->u.affs_sb.s_alloc[i].az_free;
  17864.          }
  17865.      }
  17866.      return free;
  17867.  }
  17868.  
  17869.  void
  17870. -affs_free_block(struct super_block *sb, LONG block)
  17871. +affs_free_block(struct super_block *sb, int block)
  17872.  {
  17873.      int             bmap;
  17874.      int             bit;
  17875. -    ULONG             blk;
  17876. +    int             blk;
  17877. +    int             zone_no;
  17878.      struct affs_bm_info    *bm;
  17879.  
  17880.      pr_debug("AFFS: free_block(%d)\n",block);
  17881.  
  17882. -    blk    = block - sb->u.affs_sb.s_reserved;
  17883. -    bmap   = blk / (sb->s_blocksize * 8 - 32);
  17884. -    bit    = blk % (sb->s_blocksize * 8 - 32);
  17885. -    bm     = &sb->u.affs_sb.s_bitmap[bmap];
  17886. -    if (bmap >= sb->u.affs_sb.s_bm_count || bit >= bm->bm_size) {
  17887. +    blk     = block - sb->u.affs_sb.s_reserved;
  17888. +    bmap    = blk / (sb->s_blocksize * 8 - 32);
  17889. +    bit     = blk % (sb->s_blocksize * 8 - 32);
  17890. +    zone_no = (bmap << (sb->s_blocksize_bits - 7)) + bit / 1024;
  17891. +    bm      = &sb->u.affs_sb.s_bitmap[bmap];
  17892. +    if (bmap >= sb->u.affs_sb.s_bm_count) {
  17893.          printk("AFFS: free_block(): block %d outside partition.\n",block);
  17894.          return;
  17895.      }
  17896. -    blk  = 0;
  17897. +    blk = 0;
  17898.      set_bit(bit & 31,&blk);
  17899.  
  17900.      lock_super(sb);
  17901. +    bm->bm_count++;
  17902. +    if (!bm->bm_bh) {
  17903. +        bm->bm_bh = affs_bread(sb->s_dev,bm->bm_key,sb->s_blocksize);
  17904. +        if (!bm->bm_bh) {
  17905. +            bm->bm_count--;
  17906. +            unlock_super(sb);
  17907. +            printk("AFFS: free_block(): Cannot read bitmap block %d\n",bm->bm_key);
  17908. +            return;
  17909. +        }
  17910. +    }
  17911.      if (set_bit(bit ^ BO_EXBITS,bm->bm_bh->b_data + 4))
  17912.          printk("AFFS: free_block(): block %d is already free.\n",block);
  17913.      else {
  17914. -        bm->bm_free++;
  17915. -        ((ULONG *)bm->bm_bh->b_data)[0] = ntohl(htonl(((ULONG *)bm->bm_bh->b_data)[0]) - blk);
  17916. +        sb->u.affs_sb.s_alloc[zone_no].az_free++;
  17917. +        ((__u32 *)bm->bm_bh->b_data)[0] = ntohl(htonl(((__u32 *)bm->bm_bh->b_data)[0]) - blk);
  17918.          mark_buffer_dirty(bm->bm_bh,1);
  17919.          sb->s_dirt = 1;
  17920.      }
  17921. +    if (--bm->bm_count == 0) {
  17922. +        affs_brelse(bm->bm_bh);
  17923. +        bm->bm_bh = NULL;
  17924. +    }
  17925.      unlock_super(sb);
  17926.  }
  17927.  
  17928. -static ULONG
  17929. +static int
  17930.  affs_balloc(struct inode *inode, int zone_no)
  17931.  {
  17932. -    ULONG             w;
  17933. -    ULONG            *bm;
  17934. +    __u32             w;
  17935. +    __u32            *bm;
  17936.      int             fb;
  17937.      int             i;
  17938.      int             fwb;
  17939. -    ULONG             block;
  17940. +    int             block;
  17941.      struct affs_zone    *zone;
  17942. +    struct affs_alloc_zone    *az;
  17943.      struct super_block    *sb;
  17944.  
  17945.      sb   = inode->i_sb;
  17946.      zone = &sb->u.affs_sb.s_zones[zone_no];
  17947.  
  17948. -    if (!zone || !zone->z_bm || !zone->z_bm->bm_bh)
  17949. -        return 0;
  17950. -    
  17951. +    if (!zone->z_bm || !zone->z_bm->bm_bh)
  17952. +        return 0;    
  17953. +
  17954.      pr_debug("AFFS: balloc(inode=%lu,zone=%d)\n",inode->i_ino,zone_no);
  17955.  
  17956. -    bm = (ULONG *)zone->z_bm->bm_bh->b_data;
  17957. +    az = &sb->u.affs_sb.s_alloc[zone->z_az_no];
  17958. +    bm = (__u32 *)zone->z_bm->bm_bh->b_data;
  17959.  repeat:
  17960. -    fb = (zone->z_bm->bm_size + 31) >> 5;
  17961. -    for (i = zone->z_start; i <= fb; i++) {
  17962. +    for (i = zone->z_start; i < zone->z_end; i++) {
  17963.          if (bm[i])
  17964.              goto found;
  17965.      }
  17966. -    return 0;
  17967. +    return 0;    
  17968.  
  17969.  found:
  17970.      fwb = zone->z_bm->bm_firstblk + (i - 1) * 32;
  17971.      lock_super(sb);
  17972.      zone->z_start = i;
  17973. -    w   = htonl(bm[i]);
  17974. -    fb  = find_first_one_bit(&w,32);
  17975. +    w   = ~htonl(bm[i]);
  17976. +    fb  = find_first_zero_bit(&w,32);
  17977.      if (fb > 31 || !clear_bit(fb ^ BO_EXBITS,&bm[i])) {
  17978.          unlock_super(sb);
  17979.          printk("AFFS: balloc(): empty block disappeared somehow\n");
  17980.          goto repeat;
  17981.      }
  17982.      block = fwb + fb;
  17983. -    zone->z_bm->bm_free--;
  17984. +    az->az_free--;
  17985.  
  17986. -    /* prealloc as much as possible within this word, but not for headers */
  17987. +    /* prealloc as much as possible within this word, but not in header zone */
  17988.  
  17989.      if (zone_no) {
  17990.          while (inode->u.affs_i.i_pa_cnt < MAX_PREALLOC && ++fb < 32) {
  17991. -            fb = find_next_one_bit(&w,32,fb);
  17992. +            fb = find_next_zero_bit(&w,32,fb);
  17993.              if (fb > 31)
  17994.                  break;
  17995.              if (!clear_bit(fb ^ BO_EXBITS,&bm[i])) {
  17996. @@ -139,102 +160,129 @@
  17997.              inode->u.affs_i.i_data[inode->u.affs_i.i_pa_last++] = fwb + fb;
  17998.              inode->u.affs_i.i_pa_last &= MAX_PREALLOC - 1;
  17999.              inode->u.affs_i.i_pa_cnt++;
  18000. -            zone->z_bm->bm_free--;
  18001. +            az->az_free--;
  18002.          }
  18003.      }
  18004. -    w    -= htonl(bm[i]);
  18005. +    w     = ~w - htonl(bm[i]);
  18006.      bm[0] = ntohl(htonl(bm[0]) + w);
  18007.      unlock_super(sb);
  18008.      mark_buffer_dirty(zone->z_bm->bm_bh,1);
  18009. +    zone->z_lru_time = jiffies;
  18010.  
  18011.      return block;
  18012.  }
  18013.  
  18014. -static void
  18015. -affs_find_new_zone(struct super_block *sb,struct affs_zone *z, int minfree, int start)
  18016. +static int
  18017. +affs_find_new_zone(struct super_block *sb, int zone_no)
  18018.  {
  18019.      struct affs_bm_info    *bm;
  18020. -    int             offs;
  18021. -    int             zone;
  18022. -    int             free;
  18023. -    int             len;
  18024. +    struct affs_zone    *zone;
  18025. +    struct affs_alloc_zone    *az;
  18026. +    int             bestfree;
  18027. +    int             bestno;
  18028. +    int             bestused;
  18029. +    int             lusers;
  18030. +    int             i;
  18031. +    int             min;
  18032.  
  18033. -    pr_debug("AFFS: find_new_zone()\n");
  18034. +    pr_debug("AFFS: find_new_zone(zone_no=%d)\n",zone_no);
  18035.  
  18036. +    bestfree = 0;
  18037. +    bestused = -1;
  18038. +    bestno   = -1;
  18039. +    lusers   = MAX_ZONES;
  18040. +    min      = zone_no ? AFFS_DATA_MIN_FREE : AFFS_HDR_MIN_FREE;
  18041.      lock_super(sb);
  18042. -
  18043. -    zone    = start;
  18044. -    z->z_bm = NULL;
  18045. -    while (1) {
  18046. -        if (zone >= sb->u.affs_sb.s_num_zones) {
  18047. -            zone = 0;
  18048. -            continue;
  18049. +    zone = &sb->u.affs_sb.s_zones[zone_no];
  18050. +    i    = zone->z_az_no;
  18051. +    az   = &sb->u.affs_sb.s_alloc[i];
  18052. +    if (zone->z_bm && zone->z_bm->bm_count) {
  18053. +        if (--zone->z_bm->bm_count == 0) {
  18054. +            affs_brelse(zone->z_bm->bm_bh);
  18055. +            zone->z_bm->bm_bh = NULL;
  18056.          }
  18057. +        if (az->az_count)
  18058. +            az->az_count--;
  18059. +        else
  18060. +            printk("AFFS: find_new_zone(): az_count=0, but bm used\n");
  18061.  
  18062. -        if (!set_bit(zone,sb->u.affs_sb.s_zonemap)) {
  18063. -            bm   = &sb->u.affs_sb.s_bitmap[zone >> (sb->s_blocksize_bits - 8)];
  18064. -            offs = zone * 256 & (sb->s_blocksize - 1);
  18065. -            len  = bm->bm_size / 8 - offs;
  18066. -            if (len > 256)
  18067. -                len = 256;
  18068. -            offs += 4;
  18069. -            free  = affs_count_free_bits(len,(char *)bm->bm_bh->b_data + offs);
  18070. -            if (free && (100 * free) / (len * 8) > minfree) {
  18071. -                z->z_bm       = bm;
  18072. -                z->z_start    = offs / 4;
  18073. -                z->z_ino      = 0;
  18074. -                z->z_zone_no  = zone;
  18075. -                pr_debug("  ++ found zone (%d) in bh %d at offset %d with %d free blocks\n",
  18076. -                    zone,(zone >> (sb->s_blocksize_bits - 8)),offs,free);
  18077. +    }
  18078. +    while (1) {
  18079. +        if (i >= sb->u.affs_sb.s_num_az)
  18080. +            i = 0;
  18081. +        az = &sb->u.affs_sb.s_alloc[i];
  18082. +        if (!az->az_count) {
  18083. +            if (az->az_free > min) {
  18084.                  break;
  18085.              }
  18086. -            clear_bit(zone,sb->u.affs_sb.s_zonemap);
  18087. +            if (az->az_free > bestfree) {
  18088. +                bestfree = az->az_free;
  18089. +                bestno   = i;
  18090. +            }
  18091. +        } else if (az->az_free && az->az_count < lusers) {
  18092. +            lusers   = az->az_count;
  18093. +            bestused = i;
  18094.          }
  18095. -
  18096. -        /* Skip to next possible zone */
  18097. -
  18098. -        pr_debug("  ++ Skipping to next zone\n");
  18099. -        if (++zone == start)
  18100. +        if (++i == zone->z_az_no) {        /* Seen all */
  18101. +            if (bestno >= 0) {
  18102. +                i = bestno;
  18103. +            } else {
  18104. +                i = bestused;
  18105. +            }
  18106.              break;
  18107. +        }
  18108. +    }
  18109. +    if (i < 0) {
  18110. +        /* Didn't find a single free block anywhere. */
  18111. +        unlock_super(sb);
  18112. +        return 0;
  18113. +    }
  18114. +    az = &sb->u.affs_sb.s_alloc[i];
  18115. +    az->az_count++;
  18116. +    bm = &sb->u.affs_sb.s_bitmap[i >> (sb->s_blocksize_bits - 7)];
  18117. +    bm->bm_count++;
  18118. +    if (!bm->bm_bh)
  18119. +        bm->bm_bh = affs_bread(sb->s_dev,bm->bm_key,sb->s_blocksize);
  18120. +    if (!bm->bm_bh) {
  18121. +        bm->bm_count--;
  18122. +        az->az_count--;
  18123. +        unlock_super(sb);
  18124. +        printk("AFFS: find_new_zone(): Cannot read bitmap\n");
  18125. +        return 0;
  18126.      }
  18127. +    zone->z_bm    = bm;
  18128. +    zone->z_start = (i & ((sb->s_blocksize / 128) - 1)) * 32 + 1;
  18129. +    zone->z_end   = zone->z_start + az->az_size;
  18130. +    zone->z_az_no = i;
  18131. +    zone->z_lru_time = jiffies;
  18132. +    pr_debug("  ++ found zone (%d) in bm %d at lw offset %d with %d free blocks\n",
  18133. +         i,(i >> (sb->s_blocksize_bits - 7)),zone->z_start,az->az_free);
  18134.      unlock_super(sb);
  18135. -    return;
  18136. +    return az->az_free;
  18137.  }
  18138.  
  18139. -LONG
  18140. +int
  18141.  affs_new_header(struct inode *inode)
  18142.  {
  18143. -    struct affs_zone    *zone;
  18144. -    LONG             block;
  18145. -    struct super_block    *sb;
  18146. +    int             block;
  18147.      struct buffer_head    *bh;
  18148.  
  18149. -    sb   = inode->i_sb;
  18150. -    zone = &sb->u.affs_sb.s_zones[0];
  18151. -
  18152. -    /* We try up to 3 times to find a free block:
  18153. -     * If there is no more room in the current header zone,
  18154. -     * we try to get a new one and allocate the block there.
  18155. -     * If there is no zone with at least AFFS_HDR_MIN_FREE
  18156. -     * percent of free blocks, we try to find a zone with
  18157. -     * at least one free block.
  18158. -     */
  18159. +    pr_debug("AFFS: new_header(ino=%lu)\n",inode->i_ino);
  18160.  
  18161.      if (!(block = affs_balloc(inode,0))) {
  18162. -        clear_bit(zone->z_zone_no,sb->u.affs_sb.s_zonemap);
  18163. -        affs_find_new_zone(sb,zone,AFFS_HDR_MIN_FREE,(sb->u.affs_sb.s_num_zones + 1) / 2);
  18164. -        if (!(block = affs_balloc(inode,0))) {
  18165. -            clear_bit(zone->z_zone_no,sb->u.affs_sb.s_zonemap);
  18166. -            affs_find_new_zone(sb,zone,0,(sb->u.affs_sb.s_num_zones + 1) / 2);
  18167. -            if (!(block = affs_balloc(inode,0)))
  18168. -                return 0;
  18169. +        while(affs_find_new_zone(inode->i_sb,0)) {
  18170. +            if ((block = affs_balloc(inode,0)))
  18171. +                goto init_block;
  18172. +            schedule();
  18173.          }
  18174. +        return 0;
  18175.      }
  18176. -    if (!(bh = getblk(inode->i_dev,block,sb->s_blocksize))) {
  18177. +init_block:
  18178. +    if (!(bh = getblk(inode->i_dev,block,AFFS_I2BSIZE(inode)))) {
  18179.          printk("AFFS: balloc(): cannot read block %d\n",block);
  18180.          return 0;
  18181.      }
  18182. -    memset(bh->b_data,0,sb->s_blocksize);
  18183. +    memset(bh->b_data,0,AFFS_I2BSIZE(inode));
  18184.      mark_buffer_uptodate(bh,1);
  18185.      mark_buffer_dirty(bh,1);
  18186.      affs_brelse(bh);
  18187. @@ -242,7 +290,7 @@
  18188.      return block;
  18189.  }
  18190.  
  18191. -LONG
  18192. +int
  18193.  affs_new_data(struct inode *inode)
  18194.  {
  18195.      int             empty, old;
  18196. @@ -251,7 +299,7 @@
  18197.      struct super_block    *sb;
  18198.      struct buffer_head    *bh;
  18199.      int             i = 0;
  18200. -    LONG             block;
  18201. +    int             block;
  18202.  
  18203.      pr_debug("AFFS: new_data(ino=%lu)\n",inode->i_ino);
  18204.  
  18205. @@ -265,7 +313,6 @@
  18206.          goto init_block;
  18207.      }
  18208.      unlock_super(sb);
  18209. -repeat:
  18210.      oldest = jiffies;
  18211.      old    = 0;
  18212.      empty  = 0;
  18213. @@ -287,19 +334,25 @@
  18214.          i = empty;
  18215.      else if (old)
  18216.          i = old;
  18217. -    else
  18218. +    else {
  18219. +        inode->u.affs_i.i_zone = 0;
  18220.          return affs_new_header(inode);
  18221. +    }
  18222.  
  18223.      inode->u.affs_i.i_zone = i;
  18224.      zone->z_ino            = inode->i_ino;
  18225.  
  18226.  found:
  18227.      zone = &sb->u.affs_sb.s_zones[i];
  18228. -    if (!(block = affs_balloc(inode,i))) {                /* Zone is full */
  18229. -        clear_bit(zone->z_zone_no,sb->u.affs_sb.s_zonemap);
  18230. -        affs_find_new_zone(sb,zone,AFFS_DATA_MIN_FREE,sb->u.affs_sb.s_nextzone);
  18231. -        sb->u.affs_sb.s_nextzone = zone->z_zone_no + 1;
  18232. -        goto repeat;
  18233. +    if (!(block = affs_balloc(inode,i))) {        /* No data zones left */
  18234. +        while(affs_find_new_zone(sb,i)) {
  18235. +            if ((block = affs_balloc(inode,i)))
  18236. +                goto init_block;
  18237. +            schedule();
  18238. +        }
  18239. +        inode->u.affs_i.i_zone = 0;
  18240. +        zone->z_ino            = -1;
  18241. +        return 0;
  18242.      }
  18243.  
  18244.  init_block:
  18245. @@ -318,15 +371,15 @@
  18246.  void
  18247.  affs_make_zones(struct super_block *sb)
  18248.  {
  18249. -    int     i, j;
  18250. -
  18251. -    pr_debug("AFFS: make_zones(): num_zones=%d\n",sb->u.affs_sb.s_num_zones);
  18252. +    int     i, mid;
  18253.  
  18254. -    j = (sb->u.affs_sb.s_num_zones + 1) / 2;
  18255. +    pr_debug("AFFS: make_zones(): num_zones=%d\n",sb->u.affs_sb.s_num_az);
  18256.  
  18257. -    affs_find_new_zone(sb,&sb->u.affs_sb.s_zones[0],AFFS_HDR_MIN_FREE,j);
  18258. +    mid = (sb->u.affs_sb.s_num_az + 1) / 2;
  18259. +    sb->u.affs_sb.s_zones[0].z_az_no = mid;
  18260. +    affs_find_new_zone(sb,0);
  18261.      for (i = 1; i < MAX_ZONES; i++) {
  18262. -        affs_find_new_zone(sb,&sb->u.affs_sb.s_zones[i],AFFS_DATA_MIN_FREE,j);
  18263. -        j = sb->u.affs_sb.s_zones[i].z_zone_no + 1;
  18264. +        sb->u.affs_sb.s_zones[i].z_az_no = mid;
  18265. +        affs_find_new_zone(sb,i);
  18266.      }
  18267.  }
  18268. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/dir.c linux/fs/affs/dir.c
  18269. --- pre2.0.5/linux/fs/affs/dir.c    Fri May 17 15:32:17 1996
  18270. +++ linux/fs/affs/dir.c    Sun May 19 15:22:19 1996
  18271. @@ -1,7 +1,7 @@
  18272.  /*
  18273.   *  linux/fs/affs/dir.c
  18274.   *
  18275. - *  (c) 1996  Hans-Joachim Widmaier - rewritten
  18276. + *  (c) 1996  Hans-Joachim Widmaier - Rewritten
  18277.   *
  18278.   *  (C) 1993  Ray Burr - Modified for Amiga FFS filesystem.
  18279.   *
  18280. @@ -58,7 +58,7 @@
  18281.      NULL,            /* readpage */
  18282.      NULL,            /* writepage */
  18283.      NULL,            /* bmap */
  18284. -    affs_dir_truncate,    /* truncate */
  18285. +    NULL,            /* truncate */
  18286.      NULL            /* permissions */
  18287.  };
  18288.  
  18289. @@ -72,11 +72,11 @@
  18290.  affs_readdir(struct inode *inode, struct file *filp, void *dirent, filldir_t filldir)
  18291.  {
  18292.      int             j, namelen;
  18293. -    LONG             i;
  18294. -    ULONG             hash_pos;
  18295. -    ULONG             chain_pos;
  18296. +    int             i;
  18297. +    int             hash_pos;
  18298. +    int             chain_pos;
  18299.      unsigned long         ino;
  18300. -    unsigned long             old;
  18301. +    unsigned long         old;
  18302.      int stored;
  18303.      char *name;
  18304.      struct buffer_head *dir_bh;
  18305. @@ -142,9 +142,9 @@
  18306.           * we can jump directly to where we left off.
  18307.           */
  18308.          if (filp->private_data && filp->f_version == dir->i_version) {
  18309. -            i = (ULONG)filp->private_data;
  18310. +            i = (int)filp->private_data;
  18311.              j = 0;
  18312. -            pr_debug("AFFS: readdir() left off=%lu\n",i);
  18313. +            pr_debug("AFFS: readdir() left off=%d\n",i);
  18314.          }
  18315.          filp->f_version = dir->i_version;
  18316.          pr_debug("AFFS: hash_pos=%lu chain_pos=%lu\n", hash_pos, chain_pos);
  18317. @@ -163,7 +163,8 @@
  18318.          }
  18319.          if (fh_bh) {
  18320.              namelen = affs_get_file_name(AFFS_I2BSIZE(inode),fh_bh->b_data,&name);
  18321. -            pr_debug("AFFS: readdir(): filldir(..,\"%.*s\",ino=%lu), i=%lu\n",namelen,name,ino,i);
  18322. +            pr_debug("AFFS: readdir(): filldir(..,\"%.*s\",ino=%lu), i=%lu\n",
  18323. +                 namelen,name,ino,i);
  18324.              filp->private_data = (void *)ino;
  18325.              if (filldir(dirent,name,namelen,filp->f_pos,ino) < 0)
  18326.                  goto readdir_done;
  18327. @@ -187,10 +188,4 @@
  18328.      iput(dir);
  18329.      pr_debug("AFFS: readdir()=%d\n",stored);
  18330.      return stored;
  18331. -}
  18332. -
  18333. -void
  18334. -affs_dir_truncate(struct inode *inode)
  18335. -{
  18336. -    printk("AFFS: dir_truncate()\n");
  18337.  }
  18338. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/file.c linux/fs/affs/file.c
  18339. --- pre2.0.5/linux/fs/affs/file.c    Fri May 17 15:32:17 1996
  18340. +++ linux/fs/affs/file.c    Sun May 19 15:22:19 1996
  18341. @@ -1,7 +1,7 @@
  18342.  /*
  18343.   *  linux/fs/affs/file.c
  18344.   *
  18345. - *  (c) 1996  Hans-Joachim Widmaier - rewritten
  18346. + *  (c) 1996  Hans-Joachim Widmaier - Rewritten
  18347.   *
  18348.   *  (C) 1993  Ray Burr - Modified for Amiga FFS filesystem.
  18349.   *
  18350. @@ -104,11 +104,11 @@
  18351.  };
  18352.  
  18353.  int
  18354. -affs_bmap(struct inode *inode, LONG block)
  18355. +affs_bmap(struct inode *inode, int block)
  18356.  {
  18357.      struct buffer_head    *bh;
  18358. -    LONG             ext, key;
  18359. -    LONG             ptype, stype;
  18360. +    int             ext, key;
  18361. +    int             ptype, stype;
  18362.  
  18363.      pr_debug("AFFS: bmap(%lu,%d)\n",inode->i_ino,block);
  18364.  
  18365. @@ -155,13 +155,13 @@
  18366.  }
  18367.  
  18368.  struct buffer_head *
  18369. -affs_getblock(struct inode *inode, LONG block)
  18370. +affs_getblock(struct inode *inode, int block)
  18371.  {
  18372.      struct buffer_head    *bh;
  18373.      struct buffer_head    *ebh;
  18374. -    LONG             key;
  18375. -    LONG             ext;
  18376. -    LONG             cnt, j, pt;
  18377. +    int             key;
  18378. +    int             ext;
  18379. +    int             cnt, j, pt;
  18380.  
  18381.      pr_debug("AFFS: getblock(%lu,%d)\n",inode->i_ino,block);
  18382.  
  18383. @@ -258,28 +258,28 @@
  18384.      affs_brelse(bh);
  18385.      if (!key)
  18386.          return NULL;
  18387. -
  18388. +    
  18389.      return affs_bread(inode->i_dev,key,AFFS_I2BSIZE(inode));
  18390.  }
  18391.  
  18392.  struct buffer_head *
  18393. -affs_getblock_ofs(struct inode *inode, LONG block, LONG *blk_key)
  18394. +affs_getblock_ofs(struct inode *inode, int block, int *blk_key)
  18395.  {
  18396.      struct buffer_head    *bh;
  18397.      struct buffer_head    *pbh;
  18398.      struct buffer_head    *ebh;
  18399. -    LONG             key;
  18400. -    LONG             ext;
  18401. -    LONG             cnt, j, pt;
  18402. +    int             key;
  18403. +    int             ext;
  18404. +    int             cnt, j, pt;
  18405.  
  18406. -    pr_debug("AFFS: getblock(%lu,%d)\n",inode->i_ino,block);
  18407. +    pr_debug("AFFS: getblock_ofs(%lu,%d)\n",inode->i_ino,block);
  18408.  
  18409.      if (block < 0)
  18410.          return NULL;
  18411.      key = inode->i_ino;
  18412.      pt  = T_SHORT;
  18413.  
  18414. -    ext = block / (AFFS_I2HSIZE(inode) - 24);
  18415. +    ext = block / AFFS_I2HSIZE(inode);
  18416.      if (ext) {
  18417.          if (ext > inode->u.affs_i.i_max_ext)
  18418.              ext = inode->u.affs_i.i_max_ext;
  18419. @@ -305,7 +305,11 @@
  18420.          j = htonl(((struct file_front *)bh->b_data)->block_count);
  18421.          while (j < AFFS_I2HSIZE(inode) && j <= block) {
  18422.              if (!pbh && inode->u.affs_i.i_lastblock >= 0) {
  18423. -                pbh = affs_getblock_ofs(inode,inode->u.affs_i.i_lastblock,&key);
  18424. +                if (j > 0)
  18425. +                    pbh = affs_bread(inode->i_dev,ntohl(AFFS_BLOCK(bh->b_data,inode,j - 1)),
  18426. +                             AFFS_I2BSIZE(inode));
  18427. +                else
  18428. +                    pbh = affs_getblock_ofs(inode,inode->u.affs_i.i_lastblock,&key);
  18429.                  if (!pbh) {
  18430.                      printk("AFFS: getblock(): cannot get last block in file\n");
  18431.                      break;
  18432. @@ -335,12 +339,14 @@
  18433.              DATA_FRONT(ebh)->primary_type    = ntohl(T_DATA);
  18434.              DATA_FRONT(ebh)->header_key      = ntohl(inode->i_ino);
  18435.              DATA_FRONT(ebh)->sequence_number = ntohl(inode->u.affs_i.i_lastblock + 1);
  18436. -            DATA_FRONT(pbh)->data_size       = ntohl(AFFS_I2HSIZE(inode) - 24);
  18437. -            DATA_FRONT(pbh)->next_data       = ntohl(key);
  18438. -            affs_fix_checksum(AFFS_I2HSIZE(inode),pbh->b_data,5);
  18439. -            mark_buffer_dirty(pbh,0);
  18440. -            mark_buffer_dirty(ebh,0);
  18441. -            affs_brelse(pbh);
  18442. +            if (pbh) {
  18443. +                DATA_FRONT(pbh)->data_size = ntohl(AFFS_I2BSIZE(inode) - 24);
  18444. +                DATA_FRONT(pbh)->next_data = ntohl(key);
  18445. +                affs_fix_checksum(AFFS_I2BSIZE(inode),pbh->b_data,5);
  18446. +                mark_buffer_dirty(pbh,0);
  18447. +                mark_buffer_dirty(ebh,0);
  18448. +                affs_brelse(pbh);
  18449. +            }
  18450.              pbh = ebh;
  18451.              j++;
  18452.          }
  18453. @@ -433,10 +439,10 @@
  18454.          left = MIN (inode->i_size - filp->f_pos,count - (buf - start));
  18455.          if (!left)
  18456.              break;
  18457. -        sector = affs_bmap(inode,(ULONG)filp->f_pos / blocksize);
  18458. +        sector = affs_bmap(inode,(__u32)filp->f_pos / blocksize);
  18459.          if (!sector)
  18460.              break;
  18461. -        offset = (ULONG)filp->f_pos % blocksize;
  18462. +        offset = (__u32)filp->f_pos % blocksize;
  18463.          bh = affs_bread(inode->i_dev,sector,AFFS_I2BSIZE(inode));
  18464.          if (!bh)
  18465.              break;
  18466. @@ -537,6 +543,7 @@
  18467.      off_t             pos;
  18468.      int             written;
  18469.      int             c;
  18470. +    int             key;
  18471.      int             blocksize;
  18472.      struct buffer_head    *bh;
  18473.      struct inode        *ino;
  18474. @@ -546,7 +553,7 @@
  18475.          (unsigned long)filp->f_pos,count);
  18476.  
  18477.      if (!inode) {
  18478. -        printk("AFFS: file_write(): inode=NULL\n");
  18479. +        printk("AFFS: file_write_ofs(): inode=NULL\n");
  18480.          return -EINVAL;
  18481.      }
  18482.      ino = NULL;
  18483. @@ -560,7 +567,7 @@
  18484.          inode = ino;
  18485.      }
  18486.      if (!S_ISREG(inode->i_mode)) {
  18487. -        printk("AFFS: file_write(): mode=%07o\n",inode->i_mode);
  18488. +        printk("AFFS: file_write_ofs(): mode=%07o\n",inode->i_mode);
  18489.          iput(inode);
  18490.          return -EINVAL;
  18491.      }
  18492. @@ -573,7 +580,7 @@
  18493.      blocksize = AFFS_I2BSIZE(inode) - 24;
  18494.      written   = 0;
  18495.      while (written < count) {
  18496. -        bh = affs_getblock(inode,pos / blocksize);
  18497. +        bh = affs_getblock_ofs(inode,pos / blocksize,&key);
  18498.          if (!bh) {
  18499.              if (!written)
  18500.                  written = -ENOSPC;
  18501. @@ -620,12 +627,13 @@
  18502.      struct buffer_head    *bh;
  18503.      struct buffer_head    *ebh;
  18504.      struct inode        *ino;
  18505. -    LONG     first;
  18506. -    LONG     block;
  18507. -    LONG     key;
  18508. -    LONG    *keyp;
  18509. -    LONG     ekey;
  18510. -    LONG     ptype, stype;
  18511. +    struct affs_zone    *zone;
  18512. +    int     first;
  18513. +    int     block;
  18514. +    int     key;
  18515. +    int    *keyp;
  18516. +    int     ekey;
  18517. +    int     ptype, stype;
  18518.      int     freethis;
  18519.      int     blocksize;
  18520.      int     rem;
  18521. @@ -646,7 +654,24 @@
  18522.      blocksize = AFFS_I2BSIZE(inode) - ((inode->i_sb->u.affs_sb.s_flags & SF_OFS) ? 24 : 0);
  18523.      first = (inode->i_size + blocksize - 1) / blocksize;
  18524.      if (inode->u.affs_i.i_lastblock < first - 1) {
  18525. -        bh = affs_getblock(inode,first - 1);
  18526. +        if (inode->i_sb->u.affs_sb.s_flags & SF_OFS)
  18527. +            bh = affs_getblock_ofs(inode,first - 1,&ekey);
  18528. +        else
  18529. +            bh = affs_getblock(inode,first - 1);
  18530. +
  18531. +        while (inode->u.affs_i.i_pa_cnt) {        /* Free any preallocated blocks */
  18532. +            affs_free_block(inode->i_sb,
  18533. +                    inode->u.affs_i.i_data[inode->u.affs_i.i_pa_next++]);
  18534. +            inode->u.affs_i.i_pa_next &= MAX_PREALLOC - 1;
  18535. +            inode->u.affs_i.i_pa_cnt--;
  18536. +        }
  18537. +        if (inode->u.affs_i.i_zone) {
  18538. +            lock_super(inode->i_sb);
  18539. +            zone = &inode->i_sb->u.affs_sb.s_zones[inode->u.affs_i.i_zone];
  18540. +            if (zone->z_ino == inode->i_ino)
  18541. +                zone->z_ino = 0;
  18542. +            unlock_super(inode->i_sb);
  18543. +        }
  18544.          if (!bh) {
  18545.              printk("AFFS: truncate(): Cannot extend file\n");
  18546.              inode->i_size = blocksize * (inode->u.affs_i.i_lastblock + 1);
  18547. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/inode.c linux/fs/affs/inode.c
  18548. --- pre2.0.5/linux/fs/affs/inode.c    Fri May 17 15:32:17 1996
  18549. +++ linux/fs/affs/inode.c    Sun May 19 16:15:32 1996
  18550. @@ -1,7 +1,7 @@
  18551.  /*
  18552.   *  linux/fs/affs/inode.c
  18553.   *
  18554. - *  (c) 1996  Hans-Joachim Widmaier - rewritten
  18555. + *  (c) 1996  Hans-Joachim Widmaier - Rewritten
  18556.   *
  18557.   *  (C) 1993  Ray Burr - Modified for Amiga FFS filesystem.
  18558.   * 
  18559. @@ -25,12 +25,15 @@
  18560.  #include <linux/genhd.h>
  18561.  #include <linux/amigaffs.h>
  18562.  #include <linux/major.h>
  18563. +#include <linux/blkdev.h>
  18564.  #include <asm/system.h>
  18565.  #include <asm/segment.h>
  18566.  
  18567.  extern int *blk_size[];
  18568.  extern struct timezone sys_tz;
  18569.  
  18570. +#define MIN(a,b) (((a)<(b))?(a):(b))
  18571. +
  18572.  void
  18573.  affs_put_super(struct super_block *sb)
  18574.  {
  18575. @@ -39,15 +42,13 @@
  18576.      pr_debug("affs_put_super()\n");
  18577.  
  18578.      lock_super(sb);
  18579. -    if (!(sb->s_flags & MS_RDONLY)) {
  18580. -        for (i = 0; i < sb->u.affs_sb.s_bm_count; i++)
  18581. -            affs_brelse(sb->u.affs_sb.s_bitmap[i].bm_bh);
  18582. -        ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = htonl(1);
  18583. -        secs_to_datestamp(CURRENT_TIME,
  18584. -                  &ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered);
  18585. -        affs_fix_checksum(sb->s_blocksize,sb->u.affs_sb.s_root_bh->b_data,5);
  18586. -        mark_buffer_dirty(sb->u.affs_sb.s_root_bh,1);
  18587. -    }
  18588. +    for (i = 0; i < sb->u.affs_sb.s_bm_count; i++)
  18589. +        affs_brelse(sb->u.affs_sb.s_bitmap[i].bm_bh);
  18590. +    ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = htonl(1);
  18591. +    secs_to_datestamp(CURRENT_TIME,&ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered);
  18592. +    affs_fix_checksum(sb->s_blocksize,sb->u.affs_sb.s_root_bh->b_data,5);
  18593. +    mark_buffer_dirty(sb->u.affs_sb.s_root_bh,1);
  18594. +
  18595.      if (sb->u.affs_sb.s_flags & SF_PREFIX)
  18596.          kfree(sb->u.affs_sb.s_prefix);
  18597.      kfree(sb->u.affs_sb.s_bitmap);
  18598. @@ -62,15 +63,24 @@
  18599.  static void
  18600.  affs_write_super(struct super_block *sb)
  18601.  {
  18602. -    int     i, clean = 2;
  18603. +    int             i, clean = 2;
  18604.  
  18605. +    if ((sb->u.affs_sb.s_flags & SF_USE_MP) && !sb->u.affs_sb.s_uid && sb->s_covered) {
  18606. +        sb->s_mounted->i_uid = sb->u.affs_sb.s_uid = sb->s_covered->i_uid;
  18607. +        sb->s_mounted->i_gid = sb->u.affs_sb.s_gid = sb->s_covered->i_gid;
  18608. +        sb->u.affs_sb.s_flags &= ~SF_USE_MP;
  18609. +    }
  18610.      if (!(sb->s_flags & MS_RDONLY)) {
  18611. +        lock_super(sb);
  18612.          for (i = 0, clean = 1; i < sb->u.affs_sb.s_bm_count; i++) {
  18613. -            if (buffer_dirty(sb->u.affs_sb.s_bitmap[i].bm_bh)) {
  18614. -                clean = 0;
  18615. -                break;
  18616. +            if (sb->u.affs_sb.s_bitmap[i].bm_bh) {
  18617. +                if (buffer_dirty(sb->u.affs_sb.s_bitmap[i].bm_bh)) {
  18618. +                    clean = 0;
  18619. +                    break;
  18620. +                }
  18621.              }
  18622.          }
  18623. +        unlock_super(sb);
  18624.          ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = htonl(clean);
  18625.          secs_to_datestamp(CURRENT_TIME,
  18626.                    &ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered);
  18627. @@ -108,7 +118,6 @@
  18628.      return dir->u.affs_i.i_parent;
  18629.  }
  18630.  
  18631. -
  18632.  static int
  18633.  parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, int *root,
  18634.          int *blocksize, char **prefix, char *volume, unsigned long *mount_opts)
  18635. @@ -140,6 +149,13 @@
  18636.              }
  18637.              *mount_opts |= SF_IMMUTABLE;
  18638.          }
  18639. +        if (!strcmp(this_char,"usemp")) {
  18640. +            if (value) {
  18641. +                printk("AFFS: option usemp does not take an argument\n");
  18642. +                return 0;
  18643. +            }
  18644. +            *mount_opts |= SF_USE_MP;
  18645. +        }
  18646.          else if (!strcmp(this_char,"verbose")) {
  18647.              if (value) {
  18648.                  printk("AFFS: option verbose does not take an argument\n");
  18649. @@ -251,6 +267,10 @@
  18650.      return 1;
  18651.  }
  18652.  
  18653. +/* This function definately needs to be split up. Some fine day I'll
  18654. + * hopefully have the guts to do so. Until then: sorry for the mess.
  18655. + */
  18656. +
  18657.  struct super_block *
  18658.  affs_read_super(struct super_block *s,void *data, int silent)
  18659.  {
  18660. @@ -259,26 +279,26 @@
  18661.      kdev_t             dev = s->s_dev;
  18662.      int             root_block;
  18663.      int             size;
  18664. -    ULONG             chksum;
  18665. -    ULONG            *bm;
  18666. -    LONG             ptype, stype;
  18667. -    int             mapidx = 0;
  18668. +    __u32             chksum;
  18669. +    __u32            *bm;
  18670. +    int             ptype, stype;
  18671. +    int             mapidx;
  18672.      int             num_bm;
  18673. -    int             i;
  18674. +    int             i, j;
  18675.      int             key;
  18676.      int             blocksize;
  18677.      uid_t             uid;
  18678.      gid_t             gid;
  18679. -    int             mode, reserved;
  18680. -    int             zm_size;
  18681. +    int             reserved;
  18682. +    int             az_no;
  18683.      unsigned long         mount_flags;
  18684. -    ULONG             offset;
  18685. +    unsigned long         offset;
  18686.  
  18687. -    pr_debug("affs_read_super(%s)\n",(const char *)data);
  18688. +    pr_debug("affs_read_super(%s)\n",data ? (const char *)data : "no options");
  18689.  
  18690.      MOD_INC_USE_COUNT;
  18691.  
  18692. -    if (!parse_options(data,&uid,&gid,&mode,&reserved,&root_block,
  18693. +    if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
  18694.          &blocksize,&s->u.affs_sb.s_prefix,s->u.affs_sb.s_volume,&mount_flags)) {
  18695.          s->s_dev = 0;
  18696.          printk("AFFS: error parsing options.\n");
  18697. @@ -292,13 +312,15 @@
  18698.       * blocks, we will have to change it.
  18699.       */
  18700.  
  18701. -    size                      = 2 * blk_size[MAJOR(dev)][MINOR(dev)];
  18702. -    s->u.affs_sb.s_bitmap     = NULL;
  18703. -    s->u.affs_sb.s_root_bh    = NULL;
  18704. -    s->u.affs_sb.s_flags      = mount_flags;
  18705. -    s->u.affs_sb.s_mode       = mode;
  18706. -    s->u.affs_sb.s_uid        = uid;
  18707. -    s->u.affs_sb.s_gid        = gid;
  18708. +    size = blksize_size[MAJOR(dev)][MINOR(dev)];
  18709. +    size = (size ? size : BLOCK_SIZE) / 512 * blk_size[MAJOR(dev)][MINOR(dev)];
  18710. +
  18711. +    s->u.affs_sb.s_bitmap  = NULL;
  18712. +    s->u.affs_sb.s_root_bh = NULL;
  18713. +    s->u.affs_sb.s_flags   = mount_flags;
  18714. +    s->u.affs_sb.s_mode    = i;
  18715. +    s->u.affs_sb.s_uid     = uid;
  18716. +    s->u.affs_sb.s_gid     = gid;
  18717.  
  18718.      if (size == 0) {
  18719.          s->s_dev = 0;
  18720. @@ -320,15 +342,12 @@
  18721.          num_bm = 4096;
  18722.      }
  18723.      for (blocksize = chksum; blocksize <= num_bm; blocksize <<= 1, size >>= 1) {
  18724. -            if (root_block < 0){
  18725. -            if (MAJOR(dev) == FLOPPY_MAJOR)
  18726. -                s->u.affs_sb.s_root_block = size/4;
  18727. -            else
  18728. +        if (root_block < 0)
  18729.              s->u.affs_sb.s_root_block = (reserved + size - 1) / 2;
  18730. -        }else
  18731. +        else
  18732.              s->u.affs_sb.s_root_block = root_block;
  18733.          pr_debug("Trying bs=%d bytes, root at %d, size=%d blocks (%d reserved)\n",
  18734. -            blocksize,s->u.affs_sb.s_root_block,size,reserved);
  18735. +             blocksize,s->u.affs_sb.s_root_block,size,reserved);
  18736.          set_blocksize(dev,blocksize);
  18737.          bh = affs_bread(dev,s->u.affs_sb.s_root_block,blocksize);
  18738.          if (!bh) {
  18739. @@ -360,7 +379,7 @@
  18740.      /* Find out which kind of FS we have */
  18741.      bb = affs_bread(dev,0,s->s_blocksize);
  18742.      if (bb) {
  18743. -        chksum = htonl(*(ULONG *)bb->b_data);
  18744. +        chksum = htonl(*(__u32 *)bb->b_data);
  18745.          switch (chksum) {
  18746.              case MUFS_FS:
  18747.              case MUFS_INTLFFS:
  18748. @@ -422,20 +441,28 @@
  18749.          goto out;
  18750.      }
  18751.  
  18752. -    /* Allocate space for bitmap pointers and read the bitmap */
  18753. +    /* Allocate space for bitmaps, zones and others */
  18754.  
  18755. -    size    = s->u.affs_sb.s_partition_size - reserved;
  18756. -    num_bm  = (size + s->s_blocksize * 8 - 32 - 1) / (s->s_blocksize * 8 - 32);
  18757. -    zm_size = (num_bm *  (1 << (s->s_blocksize_bits - 8)) + 7) / 8;
  18758. -    ptype   = num_bm * sizeof(struct affs_bm_info) + zm_size +
  18759. -          MAX_ZONES * sizeof(struct affs_zone);
  18760. +    size   = s->u.affs_sb.s_partition_size - reserved;
  18761. +    num_bm = (size + s->s_blocksize * 8 - 32 - 1) / (s->s_blocksize * 8 - 32);
  18762. +    az_no  = (size + AFFS_ZONE_SIZE - 1) / (AFFS_ZONE_SIZE - 32);
  18763. +    ptype  = num_bm * sizeof(struct affs_bm_info) + 
  18764. +         az_no * sizeof(struct affs_alloc_zone) +
  18765. +         MAX_ZONES * sizeof(struct affs_zone);
  18766. +    pr_debug("num_bm=%d, az_no=%d, sum=%d\n",num_bm,az_no,ptype);
  18767.      if (!(s->u.affs_sb.s_bitmap = kmalloc(ptype,GFP_KERNEL))) {
  18768. -        printk("AFFS: Can't get memory for bitmap info.\n");
  18769. +        printk("AFFS: Not enough memory.\n");
  18770.          goto out;
  18771.      }
  18772.      memset(s->u.affs_sb.s_bitmap,0,ptype);
  18773.  
  18774. -    if( (ULONG)((UBYTE *)bh->b_data + s->s_blocksize - 200) == 0 ) {
  18775. +    s->u.affs_sb.s_zones   = (struct affs_zone *)&s->u.affs_sb.s_bitmap[num_bm];
  18776. +    s->u.affs_sb.s_alloc   = (struct affs_alloc_zone *)&s->u.affs_sb.s_zones[MAX_ZONES];
  18777. +    s->u.affs_sb.s_num_az  = az_no;
  18778. +
  18779. +    mapidx = 0;
  18780. +
  18781. +    if (ROOT_END_S(bh->b_data,s)->bm_flag == 0) {
  18782.          if (!(s->s_flags & MS_RDONLY)) {
  18783.              printk("AFFS: Bitmap invalid - mounting %s read only.\n",kdevname(dev));
  18784.              s->s_flags |= MS_RDONLY;
  18785. @@ -445,14 +472,17 @@
  18786.          goto nobitmap;
  18787.      }
  18788.  
  18789. -    pr_debug("AFFS: %d bitmap blocks\n",num_bm);
  18790. +    /* The following section is ugly, I know. Especially because of the
  18791. +     * reuse of some variables that are not named properly.
  18792. +     */
  18793.  
  18794.      key    = root_block;
  18795.      ptype  = s->s_blocksize / 4 - 49;
  18796.      stype  = ptype + 25;
  18797.      offset = s->u.affs_sb.s_reserved;
  18798. +    az_no  = 0;
  18799.      while (bh) {
  18800. -        bm = (ULONG *)bh->b_data;
  18801. +        bm = (__u32 *)bh->b_data;
  18802.          for (i = ptype; i < stype && bm[i]; i++, mapidx++) {
  18803.              if (mapidx >= num_bm) {
  18804.                  printk("AFFS: Not enough bitmap space!?\n");
  18805. @@ -460,21 +490,22 @@
  18806.              }
  18807.              bb = affs_bread(s->s_dev,htonl(bm[i]),s->s_blocksize);
  18808.              if (bb) {
  18809. -                if (affs_checksum_block(s->s_blocksize,bb->b_data,NULL,NULL) /*&&
  18810. -                    !(s->s_flags & MS_RDONLY)*/) {
  18811. +                if (affs_checksum_block(s->s_blocksize,bb->b_data,NULL,NULL) &&
  18812. +                    !(s->s_flags & MS_RDONLY)) {
  18813.                      printk("AFFS: Bitmap (%d,key=%lu) invalid - "
  18814.                             "mounting %s read only.\n",mapidx,htonl(bm[i]),
  18815.                          kdevname(dev));
  18816.                      s->s_flags |= MS_RDONLY;
  18817.                  }
  18818. +                /* Mark unused bits in the last word as allocated */
  18819.                  if (size <= s->s_blocksize * 8 - 32) {    /* last bitmap */
  18820.                      ptype = size / 32 + 1;        /* word number */
  18821.                      key   = size & 0x1F;        /* used bits */
  18822.                      if (key) {
  18823.                          chksum = ntohl(0x7FFFFFFF >> (31 - key));
  18824. -                        ((ULONG *)bb->b_data)[ptype] &= chksum;
  18825. +                        ((__u32 *)bb->b_data)[ptype] &= chksum;
  18826.                          affs_fix_checksum(s->s_blocksize,bb->b_data,0);
  18827. -                        /* no need to mark buffer as dirty */
  18828. +                        mark_buffer_dirty(bb,1);
  18829.                      }
  18830.                      ptype = (size + 31) & ~0x1F;
  18831.                      size  = 0;
  18832. @@ -485,11 +516,19 @@
  18833.                      size -= ptype;
  18834.                  }
  18835.                  s->u.affs_sb.s_bitmap[mapidx].bm_firstblk = offset;
  18836. -                s->u.affs_sb.s_bitmap[mapidx].bm_size     = ptype;
  18837. -                s->u.affs_sb.s_bitmap[mapidx].bm_bh       = bb;
  18838. -                s->u.affs_sb.s_bitmap[mapidx].bm_free     =
  18839. -                        affs_count_free_bits(ptype / 8,bb->b_data + 4);
  18840. +                s->u.affs_sb.s_bitmap[mapidx].bm_bh       = NULL;
  18841. +                s->u.affs_sb.s_bitmap[mapidx].bm_key      = htonl(bm[i]);
  18842. +                s->u.affs_sb.s_bitmap[mapidx].bm_count    = 0;
  18843.                  offset += ptype;
  18844. +
  18845. +                for (j = 0; ptype > 0; j++, az_no++, ptype -= key) {
  18846. +                    key = MIN(ptype,AFFS_ZONE_SIZE);    /* size in bits */
  18847. +                    s->u.affs_sb.s_alloc[az_no].az_size = key / 32;
  18848. +                    s->u.affs_sb.s_alloc[az_no].az_free =
  18849. +                        affs_count_free_bits(key / 8,bb->b_data +
  18850. +                                     j * (AFFS_ZONE_SIZE / 8) + 4);
  18851. +                }
  18852. +                affs_brelse(bb);
  18853.              } else {
  18854.                  printk("AFFS: Can't read bitmap.\n");
  18855.                  goto out;
  18856. @@ -511,18 +550,15 @@
  18857.          printk("AFFS: Got only %d bitmap blocks, expected %d\n",mapidx,num_bm);
  18858.          goto out;
  18859.      }
  18860. -    s->u.affs_sb.s_num_zones = ((num_bm - 1) << (s->s_blocksize_bits - 8)) +
  18861. -                   (s->u.affs_sb.s_bitmap[num_bm - 1].bm_size + 2047) / 2048;
  18862.  nobitmap:
  18863.      s->u.affs_sb.s_bm_count  = mapidx;
  18864. -    s->u.affs_sb.s_zones     = (struct affs_zone *)&s->u.affs_sb.s_bitmap[num_bm];
  18865. -    s->u.affs_sb.s_zonemap   = (char *)&s->u.affs_sb.s_zones[MAX_ZONES];
  18866.  
  18867.      /* set up enough so that it can read an inode */
  18868.  
  18869.      s->s_dev       = dev;
  18870.      s->s_op        = &affs_sops;
  18871.      s->s_mounted   = iget(s,root_block);
  18872. +    s->s_dirt      = 1;
  18873.      unlock_super(s);
  18874.  
  18875.      if (!(s->s_mounted)) {
  18876. @@ -532,7 +568,7 @@
  18877.          return NULL;
  18878.      }
  18879.  
  18880. -    /* If the fs is mounted r/w, create data zones, else free bitmaps. */
  18881. +    /* create data zones if the fs is mounted r/w */
  18882.  
  18883.      if (!(s->s_flags & MS_RDONLY)) {
  18884.          ROOT_END(s->u.affs_sb.s_root_bh->b_data,s->s_mounted)->bm_flag = 0;
  18885. @@ -541,13 +577,7 @@
  18886.          affs_fix_checksum(s->s_blocksize,s->u.affs_sb.s_root_bh->b_data,5);
  18887.          mark_buffer_dirty(s->u.affs_sb.s_root_bh,1);
  18888.          affs_make_zones(s);
  18889. -    } else {
  18890. -        for (i = 0; i < s->u.affs_sb.s_bm_count; i++) {
  18891. -            affs_brelse(s->u.affs_sb.s_bitmap[i].bm_bh);
  18892. -            s->u.affs_sb.s_bitmap[i].bm_bh = NULL;
  18893. -        }
  18894.      }
  18895. -        
  18896.  
  18897.      pr_debug("AFFS: s_flags=%lX\n",s->s_flags);
  18898.      return s;
  18899. @@ -555,11 +585,8 @@
  18900.   out: /* Kick out for various error conditions */
  18901.      affs_brelse (bh);
  18902.      affs_brelse(s->u.affs_sb.s_root_bh);
  18903. -    if (s->u.affs_sb.s_bitmap) {
  18904. -        for (i = 0; i < mapidx; i++)
  18905. -            affs_brelse(s->u.affs_sb.s_bitmap[i].bm_bh);
  18906. +    if (s->u.affs_sb.s_bitmap)
  18907.          kfree(s->u.affs_sb.s_bitmap);
  18908. -    }
  18909.      s->s_dev = 0;
  18910.      unlock_super(s);
  18911.      MOD_DEC_USE_COUNT;
  18912. @@ -569,7 +596,7 @@
  18913.  void
  18914.  affs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
  18915.  {
  18916. -    ULONG         free;
  18917. +    int         free;
  18918.      struct statfs     tmp;
  18919.  
  18920.      pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",sb->u.affs_sb.s_partition_size,
  18921. @@ -592,9 +619,9 @@
  18922.      struct buffer_head    *bh, *lbh;
  18923.      struct file_front    *file_front;
  18924.      struct file_end        *file_end;
  18925. -    LONG             block;
  18926. -    ULONG             prot;
  18927. -    LONG             ptype, stype;
  18928. +    int             block;
  18929. +    unsigned long         prot;
  18930. +    int             ptype, stype;
  18931.      unsigned short         id;
  18932.  
  18933.      pr_debug("AFFS: read_inode(%lu)\n",inode->i_ino);
  18934. @@ -817,7 +844,7 @@
  18935.  {
  18936.      struct inode        *inode;
  18937.      struct super_block    *sb;
  18938. -    ULONG             block;
  18939. +    int             block;
  18940.  
  18941.      if (!dir || !(inode = get_empty_inode()))
  18942.          return NULL;
  18943. @@ -863,15 +890,15 @@
  18944.  
  18945.  int
  18946.  affs_add_entry(struct inode *dir, struct inode *link, struct inode *inode,
  18947. -           const char *name, int len, LONG type)
  18948. +           const char *name, int len, int type)
  18949.  {
  18950.      struct buffer_head    *dir_bh;
  18951.      struct buffer_head    *inode_bh;
  18952.      struct buffer_head    *link_bh;
  18953. -    ULONG             hash;
  18954. +    int             hash;
  18955.  
  18956. -    pr_debug("AFFS: add_entry(dir=%lu,inode=%lu,\"%*s\",type=%ld\n",dir->i_ino,inode->i_ino,
  18957. -        len,name,type);
  18958. +    pr_debug("AFFS: add_entry(dir=%lu,inode=%lu,\"%*s\",type=%d\n",dir->i_ino,inode->i_ino,
  18959. +         len,name,type);
  18960.  
  18961.      dir_bh      = affs_bread(dir->i_dev,dir->i_ino,AFFS_I2BSIZE(dir));
  18962.      inode_bh    = affs_bread(inode->i_dev,inode->i_ino,AFFS_I2BSIZE(inode));
  18963. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/namei.c linux/fs/affs/namei.c
  18964. --- pre2.0.5/linux/fs/affs/namei.c    Fri May 17 15:32:17 1996
  18965. +++ linux/fs/affs/namei.c    Sun May 19 15:22:20 1996
  18966. @@ -1,7 +1,7 @@
  18967.  /*
  18968.   *  linux/fs/affs/namei.c
  18969.   *
  18970. - *  (c) 1996  Hans-Joachim Widmaier - rewritten
  18971. + *  (c) 1996  Hans-Joachim Widmaier - Rewritten
  18972.   *
  18973.   *  (C) 1993  Ray Burr - Modified for Amiga FFS filesystem.
  18974.   *
  18975. @@ -10,12 +10,12 @@
  18976.  
  18977.  #include <linux/sched.h>
  18978.  #include <linux/affs_fs.h>
  18979. -#include <linux/amigaffs.h>
  18980.  #include <linux/kernel.h>
  18981.  #include <linux/string.h>
  18982.  #include <linux/stat.h>
  18983.  #include <linux/fcntl.h>
  18984.  #include <linux/locks.h>
  18985. +#include <linux/amigaffs.h>
  18986.  #include <asm/segment.h>
  18987.  
  18988.  #include <linux/errno.h>
  18989. @@ -100,7 +100,7 @@
  18990.  {
  18991.      struct buffer_head *bh;
  18992.      int     intl;
  18993. -    ULONG     key;
  18994. +    int     key;
  18995.  
  18996.      pr_debug("AFFS: find_entry(%.*s)=\n",namelen,name);
  18997.  
  18998. @@ -137,7 +137,6 @@
  18999.              break;
  19000.          key = htonl(FILE_END(bh->b_data,dir)->hash_chain);
  19001.      }
  19002. -    pr_debug("%lu\n",key);
  19003.      *ino = key;
  19004.      return bh;
  19005.  }
  19006. @@ -379,7 +378,6 @@
  19007.      char             c, lc;
  19008.  
  19009.      pr_debug("AFFS: symlink(%lu,\"%.*s\" -> \"%s\")\n",dir->i_ino,len,name,symname);
  19010. -    printk("AFFS: symlink(%lu,\"%.*s\" -> \"%s\")\n",dir->i_ino,len,name,symname);
  19011.      
  19012.      maxlen = 4 * AFFS_I2HSIZE(dir) - 1;
  19013.      inode  = affs_new_inode(dir);
  19014. @@ -548,7 +546,7 @@
  19015.      int             retval;
  19016.  
  19017.      pr_debug("AFFS: rename(old=%lu,\"%*s\" to new=%lu,\"%*s\")\n",old_dir->i_ino,old_len,old_name,
  19018. -        new_dir->i_ino,new_len,new_name);
  19019. +         new_dir->i_ino,new_len,new_name);
  19020.      
  19021.      if (new_len > 30)
  19022.          new_len = 30;
  19023. @@ -607,7 +605,7 @@
  19024.          if (affs_parent_ino(old_inode) != old_dir->i_ino)
  19025.              goto end_rename;
  19026.      }
  19027. -    /* Unlink destination if existant */
  19028. +    /* Unlink destination if existent */
  19029.      if (new_inode) {
  19030.          if ((retval = affs_fix_hash_pred(new_dir,affs_hash_name(new_name,new_len,
  19031.                                           AFFS_I2FSTYPE(new_dir),AFFS_I2HSIZE(new_dir)) + 6,
  19032. @@ -652,8 +650,8 @@
  19033.  int
  19034.  affs_fixup(struct buffer_head *bh, struct inode *inode)
  19035.  {
  19036. -    ULONG             key, link_key;
  19037. -    LONG             type;
  19038. +    int             key, link_key;
  19039. +    int             type;
  19040.      struct buffer_head    *nbh;
  19041.      struct inode        *ofinode;
  19042.  
  19043. diff -u --recursive --new-file pre2.0.5/linux/fs/affs/symlink.c linux/fs/affs/symlink.c
  19044. --- pre2.0.5/linux/fs/affs/symlink.c    Fri May 17 15:32:17 1996
  19045. +++ linux/fs/affs/symlink.c    Sun May 19 15:22:20 1996
  19046. @@ -1,7 +1,7 @@
  19047.  /*
  19048.   *  linux/fs/affs/symlink.c
  19049.   *
  19050. - *  1995  Hans-Joachim Widmaier - modified for affs.
  19051. + *  1995  Hans-Joachim Widmaier - Modified for affs.
  19052.   *
  19053.   *  Copyright (C) 1991, 1992  Linus Torvalds
  19054.   *
  19055. diff -u --recursive --new-file pre2.0.5/linux/fs/buffer.c linux/fs/buffer.c
  19056. --- pre2.0.5/linux/fs/buffer.c    Tue May  7 16:22:36 1996
  19057. +++ linux/fs/buffer.c    Fri May 17 18:30:40 1996
  19058. @@ -1270,6 +1270,8 @@
  19059.             deemed complete once all buffers have been visited
  19060.             (b_count==0) and are now unlocked. */
  19061.      bh->b_count--;
  19062. +    if (!test_bit(BH_Uptodate, &bh->b_state))
  19063. +        set_bit(PG_error, &page->flags);
  19064.      for (tmp = bh; tmp=tmp->b_this_page, tmp!=bh; ) {
  19065.          if (test_bit(BH_Lock, &tmp->b_state) || tmp->b_count)
  19066.              return;
  19067. diff -u --recursive --new-file pre2.0.5/linux/fs/isofs/rock.c linux/fs/isofs/rock.c
  19068. --- pre2.0.5/linux/fs/isofs/rock.c    Wed May 15 11:01:15 1996
  19069. +++ linux/fs/isofs/rock.c    Sat May 18 11:15:09 1996
  19070. @@ -367,7 +367,7 @@
  19071.         }
  19072.  
  19073.         /*
  19074. -        * If this component record isnt continued, then append a '/'.
  19075. +        * If this component record isn't continued, then append a '/'.
  19076.          */
  19077.         if(   (!rootflag)
  19078.           && ((oldslp->flags & 1) == 0) ) inode->i_size += 1;
  19079. @@ -529,7 +529,7 @@
  19080.       }
  19081.  
  19082.       /*
  19083. -      * If this component record isnt continued, then append a '/'.
  19084. +      * If this component record isn't continued, then append a '/'.
  19085.        */
  19086.       if(   (!rootflag)
  19087.          && ((oldslp->flags & 1) == 0) ) strcat(rpnt,"/");
  19088. diff -u --recursive --new-file pre2.0.5/linux/include/asm-alpha/unaligned.h linux/include/asm-alpha/unaligned.h
  19089. --- pre2.0.5/linux/include/asm-alpha/unaligned.h    Fri Jun  2 13:51:17 1995
  19090. +++ linux/include/asm-alpha/unaligned.h    Sun May 19 13:29:22 1996
  19091. @@ -1,10 +1,26 @@
  19092.  #ifndef __ALPHA_UNALIGNED_H
  19093.  #define __ALPHA_UNALIGNED_H
  19094.  
  19095. +/* 
  19096. + * The main single-value unaligned transfer routines.
  19097. + */
  19098. +#define get_unaligned(ptr) \
  19099. +    ((__typeof__(*(ptr)))__get_unaligned((ptr), sizeof(*(ptr))))
  19100. +#define put_unaligned(x,ptr) \
  19101. +    __put_unaligned((unsigned long)(x), (ptr), sizeof(*(ptr)))
  19102. +
  19103. +/*
  19104. + * This is a silly but good way to make sure that
  19105. + * the get/put functions are indeed always optimized,
  19106. + * and that we use the correct sizes.
  19107. + */
  19108. +extern void bad_unaligned_access_length(void);
  19109. +
  19110.  /*
  19111. - * inline functions to do unaligned accesses.. See entUna in traps.c
  19112. + * Elemental unaligned loads 
  19113.   */
  19114. -extern inline unsigned long ldq_u(unsigned long * r11)
  19115. +
  19116. +extern inline unsigned long __uldq(const unsigned long * r11)
  19117.  {
  19118.      unsigned long r1,r2;
  19119.      __asm__("ldq_u %0,%3\n\t"
  19120. @@ -15,11 +31,11 @@
  19121.          :"=&r" (r1), "=&r" (r2)
  19122.          :"r" (r11),
  19123.           "m" (*r11),
  19124. -         "m" (*(unsigned long *)(7+(char *) r11)));
  19125. +         "m" (*(const unsigned long *)(7+(char *) r11)));
  19126.      return r1;
  19127.  }
  19128.  
  19129. -extern inline unsigned long ldl_u(unsigned int * r11)
  19130. +extern inline unsigned long __uldl(const unsigned int * r11)
  19131.  {
  19132.      unsigned long r1,r2;
  19133.      __asm__("ldq_u %0,%3\n\t"
  19134. @@ -30,11 +46,11 @@
  19135.          :"=&r" (r1), "=&r" (r2)
  19136.          :"r" (r11),
  19137.           "m" (*r11),
  19138. -         "m" (*(unsigned long *)(3+(char *) r11)));
  19139. +         "m" (*(const unsigned long *)(3+(char *) r11)));
  19140.      return r1;
  19141.  }
  19142.  
  19143. -extern inline unsigned long ldw_u(unsigned short * r11)
  19144. +extern inline unsigned long __uldw(const unsigned short * r11)
  19145.  {
  19146.      unsigned long r1,r2;
  19147.      __asm__("ldq_u %0,%3\n\t"
  19148. @@ -45,11 +61,15 @@
  19149.          :"=&r" (r1), "=&r" (r2)
  19150.          :"r" (r11),
  19151.           "m" (*r11),
  19152. -         "m" (*(unsigned long *)(1+(char *) r11)));
  19153. +         "m" (*(const unsigned long *)(1+(char *) r11)));
  19154.      return r1;
  19155.  }
  19156.  
  19157. -extern inline void stq_u(unsigned long r5, unsigned long * r11)
  19158. +/*
  19159. + * Elemental unaligned stores 
  19160. + */
  19161. +
  19162. +extern inline void __ustq(unsigned long r5, unsigned long * r11)
  19163.  {
  19164.      unsigned long r1,r2,r3,r4;
  19165.  
  19166. @@ -69,7 +89,7 @@
  19167.          :"r" (r5), "r" (r11));
  19168.  }
  19169.  
  19170. -extern inline void stl_u(unsigned long r5, unsigned int * r11)
  19171. +extern inline void __ustl(unsigned long r5, unsigned int * r11)
  19172.  {
  19173.      unsigned long r1,r2,r3,r4;
  19174.  
  19175. @@ -89,7 +109,7 @@
  19176.          :"r" (r5), "r" (r11));
  19177.  }
  19178.  
  19179. -extern inline void stw_u(unsigned long r5, unsigned short * r11)
  19180. +extern inline void __ustw(unsigned long r5, unsigned short * r11)
  19181.  {
  19182.      unsigned long r1,r2,r3,r4;
  19183.  
  19184. @@ -107,6 +127,48 @@
  19185.           "=m" (*(unsigned long *)(1+(char *) r11)),
  19186.           "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
  19187.          :"r" (r5), "r" (r11));
  19188. +}
  19189. +
  19190. +extern inline unsigned long __get_unaligned(const void *ptr, size_t size)
  19191. +{
  19192. +    unsigned long val;
  19193. +    switch (size) {
  19194. +          case 1:
  19195. +        val = *(const unsigned char *)ptr;
  19196. +        break;
  19197. +          case 2:
  19198. +        val = __uldw((const unsigned short *)ptr);
  19199. +        break;
  19200. +          case 4:
  19201. +        val = __uldl((const unsigned int *)ptr);
  19202. +        break;
  19203. +          case 8:
  19204. +        val = __uldq((const unsigned long *)ptr);
  19205. +        break;
  19206. +          default:
  19207. +        bad_unaligned_access_length();
  19208. +    }
  19209. +    return val;
  19210. +}
  19211. +
  19212. +extern inline void __put_unaligned(unsigned long val, void *ptr, size_t size)
  19213. +{
  19214. +    switch (size) {
  19215. +          case 1:
  19216. +        *(unsigned char *)ptr = (val);
  19217. +            break;
  19218. +          case 2:
  19219. +        __ustw(val, (unsigned short *)ptr);
  19220. +        break;
  19221. +          case 4:
  19222. +        __ustl(val, (unsigned int *)ptr);
  19223. +        break;
  19224. +          case 8:
  19225. +        __ustq(val, (unsigned long *)ptr);
  19226. +        break;
  19227. +          default:
  19228. +            bad_unaligned_access_length();
  19229. +    }
  19230.  }
  19231.  
  19232.  #endif
  19233. diff -u --recursive --new-file pre2.0.5/linux/include/asm-generic/unaligned.h linux/include/asm-generic/unaligned.h
  19234. --- pre2.0.5/linux/include/asm-generic/unaligned.h    Thu Jan  1 02:00:00 1970
  19235. +++ linux/include/asm-generic/unaligned.h    Sun May 19 13:29:22 1996
  19236. @@ -0,0 +1,20 @@
  19237. +#ifndef _ASM_GENERIC_UNALIGNED_H_
  19238. +#define _ASM_GENERIC_UNALIGNED_H_
  19239. +
  19240. +/*
  19241. + * For the benefit of those who are trying to port Linux to another
  19242. + * architecture, here are some C-language equivalents. 
  19243. + */
  19244. +
  19245. +#include <asm/string.h>
  19246. +
  19247. +
  19248. +#define get_unaligned(ptr) \
  19249. +  ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
  19250. +
  19251. +#define put_unaligned(val, ptr)                \
  19252. +  ({ __typeof__(*(ptr)) __tmp = (val);            \
  19253. +     memcpy((ptr), &__tmp, sizeof(*(ptr)));        \
  19254. +     (void)0; })
  19255. +
  19256. +#endif /* _ASM_GENERIC_UNALIGNED_H */
  19257. diff -u --recursive --new-file pre2.0.5/linux/include/asm-i386/unaligned.h linux/include/asm-i386/unaligned.h
  19258. --- pre2.0.5/linux/include/asm-i386/unaligned.h    Thu Jan  1 02:00:00 1970
  19259. +++ linux/include/asm-i386/unaligned.h    Sun May 19 15:47:57 1996
  19260. @@ -0,0 +1,16 @@
  19261. +#ifndef __I386_UNALIGNED_H
  19262. +#define __I386_UNALIGNED_H
  19263. +
  19264. +/*
  19265. + * The i386 can do unaligned accesses itself. 
  19266. + *
  19267. + * The strange macros are there to make sure these can't
  19268. + * be misused in a way that makes them not work on other
  19269. + * architectures where unaligned accesses aren't as simple.
  19270. + */
  19271. +
  19272. +#define get_unaligned(ptr) (*(ptr))
  19273. +
  19274. +#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
  19275. +
  19276. +#endif
  19277. diff -u --recursive --new-file pre2.0.5/linux/include/linux/affs_fs.h linux/include/linux/affs_fs.h
  19278. --- pre2.0.5/linux/include/linux/affs_fs.h    Fri May 17 15:32:18 1996
  19279. +++ linux/include/linux/affs_fs.h    Sun May 19 15:22:20 1996
  19280. @@ -5,7 +5,6 @@
  19281.   */
  19282.  
  19283.  #include <linux/types.h>
  19284. -#include <linux/amigaffs.h>
  19285.  
  19286.  #define AFFS_SUPER_MAGIC 0xadff
  19287.  
  19288. @@ -21,29 +20,37 @@
  19289.  /* Get the fs type given an inode */
  19290.  #define AFFS_I2FSTYPE(inode) ((inode)->i_sb->u.affs_sb.s_flags & SF_INTL)
  19291.  
  19292. +struct DateStamp
  19293. +{
  19294. +  __u32 ds_Days;
  19295. +  __u32 ds_Minute;
  19296. +  __u32 ds_Tick;
  19297. +};
  19298. +
  19299. +
  19300.  /* --- Prototypes -----------------------------------------------------------------------------    */
  19301.  
  19302.  /* amigaffs.c */
  19303.  
  19304.  extern int           affs_get_key_entry(int bsize, void *data, int entry_pos);
  19305. -extern int           affs_find_next_hash_entry(int bsize, void *dir_data, __u32 *hash_pos);
  19306. +extern int           affs_find_next_hash_entry(int bsize, void *dir_data, int *hash_pos);
  19307.  extern int           affs_get_file_name(int bsize, void *fh_data, char **name);
  19308. -extern __u32           affs_checksum_block(int bsize, void *data, __s32 *ptype, __s32 *stype);
  19309. +extern unsigned int       affs_checksum_block(int bsize, void *data, int *ptype, int *stype);
  19310.  extern void           affs_fix_checksum(int bsize, void *data, int cspos);
  19311.  extern void           secs_to_datestamp(int secs, struct DateStamp *ds);
  19312. -extern int           prot_to_mode(__u32 prot);
  19313. -extern __u32           mode_to_prot(int mode);
  19314. +extern int           prot_to_mode(unsigned int prot);
  19315. +extern unsigned int       mode_to_prot(int mode);
  19316.  extern int           affs_fix_hash_pred(struct inode *startino, int startoffset,
  19317. -                           __s32 key, __s32 newkey);
  19318. -extern int           affs_fix_link_pred(struct inode *startino, __s32 key, __s32 newkey);
  19319. +                           int key, int newkey);
  19320. +extern int           affs_fix_link_pred(struct inode *startino, int key, int newkey);
  19321.  
  19322.  /* bitmap. c */
  19323.  
  19324.  extern int           affs_count_free_blocks(struct super_block *s);
  19325. -extern int           affs_count_free_bits(int blocksize, const __u8 *data);
  19326. -extern void           affs_free_block(struct super_block *sb, __s32 block);
  19327. -extern __s32           affs_new_header(struct inode *inode);
  19328. -extern __s32           affs_new_data(struct inode *inode);
  19329. +extern int           affs_count_free_bits(int blocksize, const char *data);
  19330. +extern void           affs_free_block(struct super_block *sb, int block);
  19331. +extern int           affs_new_header(struct inode *inode);
  19332. +extern int           affs_new_data(struct inode *inode);
  19333.  extern void           affs_make_zones(struct super_block *sb);
  19334.  
  19335.  /* namei.c */
  19336. @@ -78,7 +85,7 @@
  19337.  extern void           affs_put_inode(struct inode *);
  19338.  extern struct inode      *affs_new_inode(const struct inode *dir);
  19339.  extern int           affs_add_entry(struct inode *dir, struct inode *link, struct inode *inode,
  19340. -                      const char *name, int len, __s32 type);
  19341. +                      const char *name, int len, int type);
  19342.  
  19343.  /* file.c */
  19344.  
  19345. @@ -101,5 +108,4 @@
  19346.  extern struct inode_operations     affs_blkdev_inode_operations;
  19347.  
  19348.  extern int init_affs_fs(void);
  19349. -
  19350.  #endif
  19351. diff -u --recursive --new-file pre2.0.5/linux/include/linux/affs_fs_i.h linux/include/linux/affs_fs_i.h
  19352. --- pre2.0.5/linux/include/linux/affs_fs_i.h    Tue May  7 16:22:38 1996
  19353. +++ linux/include/linux/affs_fs_i.h    Sun May 19 15:22:20 1996
  19354. @@ -1,24 +1,25 @@
  19355.  #ifndef _AFFS_FS_I
  19356.  #define _AFFS_FS_I
  19357.  
  19358. -#define EXT_CACHE_SIZE    16
  19359. +#define EXT_CACHE_SIZE    12
  19360.  #define MAX_PREALLOC    8    /* MUST be a power of 2 */
  19361.  
  19362.  /*
  19363.   * affs fs inode data in memory
  19364.   */
  19365.  struct affs_inode_info {
  19366. -    int i_protect;    /* unused attribute bits */
  19367. -    int i_parent;   /* parent ino */
  19368. -    int i_original;    /* if != 0, this is the key of the original */
  19369. -    __u32 i_ext[EXT_CACHE_SIZE]; /* extension block numbers */
  19370. -    __u32 i_data[MAX_PREALLOC]; /* preallocated blocks */
  19371. -    short i_max_ext; /* last known extension block */
  19372. -    short i_pa_cnt;    /* number of preallocated blocks */
  19373. -    short i_pa_next;  /* Index of next block in i_data[] */
  19374. -    short i_pa_last;  /* Index of next free slot in i_data[] */
  19375. -    short i_zone;    /* write zone */
  19376. -    unsigned char i_hlink;    /* This is a fake */
  19377. +    __u32    i_protect;        /* unused attribute bits */
  19378. +    __s32    i_parent;        /* parent ino */
  19379. +    __s32    i_original;        /* if != 0, this is the key of the original */
  19380. +    __s32    i_ext[EXT_CACHE_SIZE];    /* extension block numbers */
  19381. +    __s32    i_data[MAX_PREALLOC];    /* preallocated blocks */
  19382. +    int    i_lastblock;        /* last allocated block */
  19383. +    short    i_max_ext;        /* last known extension block */
  19384. +    short    i_pa_cnt;        /* number of preallocated blocks */
  19385. +    short    i_pa_next;        /* Index of next block in i_data[] */
  19386. +    short    i_pa_last;        /* Index of next free slot in i_data[] */
  19387. +    short    i_zone;            /* write zone */
  19388. +    unsigned char i_hlink;        /* This is a fake */
  19389.      unsigned char i_pad;
  19390.  };
  19391.  
  19392. diff -u --recursive --new-file pre2.0.5/linux/include/linux/affs_fs_sb.h linux/include/linux/affs_fs_sb.h
  19393. --- pre2.0.5/linux/include/linux/affs_fs_sb.h    Sat May 11 10:42:07 1996
  19394. +++ linux/include/linux/affs_fs_sb.h    Sun May 19 15:22:20 1996
  19395. @@ -8,24 +8,30 @@
  19396.   *
  19397.   */
  19398.  
  19399. -#include <linux/amigaffs.h>
  19400. -
  19401.  #define MAX_ZONES        8
  19402. -#define AFFS_DATA_MIN_FREE    30    /* Percentage of free blocks needed for a data zone */
  19403. -#define AFFS_HDR_MIN_FREE    10    /* Same for header blocks */
  19404. +#define AFFS_DATA_MIN_FREE    512    /* Number of free blocks in zone for data blocks */
  19405. +#define AFFS_HDR_MIN_FREE    128    /* Same for header blocks */
  19406. +#define AFFS_ZONE_SIZE        1024    /* Blocks per alloc zone, must be multiple of 32 */
  19407.  
  19408.  struct affs_bm_info {
  19409. -    struct buffer_head *bm_bh;    /* Buffer for bitmap. */
  19410. -    int bm_free;            /* Free blocks. */
  19411. -    int bm_size;            /* Size in bits, rounded to multiple of 32. */
  19412. +    struct buffer_head *bm_bh;    /* Buffer head if loaded (bm_count > 0) */
  19413.      int bm_firstblk;        /* Block number of first bit in this map */
  19414. +    int bm_key;            /* Disk block number */
  19415. +    int bm_count;            /* Usage counter */
  19416. +};
  19417. +
  19418. +struct affs_alloc_zone {
  19419. +    short az_size;            /* Size of this allocation zone in double words */
  19420. +    short az_count;            /* Number of users */
  19421. +    int az_free;            /* Free blocks in here (no. of bits) */
  19422.  };
  19423.  
  19424.  struct affs_zone {
  19425.      unsigned long z_ino;        /* Associated inode number */
  19426.      struct affs_bm_info *z_bm;    /* Zone lies in this bitmap */
  19427.      int z_start;            /* Index of first word in bitmap */
  19428. -    int z_zone_no;            /* Zone number */
  19429. +    int z_end;            /* Index of last word in zone + 1 */
  19430. +    int z_az_no;            /* Zone number */
  19431.      unsigned long z_lru_time;    /* Time of last usage */
  19432.  };
  19433.  
  19434. @@ -42,10 +48,11 @@
  19435.      struct affs_bm_info *s_bitmap;    /* Bitmap infos. */
  19436.      int s_bm_count;            /* Number of bitmap blocks. */
  19437.      int s_nextzone;            /* Next zone to look for free blocks. */
  19438. -    int s_num_zones;        /* Total number of zones. */
  19439. -    struct affs_zone *s_zones;    /* The zones themselves. */
  19440. -    char *s_zonemap;        /* Bitmap for zones. */
  19441. -    char *s_prefix;            /* Prefix for volumes and assigns. */
  19442. +    int s_num_az;            /* Total number of alloc zones. */
  19443. +    struct affs_zone *s_zones;    /* The zones themselfes. */
  19444. +    struct affs_alloc_zone *s_alloc;/* The allocation zones. */
  19445. +    char *s_zonemap;        /* Bitmap for allocation zones. */
  19446. +    char *s_prefix;            /* Prefix for volumes and assignes. */
  19447.      int s_prefix_len;        /* Length of prefix. */
  19448.      char s_volume[32];        /* Volume prefix for absolute symlinks. */
  19449.  };
  19450. diff -u --recursive --new-file pre2.0.5/linux/include/linux/affs_hardblocks.h linux/include/linux/affs_hardblocks.h
  19451. --- pre2.0.5/linux/include/linux/affs_hardblocks.h    Fri May 17 15:32:18 1996
  19452. +++ linux/include/linux/affs_hardblocks.h    Sun May 19 15:22:20 1996
  19453. @@ -3,10 +3,6 @@
  19454.  
  19455.  /* Just the needed definitions for the RDB of an Amiga HD. */
  19456.  
  19457. -#ifndef AMIGAFFS_H
  19458. -#include <linux/amigaffs.h>
  19459. -#endif
  19460. -
  19461.  struct RigidDiskBlock {
  19462.      __u32    rdb_ID;
  19463.      __u32    rdb_SummedLongs;
  19464. diff -u --recursive --new-file pre2.0.5/linux/include/linux/amigaffs.h linux/include/linux/amigaffs.h
  19465. --- pre2.0.5/linux/include/linux/amigaffs.h    Fri May 17 15:32:18 1996
  19466. +++ linux/include/linux/amigaffs.h    Sun May 19 15:22:20 1996
  19467. @@ -8,7 +8,7 @@
  19468.  
  19469.  #define GET_END_PTR(st,p,sz)         ((st *)((char *)(p)+((sz)-sizeof(st))))
  19470.  #define AFFS_GET_HASHENTRY(data,hashkey) htonl(((struct dir_front *)data)->hashtable[hashkey])
  19471. -#define AFFS_BLOCK(data,ino,blk)     ((struct file_front *)data)->blocks[AFFS_I2HSIZE(ino)-1-blk]
  19472. +#define AFFS_BLOCK(data,ino,blk)     ((struct file_front *)data)->blocks[AFFS_I2HSIZE(ino)-1-(blk)]
  19473.  
  19474.  #define FILE_END(p,i)    GET_END_PTR(struct file_end,p,AFFS_I2BSIZE(i))
  19475.  #define ROOT_END(p,i)    GET_END_PTR(struct root_end,p,AFFS_I2BSIZE(i))
  19476. @@ -29,8 +29,6 @@
  19477.  #error Endianness must be known for affs to work.
  19478.  #endif
  19479.  
  19480. -/* The following constants will be checked against the values read native */
  19481. -
  19482.  #define FS_OFS        0x444F5300
  19483.  #define FS_FFS        0x444F5301
  19484.  #define FS_INTLOFS    0x444F5302
  19485. @@ -45,13 +43,6 @@
  19486.  #define MUFS_DCOFS    0x6d754604   /* 'muF\4' */
  19487.  #define MUFS_DCFFS    0x6d754605   /* 'muF\5' */
  19488.  
  19489. -struct DateStamp
  19490. -{
  19491. -  __u32 ds_Days;
  19492. -  __u32 ds_Minute;
  19493. -  __u32 ds_Tick;
  19494. -};
  19495. -
  19496.  #define T_SHORT        2
  19497.  #define T_LIST        16
  19498.  #define T_DATA        8
  19499. @@ -66,119 +57,130 @@
  19500.  struct root_front
  19501.  {
  19502.    __s32 primary_type;
  19503. -  __u32 spare1[2];
  19504. -  __u32 hash_size;
  19505. -  __u32 spare2;
  19506. +  __s32 spare1[2];
  19507. +  __s32 hash_size;
  19508. +  __s32 spare2;
  19509.    __u32 checksum;
  19510. -  __u32 hashtable[0];
  19511. +  __s32 hashtable[0];
  19512.  };
  19513.  
  19514.  struct root_end
  19515.  {
  19516.    __s32 bm_flag;
  19517. -  __u32 bm_keys[25];
  19518. -  __u32 bm_extend;
  19519. +  __s32 bm_keys[25];
  19520. +  __s32 bm_extend;
  19521.    struct DateStamp dir_altered;
  19522.    __u8 disk_name[40];
  19523.    struct DateStamp disk_altered;
  19524.    struct DateStamp disk_made;
  19525. -  __u32 spare1[3];
  19526. +  __s32 spare1[3];
  19527.    __s32 secondary_type;
  19528.  };
  19529.  
  19530.  struct dir_front
  19531.  {
  19532.    __s32 primary_type;
  19533. -  __u32 own_key;
  19534. -  __u32 spare1[3];
  19535. +  __s32 own_key;
  19536. +  __s32 spare1[3];
  19537.    __u32 checksum;
  19538. -  __u32 hashtable[0];
  19539. +  __s32 hashtable[0];
  19540.  };
  19541.  
  19542.  struct dir_end
  19543.  {
  19544. -  __u32 spare1;
  19545. -  __u16 owner_uid;
  19546. -  __u16 owner_gid;
  19547. +  __s32 spare1;
  19548. +  __s16 owner_uid;
  19549. +  __s16 owner_gid;
  19550.    __u32 protect;
  19551. -  __u32 spare2;
  19552. +  __s32 spare2;
  19553.    __u8 comment[92];
  19554.    struct DateStamp created;
  19555.    __u8 dir_name[32];
  19556. -  __u32 spare3[2];
  19557. -  __u32 link_chain;
  19558. -  __u32 spare4[5];
  19559. -  __u32 hash_chain;
  19560. -  __u32 parent;
  19561. -  __u32 spare5;
  19562. +  __s32 spare3[2];
  19563. +  __s32 link_chain;
  19564. +  __s32 spare4[5];
  19565. +  __s32 hash_chain;
  19566. +  __s32 parent;
  19567. +  __s32 spare5;
  19568.    __s32 secondary_type;
  19569.  };
  19570.  
  19571.  struct file_front
  19572.  {
  19573.    __s32 primary_type;
  19574. -  __u32 own_key;
  19575. -  __u32 block_count;
  19576. -  __u32 unknown1;
  19577. -  __u32 first_data;
  19578. +  __s32 own_key;
  19579. +  __s32 block_count;
  19580. +  __s32 unknown1;
  19581. +  __s32 first_data;
  19582.    __u32 checksum;
  19583. -  __u32 blocks[0];
  19584. +  __s32 blocks[0];
  19585.  };
  19586.  
  19587.  struct file_end
  19588.  {
  19589. -  __u32 spare1;
  19590. -  __u16 owner_uid;
  19591. -  __u16 owner_gid;
  19592. +  __s32 spare1;
  19593. +  __s16 owner_uid;
  19594. +  __s16 owner_gid;
  19595.    __u32 protect;
  19596. -  __u32 byte_size;
  19597. +  __s32 byte_size;
  19598.    __u8 comment[92];
  19599.    struct DateStamp created;
  19600.    __u8 file_name[32];
  19601. -  __u32 spare2;
  19602. -  __u32 original;    /* not really in file_end */
  19603. -  __u32 link_chain;
  19604. -  __u32 spare3[5];
  19605. -  __u32 hash_chain;
  19606. -  __u32 parent;
  19607. -  __u32 extension;
  19608. +  __s32 spare2;
  19609. +  __s32 original;    /* not really in file_end */
  19610. +  __s32 link_chain;
  19611. +  __s32 spare3[5];
  19612. +  __s32 hash_chain;
  19613. +  __s32 parent;
  19614. +  __s32 extension;
  19615.    __s32 secondary_type;
  19616.  };
  19617.  
  19618.  struct hlink_front
  19619.  {
  19620.    __s32 primary_type;
  19621. -  __u32 own_key;
  19622. -  __u32 spare1[3];
  19623. +  __s32 own_key;
  19624. +  __s32 spare1[3];
  19625.    __u32 checksum;
  19626.  };
  19627.  
  19628.  struct hlink_end
  19629.  {
  19630. -  __u32 spare1;
  19631. -  __u16 owner_uid;
  19632. -  __u16 owner_gid;
  19633. +  __s32 spare1;
  19634. +  __s16 owner_uid;
  19635. +  __s16 owner_gid;
  19636.    __u32 protect;
  19637.    __u8 comment[92];
  19638.    struct DateStamp created;
  19639.    __u8 link_name[32];
  19640. -  __u32 spare2;
  19641. -  __u32 original;
  19642. -  __u32 link_chain;
  19643. -  __u32 spare3[5];
  19644. -  __u32 hash_chain;
  19645. -  __u32 parent;
  19646. -  __u32 spare4;
  19647. +  __s32 spare2;
  19648. +  __s32 original;
  19649. +  __s32 link_chain;
  19650. +  __s32 spare3[5];
  19651. +  __s32 hash_chain;
  19652. +  __s32 parent;
  19653. +  __s32 spare4;
  19654.    __s32 secondary_type;
  19655.  };
  19656.  
  19657.  struct slink_front
  19658.  {
  19659.    __s32 primary_type;
  19660. -  __u32 own_key;
  19661. -  __u32 spare1[3];
  19662. -  __u32 checksum;
  19663. +  __s32 own_key;
  19664. +  __s32 spare1[3];
  19665. +  __s32 checksum;
  19666.    __u8    symname[288];    /* depends on block size */
  19667. +};
  19668. +
  19669. +struct data_front
  19670. +{
  19671. +  __s32 primary_type;
  19672. +  __s32 header_key;
  19673. +  __s32 sequence_number;
  19674. +  __s32 data_size;
  19675. +  __s32 next_data;
  19676. +  __s32 checksum;
  19677. +  __u8 data[488];    /* depends on block size */
  19678.  };
  19679.  
  19680.  /* Permission bits */
  19681. diff -u --recursive --new-file pre2.0.5/linux/include/linux/aztcd.h linux/include/linux/aztcd.h
  19682. --- pre2.0.5/linux/include/linux/aztcd.h    Mon Apr 29 18:05:20 1996
  19683. +++ linux/include/linux/aztcd.h    Sun May 19 15:17:57 1996
  19684. @@ -1,4 +1,4 @@
  19685. -/* $Id: aztcd.h,v 2.30 1996/04/26 05:33:56 root Exp root $
  19686. +/* $Id: aztcd.h,v 2.50 1996/05/17 16:15:43 root Exp root $
  19687.   *
  19688.   * Definitions for a AztechCD268 CD-ROM interface
  19689.   *    Copyright (C) 1994, 1995  Werner Zimmermann
  19690. @@ -32,7 +32,7 @@
  19691.  */
  19692.  
  19693.  #ifdef AZT_SW32 
  19694. -#define AZT_SW32_BASE_ADDR       0x220  /*I/O port base address of your soundcard*/
  19695. +#define AZT_SW32_BASE_ADDR      0x220  /*I/O port base address of your soundcard*/
  19696.  #endif
  19697.  
  19698.  /* Set this to 1, if you want your tray to be locked, set to 0 to prevent tray 
  19699. @@ -74,9 +74,9 @@
  19700.  #define STATUS_PORT        azt_port+1
  19701.  #define MODE_PORT        azt_port+2
  19702.  #ifdef  AZT_SW32                
  19703. - #define AZT_SW32_INIT           (unsigned int) (0xFF00 & (AZT_BASE_ADDR*16))
  19704. - #define AZT_SW32_CONFIG_REG     AZT_SW32_BASE_ADDR+0x16  /*Soundwave32 Config. Register*/
  19705. - #define AZT_SW32_ID_REG         AZT_SW32_BASE_ADDR+0x04  /*Soundwave32 ID Version Register*/
  19706. + #define AZT_SW32_INIT          (unsigned int) (0xFF00 & (AZT_BASE_ADDR*16))
  19707. + #define AZT_SW32_CONFIG_REG    AZT_SW32_BASE_ADDR+0x16  /*Soundwave32 Config. Register*/
  19708. + #define AZT_SW32_ID_REG        AZT_SW32_BASE_ADDR+0x04  /*Soundwave32 ID Version Register*/
  19709.  #endif
  19710.  
  19711.  /* status bits */
  19712. diff -u --recursive --new-file pre2.0.5/linux/include/linux/isdn.h linux/include/linux/isdn.h
  19713. --- pre2.0.5/linux/include/linux/isdn.h    Tue May  7 16:22:38 1996
  19714. +++ linux/include/linux/isdn.h    Sun May 19 15:29:31 1996
  19715. @@ -1,4 +1,4 @@
  19716. -/* $Id: isdn.h,v 1.3 1996/04/20 16:54:58 fritz Exp $
  19717. +/* $Id: isdn.h,v 1.10 1996/05/18 01:37:18 fritz Exp $
  19718.   *
  19719.   * Main header for the Linux ISDN subsystem (linklevel).
  19720.   *
  19721. @@ -21,6 +21,29 @@
  19722.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  19723.   *
  19724.   * $Log: isdn.h,v $
  19725. + * Revision 1.10  1996/05/18 01:37:18  fritz
  19726. + * Added spelling corrections and some minor changes
  19727. + * to stay in sync with kernel.
  19728. + *
  19729. + * Revision 1.9  1996/05/17 03:58:20  fritz
  19730. + * Added flags for DLE handling.
  19731. + *
  19732. + * Revision 1.8  1996/05/11 21:49:55  fritz
  19733. + * Removed queue mamagement variables.
  19734. + * Changed queue management to use sk_buffs.
  19735. + *
  19736. + * Revision 1.7  1996/05/07 09:10:06  fritz
  19737. + * Reorganized tty-related structs.
  19738. + *
  19739. + * Revision 1.6  1996/05/06 11:38:27  hipp
  19740. + * minor change in ippp struct
  19741. + *
  19742. + * Revision 1.5  1996/04/30 11:03:16  fritz
  19743. + * Added Michael's ippp-bind patch.
  19744. + *
  19745. + * Revision 1.4  1996/04/29 23:00:02  fritz
  19746. + * Added variables for voice-support.
  19747. + *
  19748.   * Revision 1.3  1996/04/20 16:54:58  fritz
  19749.   * Increased maximum number of channels.
  19750.   * Added some flags for isdn_net to handle callback more reliable.
  19751. @@ -110,7 +133,7 @@
  19752.  #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
  19753.  #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing  */
  19754.  
  19755. -#define ISDN_MODEM_ANZREG    20        /* Number of Modem-Registers        */
  19756. +#define ISDN_MODEM_ANZREG    21        /* Number of Modem-Registers        */
  19757.  #define ISDN_MSNLEN          20
  19758.  
  19759.  typedef struct {
  19760. @@ -150,6 +173,7 @@
  19761.    int  secure;       /* Flag: Secure                          */
  19762.    int  callback;     /* Flag: Callback                        */
  19763.    int  cbhup;        /* Flag: Reject Call before Callback     */
  19764. +  int  pppbind;      /* ippp device for bindings              */
  19765.  } isdn_net_ioctl_cfg;
  19766.  
  19767.  #ifdef __KERNEL__
  19768. @@ -214,11 +238,14 @@
  19769.  #define ISDN_SERVICE_BTEL  1<<12
  19770.  
  19771.  /* Macros checking plain usage */
  19772. -#define USG_NONE(x)     ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
  19773. -#define USG_RAW(x)      ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
  19774. -#define USG_MODEM(x)    ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
  19775. -#define USG_NET(x)      ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
  19776. -#define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
  19777. +#define USG_NONE(x)         ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
  19778. +#define USG_RAW(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
  19779. +#define USG_MODEM(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
  19780. +#define USG_VOICE(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
  19781. +#define USG_NET(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
  19782. +#define USG_OUTGOING(x)     ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
  19783. +#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
  19784. +                             ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)     )
  19785.  
  19786.  /* Timer-delays and scheduling-flags */
  19787.  #define ISDN_TIMER_RES       3                     /* Main Timer-Resolution  */
  19788. @@ -333,6 +360,7 @@
  19789.                                         /* Ptr to orig. header_cache_update */
  19790.    void                   (*org_hcu)(struct hh_cache *, struct device *,
  19791.                                      unsigned char *);
  19792. +  int  pppbind;                        /* ippp device for bindings         */
  19793.  } isdn_net_local;
  19794.  
  19795.  #ifdef CONFIG_ISDN_PPP
  19796. @@ -375,70 +403,74 @@
  19797.  #define ISDN_ASYNC_PGRP_LOCKOUT       0x0200 /* Lock cua opens on pgrp       */
  19798.  #define ISDN_ASYNC_CALLOUT_NOHUP      0x0400 /* No hangup for cui            */
  19799.  #define ISDN_ASYNC_SPLIT_TERMIOS      0x0008 /* Sep. termios for dialin/out  */
  19800. -#define ISDN_PORT_16550A                   4 /* Type of faked Hardware       */
  19801.  #define ISDN_SERIAL_XMIT_SIZE           4000 /* Maximum bufsize for write    */
  19802. -#define ISDN_SERIAL_TYPE_NORMAL               1 /* tty-type                     */
  19803. -#define ISDN_SERIAL_TYPE_CALLOUT           2 /* cua-type                     */
  19804. +#define ISDN_SERIAL_TYPE_NORMAL            1
  19805. +#define ISDN_SERIAL_TYPE_CALLOUT           2
  19806. +
  19807. +/* Private data of AT-command-interpreter */
  19808. +typedef struct atemu {
  19809. +  u_char              profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0 */
  19810. +  u_char              mdmreg[ISDN_MODEM_ANZREG];  /* Modem-Registers       */
  19811. +  char                pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0             */
  19812. +  char                msn[ISDN_MSNLEN];/* EAZ/MSN                          */
  19813. +  u_char              vpar[10];        /* Voice-parameters                 */
  19814. +  int                 mdmcmdl;         /* Length of Modem-Commandbuffer    */
  19815. +  int                 pluscount;       /* Counter for +++ sequence         */
  19816. +  int                 lastplus;        /* Timestamp of last +              */
  19817. +  int                 lastDLE;         /* Flag for voice-coding: DLE seen  */
  19818. +  char                mdmcmd[255];     /* Modem-Commandbuffer              */
  19819. +} atemu;
  19820.  
  19821.  /* Private data (similar to async_struct in <linux/serial.h>) */
  19822. -typedef struct {
  19823. +typedef struct modem_info {
  19824.    int            magic;
  19825.    int            flags;         /* defined in tty.h               */
  19826. -  int            type;         /* UART type                      */
  19827. -  struct tty_struct     *tty;
  19828.    int            x_char;         /* xon/xoff character             */
  19829. -  int            close_delay;
  19830. -  int            MCR;         /* Modem control register         */
  19831. +  int            mcr;         /* Modem control register         */
  19832. +  int                   msr;             /* Modem status register          */
  19833. +  int                   lsr;             /* Line status register           */
  19834.    int            line;
  19835.    int            count;         /* # of fd on device              */
  19836.    int            blocked_open;     /* # of blocked opens             */
  19837.    long            session;     /* Session of opening process     */
  19838.    long            pgrp;         /* pgrp of opening process        */
  19839. +  int                   online;          /* B-Channel is up                */
  19840. +  int                   vonline;         /* Voice-channel status           */
  19841. +  int                   dialing;         /* Dial in progress               */
  19842. +  int                   rcvsched;        /* Receive needs schedule         */
  19843.    int                   isdn_driver;     /* Index to isdn-driver           */
  19844.    int                   isdn_channel;    /* Index to isdn-channel          */
  19845.    int                   drv_index;       /* Index to dev->usage            */
  19846. +  int                   ncarrier;        /* Flag: schedule NO CARRIER      */
  19847. +  struct timer_list     nc_timer;        /* Timer for delayed NO CARRIER   */
  19848. +#define FUTURE 1
  19849.  #if FUTURE
  19850.    int                   send_outstanding;/* # of outstanding send-requests */
  19851.  #endif
  19852.    int                   xmit_size;       /* max. # of chars in xmit_buf    */
  19853.    int                   xmit_count;      /* # of chars in xmit_buf         */
  19854. -  u_char                *xmit_buf;       /* transmit-buffer                */
  19855. -  struct termios    normal_termios;
  19856. +  struct tty_struct     *tty;            /* Pointer to corresponding tty   */
  19857. +  atemu                 emu;             /* AT-emulator data               */
  19858. +  void                  *adpcms;         /* state for adpcm decompression  */
  19859. +  void                  *adpcmr;         /* state for adpcm compression    */
  19860. +  struct termios    normal_termios;  /* For saving termios structs     */
  19861.    struct termios    callout_termios;
  19862.    struct wait_queue    *open_wait;
  19863.    struct wait_queue    *close_wait;
  19864. +  struct sk_buff_head   *xmit_buf;       /* transmit-buffer queue          */
  19865.  } modem_info;
  19866.  
  19867.  #define ISDN_MODEM_WINSIZE 8
  19868.  
  19869. -/* Private data of AT-command-interpreter */
  19870. -typedef struct {
  19871. -  u_char              profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0  */
  19872. -  u_char              mdmreg[ISDN_MODEM_ANZREG];  /* Modem-Registers        */
  19873. -  char                pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0             */
  19874. -  char                msn[ISDN_MSNLEN];/* EAZ/MSN                          */
  19875. -  int                 mdmcmdl;         /* Length of Modem-Commandbuffer    */
  19876. -  int                 pluscount;       /* Counter for +++ sequence         */
  19877. -  int                 lastplus;        /* Timestamp of last +              */
  19878. -  char                mdmcmd[255];     /* Modem-Commandbuffer              */
  19879. -} atemu;
  19880. -
  19881.  /* Description of one ISDN-tty */
  19882.  typedef struct {
  19883. -  int                msr[ISDN_MAX_CHANNELS];      /* Modem-statusregister   */
  19884. -  int                mlr[ISDN_MAX_CHANNELS];      /* Line-statusregister    */
  19885. -  int                refcount;              /* Number of opens        */
  19886. -  int                online[ISDN_MAX_CHANNELS];      /* B-Channel is up        */
  19887. -  int                dialing[ISDN_MAX_CHANNELS];  /* Dial in progress       */
  19888. -  int                rcvsched[ISDN_MAX_CHANNELS]; /* Receive needs schedule */
  19889. -  int                ncarrier[ISDN_MAX_CHANNELS]; /* Output NO CARRIER      */
  19890. -  struct tty_driver  tty_modem;              /* tty-device             */
  19891. -  struct tty_driver  cua_modem;              /* cua-device             */
  19892. +  int                refcount;               /* Number of opens        */
  19893. +  struct tty_driver  tty_modem;               /* tty-device             */
  19894. +  struct tty_driver  cua_modem;               /* cua-device             */
  19895.    struct tty_struct  *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
  19896. -  struct termios     *modem_termios[ISDN_MAX_CHANNELS];
  19897. -  struct termios     *modem_termios_locked[ISDN_MAX_CHANNELS];
  19898. -  atemu              atmodem[ISDN_MAX_CHANNELS];  /* AT-Command-parser      */
  19899. -  modem_info         info[ISDN_MAX_CHANNELS];      /* Private data           */
  19900. +  struct termios     modem_termios[ISDN_MAX_CHANNELS];
  19901. +  struct termios     modem_termios_locked[ISDN_MAX_CHANNELS];
  19902. +  modem_info         info[ISDN_MAX_CHANNELS];       /* Private data           */
  19903.  } modem;
  19904.  
  19905.  /*======================= End of ISDN-tty stuff ============================*/
  19906. @@ -504,6 +536,7 @@
  19907.    unsigned char *cbuf;
  19908.    struct slcompress *slcomp;
  19909.  #endif
  19910. +  unsigned long debug;
  19911.  };
  19912.  
  19913.  #endif
  19914. @@ -512,15 +545,6 @@
  19915.  
  19916.  /*======================= Start of general stuff ===========================*/
  19917.  
  19918. -/* Packet-queue-element */
  19919. -typedef struct pqueue {
  19920. -  char   *next;                /* Pointer to next packet           */
  19921. -  short   length;            /* Packetlength                     */
  19922. -  short   size;                         /* Allocated size                   */
  19923. -  u_char *rptr;                /* Read-pointer for stream-reading  */
  19924. -  u_char  buffer[1];            /* The data (will be alloc'd)       */
  19925. -} pqueue;
  19926. -
  19927.  typedef struct {
  19928.    char *next;
  19929.    char *private;
  19930. @@ -540,7 +564,8 @@
  19931.    isdn_if            *interface;        /* Interface to driver              */
  19932.    int                *rcverr;           /* Error-counters for B-Ch.-receive */
  19933.    int                *rcvcount;         /* Byte-counters for B-Ch.-receive  */
  19934. -  pqueue             **rpqueue;         /* Pointers to start of Rcv-Queue   */
  19935. +  unsigned long      DLEflag;           /* Flags: Insert DLE at next read   */
  19936. +  struct sk_buff_head *rpqueue;         /* Pointers to start of Rcv-Queue   */
  19937.    struct wait_queue  **rcv_waitq;       /* Wait-Queues for B-Channel-Reads  */
  19938.    struct wait_queue  **snd_waitq;       /* Wait-Queue for B-Channel-Send's  */
  19939.    char               msn2eaz[10][ISDN_MSNLEN];  /* Mapping-Table MSN->EAZ   */
  19940. diff -u --recursive --new-file pre2.0.5/linux/include/linux/isdn_ppp.h linux/include/linux/isdn_ppp.h
  19941. --- pre2.0.5/linux/include/linux/isdn_ppp.h    Mon Feb 26 11:58:16 1996
  19942. +++ linux/include/linux/isdn_ppp.h    Sun May 19 15:29:31 1996
  19943. @@ -1,4 +1,8 @@
  19944. +#ifndef _LINUX_ISDN_PPP_H
  19945. +#define _LINUX_ISDN_PPP_H
  19946. +
  19947.  extern int isdn_ppp_dial_slave(char *);
  19948. +extern int isdn_ppp_hangup_slave(char *);
  19949.  
  19950.  struct pppinfo
  19951.  {
  19952. @@ -28,3 +32,4 @@
  19953.  #define MP_END_FRAG    0x40
  19954.  #define MP_BEGIN_FRAG  0x80
  19955.  
  19956. +#endif
  19957. diff -u --recursive --new-file pre2.0.5/linux/include/linux/isdnif.h linux/include/linux/isdnif.h
  19958. --- pre2.0.5/linux/include/linux/isdnif.h    Tue May  7 16:22:38 1996
  19959. +++ linux/include/linux/isdnif.h    Sun May 19 15:29:31 1996
  19960. @@ -1,4 +1,4 @@
  19961. -/* $Id: isdnif.h,v 1.2 1996/04/20 17:02:40 fritz Exp $
  19962. +/* $Id: isdnif.h,v 1.8 1996/05/18 01:45:37 fritz Exp $
  19963.   *
  19964.   * Linux ISDN subsystem
  19965.   *
  19966. @@ -22,6 +22,27 @@
  19967.   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  19968.   *
  19969.   * $Log: isdnif.h,v $
  19970. + * Revision 1.8  1996/05/18 01:45:37  fritz
  19971. + * More spelling corrections.
  19972. + *
  19973. + * Revision 1.7  1996/05/18 01:37:19  fritz
  19974. + * Added spelling corrections and some minor changes
  19975. + * to stay in sync with kernel.
  19976. + *
  19977. + * Revision 1.6  1996/05/17 03:59:28  fritz
  19978. + * Marked rcvcallb and writebuf obsolete.
  19979. + *
  19980. + * Revision 1.5  1996/05/01 11:43:54  fritz
  19981. + * Removed STANDALONE
  19982. + *
  19983. + * Revision 1.4  1996/05/01 11:38:40  fritz
  19984. + * Added ISDN_FEATURE_L2_TRANS
  19985. + *
  19986. + * Revision 1.3  1996/04/29 22:57:54  fritz
  19987. + * Added driverId and channel parameters to
  19988. + * writecmd() and readstat().
  19989. + * Added constant for voice-support.
  19990. + *
  19991.   * Revision 1.2  1996/04/20 17:02:40  fritz
  19992.   * Changes to support skbuffs for Lowlevel-Drivers.
  19993.   * Misc. typos
  19994. @@ -34,10 +55,6 @@
  19995.  #ifndef isdnif_h
  19996.  #define isdnif_h
  19997.  
  19998. -#ifdef STANDALONE
  19999. -#include <linux/k_compat.h>
  20000. -#endif
  20001. -
  20002.  /*
  20003.   * Values for general protocol-selection
  20004.   */
  20005. @@ -52,6 +69,7 @@
  20006.  #define ISDN_PROTO_L2_X75UI  1   /* X75/LAPB with UI-Frames     */
  20007.  #define ISDN_PROTO_L2_X75BUI 2   /* X75/LAPB with UI-Frames     */
  20008.  #define ISDN_PROTO_L2_HDLC   3   /* HDLC                        */
  20009. +#define ISDN_PROTO_L2_TRANS  4   /* Transparent (Voice)         */
  20010.  
  20011.  /*
  20012.   * Values for Layer-3-protocol-selection
  20013. @@ -112,6 +130,7 @@
  20014.  #define ISDN_FEATURE_L2_X75UI   (0x0001 << ISDN_PROTO_L2_X75UI)
  20015.  #define ISDN_FEATURE_L2_X75BUI  (0x0001 << ISDN_PROTO_L2_X75BUI)
  20016.  #define ISDN_FEATURE_L2_HDLC    (0x0001 << ISDN_PROTO_L2_HDLC)
  20017. +#define ISDN_FEATURE_L2_TRANS   (0x0001 << ISDN_PROTO_L2_TRANS)
  20018.  
  20019.  /* Layer 3 */
  20020.  #define ISDN_FEATURE_L3_TRANS   (0x0100 << ISDN_PROTO_L3_TRANS)
  20021. @@ -167,6 +186,10 @@
  20022.     *             int    local channel-number (0 ...)
  20023.     *             u_char pointer to received data (in Kernel-Space, volatile)
  20024.     *             int    length of data
  20025. +   *
  20026. +   * NOTE: This callback is obsolete, and will be removed when all
  20027. +   *       current LL-drivers support rcvcall_skb. Do NOT use for new
  20028. +   *       drivers.
  20029.     */
  20030.    void (*rcvcallb)(int, int, u_char*, int);
  20031.  
  20032. @@ -207,6 +230,10 @@
  20033.     *                              no schedule allowed) 
  20034.     *                          1 = Data is in User-Space (use memcpy_fromfs,
  20035.     *                              may schedule)
  20036. +   *
  20037. +   * NOTE: This call is obsolete, and will be removed when all
  20038. +   *       current LL-drivers support writebuf_skb. Do NOT use for new
  20039. +   *       drivers.
  20040.     */
  20041.    int (*writebuf)(int, int, const u_char*, int, int);
  20042.  
  20043. @@ -227,8 +254,10 @@
  20044.     *                              no schedule allowed) 
  20045.     *                          1 = Data is in User-Space (use memcpy_fromfs,
  20046.     *                              may schedule)
  20047. +   *             int    driverId
  20048. +   *             int    local channel-number (0 ...)
  20049.     */
  20050. -  int (*writecmd)(const u_char*, int, int);
  20051. +  int (*writecmd)(const u_char*, int, int, int, int);
  20052.    /* Read raw Status replies
  20053.     *             u_char pointer data (volatile)
  20054.     *             int    length of buffer
  20055. @@ -236,8 +265,10 @@
  20056.     *                              no schedule allowed) 
  20057.     *                          1 = Data is in User-Space (use memcpy_fromfs,
  20058.     *                              may schedule)
  20059. +   *             int    driverId
  20060. +   *             int    local channel-number (0 ...)
  20061.     */
  20062. -  int (*readstat)(u_char*, int, int);
  20063. +  int (*readstat)(u_char*, int, int, int, int);
  20064.    char id[20];
  20065.  } isdn_if;
  20066.  
  20067. @@ -250,7 +281,7 @@
  20068.   *              supporting sk_buff's should set this to 0.
  20069.   * command      Address of Command-Handler.
  20070.   * features     Bitwise coded Features of this driver. (use ISDN_FEATURE_...)
  20071. - * writebuf     Address of Send-Command-Handler.
  20072. + * writebuf     Address of Send-Command-Handler. OBSOLETE do NOT use anymore.
  20073.   * writebuf_skb Address of Skbuff-Send-Handler. (NULL if not supported)
  20074.   * writecmd        "    "  D-Channel  " which accepts raw D-Ch-Commands.
  20075.   * readstat        "    "  D-Channel  " which delivers raw Status-Data.
  20076. @@ -259,7 +290,7 @@
  20077.   *
  20078.   * channels      Driver-ID assigned to this driver. (Must be used on all
  20079.   *               subsequent callbacks.
  20080. - * rcvcallb      Address of handler for received data.
  20081. + * rcvcallb      Address of handler for received data. OBSOLETE, do NOT use anymore.
  20082.   * rcvcallb_skb  Address of handler for received Skbuff's. (NULL if not supp.)
  20083.   * statcallb        "    "     "    for status-changes.
  20084.   *
  20085. diff -u --recursive --new-file pre2.0.5/linux/include/linux/mcdx.h linux/include/linux/mcdx.h
  20086. --- pre2.0.5/linux/include/linux/mcdx.h    Fri May 17 15:32:18 1996
  20087. +++ linux/include/linux/mcdx.h    Sat May 18 11:15:09 1996
  20088. @@ -27,7 +27,7 @@
  20089.   *  Daniel v. Mosnenck (he sent me the Technical and Programming Reference)
  20090.   *  Gerd Knorr (he lent me his PhotoCD)
  20091.   *  Nils Faerber and Roger E. Wolff (extensively tested the LU portion)
  20092. - *  Andreas Kies (testing the mysterious hang up's)
  20093. + *  Andreas Kies (testing the mysterious hangups)
  20094.   *  ... somebody forgotten?
  20095.   *  
  20096.   */
  20097. @@ -35,14 +35,14 @@
  20098.  #ifndef __MCDX_H
  20099.  #define __MCDX_H
  20100.  /*
  20101. - *     PLEASE CONFIGURE THIS ACCORIDNG TO YOURS HARDWARE/JUMPER SETTINGS.
  20102. + *     PLEASE CONFIGURE THIS ACCORDING TO YOUR HARDWARE/JUMPER SETTINGS.
  20103.   *
  20104.   *      o       MCDX_NDRIVES  :  number of used entries of the following table
  20105.   *      o       MCDX_DRIVEMAP :  table of {i/o base, irq} per controller
  20106.   *
  20107.   *      NOTE: Don't even think about connecting the drive to IRQ 9(2).
  20108.   *    In the AT architecture this interrupt is used to cascade the two
  20109. - *    interrupt controllers and isn't therefore usable for enything else!
  20110. + *    interrupt controllers and isn't therefore usable for anything else!
  20111.   */
  20112.   /* #define I_WAS_IN_MCDX_H */
  20113.  #define MCDX_NDRIVES 1
  20114. @@ -55,11 +55,11 @@
  20115.            
  20116.  /* 
  20117.   * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!NO USER INTERVENTION NEEDED BELOW
  20118. - * If You are shure that all configuration is done, please uncomment the
  20119. + * If You are sure that all configuration is done, please uncomment the
  20120.   * line below. 
  20121.   */
  20122.  
  20123. -#undef MCDX_DEBUG    /* This is *REALLY* only for developement! */
  20124. +#undef MCDX_DEBUG    /* This is *REALLY* only for development! */
  20125.  
  20126.  #ifdef MCDX_DEBUG
  20127.  #define MCDX_TRACE(x) printk x
  20128. diff -u --recursive --new-file pre2.0.5/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h
  20129. --- pre2.0.5/linux/include/linux/proc_fs.h    Sun May  5 08:52:04 1996
  20130. +++ linux/include/linux/proc_fs.h    Sun May 19 16:27:21 1996
  20131. @@ -120,7 +120,8 @@
  20132.      PROC_SCSI_GENERIC_NCR5380,
  20133.      PROC_SCSI_IN2000,
  20134.      PROC_SCSI_PAS16,
  20135. -    PROC_SCSI_QLOGIC,
  20136. +    PROC_SCSI_QLOGICFAS,
  20137. +    PROC_SCSI_QLOGICISP,
  20138.      PROC_SCSI_SEAGATE,
  20139.      PROC_SCSI_T128,
  20140.      PROC_SCSI_NCR53C7xx,
  20141. diff -u --recursive --new-file pre2.0.5/linux/include/net/sock.h linux/include/net/sock.h
  20142. --- pre2.0.5/linux/include/net/sock.h    Fri May 17 15:32:19 1996
  20143. +++ linux/include/net/sock.h    Sun May 19 16:29:21 1996
  20144. @@ -195,8 +195,8 @@
  20145.      struct sock        *next;
  20146.      struct sock        *prev; /* Doubly linked chain.. */
  20147.      struct sock        *pair;
  20148. -    struct sk_buff        * send_head;
  20149. -    struct sk_buff        * send_tail;
  20150. +    struct sk_buff        * volatile send_head;
  20151. +    struct sk_buff        * volatile send_tail;
  20152.      struct sk_buff_head    back_log;
  20153.      struct sk_buff        *partial;
  20154.      struct timer_list    partial_timer;
  20155. @@ -212,33 +212,33 @@
  20156.      unsigned short        window;
  20157.      __u32                   lastwin_seq;    /* sequence number when we last updated the window we offer */
  20158.      __u32            high_seq;    /* sequence number when we did current fast retransmit */
  20159. -    unsigned long        ato;            /* ack timeout */
  20160. -    unsigned long        lrcvtime;       /* jiffies at last rcv */
  20161. +    volatile unsigned long  ato;            /* ack timeout */
  20162. +    volatile unsigned long  lrcvtime;       /* jiffies at last rcv */
  20163.      unsigned short        bytes_rcv;
  20164.  /*
  20165.   *    mss is min(mtu, max_window) 
  20166.   */
  20167.      unsigned short        mtu;       /* mss negotiated in the syn's */
  20168. -    unsigned short        mss;       /* current eff. mss - can change */
  20169. -    unsigned short        user_mss;  /* mss requested by user in ioctl */
  20170. -    unsigned short        max_window;
  20171. +    volatile unsigned short    mss;       /* current eff. mss - can change */
  20172. +    volatile unsigned short    user_mss;  /* mss requested by user in ioctl */
  20173. +    volatile unsigned short    max_window;
  20174.      unsigned long         window_clamp;
  20175.      unsigned int        ssthresh;
  20176.      unsigned short        num;
  20177. -    unsigned short        cong_window;
  20178. -    unsigned short        cong_count;
  20179. -    unsigned short        packets_out;
  20180. -    unsigned short        shutdown;
  20181. -    unsigned long        rtt;
  20182. -    unsigned long        mdev;
  20183. -    unsigned long        rto;
  20184. +    volatile unsigned short    cong_window;
  20185. +    volatile unsigned short    cong_count;
  20186. +    volatile unsigned short    packets_out;
  20187. +    volatile unsigned short    shutdown;
  20188. +    volatile unsigned long    rtt;
  20189. +    volatile unsigned long    mdev;
  20190. +    volatile unsigned long    rto;
  20191.  
  20192.  /*
  20193.   *    currently backoff isn't used, but I'm maintaining it in case
  20194.   *    we want to go back to a backoff formula that needs it
  20195.   */
  20196.   
  20197. -    unsigned short        backoff;
  20198. +    volatile unsigned short    backoff;
  20199.      int            err, err_soft;    /* Soft holds errors that don't
  20200.                             cause failure but are the cause
  20201.                             of a persistent failure not just
  20202. diff -u --recursive --new-file pre2.0.5/linux/kernel/module.c linux/kernel/module.c
  20203. --- pre2.0.5/linux/kernel/module.c    Fri May 17 15:32:19 1996
  20204. +++ linux/kernel/module.c    Fri May 17 18:34:06 1996
  20205. @@ -293,7 +293,7 @@
  20206.      else {
  20207.          for (mp = module_list; mp != &kernel_module; mp = mp->next) {
  20208.              if ((mp->ref == NULL) && (mp->state == MOD_RUNNING) &&
  20209. -                ((GET_USE_COUNT(mp) & ~(MOD_AUTOCLEAN | MOD_VISITED)) == 0)) {
  20210. +                ((GET_USE_COUNT(mp) & ~MOD_VISITED) == MOD_AUTOCLEAN)) {
  20211.                      if ((GET_USE_COUNT(mp) & MOD_VISITED)) {
  20212.                      /* Don't reap until one "cycle" after last _use_ */
  20213.                         GET_USE_COUNT(mp) &= ~MOD_VISITED;
  20214. diff -u --recursive --new-file pre2.0.5/linux/net/core/net_alias.c linux/net/core/net_alias.c
  20215. --- pre2.0.5/linux/net/core/net_alias.c    Fri May 17 15:32:20 1996
  20216. +++ linux/net/core/net_alias.c    Sat May 18 20:16:23 1996
  20217. @@ -235,6 +235,18 @@
  20218.  }
  20219.  
  20220.  
  20221. +static int
  20222. +net_alias_open(struct device * dev)
  20223. +{
  20224. +  return 0;
  20225. +}
  20226. +
  20227. +static int
  20228. +net_alias_close(struct device * dev)
  20229. +{
  20230. +  return 0;
  20231. +}
  20232. +
  20233.  /*
  20234.   * setups a new (alias) device 
  20235.   */
  20236. @@ -264,6 +276,8 @@
  20237.    dev->my_alias = alias;    /* point to alias */
  20238.    dev->name = alias->name;
  20239.    dev->type = main_dev->type;
  20240. +  dev->open = net_alias_open;
  20241. +  dev->stop = net_alias_close;
  20242.    dev->hard_header_len = main_dev->hard_header_len;
  20243.    memcpy(dev->broadcast, main_dev->broadcast, MAX_ADDR_LEN);
  20244.    memcpy(dev->dev_addr, main_dev->dev_addr, MAX_ADDR_LEN);
  20245. diff -u --recursive --new-file pre2.0.5/linux/net/decnet/README linux/net/decnet/README
  20246. --- pre2.0.5/linux/net/decnet/README    Fri May 17 15:32:20 1996
  20247. +++ linux/net/decnet/README    Sat May 18 11:15:09 1996
  20248. @@ -1,4 +1,4 @@
  20249. -Yes.. its being worked on.
  20250. +Yes.. it's being worked on.
  20251.  
  20252.  If you want to get involved email me <Alan.Cox@linux.org> and I'll put you
  20253.  in touch with the people doing the work.
  20254. diff -u --recursive --new-file pre2.0.5/linux/net/ipv4/tcp_input.c linux/net/ipv4/tcp_input.c
  20255. --- pre2.0.5/linux/net/ipv4/tcp_input.c    Fri May 17 15:32:20 1996
  20256. +++ linux/net/ipv4/tcp_input.c    Sat May 18 20:28:07 1996
  20257. @@ -61,15 +61,7 @@
  20258.          if (m <= 0)
  20259.              m = 1;
  20260.  
  20261. -        /* Yikes. This used to test if m was larger than rtt/8.
  20262. -         * Maybe on a long delay high speed link this would be
  20263. -             * good initial guess, but over a slow link where the
  20264. -             * delay is dominated by transmission time this will
  20265. -             * be very bad, since ato will almost always be something
  20266. -         * more like rtt/2. Better to discard data points that
  20267. -         * are larger than the rtt estimate.
  20268. -             */
  20269. -        if (m > sk->rtt)
  20270. +        if (m > (sk->rtt >> 3))
  20271.          {
  20272.              sk->ato = sk->rtt >> 3;
  20273.              /*
  20274. @@ -741,7 +733,7 @@
  20275.       * (2) it has the same window as the last ACK,
  20276.       * (3) we have outstanding data that has not been ACKed
  20277.       * (4) The packet was not carrying any data.
  20278. -     * (5) [From Floyds paper on fast retransmit wars]
  20279. +     * (5) [From Floyd's paper on fast retransmit wars]
  20280.       *     The packet acked data after high_seq;
  20281.       * I've tried to order these in occurrence of most likely to fail
  20282.       * to least likely to fail.
  20283. diff -u --recursive --new-file pre2.0.5/linux/net/ipv4/tcp_output.c linux/net/ipv4/tcp_output.c
  20284. --- pre2.0.5/linux/net/ipv4/tcp_output.c    Fri May 17 15:32:21 1996
  20285. +++ linux/net/ipv4/tcp_output.c    Sat May 18 11:15:09 1996
  20286. @@ -837,7 +837,7 @@
  20287.   *      sending every two full sized packets will never need to be
  20288.   *      invoked, the delayed ack will be sent before the ATO timeout
  20289.   *      every time. Of course, the relies on our having a good estimate
  20290. - *      for packet interarrival times.
  20291. + *      for packet interarrival times.)
  20292.   */
  20293.  void tcp_send_delayed_ack(struct sock * sk, int max_timeout, unsigned long timeout)
  20294.  {
  20295.