diff -u --recursive --new-file v2.3.28/linux/Documentation/00-INDEX linux/Documentation/00-INDEX --- v2.3.28/linux/Documentation/00-INDEX Thu Aug 26 13:05:34 1999 +++ linux/Documentation/00-INDEX Sun Nov 21 11:13:56 1999 @@ -7,8 +7,6 @@ 00-INDEX - this file. -ARM-README - - information for using Linux on the ARM architecture. BUG-HUNTING - brute force method of doing binary search of patches to find bug. Changes @@ -21,16 +19,22 @@ - info on using the enhanced interrupt hardware on SMP boards. IO-mapping.txt - how to access I/O mapped memory from within device drivers. -SMP.txt - - notes, and "To Fix" list for multi-processor Linux. (see smp.tex) +README.DAC960 + - info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux VGA-softcursor.txt - how to change your VGA cursor from a blinking underscore. +acpi.txt + - info on ACPI Driver Interface arm/ - directory with info about Linux on the ARM architecture. +atm.txt + - info on Linux ATM support binfmt_misc.txt - info on the kernel support for extra binary formats. cdrom/ - directory with information on the CD-ROM drivers that Linux has. +computone.txt + - info on Computone Intelliport II/Plus Multiport Serial Driver cpqarray.txt - info on using Compaq's SMART2 Intelligent Disk Array Controllers. devices.tex @@ -59,6 +63,8 @@ - how to use the RAM disk as an initial/temporary root filesystem. ioctl-number.txt - how to implement and register device/driver ioctl calls. +isapnp.txt + - info on Linux ISA Plug & Play support isdn/ - directory with info on the Linux ISDN support, and supported cards. java.txt @@ -107,6 +113,8 @@ - directory with info on various aspects of networking with Linux. nfsroot.txt - short guide on setting up a diskless box with NFS root filesystem +nmi_watchdog.txt + - info on NMI watchdog for SMP systems oops-tracing.txt - how to decode those nasty internal kernel error dump messages. paride.txt @@ -121,6 +129,8 @@ - directory with info on using Linux with the PowerPC. proc.txt - detailed info on Linux's /proc filesystem. +proc_usb_info.txt + - info on /proc/bus/usb direcory generated for USB devices ramdisk.txt - short guide on how to set up and use the RAM disk. riscom8.txt @@ -157,12 +167,12 @@ - directory with info on the /proc/sys/* files sysrq.txt - info on the magic SysRq key -transname.txt - - how to use name translation to ease use of diskless systems. unicode.txt - info on the Unicode character/font mapping used in Linux. video4linux/ - directory with info regarding video/TV/radio cards and linux. +vm/ + - directory with info on the Linux vm code. watchdog.txt - how to auto-reboot Linux if it has "fallen and can't get up". ;-) xterm-linux.xpm diff -u --recursive --new-file v2.3.28/linux/Documentation/Changes linux/Documentation/Changes --- v2.3.28/linux/Documentation/Changes Thu Nov 11 20:11:30 1999 +++ linux/Documentation/Changes Tue Nov 23 09:23:18 1999 @@ -385,9 +385,21 @@ === Due to changes in the PPP driver and routing code, those of you -using PPP networking will need to upgrade your pppd. +using PPP networking will need to upgrade your pppd to at least +version 2.3.9. See ftp://cs.anu.edu.au/pub/software/ppp/ for newest +versions. -See ftp://cs.anu.edu.au/pub/software/ppp/ for newest versions. + You must make sure that the special device file /dev/ppp exists. +It can be made by executing this command as root: + + mknod /dev/ppp c 108 0 + + If you have built ppp support as modules, you should put the lines +below in your /etc/modules.conf file. I assume you want asynchronous +ppp; replace ppp_async by ppp_synctty if you want synchronous ppp. + + alias char-major-108 ppp_generic + alias tty-ldisc-3 ppp_async iBCS ==== diff -u --recursive --new-file v2.3.28/linux/Documentation/Configure.help linux/Documentation/Configure.help --- v2.3.28/linux/Documentation/Configure.help Thu Nov 18 20:25:37 1999 +++ linux/Documentation/Configure.help Tue Nov 23 10:15:42 1999 @@ -6499,10 +6499,16 @@ SiS 900 PCI Fast Ethernet Adapter support CONFIG_SIS900 - This is a driver for the Silicon Integrated System Corporation 900 - Fast Ethernet PCI network card. If you have one of those, say Y and - read the Ethernet-HOWTO, available from - http://metalab.unc.edu/mdw/linux.html#howto . + This is a driver for the Fast Ethernet PCI network cards based on + the SiS 900 and SiS 7016 chips. The SiS 900 core is also embedded in + SiS 630 and SiS 540 chipsets. If you have one of those, say Y and + read the Ethernet-HOWTO, available via FTP (user: anonymous) in + ftp://metalab.unc.edu/pub/Linux/docs/HOWTO. Please read + Documentation/networking/sis900.txt and comments at the beginning + of drivers/net/sis900.c for more information. + + This driver also supports AMD 79C901 HomePNA such that you can use + your phone line as network cable. If you want to compile this driver as a module ( = code which can be inserted in and removed from the running kernel whenever you want), @@ -6569,6 +6575,27 @@ The safe and default value for this is N. +SysKonnect SK-98xx support +CONFIG_SK98LIN + Say Y here if you have a SysKonnect SK-98xx Gigabit Ethernet Server + Adapter. The following adapters are supported by this driver: + - SK-9841 (single link 1000Base-LX) + - SK-9842 (dual link 1000Base-LX) + - SK-9843 (single link 1000Base-SX) + - SK-9844 (dual link 1000Base-SX) + - SK-9821 (single link 1000Base-T) + - SK-9822 (dual link 1000Base-T) + The dual link adapters support a link-failover feature. + Read Documentation/networking/sk98lin.txt for information about + optional driver parameters. + Questions concerning this driver may be addresse to: + linux@syskonnect.de + + If you want to compile this driver as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read Documentation/modules.txt. This is recommended. + The module will be called sk98lin.o. + AMD LANCE and PCnet (AT1500 and NE2100) support CONFIG_LANCE If you have a network (Ethernet) card of this type, say Y and read @@ -11128,10 +11155,10 @@ is the only voice-supporting driver. See Documentation/isdn/README.audio for more information. -X.25 PLP on top of ISDN (EXPERIMENTAL) +X.25 PLP on top of ISDN CONFIG_ISDN_X25 - This experimental feature provides the X.25 protocol over ISDN - connections. See Documentation/isdn/README.x25 for more information + This feature provides the X.25 protocol over ISDN connections. + See Documentation/isdn/README.x25 for more information if you are thinking about using this. ISDN diversion services support @@ -11193,6 +11220,28 @@ called hisax.o. See Documentation/isdn/README.HiSax for more information on using this driver. +HiSax Support for EURO/DSS1 +CONFIG_HISAX_EURO + Enable this if you have a EURO ISDN line. + +Support for german chargeinfo +CONFIG_DE_AOC + If you have german AOC, you can enable this to get the charginfo. + +Disable sending complete +CONFIG_HISAX_NO_SENDCOMPLETE + If you have trouble with some ugly exchanges or you live in + Australia select this option. + +Disable sending low layer compatibility +CONFIG_HISAX_NO_LLC + If you have trouble with some ugly exchanges try to select this + option. + +HiSax Support for german 1TR6 +CONFIG_HISAX_1TR6 + Enable this if you have a old german 1TR6 line. + HiSax Support for Teles 16.0/8.0 CONFIG_HISAX_16_0 This enables HiSax support for the Teles ISDN-cards S0-16.0, S0-8 @@ -11211,13 +11260,15 @@ different cards, a different D-channel protocol, or non-standard IRQ/port settings. -HiSax Support for Teles 16.3c -CONFIG_HISAX_TELES3C - This enables HiSax support for the Teles ISDN-cards 16.3c. - - See Documentation/isdn/README.HiSax on how to configure it using the - different cards, a different D-channel protocol, or non-standard - IRQ/port settings. +HiSax Support for Teles PCI +CONFIG_HISAX_TELESPCI + This enables HiSax support for the Teles PCI. + See Documentation/isdn/README.HiSax on how to configure it. + +HiSax Support for Teles S0Box +CONFIG_HISAX_S0BOX + This enables HiSax support for the Teles/Creatix parallel port + S0BOX. See Documentation/isdn/README.HiSax on how to configure it. HiSax Support for AVM A1 (Fritz) CONFIG_HISAX_AVM_A1 @@ -11227,7 +11278,17 @@ different cards, a different D-channel protocol, or non-standard IRQ/port settings. -HiSax Support for Elsa ISA cards +HiSax Support for AVM PnP/PCI (Fritz!PNP/PCI) +CONFIG_HISAX_FRITZPCI + This enables HiSax support for the AVM "Fritz!PnP" and "Fritz!PCI". + See Documentation/isdn/README.HiSax on how to configure it. + +HiSax Support for AVM A1 PCMCIA (Fritz) +CONFIG_HISAX_AVM_A1_PCMCIA + This enables HiSax support for the AVM A1 "Fritz!PCMCIA"). + See Documentation/isdn/README.HiSax on how to configure it. + +HiSax Support for Elsa cards CONFIG_HISAX_ELSA This enables HiSax support for the Elsa Mircolink ISA cards, for the Elsa Quickstep series cards and Elsa PCMCIA. @@ -11270,7 +11331,16 @@ different cards, a different D-channel protocol, or non-standard IRQ/port settings. -HiSax Support for Sedlbauer speed card/win-star +HiSax Support for HFC-S based cards +CONFIG_HISAX_HFCS + This enables HiSax support for the HFC-S 2BDS0 based cards, like + teles 16.3c. + + See Documentation/isdn/README.HiSax on how to configure it using the + different cards, a different D-channel protocol, or non-standard + IRQ/port settings. + +HiSax Support for Sedlbauer cards CONFIG_HISAX_SEDLBAUER This enables HiSax support for the Sedlbauer passive ISDN cards. @@ -11307,50 +11377,58 @@ See Documentation/isdn/README.HiSax on how to configure it using a different D-channel protocol, or non-standard IRQ/port settings. -HiSax Support for Am7930 (EXPERIMENTAL) -CONFIG_HISAX_AMD7930 - This enables HiSax support for the AMD7930 chips on some SPARCs. - This code is not finished yet. +HiSax Support for Siemens I-Surf card +CONFIG_HISAX_ISURF + This enables HiSax support for the Siemens I-Talk/I-Surf card with + ISAR chip. + See Documentation/isdn/README.HiSax on how to configure it using a + different D-channel protocol, or non-standard IRQ/port settings. -HiSax Support for EURO/DSS1 -CONFIG_HISAX_EURO - Say Y or N according to the D-channel protocol which your local - telephone service company provides. +HiSax Support for HST Saphir card +CONFIG_HISAX_HSTSAPHIR + This enables HiSax support for the HST Saphir card. + + See Documentation/isdn/README.HiSax on how to configure it using a + different D-channel protocol, or non-standard IRQ/port settings. - NOTE: If you say Y here and you have only one ISDN card installed, - you cannot say Y to "HiSax Support for German 1TR6", below. And vice - versa. +HiSax Support for Telekom A4T card +CONFIG_HISAX_BKM_A4T + This enables HiSax support for the Telekom A4T card. + + See Documentation/isdn/README.HiSax on how to configure it using a + different D-channel protocol, or non-standard IRQ/port settings. -Support for German tariff info -CONFIG_DE_AOC - If you want that the HiSax hardware driver sends messages to the - upper level of the isdn code on each AOCD (Advice Of Charge, During - the call -- transmission of the fee information during a call) and - on each AOCE (Advice Of Charge, at the End of the call -- - transmission of fee information at the end of the call), say Y here. - This works only in Germany. - -Support for Australian Microlink service (not for std. EURO) -CONFIG_HISAX_ML - If you are in Australia and connected to the Microlink telephone - network, enable this, because there are little differences in - protocol. +HiSax Support for Scitel Quadro card +CONFIG_HISAX_SCT_QUADRO + This enables HiSax support for the Scitel Quadro card. - Please don't enable this in other countries. + See Documentation/isdn/README.HiSax on how to configure it using a + different D-channel protocol, or non-standard IRQ/port settings. -HiSax Support for US/NI-1 (not released yet) -CONFIG_HISAX_NI1 - Say Y or N according to the D-channel protocol which your local - telephone service company provides. +HiSax Support for Gazel cards +CONFIG_HISAX_GAZEL + This enables HiSax support for the Gazel cards. -HiSax Support for German 1TR6 -CONFIG_HISAX_1TR6 - Say Y or N according to the D-channel protocol which your local - telephone service company provides. + See Documentation/isdn/README.HiSax on how to configure it using a + different D-channel protocol, or non-standard IRQ/port settings. - NOTE: If you say Y here and you have only one ISDN card installed, - you cannot say Y to "HiSax Support for EURO/DSS1", above. And vice - versa. +HiSax Support for HFC PCI-Bus cards +CONFIG_HISAX_HFC_PCI + This enables HiSax support for the HFC-S PCI 2BDS0 based cards. + + For more informations see under Documentation/isdn/README.hfc-pci. + +HiSax Support for Winbond W6692 based cards +CONFIG_HISAX_W6692 + This enables HiSax support for Winbond W6692 based PCI ISDN cards. + + See Documentation/isdn/README.HiSax on how to configure it using a + different D-channel protocol, or non-standard IRQ/port settings. + +HiSax Support for Am7930 (EXPERIMENTAL) +CONFIG_HISAX_AMD7930 + This enables HiSax support for the AMD7930 chips on some SPARCs. + This code is not finished yet. PCBIT-D support CONFIG_ISDN_DRV_PCBIT @@ -11399,26 +11477,51 @@ an ISDN-fax-machine. This must be supported by the lowlevel driver also. See Documentation/isdn/README.fax for more information. -AVM-B1 with CAPI2.0 support +AVM CAPI2.0 support CONFIG_ISDN_DRV_AVMB1 - This enables support for the AVM B1 ISDN networking cards. In + This enables support for the AVM B1/T1 ISDN networking cards.In addition, a CAPI (Common ISDN Application Programming Interface, a standard making it easy for programs to access ISDN hardware, see - http://www.capi.org/ ) interface for this card is provided. In order - to use this card, additional firmware is necessary, which has to be - downloaded into the card using a utility which is distributed - separately. Please read the file Documentation/isdn/README.avmb1. - + http://www.capi.org/; to browse the WWW, you need to have access to + a machine on the Internet that has a program like lynx or netscape) + interface for this card is provided. In order to use this card, + additional firmware is necessary, which has to be downloaded into + the card using a utility which is distributed separately. Please + read the file Documentation/isdn/README.avmb1. + This code is also available as a module ( = code which can be inserted in and removed from the running kernel whenever you want). The module will be called avmb1.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. +AVM B1 ISA support +CONFIG_ISDN_DRV_AVMB1_B1ISA + Enable support for the ISA version of the AVM B1 card. + +AVM B1 PCI support +CONFIG_ISDN_DRV_AVMB1_B1PCI + Enable support for the PCI version of the AVM B1 card. + +AVM T1/T1-B ISA support +CONFIG_ISDN_DRV_AVMB1_T1ISA + Enable support for the AVM T1 T1B card. + Note: This is a PRI card and handle 30 B-channels. + +AVM B1/M1/M2 PCMCIA support +CONFIG_ISDN_DRV_AVMB1_B1PCMCIA + Enable support for the PCMCIA version of the AVM B1 card. + +AVM T1/T1-B PCI support +CONFIG_ISDN_DRV_AVMB1_T1PCI + Enable support for the AVM T1 T1B card. + Note: This is a PRI card and handle 30 B-channels. + Verbose reason code reporting (kernel size +=7K) CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON If you say Y here, the AVM B1 driver will give verbose reasons for disconnecting. This will increase the size of the kernel by 7 KB. If unsure, say Y. + IBM Active 2000 support (EXPERIMENTAL) CONFIG_ISDN_DRV_ACT2000 diff -u --recursive --new-file v2.3.28/linux/Documentation/ioctl-number.txt linux/Documentation/ioctl-number.txt --- v2.3.28/linux/Documentation/ioctl-number.txt Wed Oct 27 16:34:12 1999 +++ linux/Documentation/ioctl-number.txt Fri Nov 19 11:35:10 1999 @@ -122,6 +122,8 @@ asm-sparc64/kbio.h 'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system +'l' 40-7F linux/udf_fs_i.h in development: + 'm' all linux/mtio.h conflict! 'm' all linux/soundcard.h conflict! 'm' all linux/synclink.h conflict! diff -u --recursive --new-file v2.3.28/linux/Documentation/networking/ppp.txt linux/Documentation/networking/ppp.txt --- v2.3.28/linux/Documentation/networking/ppp.txt Fri Apr 3 17:48:11 1998 +++ linux/Documentation/networking/ppp.txt Wed Dec 31 16:00:00 1969 @@ -1,51 +0,0 @@ -*NEWSFLASH* -This kernel release needs a minor bug fix for pppd to run properly with -the new routing code. When your pppd doesn't work apply the following -patch to pppd-2.2.0f or update to the newest pppd version. - -Patch: - ---- ppp-2.2.0f/pppd/sys-linux.c-o Wed Sep 17 00:23:01 1997 -+++ ppp-2.2.0f/pppd/sys-linux.c Wed Sep 17 00:23:11 1997 -@@ -927,8 +927,11 @@ - - if (ioctl(sockfd, SIOCADDRT, &rt) < 0) - { -+/* The new linux routing code doesn't like routes on down devices. */ -+#if 0 - syslog (LOG_ERR, "ioctl(SIOCADDRT) device route: %m"); - return (0); -+#endif - } - return 1; - } - - --Andi Kleen --------------------------------------------------------------------- - -The PPP support for this kernel requires the 2.2.0 version of the -pppd daemon. You will find the current version of the daemon on -sunsite.unc.edu in the /pub/Linux/system/Network/serial directory. - -Sunsite has many mirror sites. Please feel free to obtain it from -a mirror site close to you. - -If you attempt to use a version of pppd which is not compatible -then you will have some error condition. It usually is reflected -in that an ioctl operation will generate a fatal error. - -Please do not use earlier versions of the 2.2 package. If you -obtained a copy from merit.edu or bellatrix then please get an -update from the sunsite site. - -The CCP (Compression Control Protocol) which is supported by this -code is functional. You will need a compatible BSD compressor on -your peer site to use the code. - -The BSD compression code will only build as a loadable module. There -was an earlier version which would build it into the kernel but that -functionality has been removed for various reasons. - --- -Al Longyear longyear@netcom.com diff -u --recursive --new-file v2.3.28/linux/Documentation/networking/sis900.txt linux/Documentation/networking/sis900.txt --- v2.3.28/linux/Documentation/networking/sis900.txt Wed Dec 31 16:00:00 1969 +++ linux/Documentation/networking/sis900.txt Thu Nov 18 20:14:51 1999 @@ -0,0 +1,460 @@ + SiS 900/7016 Fast Ethernet Device Driver + by Ollie Lho (ollie@sis.com.tw) + November 4, 1999. Document Revision: 0.1 + + This document gives some information on installation and usage of SiS + 900/7016 device driver under Linux. + ______________________________________________________________________ + + Table of Contents + + + 1. Introduction + + 2. License + + 3. Changes + + 4. Tested Environment + + 5. Files in This Rackage + + 6. Installation + + 6.1 Kernel version later than 2.2.11 and 2.3.15 + 6.1.1 Building the driver as loadable module + 6.1.2 Building the driver into kernel + 6.2 Earlier Kernel Version in 2.2.x and 2.3.x Series + + 7. Known Problems and Bugs + + 8. Revision History + + 9. Acknowledgements + + + + ______________________________________________________________________ + + 1. Introduction + + This document describes the revision 1.06 of SiS 900/7016 Fast + Ethernet device driver under Linux. The driver is developed by Silicon + Integrated System Corp. and distributed freely under the GNU General + Public License (GPL). The driver can be compiled as a loadable module + and used under Linux kernel version 2.2.x. With minimal changes, the + driver can also be used under 2.3.x kernel, please see section + ``Installation''. If you are intended to use the driver for earlier + kernels, you are on your own. + + The driver is tested with usual TCP/IP applications including FTP, + Telnet, Netscape etc. and is used constantly by the developers. + + Please send all comments/fixes/questions to Ollie Lho. + + + 2. License + + + + + + + + + + + Copyright (C) 1999 Silicon Integrated System Corp. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + + + + 3. Changes + + Changes made in Revision 1.06 + + 1. Separation of sis900.c and sis900.h in order to move most constant + definition to sis900.h (many of those constants were corrected) + + 2. Clean up PCI detection, the pci-scan from Donald Becker were not + used, just simple pci_find_*. + + 3. MII detection is modified to support multiple mii transceiver. + + 4. Bugs in read_eeprom, mdio_* were removed. + + 5. Lot of sis900 irrelevant comments were removed/changed and more + comments were added to reflect the real situation. + + 6. Clean up of physical/virtual address space mess in buffer + descriptors. + + 7. Better transmit/receive error handling. + + 8. The driver now uses zero-copy single buffer management scheme to + improve performance. + + 9. Names of variables were changed to be more consistent. + + 10. Clean up of auo-negotiation and timer code. + + 11. Automatic detection and change of PHY on the fly. + + + 4. Tested Environment + + This driver is developed on the following hardware + + o Intel Celeron 336 with SiS 620 (rev 02) chipset + + o SiS 900 (rev 01) and SiS 7016/7014 Fast Ethernet Card + + and tested with these software environments + + o Red Hat Linux version 6.0 + + o Linux kernel version 2.2.13 + + o Netscape version 4.6 + + o NcFTP 3.0.0 beta 18 + + o Samba version 2.0.3 + + + 5. Files in This Rackage + + In the package you can find these files: + + + sis900-2.2.x.c + Driver source for kernel 2.2.x + + sis900-2.3.x.c + Driver source for kernel 2.3.x + + sis900.h + Header file for both 2.2.x and 2.3.x kernel + + sis900.sgml + Linux-Doc SGML source of the document + + + 6. Installation + + Before trying to install the driver, be sure to get the latest + revision from SiS' Home Page. If you have no prior experience in + networking under Linux, please read Ethernet HOWTO and Networking + HOWTO available from Linux Documentation Project (LDP). + + The installation procedure are different according to your kernel + versions. + + + 6.1. Kernel version later than 2.2.11 and 2.3.15 + + The driver is bundled in release later than 2.2.11 and 2.3.15 so this + is the most easy case. Be sure you have the appropriate packages for + compiling kernel source. Those packages are listed in + Document/Changes in kernel source distribution. There are two + alternative ways to install the driver + + + 6.1.1. Building the driver as loadable module + + To build the driver as a loadable kernel module you have to + reconfigure the kernel to activate network support by + + + + make config + + + + + Choose "Network Device Support" to "Y" and "Ethernet Support" to "Y". + Then you have to choose "SiS 900 Fast Ethernet Adapter Support" to + "M". + + After reconfiguring the kernel, you can make the driver module by + + + make modules + + + + + The driver should be compiled with no errors. After compiling the + driver, the driver can be installed to proper place by + + + + make modules_install + + + + + Load the driver into kernel by + + + + insmod sis900 + + + + + When loading the driver into memory, some information message can be + view by + + + + dmesg + + + + + or + + + cat /var/log/message + + + + + If the driver is loaded properly you will have messages similar to + this: + + + + sis900.c: v1.06 11/04/99 + eth0: SiS 900 PCI Fast Ethernet at 0xd000, IRQ 10, 00:00:e8:83:7f:a4. + eth0: SiS 900 Internal MII PHY transceiver found at address 1. + + + + + showing the version of the driver and the results of probing routine. + + Once the driver is loaded, network can be brought up by + + + + /sbin/ifconfig eth0 IPADDR broadcast BROADCAST netmask NETMASK + + + + + + where IPADDR, BROADCAST, NETMASK are your IP address, broadcast + address and netmask respectively. For more information on how to + configure network interface, please refer to Networking HOWTO. + + The link status is also shown by kernel messages. For example, after + the network interface is activated, you may have the message: + + + + eth0: Using SiS 900 Internal MII PHY as default + eth0: Media Link On 100mbps full-duplex + + + + + If you try to unplug the twist pair (TP) cable you will get + + + + eth0: Media Link Off + + + + + indicating that the link is failed. + + + 6.1.2. Building the driver into kernel + + If you want to make the driver into kernel, choose "Y" rather than "M" + on "SiS 900 Fast Ethernet Adapter Support" when configuring the + kernel. Build the kernel image in the usual way + + + + make dep + + make clean + + make bzlilo + + + + + Next time the system reboot, you have the driver in memory. + + + 6.2. Earlier Kernel Version in 2.2.x and 2.3.x Series + + Installing the driver for earlier kernels in 2.2.x and 2.3.x series + requires a little bit more work. First you have to copy sis900-2.x.x.c + to /usr/src/linux/drivers/net/ and you have to modify some files + manually (sorry !! no patch available !!) + + in Space.c, add + + + extern int sis900_probe(struct device *dev); + + ... + + #ifdef CONFIG_SIS900 + {sis900_probe,0}, + #endif + + + in Config.in add + + + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + ... //other adapter drivers + tristate 'SiS 900 PCI Fast Ethernet Adapter Support' CONFIG_SIS900 + ... //other adapter drivers + fi + + + + + in Makefile add + + + ifeq ($(CONFIG_SIS900),y) + L_OBJS += sis900.o + else + ifeq ($(CONFIG_SIS900),m) + M_OBJS += sis900.o + endif + endif + + + + + After modifying these files, the driver can be build as described in + the previous section. + + + 7. Known Problems and Bugs + + There are some known problems and bugs. If you find any other bugs + please mail to ollie@sis.com.tw + + 1. AM79C901 HomePNA PHY is not thoroughly tested, there may be some + bugs in the "on the fly" change of transceiver. + + 2. A bug is hidden somewhere in the receive buffer management code, + the bug causes NULL pointer reference in the kernel. This fault is + caught before bad things happen and reported with the message: + + + eth0: NULL pointer encountered in Rx ring, skipping + + + + + which can be viewed with dmesg or cat /var/log/message. + + + 8. Revision History + + + o November 4, 1999, Revision 1.06, Second release, lots of clean up + and optimization. + + o August 8, 1999, Revision 1.05, Initial Public Release + + + 9. Acknowledgements + + This driver was originally derived form Donald Becker's pci-skeleton + and rtl8139 drivers. Donald also provided various suggestion regarded + with improvements made in revision 1.06. + + The 1.05 revision was created by Jim Huang, AMD 79c901 support was + added by Chin-Shan Li. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -u --recursive --new-file v2.3.28/linux/Documentation/networking/sk98lin.txt linux/Documentation/networking/sk98lin.txt --- v2.3.28/linux/Documentation/networking/sk98lin.txt Wed Dec 31 16:00:00 1969 +++ linux/Documentation/networking/sk98lin.txt Tue Nov 23 10:15:42 1999 @@ -0,0 +1,480 @@ +(C)Copyright 1999 SysKonnect. +=========================================================================== + +sk98lin.txt created 11-Nov-1999 + +Readme File for sk98lin.o v3.02 +SK-NET Gigabit Ethernet Adapter SK-98xx Driver for Linux + +This file contains +(1) OVERVIEW +(2) REQUIRED FILES +(3) INSTALLATION +(4) INCLUSION OF THE ADAPTER AT SYSTEM START +(5) DRIVER PARAMETERS +(6) LARGE FRAME SUPPORT +(7) TROUBLESHOOTING +(8) HISTORY + +=========================================================================== + + + +(1) OVERVIEW +============ + +The sk98lin driver supports the SysKonnect SK-NET Gigabit Ethernet +Adapter SK-98xx family on Linux 2.2.x. +It has been tested with Linux on Intel/x86 and ALPHA machines. +From v3.02 on, the driver is integrated in the linux kernel source. +*** + + +(2) REQUIRED FILES +================== + +The linux kernel source. +No additional files required. +*** + + +(3) INSTALLATION +================ + +The following steps describe the actions that are required to install +the driver and to start it manually. These steps should be carried +out for the initial driver setup. Once confirmed to be ok, they can +be included in the system start which is described in the next +chapter. + +NOTE 1: You must have 'root' access to the system to perform + the following tasks. +NOTE 2: IMPORTANT: In case of problems, please read the section + "Troubleshooting" below. + +1) The driver can either be integrated into the kernel or it can + be compiled as a module. + Select the appropriate option during the kernel configuration. + For use as a module, your kernel must have + 'loadable module support' enabled. + For automatic driver start, you also need 'Kernel module loader' + enabled. + Configure those options, build and install the new kernel. If you + choose to use the driver as a module, do "make modules" and + "make modules_install". + Reboot your system. + +4) Load the module manually by entering: + insmod sk98lin.o + If the SysKonnect SK-98xx adapter is installed in your + computer and you have a /proc filesystem, running the command + 'more /proc/net/dev' should produce an output containing a + line with the following format: + eth0: 0 0 ... + which means that your adapter has been found and initialized. + + NOTE 1: If you have more than one SysKonnect SK-98xx adapter, the + adapters will be listed as 'eth0', 'eth1', 'eth2', etc. + For each adapter, repeat the steps 5) and 6). + NOTE 2: If you have other Ethernet adapters installed, + your SysKonnect SK-98xx adapter can be mapped to 'eth1' or + 'eth2' ... + The module installation message (in system logfile or + on console, depending on /etc/syslog.conf) prints a line + for each adapter that is found, containing the + corresponding 'ethX'. + +5) Select an IP address and assign it to the respective adapter by + entering: + ifconfig eth0 + This causes the adapter to connect to the ethernet. The solitary + yellow LED at the adapter is now active, the link status LED of + the primary port is on and the link status LED of the secondary + port (on dual port adapters) is blinking (only if the laters are + connected to a switch or hub). + You will also get a status message on the console saying + "ethX: network connection up using port Y" and indicating + the selected connection parameters. + + NOTE: If you are in doubt about IP addresses, ask your network + administrator for assistance. + +6) Your adapter should now be fully operational. + Use 'ping ' to verify the connection to other + computers on your network. + By entering 'ifconfig', you can check the number of packets sent + and received by your adapter and additional some other information + regarding the adapter configuration. + +7) The driver module can be stopped and unloaded using the following + commands: + ifconfig eth0 down + rmmod sk98lin +*** + + +(4) INCLUSION OF THE ADAPTER AT SYSTEM START +============================================ + +Since a large number of different Linux distributions are +available, we are unable to describe a general installation procedure +for the driver module. +Because the driver is now integrated in the kernel, installation should +be easy, using the standard mechanism of your distribution. +Refer to the distribution's manual for installation of ethernet adapters. +*** + + +(5) DRIVER PARAMETERS +===================== + +Parameters can be set at the command line while loading the +module with 'insmod'. The configuration tools of some distributions +can also give parameters to the driver module. +If you use the kernel module loader, you can set driver parameters +in the file /etc/conf.modules. Insert a line of the form: + +options sk98lin ... + +For "...", use the same syntax as described below for the command +line paramaters of insmod. +You either have to reboot your computer or unload and reload +the driver to activate the new parameters. +The syntax of the driver parameters is: + +insmod sk98lin parameter=value1[,value2[,value3...]] + +value1 is for the first adapter, value2 for the second one etc. +All Parameters are case sensitive, so write them exactly as +shown below. + +Sample: Suppose you have two adapters. You want to set AutoNegotiation + on Port A of the first adapter to ON and on Port A of the + second adapter to OFF. + You also want to set DuplexCapabilities on Port A of the first + adapter to FULL and on Port A of the second adapter to HALF. + You must enter: + + insmod sk98lin.o AutoNeg_A=On,Off DupCap_A=Full,Half + +NOTE: The number of adapters that can be configured this way is + limited in the driver (file skge.c, constant SK_MAX_CARD_PARAM). + The current limit is 16. If you happen to install + more adapters, adjust this and recompile. + + +5.1 Per-Port Parameters +----------------------- +Those setting are available for each port on the adapter. +In the following description, '?' stands for the port for +which you set the parameter (A or B). + +- Auto Negotiation + Parameter: AutoNeg_? + Values: On, Off, Sense + Default: Sense + + The "Sense"-mode finds out automatically whether the link + partner supports autonegotiation or not. + +- Duplex Capabilities + Parameter: DupCap_? + Values: Half, Full, Both + Default: Both + + This parameters is relevant only if autonegotiation for + this port is not "Sense". If autonegotiation is "On", all + three values are possible. If it is "Off", only "Full" and + "Half" are allowed. + It is usefull if your link partner does not support all + possible combinations. + +- Flow Control + Parameter: FlowCtrl_? + Values: Sym, SymOrRem, LocSend, None + Default: SymOrRem + + This parameter can be used to set the flow control capabilities + that the port reports during autonegotiation. + The meaning of the different modes is: +-- Sym = Symetric: both link partners are allowed to send PAUSE frames +-- SymOrRem = SymetricOrRemote: both or only remote partner are allowed + to send PAUSE frames +-- LocSend = LocalSend: only local link partner is allowed to send + PAUSE frames +-- None: no link partner is allowed to send PAUSE frames + + NOTE: This parameter is ignored if autonegotiation is set to "Off". + +- Role in Master-Slave-Negotiation (1000Base-T only). + Parameter: Role_? + Values: Auto, Master, Slave + Default: Auto + + This parameter is only valid for the SK-9821 and SK-9822 adapters. + For two 1000Base-T ports to communicate, one must take the role as + master (providing timing information), while the other must be slave. + Normally, this is negotiated between the two ports during link + establishment. If this should ever fail, you can force a port to a + specific setting with this parameter. + + +5.2 Per-Adapter Parameters +-------------------------- + +- Preferred Port + Parameter: PrefPort + Values: A, B + Default: A + + This is used to force the preferred port to A or B (on two-port NICs). + The preferred port is the one that is used if both are detected as + fully functional. + +- RLMT (Redundant Link Management Technology) Mode + Parameter: RlmtMode + Values: CheckLinkState,CheckLocalPort, CheckSeg + Default: CheckLinkState + + RLMT (the driver part that decides which port to use) knows three + ways of checking if a port is available for use: + +-- CheckLinkState = Check link state only: RLMT uses the link state + reported by the adapter hardware for each individual port to determine + whether a port can be used for all network traffic or not. + +-- CheckLocalPort - Check other port on adapter: RLMT sends test frames + from each port to each other port and checks if they are received by + the other port, respectively. Thus, the ports must be connected to the + network such that LLC test frames can be exchanged between them + (i.e. there must be no routers between the ports). + +-- CheckSeg - Check other port and segmentation: RLMT checks the other port + and in addition requests information from the Gigabit Ethernet + switch next to each port to see if the network is segmented between + the ports. Thus, this mode is only to be used if you have Gigabit + Ethernet switches installed in your network that have been configured + to use the Spanning Tree protocol. + + NOTE: The modes CheckLocalPort and CheckSeg are meant to operate in + configurations where a network path between the ports on one + adapter exists. Especially, they are not designed to work where + adapters are connected back-to-back. +*** + + +(6) LARGE FRAME SUPPORT +======================= + +Large frames (also called jumbo frames) are now supported by the +driver. This can result in a greatly improved throughput if +transfering large amounts of data. +To enable large frames, set the MTU (maximum transfer unit) +of the interface to the value you wish (up to 9000). The command +for this is: + ifconfig eth0 mtu 9000 +This will only work if you have two adapters connected back-to-back +or if you use a switch that supports large frames. When using a +switch, it should be configured to allow large frames, without +autonegotiating for them. +The setting must be done on all adapters that can be reached by +the large frames. If one adapter is not set to receive large frames, +it will simply drop them. + +NOTE: If you look at the statistics (with netstat) in large frame + mode while there is traffic on the net, you will see the + RX error counter go up. This is because the adapter hardware + counts received large frames as errors, although they are + received correctly. So ignore this counter in that case. + +You can switch back to the standard ethernet frame size with: + ifconfig eth0 mtu 1500 +*** + + +(7) TROUBLESHOOTING +=================== + +If you run into problems during installation, check those items: + +Problem: The SK-98xx adapter can not be found by the driver. +Reason: Look in /proc/pci for the following entry: + 'Ethernet controller: SysKonnect SK-98xx ...' + If this entry exists, then the SK-98xx adapter has been + found by the system and should be able to be used. + If this entry does not exist or if the file '/proc/pci' + is not there, then you may have a hardware problem or PCI + support may not be enabled in your kernel. + The adapter can be checked using the diagnostic program + which is available from the SysKonnect web site: + www.syskonnect.de + Some COMPAQ machines have a problem with PCI under + Linux. This is described in the 'PCI howto' document + (included in some distributions or available from the + www, e.g. at 'www.linux.org'). This might be fixed in the + 2.2.x kernel series (I've not tested it). + +Problem: Programs such as 'ifconfig' or 'route' can not be found or + you get an error message 'Operation not permitted'. +Reason: You are not logged in as user 'root'. Logout and + login as root or change to root via 'su'. + +Problem: Using the command 'ping
', you get a message + "ping: sendto: Network is unreachable". +Reason: Your route is not set up correct. + If you are using RedHat, you probably forgot + to set up the route in 'network configuration'. + Check the existing routes with the 'route' command + and check if there is an entry for 'eth0' and if + it is correct. + +Problem: The driver can be started, the adapter is connected + to the network, but you can not receive or transmit + any packet; e.g. 'ping' does not work. +Reason: You have an incorrect route in your routing table. + Check the routing table with the command 'route' and + read the manual pages about route ('man route'). +NOTE: Although the 2.2.x kernel versions generate the routing + entry automatically, you may have problems of this kind + here, too. We found a case where the driver started correct + at system boot, but after removing and reloading the driver, + the route of the adapter's network pointed to the 'dummy0' + device and had to be corrected manually. + +Problem: You want to use your computer as a router between + multiple IP subnetworks (using multiple adapters), but + you can not reach computers in other subnetworks. +Reason: Either the router's kernel is not configured for IP + forwarding or there is a problem with the routing table + and gateway configuration in at least one of the + computers. + +Problem: At the start of the driver, you get an error message: + "eth0: -- ERROR -- + Class: internal Software error + Nr: 0xcc + Msg: SkGeInitPort() cannot init running ports" +Reason: You are using a driver compiled for single processor + machines on an multiprocessor machine with SMP (Symetric + MultiProcessor) kernel. + Configure your kernel appropriate and recompile the kernel or + the modules. + +If your problem is not listed here, please contact SysKonnect's technical +support for help (linux@syskonnect.de). +When contacting our technical support, please ensure that the +following information is available: +- System Manufacturer and Model +- Boards in your system +- Distribution +- Kernel version +*** + + +(8) HISTORY +=========== + +VERSION 3.02 +Problems fixed: +- None +New Features: +- Integration in linux kernel source. +Known limitations: +- None + +VERSION 3.02 +Problems fixed: +- None +New Features: +- Full source release +Known limitations: +- None + +VERSION 3.00 +Problems fixed: +- None +New Features: +- Support for 1000Base-T adapters (SK-9821 and SK-9822) +Known limitations: +- None + +VERSION 1.07 +Problems fixed: +- RlmtMode parameter value strings were wrong (#10437) +- Driver sent too many RLMT frames (#10439) +- Driver did not recognize network segmentation (#10440) +- RLMT switched too often on segmented network (#10441) +Known limitations: +- None + +VERSION 1.06 +Problems fixed: +- System panic'ed after some time when running with + RlmtMode=CheckOtherLink or RlmtMode=CheckSeg (#10421) + Panic message: "Kernel panic: skput: over ... dev: eth0" +- Driver did not switch back to default port when connected + back-to-back (#10422). +Changes: +- RlmtMode parameter names have changed +New features: +- There is now a version for ALPHA processors +Known limitations: +- None + +VERSION 1.05 +Problems fixed: +- Driver failed to load on kernels with version information + for module symbols enabled +Known limitations: +- None + +VERSION 1.04 +Problems fixed: +- Large frame support does work now (no autonegotiation + support for large frames, just manually selectable) +New Features: +- Receive checksumming in hardware +- Performance optimizations + Some numbers (on two PII-400 machines, back-to-back): + netpipe: 300 MBit/sec, with large frames: 470 MBit/sec + ttcp: 38 MByte/sec, with large frames: 60 MByte/sec + ttcp (UDP send): 66 MByte/sec, with large frames: 106 MByte/sec +Known limitations: +- None + +VERSION 1.03 +Problems fixed: +- Unloading with "rmmod" caused segmentation fault (#10415) +- The link LED flickered from time to time, if no link was + established (#10402) +- Installation problems with RedHat 6.0 (#10409) +New Features: +- Connection state ouput at "network connection up" +Known limitations: +- None + +VERSION 1.02 +Problems fixed: +- Failed with multiple adapters +- Failed with Single Port adapters +- Startup string was only displayed if adapter found +- No link could be established on certain switches when the switches were + rebooted. (#10377) +Known limitations: +- Segmentation fault at "rmmod" with kernel 2.2.3 on some machines + +VERSION 1.01 +Problems fixed: +- Sensor status was not set back to 'ok' after 'warning/error'. (#10386) +Changes: +- improved parallelism in driver + +VERSION 1.00 +Known limitations: +- not tested with all kernel versions (I don't have that much time :-) +- only x86 version available (if you need others, ask for it) +- source code not completely available + +***End of Readme File*** + + diff -u --recursive --new-file v2.3.28/linux/MAINTAINERS linux/MAINTAINERS --- v2.3.28/linux/MAINTAINERS Thu Nov 11 20:11:31 1999 +++ linux/MAINTAINERS Sun Nov 21 11:13:56 1999 @@ -110,7 +110,7 @@ ADVANSYS SCSI DRIVER P: Bob Frey -M: Bob Frey +M: linux@advansys.com W: http://www.advansys.com/linux.html L: linux-scsi@vger.rutgers.edu S: Maintained @@ -799,6 +799,12 @@ P: Ingo Molnar M: mingo@redhat.com S: Maintained + +SIS 900/7016 FAST ETHERNET DRIVER +P: Ollie Lho +M: ollie@sis.com.tw +L: linux-net@vger.rutgers.edu +S: Supported SMB FILESYSTEM P: Andrew Tridgell diff -u --recursive --new-file v2.3.28/linux/Makefile linux/Makefile --- v2.3.28/linux/Makefile Thu Nov 18 20:25:37 1999 +++ linux/Makefile Tue Nov 23 10:15:42 1999 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 3 -SUBLEVEL = 28 +SUBLEVEL = 29 EXTRAVERSION = ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) @@ -112,6 +112,7 @@ DRIVERS =drivers/block/block.a \ drivers/char/char.o \ drivers/misc/misc.o \ + drivers/net/net.o \ drivers/parport/parport.a LIBS =$(TOPDIR)/lib/lib.a SUBDIRS =kernel drivers mm fs net ipc lib @@ -124,8 +125,6 @@ DRIVERS := $(DRIVERS) drivers/isdn/isdn.a endif -DRIVERS := $(DRIVERS) drivers/net/net.a - ifdef CONFIG_NET_FC DRIVERS := $(DRIVERS) drivers/net/fc/fc.a endif @@ -364,6 +363,7 @@ if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \ if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \ if [ -f IRDA_MODULES ]; then inst_mod IRDA_MODULES net; fi; \ + if [ -f SK98LIN_MODULES ]; then inst_mod SK98LIN_MODULES net; fi; \ if [ -f USB_MODULES ]; then inst_mod USB_MODULES usb; fi; \ if [ -f PCMCIA_MODULES ]; then inst_mod PCMCIA_MODULES pcmcia; fi; \ if [ -f PCMCIA_NET_MODULES ]; then inst_mod PCMCIA_NET_MODULES pcmcia; fi; \ diff -u --recursive --new-file v2.3.28/linux/arch/alpha/boot/bootp.c linux/arch/alpha/boot/bootp.c --- v2.3.28/linux/arch/alpha/boot/bootp.c Fri Jun 25 17:36:13 1999 +++ linux/arch/alpha/boot/bootp.c Tue Nov 23 10:10:38 1999 @@ -200,11 +200,11 @@ load(START_ADDR+(4*KERNEL_SIZE), KERNEL_ORIGIN, KERNEL_SIZE); load(START_ADDR, START_ADDR+(4*KERNEL_SIZE), KERNEL_SIZE); - memset((char*)ZERO_PAGE(0), 0, PAGE_SIZE); - strcpy((char*)ZERO_PAGE(0), envval); + memset((char*)ZERO_PGE, 0, PAGE_SIZE); + strcpy((char*)ZERO_PGE, envval); #ifdef INITRD_SIZE - ((long *)(ZERO_PAGE(0)+256))[0] = initrd_start; - ((long *)(ZERO_PAGE(0)+256))[1] = INITRD_SIZE; + ((long *)(ZERO_PGE+256))[0] = initrd_start; + ((long *)(ZERO_PGE+256))[1] = INITRD_SIZE; #endif runkernel(); diff -u --recursive --new-file v2.3.28/linux/arch/alpha/boot/main.c linux/arch/alpha/boot/main.c --- v2.3.28/linux/arch/alpha/boot/main.c Fri Jun 25 17:36:13 1999 +++ linux/arch/alpha/boot/main.c Tue Nov 23 10:10:38 1999 @@ -182,7 +182,7 @@ nbytes = 0; } envval[nbytes] = '\0'; - strcpy((char*)ZERO_PAGE(0), envval); + strcpy((char*)ZERO_PGE, envval); srm_printk(" Ok\nNow booting the kernel\n"); runkernel(); diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/alpha_ksyms.c linux/arch/alpha/kernel/alpha_ksyms.c --- v2.3.28/linux/arch/alpha/kernel/alpha_ksyms.c Thu Nov 11 20:11:31 1999 +++ linux/arch/alpha/kernel/alpha_ksyms.c Tue Nov 23 10:10:38 1999 @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #define __KERNEL_SYSCALLS__ diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_apecs.c linux/arch/alpha/kernel/core_apecs.c --- v2.3.28/linux/arch/alpha/kernel/core_apecs.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_apecs.c Tue Nov 23 10:10:38 1999 @@ -357,7 +357,7 @@ }; void __init -apecs_init_arch(unsigned long *mem_start, unsigned long *mem_end) +apecs_init_arch(void) { struct pci_controler *hose; @@ -386,7 +386,7 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); + hose = alloc_pci_controler(); hose->io_space = &ioport_resource; hose->mem_space = &iomem_resource; hose->config_space = APECS_CONF; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_cia.c linux/arch/alpha/kernel/core_cia.c --- v2.3.28/linux/arch/alpha/kernel/core_cia.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_cia.c Tue Nov 23 10:10:38 1999 @@ -315,7 +315,7 @@ }; void __init -cia_init_arch(unsigned long *mem_start, unsigned long *mem_end) +cia_init_arch(void) { struct pci_controler *hose; struct resource *hae_mem; @@ -424,8 +424,8 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); - hae_mem = alloc_resource(mem_start); + hose = alloc_pci_controler(); + hae_mem = alloc_resource(); hose->io_space = &ioport_resource; hose->mem_space = hae_mem; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_lca.c linux/arch/alpha/kernel/core_lca.c --- v2.3.28/linux/arch/alpha/kernel/core_lca.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_lca.c Tue Nov 23 10:10:38 1999 @@ -279,7 +279,7 @@ }; void __init -lca_init_arch(unsigned long *mem_start, unsigned long *mem_end) +lca_init_arch(void) { struct pci_controler *hose; @@ -307,7 +307,7 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); + hose = alloc_pci_controler(); hose->io_space = &ioport_resource; hose->mem_space = &iomem_resource; hose->config_space = LCA_CONF; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_mcpcia.c linux/arch/alpha/kernel/core_mcpcia.c --- v2.3.28/linux/arch/alpha/kernel/core_mcpcia.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_mcpcia.c Tue Nov 23 10:10:38 1999 @@ -205,7 +205,7 @@ static int mcpcia_read_config_byte(struct pci_dev *dev, int where, u8 *value) { - struct pci_controler *hose = dev->sysdata ? : probing_hose; + struct pci_controler *hose = dev->sysdata; unsigned long addr, w; unsigned char type1; @@ -221,7 +221,7 @@ static int mcpcia_read_config_word(struct pci_dev *dev, int where, u16 *value) { - struct pci_controler *hose = dev->sysdata ? : probing_hose; + struct pci_controler *hose = dev->sysdata; unsigned long addr, w; unsigned char type1; @@ -237,7 +237,7 @@ static int mcpcia_read_config_dword(struct pci_dev *dev, int where, u32 *value) { - struct pci_controler *hose = dev->sysdata ? : probing_hose; + struct pci_controler *hose = dev->sysdata; unsigned long addr; unsigned char type1; @@ -252,7 +252,7 @@ static int mcpcia_write_config(struct pci_dev *dev, int where, u32 value, long mask) { - struct pci_controler *hose = dev->sysdata ? : probing_hose; + struct pci_controler *hose = dev->sysdata; unsigned long addr; unsigned char type1; @@ -327,16 +327,16 @@ } static void __init -mcpcia_new_hose(unsigned long *mem_start, int h) +mcpcia_new_hose(int h) { struct pci_controler *hose; struct resource *io, *mem, *hae_mem; int mid = hose2mid(h); - hose = alloc_pci_controler(mem_start); - io = alloc_resource(mem_start); - mem = alloc_resource(mem_start); - hae_mem = alloc_resource(mem_start); + hose = alloc_pci_controler(); + io = alloc_resource(); + mem = alloc_resource(); + hae_mem = alloc_resource(); hose->io_space = io; hose->mem_space = hae_mem; @@ -420,7 +420,7 @@ } void __init -mcpcia_init_arch(unsigned long *mem_start, unsigned long *mem_end) +mcpcia_init_arch(void) { extern asmlinkage void entInt(void); struct pci_controler *hose; @@ -437,7 +437,7 @@ /* First, find how many hoses we have. */ for (h = 0; h < MCPCIA_MAX_HOSES; ++h) { if (mcpcia_probe_hose(h)) { - mcpcia_new_hose(mem_start, h); + mcpcia_new_hose(h); hose_count++; } } diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_polaris.c linux/arch/alpha/kernel/core_polaris.c --- v2.3.28/linux/arch/alpha/kernel/core_polaris.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_polaris.c Tue Nov 23 10:10:38 1999 @@ -176,7 +176,7 @@ }; void __init -polaris_init_arch(unsigned long *mem_start, unsigned long *mem_end) +polaris_init_arch(void) { struct pci_controler *hose; @@ -192,7 +192,7 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); + hose = alloc_pci_controler(); hose->io_space = &ioport_resource; hose->mem_space = &iomem_resource; hose->config_space = POLARIS_DENSE_CONFIG_BASE; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_pyxis.c linux/arch/alpha/kernel/core_pyxis.c --- v2.3.28/linux/arch/alpha/kernel/core_pyxis.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_pyxis.c Tue Nov 23 10:10:38 1999 @@ -285,7 +285,7 @@ }; void __init -pyxis_init_arch(unsigned long *mem_start, unsigned long *mem_end) +pyxis_init_arch(void) { struct pci_controler *hose; unsigned int temp; @@ -379,7 +379,7 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); + hose = alloc_pci_controler(); hose->io_space = &ioport_resource; hose->mem_space = &iomem_resource; hose->config_space = PYXIS_CONF; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_t2.c linux/arch/alpha/kernel/core_t2.c --- v2.3.28/linux/arch/alpha/kernel/core_t2.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_t2.c Tue Nov 23 10:10:38 1999 @@ -322,7 +322,7 @@ }; void __init -t2_init_arch(unsigned long *mem_start, unsigned long *mem_end) +t2_init_arch(void) { struct pci_controler *hose; unsigned int i; @@ -384,7 +384,7 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); + hose = alloc_pci_controler(); hose->io_space = &ioport_resource; hose->mem_space = &iomem_resource; hose->config_space = T2_CONF; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/core_tsunami.c linux/arch/alpha/kernel/core_tsunami.c --- v2.3.28/linux/arch/alpha/kernel/core_tsunami.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/core_tsunami.c Tue Nov 23 10:10:38 1999 @@ -84,7 +84,7 @@ mk_conf_addr(struct pci_dev *dev, int where, unsigned long *pci_addr, unsigned char *type1) { - struct pci_controler *hose = dev->sysdata ? : probing_hose; + struct pci_controler *hose = dev->sysdata; unsigned long addr; u8 bus = dev->bus->number; u8 device_fn = dev->devfn; @@ -154,6 +154,7 @@ return PCIBIOS_DEVICE_NOT_FOUND; __kernel_stb(value, *(vucp)addr); + mb(); return PCIBIOS_SUCCESSFUL; } @@ -167,6 +168,7 @@ return PCIBIOS_DEVICE_NOT_FOUND; __kernel_stw(value, *(vusp)addr); + mb(); return PCIBIOS_SUCCESSFUL; } @@ -180,6 +182,7 @@ return PCIBIOS_DEVICE_NOT_FOUND; *(vuip)addr = value; + mb(); return PCIBIOS_SUCCESSFUL; } @@ -243,31 +246,37 @@ #define FN __FUNCTION__ static void __init -tsunami_init_one_pchip(tsunami_pchip *pchip, int index, - unsigned long *mem_start) +tsunami_init_one_pchip(tsunami_pchip *pchip, int index) { struct pci_controler *hose; if (tsunami_probe_read(&pchip->pctl.csr) == 0) return; - hose = alloc_pci_controler(mem_start); - hose->io_space = alloc_resource(mem_start); - hose->mem_space = alloc_resource(mem_start); + hose = alloc_pci_controler(); + hose->io_space = alloc_resource(); + hose->mem_space = alloc_resource(); hose->config_space = TSUNAMI_CONF(index); hose->index = index; hose->io_space->start = TSUNAMI_IO(index) - TSUNAMI_IO_BIAS; - hose->io_space->end = hose->io_space->start + 0xffff; + hose->io_space->end = hose->io_space->start + TSUNAMI_IO_SPACE; hose->io_space->name = pci_io_names[index]; + hose->io_space->flags = IORESOURCE_IO; hose->mem_space->start = TSUNAMI_MEM(index) - TSUNAMI_MEM_BIAS; + /* the IOMEM address space is larger than 32bit but most pci + cars doesn't support 64bit address space so we stick with + 32bit here (see the TSUNAMI_MEM_SPACE define). */ hose->mem_space->end = hose->mem_space->start + 0xffffffff; hose->mem_space->name = pci_mem_names[index]; + hose->mem_space->flags = IORESOURCE_MEM; - request_resource(&ioport_resource, hose->io_space); - request_resource(&iomem_resource, hose->mem_space); + if (request_resource(&ioport_resource, hose->io_space) < 0) + printk(KERN_ERR "failed to request IO on hose %d", index); + if (request_resource(&iomem_resource, hose->mem_space) < 0) + printk(KERN_ERR "failed to request IOMEM on hose %d", index); /* * Set up the PCI->physical memory translation windows. @@ -294,7 +303,7 @@ } void __init -tsunami_init_arch(unsigned long *mem_start, unsigned long *mem_end) +tsunami_init_arch(void) { #ifdef NXM_MACHINE_CHECKS_ON_TSUNAMI extern asmlinkage void entInt(void); @@ -338,9 +347,9 @@ /* Find how many hoses we have, and initialize them. TSUNAMI and TYPHOON can have 2, but might only have 1 (DS10). */ - tsunami_init_one_pchip(TSUNAMI_pchip0, 0, mem_start); + tsunami_init_one_pchip(TSUNAMI_pchip0, 0); if (TSUNAMI_cchip->csc.csr & 1L<<14) - tsunami_init_one_pchip(TSUNAMI_pchip1, 1, mem_start); + tsunami_init_one_pchip(TSUNAMI_pchip1, 1); } static inline void diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/machvec_impl.h linux/arch/alpha/kernel/machvec_impl.h --- v2.3.28/linux/arch/alpha/kernel/machvec_impl.h Tue Aug 31 17:29:12 1999 +++ linux/arch/alpha/kernel/machvec_impl.h Tue Nov 23 10:10:38 1999 @@ -7,6 +7,7 @@ */ #include +#include /* Whee. Both TSUNAMI and POLARIS don't have an HAE. Fix things up for the GENERIC kernel by defining the HAE address to be that of the cache. diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/pci.c linux/arch/alpha/kernel/pci.c --- v2.3.28/linux/arch/alpha/kernel/pci.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/pci.c Tue Nov 23 10:10:38 1999 @@ -6,10 +6,14 @@ * David Mosberger (davidm@cs.arizona.edu) */ +/* 2.3.x PCI/resources, 1999 Andrea Arcangeli */ + #include #include #include #include +#include +#include #include #include "proto.h" @@ -36,7 +40,6 @@ */ struct pci_controler *hose_head, **hose_tail = &hose_head; -struct pci_controler *probing_hose; /* * Quirks. @@ -62,24 +65,93 @@ { 0 } }; +#define MAX(val1, val2) ((val1) > (val2) ? (val1) : (val2)) +#define ALIGN(val,align) (((val) + ((align) - 1)) & ~((align) - 1)) +#define KB 1024 +#define MB (1024*KB) +#define GB (1024*MB) +unsigned long resource_fixup(struct pci_dev * dev, struct resource * res, + unsigned long start, unsigned long size) +{ + unsigned long alignto; + + if (res->flags & IORESOURCE_IO) + { + /* + * Aligning to 0x800 rather than the minimum base of + * 0x400 is an attempt to avoid having devices in + * any 0x?C?? range, which is where the de4x5 driver + * probes for EISA cards. + * + * Adaptecs, especially, resent such intrusions. + */ + alignto = MAX(0x800, size); + start = ALIGN(start, alignto); + } + else if (res->flags & IORESOURCE_MEM) + { + /* + * The following holds at least for the Low Cost + * Alpha implementation of the PCI interface: + * + * In sparse memory address space, the first + * octant (16MB) of every 128MB segment is + * aliased to the very first 16 MB of the + * address space (i.e., it aliases the ISA + * memory address space). Thus, we try to + * avoid allocating PCI devices in that range. + * Can be allocated in 2nd-7th octant only. + * Devices that need more than 112MB of + * address space must be accessed through + * dense memory space only! + */ + /* align to multiple of size of minimum base */ + alignto = MAX(0x1000, size); + start = ALIGN(start, alignto); + if (size > 7 * 16*MB) + printk(KERN_WARNING "PCI: dev %s " + "requests %ld bytes of contiguous " + "address space---don't use sparse " + "memory accesses on this device!\n", + dev->name, size); + else + { + if (((start / (16*MB)) & 0x7) == 0) { + start &= ~(128*MB - 1); + start += 16*MB; + start = ALIGN(start, alignto); + } + if (start/(128*MB) != (start + size)/(128*MB)) { + start &= ~(128*MB - 1); + start += (128 + 16)*MB; + start = ALIGN(start, alignto); + } + } + } + + return start; +} +#undef MAX +#undef ALIGN +#undef KB +#undef MB +#undef GB /* * Pre-layout host-independant device initialization. */ static void __init -pcibios_assign_special(void) +pcibios_assign_special(struct pci_dev * dev) { - struct pci_dev *dev; - int i; - /* The first three resources of an IDE controler are often magic, so leave them unchanged. This is true, for instance, of the Contaq 82C693 as seen on SX164 and DP264. */ - for (dev = pci_devices; dev; dev = dev->next) { - if (dev->class >> 8 != PCI_CLASS_STORAGE_IDE) - continue; + if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE) + { + int i; + /* Resource 1 of IDE controller is the address of HD_CMD register which actually occupies a single byte (0x3f6 for ide0) in reported 0x3f4-3f7 range. We have to fix @@ -87,10 +159,9 @@ controller. */ dev->resource[1].start += 2; dev->resource[1].end = dev->resource[1].start; - for (i = 0; i < PCI_NUM_RESOURCES; i++) { - if (dev->resource[i].flags) + for (i = 0; i < PCI_NUM_RESOURCES; i++) + if (dev->resource[i].flags && dev->resource[i].start) pci_claim_resource(dev, i); - } } } @@ -110,31 +181,63 @@ } void __init +pcibios_fixup_resource(struct resource *res, struct resource *root) +{ + res->start += root->start; + res->end += root->start; +} + +void __init +pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus) +{ + /* Update device resources. */ + + int i; + + for (i = 0; i < PCI_NUM_RESOURCES; i++) { + if (!dev->resource[i].start) + continue; + if (dev->resource[i].flags & IORESOURCE_IO) + pcibios_fixup_resource(&dev->resource[i], + bus->resource[0]); + else if (dev->resource[i].flags & IORESOURCE_MEM) + pcibios_fixup_resource(&dev->resource[i], + bus->resource[1]); + } + pcibios_assign_special(dev); +} + +void __init pcibios_fixup_bus(struct pci_bus *bus) { /* Propogate hose info into the subordinate devices. */ - struct pci_controler *hose = probing_hose; + struct pci_controler *hose = (struct pci_controler *) bus->sysdata; struct pci_dev *dev; bus->resource[0] = hose->io_space; bus->resource[1] = hose->mem_space; for (dev = bus->devices; dev; dev = dev->sibling) - dev->sysdata = hose; + if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) + pcibios_fixup_device_resources(dev, bus); } void __init pcibios_update_resource(struct pci_dev *dev, struct resource *root, struct resource *res, int resource) { - unsigned long where, size; - u32 reg; + int where; + u32 reg; - where = PCI_BASE_ADDRESS_0 + (resource * 4); - size = res->end - res->start; - pci_read_config_dword(dev, where, ®); - reg = (reg & size) | (((u32)(res->start - root->start)) & ~size); - pci_write_config_dword(dev, where, reg); + where = PCI_BASE_ADDRESS_0 + (resource * 4); + reg = (res->start - root->start) | (res->flags & 0xf); + pci_write_config_dword(dev, where, reg); + if ((res->flags & (PCI_BASE_ADDRESS_SPACE | PCI_BASE_ADDRESS_MEM_TYPE_MASK)) + == (PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64)) + { + pci_write_config_dword(dev, where+4, 0); + printk(KERN_WARNING "PCI: dev %s type 64-bit\n", dev->name); + } /* ??? FIXME -- record old value for shutdown. */ } @@ -170,6 +273,15 @@ } void __init +pcibios_fixup_pbus_ranges(struct pci_bus * bus, struct pbus_set_ranges_data * ranges) +{ + ranges->io_start -= bus->resource[0]->start; + ranges->io_end -= bus->resource[0]->start; + ranges->mem_start -= bus->resource[1]->start; + ranges->mem_end -= bus->resource[1]->start; +} + +void __init common_init_pci(void) { struct pci_controler *hose; @@ -180,15 +292,12 @@ for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { hose->first_busno = next_busno; hose->last_busno = 0xff; - probing_hose = hose; bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose); hose->bus = bus; next_busno = hose->last_busno = bus->subordinate; next_busno += 1; } - probing_hose = NULL; - pcibios_assign_special(); pci_assign_unassigned_resources(alpha_mv.min_io_address, alpha_mv.min_mem_address); pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); @@ -197,17 +306,11 @@ struct pci_controler * __init -alloc_pci_controler(unsigned long *mem_start) +alloc_pci_controler(void) { - unsigned long start = *mem_start; struct pci_controler *hose; - if (start & 31) - start = (start | 31) + 1; - hose = (void *) start; - start = (unsigned long) (hose + 1); - *mem_start = start; - memset(hose, 0, sizeof(*hose)); + hose = alloc_bootmem(sizeof(*hose)); *hose_tail = hose; hose_tail = &hose->next; @@ -216,17 +319,11 @@ } struct resource * __init -alloc_resource(unsigned long *mem_start) +alloc_resource(void) { - unsigned long start = *mem_start; struct resource *res; - if (start & 31) - start = (start | 31) + 1; - res = (void *) start; - start = (unsigned long) (res + 1); - *mem_start = start; - memset(res, 0, sizeof(*res)); + res = alloc_bootmem(sizeof(*res)); return res; } diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/pci_impl.h linux/arch/alpha/kernel/pci_impl.h --- v2.3.28/linux/arch/alpha/kernel/pci_impl.h Tue Sep 7 12:14:05 1999 +++ linux/arch/alpha/kernel/pci_impl.h Tue Nov 23 10:10:38 1999 @@ -125,12 +125,11 @@ /* The hose list. */ extern struct pci_controler *hose_head, **hose_tail; -extern struct pci_controler *probing_hose; extern void common_init_pci(void); extern u8 common_swizzle(struct pci_dev *, u8 *); -extern struct pci_controler *alloc_pci_controler(unsigned long *); -extern struct resource *alloc_resource(unsigned long *); +extern struct pci_controler *alloc_pci_controler(void); +extern struct resource *alloc_resource(void); extern const char *const pci_io_names[]; extern const char *const pci_mem_names[]; diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/proto.h linux/arch/alpha/kernel/proto.h --- v2.3.28/linux/arch/alpha/kernel/proto.h Tue Aug 31 17:29:12 1999 +++ linux/arch/alpha/kernel/proto.h Tue Nov 23 10:10:38 1999 @@ -12,43 +12,43 @@ /* core_apecs.c */ extern struct pci_ops apecs_pci_ops; -extern void apecs_init_arch(unsigned long *, unsigned long *); +extern void apecs_init_arch(void); extern void apecs_pci_clr_err(void); extern void apecs_machine_check(u64, u64, struct pt_regs *); /* core_cia.c */ extern struct pci_ops cia_pci_ops; -extern void cia_init_arch(unsigned long *, unsigned long *); +extern void cia_init_arch(void); extern void cia_machine_check(u64, u64, struct pt_regs *); /* core_lca.c */ extern struct pci_ops lca_pci_ops; -extern void lca_init_arch(unsigned long *, unsigned long *); +extern void lca_init_arch(void); extern void lca_machine_check(u64, u64, struct pt_regs *); /* core_mcpcia.c */ extern struct pci_ops mcpcia_pci_ops; -extern void mcpcia_init_arch(unsigned long *, unsigned long *); +extern void mcpcia_init_arch(void); extern void mcpcia_machine_check(u64, u64, struct pt_regs *); /* core_polaris.c */ extern struct pci_ops polaris_pci_ops; -extern void polaris_init_arch(unsigned long *, unsigned long *); +extern void polaris_init_arch(void); extern void polaris_machine_check(u64, u64, struct pt_regs *); /* core_pyxis.c */ extern struct pci_ops pyxis_pci_ops; -extern void pyxis_init_arch(unsigned long *, unsigned long *); +extern void pyxis_init_arch(void); extern void pyxis_machine_check(u64, u64, struct pt_regs *); /* core_t2.c */ extern struct pci_ops t2_pci_ops; -extern void t2_init_arch(unsigned long *, unsigned long *); +extern void t2_init_arch(void); extern void t2_machine_check(u64, u64, struct pt_regs *); /* core_tsunami.c */ extern struct pci_ops tsunami_pci_ops; -extern void tsunami_init_arch(unsigned long *, unsigned long *); +extern void tsunami_init_arch(void); extern void tsunami_machine_check(u64, u64, struct pt_regs *); /* setup.c */ diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c --- v2.3.28/linux/arch/alpha/kernel/setup.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/setup.c Tue Nov 23 10:10:38 1999 @@ -4,6 +4,8 @@ * Copyright (C) 1995 Linus Torvalds */ +/* 2.3.x bootmem, 1999 Andrea Arcangeli */ + /* * Bootup setup stuff. */ @@ -26,6 +28,7 @@ #include #include #include +#include #ifdef CONFIG_RTC #include @@ -40,6 +43,8 @@ #include #include #include +#include +#include #include "proto.h" #include "pci_impl.h" @@ -57,7 +62,6 @@ #define N(a) (sizeof(a)/sizeof(a[0])) -static unsigned long find_end_memory(void); static struct alpha_machine_vector *get_sysvec(long, long, long); static struct alpha_machine_vector *get_sysvec_byname(const char *); static void get_sysnames(long, long, char **, char **); @@ -68,7 +72,7 @@ * initialized, we need to copy things out into a more permanent * place. */ -#define PARAM ZERO_PAGE(0) +#define PARAM ZERO_PGE #define COMMAND_LINE ((char*)(PARAM + 0x0000)) #define COMMAND_LINE_SIZE 256 #define INITRD_START (*(unsigned long *) (PARAM+0x100)) @@ -181,12 +185,105 @@ request_resource(io, standard_io_resources+i); } -void __init -setup_arch(char **cmdline_p, unsigned long * memory_start_p, - unsigned long * memory_end_p) +#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) +#define PFN_PHYS(x) ((x) << PAGE_SHIFT) +#define PFN_MAX PFN_DOWN(0x80000000) +static void __init setup_memory(void) { + struct memclust_struct * cluster; + struct memdesc_struct * memdesc; + unsigned long start_pfn, bootmap_size; extern char _end[]; + int i; + + /* alloc the bootmem after the kernel */ + start_pfn = PFN_UP(virt_to_phys(_end)); + SRM_printf("_end %p\n", _end); + + /* find free clusters, and init and free the bootmem accordingly */ + memdesc = (struct memdesc_struct *) (hwrpb->mddt_offset + (unsigned long) hwrpb); + + for (cluster = memdesc->cluster, i = memdesc->numclusters; + i > 0; i--, cluster++) + { + unsigned long end; + + printk("memcluster %d, usage %02lx, start %8lu, end %8lu\n", + i, cluster->usage, cluster->start_pfn, + cluster->numpages); + + /* Bit 0 is console/PALcode reserved. Bit 1 is + non-volatile memory -- we might want to mark + this for later */ + if (cluster->usage & 3) + continue; + + end = cluster->start_pfn + cluster->numpages; + if (end > max_low_pfn) + max_low_pfn = end; + } + /* Enforce maximum of 2GB even if there is more. Blah. */ + if (max_low_pfn > PFN_MAX) + max_low_pfn = PFN_MAX; + SRM_printf("max_low_pfn %d\n", max_low_pfn); + + /* allocate the bootmem array after the kernel and mark + the whole MM as reserved */ + bootmap_size = init_bootmem(start_pfn, max_low_pfn); + + for (cluster = memdesc->cluster, i = memdesc->numclusters; + i > 0; i--, cluster++) + { + unsigned long end, start; + + /* Bit 0 is console/PALcode reserved. Bit 1 is + non-volatile memory -- we might want to mark + this for later */ + if (cluster->usage & 3) + continue; + + start = PFN_PHYS(cluster->start_pfn); + if (start < PFN_PHYS(start_pfn) + bootmap_size) + start = PFN_PHYS(start_pfn) + bootmap_size; + if (PFN_DOWN(start) >= PFN_MAX) + continue; + + end = PFN_PHYS(cluster->start_pfn + cluster->numpages); + if (PFN_DOWN(end) > PFN_MAX) + end = PFN_PHYS(PFN_MAX); + + if (start >= end) + continue; + free_bootmem(start, end-start); + } + +#ifdef CONFIG_BLK_DEV_INITRD + initrd_start = INITRD_START; + if (initrd_start) { + initrd_end = initrd_start+INITRD_SIZE; + printk("Initial ramdisk at: 0x%p (%lu bytes)\n", + (void *) initrd_start, INITRD_SIZE); + + if (initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) { + printk("initrd extends beyond end of memory " + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + initrd_end, phys_to_virt(PFN_PHYS(max_low_pfn))); + initrd_start = initrd_end = 0; + } + else + reserve_bootmem(virt_to_phys(initrd_start), INITRD_SIZE); + } +#endif /* CONFIG_BLK_DEV_INITRD */ +} +#undef PFN_UP +#undef PFN_DOWN +#undef PFN_PHYS +#undef PFN_MAX +void __init +setup_arch(char **cmdline_p) +{ struct alpha_machine_vector *vec = NULL; struct percpu_struct *cpu; char *type_name, *var_name, *p; @@ -258,6 +355,10 @@ alpha_using_srm = strncmp((const char *)hwrpb->ssn, "MILO", 4) != 0; #endif + SRM_printf("Booting on %s%s%s using machine vector %s\n", + type_name, (*var_name ? " variation " : ""), + var_name, alpha_mv.vector_name); + printk("Booting " #ifdef CONFIG_ALPHA_GENERIC "GENERIC " @@ -281,29 +382,12 @@ wrmces(0x7); /* Find our memory. */ - *memory_end_p = find_end_memory(); - *memory_start_p = (unsigned long) _end; - -#ifdef CONFIG_BLK_DEV_INITRD - initrd_start = INITRD_START; - if (initrd_start) { - initrd_end = initrd_start+INITRD_SIZE; - printk("Initial ramdisk at: 0x%p (%lu bytes)\n", - (void *) initrd_start, INITRD_SIZE); - - if (initrd_end > *memory_end_p) { - printk("initrd extends beyond end of memory " - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - initrd_end, (unsigned long) memory_end_p); - initrd_start = initrd_end = 0; - } - } -#endif + setup_memory(); /* Initialize the machine. Usually has to do with setting up DMA windows and the like. */ if (alpha_mv.init_arch) - alpha_mv.init_arch(memory_start_p, memory_end_p); + alpha_mv.init_arch(); /* Reserve standard resources. */ reserve_std_resources(); @@ -352,35 +436,6 @@ setup_smp(); #endif } - -static unsigned long __init -find_end_memory(void) -{ - int i; - unsigned long high = 0; - struct memclust_struct * cluster; - struct memdesc_struct * memdesc; - - memdesc = (struct memdesc_struct *) - (INIT_HWRPB->mddt_offset + (unsigned long) INIT_HWRPB); - cluster = memdesc->cluster; - - for (i = memdesc->numclusters ; i > 0; i--, cluster++) { - unsigned long tmp; - tmp = (cluster->start_pfn + cluster->numpages) << PAGE_SHIFT; - if (tmp > high) - high = tmp; - } - - /* Round it up to an even number of pages. */ - high = (high + PAGE_SIZE) & (PAGE_MASK*2); - - /* Enforce maximum of 2GB even if there is more. Blah. */ - if (high > 0x80000000UL) - high = 0x80000000UL; - return PAGE_OFFSET + high; -} - static char sys_unknown[] = "Unknown"; static char systype_names[][16] = { diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/signal.c linux/arch/alpha/kernel/signal.c --- v2.3.28/linux/arch/alpha/kernel/signal.c Thu Jul 22 09:47:55 1999 +++ linux/arch/alpha/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -688,6 +688,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/smp.c linux/arch/alpha/kernel/smp.c --- v2.3.28/linux/arch/alpha/kernel/smp.c Fri Sep 10 23:57:27 1999 +++ linux/arch/alpha/kernel/smp.c Tue Nov 23 10:10:38 1999 @@ -23,8 +23,10 @@ #include #include #include +#include #include #include +#include #define __KERNEL_SYSCALLS__ #include diff -u --recursive --new-file v2.3.28/linux/arch/alpha/kernel/sys_sio.c linux/arch/alpha/kernel/sys_sio.c --- v2.3.28/linux/arch/alpha/kernel/sys_sio.c Sat Oct 9 11:47:50 1999 +++ linux/arch/alpha/kernel/sys_sio.c Tue Nov 23 10:10:38 1999 @@ -55,7 +55,7 @@ } static inline void __init -xl_init_arch(unsigned long *mem_start, unsigned long *mem_end) +xl_init_arch(void) { struct pci_controler *hose; @@ -93,7 +93,7 @@ * Create our single hose. */ - hose = alloc_pci_controler(mem_start); + hose = alloc_pci_controler(); hose->io_space = &ioport_resource; hose->mem_space = &iomem_resource; hose->config_space = LCA_CONF; @@ -101,7 +101,7 @@ } static inline void __init -alphabook1_init_arch(unsigned long *mem_start, unsigned long *mem_end) +alphabook1_init_arch(void) { /* The AlphaBook1 has LCD video fixed at 800x600, 37 rows and 100 cols. */ @@ -109,7 +109,7 @@ screen_info.orig_video_cols = 100; screen_info.orig_video_lines = 37; - lca_init_arch(mem_start, mem_end); + lca_init_arch(); } @@ -238,8 +238,8 @@ static inline void __init noname_init_pci(void) { - sio_pci_route(); common_init_pci(); + sio_pci_route(); sio_fixup_irq_levels(sio_collect_irq_levels()); ns87312_enable_ide(0x26e); } @@ -250,8 +250,8 @@ struct pci_dev *dev; unsigned char orig, config; - sio_pci_route(); common_init_pci(); + sio_pci_route(); /* * On the AlphaBook1, the PCMCIA chip (Cirrus 6729) diff -u --recursive --new-file v2.3.28/linux/arch/alpha/mm/fault.c linux/arch/alpha/mm/fault.c --- v2.3.28/linux/arch/alpha/mm/fault.c Fri Aug 13 11:53:50 1999 +++ linux/arch/alpha/mm/fault.c Tue Nov 23 10:10:38 1999 @@ -11,7 +11,7 @@ #define __EXTERN_INLINE inline #include -#include +#include #undef __EXTERN_INLINE #include diff -u --recursive --new-file v2.3.28/linux/arch/alpha/mm/init.c linux/arch/alpha/mm/init.c --- v2.3.28/linux/arch/alpha/mm/init.c Fri Oct 22 13:21:43 1999 +++ linux/arch/alpha/mm/init.c Tue Nov 23 10:10:38 1999 @@ -4,6 +4,8 @@ * Copyright (C) 1995 Linus Torvalds */ +/* 2.3.x zone allocator, 1999 Andrea Arcangeli */ + #include #include #include @@ -15,6 +17,7 @@ #include #include #include +#include /* max_low_pfn */ #ifdef CONFIG_BLK_DEV_INITRD #include #endif @@ -22,10 +25,12 @@ #include #include #include +#include #include #include +#include -#define DEBUG_POISON 0 +static unsigned long totalram_pages; extern void die_if_kernel(char *,struct pt_regs *,long); extern void show_net_buffers(void); @@ -58,7 +63,7 @@ pmd = (pmd_t *) __get_free_page(GFP_KERNEL); if (pgd_none(*pgd)) { if (pmd) { - clear_page((unsigned long)pmd); + clear_page((void *)pmd); pgd_set(pgd, pmd); return pmd + offset; } @@ -81,7 +86,7 @@ pte = (pte_t *) __get_free_page(GFP_KERNEL); if (pmd_none(*pmd)) { if (pte) { - clear_page((unsigned long)pte); + clear_page((void *)pte); pmd_set(pmd, pte); return pte + offset; } @@ -136,7 +141,7 @@ __bad_page(void) { memset((void *) EMPTY_PGE, 0, PAGE_SIZE); - return pte_mkdirty(mk_pte((unsigned long) EMPTY_PGE, PAGE_SHARED)); + return pte_mkdirty(mk_pte(mem_map + MAP_NR(EMPTY_PGE), PAGE_SHARED)); } void @@ -172,8 +177,6 @@ #endif } -extern unsigned long free_area_init(unsigned long, unsigned long); - static inline unsigned long load_PCB(struct thread_struct * pcb) { @@ -186,40 +189,39 @@ * paging_init() sets up the page tables: in the alpha version this actually * unmaps the bootup page table (as we're now in KSEG, so we don't need it). */ -unsigned long -paging_init(unsigned long start_mem, unsigned long end_mem) +void paging_init(void) { - int i; unsigned long newptbr; - struct memclust_struct * cluster; - struct memdesc_struct * memdesc; unsigned long original_pcb_ptr; + unsigned int zones_size[MAX_NR_ZONES] = {0, 0, 0}; + unsigned long dma_pfn, high_pfn; - /* initialize mem_map[] */ - start_mem = free_area_init(start_mem, end_mem); + dma_pfn = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; + high_pfn = max_low_pfn; - /* find free clusters, update mem_map[] accordingly */ - memdesc = (struct memdesc_struct *) - (hwrpb->mddt_offset + (unsigned long) hwrpb); - cluster = memdesc->cluster; - for (i = memdesc->numclusters ; i > 0; i--, cluster++) { - unsigned long pfn, nr; - - /* Bit 0 is console/PALcode reserved. Bit 1 is - non-volatile memory -- we might want to mark - this for later */ - if (cluster->usage & 3) - continue; - pfn = cluster->start_pfn; - nr = cluster->numpages; +#define ORDER_MASK (~((1 << (MAX_ORDER-1))-1)) +#define ORDER_ALIGN(n) (((n) + ~ORDER_MASK) & ORDER_MASK) - while (nr--) - clear_bit(PG_reserved, &mem_map[pfn++].flags); + dma_pfn = ORDER_ALIGN(dma_pfn); + high_pfn = ORDER_ALIGN(high_pfn); + +#undef ORDER_MASK +#undef ORDER_ALIGN + + if (dma_pfn > high_pfn) + zones_size[ZONE_DMA] = high_pfn; + else + { + zones_size[0] = dma_pfn; + zones_size[ZONE_NORMAL] = high_pfn - dma_pfn; } + /* initialize mem_map[] */ + free_area_init(zones_size); + /* Initialize the kernel's page tables. Linux puts the vptb in the last slot of the L1 page table. */ - memset((void *) ZERO_PAGE(0), 0, PAGE_SIZE); + memset((void *)ZERO_PGE, 0, PAGE_SIZE); memset(swapper_pg_dir, 0, PAGE_SIZE); newptbr = ((unsigned long) swapper_pg_dir - PAGE_OFFSET) >> PAGE_SHIFT; pgd_val(swapper_pg_dir[1023]) = @@ -252,8 +254,6 @@ phys_to_virt(original_pcb_ptr); } original_pcb = *(struct thread_struct *) original_pcb_ptr; - - return start_mem; } #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM) @@ -273,64 +273,12 @@ } #endif -#if DEBUG_POISON -static void -kill_page(unsigned long pg) -{ - unsigned long *p = (unsigned long *)pg; - unsigned long i = PAGE_SIZE, v = 0xdeadbeefdeadbeef; - do { - p[0] = v; - p[1] = v; - p[2] = v; - p[3] = v; - p[4] = v; - p[5] = v; - p[6] = v; - p[7] = v; - i -= 64; - p += 8; - } while (i != 0); -} -#else -#define kill_page(pg) -#endif - void -mem_init(unsigned long start_mem, unsigned long end_mem) +mem_init(void) { - unsigned long tmp; - - end_mem &= PAGE_MASK; - max_mapnr = num_physpages = MAP_NR(end_mem); - high_memory = (void *) end_mem; - start_mem = PAGE_ALIGN(start_mem); - - /* - * Mark the pages used by the kernel as reserved. - */ - tmp = KERNEL_START; - while (tmp < start_mem) { - set_bit(PG_reserved, &mem_map[MAP_NR(tmp)].flags); - tmp += PAGE_SIZE; - } - - for (tmp = PAGE_OFFSET ; tmp < end_mem ; tmp += PAGE_SIZE) { - if (tmp >= MAX_DMA_ADDRESS) - clear_bit(PG_DMA, &mem_map[MAP_NR(tmp)].flags); - if (PageReserved(mem_map+MAP_NR(tmp))) - continue; - atomic_set(&mem_map[MAP_NR(tmp)].count, 1); -#ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start && tmp >= initrd_start && tmp < initrd_end) - continue; -#endif - kill_page(tmp); - free_page(tmp); - } - tmp = nr_free_pages << PAGE_SHIFT; - printk("Memory: %luk available\n", tmp >> 10); - return; + max_mapnr = num_physpages = max_low_pfn; + totalram_pages += free_all_bootmem(); + printk("Memory: %luk available\n", totalram_pages >> 10); } void @@ -341,34 +289,36 @@ addr = (unsigned long)(&__init_begin); for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { - mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved); - atomic_set(&mem_map[MAP_NR(addr)].count, 1); - kill_page(addr); + ClearPageReserved(mem_map + MAP_NR(addr)); + set_page_count(mem_map+MAP_NR(addr), 1); free_page(addr); + totalram_pages++; } printk ("Freeing unused kernel memory: %ldk freed\n", (&__init_end - &__init_begin) >> 10); } +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long start, unsigned long end) +{ + for (; start < end; start += PAGE_SIZE) { + ClearPageReserved(mem_map + MAP_NR(start)); + set_page_count(mem_map+MAP_NR(start), 1); + free_page(start); + totalram_pages++; + } + printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); +} +#endif + void si_meminfo(struct sysinfo *val) { - int i; - - i = max_mapnr; - val->totalram = 0; + val->totalram = totalram_pages; val->sharedram = 0; - val->freeram = nr_free_pages << PAGE_SHIFT; - val->bufferram = atomic_read(&buffermem); - while (i-- > 0) { - if (PageReserved(mem_map+i)) - continue; - val->totalram++; - if (!atomic_read(&mem_map[i].count)) - continue; - val->sharedram += atomic_read(&mem_map[i].count) - 1; - } - val->totalram <<= PAGE_SHIFT; - val->sharedram <<= PAGE_SHIFT; - return; + val->freeram = nr_free_pages(); + val->bufferram = atomic_read(&buffermem_pages); + val->totalhigh = 0; + val->freehigh = 0; + val->mem_unit = PAGE_SIZE; } diff -u --recursive --new-file v2.3.28/linux/arch/arm/Makefile linux/arch/arm/Makefile --- v2.3.28/linux/arch/arm/Makefile Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/Makefile Tue Nov 23 22:23:11 1999 @@ -241,5 +241,3 @@ empeg_config: $(RM) arch/arm/defconfig cp arch/arm/def-configs/empeg arch/arm/defconfig - - diff -u --recursive --new-file v2.3.28/linux/arch/arm/boot/compressed/head-netwinder.S linux/arch/arm/boot/compressed/head-netwinder.S --- v2.3.28/linux/arch/arm/boot/compressed/head-netwinder.S Fri Oct 22 13:21:43 1999 +++ linux/arch/arm/boot/compressed/head-netwinder.S Tue Nov 23 22:23:11 1999 @@ -24,6 +24,7 @@ bcs 1b movs r4, r5 mov r5, #0 + mov r1, #5 @ only here to fix NeTTroms which dont set r1 movne pc, r0 mov r0, #0 diff -u --recursive --new-file v2.3.28/linux/arch/arm/def-configs/footbridge linux/arch/arm/def-configs/footbridge --- v2.3.28/linux/arch/arm/def-configs/footbridge Fri Oct 22 13:21:43 1999 +++ linux/arch/arm/def-configs/footbridge Tue Nov 23 22:23:11 1999 @@ -100,16 +100,27 @@ # CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_RZ1000 is not set CONFIG_BLK_DEV_IDEPCI=y -CONFIG_BLK_DEV_IDEDMA=y +CONFIG_BLK_DEV_IDEDMA_PCI=y +CONFIG_IDEDMA_PCI_AUTO=y +# IDEDMA_NEW_DRIVE_LISTINGS is not set +IDEDMA_PCI_EXPERIMENTAL=y CONFIG_BLK_DEV_OFFBOARD=y -CONFIG_IDEDMA_AUTO=y +# CONFIG_BLK_DEV_AEC6210 is not set +# CONFIG_BLK_DEV_CMD646 is not set +CONFIG_BLK_DEV_CY82C693=y +# CONFIG_BLK_DEV_HPT34X is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_NS87415 is not set # CONFIG_BLK_DEV_OPTI621 is not set +CONFIG_BLK_DEV_PDC202XX=y +# PDC202XX_FORCE_BURST_BIT is not set +# PDC202XX_FORCE_MASTER_MODE is not set # CONFIG_BLK_DEV_TRM290 is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -# CONFIG_BLK_DEV_CMD646 is not set CONFIG_BLK_DEV_SL82C105=y +CONFIG_BLK_DEV_IDEDMA=y +CONFIG_IDEDMA_AUTO=y # CONFIG_IDE_CHIPSETS is not set +# CONFIG_BLK_CPQ_DA is not set # # Additional Block Devices diff -u --recursive --new-file v2.3.28/linux/arch/arm/defconfig linux/arch/arm/defconfig --- v2.3.28/linux/arch/arm/defconfig Sun Nov 7 16:37:33 1999 +++ linux/arch/arm/defconfig Tue Nov 23 22:23:11 1999 @@ -91,7 +91,7 @@ # CONFIG_BLK_DEV_OPTI621 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_BLK_DEV_VIA82C586 is not set # CONFIG_BLK_DEV_CMD646 is not set CONFIG_BLK_DEV_SL82C105=y # CONFIG_IDE_CHIPSETS is not set diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/armksyms.c linux/arch/arm/kernel/armksyms.c --- v2.3.28/linux/arch/arm/kernel/armksyms.c Thu Nov 11 20:11:31 1999 +++ linux/arch/arm/kernel/armksyms.c Tue Nov 23 22:23:11 1999 @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/bios32.c linux/arch/arm/kernel/bios32.c --- v2.3.28/linux/arch/arm/kernel/bios32.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/kernel/bios32.c Tue Nov 23 22:23:11 1999 @@ -218,6 +218,14 @@ static int __init ebsa285_map_irq(struct pci_dev *dev, u8 slot, u8 pin) { + if (dev->vendor == PCI_VENDOR_ID_CONTAQ && + dev->device == PCI_DEVICE_ID_CONTAQ_82C693) + switch (PCI_FUNC(dev->devfn)) { + case 1: return 14; + case 2: return 15; + case 3: return 12; + } + return irqmap_ebsa285[(slot + pin) & 3]; } @@ -261,6 +269,8 @@ #define DEV(v,d) ((v)<<16|(d)) switch (DEV(dev->vendor, dev->device)) { case DEV(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142): + case DEV(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C885): + case DEV(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_YELLOWFIN): return IRQ_NETWINDER_ETHER100; case DEV(PCI_VENDOR_ID_WINBOND2, 0x5a5a): @@ -273,6 +283,7 @@ return IRQ_ISA_HARDDISK1; case DEV(PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000): + case DEV(PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010): return IRQ_NETWINDER_VGA; default: diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/bios32.h linux/arch/arm/kernel/bios32.h --- v2.3.28/linux/arch/arm/kernel/bios32.h Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/kernel/bios32.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,9 @@ +struct hw_pci { + void (*init)(void); + unsigned long io_start; + unsigned long mem_start; + u8 (*swizzle)(struct pci_dev *dev, u8 *pin); + int (*map_irq)(struct pci_dev *dev, u8 slot, u8 pin); +}; + +void __init dc21285_init(void); diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/ecard.c linux/arch/arm/kernel/ecard.c --- v2.3.28/linux/arch/arm/kernel/ecard.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/kernel/ecard.c Fri Nov 19 11:33:29 1999 @@ -865,7 +865,7 @@ return buffer - start; } -int get_ecard_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int get_ecard_dev_info(char *buf, char **start, off_t pos, int count) { ecard_t *ec = cards; off_t at = 0; diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/entry-armv.S linux/arch/arm/kernel/entry-armv.S --- v2.3.28/linux/arch/arm/kernel/entry-armv.S Fri Oct 22 13:21:44 1999 +++ linux/arch/arm/kernel/entry-armv.S Tue Nov 23 22:23:11 1999 @@ -20,6 +20,10 @@ #include "../lib/constants.h" +#ifndef MODE_SVC +#define MODE_SVC 0x13 +#endif + .text #define PF_TRACESYS 0x20 @@ -342,10 +346,8 @@ .endm .macro restore_user_regs - mrs r1, cpsr @ disable IRQs - orr r1, r1, #I_BIT ldr r0, [sp, #S_PSR] @ Get calling cpsr - msr cpsr, r1 + msr cpsr_c, #I_BIT | MODE_SVC @ disable IRQs msr spsr, r0 @ save in spsr_svc ldmia sp, {r0 - lr}^ @ Get calling r0 - lr mov r0, r0 @@ -360,16 +362,13 @@ /* If we're optimising for StrongARM the resulting code won't run on an ARM7 and we can save a couple of instructions. --pb */ -#ifdef __ARM_ARCH_4__ - .macro arm700_bug_check, instr, temp - .endm -#else .macro arm700_bug_check, instr, temp +#ifndef __ARM_ARCH_4__ and \temp, \instr, #0x0f000000 @ check for SWI teq \temp, #0x0f000000 bne .Larm700bug - .endm #endif + .endm .macro enable_irqs, temp mrs \temp, cpsr @@ -389,6 +388,13 @@ adr\cond \reg, \label .endm + .macro alignment_trap, rbase, rtemp, sym +#ifdef CONFIG_ALIGNMENT_TRAP + ldr \rtemp, [\rbase, #OFF_CR_ALIGNMENT(\sym)] + mcr p15, 0, \rtemp, c1, c0 +#endif + .endm + /* * Invalid mode handlers */ @@ -473,11 +479,9 @@ add r5, sp, #S_SP mov r1, lr stmia r5, {r0 - r4} @ save sp_SVC, lr_SVC, pc, cpsr, old_ro - mrs r9, cpsr @ Enable interrupts if they were tst r3, #I_BIT biceq r9, r9, #I_BIT @ previously - mov r0, r2 /* * This routine must not corrupt r9 @@ -489,9 +493,10 @@ #else bl cpu_data_abort #endif - msr cpsr, r9 + msr cpsr_c, r9 mov r3, sp bl SYMBOL_NAME(do_DataAbort) + msr cpsr_c, #I_BIT | MODE_SVC ldr r0, [sp, #S_PSR] msr spsr, r0 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr @@ -512,7 +517,7 @@ @ adrsvc ne, lr, 1b bne do_IRQ - ldr r0, [sp, #S_PSR] + ldr r0, [sp, #S_PSR] @ irqs are already disabled msr spsr, r0 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr @@ -533,7 +538,8 @@ mov r1, sp @ struct pt_regs *regs bl SYMBOL_NAME(do_undefinstr) -1: ldr lr, [sp, #S_PSR] @ Get SVC cpsr +1: msr cpsr_c, #I_BIT | MODE_SVC + ldr lr, [sp, #S_PSR] @ Get SVC cpsr msr spsr, lr ldmia sp, {r0 - pc}^ @ Restore SVC registers @@ -554,10 +560,6 @@ /* * User mode handlers */ -#ifdef DEBUG_UNDEF -t: .ascii "Prefetch -> undefined instruction\n\0" - .align -#endif .align 5 __dabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go stmia sp, {r0 - r12} @ save r0 - r12 @@ -566,12 +568,7 @@ ldmia r4, {r0 - r2} @ Get USR pc, cpsr stmia r3, {r0 - r2} @ Save USR pc, cpsr, old_r0 stmdb r3, {sp, lr}^ - -#ifdef CONFIG_ALIGNMENT_TRAP - ldr r7, [r4, #OFF_CR_ALIGNMENT(__temp_abt)] - mcr p15, 0, r7, c1, c0 -#endif - + alignment_trap r4, r7, __temp_abt mov fp, #0 #ifdef MULTI_CPU ldr r2, .LCprocfns @@ -580,10 +577,7 @@ #else bl cpu_data_abort #endif - mrs r3, cpsr @ Enable interrupts if they were - bic r3, r3, #I_BIT @ previously - msr cpsr, r3 - + msr cpsr_c, #MODE_SVC @ Enable interrupts mov r3, sp adrsvc al, lr, ret_from_sys_call b SYMBOL_NAME(do_DataAbort) @@ -596,12 +590,7 @@ ldmia r4, {r5 - r7} @ get saved PC, SPSR stmia r8, {r5 - r7} @ save pc, psr, old_r0 stmdb r8, {sp, lr}^ - -#ifdef CONFIG_ALIGNMENT_TRAP - ldr r7, [r4, #OFF_CR_ALIGNMENT(__temp_irq)] - mcr p15, 0, r7, c1, c0 -#endif - + alignment_trap r4, r7, __temp_irq mov fp, #0 1: get_irqnr_and_base r0, r6, r5 movne r1, sp @@ -621,12 +610,7 @@ ldmia r4, {r5 - r7} stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0 stmdb r8, {sp, lr}^ @ Save user r0 - r12 - -#ifdef CONFIG_ALIGNMENT_TRAP - ldr r7, [r4, #OFF_CR_ALIGNMENT(__temp_und)] - mcr p15, 0, r7, c1, c0 -#endif - + alignment_trap r4, r7, __temp_und mov fp, #0 adrsvc al, r9, ret_from_sys_call @ r9 = normal FP return adrsvc al, lr, fpundefinstr @ lr = undefined instr return @@ -640,9 +624,7 @@ fpundefinstr: mov r0, lr mov r1, sp - mrs r4, cpsr @ Enable interrupts - bic r4, r4, #I_BIT - msr cpsr, r4 + msr cpsr_c, #MODE_SVC @ Enable interrupts adrsvc al, lr, ret_from_sys_call b SYMBOL_NAME(do_undefinstr) @@ -654,16 +636,9 @@ ldmia r4, {r5 - r7} @ Get USR pc, cpsr stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0 stmdb r8, {sp, lr}^ @ Save sp_usr lr_usr - -#ifdef CONFIG_ALIGNMENT_TRAP - ldr r7, [r4, #OFF_CR_ALIGNMENT(__temp_abt)] - mcr p15, 0, r7, c1, c0 -#endif - + alignment_trap r4, r7, __temp_abt mov fp, #0 - mrs r7, cpsr @ Enable interrupts if they were - bic r7, r7, #I_BIT @ previously - msr cpsr, r7 + msr cpsr_c, #MODE_SVC @ Enable interrupts mov r0, r5 @ address (pc) mov r1, sp @ regs bl SYMBOL_NAME(do_PrefetchAbort) @ call abort handler @@ -681,6 +656,11 @@ msr spsr, lr ldmia sp, {r0 - pc}^ @ Restore USR registers +#ifdef DEBUG_UNDEF +t: .ascii "Prefetch -> undefined instruction\n\0" + .align +#endif + #include "entry-common.S" .text @@ -738,14 +718,31 @@ @ @ now branch to the relevent MODE handling routine @ - bic r13, lr, #63 - orr r13, r13, #0x93 - msr spsr, r13 @ switch to SVC_32 mode + msr spsr_c, #I_BIT | MODE_SVC @ switch to SVC_32 mode and lr, lr, #15 - adr r13, .LCtab_irq - ldr lr, [r13, lr, lsl #2] + ldr lr, [pc, lr, lsl #2] movs pc, lr @ Changes mode and branches + +.LCtab_irq: .word __irq_usr @ 0 (USR_26 / USR_32) + .word __irq_invalid @ 1 (FIQ_26 / FIQ_32) + .word __irq_invalid @ 2 (IRQ_26 / IRQ_32) + .word __irq_svc @ 3 (SVC_26 / SVC_32) + .word __irq_invalid @ 4 + .word __irq_invalid @ 5 + .word __irq_invalid @ 6 + .word __irq_invalid @ 7 + .word __irq_invalid @ 8 + .word __irq_invalid @ 9 + .word __irq_invalid @ a + .word __irq_invalid @ b + .word __irq_invalid @ c + .word __irq_invalid @ d + .word __irq_invalid @ e + .word __irq_invalid @ f + + .align 5 + /* * Data abort dispatcher - dispatches it to the correct handler for the processor mode * Enter in ABT mode, spsr = USR CPSR, lr = USR PC @@ -761,15 +758,31 @@ @ @ now branch to the relevent MODE handling routine @ - bic r13, lr, #63 - orr r13, r13, #0x93 - msr spsr, r13 @ switch to SVC_32 mode + msr spsr_c, #I_BIT | MODE_SVC @ switch to SVC_32 mode and lr, lr, #15 - adr r13, .LCtab_dabt - ldr lr, [r13, lr, lsl #2] + ldr lr, [pc, lr, lsl #2] movs pc, lr @ Changes mode and branches +.LCtab_dabt: .word __dabt_usr @ 0 (USR_26 / USR_32) + .word __dabt_invalid @ 1 (FIQ_26 / FIQ_32) + .word __dabt_invalid @ 2 (IRQ_26 / IRQ_32) + .word __dabt_svc @ 3 (SVC_26 / SVC_32) + .word __dabt_invalid @ 4 + .word __dabt_invalid @ 5 + .word __dabt_invalid @ 6 + .word __dabt_invalid @ 7 + .word __dabt_invalid @ 8 + .word __dabt_invalid @ 9 + .word __dabt_invalid @ a + .word __dabt_invalid @ b + .word __dabt_invalid @ c + .word __dabt_invalid @ d + .word __dabt_invalid @ e + .word __dabt_invalid @ f + + .align 5 + /* * Prefetch abort dispatcher - dispatches it to the correct handler for the processor mode * Enter in ABT mode, spsr = USR CPSR, lr = USR PC @@ -786,15 +799,18 @@ @ @ now branch to the relevent MODE handling routine @ - bic r13, lr, #63 - orr r13, r13, #0x93 - msr spsr, r13 @ switch to SVC_32 mode + msr spsr_c, #I_BIT | MODE_SVC @ switch to SVC_32 mode ands lr, lr, #15 ldreq lr, .LCtab_pabt ldrne lr, .LCtab_pabt + 4 movs pc, lr +.LCtab_pabt: .word __pabt_usr + .word __pabt_invalid + + .align 5 + /* * Undef instr entry dispatcher - dispatches it to the correct handler for the processor mode * Enter in UND mode, spsr = SVC/USR CPSR, lr = SVC/USR PC @@ -810,15 +826,31 @@ @ @ now branch to the relevent MODE handling routine @ - bic r13, lr, #63 - orr r13, r13, #0x93 - msr spsr, r13 @ switch to SVC_32 mode + msr spsr_c, #I_BIT | MODE_SVC @ switch to SVC_32 mode and lr, lr, #15 - adr r13, .LCtab_und - ldr lr, [r13, lr, lsl #2] + ldr lr, [pc, lr, lsl #2] movs pc, lr @ Changes mode and branches +.LCtab_und: .word __und_usr @ 0 (USR_26 / USR_32) + .word __und_invalid @ 1 (FIQ_26 / FIQ_32) + .word __und_invalid @ 2 (IRQ_26 / IRQ_32) + .word __und_svc @ 3 (SVC_26 / SVC_32) + .word __und_invalid @ 4 + .word __und_invalid @ 5 + .word __und_invalid @ 6 + .word __und_invalid @ 7 + .word __und_invalid @ 8 + .word __und_invalid @ 9 + .word __und_invalid @ a + .word __und_invalid @ b + .word __und_invalid @ c + .word __und_invalid @ d + .word __und_invalid @ e + .word __und_invalid @ f + + .align 5 + /*============================================================================= * Undefined FIQs *----------------------------------------------------------------------------- @@ -847,60 +879,6 @@ * for CPUs with separate I & D caches. */ .align 5 - -.LCtab_irq: .word __irq_usr @ 0 (USR_26 / USR_32) - .word __irq_invalid @ 1 (FIQ_26 / FIQ_32) - .word __irq_invalid @ 2 (IRQ_26 / IRQ_32) - .word __irq_svc @ 3 (SVC_26 / SVC_32) - .word __irq_invalid @ 4 - .word __irq_invalid @ 5 - .word __irq_invalid @ 6 - .word __irq_invalid @ 7 - .word __irq_invalid @ 8 - .word __irq_invalid @ 9 - .word __irq_invalid @ a - .word __irq_invalid @ b - .word __irq_invalid @ c - .word __irq_invalid @ d - .word __irq_invalid @ e - .word __irq_invalid @ f - -.LCtab_und: .word __und_usr @ 0 (USR_26 / USR_32) - .word __und_invalid @ 1 (FIQ_26 / FIQ_32) - .word __und_invalid @ 2 (IRQ_26 / IRQ_32) - .word __und_svc @ 3 (SVC_26 / SVC_32) - .word __und_invalid @ 4 - .word __und_invalid @ 5 - .word __und_invalid @ 6 - .word __und_invalid @ 7 - .word __und_invalid @ 8 - .word __und_invalid @ 9 - .word __und_invalid @ a - .word __und_invalid @ b - .word __und_invalid @ c - .word __und_invalid @ d - .word __und_invalid @ e - .word __und_invalid @ f - -.LCtab_dabt: .word __dabt_usr @ 0 (USR_26 / USR_32) - .word __dabt_invalid @ 1 (FIQ_26 / FIQ_32) - .word __dabt_invalid @ 2 (IRQ_26 / IRQ_32) - .word __dabt_svc @ 3 (SVC_26 / SVC_32) - .word __dabt_invalid @ 4 - .word __dabt_invalid @ 5 - .word __dabt_invalid @ 6 - .word __dabt_invalid @ 7 - .word __dabt_invalid @ 8 - .word __dabt_invalid @ 9 - .word __dabt_invalid @ a - .word __dabt_invalid @ b - .word __dabt_invalid @ c - .word __dabt_invalid @ d - .word __dabt_invalid @ e - .word __dabt_invalid @ f - -.LCtab_pabt: .word __pabt_usr - .word __pabt_invalid .LCvswi: .word vector_swi diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/head-armv.S linux/arch/arm/kernel/head-armv.S --- v2.3.28/linux/arch/arm/kernel/head-armv.S Fri Oct 22 13:21:44 1999 +++ linux/arch/arm/kernel/head-armv.S Tue Nov 23 22:23:11 1999 @@ -189,6 +189,7 @@ str r3, [r0], #4 add r3, r3, #1 << 20 str r3, [r0], #4 +1: #endif #endif #ifdef CONFIG_ARCH_RPC diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/process.c linux/arch/arm/kernel/process.c --- v2.3.28/linux/arch/arm/kernel/process.c Thu Nov 11 20:11:31 1999 +++ linux/arch/arm/kernel/process.c Tue Nov 23 22:23:11 1999 @@ -91,8 +91,8 @@ arch_reset(reboot_mode); + mdelay(1000); printk("Reboot failed -- System halted\n"); - while (1); } @@ -179,62 +179,51 @@ /* * Task structure and kernel stack allocation. - * - * Taken from the i386 version. */ +static struct task_struct *task_struct_head; +static unsigned int nr_task_struct; + #ifdef CONFIG_CPU_32 -#define EXTRA_TASK_STRUCT 8 -static struct task_struct *task_struct_stack[EXTRA_TASK_STRUCT]; -static int task_struct_stack_ptr = -1; +#define EXTRA_TASK_STRUCT 4 +#else +#define EXTRA_TASK_STRUCT 0 #endif struct task_struct *alloc_task_struct(void) { struct task_struct *tsk; -#ifndef EXTRA_TASK_STRUCT - tsk = ll_alloc_task_struct(); -#else - int index; - - index = task_struct_stack_ptr; - if (index >= EXTRA_TASK_STRUCT/2) - goto use_cache; - - tsk = ll_alloc_task_struct(); + if (EXTRA_TASK_STRUCT) + tsk = task_struct_head; + else + tsk = NULL; - if (!tsk) { - index = task_struct_stack_ptr; + if (tsk) { + task_struct_head = tsk->next_task; + nr_task_struct -= 1; + } else + tsk = ll_alloc_task_struct(); - if (index >= 0) { -use_cache: tsk = task_struct_stack[index]; - task_struct_stack_ptr = index - 1; - } - } -#endif #ifdef CONFIG_SYSRQ - /* You need this if you want SYSRQ-T to give sensible stack - * usage information + /* + * The stack must be cleared if you want SYSRQ-T to + * give sensible stack usage information */ if (tsk) { char *p = (char *)tsk; memzero(p+KERNEL_STACK_SIZE, KERNEL_STACK_SIZE); } #endif - return tsk; } -void free_task_struct(struct task_struct *p) +void __free_task_struct(struct task_struct *p) { -#ifdef EXTRA_TASK_STRUCT - int index = task_struct_stack_ptr + 1; - - if (index < EXTRA_TASK_STRUCT) { - task_struct_stack[index] = p; - task_struct_stack_ptr = index; + if (EXTRA_TASK_STRUCT && nr_task_struct < EXTRA_TASK_STRUCT) { + p->next_task = task_struct_head; + task_struct_head = p; + nr_task_struct += 1; } else -#endif ll_free_task_struct(p); } @@ -262,6 +251,8 @@ { struct pt_regs * childregs; struct context_save_struct * save; + + atomic_set(&p->thread.refcount, 1); childregs = ((struct pt_regs *)((unsigned long)p + 8192)) - 1; *childregs = *regs; diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/setup.c linux/arch/arm/kernel/setup.c --- v2.3.28/linux/arch/arm/kernel/setup.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/kernel/setup.c Tue Nov 23 22:23:11 1999 @@ -274,7 +274,7 @@ /* * Initialise the boot-time allocator */ - bootmem_end += init_bootmem(bootmem_end >> PAGE_SHIFT, end_pfn); + bootmem_end += init_bootmem(bootmem_end >> PAGE_SHIFT, end_pfn, PHYS_OFFSET); /* * Register all available RAM with the bootmem allocator. diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/signal.c linux/arch/arm/kernel/signal.c --- v2.3.28/linux/arch/arm/kernel/signal.c Fri Oct 22 13:21:44 1999 +++ linux/arch/arm/kernel/signal.c Tue Nov 23 22:23:11 1999 @@ -21,7 +21,7 @@ #include #include -#include +#include #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) @@ -545,6 +545,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c --- v2.3.28/linux/arch/arm/kernel/sys_arm.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/kernel/sys_arm.c Tue Nov 23 22:23:11 1999 @@ -119,104 +119,73 @@ { int version, ret; - lock_kernel(); version = call >> 16; /* hack for backward compatibility */ call &= 0xffff; - if (call <= SEMCTL) - switch (call) { - case SEMOP: - ret = sys_semop (first, (struct sembuf *)ptr, second); - goto out; - case SEMGET: - ret = sys_semget (first, second, third); - goto out; - case SEMCTL: { - union semun fourth; - ret = -EINVAL; + switch (call) { + case SEMOP: + return sys_semop (first, (struct sembuf *)ptr, second); + case SEMGET: + return sys_semget (first, second, third); + case SEMCTL: { + union semun fourth; + if (!ptr) + return -EINVAL; + if (get_user(fourth.__pad, (void **) ptr)) + return -EFAULT; + return sys_semctl (first, second, third, fourth); + } + + case MSGSND: + return sys_msgsnd (first, (struct msgbuf *) ptr, + second, third); + case MSGRCV: + switch (version) { + case 0: { + struct ipc_kludge tmp; if (!ptr) - goto out; - ret = -EFAULT; - if (get_user(fourth.__pad, (void **) ptr)) - goto out; - ret = sys_semctl (first, second, third, fourth); - goto out; - } - default: - ret = -EINVAL; - goto out; + return -EINVAL; + if (copy_from_user(&tmp,(struct ipc_kludge *) ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); } - if (call <= MSGCTL) - switch (call) { - case MSGSND: - ret = sys_msgsnd (first, (struct msgbuf *) ptr, - second, third); - goto out; - case MSGRCV: - switch (version) { - case 0: { - struct ipc_kludge tmp; - ret = -EINVAL; - if (!ptr) - goto out; - ret = -EFAULT; - if (copy_from_user(&tmp,(struct ipc_kludge *) ptr, - sizeof (tmp))) - goto out; - ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third); - goto out; - } - case 1: default: - ret = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); - goto out; - } - case MSGGET: - ret = sys_msgget ((key_t) first, second); - goto out; - case MSGCTL: - ret = sys_msgctl (first, second, (struct msqid_ds *) ptr); - goto out; default: - ret = -EINVAL; - goto out; + return sys_msgrcv (first, + (struct msgbuf *) ptr, + second, fifth, third); } - if (call <= SHMCTL) - switch (call) { - case SHMAT: - switch (version) { - case 0: default: { - ulong raddr; - ret = sys_shmat (first, (char *) ptr, second, &raddr); - if (ret) - goto out; - ret = put_user (raddr, (ulong *) third); - goto out; - } - case 1: /* iBCS2 emulator entry point */ - ret = -EINVAL; - if (!segment_eq(get_fs(), get_ds())) - goto out; - ret = sys_shmat (first, (char *) ptr, second, (ulong *) third); - goto out; - } - case SHMDT: - ret = sys_shmdt ((char *)ptr); - goto out; - case SHMGET: - ret = sys_shmget (first, second, third); - goto out; - case SHMCTL: - ret = sys_shmctl (first, second, (struct shmid_ds *) ptr); - goto out; - default: - ret = -EINVAL; - goto out; + case MSGGET: + return sys_msgget ((key_t) first, second); + case MSGCTL: + return sys_msgctl (first, second, (struct msqid_ds *) ptr); + + case SHMAT: + switch (version) { + default: { + ulong raddr; + ret = sys_shmat (first, (char *) ptr, second, &raddr); + if (ret) + return ret; + return put_user (raddr, (ulong *) third); + } + case 1: /* iBCS2 emulator entry point */ + if (!segment_eq(get_fs(), get_ds())) + return -EINVAL; + return sys_shmat (first, (char *) ptr, + second, (ulong *) third); } - else - ret = -EINVAL; -out: - unlock_kernel(); - return ret; + case SHMDT: + return sys_shmdt ((char *)ptr); + case SHMGET: + return sys_shmget (first, second, third); + case SHMCTL: + return sys_shmctl (first, second, + (struct shmid_ds *) ptr); + default: + return -EINVAL; + } } /* Fork a new task - this creates a new program thread. diff -u --recursive --new-file v2.3.28/linux/arch/arm/lib/backtrace.S linux/arch/arm/lib/backtrace.S --- v2.3.28/linux/arch/arm/lib/backtrace.S Fri Oct 22 13:21:44 1999 +++ linux/arch/arm/lib/backtrace.S Tue Nov 23 22:23:11 1999 @@ -83,28 +83,34 @@ #define reg r5 #define stack r6 -.Ldumpstm: stmfd sp!, {instr, reg, stack, lr} +.Ldumpstm: stmfd sp!, {instr, reg, stack, r7, lr} mov stack, r0 mov instr, r1 mov reg, #9 - + mov r7, #0 1: mov r3, #1 tst instr, r3, lsl reg beq 2f + add r7, r7, #1 + teq r7, #4 + moveq r7, #0 + moveq r3, #'\n' + movne r3, #' ' ldr r2, [stack], #-4 mov r1, reg adr r0, .Lfp bl SYMBOL_NAME(printk) 2: subs reg, reg, #1 bpl 1b - + teq r7, #0 + adrne r0, .Lcr + blne SYMBOL_NAME(printk) mov r0, stack - LOADREGS(fd, sp!, {instr, reg, stack, pc}) + LOADREGS(fd, sp!, {instr, reg, stack, r7, pc}) -.Lfe: .ascii "Function entered at [<%p>] from [<%p>]\n" - .byte 0 -.Lfp: .ascii " r%d = %p\n" - .byte 0 +.Lfe: .asciz "Function entered at [<%p>] from [<%p>]\n" +.Lfp: .asciz " r%d = %08X%c" +.Lcr: .asciz "\n" .align .Ldsi: .word 0x00e92dd8 >> 2 .word 0x00e92d00 >> 2 diff -u --recursive --new-file v2.3.28/linux/arch/arm/mm/init.c linux/arch/arm/mm/init.c --- v2.3.28/linux/arch/arm/mm/init.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/mm/init.c Tue Nov 23 22:23:11 1999 @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -168,6 +168,7 @@ void __init paging_init(void) { void *zero_page, *bad_page, *bad_table; + unsigned int zone_size[3]; #ifdef CONFIG_CPU_32 #define TABLE_OFFSET (PTRS_PER_PTE) @@ -189,7 +190,11 @@ pagetable_init(); flush_tlb_all(); - free_area_init(max_low_pfn); + /* + * Initialise the zones and mem_map + */ + zonesize_init(zone_size); + free_area_init(zone_size); /* * finish off the bad pages once @@ -235,22 +240,19 @@ */ void __init mem_init(void) { - int codepages = 0; - int reservedpages = 0; - int datapages = 0; - int initpages = 0, i, min_nr; + extern char __init_begin, __init_end, _text, _etext, _end; + unsigned int codepages, datapages, initpages; + int i; - max_mapnr = max_low_pfn; - high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); + max_mapnr = max_low_pfn; + high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); -#ifdef CONFIG_CPU_32 /* * We may have non-contiguous memory. Setup the PageSkip stuff, * and mark the areas of mem_map which can be freed */ if (meminfo.nr_banks != 1) create_memmap_holes(); -#endif /* this will put all unused low memory onto the freelists */ totalram_pages += free_all_bootmem(); @@ -263,29 +265,16 @@ for (i = 0; i < meminfo.nr_banks; i++) num_physpages += meminfo.bank[i].size >> PAGE_SHIFT; - printk ("Memory: %luk/%luM available (%dk code, %dk reserved, %dk data, %dk init)\n", - (unsigned long) nr_free_pages << (PAGE_SHIFT-10), - num_physpages >> (20 - PAGE_SHIFT), - codepages << (PAGE_SHIFT-10), - reservedpages << (PAGE_SHIFT-10), - datapages << (PAGE_SHIFT-10), - initpages << (PAGE_SHIFT-10)); - - /* - * Correct freepages watermarks - */ - i = nr_free_pages >> 7; - if (PAGE_SIZE < 32768) - min_nr = 10; - else - min_nr = 2; - if (i < min_nr) - i = min_nr; - if (i > 256) - i = 256; - freepages.min = i; - freepages.low = i * 2; - freepages.high = i * 3; + codepages = (int)&_etext - &_text; + datapages = (int)&_end - &_etext; + initpages = (int)&__init_end - &__init_start; + + printk("Memory: %luk/%luM available (%dK code, %dK data, %dK init)\n", + (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), + num_physpages >> (20 - PAGE_SHIFT), + codepages << (PAGE_SHIFT-10), + datapages << (PAGE_SHIFT-10), + initpages << (PAGE_SHIFT-10)); #ifdef CONFIG_CPU_26 if (max_mapnr <= 128) { @@ -348,7 +337,7 @@ { val->totalram = totalram_pages; val->sharedram = 0; - val->freeram = nr_free_pages; + val->freeram = nr_free_pages(); val->bufferram = atomic_read(&buffermem_pages); val->totalhigh = 0; val->freehigh = 0; diff -u --recursive --new-file v2.3.28/linux/arch/arm/mm/ioremap.c linux/arch/arm/mm/ioremap.c --- v2.3.28/linux/arch/arm/mm/ioremap.c Fri Oct 22 13:21:44 1999 +++ linux/arch/arm/mm/ioremap.c Tue Nov 23 22:23:11 1999 @@ -32,7 +32,7 @@ #include #include -#include +#include #include static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, @@ -136,7 +136,7 @@ /* * Ok, go for it.. */ - area = get_vm_area(size); + area = get_vm_area(size, VM_IOREMAP); if (!area) return NULL; addr = area->addr; diff -u --recursive --new-file v2.3.28/linux/arch/arm/mm/map.h linux/arch/arm/mm/map.h --- v2.3.28/linux/arch/arm/mm/map.h Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/mm/map.h Tue Nov 23 22:23:11 1999 @@ -19,6 +19,7 @@ extern struct map_desc io_desc[]; extern unsigned int io_desc_size; +extern void zonesize_init(unsigned int *); extern void create_memmap_holes(void); extern void pagetable_init(void); diff -u --recursive --new-file v2.3.28/linux/arch/arm/mm/mm-armo.c linux/arch/arm/mm/mm-armo.c --- v2.3.28/linux/arch/arm/mm/mm-armo.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/mm/mm-armo.c Tue Nov 23 22:23:11 1999 @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -134,6 +135,20 @@ } /* + * Calculate the size of the DMA, normal and highmem zones. + * On 26-bit ARMs, we don't have any real DMA or highmem, + * so we allocate the whole memory as being DMA-capable. + */ +void __init zonesize_init(unsigned int *zone_size) +{ + int i; + + zone_size[0] = max_low_pfn; + zone_size[1] = 0; + zone_size[2] = 0; +} + +/* * This contains the code to setup the memory map on an ARM2/ARM250/ARM3 * machine. This is both processor & architecture specific, and requires * some more work to get it to fit into our separate processor and @@ -147,7 +162,6 @@ page_nr = max_low_pfn; pte = alloc_bootmem_low_pages(PTRS_PER_PTE * sizeof(pte_t)); - memzero(pte, PTRS_PER_PTE * sizeof(pte_t)); pte[0] = mk_pte_phys(PAGE_OFFSET + 491520, PAGE_READONLY); set_pmd(pmd_offset(swapper_pg_dir, 0), mk_kernel_pmd(pte)); diff -u --recursive --new-file v2.3.28/linux/arch/arm/mm/mm-armv.c linux/arch/arm/mm/mm-armv.c --- v2.3.28/linux/arch/arm/mm/mm-armv.c Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/mm/mm-armv.c Tue Nov 23 22:23:11 1999 @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -178,7 +179,6 @@ pte_t *ptep = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); - memzero(ptep, 2 * PTRS_PER_PTE * sizeof(pte_t)); ptep += PTRS_PER_PTE; set_pmd(pmdp, __mk_pmd(ptep, PMD_TYPE_TABLE | PMD_DOMAIN(domain))); @@ -266,6 +266,32 @@ #define NR_INIT_MAPS (sizeof(init_map) / sizeof(init_map[0])) +/* + * Calculate the size of the DMA, normal and highmem zones. + * On ARM, we don't have any problems with DMA, so all memory + * is allocated to the DMA zone. We also don't have any + * highmem either. + */ +void __init zonesize_init(unsigned int *zone_size) +{ + int i; + + zone_size[0] = 0; + zone_size[1] = 0; + zone_size[2] = 0; + + for (i = 0; i < meminfo.nr_banks; i++) { + if (meminfo.bank[i].size) { + unsigned int end; + + end = (meminfo.bank[i].start + + meminfo.bank[i].size) >> PAGE_SHIFT; + if (end > zone_size[0]) + zone_size[0] = end; + } + } +} + void __init pagetable_init(void) { unsigned long address = 0; @@ -364,27 +390,4 @@ set_bit(PG_skip, &pg->flags); pg->next_hash = NULL; } - -#if 0 - /* - * setup address validity map - * - don't think this is used anymore? - */ - sz = meminfo.end >> (PAGE_SHIFT + 8); /* in MB */ - sz = (sz + 31) >> 3; - - valid_addr_bitmap = alloc_bootmem(sz); - memzero(valid_addr_bitmap, sz); - - for (i = 0; i < meminfo.nr_banks; i++) { - int idx, end; - - idx = meminfo.bank[i].start >> 20; - end = (meminfo.bank[i].start + - meminfo.bank[i].size) >> 20; - do - set_bit(idx, valid_addr_bitmap); - while (++idx < end); - } -#endif } diff -u --recursive --new-file v2.3.28/linux/arch/arm/mm/small_page.c linux/arch/arm/mm/small_page.c --- v2.3.28/linux/arch/arm/mm/small_page.c Thu Nov 11 20:11:31 1999 +++ linux/arch/arm/mm/small_page.c Tue Nov 23 22:23:11 1999 @@ -66,9 +66,9 @@ #endif }; -#define USED_MAP(pg) ((pg)->offset) -#define TEST_AND_CLEAR_USED(pg,off) (test_and_clear_bit(off, &(pg)->offset)) -#define SET_USED(pg,off) (set_bit(off, &(pg)->offset)) +#define USED_MAP(pg) ((pg)->index) +#define TEST_AND_CLEAR_USED(pg,off) (test_and_clear_bit(off, &USED_MAP(pg))) +#define SET_USED(pg,off) (set_bit(off, &USED_MAP(pg))) static void add_page_to_queue(struct page *page, struct page **p) { @@ -116,7 +116,7 @@ remove_page_from_queue(page); restore_flags(flags); - return page_address(page) + (offset << order->shift); + return __page_address(page) + (offset << order->shift); need_new_page: page = alloc_page(priority); diff -u --recursive --new-file v2.3.28/linux/arch/i386/boot/Makefile linux/arch/i386/boot/Makefile --- v2.3.28/linux/arch/i386/boot/Makefile Thu Nov 18 20:25:37 1999 +++ linux/arch/i386/boot/Makefile Sun Nov 21 00:11:09 1999 @@ -51,8 +51,8 @@ bootsect.s: bootsect.S Makefile $(BOOT_INCL) $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ -bbootsect: bbootsect.o bsetup.o - $(LD) -Ttext 0x0 -R bsetup.o -s -oformat binary $< -o $@ +bbootsect: bbootsect.o + $(LD) -Ttext 0x0 -s -oformat binary $< -o $@ bbootsect.o: bbootsect.s $(AS) -o $@ $< diff -u --recursive --new-file v2.3.28/linux/arch/i386/boot/bootsect.S linux/arch/i386/boot/bootsect.S --- v2.3.28/linux/arch/i386/boot/bootsect.S Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/boot/bootsect.S Sun Nov 21 00:09:51 1999 @@ -247,7 +247,8 @@ xorw %bx, %bx # bx is starting address within segment rp_read: #ifdef __BIG_KERNEL__ - lcall bootsect_kludge # in setup.S + bootsect_kludge = 0x220 # 0x200 (size of bootsector) + 0x20 (offset + lcall bootsect_kludge # of bootsect_kludge in setup.S) #else movw %es, %ax subw $SYSSEG, %ax @@ -398,11 +399,9 @@ # don't have to worry about it later. kill_motor: - pushw %dx movw $0x3f2, %dx xorb %al, %al outb %al, %dx - popw %dx ret sectors: .word 0 diff -u --recursive --new-file v2.3.28/linux/arch/i386/boot/compressed/misc.c linux/arch/i386/boot/compressed/misc.c --- v2.3.28/linux/arch/i386/boot/compressed/misc.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/boot/compressed/misc.c Sat Nov 20 10:09:05 1999 @@ -9,10 +9,8 @@ * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 */ -#include -#include +#include #include - /* * gzip declarations */ diff -u --recursive --new-file v2.3.28/linux/arch/i386/boot/setup.S linux/arch/i386/boot/setup.S --- v2.3.28/linux/arch/i386/boot/setup.S Thu Nov 18 20:25:37 1999 +++ linux/arch/i386/boot/setup.S Sun Nov 21 00:09:51 1999 @@ -125,7 +125,6 @@ ramdisk_size: .long 0 # its size in bytes -.global bootsect_kludge # so that we can see it in bootsect.S bootsect_kludge: .word bootsect_helper, SETUPSEG @@ -456,7 +455,7 @@ xorw %bx, %bx int $0x15 # ignore return code movw $0x05303, %ax # 32 bit connect - xorw %ebx, %ebx + xorw %bx, %bx int $0x15 jc no_32_apm_bios # Ack, error. diff -u --recursive --new-file v2.3.28/linux/arch/i386/boot/video.S linux/arch/i386/boot/video.S --- v2.3.28/linux/arch/i386/boot/video.S Thu Nov 18 20:25:37 1999 +++ linux/arch/i386/boot/video.S Sun Nov 21 00:09:51 1999 @@ -1278,7 +1278,7 @@ no_s31: xorw %bp, %bp # Detection failed s3rest: movb %bh, %ah movb $0x38, %al # restore old value of CRT register 0x38 - call outidx + jmp outidx idS3: .byte 0x81, 0x82, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95 .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa8, 0xb0 diff -u --recursive --new-file v2.3.28/linux/arch/i386/defconfig linux/arch/i386/defconfig --- v2.3.28/linux/arch/i386/defconfig Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/defconfig Tue Nov 23 12:54:31 1999 @@ -257,7 +257,6 @@ # CONFIG_NET_ISA is not set CONFIG_NET_EISA=y # CONFIG_PCNET32 is not set -# CONFIG_ACENIC is not set # CONFIG_APRICOT is not set # CONFIG_CS89x0 is not set # CONFIG_DE4X5 is not set @@ -265,9 +264,16 @@ # CONFIG_DGRS is not set CONFIG_EEXPRESS_PRO100=y # CONFIG_NE2K_PCI is not set +# CONFIG_SIS900 is not set # CONFIG_TLAN is not set # CONFIG_VIA_RHINE is not set # CONFIG_NET_POCKET is not set + +# +# Ethernet (1000 Mbit) +# +# CONFIG_ACENIC is not set +# CONFIG_SK98LIN is not set # CONFIG_FDDI is not set # CONFIG_PPP is not set # CONFIG_SLIP is not set @@ -381,7 +387,7 @@ # CONFIG_PCMCIA_SERIAL_CB is not set # -# USB drivers - not for the faint of heart +# Support for USB # # CONFIG_USB is not set @@ -396,7 +402,6 @@ # CONFIG_QUOTA is not set CONFIG_AUTOFS_FS=y # CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/apm.c linux/arch/i386/kernel/apm.c --- v2.3.28/linux/arch/i386/kernel/apm.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/kernel/apm.c Fri Nov 19 11:33:29 1999 @@ -1193,7 +1193,7 @@ return 0; } -int apm_get_info(char *buf, char **start, off_t fpos, int length, int dummy) +static int apm_get_info(char *buf, char **start, off_t fpos, int length) { char * p; unsigned short bx; diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c --- v2.3.28/linux/arch/i386/kernel/irq.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/kernel/irq.c Sat Nov 20 10:09:05 1999 @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/mca.c linux/arch/i386/kernel/mca.c --- v2.3.28/linux/arch/i386/kernel/mca.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/kernel/mca.c Fri Nov 19 21:16:10 1999 @@ -744,11 +744,13 @@ void __init mca_do_proc_init(void) { int i; + struct proc_dir_entry *proc_mca; struct proc_dir_entry* node = NULL; struct MCA_adapter *p; if(mca_info == NULL) return; /* Should never happen */ + proc_mca = proc_mkdir("mca", &proc_root); create_proc_read_entry("pos",0,proc_mca,get_mca_info,NULL); create_proc_read_entry("machine",0,proc_mca,get_mca_machine_info,NULL); diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/mtrr.c linux/arch/i386/kernel/mtrr.c --- v2.3.28/linux/arch/i386/kernel/mtrr.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/kernel/mtrr.c Sat Nov 20 16:19:00 1999 @@ -1446,12 +1446,6 @@ return 0; } /* End Function mtrr_ioctl */ -static int mtrr_open (struct inode *ino, struct file *filep) -{ - MOD_INC_USE_COUNT; - return 0; -} /* End Function mtrr_open */ - static int mtrr_close (struct inode *ino, struct file *file) { int i, max; @@ -1482,7 +1476,7 @@ NULL, /* Poll */ mtrr_ioctl, /* IOctl */ NULL, /* MMAP */ - mtrr_open, /* Open */ + NULL, /* Open */ NULL, /* Flush */ mtrr_close, /* Release */ NULL, /* Fsync */ @@ -1515,11 +1509,7 @@ NULL /* revalidate */ }; -static struct proc_dir_entry proc_root_mtrr = { - 0, 4, "mtrr", - S_IFREG | S_IWUSR | S_IRUGO, 1, 0, 0, - 0, &proc_mtrr_inode_operations -}; +static struct proc_dir_entry *proc_root_mtrr; static void compute_ascii (void) { @@ -1555,7 +1545,7 @@ ascii_buf_bytes += strlen (ascii_buffer + ascii_buf_bytes); } } - proc_root_mtrr.size = ascii_buf_bytes; + proc_root_mtrr->size = ascii_buf_bytes; } /* End Function compute_ascii */ #endif /* CONFIG_PROC_FS */ @@ -1826,9 +1816,9 @@ # endif /* !__SMP__ */ # ifdef CONFIG_PROC_FS - proc_register (&proc_root, &proc_root_mtrr); -# endif - + proc_root_mtrr = create_proc_entry("mtrr", S_IWUSR|S_IRUGO, &proc_root); + proc_root_mtrr->ops = &proc_mtrr_inode_operations; +#endif init_table (); return 0; } /* End Function mtrr_init */ diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/pci-i386.c linux/arch/i386/kernel/pci-i386.c --- v2.3.28/linux/arch/i386/kernel/pci-i386.c Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/kernel/pci-i386.c Tue Nov 23 10:10:38 1999 @@ -122,12 +122,12 @@ printk(KERN_ERR "PCI: I/O Region %s/%d too large (%ld bytes)\n", dev->slot_name, i, size); return -EFBIG; } - if (allocate_resource(pr, r, size, 0x1000, ~0, 1024)) { + if (allocate_resource(pr, r, size, 0x1000, ~0, 1024, dev)) { printk(KERN_ERR "PCI: Allocation of I/O region %s/%d (%ld bytes) failed\n", dev->slot_name, i, size); return -EBUSY; } } else { - if (allocate_resource(pr, r, size, 0x10000000, ~0, size)) { + if (allocate_resource(pr, r, size, 0x10000000, ~0, size, dev)) { printk(KERN_ERR "PCI: Allocation of memory region %s/%d (%ld bytes) failed\n", dev->slot_name, i, size); return -EBUSY; } @@ -291,6 +291,12 @@ pcibios_allocate_resources(0); pcibios_allocate_resources(1); pcibios_assign_resources(); +} + +unsigned long resource_fixup(struct pci_dev * dev, struct resource * res, + unsigned long start, unsigned long size) +{ + return start; } int pcibios_enable_resources(struct pci_dev *dev) diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c --- v2.3.28/linux/arch/i386/kernel/setup.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/kernel/setup.c Sat Nov 20 10:09:05 1999 @@ -449,6 +449,9 @@ case E820_ACPI: printk("(ACPI data)\n"); break; + case E820_NVS: + printk("(ACPI NVS)\n"); + break; default: printk("type %lu\n", e820.map[i].type); break; } @@ -634,7 +637,6 @@ highstart_pfn = highend_pfn = max_pfn; if (max_pfn > MAXMEM_PFN) { highstart_pfn = MAXMEM_PFN; - highend_pfn = max_pfn; printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", pages_to_mb(highend_pfn - highstart_pfn)); } diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/signal.c linux/arch/i386/kernel/signal.c --- v2.3.28/linux/arch/i386/kernel/signal.c Thu Jul 22 09:47:55 1999 +++ linux/arch/i386/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -687,6 +687,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/smp.c linux/arch/i386/kernel/smp.c --- v2.3.28/linux/arch/i386/kernel/smp.c Thu Nov 18 20:25:37 1999 +++ linux/arch/i386/kernel/smp.c Sat Nov 20 10:09:05 1999 @@ -18,6 +18,7 @@ #include #include #include +#include /* * Some notes on processor bugs: diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/smpboot.c linux/arch/i386/kernel/smpboot.c --- v2.3.28/linux/arch/i386/kernel/smpboot.c Mon Nov 1 13:56:26 1999 +++ linux/arch/i386/kernel/smpboot.c Sat Nov 20 10:09:05 1999 @@ -44,6 +44,7 @@ #include #include #include +#include /* Set if we find a B stepping CPU */ static int smp_b_stepping = 0; @@ -649,10 +650,11 @@ void __init smp_store_cpu_info(int id) { - struct cpuinfo_x86 *c=&cpu_data[id]; + struct cpuinfo_x86 *c = cpu_data + id; *c = boot_cpu_data; c->pte_quick = 0; + c->pmd_quick = 0; c->pgd_quick = 0; c->pgtable_cache_sz = 0; identify_cpu(c); @@ -719,7 +721,7 @@ * Enable APIC */ value |= (1<<8); -#if 0 +#if 1 /* Enable focus processor (bit==0) */ value &= ~(1<<9); #else @@ -821,8 +823,7 @@ * could use the real zero-page, but it's safer * this way if some buggy code writes to this page ... */ - apic_phys = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); - memset((void *)apic_phys, 0, PAGE_SIZE); + apic_phys = (unsigned long) alloc_bootmem_pages(PAGE_SIZE); apic_phys = __pa(apic_phys); } set_fixmap(FIX_APIC_BASE, apic_phys); @@ -837,8 +838,7 @@ if (smp_found_config) { ioapic_phys = mp_ioapics[i].mpc_apicaddr; } else { - ioapic_phys = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); - memset((void *)ioapic_phys, 0, PAGE_SIZE); + ioapic_phys = (unsigned long) alloc_bootmem_pages(PAGE_SIZE); ioapic_phys = __pa(ioapic_phys); } set_fixmap(idx,ioapic_phys); diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c --- v2.3.28/linux/arch/i386/kernel/traps.c Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/kernel/traps.c Sat Nov 20 10:09:05 1999 @@ -35,6 +35,7 @@ #include #include +#include #ifdef CONFIG_X86_VISWS_APIC #include diff -u --recursive --new-file v2.3.28/linux/arch/i386/kernel/vm86.c linux/arch/i386/kernel/vm86.c --- v2.3.28/linux/arch/i386/kernel/vm86.c Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/kernel/vm86.c Sat Nov 20 10:09:05 1999 @@ -14,7 +14,7 @@ #include #include -#include +#include #include /* diff -u --recursive --new-file v2.3.28/linux/arch/i386/mm/fault.c linux/arch/i386/mm/fault.c --- v2.3.28/linux/arch/i386/mm/fault.c Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/mm/fault.c Sat Nov 20 10:09:05 1999 @@ -19,7 +19,7 @@ #include #include -#include +#include #include extern void die(const char *,struct pt_regs *,long); diff -u --recursive --new-file v2.3.28/linux/arch/i386/mm/init.c linux/arch/i386/mm/init.c --- v2.3.28/linux/arch/i386/mm/init.c Thu Nov 11 20:11:31 1999 +++ linux/arch/i386/mm/init.c Tue Nov 23 10:21:39 1999 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -285,7 +286,6 @@ #if CONFIG_X86_PAE if (pgd_none(*pgd)) { pmd = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); - memset((void*)pmd, 0, PAGE_SIZE); pgd_val(*pgd) = __pa(pmd) + 0x1; if (pmd != pmd_offset(pgd, start)) BUG(); @@ -297,7 +297,6 @@ for (; (j < PTRS_PER_PMD) && start; pmd++, j++) { if (pmd_none(*pmd)) { pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); - memset((void*)pte, 0, PAGE_SIZE); pmd_val(*pmd) = _KERNPG_TABLE + __pa(pte); if (pte != pte_offset(pmd, 0)) BUG(); @@ -327,7 +326,6 @@ vaddr = i*PGDIR_SIZE; #if CONFIG_X86_PAE pmd = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); - memset((void*)pmd, 0, PAGE_SIZE); pgd_val(*pgd) = __pa(pmd) + 0x1; #else pmd = (pmd_t *)pgd; @@ -352,7 +350,6 @@ } pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); - memset((void*)pte, 0, PAGE_SIZE); pmd_val(*pmd) = _KERNPG_TABLE + __pa(pte); if (pte != pte_offset(pmd, 0)) @@ -412,7 +409,11 @@ * that case). */ for (i = 0; i < USER_PTRS_PER_PGD; i++) +#if CONFIG_X86_PAE + pgd_clear(swapper_pg_dir+i); +#else pgd_val(swapper_pg_dir[i]) = 0; +#endif flush_tlb_all(); } @@ -448,13 +449,22 @@ kmap_init(); #endif { - unsigned int zones_size[3]; - - zones_size[0] = virt_to_phys((char *)MAX_DMA_ADDRESS) - >> PAGE_SHIFT; - zones_size[1] = max_low_pfn - zones_size[0]; - zones_size[2] = highend_pfn - zones_size[0] - zones_size[1]; + unsigned int zones_size[MAX_NR_ZONES] = {0, 0, 0}; + unsigned int max_dma, high, low; + max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; + low = max_low_pfn; + high = highend_pfn; + + if (low < max_dma) + zones_size[ZONE_DMA] = low; + else { + zones_size[ZONE_DMA] = max_dma; + zones_size[ZONE_NORMAL] = low - max_dma; +#ifdef CONFIG_HIGHMEM + zones_size[ZONE_HIGHMEM] = high - low; +#endif + } free_area_init(zones_size); } return; @@ -514,13 +524,18 @@ int i; for (i = 0; i < e820.nr_map; i++) { - unsigned long addr, size; + unsigned long addr, end; if (e820.map[i].type != E820_RAM) /* not usable memory */ continue; + /* + * !!!FIXME!!! Some BIOSen report areas as RAM that + * are not. Notably the 640->1Mb area. We need a sanity + * check here. + */ addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT; - size = e820.map[i].size >> PAGE_SHIFT; - if ((pagenr >= addr) && (pagenr < addr+size)) + end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT; + if ((pagenr >= addr) && (pagenr < end)) return 1; } return 0; @@ -528,15 +543,13 @@ void __init mem_init(void) { - int codepages = 0; - int reservedpages = 0; - int datapages = 0; - int initpages = 0; -#ifdef CONFIG_HIGHMEM + int codesize, reservedpages, datasize, initsize; int tmp; if (!mem_map) BUG(); + +#ifdef CONFIG_HIGHMEM highmem_start_page = mem_map + highstart_pfn; /* cache the highmem_mapnr */ highmem_mapnr = highstart_pfn; @@ -552,6 +565,13 @@ /* this will put all low memory onto the freelists */ totalram_pages += free_all_bootmem(); + reservedpages = 0; + for (tmp = 0; tmp < max_low_pfn; tmp++) + /* + * Only count reserved RAM pages + */ + if (page_is_ram(tmp) && PageReserved(mem_map+tmp)) + reservedpages++; #ifdef CONFIG_HIGHMEM for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { struct page *page = mem_map + tmp; @@ -568,19 +588,23 @@ } totalram_pages += totalhigh_pages; #endif + codesize = (unsigned long) &_etext - (unsigned long) &_text; + datasize = (unsigned long) &_edata - (unsigned long) &_etext; + initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; + printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), max_mapnr << (PAGE_SHIFT-10), - codepages << (PAGE_SHIFT-10), + codesize >> 10, reservedpages << (PAGE_SHIFT-10), - datapages << (PAGE_SHIFT-10), - initpages << (PAGE_SHIFT-10), + datasize >> 10, + initsize >> 10, (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) ); #if CONFIG_X86_PAE if (!cpu_has_pae) - panic("cannot execute a PAE-enabled kernel on a PAE-incapable CPU!"); + panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); #endif if (boot_cpu_data.wp_works_ok < 0) test_wp_bit(); @@ -610,6 +634,19 @@ } printk ("Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10); } + +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long start, unsigned long end) +{ + for (; start < end; start += PAGE_SIZE) { + ClearPageReserved(mem_map + MAP_NR(start)); + set_page_count(mem_map+MAP_NR(start), 1); + free_page(start); + totalram_pages++; + } + printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); +} +#endif void si_meminfo(struct sysinfo *val) { diff -u --recursive --new-file v2.3.28/linux/arch/i386/mm/ioremap.c linux/arch/i386/mm/ioremap.c --- v2.3.28/linux/arch/i386/mm/ioremap.c Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/mm/ioremap.c Sat Nov 20 10:09:05 1999 @@ -10,6 +10,7 @@ #include #include +#include static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, unsigned long phys_addr, unsigned long flags) @@ -131,7 +132,7 @@ /* * Ok, go for it.. */ - area = get_vm_area(size); + area = get_vm_area(size, VM_IOREMAP); if (!area) return NULL; addr = area->addr; diff -u --recursive --new-file v2.3.28/linux/arch/m68k/kernel/signal.c linux/arch/m68k/kernel/signal.c --- v2.3.28/linux/arch/m68k/kernel/signal.c Sun Aug 15 11:47:29 1999 +++ linux/arch/m68k/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -1093,6 +1093,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGIOT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/m68k/mac/iop.c linux/arch/m68k/mac/iop.c --- v2.3.28/linux/arch/m68k/mac/iop.c Mon Nov 1 13:56:26 1999 +++ linux/arch/m68k/mac/iop.c Fri Nov 19 11:33:29 1999 @@ -51,6 +51,9 @@ * IOP hasn't died. * o Some of the IOP manager routines need better error checking and * return codes. Nothing major, just prettying up. + * + * + share the stuff you were smoking when you wrote the iop_get_proc_info() + * for case when CONFIG_PROC_FS is undefined. */ /* @@ -125,9 +128,10 @@ int iop_scc_present,iop_ism_present; #ifdef CONFIG_PROC_FS -static int iop_get_proc_info(char *, char **, off_t, int, int); +static int iop_get_proc_info(char *, char **, off_t, int); #else -static int iop_get_proc_info(char *, char **, off_t, int, int) {} +/* What the bloody hell is THAT ??? */ +static int iop_get_proc_info(char *, char **, off_t, int) {} #endif /* CONFIG_PROC_FS */ /* structure for tracking channel listeners */ @@ -670,7 +674,7 @@ return len; } -int iop_get_proc_info(char *buf, char **start, off_t pos, int count, int wr) +static int iop_get_proc_info(char *buf, char **start, off_t pos, int count) { int len, cnt; diff -u --recursive --new-file v2.3.28/linux/arch/m68k/mm/kmap.c linux/arch/m68k/mm/kmap.c --- v2.3.28/linux/arch/m68k/mm/kmap.c Wed May 12 08:50:00 1999 +++ linux/arch/m68k/mm/kmap.c Thu Nov 18 19:32:51 1999 @@ -39,7 +39,7 @@ static inline struct vm_struct *get_io_area(unsigned long size) { - return get_vm_area(size); + return get_vm_area(size, VM_IOREMAP); } diff -u --recursive --new-file v2.3.28/linux/arch/mips/kernel/signal.c linux/arch/mips/kernel/signal.c --- v2.3.28/linux/arch/mips/kernel/signal.c Thu Jul 22 09:47:55 1999 +++ linux/arch/mips/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -492,7 +492,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGABRT: case SIGFPE: case SIGSEGV: - case SIGBUS: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c --- v2.3.28/linux/arch/ppc/kernel/signal.c Tue Aug 31 17:29:13 1999 +++ linux/arch/ppc/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -444,6 +444,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c --- v2.3.28/linux/arch/ppc/mm/init.c Thu Nov 11 20:11:32 1999 +++ linux/arch/ppc/mm/init.c Fri Nov 19 11:38:21 1999 @@ -422,7 +422,7 @@ if (mem_init_done) { struct vm_struct *area; - area = get_vm_area(size); + area = get_vm_area(size, VM_ALLOC); if (area == 0) return NULL; v = VMALLOC_VMADDR(area->addr); @@ -779,11 +779,9 @@ mp->n_regions = d; } -#if defined(CONFIG_PMAC) || defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC) /* * Read in a property describing some pieces of memory. */ - static void __init get_mem_prop(char *name, struct mem_pieces *mp) { struct reg_property *rp; @@ -802,7 +800,6 @@ sort_mem_pieces(mp); coalesce_mem_pieces(mp); } -#endif /* CONFIG_PMAC || CONFIG_CHRP || CONFIG_ALL_PPC */ /* * Set up one of the I/D BAT (block address translation) register pairs. @@ -1215,6 +1212,18 @@ */ empty_bad_page = alloc_bootmem_pages(PAGE_SIZE); empty_bad_page_table = alloc_bootmem_pages(PAGE_SIZE); + { + unsigned int zones_size[2]; + /* + * All pages are DMA-able so this is wrong - the zone code is assuming + * both regions have a value so this is necessary for now. + * -- Cort + */ + zones_size[0] = virt_to_phys(end_of_DRAM-(1<<20)) >> PAGE_SHIFT; + zones_size[1] = (1<<20) >> PAGE_SHIFT; + + free_area_init(zones_size); + } } void __init mem_init(void) @@ -1239,6 +1248,12 @@ clear_bit(PG_reserved, &mem_map[MAP_NR(addr)].flags); } #endif /* CONFIG_BLK_DEV_INITRD */ + + /* mark the RTAS pages as reserved */ + if ( rtas_data ) + for (addr = (rtas_data+PAGE_OFFSET); addr < PAGE_ALIGN(PAGE_OFFSET+rtas_data+rtas_size) ; + rtas_data += PAGE_SIZE) + SetPageReserved(mem_map + MAP_NR(addr)); for (addr = PAGE_OFFSET; addr < (unsigned long)end_of_DRAM; addr += PAGE_SIZE) { diff -u --recursive --new-file v2.3.28/linux/arch/sh/kernel/signal.c linux/arch/sh/kernel/signal.c --- v2.3.28/linux/arch/sh/kernel/signal.c Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -566,6 +566,7 @@ case SIGQUIT: case SIGILL: case SIGTRAP: case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; /* FALLTHRU */ diff -u --recursive --new-file v2.3.28/linux/arch/sh/mm/ioremap.c linux/arch/sh/mm/ioremap.c --- v2.3.28/linux/arch/sh/mm/ioremap.c Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/mm/ioremap.c Thu Nov 18 19:32:51 1999 @@ -123,7 +123,7 @@ /* * Ok, go for it.. */ - area = get_vm_area(size); + area = get_vm_area(size, VM_IOREMAP); if (!area) return NULL; addr = area->addr; diff -u --recursive --new-file v2.3.28/linux/arch/sparc/kernel/signal.c linux/arch/sparc/kernel/signal.c --- v2.3.28/linux/arch/sparc/kernel/signal.c Sun Nov 7 16:37:34 1999 +++ linux/arch/sparc/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -1162,7 +1162,8 @@ continue; case SIGQUIT: case SIGILL: case SIGTRAP: - case SIGABRT: case SIGFPE: case SIGSEGV: case SIGBUS: + case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; #ifdef DEBUG_SIGNALS diff -u --recursive --new-file v2.3.28/linux/arch/sparc64/kernel/signal.c linux/arch/sparc64/kernel/signal.c --- v2.3.28/linux/arch/sparc64/kernel/signal.c Sun Nov 7 16:37:34 1999 +++ linux/arch/sparc64/kernel/signal.c Thu Nov 18 19:37:03 1999 @@ -726,7 +726,8 @@ continue; case SIGQUIT: case SIGILL: case SIGTRAP: - case SIGABRT: case SIGFPE: case SIGSEGV: case SIGBUS: + case SIGABRT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: if (do_coredump(signr, regs)) exit_code |= 0x80; #ifdef DEBUG_SIGNALS diff -u --recursive --new-file v2.3.28/linux/drivers/acorn/char/serial-card.c linux/drivers/acorn/char/serial-card.c --- v2.3.28/linux/drivers/acorn/char/serial-card.c Thu Jun 17 01:11:35 1999 +++ linux/drivers/acorn/char/serial-card.c Thu Nov 18 20:33:25 1999 @@ -55,6 +55,8 @@ { struct serial_struct req; + memset(&req, 0, sizeof(serial_struct)); + req.baud_base = MY_BAUD_BASE; req.irq = irq; req.port = port; diff -u --recursive --new-file v2.3.28/linux/drivers/block/Config.in linux/drivers/block/Config.in --- v2.3.28/linux/drivers/block/Config.in Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/Config.in Thu Nov 18 19:25:28 1999 @@ -54,7 +54,7 @@ bool ' Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD bool ' AEC6210 chipset support' CONFIG_BLK_DEV_AEC6210 if [ "$CONFIG_IDEDMA_PCI_EXPERIMENTAL" = "y" -a "$CONFIG_BLK_DEV_AEC6210" = "y" ]; then - bool ' AEC6210 Tuning support' CONFIG_BLK_DEV_AEC6210_TUNING + bool ' AEC6210 Tuning support (EXPERIMENTAL)' CONFIG_BLK_DEV_AEC6210_TUNING fi if [ "$CONFIG_IDEDMA_PCI_EXPERIMENTAL" = "y" ]; then if [ "$CONFIG_X86" = "y" ]; then @@ -90,7 +90,7 @@ if [ "$CONFIG_BLK_DEV_PDC202XX" = "y" ]; then bool ' Special UDMA Feature' CONFIG_PDC202XX_FORCE_BURST_BIT if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' Special Mode Feature (EXPERIMENTAL)' CONFIG_PDC202XX_FORCE_MASTER_MODE + bool ' Special Mode Feature (EXPERIMENTAL)' CONFIG_PDC202XX_FORCE_MASTER_MODE fi fi if [ "$CONFIG_X86" = "y" ]; then diff -u --recursive --new-file v2.3.28/linux/drivers/block/DAC960.c linux/drivers/block/DAC960.c --- v2.3.28/linux/drivers/block/DAC960.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/block/DAC960.c Fri Nov 19 21:16:10 1999 @@ -3483,36 +3483,20 @@ ControllerNumber++) { DAC960_Controller_T *Controller = DAC960_Controllers[ControllerNumber]; - PROC_DirectoryEntry_T *ControllerProcEntry, *InitialStatusProcEntry; - PROC_DirectoryEntry_T *CurrentStatusProcEntry, *UserCommandProcEntry; + PROC_DirectoryEntry_T *ControllerProcEntry; + PROC_DirectoryEntry_T *UserCommandProcEntry; if (Controller == NULL) continue; - ControllerProcEntry = &Controller->ControllerProcEntry; - ControllerProcEntry->name = Controller->ControllerName; - ControllerProcEntry->namelen = strlen(ControllerProcEntry->name); - ControllerProcEntry->mode = S_IFDIR | S_IRUGO | S_IXUGO; - proc_register(DAC960_ProcDirectoryEntry, ControllerProcEntry); - InitialStatusProcEntry = &Controller->InitialStatusProcEntry; - InitialStatusProcEntry->name = "initial_status"; - InitialStatusProcEntry->namelen = strlen(InitialStatusProcEntry->name); - InitialStatusProcEntry->mode = S_IFREG | S_IRUGO; - InitialStatusProcEntry->data = Controller; - InitialStatusProcEntry->read_proc = DAC960_ProcReadInitialStatus; - proc_register(ControllerProcEntry, InitialStatusProcEntry); - CurrentStatusProcEntry = &Controller->CurrentStatusProcEntry; - CurrentStatusProcEntry->name = "current_status"; - CurrentStatusProcEntry->namelen = strlen(CurrentStatusProcEntry->name); - CurrentStatusProcEntry->mode = S_IFREG | S_IRUGO; - CurrentStatusProcEntry->data = Controller; - CurrentStatusProcEntry->read_proc = DAC960_ProcReadCurrentStatus; - proc_register(ControllerProcEntry, CurrentStatusProcEntry); - UserCommandProcEntry = &Controller->UserCommandProcEntry; - UserCommandProcEntry->name = "user_command"; - UserCommandProcEntry->namelen = strlen(UserCommandProcEntry->name); - UserCommandProcEntry->mode = S_IFREG | S_IWUSR | S_IRUSR; - UserCommandProcEntry->data = Controller; - UserCommandProcEntry->read_proc = DAC960_ProcReadUserCommand; + ControllerProcEntry = proc_mkdir(Controller->ControllerName, + DAC960_ProcDirectoryEntry); + create_proc_read_entry("initial_status",0,ControllerProcEntry, + DAC960_ProcReadInitialStatus, Controller); + create_proc_read_entry("current_status",0,ControllerProcEntry, + DAC960_ProcReadCurrentStatus, Controller); + UserCommandProcEntry = + create_proc_read_entry("user_command", S_IWUSR|S_IRUSR, + ControllerProcEntry, + DAC960_ProcReadUserCommand, Controller); UserCommandProcEntry->write_proc = DAC960_ProcWriteUserCommand; - proc_register(ControllerProcEntry, UserCommandProcEntry); } } @@ -3524,6 +3508,7 @@ static void DAC960_DestroyProcEntries(void) { + /* FIXME */ remove_proc_entry("driver/rd", NULL); } diff -u --recursive --new-file v2.3.28/linux/drivers/block/DAC960.h linux/drivers/block/DAC960.h --- v2.3.28/linux/drivers/block/DAC960.h Tue Aug 31 17:29:13 1999 +++ linux/drivers/block/DAC960.h Fri Nov 19 21:16:10 1999 @@ -1258,10 +1258,6 @@ DAC960_StatusMailbox_T *FirstStatusMailbox; DAC960_StatusMailbox_T *LastStatusMailbox; DAC960_StatusMailbox_T *NextStatusMailbox; - PROC_DirectoryEntry_T ControllerProcEntry; - PROC_DirectoryEntry_T InitialStatusProcEntry; - PROC_DirectoryEntry_T CurrentStatusProcEntry; - PROC_DirectoryEntry_T UserCommandProcEntry; WaitQueue_T CommandWaitQueue; DAC960_DCDB_T MonitoringDCDB; DAC960_Enquiry_T Enquiry[2]; diff -u --recursive --new-file v2.3.28/linux/drivers/block/aec6210.c linux/drivers/block/aec6210.c --- v2.3.28/linux/drivers/block/aec6210.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/aec6210.c Thu Nov 18 19:30:51 1999 @@ -34,6 +34,7 @@ * 50: ff ff ff ff 00 06 00 00 00 00 00 00 00 00 00 00 */ +#include #include #include #include diff -u --recursive --new-file v2.3.28/linux/drivers/block/alim15x3.c linux/drivers/block/alim15x3.c --- v2.3.28/linux/drivers/block/alim15x3.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/alim15x3.c Fri Nov 19 11:33:29 1999 @@ -35,8 +35,8 @@ #include #include -static int ali_get_info(char *buffer, char **addr, off_t offset, int count, int dummy); -extern int (*ali_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int ali_get_info(char *buffer, char **addr, off_t offset, int count); +extern int (*ali_display_info)(char *, char **, off_t, int); /* ide-proc.c */ struct pci_dev *bmide_dev; char *fifo[4] = { @@ -67,7 +67,7 @@ "error DRQ busy" }; -static int ali_get_info(char *buffer, char **addr, off_t offset, int count, int dummy) +static int ali_get_info(char *buffer, char **addr, off_t offset, int count) { byte reg53h, reg5xh, reg5yh, reg5xh1, reg5yh1; unsigned int bibma; diff -u --recursive --new-file v2.3.28/linux/drivers/block/floppy.c linux/drivers/block/floppy.c --- v2.3.28/linux/drivers/block/floppy.c Tue Sep 7 12:14:06 1999 +++ linux/drivers/block/floppy.c Tue Nov 23 10:02:13 1999 @@ -1167,7 +1167,7 @@ /* gets the response from the fdc */ static int result(void) { - int i, status; + int i, status=0; for(i=0; i < MAX_REPLIES; i++) { if ((status = wait_til_ready()) < 0) diff -u --recursive --new-file v2.3.28/linux/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c --- v2.3.28/linux/drivers/block/ide-cd.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/ide-cd.c Sat Nov 20 09:51:50 1999 @@ -130,7 +130,7 @@ * 3.15 July 2, 1996 -- Added support for Sanyo 3 CD changers * from Ben Galliart with * special help from Jeff Lightfoot - * + * * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl. * 3.17 Sep 17, 1996 -- Tweak audio reads for some drives. @@ -1253,20 +1253,10 @@ /* Figure out how much data to transfer. */ thislen = pc->buflen; - if (thislen < 0) thislen = -thislen; if (thislen > len) thislen = len; /* The drive wants to be written to. */ if ((ireason & 3) == 0) { - /* Check that we want to write. */ - if (pc->buflen > 0) { - printk ("%s: cdrom_pc_intr: Drive wants " - "to transfer data the wrong way!\n", - drive->name); - pc->stat = 1; - thislen = 0; - } - /* Transfer the data. */ atapi_output_bytes (drive, pc->buffer, thislen); @@ -1285,14 +1275,6 @@ /* Same drill for reading. */ else if ((ireason & 3) == 2) { - /* Check that we want to read. */ - if (pc->buflen < 0) { - printk ("%s: cdrom_pc_intr: Drive wants to " - "transfer data the wrong way!\n", - drive->name); - pc->stat = 1; - thislen = 0; - } /* Transfer the data. */ atapi_input_bytes (drive, pc->buffer, thislen); diff -u --recursive --new-file v2.3.28/linux/drivers/block/ide-features.c linux/drivers/block/ide-features.c --- v2.3.28/linux/drivers/block/ide-features.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/ide-features.c Thu Nov 18 19:30:51 1999 @@ -13,7 +13,6 @@ * Gadi Oxman */ -#include #include #include #include diff -u --recursive --new-file v2.3.28/linux/drivers/block/ide-geometry.c linux/drivers/block/ide-geometry.c --- v2.3.28/linux/drivers/block/ide-geometry.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/ide-geometry.c Thu Nov 18 19:12:26 1999 @@ -66,7 +66,6 @@ drive->head = drive->bios_head = *(BIOS+2); drive->sect = drive->bios_sect = *(BIOS+14); drive->ctl = *(BIOS+8); - drive->present = 1; } BIOS += 16; } diff -u --recursive --new-file v2.3.28/linux/drivers/block/ide-proc.c linux/drivers/block/ide-proc.c --- v2.3.28/linux/drivers/block/ide-proc.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/ide-proc.c Fri Nov 19 11:33:29 1999 @@ -75,22 +75,22 @@ #ifdef CONFIG_BLK_DEV_ALI15X3 extern byte ali_proc; -int (*ali_display_info)(char *, char **, off_t, int, int) = NULL; +int (*ali_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_ALI15X3 */ #ifdef CONFIG_BLK_DEV_PIIX extern byte piix_proc; -int (*piix_display_info)(char *, char **, off_t, int, int) = NULL; +int (*piix_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_PIIX */ #ifdef CONFIG_BLK_DEV_SIS5513 extern byte sis_proc; -int (*sis_display_info)(char *, char **, off_t, int, int) = NULL; +int (*sis_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_SIS5513 */ #ifdef CONFIG_BLK_DEV_VIA82CXXX extern byte via_proc; -int (*via_display_info)(char *, char **, off_t, int, int) = NULL; +int (*via_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_VIA82CXXX */ static int ide_getxdigit(char c) @@ -668,17 +668,12 @@ } } -static int proc_ide_readlink(struct proc_dir_entry *de, char *page) -{ - int n = (de->name[2] - 'a') / 2; - return sprintf(page, "ide%d/%s", n, de->name); -} - static void create_proc_ide_drives(ide_hwif_t *hwif) { int d; struct proc_dir_entry *ent; struct proc_dir_entry *parent = hwif->proc; + char name[64]; for (d = 0; d < MAX_DRIVES; d++) { ide_drive_t *drive = &hwif->drives[d]; @@ -697,11 +692,9 @@ ide_add_proc_entries(drive->proc, driver->proc, drive); } } - ent = create_proc_entry(drive->name, S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, proc_ide_root); + sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); + ent = proc_symlink(drive->name, proc_ide_root, name); if (!ent) return; - ent->data = drive; - ent->readlink_proc = proc_ide_readlink; - ent->nlink = 1; } } diff -u --recursive --new-file v2.3.28/linux/drivers/block/piix.c linux/drivers/block/piix.c --- v2.3.28/linux/drivers/block/piix.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/piix.c Fri Nov 19 11:33:29 1999 @@ -74,12 +74,12 @@ #include #include -static int piix_get_info(char *, char **, off_t, int, int); -extern int (*piix_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int piix_get_info(char *, char **, off_t, int); +extern int (*piix_display_info)(char *, char **, off_t, int); /* ide-proc.c */ extern char *ide_media_verbose(ide_drive_t *); static struct pci_dev *bmide_dev; -static int piix_get_info (char *buffer, char **addr, off_t offset, int count, int dummy) +static int piix_get_info (char *buffer, char **addr, off_t offset, int count) { /* int rc; */ int piix_who = (bmide_dev->device == PCI_DEVICE_ID_INTEL_82371AB) ? 4 : 3; diff -u --recursive --new-file v2.3.28/linux/drivers/block/rd.c linux/drivers/block/rd.c --- v2.3.28/linux/drivers/block/rd.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/block/rd.c Tue Nov 23 10:10:38 1999 @@ -276,9 +276,11 @@ static int initrd_release(struct inode *inode,struct file *file) { + extern void free_initrd_mem(unsigned long, unsigned long); + + if (--initrd_users) return 0; + free_initrd_mem(initrd_start, initrd_end); initrd_start = 0; - /* No need to actually release the pages, because that is - done later by free_all_bootmem. */ return 0; } @@ -339,8 +341,20 @@ block_fsync /* fsync */ }; +/* Before freeing the module, invalidate all of the protected buffers! */ +static void __exit rd_cleanup (void) +{ + int i; + + for (i = 0 ; i < NUM_RAMDISKS; i++) + invalidate_buffers(MKDEV(MAJOR_NR, i)); + + unregister_blkdev( MAJOR_NR, "ramdisk" ); + blk_dev[MAJOR_NR].request_fn = 0; +} + /* This is the registration and initialization section of the RAM disk driver */ -int __init rd_init(void) +int __init rd_init (void) { int i; @@ -378,36 +392,16 @@ return 0; } -/* loadable module support */ - #ifdef MODULE +module_init(rd_init); +#endif +module_exit(rd_cleanup); +/* loadable module support */ MODULE_PARM (rd_size, "1i"); MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); MODULE_PARM (rd_blocksize, "i"); MODULE_PARM_DESC(rd_blocksize, "Blocksize of each RAM disk in bytes."); - -int init_module(void) -{ - int error = rd_init(); - if (!error) - printk(KERN_INFO "RAMDISK: Loaded as module.\n"); - return error; -} - -/* Before freeing the module, invalidate all of the protected buffers! */ -void cleanup_module(void) -{ - int i; - - for (i = 0 ; i < NUM_RAMDISKS; i++) - invalidate_buffers(MKDEV(MAJOR_NR, i)); - - unregister_blkdev( MAJOR_NR, "ramdisk" ); - blk_dev[MAJOR_NR].request_fn = 0; -} - -#endif /* MODULE */ /* End of non-loading portions of the RAM disk driver */ diff -u --recursive --new-file v2.3.28/linux/drivers/block/sis5513.c linux/drivers/block/sis5513.c --- v2.3.28/linux/drivers/block/sis5513.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/block/sis5513.c Fri Nov 19 11:33:29 1999 @@ -106,8 +106,8 @@ #include #include -static int sis_get_info(char *, char **, off_t, int, int); -extern int (*sis_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int sis_get_info(char *, char **, off_t, int); +extern int (*sis_display_info)(char *, char **, off_t, int); /* ide-proc.c */ struct pci_dev *bmide_dev; static char *cable_type[] = { @@ -140,7 +140,7 @@ "6 PCICLK", "12 PCICLK" }; -static int sis_get_info (char *buffer, char **addr, off_t offset, int count, int dummy) +static int sis_get_info (char *buffer, char **addr, off_t offset, int count) { int rc; char *p = buffer; diff -u --recursive --new-file v2.3.28/linux/drivers/block/via82cxxx.c linux/drivers/block/via82cxxx.c --- v2.3.28/linux/drivers/block/via82cxxx.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/via82cxxx.c Fri Nov 19 11:33:29 1999 @@ -119,8 +119,8 @@ "192" }; -static int via_get_info(char *, char **, off_t, int, int); -extern int (*via_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int via_get_info(char *, char **, off_t, int); +extern int (*via_display_info)(char *, char **, off_t, int); /* ide-proc.c */ static struct pci_dev *bmide_dev; static char * print_apollo_drive_config (char *buf, struct pci_dev *dev) @@ -304,7 +304,7 @@ return (char *)p; } -static int via_get_info (char *buffer, char **addr, off_t offset, int count, int dummy) +static int via_get_info (char *buffer, char **addr, off_t offset, int count) { /* * print what /proc/via displays, diff -u --recursive --new-file v2.3.28/linux/drivers/block/xd.c linux/drivers/block/xd.c --- v2.3.28/linux/drivers/block/xd.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/block/xd.c Thu Nov 18 19:25:28 1999 @@ -207,7 +207,7 @@ for (i = 0; i < (sizeof(xd_bases) / sizeof(xd_bases[0])) && !found; i++) for (j = 1; j < (sizeof(xd_sigs) / sizeof(xd_sigs[0])) && !found; j++) - if (check_signature(xd_bases[i] + xd_sigs[j].offset,xd_sigs[j].string,strlen(xd_sigs[j].string))) { + if (isa_check_signature(xd_bases[i] + xd_sigs[j].offset,xd_sigs[j].string,strlen(xd_sigs[j].string))) { *controller = j; xd_type = j; *address = xd_bases[i]; diff -u --recursive --new-file v2.3.28/linux/drivers/char/Config.in linux/drivers/char/Config.in --- v2.3.28/linux/drivers/char/Config.in Thu Nov 11 20:11:33 1999 +++ linux/drivers/char/Config.in Tue Nov 23 12:15:29 1999 @@ -114,7 +114,7 @@ tristate '/dev/nvram support' CONFIG_NVRAM -bool 'Enhanced Real Time Clock Support' CONFIG_RTC +tristate 'Enhanced Real Time Clock Support' CONFIG_RTC if [ "$CONFIG_ALPHA_BOOK1" = "y" ]; then bool 'Tadpole ANA H8 Support' CONFIG_H8 fi diff -u --recursive --new-file v2.3.28/linux/drivers/char/bttv.c linux/drivers/char/bttv.c --- v2.3.28/linux/drivers/char/bttv.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/char/bttv.c Sun Nov 21 11:13:56 1999 @@ -551,7 +551,11 @@ /* Lucky Star Image World ConferenceTV */ {3, 1, 0, 2, 16777215, { 2, 3, 1, 1}, { 131072, 1, 1638400, 3, 4}}, /* Phoebe Tv Master + FM */ - { 3, 1, 0, 2, 0xc00, { 2, 3, 1, 1},{0, 1, 0x800, 0x400, 0xc00, 0}} + { 3, 1, 0, 2, 0xc00, { 2, 3, 1, 1},{0, 1, 0x800, 0x400, 0xc00, 0}}, + /* Modular Technology MM205 PCTV, bt878 */ + { 2, 1, 0, -1, 7, { 2, 3 }, { 0, 0, 0, 0, 0 }}, + /* Magic TView CPH061 (bt878) */ + { 3, 1, 0, 2, 0xe00, { 2, 0, 1, 1}, {0x400, 0, 0, 0, 0}}, }; #define TVCARDS (sizeof(tvcards)/sizeof(tvcard)) @@ -2729,37 +2733,42 @@ } /* board specific initialisations */ - if (btv->type == BTTV_MIRO || btv->type == BTTV_MIROPRO) { - /* auto detect tuner for MIRO cards */ - btv->tuner_type=((btread(BT848_GPIO_DATA)>>10)-1)&7; - } - if (btv->type == BTTV_HAUPPAUGE || btv->type == BTTV_HAUPPAUGE878) { - hauppauge_msp_reset(btv); - hauppauge_eeprom(&(btv->i2c)); - if (btv->type == BTTV_HAUPPAUGE878) { - /* all bt878 hauppauge boards use this ... */ + + switch(btv->type) + { + case BTTV_MIRO: + case BTTV_MIROPRO: + /* auto detect tuner for MIRO cards */ + btv->tuner_type=((btread(BT848_GPIO_DATA)>>10)-1)&7; + break; + + case BTTV_HAUPPAUGE: + case BTTV_HAUPPAUGE878: + hauppauge_msp_reset(btv); + hauppauge_eeprom(&(btv->i2c)); + if (btv->type == BTTV_HAUPPAUGE878) { + /* all bt878 hauppauge boards use this ... */ + btv->pll.pll_ifreq=28636363; + btv->pll.pll_crystal=BT848_IFORM_XT0; + } + break; + + case BTTV_CONFERENCETV: + btv->tuner_type = 1; + btv->pll.pll_ifreq=28636363; + btv->pll.pll_crystal=BT848_IFORM_XT0; + break; + + case BTTV_PIXVIEWPLAYTV: + case BTTV_AVERMEDIA98: + case BTTV_MODTEC_205: + case BTTV_MAGICTVIEW061: btv->pll.pll_ifreq=28636363; btv->pll.pll_crystal=BT848_IFORM_XT0; - } - } - - if (btv->type == BTTV_CONFERENCETV) { - btv->tuner_type = 1; - btv->pll.pll_ifreq=28636363; - btv->pll.pll_crystal=BT848_IFORM_XT0; - } - - if (btv->type == BTTV_PIXVIEWPLAYTV) { - btv->pll.pll_ifreq=28636363; - btv->pll.pll_crystal=BT848_IFORM_XT0; - } + break; - if(btv->type==BTTV_AVERMEDIA98) - { - btv->pll.pll_ifreq=28636363; - btv->pll.pll_crystal=BT848_IFORM_XT0; - } - + } + if (btv->have_tuner && btv->tuner_type != -1) i2c_control_device(&(btv->i2c), I2C_DRIVERID_TUNER, @@ -2864,6 +2873,9 @@ case BTTV_PHOEBE_TVMAS: strcpy(btv->video_dev.name,"(Phoebe TV Master)"); break; + case BTTV_MODTEC_205: + strcpy(btv->video_dev.name,"(Modtec MM205)"); + break; } printk("%s\n",btv->video_dev.name); audio(btv, AUDIO_INTERN); diff -u --recursive --new-file v2.3.28/linux/drivers/char/bttv.h linux/drivers/char/bttv.h --- v2.3.28/linux/drivers/char/bttv.h Fri Oct 15 15:25:13 1999 +++ linux/drivers/char/bttv.h Sun Nov 21 11:13:56 1999 @@ -217,6 +217,8 @@ #define BTTV_CEI_RAFFLES 0x14 #define BTTV_CONFERENCETV 0x15 #define BTTV_PHOEBE_TVMAS 0x16 +#define BTTV_MODTEC_205 0x17 +#define BTTV_MAGICTVIEW061 0x18 #define AUDIO_TUNER 0x00 #define AUDIO_RADIO 0x01 diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/compressor/zftape-compress.c linux/drivers/char/ftape/compressor/zftape-compress.c --- v2.3.28/linux/drivers/char/ftape/compressor/zftape-compress.c Fri Feb 20 18:28:22 1998 +++ linux/drivers/char/ftape/compressor/zftape-compress.c Tue Nov 23 10:29:15 1999 @@ -1267,9 +1267,6 @@ "Compression routines for zftape. Uses the lzrw3 algorithm by Ross Williams"); #endif -#if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) -char kernel_version[] = UTS_RELEASE; -#endif #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18) static int can_unload(void) { @@ -1283,15 +1280,13 @@ { int result; -#if LINUX_VERSION_CODE >= KERNEL_VER(1,1,85) -# if LINUX_VERSION_CODE < KERNEL_VER(2,1,18) +#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18) register_symtab(0); /* remove global ftape symbols */ -# else +#else if (!mod_member_present(&__this_module, can_unload)) return -EBUSY; __this_module.can_unload = can_unload; EXPORT_NO_SYMBOLS; -# endif #endif result = zft_compressor_init(); keep_module_locked = 0; diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/fdc-io.c linux/drivers/char/ftape/lowlevel/fdc-io.c --- v2.3.28/linux/drivers/char/ftape/lowlevel/fdc-io.c Wed May 12 13:27:37 1999 +++ linux/drivers/char/ftape/lowlevel/fdc-io.c Tue Nov 23 10:29:15 1999 @@ -1323,11 +1323,7 @@ TRACE_EXIT 0; } -#if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70) static void ftape_interrupt(int irq, void *dev_id, struct pt_regs *regs) -#else -static void ftape_interrupt(int irq, struct pt_regs *regs) -#endif { void (*handler) (void) = *fdc.hook; TRACE_FUN(ft_t_any); @@ -1355,11 +1351,7 @@ fdc.irq); } if (request_dma(fdc.dma, ftape_id)) { -#if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70) free_irq(fdc.irq, ftape_id); -#else - free_irq(fdc.irq); -#endif TRACE_ABORT(-EIO, ft_t_bug, "Unable to grab DMA%d for ftape driver", fdc.dma); diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-bsm.c linux/drivers/char/ftape/lowlevel/ftape-bsm.c --- v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-bsm.c Tue Nov 25 14:45:27 1997 +++ linux/drivers/char/ftape/lowlevel/ftape-bsm.c Tue Nov 23 10:29:15 1999 @@ -218,17 +218,10 @@ } /* Display old ftape's end-of-file marks */ -#if LINUX_VERSION_CODE >= KERNEL_VER(2,0,0) while ((sector = get_unaligned(((__u16*)ptr)++)) != 0) { TRACE(ft_t_noise, "Old ftape eof mark: %4d/%2d", sector, get_unaligned(((__u16*)ptr)++)); } -#else - while ((sector = *((__u16*)ptr)++) != 0) { - TRACE(ft_t_noise, "Old ftape eof mark: %4d/%2d", - sector, *((__u16*)ptr)++); - } -#endif } else { /* fixed size format */ for (i = ft_first_data_segment; i < (int)(ft_segments_per_track * ft_tracks_per_tape); ++i) { diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-ctl.h linux/drivers/char/ftape/lowlevel/ftape-ctl.h --- v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-ctl.h Tue Nov 25 14:45:27 1997 +++ linux/drivers/char/ftape/lowlevel/ftape-ctl.h Tue Nov 23 10:29:15 1999 @@ -137,15 +137,6 @@ /* history record */ #define ft_history ftape_status.fti_history -/* compatibility with old kernel versions - */ -#if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) -#define _IOC_SIZE(cmd) (((cmd) & IOCSIZE_MASK) >> IOCSIZE_SHIFT) -#define _IOC_DIR(cmd) (cmd) -#define _IOC_WRITE IOC_IN -#define _IOC_READ IOC_OUT -#endif - /* * ftape-ctl.c defined global vars. */ diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-init.c linux/drivers/char/ftape/lowlevel/ftape-init.c --- v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-init.c Tue Jul 6 19:16:55 1999 +++ linux/drivers/char/ftape/lowlevel/ftape-init.c Tue Nov 23 10:29:15 1999 @@ -114,8 +114,7 @@ ft_failure = 1; /* inhibit any operation but open */ ftape_udelay_calibrate(); /* must be before fdc_wait_calibrate ! */ fdc_wait_calibrate(); -#if (LINUX_VERSION_CODE >= KERNEL_VER(1,2,0) && \ - LINUX_VERSION_CODE < KERNEL_VER(2,1,18)) +#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18) register_symtab(&ftape_symbol_table); /* add global ftape symbols */ #endif #if defined(CONFIG_PROC_FS) && defined(CONFIG_FT_PROC_FS) @@ -154,10 +153,6 @@ "(c) 1996, 1997 Claus-Justus Heine (claus@momo.math.rwth-aachen.de)"); MODULE_DESCRIPTION( "QIC-117 driver for QIC-40/80/3010/3020 floppy tape drives."); -#endif - -#if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) -char kernel_version[] = UTS_RELEASE; #endif /* Called by modules package when installing the driver diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-init.h linux/drivers/char/ftape/lowlevel/ftape-init.h --- v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-init.h Fri Jan 23 17:38:04 1998 +++ linux/drivers/char/ftape/lowlevel/ftape-init.h Tue Nov 23 10:29:15 1999 @@ -42,9 +42,7 @@ /* ftape-init.c defined global variables. */ -#if defined(MODULE) && LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) -extern char kernel_version[]; -#endif + /* ftape-init.c defined global functions not defined in ftape.h */ diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-proc.h linux/drivers/char/ftape/lowlevel/ftape-proc.h --- v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-proc.h Tue Nov 25 14:45:27 1997 +++ linux/drivers/char/ftape/lowlevel/ftape-proc.h Fri Nov 19 11:33:29 1999 @@ -29,8 +29,6 @@ #include -extern struct proc_dir_entry proc_ftape; - extern int ftape_proc_init(void); extern void ftape_proc_destroy(void); diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-rw.h linux/drivers/char/ftape/lowlevel/ftape-rw.h --- v2.3.28/linux/drivers/char/ftape/lowlevel/ftape-rw.h Tue Nov 25 14:45:27 1997 +++ linux/drivers/char/ftape/lowlevel/ftape-rw.h Tue Nov 23 10:29:15 1999 @@ -36,7 +36,6 @@ #include "../lowlevel/ftape-init.h" #include "../lowlevel/ftape-bsm.h" -#if LINUX_VERSION_CODE >= KERNEL_VER(2,0,0) #include #define GET2(address, offset) get_unaligned((__u16*)((__u8 *)address + offset)) @@ -45,14 +44,6 @@ #define PUT2(address, offset , value) put_unaligned((value), (__u16*)((__u8 *)address + offset)) #define PUT4(address, offset , value) put_unaligned((value), (__u32*)((__u8 *)address + offset)) #define PUT8(address, offset , value) put_unaligned((value), (__u64*)((__u8 *)address + offset)) -#else -#define GET2(address, offset) *(__u16*)((__u8 *)address + offset) -#define GET4(address, offset) *(__u32*)((__u8 *)address + offset) -#define GET8(address, offset) *(__u64*)((__u8 *)address + offset) -#define PUT2(address, offset , value) *(__u16*)((__u8 *)address + offset) = (__u16)(value) -#define PUT4(address, offset , value) *(__u32*)((__u8 *)address + offset) = (__u32)(value) -#define PUT8(address, offset , value) *(__u64*)((__u8 *)address + offset) = (__u32)(value) -#endif enum runner_status_enum { idle = 0, diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/zftape/zftape-eof.c linux/drivers/char/ftape/zftape/zftape-eof.c --- v2.3.28/linux/drivers/char/ftape/zftape/zftape-eof.c Tue Nov 25 14:45:28 1997 +++ linux/drivers/char/ftape/zftape/zftape-eof.c Tue Nov 23 10:29:15 1999 @@ -122,19 +122,11 @@ { while (ptr + 3 < limit) { -#if LINUX_VERSION_CODE >= KERNEL_VER(2,0,0) if (get_unaligned((__u32*)ptr)) { ++(__u32*)ptr; } else { return ptr; } -#else - if (*(__u32*)ptr) { - ++(__u32*)ptr; - } else { - return ptr; - } -#endif } return NULL; } diff -u --recursive --new-file v2.3.28/linux/drivers/char/ftape/zftape/zftape-init.c linux/drivers/char/ftape/zftape/zftape-init.c --- v2.3.28/linux/drivers/char/ftape/zftape/zftape-init.c Tue Jul 6 19:16:55 1999 +++ linux/drivers/char/ftape/zftape/zftape-init.c Tue Nov 23 10:29:15 1999 @@ -115,13 +115,8 @@ #else static int zft_read (struct inode *ino, struct file *fp, char *buff, int req_len); -#if LINUX_VERSION_CODE >= KERNEL_VER(1,3,0) static int zft_write(struct inode *ino, struct file *fp, const char *buff, int req_len); -#else -static int zft_write(struct inode *ino, struct file *fp, char *buff, - int req_len); -#endif #endif static struct file_operations zft_cdev = @@ -326,11 +321,8 @@ #elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0) static long zft_write(struct inode *ino, struct file *fp, const char *buff, unsigned long req_len) -#elif LINUX_VERSION_CODE >= KERNEL_VER(1,3,0) -static int zft_write(struct inode *ino, struct file *fp, const char *buff, - int req_len) #else -static int zft_write(struct inode *ino, struct file *fp, char *buff, +static int zft_write(struct inode *ino, struct file *fp, const char *buff, int req_len) #endif { @@ -445,10 +437,8 @@ TRACE(ft_t_info, "installing zftape VFS interface for ftape driver ..."); TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),); -#if LINUX_VERSION_CODE >= KERNEL_VER(1,2,0) -# if LINUX_VERSION_CODE < KERNEL_VER(2,1,18) +#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18) register_symtab(&zft_symbol_table); /* add global zftape symbols */ -# endif #endif #ifdef CONFIG_ZFT_COMPRESSOR (void)zft_compressor_init(); @@ -461,9 +451,6 @@ #ifdef MODULE -#if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) && defined(MODULE) -char kernel_version[] = UTS_RELEASE; -#endif #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18) /* Called by modules package before trying to unload the module */ diff -u --recursive --new-file v2.3.28/linux/drivers/char/h8.c linux/drivers/char/h8.c --- v2.3.28/linux/drivers/char/h8.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/char/h8.c Fri Nov 19 11:33:29 1999 @@ -58,9 +58,10 @@ static void h8_intr(int irq, void *dev_id, struct pt_regs *regs); #ifdef CONFIG_PROC_FS -static int h8_get_info(char *, char **, off_t, int, int); +static int h8_get_info(char *, char **, off_t, int); #else -static int h8_get_info(char *, char **, off_t, int, int) {} +static int h8_get_info(char *, char **, off_t, int) {} +#error "Somebody needs to learn C. Badly." #endif /* @@ -402,7 +403,7 @@ } #ifdef CONFIG_PROC_FS -int h8_get_info(char *buf, char **start, off_t fpos, int length, int dummy) +static int h8_get_info(char *buf, char **start, off_t fpos, int length) { char *p; diff -u --recursive --new-file v2.3.28/linux/drivers/char/ip2main.c linux/drivers/char/ip2main.c --- v2.3.28/linux/drivers/char/ip2main.c Thu Nov 11 20:11:33 1999 +++ linux/drivers/char/ip2main.c Fri Nov 19 11:33:29 1999 @@ -71,7 +71,7 @@ #include -int ip2_read_procmem(char *, char **, off_t, int, int ); +static int ip2_read_procmem(char *, char **, off_t, int); int ip2_read_proc(char *, char **, off_t, int, int *, void * ); /********************/ @@ -3003,8 +3003,8 @@ #define LIMIT (PAGE_SIZE - 120) -int -ip2_read_procmem(char *buf, char **start, off_t offset, int len, int unused) +static int +ip2_read_procmem(char *buf, char **start, off_t offset, int len) { i2eBordStrPtr pB; i2ChanStrPtr pCh; diff -u --recursive --new-file v2.3.28/linux/drivers/char/mem.c linux/drivers/char/mem.c --- v2.3.28/linux/drivers/char/mem.c Thu Nov 11 20:11:34 1999 +++ linux/drivers/char/mem.c Sat Nov 20 10:09:05 1999 @@ -21,7 +21,7 @@ #include #include -#include +#include #ifdef CONFIG_SOUND void soundcore_init(void); diff -u --recursive --new-file v2.3.28/linux/drivers/char/misc.c linux/drivers/char/misc.c --- v2.3.28/linux/drivers/char/misc.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/char/misc.c Tue Nov 23 12:15:29 1999 @@ -71,7 +71,6 @@ extern void acq_init(void); extern void dtlk_init(void); extern void pcwatchdog_init(void); -extern int rtc_init(void); extern int rtc_sun_init(void); /* Combines MK48T02 and MK48T08 */ extern int rtc_DP8570A_init(void); extern int rtc_MK48T08_init(void); @@ -223,9 +222,6 @@ #endif #if defined(CONFIG_SUN_MOSTEK_RTC) rtc_sun_init(); -#endif -#if defined(CONFIG_RTC) - rtc_init(); #endif #ifdef CONFIG_ATARI_DSP56K dsp56k_init(); diff -u --recursive --new-file v2.3.28/linux/drivers/char/radio-typhoon.c linux/drivers/char/radio-typhoon.c --- v2.3.28/linux/drivers/char/radio-typhoon.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/char/radio-typhoon.c Fri Nov 19 11:33:29 1999 @@ -72,8 +72,7 @@ static int typhoon_open(struct video_device *dev, int flags); static void typhoon_close(struct video_device *dev); #ifdef CONFIG_RADIO_TYPHOON_PROC_FS -static int typhoon_get_info(char *buf, char **start, off_t offset, int len, - int unused); +static int typhoon_get_info(char *buf, char **start, off_t offset, int len); #endif static void typhoon_setvol_generic(struct typhoon_device *dev, int vol) @@ -299,8 +298,7 @@ #ifdef CONFIG_RADIO_TYPHOON_PROC_FS -static int typhoon_get_info(char *buf, char **start, off_t offset, int len, - int unused) +static int typhoon_get_info(char *buf, char **start, off_t offset, int len) { #ifdef MODULE #define MODULEPROCSTRING "Driver loaded as a module" diff -u --recursive --new-file v2.3.28/linux/drivers/char/rocket.c linux/drivers/char/rocket.c --- v2.3.28/linux/drivers/char/rocket.c Tue Aug 31 17:29:13 1999 +++ linux/drivers/char/rocket.c Tue Nov 23 10:29:15 1999 @@ -42,16 +42,14 @@ #include #include -#if (defined(CONFIG_PCI) && (LINUX_VERSION_CODE >= 131072)) +#ifdef CONFIG_PCI #define ENABLE_PCI #endif -#if (LINUX_VERSION_CODE > 66304) #define NEW_MODULES #ifdef LOCAL_ROCKET_H /* We're building standalone */ #define MODULE #endif -#endif #ifdef NEW_MODULES #ifdef MODVERSIONS @@ -200,13 +198,6 @@ MODULE_PARM_DESC(support_low_speed, "0 means support 50 baud, 1 means support 460400 baud"); #endif -/* - * Provide backwards compatibility for kernels prior to 2.1.8. - */ -#if (LINUX_VERSION_CODE < 0x20000) -typedef dev_t kdev_t; -#endif - #if (LINUX_VERSION_CODE < 131336) int copy_from_user(void *to, const void *from_user, unsigned long len) { @@ -1757,13 +1748,8 @@ } } -#if (LINUX_VERSION_CODE > 66304) static int rp_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) -#else -static int rp_write(struct tty_struct * tty, int from_user, - unsigned char *buf, int count) -#endif { struct r_port * info = (struct r_port *)tty->driver_data; CHANNEL_t *cp; diff -u --recursive --new-file v2.3.28/linux/drivers/char/rtc.c linux/drivers/char/rtc.c --- v2.3.28/linux/drivers/char/rtc.c Tue Aug 31 17:29:13 1999 +++ linux/drivers/char/rtc.c Tue Nov 23 12:15:29 1999 @@ -33,10 +33,11 @@ * DEC Alpha as the CMOS clock is also used for other things. * 1.09 Nikita Schmidt: epoch support and some Alpha cleanup. * 1.09a Pete Zaitcev: Sun SPARC + * 1.09b Jeff Garzik: Modularize, init cleanup * */ -#define RTC_VERSION "1.09a" +#define RTC_VERSION "1.09b" #define RTC_IRQ 8 /* Can't see this changing soon. */ #define RTC_IO_EXTENT 0x10 /* Only really two ports, but... */ @@ -49,15 +50,16 @@ * this driver.) */ +#include +#include #include -#include #include -#include #include #include #include #include #include +#include #include #include @@ -67,6 +69,7 @@ #include static unsigned long rtc_port; +static int rtc_irq; #endif /* @@ -99,6 +102,9 @@ static inline unsigned char rtc_is_updating(void); +static int rtc_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data); + /* * Bits in rtc_status. (6 bits of room for future expansion) */ @@ -106,9 +112,9 @@ #define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */ #define RTC_TIMER_ON 0x02 /* missed irq timer active */ -unsigned char rtc_status = 0; /* bitmapped status byte. */ -unsigned long rtc_freq = 0; /* Current periodic IRQ rate */ -unsigned long rtc_irq_data = 0; /* our output to the world */ +static unsigned char rtc_status = 0; /* bitmapped status byte. */ +static unsigned long rtc_freq = 0; /* Current periodic IRQ rate */ +static unsigned long rtc_irq_data = 0; /* our output to the world */ /* * If this driver ever becomes modularised, it will be really nice @@ -117,7 +123,7 @@ static unsigned long epoch = 1900; /* year corresponding to 0x00 */ -unsigned char days_in_mo[] = +static const unsigned char days_in_mo[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; /* @@ -457,6 +463,8 @@ if(rtc_status & RTC_IS_OPEN) return -EBUSY; + MOD_INC_USE_COUNT; + rtc_status |= RTC_IS_OPEN; rtc_irq_data = 0; return 0; @@ -487,6 +495,8 @@ del_timer(&rtc_irq_timer); } + MOD_DEC_USE_COUNT; + rtc_irq_data = 0; rtc_status &= ~RTC_IS_OPEN; return 0; @@ -524,7 +534,7 @@ &rtc_fops }; -int __init rtc_init(void) +static int __init rtc_init(void) { unsigned long flags; #ifdef __alpha__ @@ -535,7 +545,6 @@ #ifdef __sparc__ struct linux_ebus *ebus; struct linux_ebus_device *edev; - int rtc_irq; #endif printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION); @@ -575,6 +584,8 @@ return -EIO; } misc_register(&rtc_dev); + create_proc_read_entry ("rtc", 0, NULL, rtc_read_proc, NULL); + /* Check region? Naaah! Just snarf it up. */ request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); #endif /* __sparc__ vs. others */ @@ -619,6 +630,25 @@ return 0; } +static void __exit rtc_exit (void) +{ + /* interrupts and timer disabled at this point by rtc_release */ + + remove_proc_entry ("rtc", NULL); + misc_deregister(&rtc_dev); + +#ifdef __sparc__ + free_irq (rtc_irq, &rtc_port); +#else + release_region (RTC_PORT (0), RTC_IO_EXTENT); + free_irq (RTC_IRQ, NULL); +#endif /* __sparc__ */ +} + +module_init(rtc_init); +module_exit(rtc_exit); +EXPORT_NO_SYMBOLS; + /* * At IRQ rates >= 4096Hz, an interrupt may get lost altogether. * (usually during an IDE disk interrupt, with IRQ unmasking off) @@ -650,7 +680,7 @@ * Info exported via "/proc/rtc". */ -int get_rtc_status(char *buf) +static int rtc_get_status(char *buf) { char *p; struct rtc_time tm; @@ -722,6 +752,18 @@ batt ? "okay" : "dead"); return p - buf; +} + +static int rtc_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int len = rtc_get_status(page); + if (len <= off+count) *eof = 1; + *start = page + off; + len -= off; + if (len>count) len = count; + if (len<0) len = 0; + return len; } /* diff -u --recursive --new-file v2.3.28/linux/drivers/char/serial.c linux/drivers/char/serial.c --- v2.3.28/linux/drivers/char/serial.c Thu Nov 11 20:11:34 1999 +++ linux/drivers/char/serial.c Tue Nov 23 10:29:15 1999 @@ -44,6 +44,9 @@ * int rs_init(void); */ +static char *serial_version = "4.91"; +static char *serial_revdate = "1999-11-17"; + /* * Serial driver configuration section. Here are the various options: * @@ -86,10 +89,15 @@ #define CONFIG_HUB6 #endif -#if (defined(CONFIG_PCI) && (LINUX_VERSION_CODE >= 131072)) +#ifdef CONFIG_PCI #define ENABLE_SERIAL_PCI +#ifndef CONFIG_SERIAL_SHARE_IRQ #define CONFIG_SERIAL_SHARE_IRQ #endif +#ifndef CONFIG_SERIAL_MANY_PORTS +#define CONFIG_SERIAL_MANY_PORTS +#endif +#endif /* Set of debugging defines */ @@ -98,6 +106,7 @@ #undef SERIAL_DEBUG_FLOW #undef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT #undef SERIAL_DEBUG_PCI +#undef SERIAL_DEBUG_AUTOCONF /* Sanity checks */ @@ -119,10 +128,9 @@ #define RS_STROBE_TIME (10*HZ) #define RS_ISR_PASS_LIMIT 256 -#define IRQ_T(state) \ - ((state->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) - +#if (defined(__i386__) && (CPU==386 || CPU==486)) #define SERIAL_INLINE +#endif #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ @@ -135,12 +143,10 @@ * End of serial driver configuration section. */ -#if (LINUX_VERSION_CODE > 66304) #define NEW_MODULES #ifdef LOCAL_HEADERS /* We're building standalone */ #define MODULE #endif -#endif #ifdef NEW_MODULES #ifdef MODVERSIONS @@ -152,6 +158,7 @@ #endif #endif /* NEW_MODULES */ #include + #include #ifdef LOCAL_HEADERS #include "serial_local.h" @@ -160,7 +167,7 @@ #include #include #include -static char *serial_version = "4.30"; +#define LOCAL_VERSTRING "" #endif #include @@ -177,10 +184,11 @@ #include #include #include -#if (LINUX_VERSION_CODE >= 131343) /* 2.1.15 -- XX get correct version */ +#if (LINUX_VERSION_CODE >= 131343) #include -#else -#define __initfunc(x) x +#endif +#if (LINUX_VERSION_CODE >= 131336) +#include #endif #include #ifdef CONFIG_SERIAL_CONSOLE @@ -190,6 +198,14 @@ #include #endif +/* + * All of the compatibilty code so we can compile serial.c against + * older kernels is hidden in serial_compat.h + */ +#if (LINUX_VERSION_CODE < 0x020317) /* 2.3.23 */ +#include "serial_compat.h" +#endif + #include #include #include @@ -203,6 +219,8 @@ #ifdef SERIAL_INLINE #define _INLINE_ inline +#else +#define _INLINE_ #endif static char *serial_name = "Serial driver"; @@ -233,6 +251,7 @@ static int IRQ_timeout[NR_IRQS]; #ifdef CONFIG_SERIAL_CONSOLE static struct console sercons; +static unsigned long break_pressed; /* break, really ... */ #endif static unsigned detect_uart_irq (struct serial_state * state); @@ -274,7 +293,11 @@ #define NR_PCI_BOARDS 8 static struct pci_board_inst serial_pci_board[NR_PCI_BOARDS]; static int serial_pci_board_idx = 0; +#ifdef PCI_NUM_RESOURCES #define PCI_BASE_ADDRESS(dev, r) ((dev)->resource[r].start) +#else +#define PCI_BASE_ADDRESS(dev, r) ((dev)->base_address[r]) +#endif #endif /* ENABLE_SERIAL_PCI */ static struct tty_struct *serial_table[NR_PORTS]; @@ -301,87 +324,6 @@ static struct semaphore tmp_buf_sem = MUTEX; #endif -/* - * Provide backwards compatibility for kernels prior to 2.1.XX. - */ -#if (LINUX_VERSION_CODE < 0x20000) -typedef dev_t kdev_t; -#endif - -#if (LINUX_VERSION_CODE < 0x02017E) -static signed long schedule_timeout(signed long timeout) -{ - unsigned long expire; - - expire = timeout + jiffies; - - current->timeout = jiffies + timeout; - schedule(); - - timeout = expire - jiffies; - return timeout < 0 ? 0 : timeout; -} -#endif - -#ifndef time_after -#define time_after(a,b) ((long)(b) - (long)(a) < 0) -#endif - -#if (LINUX_VERSION_CODE < 0x020100) -static inline int irq_cannonicalize(int irq) -{ - return ((irq == 2) ? 9 : irq); -} -#endif - -#if (LINUX_VERSION_CODE < 131336) -static int copy_from_user(void *to, const void *from_user, unsigned long len) -{ - int error; - - error = verify_area(VERIFY_READ, from_user, len); - if (error) - return len; - memcpy_fromfs(to, from_user, len); - return 0; -} - -static int copy_to_user(void *to_user, const void *from, unsigned long len) -{ - int error; - - error = verify_area(VERIFY_WRITE, to_user, len); - if (error) - return len; - memcpy_tofs(to_user, from, len); - return 0; -} - -static inline int signal_pending(struct task_struct *p) -{ - return (p->signal & (~p->blocked != 0)); -} - -#else -#include -#endif - -#ifdef CAP_SYS_ADMIN -#define serial_isroot() (capable(CAP_SYS_ADMIN)) -#else -#define serial_isroot() (suser()) -#endif - -#if (LINUX_VERSION_CODE < 131394) /* 2.1.66 */ -#define test_and_clear_bit(x,y) clear_bit(x,y) - -static inline void remove_bh(int nr) -{ - bh_base[nr] = NULL; - bh_mask &= ~(1 << nr); -} -#endif - static inline int serial_paranoia_check(struct async_struct *info, kdev_t device, const char *routine) @@ -404,78 +346,63 @@ return 0; } -static inline unsigned int serial_in(struct async_struct *info, int offset) +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset) { + switch (info->io_type) { #ifdef CONFIG_HUB6 - if (info->hub6) { - outb(info->hub6 - 1 + offset, info->port); - return inb(info->port+1); - } else + case SERIAL_IO_HUB6: + outb(info->hub6 - 1 + offset, info->port); + return inb(info->port+1); #endif #ifdef CONFIG_SERIAL_PCI_MEMMAPPED - if (info->iomem_base) - return readb(info->iomem_base + (offset<iomem_reg_shift)); - else + case SERIAL_IO_MEM: + return readb(info->iomem_base + + (offset<iomem_reg_shift)); +#endif +#ifdef CONFIG_SERIAL_GSC + case SERIAL_IO_GSC: + return gsc_readb(info->iomem_base + offset); #endif - return inb(info->port + offset); + default: + return inb(info->port + offset); + } } -static inline unsigned int serial_inp(struct async_struct *info, int offset) +static _INLINE_ void serial_out(struct async_struct *info, int offset, + int value) { + switch (info->io_type) { #ifdef CONFIG_HUB6 - if (info->hub6) { - outb(info->hub6 - 1 + offset, info->port); - return inb_p(info->port+1); - } else + case SERIAL_IO_HUB6: + outb(info->hub6 - 1 + offset, info->port); + outb(value, info->port+1); + break; #endif #ifdef CONFIG_SERIAL_PCI_MEMMAPPED - if (info->iomem_base) - return readb(info->iomem_base + (offset<iomem_reg_shift)); - else + case SERIAL_IO_MEM: + writeb(value, info->iomem_base + + (offset<iomem_reg_shift)); + break; #endif -#ifdef CONFIG_SERIAL_NOPAUSE_IO - return inb(info->port + offset); -#else - return inb_p(info->port + offset); +#ifdef CONFIG_SERIAL_GSC + case SERIAL_IO_GSC: + gsc_writeb(value, info->iomem_base + offset); + break; #endif + default: + outb(value, info->port+offset); + } } -static inline void serial_out(struct async_struct *info, int offset, int value) -{ -#ifdef CONFIG_HUB6 - if (info->hub6) { - outb(info->hub6 - 1 + offset, info->port); - outb(value, info->port+1); - } else -#endif -#ifdef CONFIG_SERIAL_PCI_MEMMAPPED - if (info->iomem_base) - writeb(value, info->iomem_base + (offset<iomem_reg_shift)); - else -#endif - outb(value, info->port+offset); -} +/* + * We used to support using pause I/O for certain machines. We + * haven't supported this for a while, but just in case it's badly + * needed for certain old 386 machines, I've left these #define's + * in.... + */ +#define serial_inp(info, offset) serial_in(info, offset) +#define serial_outp(info, offset, value) serial_out(info, offset, value) -static inline void serial_outp(struct async_struct *info, int offset, - int value) -{ -#ifdef CONFIG_HUB6 - if (info->hub6) { - outb(info->hub6 - 1 + offset, info->port); - outb_p(value, info->port+1); - } else -#endif -#ifdef CONFIG_SERIAL_PCI_MEMMAPPED - if (info->iomem_base) - writeb(value, info->iomem_base + (offset<iomem_reg_shift)); - else -#endif -#ifdef CONFIG_SERIAL_NOPAUSE_IO - outb(value, info->port+offset); -#else - outb_p(value, info->port+offset); -#endif -} /* * For the 16C950 @@ -579,7 +506,7 @@ } static _INLINE_ void receive_chars(struct async_struct *info, - int *status) + int *status, struct pt_regs * regs) { struct tty_struct *tty = info->tty; unsigned char ch; @@ -590,7 +517,7 @@ do { ch = serial_inp(info, UART_RX); if (tty->flip.count >= TTY_FLIPBUF_SIZE) - break; + goto ignore_char; *tty->flip.char_buf_ptr = ch; icount->rx++; @@ -629,6 +556,15 @@ #ifdef SERIAL_DEBUG_INTR printk("handling break...."); #endif +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE) + if (info->line == sercons.index) { + if (!break_pressed) { + break_pressed = jiffies; + goto ignore_char; + } + break_pressed = 0; + } +#endif *tty->flip.flag_buf_ptr = TTY_BREAK; if (info->flags & ASYNC_SAK) do_SAK(tty); @@ -642,14 +578,25 @@ * reported immediately, and doesn't * affect the current character */ - if (tty->flip.count < TTY_FLIPBUF_SIZE) { - tty->flip.count++; - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - *tty->flip.flag_buf_ptr = TTY_OVERRUN; - } + tty->flip.count++; + tty->flip.flag_buf_ptr++; + tty->flip.char_buf_ptr++; + *tty->flip.flag_buf_ptr = TTY_OVERRUN; + if (tty->flip.count >= TTY_FLIPBUF_SIZE) + goto ignore_char; } } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE) + if (break_pressed && info->line == sercons.index) { + if (ch != 0 && + time_before(jiffies, break_pressed + HZ*5)) { + handle_sysrq(ch, regs, NULL, NULL); + break_pressed = 0; + goto ignore_char; + } + break_pressed = 0; + } +#endif tty->flip.flag_buf_ptr++; tty->flip.char_buf_ptr++; tty->flip.count++; @@ -819,7 +766,7 @@ printk("status = %x...", status); #endif if (status & UART_LSR_DR) - receive_chars(info, &status); + receive_chars(info, &status, regs); check_modem_status(info); if (status & UART_LSR_THRE) transmit_chars(info, 0); @@ -883,7 +830,7 @@ printk("status = %x...", status); #endif if (status & UART_LSR_DR) - receive_chars(info, &status); + receive_chars(info, &status, regs); check_modem_status(info); if (status & UART_LSR_THRE) transmit_chars(info, 0); @@ -946,7 +893,7 @@ printk("status = %x...", status); #endif if (status & UART_LSR_DR) - receive_chars(info, &status); + receive_chars(info, &status, regs); check_modem_status(info); if (status & UART_LSR_THRE) transmit_chars(info, 0); @@ -1041,7 +988,7 @@ unsigned long flags; if ((jiffies - last_strobe) >= RS_STROBE_TIME) { - for (i=1; i < NR_IRQS; i++) { + for (i=0; i < NR_IRQS; i++) { info = IRQ_ports[i]; if (!info) continue; @@ -1228,7 +1175,7 @@ */ if (serial_inp(info, UART_LSR) == 0xff) { printk("LSR safety check engaged!\n"); - if (serial_isroot()) { + if (capable(CAP_SYS_ADMIN)) { if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); } else @@ -1243,7 +1190,7 @@ !IRQ_ports[state->irq]->next_port)) { if (IRQ_ports[state->irq]) { #ifdef CONFIG_SERIAL_SHARE_IRQ - free_irq(state->irq, NULL); + free_irq(state->irq, &IRQ_ports[state->irq]); #ifdef CONFIG_SERIAL_MULTIPORT if (rs_multiport[state->irq].port1) handler = rs_interrupt_multi; @@ -1257,10 +1204,10 @@ } else handler = rs_interrupt_single; - retval = request_irq(state->irq, handler, IRQ_T(state), - "serial", NULL); + retval = request_irq(state->irq, handler, SA_SHIRQ, + "serial", &IRQ_ports[state->irq]); if (retval) { - if (serial_isroot()) { + if (capable(CAP_SYS_ADMIN)) { if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); @@ -1409,15 +1356,16 @@ if (state->irq && (!IRQ_ports[state->irq] || !IRQ_ports[state->irq]->next_port)) { if (IRQ_ports[state->irq]) { - free_irq(state->irq, NULL); + free_irq(state->irq, &IRQ_ports[state->irq]); retval = request_irq(state->irq, rs_interrupt_single, - IRQ_T(state), "serial", NULL); + SA_SHIRQ, "serial", + &IRQ_ports[state->irq]); if (retval) printk("serial shutdown: request_irq: error %d" " Couldn't reacquire IRQ.\n", retval); } else - free_irq(state->irq, NULL); + free_irq(state->irq, &IRQ_ports[state->irq]); } if (info->xmit_buf) { @@ -1445,8 +1393,11 @@ serial_outp(info, UART_MCR, info->MCR); /* disable FIFO's */ - serial_outp(info, UART_FCR, (UART_FCR_CLEAR_RCVR | + serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO | + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)); + serial_outp(info, UART_FCR, 0); + (void)serial_in(info, UART_RX); /* read data port to reset things */ if (info->tty) @@ -1922,6 +1873,7 @@ tmp.closing_wait = state->closing_wait; tmp.custom_divisor = state->custom_divisor; tmp.hub6 = state->hub6; + tmp.io_type = state->io_type; if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) return -EFAULT; return 0; @@ -1944,7 +1896,7 @@ change_port = (new_serial.port != state->port) || (new_serial.hub6 != state->hub6); - if (!serial_isroot()) { + if (!capable(CAP_SYS_ADMIN)) { if (change_irq || change_port || (new_serial.baud_base != state->baud_base) || (new_serial.type != state->type) || @@ -1963,7 +1915,7 @@ new_serial.irq = irq_cannonicalize(new_serial.irq); - if ((new_serial.irq >= NR_IRQS) || (new_serial.port > 0xffff) || + if ((new_serial.irq >= NR_IRQS) || (new_serial.baud_base < 9600)|| (new_serial.type < PORT_UNKNOWN) || (new_serial.type > PORT_MAX) || (new_serial.type == PORT_CIRRUS) || (new_serial.type == PORT_STARTECH)) { @@ -1973,7 +1925,7 @@ if ((new_serial.type != state->type) || (new_serial.xmit_fifo_size <= 0)) new_serial.xmit_fifo_size = - uart_config[state->type].dfl_xmit_fifo_size; + uart_config[new_serial.type].dfl_xmit_fifo_size; /* Make sure address is not already in use */ if (new_serial.type) { @@ -1998,17 +1950,17 @@ info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | (info->flags & ASYNC_INTERNAL_FLAGS)); state->custom_divisor = new_serial.custom_divisor; - state->type = new_serial.type; state->close_delay = new_serial.close_delay * HZ/100; state->closing_wait = new_serial.closing_wait * HZ/100; -#if (LINUX_VERSION_CODE > 0x200100) +#if (LINUX_VERSION_CODE > 0x20100) info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; #endif info->xmit_fifo_size = state->xmit_fifo_size = new_serial.xmit_fifo_size; - if (state->type != PORT_UNKNOWN && state->port) + if ((state->type != PORT_UNKNOWN) && state->port) release_region(state->port,8); + state->type = new_serial.type; if (change_port || change_irq) { /* * We need to shutdown the serial port at the old @@ -2018,6 +1970,10 @@ state->irq = new_serial.irq; info->port = state->port = new_serial.port; info->hub6 = state->hub6 = new_serial.hub6; + if (info->hub6) + info->io_type = state->io_type = SERIAL_IO_HUB6; + else if (info->io_type == SERIAL_IO_HUB6) + info->io_type = state->io_type = SERIAL_IO_PORT; } if ((state->type != PORT_UNKNOWN) && state->port) request_region(state->port,8,"serial(set)"); @@ -2068,6 +2024,18 @@ status = serial_in(info, UART_LSR); restore_flags(flags); result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0); + + /* + * If we're about to load something into the transmit + * register, we'll pretend the transmitter isn't empty to + * avoid a race condition (depending on when the transmit + * interrupt happens). + */ + if (info->x_char || + ((info->xmit_cnt > 0) && !info->tty->stopped && + !info->tty->hw_stopped)) + result &= TIOCSER_TEMT; + if (copy_to_user(value, &result, sizeof(int))) return -EFAULT; return 0; @@ -2162,7 +2130,7 @@ { int retval; - if (!serial_isroot()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (info->state->count > 1) @@ -2265,7 +2233,7 @@ int retval; void (*handler)(int, void *, struct pt_regs *); - if (!serial_isroot()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; state = info->state; @@ -2318,14 +2286,14 @@ if (IRQ_ports[state->irq]->next_port && (was_multi != now_multi)) { - free_irq(state->irq, NULL); + free_irq(state->irq, &IRQ_ports[state->irq]); if (now_multi) handler = rs_interrupt_multi; else handler = rs_interrupt; - retval = request_irq(state->irq, handler, IRQ_T(state), - "serial", NULL); + retval = request_irq(state->irq, handler, SA_SHIRQ, + "serial", &IRQ_ports[state->irq]); if (retval) { printk("Couldn't reallocate serial interrupt " "driver!!\n"); @@ -2652,7 +2620,7 @@ info->tty = 0; if (info->blocked_open) { if (info->close_delay) { - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(info->close_delay); } wake_up_interruptible(&info->open_wait); @@ -2716,14 +2684,14 @@ #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT printk("lsr = %d (jiff=%lu)...", lsr, jiffies); #endif - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(char_time); if (signal_pending(current)) break; if (timeout && time_after(jiffies, orig_jiffies + timeout)) break; } - current->state = TASK_RUNNING; + set_current_state(TASK_RUNNING); #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies); #endif @@ -2759,11 +2727,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, struct async_struct *info) { -#ifdef DECLARE_WAITQUEUE DECLARE_WAITQUEUE(wait, current); -#else - struct wait_queue wait = { current, NULL }; -#endif struct serial_state *state = info->state; int retval; int do_clocal = 0, extra_count = 0; @@ -2880,7 +2844,7 @@ #endif schedule(); } - current->state = TASK_RUNNING; + set_current_state(TASK_RUNNING); remove_wait_queue(&info->open_wait, &wait); if (extra_count) state->count++; @@ -2912,14 +2876,13 @@ return -ENOMEM; } memset(info, 0, sizeof(struct async_struct)); -#ifdef DECLARE_WAITQUEUE init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->delta_msr_wait); -#endif info->magic = SERIAL_MAGIC; info->port = sstate->port; info->flags = sstate->flags; + info->io_type = sstate->io_type; #ifdef CONFIG_SERIAL_PCI_MEMMAPPED info->iomem_base = sstate->iomem_base; info->iomem_reg_shift = sstate->iomem_reg_shift; @@ -3126,7 +3089,8 @@ int i, len = 0, l; off_t begin = 0; - len += sprintf(page, "serinfo:1.0 driver:%s\n", serial_version); + len += sprintf(page, "serinfo:1.0 driver:%s%s revision:%s\n", + serial_version, LOCAL_VERSTRING, serial_revdate); for (i = 0; i < NR_PORTS && len < 4000; i++) { l = line_info(page + len, &rs_table[i]); len += l; @@ -3160,7 +3124,8 @@ */ static _INLINE_ void show_serial_version(void) { - printk(KERN_INFO "%s version %s with", serial_name, serial_version); + printk(KERN_INFO "%s version %s%s (%s) with", serial_name, + serial_version, LOCAL_VERSTRING, serial_revdate); #ifdef CONFIG_HUB6 printk(" HUB-6"); #define SERIAL_OPT @@ -3298,11 +3263,11 @@ } /* - * This is a helper routine to autodetect StarTech/Exar UART's. When - * this function is called we know it is at least a StarTech 16650 V2, - * but it might be one of several StarTech UARTs, or one of its - * clones. (We treat the broken original StarTech 16650 V1 as a - * 16550A, and why not? Startech doesn't seem to even acknowledge its + * This is a helper routine to autodetect StarTech/Exar/Oxsemi UART's. + * When this function is called we know it is at least a StarTech + * 16650 V2, but it might be one of several StarTech UARTs, or one of + * its clones. (We treat the broken original StarTech 16650 V1 as a + * 16550, and why not? Startech doesn't seem to even acknowledge its * existence.) * * What evil have men's minds wrought... @@ -3311,39 +3276,48 @@ struct serial_state *state, unsigned long flags) { - unsigned char scratch, status1, status2, old_fctr, old_emsr; + unsigned char scratch, scratch2, scratch3; /* - * Here we check for the XR16C85x family. We do this by - * checking for to see if we can replace the scratch register - * with the receive FIFO count register. + * First we check to see if it's an Oxford Semiconductor UART. * - * XXX I don't have one of these chips, but it should also be - * possible to check for them by setting DLL and DLM to 0, and - * then reading back DLL and DLM. If the DLM reads back as - * 0x10, then the UART is a XR16C850 and the DLL contains the - * chip revision. - */ - old_fctr = serial_inp(info, UART_FCTR); - serial_outp(info, UART_FCTR, old_fctr | UART_FCTR_SCR_SWAP); - old_emsr = serial_inp(info, UART_EMSR); - serial_outp(info, UART_EMSR, 0x00); - serial_outp(info, UART_LCR, 0x00); - scratch = serial_in(info, UART_SCR); - serial_outp(info, UART_SCR, 0xa5); - status1 = serial_in(info, UART_SCR); - serial_outp(info, UART_SCR, 0x5a); - status2 = serial_in(info, UART_SCR); - serial_outp(info, UART_SCR, scratch); - if ((status1 != 0xa5) || (status2 != 0x5a)) { - serial_outp(info, UART_LCR, 0xBF); - serial_outp(info, UART_FCTR, old_fctr | UART_FCTR_SCR_SWAP); - serial_outp(info, UART_EMSR, old_emsr); - serial_outp(info, UART_FCTR, old_fctr); + * If we have to do this here because some non-National + * Semiconductor clone chips lock up if you try writing to the + * LSR register (which serial_icr_read does) + */ + if (state->type == PORT_16550A) { + /* Check for Oxford Semiconductor 16C950 */ + scratch = serial_icr_read(info, UART_ID1); + scratch2 = serial_icr_read(info, UART_ID2); + scratch3 = serial_icr_read(info, UART_ID3); + + if (scratch == 0x16 && scratch2 == 0xC9 && + (scratch3 == 0x50 || scratch3 == 0x52 || + scratch3 == 0x54)) { + state->type = PORT_16C950; + state->revision = serial_icr_read(info, UART_REV); + return; + } + } + + /* + * We check for a XR16C850 by setting DLL and DLM to 0, and + * then reading back DLL and DLM. If DLM reads back 0x10, + * then the UART is a XR16C850 and the DLL contains the chip + * revision. If DLM reads back 0x14, then the UART is a + * XR16C854. + * + */ + serial_outp(info, UART_LCR, UART_LCR_DLAB); + serial_outp(info, UART_DLL, 0); + serial_outp(info, UART_DLM, 0); + state->revision = serial_inp(info, UART_DLL); + scratch = serial_inp(info, UART_DLM); + serial_outp(info, UART_LCR, 0); + if (scratch == 0x10 || scratch == 0x14) { state->type = PORT_16850; return; } - serial_outp(info, UART_IER, old_fctr); /* * We distinguish between the '654 and the '650 by counting @@ -3368,10 +3342,16 @@ static void autoconfig(struct serial_state * state) { unsigned char status1, status2, scratch, scratch2, scratch3; + unsigned char save_lcr, save_mcr; struct async_struct *info, scr_info; unsigned long flags; state->type = PORT_UNKNOWN; + +#ifdef SERIAL_DEBUG_AUTOCONF + printk("Testing ttyS%d (0x%04x, 0x%04x)...\n", state->line, + state->port, (unsigned) state->iomem_base); +#endif if (!CONFIGURED_SERIAL_PORT(state)) return; @@ -3385,6 +3365,7 @@ #ifdef CONFIG_HUB6 info->hub6 = state->hub6; #endif + info->io_type = state->io_type; #ifdef CONFIG_SERIAL_PCI_MEMMAPPED info->iomem_base = state->iomem_base; info->iomem_reg_shift = state->iomem_reg_shift; @@ -3405,15 +3386,29 @@ */ scratch = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0); +#ifdef __i386__ outb(0xff, 0x080); +#endif scratch2 = serial_inp(info, UART_IER); + serial_outp(info, UART_IER, 0x0F); +#ifdef __i386__ + outb(0, 0x080); +#endif + scratch3 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, scratch); - if (scratch2) { + if (scratch2 || scratch3 != 0x0F) { +#ifdef SERIAL_DEBUG_AUTOCONF + printk("serial: ttyS%d: simple autoconfig failed\n", + state->line); +#endif restore_flags(flags); return; /* We failed; there's nothing here */ } } + save_mcr = serial_in(info, UART_MCR); + save_lcr = serial_in(info, UART_LCR); + /* * Check to see if a UART is really there. Certain broken * internal modems based on the Rockwell chipset fail this @@ -3424,18 +3419,18 @@ * that conflicts with COM 1-4 --- we hope! */ if (!(state->flags & ASYNC_SKIP_TEST)) { - scratch = serial_inp(info, UART_MCR); - serial_outp(info, UART_MCR, UART_MCR_LOOP | scratch); serial_outp(info, UART_MCR, UART_MCR_LOOP | 0x0A); status1 = serial_inp(info, UART_MSR) & 0xF0; - serial_outp(info, UART_MCR, scratch); + serial_outp(info, UART_MCR, save_mcr); if (status1 != 0x90) { +#ifdef SERIAL_DEBUG_AUTOCONF + printk("serial: ttyS%d: no UART loopback failed\n", + state->line); +#endif restore_flags(flags); return; } - } - - scratch2 = serial_in(info, UART_LCR); + } serial_outp(info, UART_LCR, 0xBF); /* set up for StarTech test */ serial_outp(info, UART_EFR, 0); /* EFR is the same as FCR */ serial_outp(info, UART_LCR, 0); @@ -3456,21 +3451,6 @@ break; } if (state->type == PORT_16550A) { - /* Check for Oxford Semiconductor 16C950 */ - unsigned char scratch4; - - scratch = serial_icr_read(info, UART_ID1); - scratch4 = serial_icr_read(info, UART_ID2); - scratch3 = serial_icr_read(info, UART_ID3); - - if (scratch == 0x16 && scratch4 == 0xC9 && - (scratch3 == 0x50 || scratch3 == 0x52 || - scratch3 == 0x54)) { - state->type = PORT_16C950; - state->revision = serial_icr_read(info, UART_REV); - } - } - if (state->type == PORT_16550A) { /* Check for Startech UART's */ serial_outp(info, UART_LCR, UART_LCR_DLAB); if (serial_in(info, UART_EFR) == 0) { @@ -3483,7 +3463,7 @@ } if (state->type == PORT_16550A) { /* Check for TI 16750 */ - serial_outp(info, UART_LCR, scratch2 | UART_LCR_DLAB); + serial_outp(info, UART_LCR, save_lcr | UART_LCR_DLAB); serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE); scratch = serial_in(info, UART_IIR) >> 5; @@ -3504,7 +3484,7 @@ } serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO); } - serial_outp(info, UART_LCR, scratch2); + serial_outp(info, UART_LCR, save_lcr); if (state->type == PORT_16450) { scratch = serial_in(info, UART_SCR); serial_outp(info, UART_SCR, 0xa5); @@ -3529,9 +3509,11 @@ /* * Reset the UART. */ - serial_outp(info, UART_MCR, 0x00 | ALPHA_KLUDGE_MCR); /* Don't ask */ - serial_outp(info, UART_FCR, (UART_FCR_CLEAR_RCVR | + serial_outp(info, UART_MCR, save_mcr); + serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO | + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)); + serial_outp(info, UART_FCR, 0); (void)serial_in(info, UART_RX); serial_outp(info, UART_IER, 0); @@ -3562,11 +3544,11 @@ * * Note that __init is a no-op if MODULE is defined; we depend on this. */ -static void __init pci_plx9050_fn(struct pci_dev *dev, +static int __init pci_plx9050_fn(struct pci_dev *dev, struct pci_board *board, int enable) { - u8 data, *p; + u8 data, *p, scratch; pci_read_config_byte(dev, PCI_COMMAND, &data); @@ -3576,12 +3558,94 @@ /* enable/disable interrupts */ p = ioremap(PCI_BASE_ADDRESS(dev, 0), 0x80); - writel(enable ? 0x41 : 0x00, p + 0x4c); + if (board->vendor == PCI_VENDOR_ID_PANACOM) { + scratch = readl(p + 0x4c); + if (enable) + scratch |= 0x40; + else + scratch &= ~0x40; + writel(scratch, p + 0x4c); + } else + writel(enable ? 0x41 : 0x00, p + 0x4c); iounmap(p); if (!enable) pci_write_config_byte(dev, PCI_COMMAND, data & ~PCI_COMMAND_MEMORY); + return 0; +} + +/* + * SIIG serial cards have an PCI interface chip which also controls + * the UART clocking frequency. Each UART can be clocked independently + * (except cards equiped with 4 UARTs) and initial clocking settings + * are stored in the EEPROM chip. It can cause problems because this + * version of serial driver doesn't support differently clocked UART's + * on single PCI card. To prevent this, initialization functions set + * high frequency clocking for all UART's on given card. It is safe (I + * hope) because it doesn't touch EEPROM settings to prevent conflicts + * with other OSes (like M$ DOS). + * + * SIIG support added by Andrey Panin , 10/1999 + * + * There is two family of SIIG serial cards with different PCI + * interface chip and different configuration methods: + * - 10x cards have control registers in IO and/or memory space; + * - 20x cards have control registers in standard PCI configuration space. + */ + +#define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc) +#define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8) + +static int __init pci_siig10x_fn(struct pci_dev *dev, + struct pci_board *board, + int enable) +{ + u16 data, *p; + + if (!enable) return 0; + + p = ioremap(PCI_BASE_ADDRESS(dev, 0), 0x80); + + switch (dev->device & 0xfff8) { + case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */ + data = 0xffdf; + break; + case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */ + data = 0xf7ff; + break; + default: /* 1S1P, 4S */ + data = 0xfffb; + break; + } + + writew(readw(p + 0x28) & data, p + 0x28); + iounmap(p); + return 0; +} + +#define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc) +#define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc) + +static int __init pci_siig20x_fn(struct pci_dev *dev, + struct pci_board *board, + int enable) +{ + u8 data; + + if (!enable) return 0; + + /* Change clock frequency for the first UART. */ + pci_read_config_byte(dev, 0x6f, &data); + pci_write_config_byte(dev, 0x6f, data & 0xef); + + /* If this card has 2 UART, we have to do the same with second UART. */ + if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) || + ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) { + pci_read_config_byte(dev, 0x73, &data); + pci_write_config_byte(dev, 0x73, data & 0xef); + } + return 0; } /* @@ -3592,9 +3656,9 @@ /* * Vendor ID, Device ID, * Subvendor ID, Subdevice ID, - * Number of Ports, Base (Maximum) Baud Rate, - * Offset of register holding Uart register offset - * Mask to apply to above register's value + * PCI Flags, Number of Ports, Base (Maximum) Baud Rate, + * Offset to get to next UART's registers + * Register shift to use for memory-mapped I/O */ { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960, PCI_SUBVENDOR_ID_CONNECT_TECH, @@ -3677,7 +3741,7 @@ SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 115200 }, { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8, PCI_ANY_ID, PCI_ANY_ID, - SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 8, 115200 }, + SPCI_FL_BASE2, 8, 115200 }, { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2, PCI_ANY_ID, PCI_ANY_ID, SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 115200 }, @@ -3691,12 +3755,226 @@ 0x400, 7, pci_plx9050_fn }, { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM, PCI_ANY_ID, PCI_ANY_ID, - SPCI_FL_BASE2 | SPCI_FL_IOMEM, 4, 921600, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 921600, 0x400, 7, pci_plx9050_fn }, { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM, PCI_ANY_ID, PCI_ANY_ID, - SPCI_FL_BASE2 | SPCI_FL_IOMEM, 2, 921600, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, 0x400, 7, pci_plx9050_fn }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_CHASE_PCIFAST, + PCI_SUBDEVICE_ID_CHASE_PCIFAST4, + SPCI_FL_BASE2, 4, 460800 }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_CHASE_PCIFAST, + PCI_SUBDEVICE_ID_CHASE_PCIFAST8, + SPCI_FL_BASE2, 8, 460800 }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_CHASE_PCIFAST, + PCI_SUBDEVICE_ID_CHASE_PCIFAST16, + SPCI_FL_BASE2, 16, 460800 }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_CHASE_PCIFAST, + PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, + SPCI_FL_BASE2, 16, 460800 }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_CHASE_PCIRAS, + PCI_SUBDEVICE_ID_CHASE_PCIRAS4, + SPCI_FL_BASE2, 4, 460800 }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_CHASE_PCIRAS, + PCI_SUBDEVICE_ID_CHASE_PCIRAS8, + SPCI_FL_BASE2, 8, 460800 }, + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE1, 4, 115200 }, + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE1, 2, 115200 }, + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE1, 8, 115200 }, + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE1, 8, 115200 }, + { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954, + PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4, + SPCI_FL_BASE0 , 4, 115200 }, + { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954, + PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4, + SPCI_FL_BASE0 , 4, 921600 }, + { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 , 2, 921600 }, + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DUAL_SERIAL, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2, 1, 460800, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2, 1, 460800, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2, 1, 460800, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2, 1, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2, 1, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2, 1, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 921600, + 0, 0, pci_siig10x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0, 1, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 4, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 4, 921600, + 0, 0, pci_siig20x_fn }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 4, 921600, + 0, 0, pci_siig20x_fn }, + /* Computone devices submitted by Doug McNash dmcnash@computone.com */ + { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG, + PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4, + SPCI_FL_IOMEM | SPCI_FL_BASE0, 4, 921600, + 0x40, 2, NULL, 0x200 }, + { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG, + PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8, + SPCI_FL_IOMEM | SPCI_FL_BASE0, 8, 921600, + 0x40, 2, NULL, 0x200 }, + { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG, + PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6, + SPCI_FL_IOMEM | SPCI_FL_BASE0, 6, 921600, + 0x40, 2, NULL, 0x200 }, + /* + * Untested PCI modems, sent in from various folks... + */ + /* at+t zoom 56K faxmodem, from dougd@shieldsbag.com */ + { PCI_VENDOR_ID_ATT, 0x442, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE1, 1, 115200 }, + /* at&t unknown modem, from jimd@esoft.com */ + { PCI_VENDOR_ID_ATT, 0x480, + PCI_ANY_ID, PCI_ANY_ID, + SPCI_FL_BASE1, 1, 115200 }, + /* Elsa Model 56K PCI Modem, from Andreas Rath */ + { PCI_VENDOR_ID_ROCKWELL, 0x1004, + 0x1048, 0x1500, + SPCI_FL_BASE1, 1, 115200 }, + /* 3Com US Robotics 56k* Voice Internal PCI, model# 2884 */ + /* from evidal@iti.upv.es */ + /* XXX complete guess this may not work!!! */ + { PCI_VENDOR_ID_USR, 0x1006, + 0x12b9, 0x0060, + SPCI_FL_BASE1 | SPCI_FL_IOMEM, 1, 115200 }, { 0, } }; @@ -3767,18 +4045,22 @@ * Run the initialization function, if any */ if (board->init_fn) - (board->init_fn)(dev, board, 1); + if ((board->init_fn)(dev, board, 1) != 0) + continue; /* * Register the serial board in the array so we can * shutdown the board later, if necessary. */ + if (serial_pci_board_idx >= NR_PCI_BOARDS) + continue; serial_pci_board[serial_pci_board_idx].board = board; serial_pci_board[serial_pci_board_idx].dev = dev; serial_pci_board_idx++; base_idx = board->flags & SPCI_FL_BASE_MASK; - port = PCI_BASE_ADDRESS(dev, base_idx); + port = PCI_BASE_ADDRESS(dev, base_idx) + + board->first_uart_offset; if (board->flags & SPCI_FL_IOMEM) port &= PCI_BASE_ADDRESS_MEM_MASK; else @@ -3829,6 +4111,7 @@ fake_state.port = port; #ifdef CONFIG_SERIAL_PCI_MEMMAPPED if (board->flags & SPCI_FL_IOMEM) { + fake_state.io_type = SERIAL_IO_MEM; fake_state.iomem_base = ioremap(port, board->uart_offset); fake_state.iomem_reg_shift = board->reg_shift; @@ -3869,6 +4152,16 @@ dualsp_serial_init (); #endif + if (timer_table[RS_TIMER].fn) { + printk("RS_TIMER already set, another serial driver " + "already loaded?\n"); +#ifdef MODULE + printk("Can't load serial driver module over built-in " + "serial driver\n"); +#endif + return -EBUSY; + } + init_bh(SERIAL_BH, do_serial_bh); timer_table[RS_TIMER].fn = rs_timer; timer_table[RS_TIMER].expires = 0; @@ -3974,6 +4267,8 @@ state->icount.frame = state->icount.parity = 0; state->icount.overrun = state->icount.brk = 0; state->irq = irq_cannonicalize(state->irq); + if (state->hub6) + state->io_type = SERIAL_IO_HUB6; if (state->port && check_region(state->port,8)) continue; if (state->flags & ASYNC_BOOT_AUTOCONF) @@ -4035,10 +4330,13 @@ state->irq = req->irq; state->port = req->port; state->flags = req->flags; + state->io_type = req->io_type; #ifdef CONFIG_SERIAL_PCI_MEMMAPPED state->iomem_base = req->iomem_base; state->iomem_reg_shift = req->iomem_reg_shift; #endif + if (req->baud_base) + state->baud_base = req->baud_base; autoconfig(state); if (state->type == PORT_UNKNOWN) { @@ -4103,13 +4401,12 @@ restore_flags(flags); for (i = 0; i < NR_PORTS; i++) { + if ((info = rs_table[i].info)) { + rs_table[i].info = NULL; + kfree_s(info, sizeof(struct async_struct)); + } if ((rs_table[i].type != PORT_UNKNOWN) && rs_table[i].port) release_region(rs_table[i].port, 8); - info = rs_table[i].info; - if (info) { - rs_table[i].info = NULL; - kfree_s(info, sizeof(struct async_struct)); - } #if defined(ENABLE_SERIAL_PCI) && defined (CONFIG_SERIAL_PCI_MEMMAPPED) if (rs_table[i].iomem_base) iounmap(rs_table[i].iomem_base); @@ -4140,20 +4437,20 @@ #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) +static struct async_struct async_sercons; + /* * Wait for transmitter & holding register to empty */ -static inline void wait_for_xmitr(struct serial_state *ser) +static inline void wait_for_xmitr(struct async_struct *info) { - int lsr; unsigned int tmout = 1000000; - do { - lsr = inb(ser->port + UART_LSR); - if (--tmout == 0) break; - } while ((lsr & BOTH_EMPTY) != BOTH_EMPTY); + while (--tmout && + ((serial_in(info, UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)); } + /* * Print a string to the serial port trying not to disturb * any possible real use of the port... @@ -4161,31 +4458,30 @@ static void serial_console_write(struct console *co, const char *s, unsigned count) { - struct serial_state *ser; + static struct async_struct *info = &async_sercons; int ier; unsigned i; - ser = rs_table + co->index; /* * First save the IER then disable the interrupts */ - ier = inb(ser->port + UART_IER); - outb(0x00, ser->port + UART_IER); + ier = serial_in(info, UART_IER); + serial_out(info, UART_IER, 0x00); /* * Now, do each character */ for (i = 0; i < count; i++, s++) { - wait_for_xmitr(ser); + wait_for_xmitr(info); /* * Send the character out. * If a LF, also do CR... */ - outb(*s, ser->port + UART_TX); + serial_out(info, UART_TX, *s); if (*s == 10) { - wait_for_xmitr(ser); - outb(13, ser->port + UART_TX); + wait_for_xmitr(info); + serial_out(info, UART_TX, 13); } } @@ -4193,8 +4489,8 @@ * Finally, Wait for transmitter & holding register to empty * and restore the IER */ - wait_for_xmitr(ser); - outb(ier, ser->port + UART_IER); + wait_for_xmitr(info); + serial_out(info, UART_IER, ier); } /* @@ -4202,30 +4498,26 @@ */ static int serial_console_wait_key(struct console *co) { - struct serial_state *ser; - int ier; - int lsr; - int c; + static struct async_struct *info; + int ier, c; - ser = rs_table + co->index; + info = &async_sercons; /* * First save the IER then disable the interrupts so * that the real driver for the port does not get the * character. */ - ier = inb(ser->port + UART_IER); - outb(0x00, ser->port + UART_IER); - - do { - lsr = inb(ser->port + UART_LSR); - } while (!(lsr & UART_LSR_DR)); - c = inb(ser->port + UART_RX); + ier = serial_in(info, UART_IER); + serial_out(info, UART_IER, 0x00); + + while ((serial_in(info, UART_LSR) & UART_LSR_DR) == 0); + c = serial_in(info, UART_RX); /* * Restore the interrupts */ - outb(ier, ser->port + UART_IER); + serial_out(info, UART_IER, ier); return c; } @@ -4243,7 +4535,8 @@ */ static int __init serial_console_setup(struct console *co, char *options) { - struct serial_state *ser; + static struct async_struct *info; + struct serial_state *state; unsigned cval; int baud = 9600; int bits = 8; @@ -4251,6 +4544,9 @@ int cflag = CREAD | HUPCL | CLOCAL; int quot = 0; char *s; +#if defined(CONFIG_KDB) + extern int kdb_port; +#endif if (options) { baud = simple_strtoul(options, NULL, 10); @@ -4313,8 +4609,21 @@ /* * Divisor, bytesize and parity */ - ser = rs_table + co->index; - quot = ser->baud_base / baud; + state = rs_table + co->index; + info = &async_sercons; + info->magic = SERIAL_MAGIC; + info->state = state; + info->port = state->port; + info->flags = state->flags; +#ifdef CONFIG_HUB6 + info->hub6 = state->hub6; +#endif + info->io_type = state->io_type; +#ifdef CONFIG_SERIAL_PCI_MEMMAPPED + info->iomem_base = state->iomem_base; + info->iomem_reg_shift = state->iomem_reg_shift; +#endif + quot = state->baud_base / baud; cval = cflag & (CSIZE | CSTOPB); #if defined(__powerpc__) || defined(__alpha__) cval >>= 8; @@ -4330,18 +4639,27 @@ * Disable UART interrupts, set DTR and RTS high * and set speed. */ - outb(cval | UART_LCR_DLAB, ser->port + UART_LCR); /* set DLAB */ - outb(quot & 0xff, ser->port + UART_DLL); /* LS of divisor */ - outb(quot >> 8, ser->port + UART_DLM); /* MS of divisor */ - outb(cval, ser->port + UART_LCR); /* reset DLAB */ - outb(0, ser->port + UART_IER); - outb(UART_MCR_DTR | UART_MCR_RTS, ser->port + UART_MCR); + serial_out(info, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */ + serial_out(info, UART_DLL, quot & 0xff); /* LS of divisor */ + serial_out(info, UART_DLM, quot >> 8); /* MS of divisor */ + serial_out(info, UART_LCR, cval); /* reset DLAB */ + serial_out(info, UART_IER, 0); + serial_out(info, UART_MCR, UART_MCR_DTR | UART_MCR_RTS); /* * If we read 0xff from the LSR, there is no UART here. */ - if (inb(ser->port + UART_LSR) == 0xff) + if (serial_in(info, UART_LSR) == 0xff) return -1; + +#if defined(CONFIG_KDB) + /* + * Remember I/O port for kdb + */ + if (kdb_port == 0 ) + kdb_port = ser->port; +#endif /* CONFIG_KDB */ + return 0; } diff -u --recursive --new-file v2.3.28/linux/drivers/char/tuner.c linux/drivers/char/tuner.c --- v2.3.28/linux/drivers/char/tuner.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/tuner.c Thu Nov 18 19:25:28 1999 @@ -96,6 +96,12 @@ 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,0xc2,732}, {"Alps TSBE1",TEMIC,PAL, 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,0xc2,732}, + {"Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modtec MM205 */ + 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,0xc0,632}, + {"Alps TSBE5", Alps, PAL,/* untested - data sheet guess. Only IF differs. */ + 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,0xc0,622}, + {"Alps TSBC5", Alps, PAL,/* untested - data sheet guess. Only IF differs. */ + 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,0xc0,608}, }; /* ---------------------------------------------------------------------- */ diff -u --recursive --new-file v2.3.28/linux/drivers/char/tuner.h linux/drivers/char/tuner.h --- v2.3.28/linux/drivers/char/tuner.h Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/tuner.h Thu Nov 18 19:25:28 1999 @@ -31,7 +31,11 @@ #define TUNER_TEMIC_NTSC 6 #define TUNER_TEMIC_PAL_I 7 #define TUNER_TEMIC_4036FY5_NTSC 8 -#define TUNER_ALPS_TSBH1_NTSC 9 +#define TUNER_ALPS_TSBH1_NTSC 9 +#define TUNER_ALPS_TSBE1_PAL 10 +#define TUNER_ALPS_TSBB5_PAL_I 11 +#define TUNER_ALPS_TSBE5_PAL 12 +#define TUNER_ALPS_TSBC5_PAL 13 #define NOTUNER 0 #define PAL 1 @@ -43,6 +47,7 @@ #define Philips 1 #define TEMIC 2 #define Sony 3 +#define Alps 4 #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ diff -u --recursive --new-file v2.3.28/linux/drivers/i2o/i2o_block.c linux/drivers/i2o/i2o_block.c --- v2.3.28/linux/drivers/i2o/i2o_block.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/i2o/i2o_block.c Tue Nov 23 10:36:14 1999 @@ -316,7 +316,7 @@ } else { - if(m[2]&0x80000000) + if(m[2]&0x40000000) { int * ptr = (int *)m[3]; if(m[4]>>24) @@ -700,7 +700,7 @@ int *query_done = &dev->done_flag; msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1] = I2O_CMD_BLOCK_CFLUSH<<24|HOST_TID<<12|dev->tid; - msg[2] = i2ob_context|0x80000000; + msg[2] = i2ob_context|0x40000000; msg[3] = (u32)query_done; msg[4] = 60<<16; i2o_post_wait(dev->controller, msg, 20, 2); @@ -709,7 +709,7 @@ */ msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1] = I2O_CMD_BLOCK_MUNLOCK<<24|HOST_TID<<12|dev->tid; - msg[2] = i2ob_context|0x80000000; + msg[2] = i2ob_context|0x40000000; msg[3] = (u32)query_done; msg[4] = -1; i2o_post_wait(dev->controller, msg, 20, 2); @@ -762,7 +762,7 @@ */ msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1] = I2O_CMD_BLOCK_MMOUNT<<24|HOST_TID<<12|dev->tid; - msg[2] = i2ob_context|0x80000000; + msg[2] = i2ob_context|0x40000000; msg[3] = (u32)query_done; msg[4] = -1; msg[5] = 0; @@ -772,7 +772,7 @@ */ msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1] = I2O_CMD_BLOCK_MLOCK<<24|HOST_TID<<12|dev->tid; - msg[2] = i2ob_context|0x80000000; + msg[2] = i2ob_context|0x40000000; msg[3] = (u32)query_done; msg[4] = -1; i2o_post_wait(dev->controller, msg, 20, 2); @@ -982,7 +982,7 @@ int *query_done = &dev->done_flag; msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1] = I2O_CMD_BLOCK_CFLUSH<<24|HOST_TID<<12|dev->tid; - msg[2] = i2ob_context|0x80000000; + msg[2] = i2ob_context|0x40000000; msg[3] = (u32)query_done; msg[4] = 60<<16; i2o_post_wait(dev->controller, msg, 20, 2); @@ -991,7 +991,7 @@ */ msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1] = I2O_CMD_BLOCK_MUNLOCK<<24|HOST_TID<<12|dev->tid; - msg[2] = i2ob_context|0x80000000; + msg[2] = i2ob_context|0x40000000; msg[3] = (u32)query_done; msg[4] = -1; i2o_post_wait(dev->controller, msg, 20, 2); diff -u --recursive --new-file v2.3.28/linux/drivers/i2o/i2o_core.c linux/drivers/i2o/i2o_core.c --- v2.3.28/linux/drivers/i2o/i2o_core.c Thu Nov 11 20:11:35 1999 +++ linux/drivers/i2o/i2o_core.c Tue Nov 23 10:36:14 1999 @@ -42,7 +42,7 @@ #include "i2o_lan.h" -#define DRIVERDEBUG +// #define DRIVERDEBUG // #define DEBUG_IRQ /* @@ -175,7 +175,9 @@ { if (msg[4] >> 24) { - i2o_report_status(KERN_WARNING, "i2o_core: post_wait reply", msg); + /* 0x40000000 is used as an error report supress bit */ + if((msg[2]&0x40000000)==0) + i2o_report_status(KERN_WARNING, "i2o_core: post_wait reply", msg); status = -(msg[4] & 0xFFFF); } else @@ -308,8 +310,8 @@ c->hrt = NULL; c->lct = NULL; c->status_block = NULL; - printk(KERN_INFO "lct @ %p hrt @ %p status @ %p", - c->lct, c->hrt, c->status_block); +// printk(KERN_INFO "lct @ %p hrt @ %p status @ %p", +// c->lct, c->hrt, c->status_block); sprintf(c->name, "i2o/iop%d", i); i2o_num_controllers++; spin_unlock(&i2o_configuration_lock); @@ -363,8 +365,8 @@ *p=c->next; spin_unlock(&i2o_configuration_lock); - printk(KERN_INFO "hrt %p lct %p page_frame %p status_block %p\n", - c->hrt, c->lct, c->page_frame, c->status_block); +// printk(KERN_INFO "hrt %p lct %p page_frame %p status_block %p\n", +// c->hrt, c->lct, c->page_frame, c->status_block); if(c->page_frame) kfree(c->page_frame); if(c->hrt) @@ -790,30 +792,29 @@ void i2o_report_controller_unit(struct i2o_controller *c, int unit) { char buf[64]; - return; - if(i2o_query_scalar(c, unit, 0xF100, 3, buf, 16)) + if(i2o_query_scalar(c, unit, 0xF100, 3, buf, 16)>=0) { buf[16]=0; - printk(KERN_INFO " Vendor: %s\n", buf); + printk(KERN_INFO " Vendor: %s", buf); } - if(i2o_query_scalar(c, unit, 0xF100, 4, buf, 16)) + if(i2o_query_scalar(c, unit, 0xF100, 4, buf, 16)>=0) { buf[16]=0; - printk(KERN_INFO " Device: %s\n", buf); + printk(" Device: %s", buf); } #if 0 - if(i2o_query_scalar(c, unit, 0xF100, 5, buf, 16)) + if(i2o_query_scalar(c, unit, 0xF100, 5, buf, 16)>=0) { buf[16]=0; printk(KERN_INFO "Description: %s\n", buf); } #endif - if(i2o_query_scalar(c, unit, 0xF100, 6, buf, 8)) + if(i2o_query_scalar(c, unit, 0xF100, 6, buf, 8)>=0) { buf[8]=0; - printk(KERN_INFO " Rev: %s\n", buf); + printk(" Rev: %s\n", buf); } } @@ -969,18 +970,18 @@ d->flags = 0; tid = d->lct_data->tid; - printk(KERN_INFO "TID %d.\n", tid); + printk(KERN_INFO "Task ID %d.\n", tid); i2o_report_controller_unit(c, tid); i2o_install_device(c, d); - printk(KERN_INFO " Class: "); + printk(KERN_INFO " Class: "); sprintf(str, "%-21s", i2o_get_class_name(d->lct_data->class_id)); printk("%s", str); - printk(" Subclass: 0x%03X Flags: ", + printk(" Subclass: 0x%04X Flags: ", d->lct_data->sub_class); if(d->lct_data->device_flags&(1<<0)) @@ -1254,52 +1255,46 @@ status_block = (u8*)c->status_block; - for(i=0;i<5;i++) - { - m=i2o_wait_message(c, "StatusGet"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - - memset(status_block, 0, sizeof(i2o_status_block)); + m=i2o_wait_message(c, "StatusGet"); + if(m==0xFFFFFFFF) + return -ETIMEDOUT; - msg=(u32 *)(c->mem_offset+m); + memset(status_block, 0, sizeof(i2o_status_block)); + msg=(u32 *)(c->mem_offset+m); __raw_writel(NINE_WORD_MSG_SIZE|SGL_OFFSET_0, &msg[0]); - __raw_writel(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID, &msg[1]); - __raw_writel(0, &msg[2]); - __raw_writel(0, &msg[3]); - __raw_writel(0, &msg[4]); - __raw_writel(0, &msg[5]); - __raw_writel(virt_to_bus(c->status_block), &msg[6]); - __raw_writel(0, &msg[7]); /* 64bit host FIXME */ - __raw_writel(sizeof(i2o_status_block), &msg[8]); - - printk("SB is %d bytes.\n", sizeof(i2o_status_block)); - - i2o_post_message(c,m); - - /* DPT work around */ - mdelay(5); + __raw_writel(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID, &msg[1]); + __raw_writel(0, &msg[2]); + __raw_writel(0, &msg[3]); + __raw_writel(0, &msg[4]); + __raw_writel(0, &msg[5]); + __raw_writel(virt_to_bus(c->status_block), &msg[6]); + __raw_writel(0, &msg[7]); /* 64bit host FIXME */ + __raw_writel(sizeof(i2o_status_block), &msg[8]); + + i2o_post_message(c,m); + + /* DPT work around */ + mdelay(5); - /* Wait for a reply */ - time=jiffies; + /* Wait for a reply */ + time=jiffies; - while((jiffies-time)<=HZ) + while((jiffies-time)<=HZ) + { + if(status_block[87]!=0) { - if(status_block[87]!=0) - { - /* Ok the reply has arrived. Fill in the important stuff */ - c->inbound_size = (status_block[12]|(status_block[13]<<8))*4; - return 0; - } - schedule(); - barrier(); + /* Ok the reply has arrived. Fill in the important stuff */ + c->inbound_size = (status_block[12]|(status_block[13]<<8))*4; + return 0; } + schedule(); + barrier(); + } #ifdef DRIVERDEBUG - printk(KERN_ERR "IOP get status timeout.\n"); + printk(KERN_ERR "IOP get status timeout.\n"); #endif - } - return 0;//-ETIMEDOUT; + return -ETIMEDOUT; } @@ -1687,7 +1682,7 @@ memset(workspace, 0, 88); - printk(KERN_INFO "i2o/iop%d: Initializing Outbound Queue\n", c->unit); +// printk(KERN_INFO "i2o/iop%d: Initializing Outbound Queue\n", c->unit); m=i2o_wait_message(c, "OutboundInit"); if(m==0xFFFFFFFF) { @@ -2146,7 +2141,7 @@ size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, iop, tid, opblk, sizeof(opblk), resblk, sizeof(resblk)); - + if (size < 0) return size; diff -u --recursive --new-file v2.3.28/linux/drivers/i2o/i2o_scsi.c linux/drivers/i2o/i2o_scsi.c --- v2.3.28/linux/drivers/i2o/i2o_scsi.c Thu Nov 11 20:11:35 1999 +++ linux/drivers/i2o/i2o_scsi.c Tue Nov 23 10:36:14 1999 @@ -297,12 +297,12 @@ { u8 reply[8]; - if(i2o_query_scalar(c, d->lct_data->tid, 0, 3, reply, 4)) + if(i2o_query_scalar(c, d->lct_data->tid, 0, 3, reply, 4)<0) return -1; *target=reply[0]; - if(i2o_query_scalar(c, d->lct_data->tid, 0, 4, reply, 8)) + if(i2o_query_scalar(c, d->lct_data->tid, 0, 4, reply, 8)<0) return -1; *lun=reply[1]; @@ -328,7 +328,7 @@ for(unit=c->devices;unit!=NULL;unit=unit->next) { dprintk(("Class %03X, parent %d, want %d.\n", - unit->lct_data->class_id, unit->lct_data->parent, d->lct_data->tid)); + unit->lct_data->class_id, unit->lct_data->parent_tid, d->lct_data->tid)); /* Only look at scsi and fc devices */ if ( (unit->lct_data->class_id != I2O_CLASS_SCSI_PERIPHERAL) @@ -337,7 +337,7 @@ continue; /* On our bus ? */ - dprintk(("Found a disk.\n")); + dprintk(("Found a disk (%d).\n", unit->lct_data->tid)); if ((unit->lct_data->parent_tid == d->lct_data->tid) || (unit->lct_data->parent_tid == d->lct_data->parent_tid) ) @@ -346,7 +346,7 @@ dprintk(("Its ours.\n")); if(i2o_find_lun(c, unit, &target, &lun)==-1) { - printk(KERN_ERR "i2o_scsi: Unable to get lun for tid %d.\n", d->lct_data->tid); + printk(KERN_ERR "i2o_scsi: Unable to get lun for tid %d.\n", unit->lct_data->tid); continue; } dprintk(("Found disk %d %d.\n", target, lun)); @@ -429,7 +429,7 @@ * bus_adapter, SCSI (obsolete), or FibreChannel busses only */ if( (d->lct_data->class_id!=I2O_CLASS_BUS_ADAPTER_PORT) // bus_adapter - && (d->lct_data->class_id!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT +// && (d->lct_data->class_id!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT ) continue; diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/Config.in linux/drivers/isdn/Config.in --- v2.3.28/linux/drivers/isdn/Config.in Thu Nov 11 20:11:35 1999 +++ linux/drivers/isdn/Config.in Thu Nov 18 21:03:01 1999 @@ -13,8 +13,8 @@ bool ' Support AT-Fax Class 2 commands' CONFIG_ISDN_TTY_FAX fi bool ' Support isdn diversion services' CONFIG_ISDN_DIVERSION -if [ "$CONFIG_X25" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' X.25 PLP on top of ISDN (EXPERIMENTAL)' CONFIG_ISDN_X25 +if [ "$CONFIG_X25" != "n" ]; then + bool ' X.25 PLP on top of ISDN' CONFIG_ISDN_X25 fi dep_tristate ' ICN 2B and 4B support' CONFIG_ISDN_DRV_ICN $CONFIG_ISDN dep_tristate ' isdnloop support' CONFIG_ISDN_DRV_LOOP $CONFIG_ISDN @@ -52,15 +52,15 @@ bool ' HiSax Support for Scitel Quadro card' CONFIG_HISAX_SCT_QUADRO bool ' HiSax Support for Gazel cards' CONFIG_HISAX_GAZEL bool ' HiSax Support for HFC PCI-Bus cards' CONFIG_HISAX_HFC_PCI - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' HiSax Support for Winbond W6692 based cards (EXPERIMENTAL)' CONFIG_HISAX_W6692 + bool ' HiSax Support for Winbond W6692 based cards' CONFIG_HISAX_W6692 + if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then # bool ' HiSax Support for TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then bool ' HiSax Support for Am7930' CONFIG_HISAX_AMD7930 fi fi fi -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then +if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then dep_tristate ' Spellcaster support (EXPERIMENTAL)' CONFIG_ISDN_DRV_SC $CONFIG_ISDN dep_tristate ' IBM Active 2000 support (EXPERIMENTAL)' CONFIG_ISDN_DRV_ACT2000 $CONFIG_ISDN fi diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/avmb1/capi.c linux/drivers/isdn/avmb1/capi.c --- v2.3.28/linux/drivers/isdn/avmb1/capi.c Thu Nov 11 20:11:36 1999 +++ linux/drivers/isdn/avmb1/capi.c Thu Nov 18 21:03:01 1999 @@ -1,11 +1,14 @@ /* - * $Id: capi.c,v 1.21 1999/09/10 17:24:18 calle Exp $ + * $Id: capi.c,v 1.22 1999/11/13 21:27:16 keil Exp $ * * CAPI 2.0 Interface for Linux * * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: capi.c,v $ + * Revision 1.22 1999/11/13 21:27:16 keil + * remove KERNELVERSION + * * Revision 1.21 1999/09/10 17:24:18 calle * Changes for proposed standard for CAPI2.0: * - AK148 "Linux Exention" @@ -282,20 +285,13 @@ capi_poll(struct file *file, poll_table * wait) { unsigned int mask = 0; -#if (LINUX_VERSION_CODE >= 0x02012d) unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); -#else - unsigned int minor = MINOR(file->f_inode->i_rdev); -#endif struct capidev *cdev; if (!minor || minor > CAPI_MAXMINOR || !capidevs[minor].is_registered) return POLLERR; cdev = &capidevs[minor]; -#if (LINUX_VERSION_CODE < 0x020159) /* 2.1.89 */ -#define poll_wait(f,wq,w) poll_wait((wq),(w)) -#endif poll_wait(file, &(cdev->recv_wait), wait); mask = POLLOUT | POLLWRNORM; if (!skb_queue_empty(&cdev->recv_queue)) @@ -523,9 +519,7 @@ capi_ioctl, NULL, /* capi_mmap */ capi_open, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,118) NULL, /* capi_flush */ -#endif capi_release, NULL, /* capi_fsync */ NULL, /* capi_fasync */ diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/avmb1/compat.h linux/drivers/isdn/avmb1/compat.h --- v2.3.28/linux/drivers/isdn/avmb1/compat.h Sun May 23 10:03:41 1999 +++ linux/drivers/isdn/avmb1/compat.h Wed Dec 31 16:00:00 1969 @@ -1,45 +0,0 @@ -/* - * $Id: compat.h,v 1.4 1998/10/25 14:39:02 fritz Exp $ - * - * Headerfile for Compartibility between different kernel versions - * - * (c) Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) - * - * $Log: compat.h,v $ - * Revision 1.4 1998/10/25 14:39:02 fritz - * Backported from MIPS (Cobalt). - * - * Revision 1.3 1997/11/04 06:12:15 calle - * capi.c: new read/write in file_ops since 2.1.60 - * capidrv.c: prepared isdnlog interface for d2-trace in newer firmware. - * capiutil.c: needs config.h (CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON) - * compat.h: added #define LinuxVersionCode - * - * Revision 1.2 1997/10/01 09:21:22 fritz - * Removed old compatibility stuff for 2.0.X kernels. - * From now on, this code is for 2.1.X ONLY! - * Old stuff is still in the separate branch. - * - * Revision 1.1 1997/03/04 21:50:36 calle - * Frirst version in isdn4linux - * - * Revision 2.2 1997/02/12 09:31:39 calle - * new version - * - * Revision 1.1 1997/01/31 10:32:20 calle - * Initial revision - * - * - */ -#ifndef __COMPAT_H__ -#define __COMPAT_H__ - -#include -#include -#include - -#ifndef LinuxVersionCode -#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s)) -#endif - -#endif /* __COMPAT_H__ */ diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/avmb1/t1pci.c linux/drivers/isdn/avmb1/t1pci.c --- v2.3.28/linux/drivers/isdn/avmb1/t1pci.c Thu Nov 11 20:11:36 1999 +++ linux/drivers/isdn/avmb1/t1pci.c Thu Nov 18 21:03:01 1999 @@ -1,11 +1,14 @@ /* - * $Id: t1pci.c,v 1.2 1999/11/05 16:38:02 calle Exp $ + * $Id: t1pci.c,v 1.3 1999/11/13 21:27:16 keil Exp $ * * Module for AVM T1 PCI-card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: t1pci.c,v $ + * Revision 1.3 1999/11/13 21:27:16 keil + * remove KERNELVERSION + * * Revision 1.2 1999/11/05 16:38:02 calle * Cleanups before kernel 2.4: * - Changed all messages to use card->name or driver->name instead of @@ -30,13 +33,12 @@ #include #include #include -#include "compat.h" #include "capicmd.h" #include "capiutil.h" #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.2 $"; +static char *revision = "$Revision: 1.3 $"; #undef CONFIG_T1PCI_DEBUG #undef CONFIG_T1PCI_POLLDEBUG diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/eicon/eicon_isa.h linux/drivers/isdn/eicon/eicon_isa.h --- v2.3.28/linux/drivers/isdn/eicon/eicon_isa.h Thu Nov 18 20:25:37 1999 +++ linux/drivers/isdn/eicon/eicon_isa.h Thu Nov 18 21:03:01 1999 @@ -1,4 +1,4 @@ -/* $Id: eicon_isa.h,v 1.5 1999/09/08 20:17:31 armin Exp $ +/* $Id: eicon_isa.h,v 1.6 1999/11/15 19:37:04 keil Exp $ * * ISDN low-level module for Eicon.Diehl active ISDN-Cards. * @@ -21,6 +21,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: eicon_isa.h,v $ + * Revision 1.6 1999/11/15 19:37:04 keil + * need config.h + * * Revision 1.5 1999/09/08 20:17:31 armin * Added microchannel patch from Erik Weber. * diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/eicon/eicon_mod.c linux/drivers/isdn/eicon/eicon_mod.c --- v2.3.28/linux/drivers/isdn/eicon/eicon_mod.c Thu Nov 11 20:11:37 1999 +++ linux/drivers/isdn/eicon/eicon_mod.c Thu Nov 18 21:03:01 1999 @@ -1,4 +1,4 @@ -/* $Id: eicon_mod.c,v 1.18 1999/10/11 18:13:25 armin Exp $ +/* $Id: eicon_mod.c,v 1.19 1999/11/12 13:21:44 armin Exp $ * * ISDN lowlevel-module for Eicon.Diehl active cards. * @@ -31,6 +31,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: eicon_mod.c,v $ + * Revision 1.19 1999/11/12 13:21:44 armin + * Bugfix of undefined reference with CONFIG_MCA + * * Revision 1.18 1999/10/11 18:13:25 armin * Added fax capabilities for Eicon Diva Server cards. * @@ -120,7 +123,7 @@ static eicon_card *cards = (eicon_card *) NULL; /* glob. var , contains start of card-list */ -static char *eicon_revision = "$Revision: 1.18 $"; +static char *eicon_revision = "$Revision: 1.19 $"; extern char *eicon_pci_revision; extern char *eicon_isa_revision; @@ -1382,7 +1385,7 @@ printk(KERN_INFO "eicon: No MCA bus, ISDN-interfaces not probed.\n"); } else { - eicon_log(card, 8, + eicon_log(NULL, 8, "eicon_mca_find_card, irq=%d.\n", irq); if (!eicon_mca_find_card(0, membase, irq, id)) @@ -1511,7 +1514,7 @@ { int j, curr_slot = 0; - eicon_log(card, 8, + eicon_log(NULL, 8, "eicon_mca_find_card type: %d, membase: %#x, irq %d \n", type, membase, irq); /* find a no-driver-assigned eicon card */ @@ -1578,7 +1581,7 @@ int irq_array1[]={3,4,0,0,2,10,11,12}; adf_pos0 = mca_read_stored_pos(slot,2); - eicon_log(card, 8, + eicon_log(NULL, 8, "eicon_mca_probe irq=%d, membase=%d\n", irq, membase); @@ -1636,7 +1639,7 @@ default: return ENODEV; }; - /* Uebereinstimmung vorgegebener membase & irq */ + /* matching membase & irq */ if ( 1 == eicon_addcard(type, membase, irq, id)) { mca_set_adapter_name(slot, eicon_mca_adapters[a_idx].name); mca_set_adapter_procfn(slot, (MCA_ProcFn) eicon_info, cards); @@ -1649,9 +1652,9 @@ /* reset card */ outb_p(0,cards_io+1); - eicon_log(card, 8, "eicon_addcard: successful for slot # %d.\n", + eicon_log(NULL, 8, "eicon_addcard: successful for slot # %d.\n", cards->mca_slot+1); - return 0 ; /* eicon_addcard hat eine Karte zugefuegt */ + return 0 ; /* eicon_addcard added a card */ } else { return ENODEV; }; diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/hisax/hisax.h linux/drivers/isdn/hisax/hisax.h --- v2.3.28/linux/drivers/isdn/hisax/hisax.h Thu Nov 11 20:11:38 1999 +++ linux/drivers/isdn/hisax/hisax.h Thu Nov 18 21:03:01 1999 @@ -1,8 +1,11 @@ -/* $Id: hisax.h,v 2.37 1999/10/14 20:25:28 keil Exp $ +/* $Id: hisax.h,v 2.38 1999/11/14 23:37:03 keil Exp $ * Basic declarations, defines and prototypes * * $Log: hisax.h,v $ + * Revision 2.38 1999/11/14 23:37:03 keil + * new ISA memory mapped IO + * * Revision 2.37 1999/10/14 20:25:28 keil * add a statistic for error monitoring * @@ -663,7 +666,8 @@ struct teles0_hw { unsigned int cfg_reg; - unsigned int membase; + unsigned long membase; + unsigned long phymem; }; struct avm_hw { @@ -803,8 +807,9 @@ struct isurf_hw { unsigned int reset; - unsigned int isac; - unsigned int isar; + unsigned long phymem; + unsigned long isac; + unsigned long isar; struct isar_reg isar_r; }; diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/hisax/isurf.c linux/drivers/isdn/hisax/isurf.c --- v2.3.28/linux/drivers/isdn/hisax/isurf.c Thu Nov 11 20:11:38 1999 +++ linux/drivers/isdn/hisax/isurf.c Thu Nov 18 21:03:01 1999 @@ -1,10 +1,13 @@ -/* $Id: isurf.c,v 1.6 1999/09/04 06:20:06 keil Exp $ +/* $Id: isurf.c,v 1.7 1999/11/14 23:37:03 keil Exp $ * isurf.c low level stuff for Siemens I-Surf/I-Talk cards * * Author Karsten Keil (keil@isdn4linux.de) * * $Log: isurf.c,v $ + * Revision 1.7 1999/11/14 23:37:03 keil + * new ISA memory mapped IO + * * Revision 1.6 1999/09/04 06:20:06 keil * Changes from kernel set_current_state() * @@ -37,7 +40,7 @@ extern const char *CardType[]; -static const char *ISurf_revision = "$Revision: 1.6 $"; +static const char *ISurf_revision = "$Revision: 1.7 $"; #define byteout(addr,val) outb(val,addr) #define bytein(addr) inb(addr) @@ -50,7 +53,7 @@ #define ISURF_ISAR_OFFSET 0 #define ISURF_ISAC_OFFSET 0x100 - +#define ISURF_IOMEM_SIZE 0x400 /* Interface functions */ static u_char @@ -145,6 +148,8 @@ release_io_isurf(struct IsdnCardState *cs) { release_region(cs->hw.isurf.reset, 1); + iounmap((unsigned char *)cs->hw.isurf.isar); + release_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE); } static void @@ -223,8 +228,7 @@ return(0); if (card->para[1] && card->para[2]) { cs->hw.isurf.reset = card->para[1]; - cs->hw.isurf.isar = card->para[2] + ISURF_ISAR_OFFSET; - cs->hw.isurf.isac = card->para[2] + ISURF_ISAC_OFFSET; + cs->hw.isurf.phymem = card->para[2]; cs->irq = card->para[0]; } else { printk(KERN_WARNING "HiSax: %s port/mem not set\n", @@ -240,11 +244,25 @@ } else { request_region(cs->hw.isurf.reset, 1, "isurf isdn"); } - + if (check_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE)) { + printk(KERN_WARNING + "HiSax: %s memory region %lx-%lx already in use\n", + CardType[card->typ], + cs->hw.isurf.phymem, + cs->hw.isurf.phymem + ISURF_IOMEM_SIZE); + release_region(cs->hw.isurf.reset, 1); + return (0); + } else { + request_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE, + "isurf iomem"); + } + cs->hw.isurf.isar = + (unsigned long) ioremap(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE); + cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET; printk(KERN_INFO - "ISurf: defined at 0x%x 0x%x IRQ %d\n", + "ISurf: defined at 0x%x 0x%lx IRQ %d\n", cs->hw.isurf.reset, - cs->hw.isurf.isar, + cs->hw.isurf.phymem, cs->irq); cs->cardmsg = &ISurf_card_msg; diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/hisax/sedlbauer.c linux/drivers/isdn/hisax/sedlbauer.c --- v2.3.28/linux/drivers/isdn/hisax/sedlbauer.c Thu Nov 11 20:11:38 1999 +++ linux/drivers/isdn/hisax/sedlbauer.c Thu Nov 18 21:03:01 1999 @@ -1,4 +1,4 @@ -/* $Id: sedlbauer.c,v 1.17 1999/09/04 06:20:06 keil Exp $ +/* $Id: sedlbauer.c,v 1.18 1999/11/13 21:25:03 keil Exp $ * sedlbauer.c low level stuff for Sedlbauer cards * includes support for the Sedlbauer speed star (speed star II), @@ -17,6 +17,9 @@ * Edgar Toernig * * $Log: sedlbauer.c,v $ + * Revision 1.18 1999/11/13 21:25:03 keil + * Support for Speedfax+ PCI + * * Revision 1.17 1999/09/04 06:20:06 keil * Changes from kernel set_current_state() * @@ -79,12 +82,13 @@ * --------------------------------------------------------------------- * Speed Card ISAC_HSCX DIP-SWITCH * Speed Win ISAC_HSCX ISAPNP - * Speed Fax+ ISAC_ISAR ISAPNP #HDLC works# + * Speed Fax+ ISAC_ISAR ISAPNP Full analog support * Speed Star ISAC_HSCX CARDMGR * Speed Win2 IPAC ISAPNP * ISDN PC/104 IPAC DIP-SWITCH * Speed Star2 IPAC CARDMGR - * Speed PCI IPAC PNP + * Speed PCI IPAC PCI PNP + * Speed Fax+ ISAC_ISAR PCI PNP Full analog support * * Important: * For the sedlbauer speed fax+ to work properly you have to download @@ -106,15 +110,18 @@ extern const char *CardType[]; -const char *Sedlbauer_revision = "$Revision: 1.17 $"; +const char *Sedlbauer_revision = "$Revision: 1.18 $"; const char *Sedlbauer_Types[] = {"None", "speed card/win", "speed star", "speed fax+", - "speed win II / ISDN PC/104", "speed star II", "speed pci"}; + "speed win II / ISDN PC/104", "speed star II", "speed pci", + "speed fax+ pci"}; #ifdef SEDLBAUER_PCI #define PCI_VENDOR_SEDLBAUER 0xe159 -#define PCI_SPEEDPCI_ID 0x02 +#define PCI_SPEEDPCI_ID 0x02 +#define PCI_SUBVENDOR_SEDLBAUER 0x51 +#define PCI_SUB_ID_SPEEDFAXP 0x01 #endif #define SEDL_SPEED_CARD_WIN 1 @@ -123,6 +130,7 @@ #define SEDL_SPEED_WIN2_PC104 4 #define SEDL_SPEED_STAR2 5 #define SEDL_SPEED_PCI 6 +#define SEDL_SPEEDFAX_PCI 7 #define SEDL_CHIP_TEST 0 #define SEDL_CHIP_ISAC_HSCX 1 @@ -153,12 +161,19 @@ #define SEDL_ISAR_ISA_ISAR_RESET_ON 10 #define SEDL_ISAR_ISA_ISAR_RESET_OFF 12 -#define SEDL_IPAC_ANY_ADR 0 -#define SEDL_IPAC_ANY_IPAC 2 +#define SEDL_IPAC_ANY_ADR 0 +#define SEDL_IPAC_ANY_IPAC 2 -#define SEDL_IPAC_PCI_BASE 0 -#define SEDL_IPAC_PCI_ADR 0xc0 -#define SEDL_IPAC_PCI_IPAC 0xc8 +#define SEDL_IPAC_PCI_BASE 0 +#define SEDL_IPAC_PCI_ADR 0xc0 +#define SEDL_IPAC_PCI_IPAC 0xc8 +#define SEDL_ISAR_PCI_ADR 0xc8 +#define SEDL_ISAR_PCI_ISAC 0xd0 +#define SEDL_ISAR_PCI_ISAR 0xe0 +#define SEDL_ISAR_PCI_ISAR_RESET_ON 0x01 +#define SEDL_ISAR_PCI_ISAR_RESET_OFF 0x18 +#define SEDL_ISAR_PCI_LED1 0x08 +#define SEDL_ISAR_PCI_LED2 0x10 #define SEDL_RESET 0x3 /* same as DOS driver */ @@ -235,24 +250,25 @@ static u_char ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset) { - return (readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset|0x80));} + return (readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset|0x80)); +} static void WriteISAC_IPAC(struct IsdnCardState *cs, u_char offset, u_char value) { - writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset|0x80, value); + writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset|0x80, value); } static void ReadISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) { - readfifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size); + readfifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size); } static void WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) { - writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size); + writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size); } static u_char @@ -485,6 +501,17 @@ writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_MASK, 0xc0); writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_PCFG, 0x12); restore_flags(flags); + } else if ((cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) && + (cs->hw.sedl.bus == SEDL_BUS_PCI)) { + byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on); + save_flags(flags); + sti(); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout((20*HZ)/1000); + byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout((20*HZ)/1000); + restore_flags(flags); } else { byteout(cs->hw.sedl.reset_on, SEDL_RESET); /* Reset On */ save_flags(flags); @@ -537,6 +564,24 @@ return(0); case CARD_TEST: return(0); + case MDL_INFO_CONN: + if (cs->subtyp != SEDL_SPEEDFAX_PCI) + return(0); + if ((long) arg) + cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED2; + else + cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED1; + byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off); + break; + case MDL_INFO_REL: + if (cs->subtyp != SEDL_SPEEDFAX_PCI) + return(0); + if ((long) arg) + cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED2; + else + cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED1; + byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off); + break; } return(0); } @@ -551,6 +596,8 @@ int bytecnt, ver, val; struct IsdnCardState *cs = card->cs; char tmp[64]; + u16 sub_vendor_id, sub_id; + long flags; strcpy(tmp, Sedlbauer_revision); printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp)); @@ -598,15 +645,40 @@ printk(KERN_WARNING "Sedlbauer: No PCI card found\n"); return(0); } - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= SA_SHIRQ; cs->hw.sedl.bus = SEDL_BUS_PCI; - cs->hw.sedl.chip = SEDL_CHIP_IPAC; - cs->subtyp = SEDL_SPEED_PCI; + pci_read_config_word(dev_sedl, PCI_SUBSYSTEM_VENDOR_ID, + &sub_vendor_id); + pci_read_config_word(dev_sedl, PCI_SUBSYSTEM_ID, + &sub_id); + printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n", + sub_vendor_id, sub_id); + printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n", + cs->hw.sedl.cfg_reg); + if ((sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER) && + (sub_id == PCI_SUB_ID_SPEEDFAXP)) { + cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR; + cs->subtyp = SEDL_SPEEDFAX_PCI; + cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + + SEDL_ISAR_PCI_ISAR_RESET_ON; + cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + + SEDL_ISAR_PCI_ISAR_RESET_OFF; + } else { + cs->hw.sedl.chip = SEDL_CHIP_IPAC; + cs->subtyp = SEDL_SPEED_PCI; + } bytecnt = 256; byteout(cs->hw.sedl.cfg_reg, 0xff); byteout(cs->hw.sedl.cfg_reg, 0x00); byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd); byteout(cs->hw.sedl.cfg_reg+ 5, 0x02); + byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on); + save_flags(flags); + sti(); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout((10*HZ)/1000); + byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off); + restore_flags(flags); #else printk(KERN_WARNING "Sedlbauer: NO_PCI_BIOS\n"); return (0); @@ -688,7 +760,7 @@ cs->writeisacfifo = &WriteISACfifo_IPAC; cs->irq_func = &sedlbauer_interrupt_ipac; - val = readreg(cs->hw.sedl.adr,cs->hw.sedl.isac, IPAC_ID); + val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ID); printk(KERN_INFO "Sedlbauer: IPAC version %x\n", val); reset_sedlbauer(cs); } else { @@ -698,18 +770,31 @@ cs->readisacfifo = &ReadISACfifo; cs->writeisacfifo = &WriteISACfifo; if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) { - cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_ISAR_ISA_ADR; - cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_ISAR_ISA_ISAC; - cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_ISAR_ISA_ISAR; - cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_ISAR_ISA_ISAR_RESET_ON; - cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_ISAR_ISA_ISAR_RESET_OFF; + if (cs->hw.sedl.bus == SEDL_BUS_PCI) { + cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + + SEDL_ISAR_PCI_ADR; + cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + + SEDL_ISAR_PCI_ISAC; + cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + + SEDL_ISAR_PCI_ISAR; + } else { + cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + + SEDL_ISAR_ISA_ADR; + cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + + SEDL_ISAR_ISA_ISAC; + cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + + SEDL_ISAR_ISA_ISAR; + cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + + SEDL_ISAR_ISA_ISAR_RESET_ON; + cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + + SEDL_ISAR_ISA_ISAR_RESET_OFF; + } cs->bcs[0].hw.isar.reg = &cs->hw.sedl.isar; cs->bcs[1].hw.isar.reg = &cs->hw.sedl.isar; test_and_set_bit(HW_ISAR, &cs->HW_Flags); cs->irq_func = &sedlbauer_interrupt_isar; cs->auxcmd = &isar_auxcmd; ISACVersion(cs, "Sedlbauer:"); - cs->BC_Read_Reg = &ReadISAR; cs->BC_Write_Reg = &WriteISAR; cs->BC_Send_Data = &isar_fill_fifo; diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/hisax/teles0.c linux/drivers/isdn/hisax/teles0.c --- v2.3.28/linux/drivers/isdn/hisax/teles0.c Thu Nov 11 20:11:38 1999 +++ linux/drivers/isdn/hisax/teles0.c Thu Nov 18 21:03:01 1999 @@ -1,4 +1,4 @@ -/* $Id: teles0.c,v 2.9 1999/07/12 21:05:31 keil Exp $ +/* $Id: teles0.c,v 2.10 1999/11/14 23:37:03 keil Exp $ * teles0.c low level stuff for Teles Memory IO isdn cards * based on the teles driver from Jan den Ouden @@ -10,6 +10,9 @@ * Beat Doebeli * * $Log: teles0.c,v $ + * Revision 2.10 1999/11/14 23:37:03 keil + * new ISA memory mapped IO + * * Revision 2.9 1999/07/12 21:05:31 keil * fix race in IRQ handling * added watchdog for lost IRQs @@ -58,71 +61,72 @@ extern const char *CardType[]; -const char *teles0_revision = "$Revision: 2.9 $"; +const char *teles0_revision = "$Revision: 2.10 $"; +#define TELES_IOMEM_SIZE 0x400 #define byteout(addr,val) outb(val,addr) #define bytein(addr) inb(addr) static inline u_char -readisac(unsigned int adr, u_char off) +readisac(unsigned long adr, u_char off) { return readb(adr + ((off & 1) ? 0x2ff : 0x100) + off); } static inline void -writeisac(unsigned int adr, u_char off, u_char data) +writeisac(unsigned long adr, u_char off, u_char data) { writeb(data, adr + ((off & 1) ? 0x2ff : 0x100) + off); mb(); } static inline u_char -readhscx(unsigned int adr, int hscx, u_char off) +readhscx(unsigned long adr, int hscx, u_char off) { return readb(adr + (hscx ? 0x1c0 : 0x180) + ((off & 1) ? 0x1ff : 0) + off); } static inline void -writehscx(unsigned int adr, int hscx, u_char off, u_char data) +writehscx(unsigned long adr, int hscx, u_char off, u_char data) { writeb(data, adr + (hscx ? 0x1c0 : 0x180) + ((off & 1) ? 0x1ff : 0) + off); mb(); } static inline void -read_fifo_isac(unsigned int adr, u_char * data, int size) +read_fifo_isac(unsigned long adr, u_char * data, int size) { register int i; - register u_char *ad = (u_char *) ((long)adr + 0x100); + register u_char *ad = (u_char *)adr + 0x100; for (i = 0; i < size; i++) data[i] = readb(ad); } static inline void -write_fifo_isac(unsigned int adr, u_char * data, int size) +write_fifo_isac(unsigned long adr, u_char * data, int size) { register int i; - register u_char *ad = (u_char *) ((long)adr + 0x100); + register u_char *ad = (u_char *)adr + 0x100; for (i = 0; i < size; i++) { writeb(data[i], ad); mb(); } } static inline void -read_fifo_hscx(unsigned int adr, int hscx, u_char * data, int size) +read_fifo_hscx(unsigned long adr, int hscx, u_char * data, int size) { register int i; - register u_char *ad = (u_char *) ((long)adr + (hscx ? 0x1c0 : 0x180)); + register u_char *ad = (u_char *) (adr + (hscx ? 0x1c0 : 0x180)); for (i = 0; i < size; i++) data[i] = readb(ad); } static inline void -write_fifo_hscx(unsigned int adr, int hscx, u_char * data, int size) +write_fifo_hscx(unsigned long adr, int hscx, u_char * data, int size) { int i; - register u_char *ad = (u_char *) ((long)adr + (hscx ? 0x1c0 : 0x180)); + register u_char *ad = (u_char *) (adr + (hscx ? 0x1c0 : 0x180)); for (i = 0; i < size; i++) { writeb(data[i], ad); mb(); } @@ -222,6 +226,8 @@ { if (cs->hw.teles0.cfg_reg) release_region(cs->hw.teles0.cfg_reg, 8); + iounmap((unsigned char *)cs->hw.teles0.membase); + release_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE); } static int @@ -262,7 +268,7 @@ default: return(1); } - cfval |= ((cs->hw.teles0.membase >> 9) & 0xF0); + cfval |= ((cs->hw.teles0.phymem >> 9) & 0xF0); byteout(cs->hw.teles0.cfg_reg + 4, cfval); HZDELAY(HZ / 10 + 1); byteout(cs->hw.teles0.cfg_reg + 4, cfval | 1); @@ -318,10 +324,9 @@ "Teles0: membase configured DOSish, assuming 0x%lx\n", (unsigned long) card->para[1]); } - cs->hw.teles0.membase = card->para[1]; cs->irq = card->para[0]; if (cs->hw.teles0.cfg_reg) { - if (check_region((cs->hw.teles0.cfg_reg), 8)) { + if (check_region(cs->hw.teles0.cfg_reg, 8)) { printk(KERN_WARNING "HiSax: %s config port %x-%x already in use\n", CardType[card->typ], @@ -358,8 +363,24 @@ } /* 16.0 and 8.0 designed for IOM1 */ test_and_set_bit(HW_IOM1, &cs->HW_Flags); + cs->hw.teles0.phymem = card->para[1]; + if (check_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE)) { + printk(KERN_WARNING + "HiSax: %s memory region %lx-%lx already in use\n", + CardType[card->typ], + cs->hw.teles0.phymem, + cs->hw.teles0.phymem + TELES_IOMEM_SIZE); + if (cs->hw.teles0.cfg_reg) + release_region(cs->hw.teles0.cfg_reg, 8); + return (0); + } else { + request_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE, + "teles iomem"); + } + cs->hw.teles0.membase = + (unsigned long) ioremap(cs->hw.teles0.phymem, TELES_IOMEM_SIZE); printk(KERN_INFO - "HiSax: %s config irq:%d mem:0x%X cfg:0x%X\n", + "HiSax: %s config irq:%d mem:0x%lX cfg:0x%X\n", CardType[cs->typ], cs->irq, cs->hw.teles0.membase, cs->hw.teles0.cfg_reg); if (reset_teles0(cs)) { diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/hisax/telespci.c linux/drivers/isdn/hisax/telespci.c --- v2.3.28/linux/drivers/isdn/hisax/telespci.c Thu Nov 11 20:11:38 1999 +++ linux/drivers/isdn/hisax/telespci.c Thu Nov 18 21:03:01 1999 @@ -1,4 +1,4 @@ -/* $Id: telespci.c,v 2.9 1999/08/11 21:01:34 keil Exp $ +/* $Id: telespci.c,v 2.10 1999/11/15 14:20:05 keil Exp $ * telespci.c low level stuff for Teles PCI isdn cards * @@ -7,6 +7,9 @@ * * * $Log: telespci.c,v $ + * Revision 2.10 1999/11/15 14:20:05 keil + * 64Bit compatibility + * * Revision 2.9 1999/08/11 21:01:34 keil * new PCI codefix * @@ -44,7 +47,7 @@ #include extern const char *CardType[]; -const char *telespci_revision = "$Revision: 2.9 $"; +const char *telespci_revision = "$Revision: 2.10 $"; #define ZORAN_PO_RQ_PEN 0x02000000 #define ZORAN_PO_WR 0x00800000 @@ -66,7 +69,7 @@ } while (portdata & ZORAN_PO_RQ_PEN) static inline u_char -readisac(unsigned int adr, u_char off) +readisac(unsigned long adr, u_char off) { register unsigned int portdata; @@ -83,7 +86,7 @@ } static inline void -writeisac(unsigned int adr, u_char off, u_char data) +writeisac(unsigned long adr, u_char off, u_char data) { register unsigned int portdata; @@ -99,7 +102,7 @@ } static inline u_char -readhscx(unsigned int adr, int hscx, u_char off) +readhscx(unsigned long adr, int hscx, u_char off) { register unsigned int portdata; @@ -115,7 +118,7 @@ } static inline void -writehscx(unsigned int adr, int hscx, u_char off, u_char data) +writehscx(unsigned long adr, int hscx, u_char off, u_char data) { register unsigned int portdata; @@ -130,7 +133,7 @@ } static inline void -read_fifo_isac(unsigned int adr, u_char * data, int size) +read_fifo_isac(unsigned long adr, u_char * data, int size) { register unsigned int portdata; register int i; @@ -148,7 +151,7 @@ } static void -write_fifo_isac(unsigned int adr, u_char * data, int size) +write_fifo_isac(unsigned long adr, u_char * data, int size) { register unsigned int portdata; register int i; @@ -165,7 +168,7 @@ } static inline void -read_fifo_hscx(unsigned int adr, int hscx, u_char * data, int size) +read_fifo_hscx(unsigned long adr, int hscx, u_char * data, int size) { register unsigned int portdata; register int i; @@ -183,7 +186,7 @@ } static inline void -write_fifo_hscx(unsigned int adr, int hscx, u_char * data, int size) +write_fifo_hscx(unsigned long adr, int hscx, u_char * data, int size) { unsigned int portdata; register int i; @@ -324,7 +327,7 @@ printk(KERN_WARNING "Teles: No IRQ for PCI card found\n"); return(0); } - cs->hw.teles0.membase = (u_int) ioremap(dev_tel->resource[ 0].start, + cs->hw.teles0.membase = (u_long) ioremap(dev_tel->resource[ 0].start, PAGE_SIZE); printk(KERN_INFO "Found: Zoran, base-address: 0x%lx, irq: 0x%x\n", dev_tel->resource[ 0].start, dev_tel->irq); @@ -348,7 +351,7 @@ /* writel(0x00800000, cs->hw.teles0.membase + 0x200); */ printk(KERN_INFO - "HiSax: %s config irq:%d mem:%x\n", + "HiSax: %s config irq:%d mem:%lx\n", CardType[cs->typ], cs->irq, cs->hw.teles0.membase); diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/pcbit/drv.c linux/drivers/isdn/pcbit/drv.c --- v2.3.28/linux/drivers/isdn/pcbit/drv.c Thu Nov 11 20:11:39 1999 +++ linux/drivers/isdn/pcbit/drv.c Thu Nov 18 21:03:01 1999 @@ -37,6 +37,7 @@ #include #include #include +#include #include "pcbit.h" #include "edss1.h" @@ -88,9 +89,21 @@ memset(dev, 0, sizeof(struct pcbit_dev)); init_waitqueue_head(&dev->set_running_wq); - if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) - dev->sh_mem = (unsigned char*) mem_base; - else + if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) { + dev->ph_mem = mem_base; + if (check_mem_region(dev->ph_mem, 4096)) { + printk(KERN_WARNING + "PCBIT: memory region %lx-%lx already in use\n", + dev->ph_mem, dev->ph_mem + 4096); + kfree(dev); + dev_pcbit[board] = NULL; + return -EACCES; + } else { + request_mem_region(dev->ph_mem, 4096, "PCBIT mem"); + } + dev->sh_mem = (unsigned char*)ioremap(dev->ph_mem, 4096); + } + else { printk("memory address invalid"); kfree(dev); @@ -102,6 +115,8 @@ if (!dev->b1) { printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); kfree(dev); + iounmap((unsigned char*)dev->sh_mem); + release_mem_region(dev->ph_mem, 4096); return -ENOMEM; } @@ -110,6 +125,8 @@ printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); kfree(dev->b1); kfree(dev); + iounmap((unsigned char*)dev->sh_mem); + release_mem_region(dev->ph_mem, 4096); return -ENOMEM; } @@ -132,6 +149,8 @@ kfree(dev->b1); kfree(dev->b2); kfree(dev); + iounmap((unsigned char*)dev->sh_mem); + release_mem_region(dev->ph_mem, 4096); dev_pcbit[board] = NULL; return -EIO; } @@ -152,6 +171,8 @@ kfree(dev->b1); kfree(dev->b2); kfree(dev); + iounmap((unsigned char*)dev->sh_mem); + release_mem_region(dev->ph_mem, 4096); dev_pcbit[board] = NULL; return -EIO; } @@ -181,6 +202,8 @@ kfree(dev->b1); kfree(dev->b2); kfree(dev); + iounmap((unsigned char*)dev->sh_mem); + release_mem_region(dev->ph_mem, 4096); dev_pcbit[board] = NULL; return -EIO; } @@ -217,6 +240,8 @@ kfree(dev->b1); kfree(dev->b2); kfree(dev); + iounmap((unsigned char*)dev->sh_mem); + release_mem_region(dev->ph_mem, 4096); } } #endif diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/pcbit/pcbit.h linux/drivers/isdn/pcbit/pcbit.h --- v2.3.28/linux/drivers/isdn/pcbit/pcbit.h Thu Nov 11 20:11:39 1999 +++ linux/drivers/isdn/pcbit/pcbit.h Thu Nov 18 21:03:01 1999 @@ -46,6 +46,7 @@ /* board */ volatile unsigned char* sh_mem; /* RDP address */ + unsigned long ph_mem; unsigned int irq; unsigned int id; unsigned int interrupt; /* set during interrupt @@ -166,10 +167,3 @@ #define L2_ERROR 6 #endif - - - - - - - diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/sc/debug.h linux/drivers/isdn/sc/debug.h --- v2.3.28/linux/drivers/isdn/sc/debug.h Thu Feb 27 10:57:30 1997 +++ linux/drivers/isdn/sc/debug.h Tue Nov 23 10:29:15 1999 @@ -26,10 +26,5 @@ * +1 (416) 297-6433 Facsimile */ -#if LINUX_VERSION_CODE < 131072 - #error You cant use this driver on kernels older than 2.0 -#else - #define REQUEST_IRQ(a,b,c,d,e) request_irq(a,b,c,d,e) - #define FREE_IRQ(a,b) free_irq(a,b) -#endif - +#define REQUEST_IRQ(a,b,c,d,e) request_irq(a,b,c,d,e) +#define FREE_IRQ(a,b) free_irq(a,b) diff -u --recursive --new-file v2.3.28/linux/drivers/misc/acpi.c linux/drivers/misc/acpi.c --- v2.3.28/linux/drivers/misc/acpi.c Thu Nov 11 20:11:39 1999 +++ linux/drivers/misc/acpi.c Mon Nov 22 17:30:42 1999 @@ -54,7 +54,7 @@ #define DECLARE_WAIT_QUEUE_HEAD(x) struct wait_queue * x = NULL #endif -static int acpi_idle_thread(void *context); +static int acpi_control_thread(void *context); static int acpi_do_ulong(ctl_table *ctl, int write, struct file *file, @@ -70,11 +70,13 @@ struct file *file, void *buffer, size_t *len); +#if 0 static int acpi_do_sleep_wake(ctl_table *ctl, int write, struct file *file, void *buffer, size_t *len); +#endif DECLARE_WAIT_QUEUE_HEAD(acpi_idle_wait); @@ -95,13 +97,14 @@ static spinlock_t acpi_devs_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(acpi_devs); -/* Make it impossible to enter L2/L3 until after we've initialized */ -static unsigned long acpi_p_lvl2_lat = ~0UL; -static unsigned long acpi_p_lvl3_lat = ~0UL; - -/* Initialize to guaranteed harmless port read */ -static unsigned long acpi_p_lvl2 = ACPI_P_LVL_DISABLED; -static unsigned long acpi_p_lvl3 = ACPI_P_LVL_DISABLED; +/* Make it impossible to enter C2/C3 until after we've initialized */ +static unsigned long acpi_p_lvl2_lat = ACPI_INFINITE_LAT; +static unsigned long acpi_p_lvl3_lat = ACPI_INFINITE_LAT; + +static unsigned long acpi_p_blk = 0; + +static int acpi_p_lvl2_tested = 0; +static int acpi_p_lvl3_tested = 0; // bits 8-15 are SLP_TYPa, bits 0-7 are SLP_TYPb static unsigned long acpi_slp_typ[] = @@ -138,12 +141,8 @@ {ACPI_EVENT, "event", NULL, 0, 0400, NULL, &acpi_do_event}, - {ACPI_P_LVL2, "p_lvl2", - &acpi_p_lvl2, sizeof(acpi_p_lvl2), - 0600, NULL, &acpi_do_ulong}, - - {ACPI_P_LVL3, "p_lvl3", - &acpi_p_lvl3, sizeof(acpi_p_lvl3), + {ACPI_P_BLK, "p_blk", + &acpi_p_blk, sizeof(acpi_p_blk), 0600, NULL, &acpi_do_ulong}, {ACPI_P_LVL2_LAT, "p_lvl2_lat", @@ -187,6 +186,17 @@ } /* + * Set the value of the PM1 control register (BM_RLD, ...) + */ +static void acpi_write_pm1_control(struct acpi_facp *facp, u32 value) +{ + if (facp->pm1a_cnt) + outw(value, facp->pm1a_cnt); + if (facp->pm1b_cnt) + outw(value, facp->pm1b_cnt); +} + +/* * Get the value of the fixed event status register */ static u32 acpi_read_pm1_status(struct acpi_facp *facp) @@ -522,14 +532,13 @@ acpi_facp->pm2_cnt_len = ACPI_PIIX4_PM2_CNT_LEN; acpi_facp->pm_tm_len = ACPI_PIIX4_PM_TM_LEN; acpi_facp->gpe0_len = ACPI_PIIX4_GPE0_LEN; - acpi_facp->p_lvl2_lat = ~0; - acpi_facp->p_lvl3_lat = ~0; + acpi_facp->p_lvl2_lat = (__u16) ACPI_INFINITE_LAT; + acpi_facp->p_lvl3_lat = (__u16) ACPI_INFINITE_LAT; acpi_facp_addr = virt_to_phys(acpi_facp); acpi_dsdt_addr = 0; - acpi_p_lvl2 = base + ACPI_PIIX4_P_LVL2; - acpi_p_lvl3 = base + ACPI_PIIX4_P_LVL3; + acpi_p_blk = base + ACPI_PIIX4_P_BLK; return 0; } @@ -602,19 +611,39 @@ acpi_write_pm1_enable(facp, 0); acpi_write_pm1_status(facp, acpi_read_pm1_status(facp)); - if (facp->smi_cmd) - outb(facp->acpi_disable, facp->smi_cmd); - return (acpi_is_enabled(facp) ? -1:0); + /* writing acpi_disable to smi_cmd would be appropriate + * here but this causes a nasty crash on many systems + */ + + return 0; } /* - * Idle loop + * Idle loop (uniprocessor only) */ static void acpi_idle_handler(void) { static int sleep_level = 1; - u32 timer, pm2_cnt; - unsigned long time; + u32 pm1_cnt, timer, pm2_cnt, bm_active; + unsigned long time, usec; + + // return to C0 on bus master request (necessary for C3 only) + pm1_cnt = acpi_read_pm1_control(acpi_facp); + if (sleep_level == 3) { + if (!(pm1_cnt & ACPI_BM_RLD)) { + pm1_cnt |= ACPI_BM_RLD; + acpi_write_pm1_control(acpi_facp, pm1_cnt); + } + } + else { + if (pm1_cnt & ACPI_BM_RLD) { + pm1_cnt &= ~ACPI_BM_RLD; + acpi_write_pm1_control(acpi_facp, pm1_cnt); + } + } + + // clear bus master activity flag + acpi_write_pm1_status(acpi_facp, ACPI_BM); // get current time (fallback to CPU cycles if no PM timer) timer = acpi_facp->pm_tmr; @@ -629,19 +658,19 @@ __asm__ __volatile__("sti ; hlt": : :"memory"); break; case 2: - inb(acpi_p_lvl2); + inb(acpi_p_blk + ACPI_P_LVL2); break; case 3: pm2_cnt = acpi_facp->pm2_cnt; if (pm2_cnt) { - /* Disable PCI arbitration while sleeping, - to avoid DMA corruption? */ + /* Disable PCI arbitration while sleeping, + to avoid DMA corruption? */ outb(inb(pm2_cnt) | ACPI_ARB_DIS, pm2_cnt); - inb(acpi_p_lvl3); + inb(acpi_p_blk + ACPI_P_LVL3); outb(inb(pm2_cnt) & ~ACPI_ARB_DIS, pm2_cnt); } else { - inb(acpi_p_lvl3); + inb(acpi_p_blk + ACPI_P_LVL3); } break; } @@ -652,12 +681,29 @@ else time = ACPI_CPU_TO_TMR_TICKS(get_cycles() - time); - if (time > acpi_p_lvl3_lat) - sleep_level = 3; - else if (time > acpi_p_lvl2_lat) - sleep_level = 2; - else - sleep_level = 1; + // check for bus master activity + bm_active = (acpi_read_pm1_status(acpi_facp) & ACPI_BM); + + // record working C2/C3 + if (sleep_level == 2 && !acpi_p_lvl2_tested) { + acpi_p_lvl2_tested = 1; + printk(KERN_INFO "ACPI: C2 works\n"); + } + else if (sleep_level == 3 && !acpi_p_lvl3_tested) { + acpi_p_lvl3_tested = 1; + printk(KERN_INFO "ACPI: C3 works\n"); + } + + // pick next C-state based on time spent sleeping, + // C-state latencies, and bus master activity + sleep_level = 1; + if (acpi_p_blk) { + usec = ACPI_TMR_TICKS_TO_uS(time); + if (usec > acpi_p_lvl3_lat && !bm_active) + sleep_level = 3; + else if (usec > acpi_p_lvl2_lat) + sleep_level = 2; + } } /* @@ -691,9 +737,9 @@ /* * Enter system sleep state */ -static void acpi_enter_sx(int state) +static void acpi_enter_sx(acpi_sstate_t state) { - unsigned long slp_typ = acpi_slp_typ[state]; + unsigned long slp_typ = acpi_slp_typ[(int) state]; if (slp_typ != ACPI_SLP_TYP_DISABLED) { u16 typa, typb, value; @@ -704,6 +750,10 @@ typa = ((typa << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK); typb = ((typb << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK); + if (state != ACPI_S0) { + acpi_enter_dx(ACPI_D3); + } + // set SLP_TYPa/b and SLP_EN if (acpi_facp->pm1a_cnt) { value = inw(acpi_facp->pm1a_cnt) & ~ACPI_SLP_TYP_MASK; @@ -713,6 +763,10 @@ value = inw(acpi_facp->pm1b_cnt) & ~ACPI_SLP_TYP_MASK; outw(value | typb | ACPI_SLP_EN, acpi_facp->pm1b_cnt); } + + if (state == ACPI_S0) { + acpi_enter_dx(ACPI_D0); + } } } @@ -721,7 +775,7 @@ */ static void acpi_power_off_handler(void) { - acpi_enter_sx(5); + acpi_enter_sx(ACPI_S5); } /* @@ -967,6 +1021,7 @@ return 0; } +#if 0 /* * Sleep or wake system */ @@ -995,6 +1050,7 @@ file->f_pos += *len; return 0; } +#endif /* * Initialize and enable ACPI @@ -1008,6 +1064,15 @@ return -ENODEV; } + if (acpi_facp->p_lvl2_lat + && acpi_facp->p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT) { + acpi_p_lvl2_lat = acpi_facp->p_lvl2_lat; + } + if (acpi_facp->p_lvl3_lat + && acpi_facp->p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT) { + acpi_p_lvl3_lat = acpi_facp->p_lvl3_lat; + } + if (acpi_facp->sci_int && request_irq(acpi_facp->sci_int, acpi_irq, @@ -1023,10 +1088,12 @@ acpi_claim_ioports(acpi_facp); acpi_sysctl = register_sysctl_table(acpi_dir_table, 1); - pid = kernel_thread(acpi_idle_thread, + pid = kernel_thread(acpi_control_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); + acpi_power_off = acpi_power_off_handler; + /* * Set up the ACPI idle function. Note that we can't really * do this with multiple CPU's, we'd need a per-CPU ACPI @@ -1037,7 +1104,6 @@ return 0; #endif - acpi_power_off = acpi_power_off_handler; acpi_idle = acpi_idle_handler; return 0; @@ -1111,7 +1177,7 @@ /* * Manage idle devices */ -static int acpi_idle_thread(void *context) +static int acpi_control_thread(void *context) { exit_mm(current); exit_files(current); diff -u --recursive --new-file v2.3.28/linux/drivers/net/3c515.c linux/drivers/net/3c515.c --- v2.3.28/linux/drivers/net/3c515.c Wed Aug 18 11:36:41 1999 +++ linux/drivers/net/3c515.c Tue Nov 23 10:29:15 1999 @@ -1194,19 +1194,12 @@ pkt_len, rx_status); if (skb != NULL) { skb->dev = dev; -#if LINUX_VERSION_CODE >= 0x10300 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ /* 'skb_put()' points to the start of sk_buff data area. */ insl(ioaddr + RX_FIFO, skb_put(skb, pkt_len), (pkt_len + 3) >> 2); outw(RxDiscard, ioaddr + EL3_CMD); /* Pop top Rx packet. */ skb->protocol = eth_type_trans(skb, dev); -#else - skb->len = pkt_len; - /* 'skb->data' points to the start of sk_buff data area. */ - insl(ioaddr + RX_FIFO, skb->data, (pkt_len + 3) >> 2); - outw(RxDiscard, ioaddr + EL3_CMD); /* Pop top Rx packet. */ -#endif /* KERNEL_1_3_0 */ netif_rx(skb); dev->last_rx = jiffies; vp->stats.rx_packets++; @@ -1288,11 +1281,7 @@ skb->head, temp); rx_nocopy++; } -#if LINUX_VERSION_CODE > 0x10300 skb->protocol = eth_type_trans(skb, dev); -#else - skb->len = pkt_len; -#endif netif_rx(skb); dev->last_rx = jiffies; vp->stats.rx_packets++; @@ -1308,12 +1297,8 @@ if (skb == NULL) break; /* Bad news! */ skb->dev = dev; /* Mark as being used by this device. */ -#if LINUX_VERSION_CODE > 0x10300 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ vp->rx_ring[entry].addr = virt_to_bus(skb->tail); -#else - vp->rx_ring[entry].addr = virt_to_bus(skb->data); -#endif vp->rx_skbuff[entry] = skb; } vp->rx_ring[entry].status = 0; /* Clear complete bit. */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/3c59x.c linux/drivers/net/3c59x.c --- v2.3.28/linux/drivers/net/3c59x.c Thu Nov 11 20:11:39 1999 +++ linux/drivers/net/3c59x.c Tue Nov 23 10:29:15 1999 @@ -1114,12 +1114,8 @@ if (skb == NULL) break; /* Bad news! */ skb->dev = dev; /* Mark as being used by this device. */ -#if LINUX_VERSION_CODE >= 0x10300 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ vp->rx_ring[i].addr = cpu_to_le32(virt_to_bus(skb->tail)); -#else - vp->rx_ring[i].addr = virt_to_bus(skb->data); -#endif } /* Wrap the ring. */ vp->rx_ring[i-1].next = cpu_to_le32(virt_to_bus(&vp->rx_ring[0])); @@ -1294,7 +1290,7 @@ if ( ! (inw(ioaddr + EL3_STATUS) & CmdInProgress)) break; -#if ! defined(final_version) && LINUX_VERSION_CODE >= 0x10300 +#if ! defined(final_version) if (vp->full_bus_master_tx) { int i; printk(KERN_DEBUG " Flags; bus-master %d, full %d; dirty %d " diff -u --recursive --new-file v2.3.28/linux/drivers/net/8390.c linux/drivers/net/8390.c --- v2.3.28/linux/drivers/net/8390.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/net/8390.c Fri Nov 19 11:48:20 1999 @@ -47,7 +47,6 @@ static const char *version = "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; -#include #include #include #include @@ -1090,10 +1089,7 @@ int start_page) { long e8390_base = dev->base_addr; -#if defined(CONFIG_MAC) || defined(CONFIG_AMIGA_PCMCIA) || \ - defined(CONFIG_ARIADNE2) || defined(CONFIG_ARIADNE2_MODULE) - struct ei_device *ei_local = (struct ei_device *) dev->priv; -#endif + struct ei_device *ei_local __attribute((unused)) = (struct ei_device *) dev->priv; outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD); diff -u --recursive --new-file v2.3.28/linux/drivers/net/Config.in linux/drivers/net/Config.in --- v2.3.28/linux/drivers/net/Config.in Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/Config.in Tue Nov 23 10:15:42 1999 @@ -95,10 +95,7 @@ tristate ' NI6510 support' CONFIG_NI65 fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - # tristate ' Packet Engines Hamachi GNIC-II support (EXPERIMENTAL)' CONFIG_HAMACHI - tristate ' Packet Engines Yellowfin Gigabit-NIC support (EXPERIMENTAL)' CONFIG_YELLOWFIN tristate ' RealTek 8129/8139 (not 8019/8029!) support (EXPERIMENTAL)' CONFIG_RTL8139 - tristate ' SiS 900 PCI Fast Ethernet Adapter support (EXPERIMENTAL)' CONFIG_SIS900 tristate ' DM9102 PCI Fast Ethernet Adapter support (EXPERIMENTAL)' CONFIG_DM9102 fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then @@ -134,10 +131,6 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' Adaptec Starfire support (EXPERIMENTAL)' CONFIG_ADAPTEC_STARFIRE fi - tristate ' Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support' CONFIG_ACENIC - if [ "$CONFIG_ACENIC" != "n" ]; then - bool ' Omit support for old Tigon I based AceNICs' CONFIG_ACENIC_OMIT_TIGON_I - fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' Ansel Communications EISA 3200 support (EXPERIMENTAL)' CONFIG_AC3200 fi @@ -154,6 +147,7 @@ fi tristate ' PCI NE2000 support' CONFIG_NE2K_PCI # tristate ' Sundance Alta support' CONFIG_ALTA + tristate ' SiS 900/7016 PCI Fast Ethernet Adapter support' CONFIG_SIS900 tristate ' TI ThunderLAN support' CONFIG_TLAN tristate ' VIA Rhine support' CONFIG_VIA_RHINE if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then @@ -170,6 +164,24 @@ fi fi +endmenu + +# +# Gigabit Ethernet +# + +mainmenu_option next_comment +comment 'Ethernet (1000 Mbit)' + + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + # tristate 'Packet Engines Hamachi GNIC-II support (EXPERIMENTAL)' CONFIG_HAMACHI + tristate 'Packet Engines Yellowfin Gigabit-NIC support (EXPERIMENTAL)' CONFIG_YELLOWFIN + fi + tristate 'Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support' CONFIG_ACENIC + if [ "$CONFIG_ACENIC" != "n" ]; then + bool ' Omit support for old Tigon I based AceNICs' CONFIG_ACENIC_OMIT_TIGON_I + fi + tristate 'SysKonnect SK-98xx support' CONFIG_SK98LIN endmenu bool 'FDDI driver support' CONFIG_FDDI diff -u --recursive --new-file v2.3.28/linux/drivers/net/Makefile linux/drivers/net/Makefile --- v2.3.28/linux/drivers/net/Makefile Thu Nov 11 20:11:39 1999 +++ linux/drivers/net/Makefile Tue Nov 23 10:15:42 1999 @@ -17,10 +17,10 @@ SUB_DIRS := MOD_SUB_DIRS := MOD_IN_SUB_DIRS := -ALL_SUB_DIRS := $(SUB_DIRS) fc hamradio irda pcmcia tokenring wan +ALL_SUB_DIRS := $(SUB_DIRS) fc hamradio irda pcmcia tokenring wan sk98lin -L_TARGET := net.a -L_OBJS := auto_irq.o +O_TARGET := net.o +O_OBJS := M_OBJS := MOD_LIST_NAME := NET_MODULES @@ -48,6 +48,16 @@ endif endif +ifeq ($(CONFIG_SK98LIN),y) +SUB_DIRS += sk98lin +MOD_IN_SUB_DIRS += sk98lin +L_OBJS += sk98lin/sk98lin.o +else + ifeq ($(CONFIG_SK98LIN),m) + MOD_IN_SUB_DIRS += sk98lin + endif +endif + ifeq ($(CONFIG_TR),y) SUB_DIRS += tokenring MOD_IN_SUB_DIRS += tokenring @@ -263,8 +273,7 @@ M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) -L_OBJS += $(O_OBJS) -L_OBJS += $(OX_OBJS) +O_OBJS += auto_irq.o include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.3.28/linux/drivers/net/Space.c linux/drivers/net/Space.c --- v2.3.28/linux/drivers/net/Space.c Thu Nov 11 20:11:39 1999 +++ linux/drivers/net/Space.c Thu Nov 18 19:25:28 1999 @@ -160,6 +160,9 @@ * EISA only driver probes, and also the legacy PCI probes */ struct devprobe eisa_probes[] __initdata = { +#ifdef CONFIG_DE4X5 /* DEC DE425, DE434, DE435 adapters */ + {de4x5_probe, 0}, +#endif #ifdef CONFIG_TLAN {tlan_probe, 0}, #endif diff -u --recursive --new-file v2.3.28/linux/drivers/net/bmac.c linux/drivers/net/bmac.c --- v2.3.28/linux/drivers/net/bmac.c Thu Nov 11 20:11:39 1999 +++ linux/drivers/net/bmac.c Fri Nov 19 11:33:29 1999 @@ -166,7 +166,7 @@ static void bmac_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs); static void bmac_set_timeout(struct net_device *dev); static void bmac_tx_timeout(unsigned long data); -static int bmac_proc_info ( char *buffer, char **start, off_t offset, int length, int dummy); +static int bmac_proc_info ( char *buffer, char **start, off_t offset, int length); static int bmac_output(struct sk_buff *skb, struct net_device *dev); static void bmac_start(struct net_device *dev); @@ -1560,7 +1560,7 @@ #endif static int -bmac_proc_info(char *buffer, char **start, off_t offset, int length, int dummy) +bmac_proc_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/drivers/net/hamradio/bpqether.c linux/drivers/net/hamradio/bpqether.c --- v2.3.28/linux/drivers/net/hamradio/bpqether.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/net/hamradio/bpqether.c Fri Nov 19 11:33:29 1999 @@ -451,7 +451,7 @@ return buf; } -int bpq_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int bpq_get_info(char *buffer, char **start, off_t offset, int length) { struct bpqdev *bpqdev; int len = 0; diff -u --recursive --new-file v2.3.28/linux/drivers/net/hamradio/scc.c linux/drivers/net/hamradio/scc.c --- v2.3.28/linux/drivers/net/hamradio/scc.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/net/hamradio/scc.c Sun Nov 21 11:13:56 1999 @@ -1571,7 +1571,7 @@ unsigned char *buf; struct net_device *dev; - if (dev_get(name) != NULL) + if (dev_get(name)) { printk(KERN_INFO "Z8530drv: device %s already exists.\n", name); return -EEXIST; @@ -2068,7 +2068,7 @@ /* ******************************************************************** */ -static int scc_net_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int scc_net_get_info(char *buffer, char **start, off_t offset, int length) { struct scc_channel *scc; struct scc_kiss *kiss; diff -u --recursive --new-file v2.3.28/linux/drivers/net/hamradio/yam.c linux/drivers/net/hamradio/yam.c --- v2.3.28/linux/drivers/net/hamradio/yam.c Thu Nov 11 20:11:41 1999 +++ linux/drivers/net/hamradio/yam.c Fri Nov 19 11:33:29 1999 @@ -781,7 +781,7 @@ } } -static int yam_net_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int yam_net_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; int i; diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/Makefile linux/drivers/net/irda/Makefile --- v2.3.28/linux/drivers/net/irda/Makefile Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/irda/Makefile Sun Nov 21 11:13:56 1999 @@ -21,26 +21,10 @@ endif ifeq ($(CONFIG_IRPORT_SIR),y) -L_OBJS += irport.o +LX_OBJS += irport.o else ifeq ($(CONFIG_IRPORT_SIR),m) - M_OBJS += irport.o - endif -endif - -ifeq ($(CONFIG_IRPORT_SIR),y) -L_OBJS += irport.o -else - ifeq ($(CONFIG_IRPORT_SIR),m) - M_OBJS += irport.o - endif -endif - -ifeq ($(CONFIG_IRPORT_SIR),y) -L_OBJS += irport.o -else - ifeq ($(CONFIG_IRPORT_SIR),m) - M_OBJS += irport.o + MX_OBJS += irport.o endif endif @@ -68,27 +52,13 @@ endif endif -ifeq ($(CONFIG_TOSHIBA_FIR),y) -L_OBJS += toshoboe.o -else - ifeq ($(CONFIG_TOSHIBA_FIR),m) - M_OBJS += toshoboe.o - endif -endif - -ifeq ($(CONFIG_TOSHIBA_FIR),y) -L_OBJS += toshoboe.o -else - ifeq ($(CONFIG_TOSHIBA_FIR),m) - M_OBJS += toshoboe.o - endif -endif - ifeq ($(CONFIG_SMC_IRCC_FIR),y) -L_OBJS += irport.o smc-ircc.o +L_OBJS += smc-ircc.o +LX_OBJS += irport.o else ifeq ($(CONFIG_SMC_IRCC_FIR),m) - M_OBJS += irport.o smc-ircc.o + M_OBJS += smc-ircc.o + MX_OBJS += irport.o endif endif @@ -121,22 +91,6 @@ else ifeq ($(CONFIG_GIRBIL_DONGLE),m) M_OBJS += girbil.o - endif -endif - -ifeq ($(CONFIG_LITELINK_DONGLE),y) -L_OBJS += litelink.o -else - ifeq ($(CONFIG_LITELINK_DONGLE),m) - M_OBJS += litelink.o - endif -endif - -ifeq ($(CONFIG_LITELINK_DONGLE),y) -L_OBJS += litelink.o -else - ifeq ($(CONFIG_LITELINK_DONGLE),m) - M_OBJS += litelink.o endif endif diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/irport.c linux/drivers/net/irda/irport.c --- v2.3.28/linux/drivers/net/irda/irport.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/irda/irport.c Sun Nov 21 11:13:56 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Aug 3 13:49:59 1997 - * Modified at: Sat Oct 30 20:03:42 1999 + * Modified at: Sat Nov 13 23:25:56 1999 * Modified by: Dag Brattli * Sources: serial.c by Linus Torvalds * @@ -89,6 +89,9 @@ static int irport_set_dtr_rts(struct net_device *dev, int dtr, int rts); static int irport_raw_write(struct net_device *dev, __u8 *buf, int len); static struct net_device_stats *irport_net_get_stats(struct net_device *dev); +static int irport_change_speed_complete(struct irda_task *task); + +EXPORT_SYMBOL(irport_change_speed); int __init irport_init(void) { @@ -379,7 +382,7 @@ * State machine for changing speed of the device. We do it this way since * we cannot use schedule_timeout() when we are in interrupt context */ -static int irport_change_speed(struct irda_task *task) +int irport_change_speed(struct irda_task *task) { struct irport_cb *self; __u32 speed = (__u32) task->param; @@ -463,40 +466,53 @@ IRDA_DEBUG(4, __FUNCTION__ "()\n"); + iobase = self->io.iobase2; + /* Finished with frame? */ if (self->tx_buff.len > 0) { /* Write data left in transmit buffer */ - actual = irport_write(self->io.iobase2, self->io.fifo_size, + actual = irport_write(iobase, self->io.fifo_size, self->tx_buff.data, self->tx_buff.len); self->tx_buff.data += actual; self->tx_buff.len -= actual; } else { - iobase = self->io.iobase2; + /* * Now serial buffer is almost free & we can start - * transmission of another packet + * transmission of another packet. But first we must check + * if we need to change the speed of the hardware */ - self->netdev->tbusy = 0; /* Unlock */ + if (self->new_speed) { + IRDA_DEBUG(5, __FUNCTION__ "(), Changing speed!\n"); + irda_task_execute(self, irport_change_speed, + irport_change_speed_complete, + NULL, (void *) self->new_speed); + self->new_speed = 0; + } else { + self->netdev->tbusy = 0; /* Unlock */ + + /* Tell network layer that we want more frames */ + mark_bh(NET_BH); + } self->stats.tx_packets++; /* Schedule network layer, so we can get some more frames */ mark_bh(NET_BH); + /* + * Reset Rx FIFO to make sure that all reflected transmit data + * is discarded. This is needed for half duplex operation + */ fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR; - if (self->io.speed < 38400) fcr |= UART_FCR_TRIGGER_1; else fcr |= UART_FCR_TRIGGER_14; - /* - * Reset Rx FIFO to make sure that all reflected transmit data - * will be discarded - */ outb(fcr, iobase+UART_FCR); /* Turn on receive interrupts */ - outb(/* UART_IER_RLSI| */UART_IER_RDI, iobase+UART_IER); + outb(UART_IER_RDI, iobase+UART_IER); } } @@ -589,16 +605,9 @@ } /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) { - if (irda_task_execute(self, irport_change_speed, - irport_change_speed_complete, NULL, - (void *) speed)) - /* - * Task not finished yet, so make the netdevice - * layer requeue the frame - */ - return -EBUSY; - } + if ((speed = irda_get_speed(skb)) != self->io.speed) + self->new_speed = speed; + spin_lock_irqsave(&self->lock, flags); /* Init tx buffer */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/irtty.c linux/drivers/net/irda/irtty.c --- v2.3.28/linux/drivers/net/irda/irtty.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/irda/irtty.c Sun Nov 21 11:13:56 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Dec 9 21:18:38 1997 - * Modified at: Sun Oct 31 22:24:03 1999 + * Modified at: Tue Nov 16 02:50:37 1999 * Modified by: Dag Brattli * Sources: slip.c by Laurence Culhane, * Fred N. van Kempen, @@ -409,16 +409,23 @@ switch (task->state) { case IRDA_TASK_INIT: - case IRDA_TASK_WAIT: - /* Are we ready to change speed yet? */ + /* + * Make sure all data is sent before changing the speed of the + * serial port. + */ if (self->tty->driver.chars_in_buffer(self->tty)) { - task->state = IRDA_TASK_WAIT; - - /* Try again later */ - ret = MSECS_TO_JIFFIES(20); + /* Keep state, and try again later */ + ret = MSECS_TO_JIFFIES(10); break; + } else { + /* Transmit buffer is now empty, but it may still + * take over 13 ms for the FIFO to become empty, so + * wait some more to be sure all data is sent + */ + irda_task_next_state(task, IRDA_TASK_WAIT); + ret = MSECS_TO_JIFFIES(13); } - + case IRDA_TASK_WAIT: if (self->dongle) irda_task_next_state(task, IRDA_TASK_CHILD_INIT); else @@ -622,16 +629,8 @@ return -EBUSY; /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) { - if (irda_task_execute(self, irtty_change_speed, - irtty_change_speed_complete, NULL, - (void *) speed)) - /* - * Task not finished yet, so make the netdevice - * layer requeue the frame - */ - return -EBUSY; - } + if ((speed = irda_get_speed(skb)) != self->io.speed) + self->new_speed = speed; /* Init tx buffer*/ self->tx_buff.data = self->tx_buff.head; @@ -648,24 +647,13 @@ actual = self->tty->driver.write(self->tty, 0, self->tx_buff.data, self->tx_buff.len); - /* Hide the part we just transmitted */ self->tx_buff.data += actual; self->tx_buff.len -= actual; self->stats.tx_packets++; self->stats.tx_bytes += self->tx_buff.len; -#if 0 - /* - * Did we transmit the whole frame? Commented out for now since - * I must check if this optimalization really works. DB. - */ - if ((self->tx_buff.len) == 0) { - IRDA_DEBUG( 4, "irtty_xmit_buf: finished with frame!\n"); - self->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); - irda_unlock( &self->tbusy); - } -#endif + dev_kfree_skb(skb); return 0; @@ -718,10 +706,18 @@ tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); - self->netdev->tbusy = 0; /* Unlock */ - - /* Tell network layer that we want more frames */ - mark_bh(NET_BH); + if (self->new_speed) { + IRDA_DEBUG(5, __FUNCTION__ "(), Changing speed!\n"); + irda_task_execute(self, irtty_change_speed, + irtty_change_speed_complete, + NULL, (void *) self->new_speed); + self->new_speed = 0; + } else { + self->netdev->tbusy = 0; /* Unlock */ + + /* Tell network layer that we want more frames */ + mark_bh(NET_BH); + } } } diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/pc87108.c linux/drivers/net/irda/pc87108.c --- v2.3.28/linux/drivers/net/irda/pc87108.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/irda/pc87108.c Sun Nov 21 11:13:56 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sat Nov 7 21:43:15 1998 - * Modified at: Sat Oct 30 16:24:17 1999 + * Modified at: Sat Nov 13 23:54:59 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli @@ -754,6 +754,7 @@ { struct pc87108 *self; int iobase; + __u32 speed; __u8 bank; int mtt; @@ -763,12 +764,17 @@ iobase = self->io.iobase; - IRDA_DEBUG(4, __FUNCTION__ "(%ld), skb->len=%d\n", jiffies, (int) skb->len); + IRDA_DEBUG(4, __FUNCTION__ "(%ld), skb->len=%d\n", jiffies, + (int) skb->len); /* Lock transmit buffer */ if (irda_lock((void *) &dev->tbusy) == FALSE) return -EBUSY; + /* Check if we need to change the speed */ + if ((speed = irda_get_speed(skb)) != self->io.speed) + self->new_speed = speed; + /* Save current bank */ bank = inb(iobase+BSR); @@ -937,6 +943,11 @@ self->stats.tx_bytes += self->tx_buff.len; } + if (self->new_speed) { + pc87108_change_speed(self, self->new_speed); + self->new_speed = 0; + } + /* Unlock tx_buff and request another frame */ self->netdev->tbusy = 0; /* Unlock */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/smc-ircc.c linux/drivers/net/irda/smc-ircc.c --- v2.3.28/linux/drivers/net/irda/smc-ircc.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/irda/smc-ircc.c Sun Nov 21 11:13:56 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Thomas Davis (tadavis@jps.net) * Created at: - * Modified at: Sat Oct 30 14:18:23 1999 + * Modified at: Fri Nov 12 21:08:09 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Thomas Davis, All Rights Reserved. @@ -421,7 +421,7 @@ serial_out(iobase, UART_MASTER, UART_MASTER_RESET); serial_out(iobase, UART_MASTER, UART_MASTER_INT_EN); irport_start(&self->irport, self->io.iobase2); - irport_change_speed(&self->irport, speed); + __irport_change_speed(&self->irport, speed); return; break; diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/toshoboe.c linux/drivers/net/irda/toshoboe.c --- v2.3.28/linux/drivers/net/irda/toshoboe.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/net/irda/toshoboe.c Sun Nov 21 11:13:56 1999 @@ -304,7 +304,7 @@ /* Check if we need to change the speed */ if ((speed = irda_get_speed(skb)) != self->io.speed) - toshoboe_setbaud (self, speed); + self->new_speed = speed; if (self->stopped) { dev_kfree_skb(skb); @@ -405,10 +405,14 @@ self->stats.tx_packets++; - /* idev->media_busy = FALSE; */ - self->netdev->tbusy = 0; - - mark_bh (NET_BH); + if (self->new_speed) { + toshoboe_setbaud(self, self->new_speed); + self->new_speed = 0; + } + self->netdev->tbusy = 0; /* Unlock */ + + /* Tell network layer that we want more frames */ + mark_bh(NET_BH); } if (irqstat & OBOE_ISR_RXDONE) diff -u --recursive --new-file v2.3.28/linux/drivers/net/irda/w83977af_ir.c linux/drivers/net/irda/w83977af_ir.c --- v2.3.28/linux/drivers/net/irda/w83977af_ir.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/irda/w83977af_ir.c Sun Nov 21 11:13:56 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Paul VanderSpek * Created at: Wed Nov 4 11:46:16 1998 - * Modified at: Sat Oct 30 16:24:32 1999 + * Modified at: Mon Nov 8 10:05:48 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli @@ -508,7 +508,7 @@ /* Check if we need to change the speed */ if ((speed = irda_get_speed(skb)) != self->io.speed) - w83977af_change_speed(self, speed); + self->new_speed = speed; /* Save current set */ set = inb(iobase+SSR); @@ -697,6 +697,12 @@ outb(AUDR_UNDR, iobase+AUDR); } else self->stats.tx_packets++; + + + if (self->new_speed) { + w83977af_change_speed(self, self->new_speed); + self->new_speed = 0; + } /* Unlock tx_buff and request another frame */ self->netdev->tbusy = 0; /* Unlock */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/pcmcia/3c575_cb.c linux/drivers/net/pcmcia/3c575_cb.c --- v2.3.28/linux/drivers/net/pcmcia/3c575_cb.c Thu Nov 11 20:11:41 1999 +++ linux/drivers/net/pcmcia/3c575_cb.c Tue Nov 23 10:29:15 1999 @@ -1328,7 +1328,7 @@ vortex_interrupt(dev->irq, dev, 0); } -#if ! defined(final_version) && LINUX_VERSION_CODE >= 0x10300 +#if ! defined(final_version) if (vp->full_bus_master_tx) { int i; printk(KERN_DEBUG " Flags; bus-master %d, full %d; dirty %d " diff -u --recursive --new-file v2.3.28/linux/drivers/net/pcmcia/ray_cs.c linux/drivers/net/pcmcia/ray_cs.c --- v2.3.28/linux/drivers/net/pcmcia/ray_cs.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/net/pcmcia/ray_cs.c Fri Nov 19 11:33:29 1999 @@ -2527,8 +2527,7 @@ static char *framing[] = {"Encapsulation", "Translation"} ; /*===========================================================================*/ -static int ray_cs_proc_read(char *buf, char **start, off_t offset, - int len, int unused) +static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len) { /* Print current values which are not available via other means * eg ifconfig diff -u --recursive --new-file v2.3.28/linux/drivers/net/setup.c linux/drivers/net/setup.c --- v2.3.28/linux/drivers/net/setup.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/net/setup.c Tue Nov 23 10:15:42 1999 @@ -8,11 +8,13 @@ #include #include +extern int plip_init(void); extern int mkiss_init_ctrl_dev(void); extern int ppp_init(void); extern int slip_init_ctrl_dev(void); extern int strip_init_ctrl_dev(void); extern int x25_asy_init_ctrl_dev(void); +extern int slhc_install(void); extern int bpq_init(void); extern int dmascc_init(void); @@ -42,6 +44,7 @@ extern int rtl8139_probe(void); extern int sdla_setup(void); extern int sis900_probe(void); +extern int skge_probe(void); extern int sparc_lance_probe(void); extern int starfire_probe(void); extern int tc59x_probe(void); @@ -181,9 +184,6 @@ #ifdef CONFIG_DEC_ELCP {tulip_probe, 0}, #endif -#ifdef CONFIG_DE4X5 /* DEC DE425, DE434, DE435 adapters */ - {de4x5_probe, 0}, -#endif #ifdef CONFIG_EPIC100 {epic100_probe, 0}, #endif @@ -204,6 +204,9 @@ #ifdef CONFIG_ACENIC {acenic_probe, 0}, #endif +#ifdef CONFIG_SK98LIN + {skge_probe, 0}, +#endif #ifdef CONFIG_VIA_RHINE {via_rhine_probe, 0}, #endif @@ -367,5 +370,3 @@ special_device_init(); /* That kicks off the legacy init functions */ } - - diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/Makefile linux/drivers/net/sk98lin/Makefile --- v2.3.28/linux/drivers/net/sk98lin/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/Makefile Tue Nov 23 10:15:42 1999 @@ -0,0 +1,80 @@ +# File: drivers/sk98lin/Makefile +# +# Makefile for the SysKonnect SK-98xx device driver. +# + +ifeq ($(CONFIG_SK98LIN),y) + O_TARGET := sk98lin.o + O_OBJS = skge.o skaddr.o skgehwt.o skgeinit.o skgepnmi.o skgesirq.o \ + ski2c.o sklm80.o skqueue.o skrlmt.o sktimer.o skvpd.o \ + skxmac2.o skcsum.o +else + ifeq ($(CONFIG_SK98LIN),m) + MOD_LIST_NAME := SK98LIN_MODULES + M_OBJS := sk98lin.o + O_TARGET := sk98lin.o + O_OBJS = skge.o skaddr.o skgehwt.o skgeinit.o skgepnmi.o skgesirq.o \ + ski2c.o sklm80.o skqueue.o skrlmt.o sktimer.o skvpd.o \ + skxmac2.o skcsum.o + endif +endif + +# DBGDEF = \ +# -DDEBUG + +ifdef DEBUG +DBGDEF += \ +-DSK_DEBUG_CHKMOD=0x00000000L \ +-DSK_DEBUG_CHKCAT=0x00000000L +endif + + +# **** possible debug modules for SK_DEBUG_CHKMOD ***************** +# SK_DBGMOD_MERR 0x00000001L /* general module error indication */ +# SK_DBGMOD_HWM 0x00000002L /* Hardware init module */ +# SK_DBGMOD_RLMT 0x00000004L /* RLMT module */ +# SK_DBGMOD_VPD 0x00000008L /* VPD module */ +# SK_DBGMOD_I2C 0x00000010L /* I2C module */ +# SK_DBGMOD_PNMI 0x00000020L /* PNMI module */ +# SK_DBGMOD_CSUM 0x00000040L /* CSUM module */ +# SK_DBGMOD_ADDR 0x00000080L /* ADDR module */ +# SK_DBGMOD_DRV 0x00010000L /* DRV module */ + +# **** possible debug categories for SK_DEBUG_CHKCAT ************** +# *** common modules *** +# SK_DBGCAT_INIT 0x00000001L module/driver initialization +# SK_DBGCAT_CTRL 0x00000002L controlling: add/rmv MCA/MAC and other controls (IOCTL) +# SK_DBGCAT_ERR 0x00000004L error handling paths +# SK_DBGCAT_TX 0x00000008L transmit path +# SK_DBGCAT_RX 0x00000010L receive path +# SK_DBGCAT_IRQ 0x00000020L general IRQ handling +# SK_DBGCAT_QUEUE 0x00000040L any queue management +# SK_DBGCAT_DUMP 0x00000080L large data output e.g. hex dump +# SK_DBGCAT_FATAL 0x00000100L large data output e.g. hex dump + +# *** driver (file skge.c) *** +# SK_DBGCAT_DRV_ENTRY 0x00010000 entry points +# SK_DBGCAT_DRV_??? 0x00020000 not used +# SK_DBGCAT_DRV_MCA 0x00040000 multicast +# SK_DBGCAT_DRV_TX_PROGRESS 0x00080000 tx path +# SK_DBGCAT_DRV_RX_PROGRESS 0x00100000 rx path +# SK_DBGCAT_DRV_PROGRESS 0x00200000 general runtime +# SK_DBGCAT_DRV_??? 0x00400000 not used +# SK_DBGCAT_DRV_PROM 0x00800000 promiscuous mode +# SK_DBGCAT_DRV_TX_FRAME 0x01000000 display tx frames +# SK_DBGCAT_DRV_ERROR 0x02000000 error conditions +# SK_DBGCAT_DRV_INT_SRC 0x04000000 interrupts sources +# SK_DBGCAT_DRV_EVENT 0x08000000 driver events + +EXTRA_CFLAGS += -I. -DSK_USE_CSUM $(DBGDEF) + +include $(TOPDIR)/Rules.make + +clean: + rm -f core *.o *.a *.s + + + + + + diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/lm80.h linux/drivers/net/sk98lin/h/lm80.h --- v2.3.28/linux/drivers/net/sk98lin/h/lm80.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/lm80.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,192 @@ +/****************************************************************************** + * + * Name: lm80.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.2 $ + * Date: $Date: 1999/03/12 13:26:51 $ + * Purpose: Contains all defines for the LM80 Chip + * (National Semiconductor). + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * $Log: lm80.h,v $ + * Revision 1.2 1999/03/12 13:26:51 malthoff + * remove __STDC__. + * + * Revision 1.1 1998/06/19 09:28:31 malthoff + * created. + * + * + ******************************************************************************/ + +#ifndef __INC_LM80_H +#define __INC_LM80_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines ********************************************************************/ + +/* + * LM80 register definition + * + * All registers are 8 bit wide + */ +#define LM80_CFG 0x00 /* Configuration Register */ +#define LM80_ISRC_1 0x01 /* Interrupt Status Register 1 */ +#define LM80_ISRC_2 0x02 /* Interrupt Status Register 2 */ +#define LM80_IMSK_1 0x03 /* Interrupt Mask Register 1 */ +#define LM80_IMSK_2 0x04 /* Interrupt Mask Register 2 */ +#define LM80_FAN_CTRL 0x05 /* Fan Devisor/RST#/OS# Register */ +#define LM80_TEMP_CTRL 0x06 /* OS# Config, Temp Res. Reg */ + /* 0x07 - 0x1f reserved */ + /* current values */ +#define LM80_VT0_IN 0x20 /* current Voltage 0 value */ +#define LM80_VT1_IN 0x21 /* current Voltage 1 value */ +#define LM80_VT2_IN 0x22 /* current Voltage 2 value */ +#define LM80_VT3_IN 0x23 /* current Voltage 3 value */ +#define LM80_VT4_IN 0x24 /* current Voltage 4 value */ +#define LM80_VT5_IN 0x25 /* current Voltage 5 value */ +#define LM80_VT6_IN 0x26 /* current Voltage 6 value */ +#define LM80_TEMP_IN 0x27 /* current temperature value */ +#define LM80_FAN1_IN 0x28 /* current Fan 1 count */ +#define LM80_FAN2_IN 0x29 /* current Fan 2 count */ + /* limit values */ +#define LM80_VT0_HIGH_LIM 0x2a /* high limit val for Voltage 0 */ +#define LM80_VT0_LOW_LIM 0x2b /* low limit val for Voltage 0 */ +#define LM80_VT1_HIGH_LIM 0x2c /* high limit val for Voltage 1 */ +#define LM80_VT1_LOW_LIM 0x2d /* low limit val for Voltage 1 */ +#define LM80_VT2_HIGH_LIM 0x2e /* high limit val for Voltage 2 */ +#define LM80_VT2_LOW_LIM 0x2f /* low limit val for Voltage 2 */ +#define LM80_VT3_HIGH_LIM 0x30 /* high limit val for Voltage 3 */ +#define LM80_VT3_LOW_LIM 0x31 /* low limit val for Voltage 3 */ +#define LM80_VT4_HIGH_LIM 0x32 /* high limit val for Voltage 4 */ +#define LM80_VT4_LOW_LIM 0x33 /* low limit val for Voltage 4 */ +#define LM80_VT5_HIGH_LIM 0x34 /* high limit val for Voltage 5 */ +#define LM80_VT5_LOW_LIM 0x35 /* low limit val for Voltage 5 */ +#define LM80_VT6_HIGH_LIM 0x36 /* high limit val for Voltage 6 */ +#define LM80_VT6_LOW_LIM 0x37 /* low limit val for Voltage 6 */ +#define LM80_THOT_LIM_UP 0x38 /* hot temperature limit (high) */ +#define LM80_THOT_LIM_LO 0x39 /* hot temperature limit (low) */ +#define LM80_TOS_LIM_UP 0x3a /* OS temperature limit (high) */ +#define LM80_TOS_LIM_LO 0x3b /* OS temperature limit (low) */ +#define LM80_FAN1_COUNT_LIM 0x3c /* Fan 1 count limit (high) */ +#define LM80_FAN2_COUNT_LIM 0x3d /* Fan 2 count limit (low) */ + /* 0x3e - 0x3f reserved */ + +/* + * LM80 bit definitions + */ + +/* LM80_CFG Configuration Register */ +#define LM80_CFG_START (1<<0) /* start monitoring operation */ +#define LM80_CFG_INT_ENA (1<<1) /* enables the INT# Interrupt output */ +#define LM80_CFG_INT_POL (1<<2) /* INT# pol: 0 act low, 1 act high */ +#define LM80_CFG_INT_CLR (1<<3) /* disables INT#/RST_OUT#/OS# outputs */ +#define LM80_CFG_RESET (1<<4) /* signals a reset */ +#define LM80_CFG_CHASS_CLR (1<<5) /* clears Chassis Intrusion (CI) pin */ +#define LM80_CFG_GPO (1<<6) /* drives the GPO# pin */ +#define LM80_CFG_INIT (1<<7) /* restore power on defaults */ + +/* LM80_ISRC_1 Interrupt Status Register 1 */ +/* LM80_IMSK_1 Interrupt Mask Register 1 */ +#define LM80_IS_VT0 (1<<0) /* limit exceeded for Voltage 0 */ +#define LM80_IS_VT1 (1<<1) /* limit exceeded for Voltage 1 */ +#define LM80_IS_VT2 (1<<2) /* limit exceeded for Voltage 2 */ +#define LM80_IS_VT3 (1<<3) /* limit exceeded for Voltage 3 */ +#define LM80_IS_VT4 (1<<4) /* limit exceeded for Voltage 4 */ +#define LM80_IS_VT5 (1<<5) /* limit exceeded for Voltage 5 */ +#define LM80_IS_VT6 (1<<6) /* limit exceeded for Voltage 6 */ +#define LM80_IS_INT_IN (1<<7) /* state of INT_IN# */ + +/* LM80_ISRC_2 Interrupt Status Register 2 */ +/* LM80_IMSK_2 Interrupt Mask Register 2 */ +#define LM80_IS_TEMP (1<<0) /* HOT temperature limit exceeded */ +#define LM80_IS_BTI (1<<1) /* state of BTI# pin */ +#define LM80_IS_FAN1 (1<<2) /* count limit exceeded for Fan 1 */ +#define LM80_IS_FAN2 (1<<3) /* count limit exceeded for Fan 2 */ +#define LM80_IS_CI (1<<4) /* Chassis Intrusion occured */ +#define LM80_IS_OS (1<<5) /* OS temperature limit exceeded */ + /* bit 6 and 7 are reserved in LM80_ISRC_2 */ +#define LM80_IS_HT_IRQ_MD (1<<6) /* Hot temperature interrupt mode */ +#define LM80_IS_OT_IRQ_MD (1<<7) /* OS temperature interrupt mode */ + +/* LM80_FAN_CTRL Fan Devisor/RST#/OS# Register */ +#define LM80_FAN1_MD_SEL (1<<0) /* Fan 1 mode select */ +#define LM80_FAN2_MD_SEL (1<<1) /* Fan 2 mode select */ +#define LM80_FAN1_PRM_CTL (3<<2) /* Fan 1 speed control */ +#define LM80_FAN2_PRM_CTL (3<<4) /* Fan 2 speed control */ +#define LM80_FAN_OS_ENA (1<<6) /* enable OS mode on RST_OUT#/OS# pins*/ +#define LM80_FAN_RST_ENA (1<<7) /* sets RST_OUT#/OS# pins in RST mode */ + +/* LM80_TEMP_CTRL OS# Config, Temp Res. Reg */ +#define LM80_TEMP_OS_STAT (1<<0) /* mirrors the state of RST_OUT#/OS# */ +#define LM80_TEMP_OS_POL (1<<1) /* select OS# polarity */ +#define LM80_TEMP_OS_MODE (1<<2) /* selects Interrupt mode */ +#define LM80_TEMP_RES (1<<3) /* selects 9 or 11 bit temp resulution*/ +#define LM80_TEMP_LSB (0xf<<4)/* 4 LSBs of 11 bit temp data */ +#define LM80_TEMP_LSB_9 (1<<7) /* LSB of 9 bit temperature data */ + + /* 0x07 - 0x1f reserved */ +/* LM80_VT0_IN current Voltage 0 value */ +/* LM80_VT1_IN current Voltage 1 value */ +/* LM80_VT2_IN current Voltage 2 value */ +/* LM80_VT3_IN current Voltage 3 value */ +/* LM80_VT4_IN current Voltage 4 value */ +/* LM80_VT5_IN current Voltage 5 value */ +/* LM80_VT6_IN current Voltage 6 value */ +/* LM80_TEMP_IN current temperature value */ +/* LM80_FAN1_IN current Fan 1 count */ +/* LM80_FAN2_IN current Fan 2 count */ +/* LM80_VT0_HIGH_LIM high limit val for Voltage 0 */ +/* LM80_VT0_LOW_LIM low limit val for Voltage 0 */ +/* LM80_VT1_HIGH_LIM high limit val for Voltage 1 */ +/* LM80_VT1_LOW_LIM low limit val for Voltage 1 */ +/* LM80_VT2_HIGH_LIM high limit val for Voltage 2 */ +/* LM80_VT2_LOW_LIM low limit val for Voltage 2 */ +/* LM80_VT3_HIGH_LIM high limit val for Voltage 3 */ +/* LM80_VT3_LOW_LIM low limit val for Voltage 3 */ +/* LM80_VT4_HIGH_LIM high limit val for Voltage 4 */ +/* LM80_VT4_LOW_LIM low limit val for Voltage 4 */ +/* LM80_VT5_HIGH_LIM high limit val for Voltage 5 */ +/* LM80_VT5_LOW_LIM low limit val for Voltage 5 */ +/* LM80_VT6_HIGH_LIM high limit val for Voltage 6 */ +/* LM80_VT6_LOW_LIM low limit val for Voltage 6 */ +/* LM80_THOT_LIM_UP hot temperature limit (high) */ +/* LM80_THOT_LIM_LO hot temperature limit (low) */ +/* LM80_TOS_LIM_UP OS temperature limit (high) */ +/* LM80_TOS_LIM_LO OS temperature limit (low) */ +/* LM80_FAN1_COUNT_LIM Fan 1 count limit (high) */ +/* LM80_FAN2_COUNT_LIM Fan 2 count limit (low) */ + /* 0x3e - 0x3f reserved */ + +#define LM80_ADDR 0x28 /* LM80 default addr */ + +/* typedefs *******************************************************************/ + + +/* function prototypes ********************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INC_LM80_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skaddr.h linux/drivers/net/sk98lin/h/skaddr.h --- v2.3.28/linux/drivers/net/sk98lin/h/skaddr.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skaddr.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,309 @@ +/****************************************************************************** + * + * Name: skaddr.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.19 $ + * Date: $Date: 1999/05/28 10:56:07 $ + * Purpose: Header file for Address Management (MC, UC, Prom) + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skaddr.h,v $ + * Revision 1.19 1999/05/28 10:56:07 rassmann + * Editorial changes. + * + * Revision 1.18 1999/04/06 17:22:04 rassmann + * Added private "ActivePort". + * + * Revision 1.17 1999/01/14 16:18:19 rassmann + * Corrected multicast initialization. + * + * Revision 1.16 1999/01/04 10:30:36 rassmann + * SkAddrOverride only possible after SK_INIT_IO phase. + * + * Revision 1.15 1998/12/29 13:13:11 rassmann + * An address override is now preserved in the SK_INIT_IO phase. + * All functions return an int now. + * Extended parameter checking. + * + * Revision 1.14 1998/11/24 12:39:45 rassmann + * Reserved multicast entry for BPDU address. + * 13 multicast entries left for protocol. + * + * Revision 1.13 1998/11/13 17:24:32 rassmann + * Changed return value of SkAddrOverride to int. + * + * Revision 1.12 1998/11/13 16:56:19 rassmann + * Added macro SK_ADDR_COMPARE. + * Changed return type of SkAddrOverride to SK_BOOL. + * + * Revision 1.11 1998/10/28 18:16:35 rassmann + * Avoiding I/Os before SK_INIT_RUN level. + * Aligning InexactFilter. + * + * Revision 1.10 1998/10/22 11:39:10 rassmann + * Corrected signed/unsigned mismatches. + * + * Revision 1.9 1998/10/15 15:15:49 rassmann + * Changed Flags Parameters from SK_U8 to int. + * Checked with lint. + * + * Revision 1.8 1998/09/24 19:15:12 rassmann + * Code cleanup. + * + * Revision 1.7 1998/09/18 20:22:13 rassmann + * Added HW access. + * + * Revision 1.6 1998/09/04 19:40:20 rassmann + * Interface enhancements. + * + * Revision 1.5 1998/09/04 12:40:57 rassmann + * Interface cleanup. + * + * Revision 1.4 1998/09/04 12:14:13 rassmann + * Interface cleanup. + * + * Revision 1.3 1998/09/02 16:56:40 rassmann + * Updated interface. + * + * Revision 1.2 1998/08/27 14:26:09 rassmann + * Updated interface. + * + * Revision 1.1 1998/08/21 08:31:08 rassmann + * First public version. + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This module is intended to manage multicast addresses and promiscuous mode + * on GEnesis adapters. + * + * Include File Hierarchy: + * + * "skdrv1st.h" + * ... + * "sktypes.h" + * "skqueue.h" + * "skaddr.h" + * ... + * "skdrv2nd.h" + * + ******************************************************************************/ + +#ifndef __INC_SKADDR_H +#define __INC_SKADDR_H + +#ifdef __cplusplus +xxxx /* not supported yet - force error */ +extern "C" { +#endif /* cplusplus */ + +/* defines ********************************************************************/ + +#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */ +#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */ + +/* ----- Common return values ----- */ + +#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */ +#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */ +#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */ + +/* ----- Clear/Add flag bits ----- */ + +#define SK_ADDR_PERMANENT 1 /* RLMT Address */ + +/* ----- Additional Clear flag bits ----- */ + +#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */ + +/* ----- Override flag bits ----- */ + +#define SK_ADDR_VIRTUAL_ADDRESS 0 +#define SK_ADDR_PHYSICAL_ADDRESS 1 + +/* ----- Override return values ----- */ + +#define SK_ADDR_OVERRIDE_SUCCESS (SK_ADDR_SUCCESS) +#define SK_ADDR_DUPLICATE_ADDRESS 1 +#define SK_ADDR_MULTICAST_ADDRESS 2 + +/* ----- Partitioning of excact match table ----- */ + +#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */ + +#define SK_ADDR_FIRST_MATCH_RLMT 1 +#define SK_ADDR_LAST_MATCH_RLMT 2 +#define SK_ADDR_FIRST_MATCH_DRV 3 +#define SK_ADDR_LAST_MATCH_DRV (SK_ADDR_EXACT_MATCHES - 1) + +/* ----- SkAddrMcAdd/SkAddrMcUpdate return values ----- */ + +#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */ +#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */ + +/* ----- Additional SkAddrMcAdd return values ----- */ + +#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */ +#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */ +#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */ + +/* Promiscuous mode bits ----- */ + +#define SK_PROM_MODE_NONE 0 /* Normal receive. */ +#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */ +#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */ +/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */ + +/* Macros */ + +#ifndef SK_ADDR_EQUAL +#ifndef SK_ADDR_DWORD_COMPARE +#define SK_ADDR_EQUAL(A1,A2) ( \ + ((SK_U8 *)(A1))[5] == ((SK_U8 *)(A2))[5] && \ + ((SK_U8 *)(A1))[4] == ((SK_U8 *)(A2))[4] && \ + ((SK_U8 *)(A1))[3] == ((SK_U8 *)(A2))[3] && \ + ((SK_U8 *)(A1))[2] == ((SK_U8 *)(A2))[2] && \ + ((SK_U8 *)(A1))[1] == ((SK_U8 *)(A2))[1] && \ + ((SK_U8 *)(A1))[0] == ((SK_U8 *)(A2))[0]) +#else /* SK_ADDR_DWORD_COMPARE */ +#define SK_ADDR_EQUAL(A1,A2) ( \ + *(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2]) && \ + *(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])) +#endif /* SK_ADDR_DWORD_COMPARE */ +#endif /* SK_ADDR_EQUAL */ + +/* typedefs *******************************************************************/ + +typedef struct s_MacAddr { + SK_U8 a[SK_MAC_ADDR_LEN]; +} SK_MAC_ADDR; + +/* SK_FILTER is used to ensure alignment of the filter. */ +typedef union s_InexactFilter { + SK_U8 Bytes[8]; + SK_U64 Val; /* Dummy entry for alignment only. */ +} SK_FILTER64; + +typedef struct s_AddrPort { + +/* ----- Public part (read-only) ----- */ + + SK_MAC_ADDR PermanentMacAddress; /* Physical MAC Address. */ + SK_MAC_ADDR CurrentMacAddress; /* Physical MAC Address. */ + int PromMode; /* Promiscuous Mode. */ + +/* ----- Private part ----- */ + + SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */ + SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */ + SK_U32 FirstExactMatchRlmt; + SK_U32 NextExactMatchRlmt; + SK_U32 FirstExactMatchDrv; + SK_U32 NextExactMatchDrv; + SK_MAC_ADDR Exact[SK_ADDR_EXACT_MATCHES]; + SK_FILTER64 InexactFilter; /* For 64-bit hash register. */ +} SK_ADDR_PORT; + +typedef struct s_Addr { + +/* ----- Public part (read-only) ----- */ + + SK_ADDR_PORT Port[SK_MAX_MACS]; + SK_MAC_ADDR PermanentMacAddress; /* Logical MAC Address. */ + SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */ + +/* ----- Private part ----- */ + +#if 0 + SK_BOOL Initialized; /* Flag: Addr module is initialized. */ +#endif /* 0 */ + SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */ + SK_U32 ActivePort; /* Vie of module ADDR. */ +} SK_ADDR; + +/* function prototypes ********************************************************/ + +#ifndef SK_KR_PROTO + +/* Functions provided by SkRlmt */ + +/* ANSI/C++ compliant function prototypes */ + +extern int SkAddrInit( + SK_AC *pAC, + SK_IOC IoC, + int Level); + +extern int SkAddrMcClear( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 PortIdx, + int Flags); + +extern int SkAddrMcAdd( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 PortIdx, + SK_MAC_ADDR *pMc, + int Flags); + +extern int SkAddrMcUpdate( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 PortIdx); + +extern int SkAddrOverride( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 PortIdx, + SK_MAC_ADDR *pNewAddr, + int Flags); + +extern int SkAddrPromiscuousChange( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 PortIdx, + int NewPromMode); + +extern int SkAddrSwap( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 FromPortIdx, + SK_U32 ToPortIdx); + +#else /* defined(SK_KR_PROTO)) */ + +/* Non-ANSI/C++ compliant function prototypes */ + +xxxx /* not supported yet - force error */ + +#endif /* defined(SK_KR_PROTO)) */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INC_SKADDR_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skcsum.h linux/drivers/net/sk98lin/h/skcsum.h --- v2.3.28/linux/drivers/net/sk98lin/h/skcsum.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skcsum.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,223 @@ +/****************************************************************************** + * + * Name: skcsum.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.2 $ + * Date: $Date: 1998/09/04 12:16:34 $ + * Purpose: Store/verify Internet checksum in send/receive packets. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skcsum.h,v $ + * Revision 1.2 1998/09/04 12:16:34 mhaveman + * Checked in for Stephan to allow compilation. + * -Added definition SK_CSUM_EVENT_CLEAR_PROTO_STATS to clear statistic + * -Added prototype for SkCsEvent() + * + * Revision 1.1 1998/09/01 15:36:53 swolf + * initial revision + * + * 01-Sep-1998 sw Created. + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * Public header file for the "GEnesis" common module "CSUM". + * + * "GEnesis" is an abbreviation of "Gigabit Ethernet Network System in Silicon" + * and is the code name of this SysKonnect project. + * + * Compilation Options: + * + * SK_USE_CSUM - Define if CSUM is to be used. Otherwise, CSUM will be an + * empty module. + * + * SKCS_OVERWRITE_PROTO - Define to overwrite the default protocol id + * definitions. In this case, all SKCS_PROTO_xxx definitions must be made + * external. + * + * SKCS_OVERWRITE_STATUS - Define to overwrite the default return status + * definitions. In this case, all SKCS_STATUS_xxx definitions must be made + * external. + * + * Include File Hierarchy: + * + * "h/skcsum.h" + * "h/sktypes.h" + * "h/skqueue.h" + * + ******************************************************************************/ + +#ifndef __INC_SKCSUM_H +#define __INC_SKCSUM_H + +#include "h/sktypes.h" +#include "h/skqueue.h" + +/* defines ********************************************************************/ + +/* + * Define the default bit flags for 'SKCS_PACKET_INFO.ProtocolFlags' if no user + * overwrite. + */ +#ifndef SKCS_OVERWRITE_PROTO /* User overwrite? */ +#define SKCS_PROTO_IP 0x1 /* IP (Internet Protocol version 4) */ +#define SKCS_PROTO_TCP 0x2 /* TCP (Transmission Control Protocol) */ +#define SKCS_PROTO_UDP 0x4 /* UDP (User Datagram Protocol) */ + +/* Indices for protocol statistics. */ +#define SKCS_PROTO_STATS_IP 0 +#define SKCS_PROTO_STATS_UDP 1 +#define SKCS_PROTO_STATS_TCP 2 +#define SKCS_NUM_PROTOCOLS 3 /* Number of supported protocols. */ +#endif /* !SKCS_OVERWRITE_PROTO */ + +/* + * Define the default SKCS_STATUS type and values if no user overwrite. + * + * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. + * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. + * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). + * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). + * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). + * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). + * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. + * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. + */ +#ifndef SKCS_OVERWRITE_STATUS /* User overwrite? */ +#define SKCS_STATUS int /* Define status type. */ + +#define SKCS_STATUS_UNKNOWN_IP_VERSION 1 +#define SKCS_STATUS_IP_CSUM_ERROR 2 +#define SKCS_STATUS_IP_FRAGMENT 3 +#define SKCS_STATUS_IP_CSUM_OK 4 +#define SKCS_STATUS_TCP_CSUM_ERROR 5 +#define SKCS_STATUS_UDP_CSUM_ERROR 6 +#define SKCS_STATUS_TCP_CSUM_OK 7 +#define SKCS_STATUS_UDP_CSUM_OK 8 +#endif /* !SKCS_OVERWRITE_STATUS */ + +/* Clear protocol statistics event. */ +#define SK_CSUM_EVENT_CLEAR_PROTO_STATS 1 + +/* + * Add two values in one's complement. + * + * Note: One of the two input values may be "longer" than 16-bit, but then the + * resulting sum may be 17 bits long. In this case, add zero to the result using + * SKCS_OC_ADD() again. + * + * Result = Value1 + Value2 + */ +#define SKCS_OC_ADD(Result, Value1, Value2) { \ + unsigned long Sum; \ + \ + Sum = (unsigned long) (Value1) + (unsigned long) (Value2); \ + /* Add-in any carry. */ \ + (Result) = (Sum & 0xffff) + (Sum >> 16); \ +} + +/* + * Subtract two values in one's complement. + * + * Result = Value1 - Value2 + */ +#define SKCS_OC_SUB(Result, Value1, Value2) \ + SKCS_OC_ADD((Result), (Value1), ~(Value2) & 0xffff) + +/* typedefs *******************************************************************/ + +/* + * SKCS_PROTO_STATS - The CSUM protocol statistics structure. + * + * There is one instance of this structure for each protocol supported. + */ +typedef struct s_CsProtocolStatistics { + SK_U64 RxOkCts; /* Receive checksum ok. */ + SK_U64 RxUnableCts; /* Unable to verify receive checksum. */ + SK_U64 RxErrCts; /* Receive checksum error. */ + SK_U64 TxOkCts; /* Transmit checksum ok. */ + SK_U64 TxUnableCts; /* Unable to verify transmit checksum. */ +} SKCS_PROTO_STATS; + +/* + * s_Csum - The CSUM module context structure. + */ +typedef struct s_Csum { + /* Enabled receive SK_PROTO_XXX bit flags. */ + unsigned ReceiveFlags; + + /* The protocol statistics structure; one per supported protocol. */ + SKCS_PROTO_STATS ProtoStats[SKCS_NUM_PROTOCOLS]; +} SK_CSUM; + +/* + * SKCS_PACKET_INFO - The packet information structure. + */ +typedef struct s_CsPacketInfo { + /* Bit field specifiying the desired/found protocols. */ + unsigned ProtocolFlags; + + /* Length of complete IP header, including any option fields. */ + unsigned IpHeaderLength; + + /* IP header checksum. */ + unsigned IpHeaderChecksum; + + /* TCP/UDP pseudo header checksum. */ + unsigned PseudoHeaderChecksum; +} SKCS_PACKET_INFO; + +/* function prototypes ********************************************************/ + +#ifndef SkCsCalculateChecksum +extern unsigned SkCsCalculateChecksum( + void *pData, + unsigned Length); +#endif + +extern int SkCsEvent( + SK_AC *pAc, + SK_IOC Ioc, + SK_U32 Event, + SK_EVPARA Param); + +extern SKCS_STATUS SkCsGetReceiveInfo( + SK_AC *pAc, + void *pIpHeader, + unsigned Checksum1, + unsigned Checksum2); + +extern void SkCsGetSendInfo( + SK_AC *pAc, + void *pIpHeader, + SKCS_PACKET_INFO *pPacketInfo); + +extern void SkCsSetReceiveFlags( + SK_AC *pAc, + unsigned ReceiveFlags, + unsigned *pChecksum1Offset, + unsigned *pChecksum2Offset); + +#endif /* __INC_SKCSUM_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skdebug.h linux/drivers/net/sk98lin/h/skdebug.h --- v2.3.28/linux/drivers/net/sk98lin/h/skdebug.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skdebug.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,111 @@ +/****************************************************************************** + * + * Name: skdebug.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.9 $ + * Date: $Date: 1999/09/14 14:02:43 $ + * Purpose: SK specific DEBUG support + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * $Log: skdebug.h,v $ + * Revision 1.9 1999/09/14 14:02:43 rwahl + * Added SK_DBGMOD_PECP. + * + * Revision 1.8 1998/11/25 08:31:54 gklug + * fix: no C++ comments allowed in common sources + * + * Revision 1.7 1998/11/24 16:47:24 swolf + * Driver may now define its own SK_DBG_MSG() (eg. in "h/skdrv1st.h"). + * + * Revision 1.6 1998/10/28 10:23:55 rassmann + * ADDED SK_DBGMOD_ADDR. + * + * Revision 1.5 1998/10/22 09:43:55 gklug + * add: CSUM module + * + * Revision 1.4 1998/10/01 07:54:44 gklug + * add: PNMI debug module + * + * Revision 1.3 1998/09/18 08:32:34 afischer + * Macros changed according ssr-spec.: + * SK_DBG_MODCHK -> SK_DBG_CHKMOD + * SK_DBG_CATCHK -> SK_DBG_CHKCAT + * + * Revision 1.2 1998/07/03 14:38:25 malthoff + * Add category SK_DBGCAT_FATAL. + * + * Revision 1.1 1998/06/19 13:39:01 malthoff + * created. + * + * + ******************************************************************************/ + +#ifndef __INC_SKDEBUG_H +#define __INC_SKDEBUG_H + +#ifdef DEBUG +#ifndef SK_DBG_MSG +#define SK_DBG_MSG(pAC,comp,cat,arg) \ + if ( ((comp) & SK_DBG_CHKMOD(pAC)) && \ + ((cat) & SK_DBG_CHKCAT(pAC)) ) { \ + SK_DBG_PRINTF arg ; \ + } +#endif +#else +#define SK_DBG_MSG(pAC,comp,lev,arg) +#endif + +/* PLS NOTE: + * ========= + * Due to any restrictions of kernel printf routines do not use other + * format identifiers as: %x %d %c %s . + * Never use any combined format identifiers such as: %lx %ld in your + * printf - argument (arg) because some OS specific kernel printfs may + * only support some basic identifiers. + */ + +/* Debug modules */ + +#define SK_DBGMOD_MERR 0x00000001L /* general module error indication */ +#define SK_DBGMOD_HWM 0x00000002L /* Hardware init module */ +#define SK_DBGMOD_RLMT 0x00000004L /* RLMT module */ +#define SK_DBGMOD_VPD 0x00000008L /* VPD module */ +#define SK_DBGMOD_I2C 0x00000010L /* I2C module */ +#define SK_DBGMOD_PNMI 0x00000020L /* PNMI module */ +#define SK_DBGMOD_CSUM 0x00000040L /* CSUM module */ +#define SK_DBGMOD_ADDR 0x00000080L /* ADDR module */ +#define SK_DBGMOD_PECP 0x00000100L /* PECP module */ + +/* Debug events */ + +#define SK_DBGCAT_INIT 0x00000001L /* module/driver initialization */ +#define SK_DBGCAT_CTRL 0x00000002L /* controlling: add/rmv MCA/MAC + * and other controls (IOCTL) + */ +#define SK_DBGCAT_ERR 0x00000004L /* error handling paths */ +#define SK_DBGCAT_TX 0x00000008L /* transmit path */ +#define SK_DBGCAT_RX 0x00000010L /* receive path */ +#define SK_DBGCAT_IRQ 0x00000020L /* general IRQ handling */ +#define SK_DBGCAT_QUEUE 0x00000040L /* any queue management */ +#define SK_DBGCAT_DUMP 0x00000080L /* large data output e.g. hex dump */ +#define SK_DBGCAT_FATAL 0x00000100L /* large data output e.g. hex dump */ + +#endif /* __INC_SKDEBUG_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skdrv1st.h linux/drivers/net/sk98lin/h/skdrv1st.h --- v2.3.28/linux/drivers/net/sk98lin/h/skdrv1st.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skdrv1st.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,207 @@ +/****************************************************************************** + * + * Name: skdrv1st.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.6 $ + * Date: $Date: 1999/07/27 08:03:33 $ + * Purpose: First header file for driver and all other modules + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skdrv1st.h,v $ + * Revision 1.6 1999/07/27 08:03:33 cgoos + * Changed SK_IN/OUT macros to readX/writeX instead of memory + * accesses (necessary for ALPHA). + * + * Revision 1.5 1999/07/23 12:10:21 cgoos + * Removed SK_RLMT_SLOW_LOOKAHEAD define. + * + * Revision 1.4 1999/07/14 12:31:13 cgoos + * Added SK_RLMT_SLOW_LOOKAHEAD define. + * + * Revision 1.3 1999/04/07 10:12:54 cgoos + * Added check for KERNEL and OPTIMIZATION defines. + * + * Revision 1.2 1999/03/01 08:51:47 cgoos + * Fixed pcibios_read/write definitions. + * + * Revision 1.1 1999/02/16 07:40:49 cgoos + * First version. + * + * + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This is the first include file of the driver, which includes all + * neccessary system header files and some of the GEnesis header files. + * It also defines some basic items. + * + * Include File Hierarchy: + * + * see skge.c + * + ******************************************************************************/ + +#ifndef __INC_SKDRV1ST_H +#define __INC_SKDRV1ST_H + + +typedef struct s_AC SK_AC; + +/* override some default functions with optimized linux functions */ + +#define SK_PNMI_STORE_U16(p,v) memcpy((char*)(p),(char*)&(v),2) +#define SK_PNMI_STORE_U32(p,v) memcpy((char*)(p),(char*)&(v),4) +#define SK_PNMI_STORE_U64(p,v) memcpy((char*)(p),(char*)&(v),8) +#define SK_PNMI_READ_U16(p,v) memcpy((char*)&(v),(char*)(p),2) +#define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),2) +#define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),2) + +#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff) + +#define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6)) + + +#if !defined(__OPTIMIZE__) || !defined(__KERNEL__) +#warning You must compile this file with the correct options! +#warning See the last lines of the source file. +#error You must compile this driver with "-O". +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "h/sktypes.h" +#include "h/skerror.h" +#include "h/skdebug.h" +#include "h/lm80.h" +#include "h/xmac_ii.h" + +#ifdef __LITTLE_ENDIAN +#define SK_LITTLE_ENDIAN +#else +#define SK_BIG_ENDIAN +#endif + + +/* we use gethrtime(), return unit: nanoseconds */ +#define SK_TICKS_PER_SEC HZ + +#define SK_MEM_MAPPED_IO + +// #define SK_RLMT_SLOW_LOOKAHEAD + +#define SK_MAX_MACS 2 + +#define SK_IOC char* + +typedef struct s_DrvRlmtMbuf SK_MBUF; + +#define SK_CONST64 INT64_C +#define SK_CONSTU64 UINT64_C + +#define SK_MEMCPY(dest,src,size) memcpy(dest,src,size) +#define SK_MEMCMP(s1,s2,size) memcmp(s1,s2,size) +#define SK_MEMSET(dest,val,size) memset(dest,val,size) +#define SK_STRLEN(pStr) strlen((char*)pStr) +#define SK_STRNCPY(pDest,pSrc,size) strncpy((char*)pDest,(char*)pSrc,size) +#define SK_STRCMP(pStr1,pStr2) strcmp((char*)pStr1,(char*)pStr2) + +/* macros to access the adapter */ +#define SK_OUT8(b,a,v) writeb(v, (b+a)) +#define SK_OUT16(b,a,v) writew(v, (b+a)) +#define SK_OUT32(b,a,v) writel(v, (b+a)) +#define SK_IN8(b,a,pv) (*(pv) = readb(b+a)) +#define SK_IN16(b,a,pv) (*(pv) = readw(b+a)) +#define SK_IN32(b,a,pv) (*(pv) = readl(b+a)) + +#define int8_t char +#define int16_t short +#define int32_t long +#define int64_t long long +#define uint8_t u_char +#define uint16_t u_short +#define uint32_t u_long +#define uint64_t unsigned long long +#define t_scalar_t int +#define t_uscalar_t unsigned int +#define uintptr_t unsigned long + +#define __CONCAT__(A,B) A##B + +#define INT32_C(a) __CONCAT__(a,L) +#define INT64_C(a) __CONCAT__(a,LL) +#define UINT32_C(a) __CONCAT__(a,UL) +#define UINT64_C(a) __CONCAT__(a,ULL) + +#ifdef DEBUG +#define SK_DBG_PRINTF printk +/* those come from the makefile */ +#define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD) +#define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT) + +extern void SkDbgPrintf(const char *format,...); + +#define SK_DBGMOD_DRV 0x00010000 + +/**** possible driver debug categories ********************************/ +#define SK_DBGCAT_DRV_ENTRY 0x00010000 +#define SK_DBGCAT_DRV_SAP 0x00020000 +#define SK_DBGCAT_DRV_MCA 0x00040000 +#define SK_DBGCAT_DRV_TX_PROGRESS 0x00080000 +#define SK_DBGCAT_DRV_RX_PROGRESS 0x00100000 +#define SK_DBGCAT_DRV_PROGRESS 0x00200000 +#define SK_DBGCAT_DRV_MSG 0x00400000 +#define SK_DBGCAT_DRV_PROM 0x00800000 +#define SK_DBGCAT_DRV_TX_FRAME 0x01000000 +#define SK_DBGCAT_DRV_ERROR 0x02000000 +#define SK_DBGCAT_DRV_INT_SRC 0x04000000 +#define SK_DBGCAT_DRV_EVENT 0x08000000 + +#endif /* DEBUG */ + +#define SK_ERR_LOG SkErrorLog + +extern void SkErrorLog(SK_AC*, int, int, char*); + +#endif /* __INC_SKDRV1ST_H */ + diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skdrv2nd.h linux/drivers/net/sk98lin/h/skdrv2nd.h --- v2.3.28/linux/drivers/net/sk98lin/h/skdrv2nd.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skdrv2nd.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,445 @@ +/****************************************************************************** + * + * Name: skdrv2nd.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.7 $ + * Date: $Date: 1999/09/28 12:38:21 $ + * Purpose: Second header file for driver and all other modules + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skdrv2nd.h,v $ + * Revision 1.7 1999/09/28 12:38:21 cgoos + * Added CheckQueue to SK_AC. + * + * Revision 1.6 1999/07/27 08:04:05 cgoos + * Added checksumming variables to SK_AC. + * + * Revision 1.5 1999/03/29 12:33:26 cgoos + * Rreversed to fine lock granularity. + * + * Revision 1.4 1999/03/15 12:14:02 cgoos + * Added DriverLock to SK_AC. + * Removed other locks. + * + * Revision 1.3 1999/03/01 08:52:27 cgoos + * Changed pAC->PciDev declaration. + * + * Revision 1.2 1999/02/18 10:57:14 cgoos + * Removed SkDrvTimeStamp prototype. + * Fixed SkGeOsGetTime prototype. + * + * Revision 1.1 1999/02/16 07:41:01 cgoos + * First version. + * + * + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This is the second include file of the driver, which includes all other + * neccessary files and defines all structures and constants used by the + * driver and the common modules. + * + * Include File Hierarchy: + * + * see skge.c + * + ******************************************************************************/ + +#ifndef __INC_SKDRV2ND_H +#define __INC_SKDRV2ND_H + +#include "h/skqueue.h" +#include "h/skgehwt.h" +#include "h/sktimer.h" +#include "h/ski2c.h" +#include "h/skgepnmi.h" +#include "h/skvpd.h" +#include "h/skgehw.h" +#include "h/skgeinit.h" +#include "h/skaddr.h" +#include "h/skgesirq.h" +#include "h/skcsum.h" +#include "h/skrlmt.h" +#include "h/skgedrv.h" + +/* global function prototypes ******************************************/ +extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned); +extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*); +extern SK_U64 SkOsGetTime(SK_AC*); +extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*); +extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*); +extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*); +extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32); +extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16); +extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8); +extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA); + +struct s_DrvRlmtMbuf { + SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */ + SK_U8 *pData; /* Data buffer (virtually contig.). */ + unsigned Size; /* Data buffer size. */ + unsigned Length; /* Length of packet (<= Size). */ + SK_U32 PortIdx; /* Receiving/transmitting port. */ +#ifdef SK_RLMT_MBUF_PRIVATE + SK_RLMT_MBUF Rlmt; /* Private part for RLMT. */ +#endif /* SK_RLMT_MBUF_PRIVATE */ + struct sk_buff *pOs; /* Pointer to message block */ +}; + + + +/* + * ioctl definitions + */ +#define SK_IOCTL_BASE (SIOCDEVPRIVATE) +#define SK_IOCTL_GETMIB (SK_IOCTL_BASE + 0) +#define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1) +#define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2) + +typedef struct s_IOCTL SK_GE_IOCTL; + +struct s_IOCTL { + char* pData; + unsigned int Len; +}; + + +/* + * define sizes of descriptor rings in bytes + */ + +#define TX_RING_SIZE (8*1024) +#define RX_RING_SIZE (24*1024) + +/* + * Buffer size for ethernet packets + */ +#define ETH_BUF_SIZE 1540 +#define ETH_MAX_MTU 1514 +#define ETH_MIN_MTU 60 +#define ETH_MULTICAST_BIT 0x01 +#define SK_JUMBO_MTU 9000 + +/* + * transmit priority selects the queue: LOW=asynchron, HIGH=synchron + */ +#define TX_PRIO_LOW 0 +#define TX_PRIO_HIGH 1 + +/* + * alignment of rx/tx descriptors + */ +#define DESCR_ALIGN 8 + +/* + * definitions for pnmi. TODO + */ +#define SK_DRIVER_RESET(pAC, IoC) 0 +#define SK_DRIVER_SENDEVENT(pAC, IoC) 0 +#define SK_DRIVER_SELFTEST(pAC, IoC) 0 + +/* TX and RX descriptors *****************************************************/ + +typedef struct s_RxD RXD; /* the receive descriptor */ + +struct s_RxD { + volatile SK_U32 RBControl; /* Receive Buffer Control */ + SK_U32 VNextRxd; /* Next receive descriptor,low dword */ + SK_U32 VDataLow; /* Receive buffer Addr, low dword */ + SK_U32 VDataHigh; /* Receive buffer Addr, high dword */ + SK_U32 FrameStat; /* Receive Frame Status word */ + SK_U32 TimeStamp; /* Time stamp from XMAX */ + SK_U32 TcpSums; /* TCP Sum 2 / TCP Sum 1 */ + SK_U32 TcpSumStarts; /* TCP Sum Start 2 / TCP Sum Start 1 */ + RXD *pNextRxd; /* Pointer to next Rxd */ + struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */ +}; + +typedef struct s_TxD TXD; /* the transmit descriptor */ + +struct s_TxD { + volatile SK_U32 TBControl; /* Transmit Buffer Control */ + SK_U32 VNextTxd; /* Next transmit descriptor,low dword */ + SK_U32 VDataLow; /* Transmit Buffer Addr, low dword */ + SK_U32 VDataHigh; /* Transmit Buffer Addr, high dword */ + SK_U32 FrameStat; /* Transmit Frame Status Word */ + SK_U32 TcpSumOfs; /* Reserved / TCP Sum Offset */ + SK_U32 TcpSumStWr; /* TCP Sum Start / TCP Sum Write */ + SK_U32 TcpReserved; /* not used */ + TXD *pNextTxd; /* Pointer to next Txd */ + struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */ +}; + + +/* definition of flags in descriptor control field */ +#define RX_CTRL_OWN_BMU UINT32_C(0x80000000) +#define RX_CTRL_STF UINT32_C(0x40000000) +#define RX_CTRL_EOF UINT32_C(0x20000000) +#define RX_CTRL_EOB_IRQ UINT32_C(0x10000000) +#define RX_CTRL_EOF_IRQ UINT32_C(0x08000000) +#define RX_CTRL_DEV_NULL UINT32_C(0x04000000) +#define RX_CTRL_STAT_VALID UINT32_C(0x02000000) +#define RX_CTRL_TIME_VALID UINT32_C(0x01000000) +#define RX_CTRL_CHECK_DEFAULT UINT32_C(0x00550000) +#define RX_CTRL_CHECK_CSUM UINT32_C(0x00560000) +#define RX_CTRL_LEN_MASK UINT32_C(0x0000FFFF) + +#define TX_CTRL_OWN_BMU UINT32_C(0x80000000) +#define TX_CTRL_STF UINT32_C(0x40000000) +#define TX_CTRL_EOF UINT32_C(0x20000000) +#define TX_CTRL_EOB_IRQ UINT32_C(0x10000000) +#define TX_CTRL_EOF_IRQ UINT32_C(0x08000000) +#define TX_CTRL_ST_FWD UINT32_C(0x04000000) +#define TX_CTRL_DISAB_CRC UINT32_C(0x02000000) +#define TX_CTRL_SOFTWARE UINT32_C(0x01000000) +#define TX_CTRL_CHECK_DEFAULT UINT32_C(0x00550000) +#define TX_CTRL_CHECK_CSUM UINT32_C(0x00560000) +#define TX_CTRL_LEN_MASK UINT32_C(0x0000FFFF) + + + +/* The offsets of registers in the TX and RX queue control io area ***********/ + +#define RX_Q_BUF_CTRL_CNT 0x00 +#define RX_Q_NEXT_DESCR_LOW 0x04 +#define RX_Q_BUF_ADDR_LOW 0x08 +#define RX_Q_BUF_ADDR_HIGH 0x0c +#define RX_Q_FRAME_STAT 0x10 +#define RX_Q_TIME_STAMP 0x14 +#define RX_Q_CSUM_1_2 0x18 +#define RX_Q_CSUM_START_1_2 0x1c +#define RX_Q_CUR_DESCR_LOW 0x20 +#define RX_Q_DESCR_HIGH 0x24 +#define RX_Q_CUR_ADDR_LOW 0x28 +#define RX_Q_CUR_ADDR_HIGH 0x2c +#define RX_Q_CUR_BYTE_CNT 0x30 +#define RX_Q_CTRL 0x34 +#define RX_Q_FLAG 0x38 +#define RX_Q_TEST1 0x3c +#define RX_Q_TEST2 0x40 +#define RX_Q_TEST3 0x44 + +#define TX_Q_BUF_CTRL_CNT 0x00 +#define TX_Q_NEXT_DESCR_LOW 0x04 +#define TX_Q_BUF_ADDR_LOW 0x08 +#define TX_Q_BUF_ADDR_HIGH 0x0c +#define TX_Q_FRAME_STAT 0x10 +#define TX_Q_CSUM_START 0x14 +#define TX_Q_CSUM_START_POS 0x18 +#define TX_Q_RESERVED 0x1c +#define TX_Q_CUR_DESCR_LOW 0x20 +#define TX_Q_DESCR_HIGH 0x24 +#define TX_Q_CUR_ADDR_LOW 0x28 +#define TX_Q_CUR_ADDR_HIGH 0x2c +#define TX_Q_CUR_BYTE_CNT 0x30 +#define TX_Q_CTRL 0x34 +#define TX_Q_FLAG 0x38 +#define TX_Q_TEST1 0x3c +#define TX_Q_TEST2 0x40 +#define TX_Q_TEST3 0x44 + +/* definition of flags in the queue control field */ +#define RX_Q_CTRL_POLL_ON 0x00000080 +#define RX_Q_CTRL_POLL_OFF 0x00000040 +#define RX_Q_CTRL_STOP 0x00000020 +#define RX_Q_CTRL_START 0x00000010 +#define RX_Q_CTRL_CLR_I_PAR 0x00000008 +#define RX_Q_CTRL_CLR_I_EOB 0x00000004 +#define RX_Q_CTRL_CLR_I_EOF 0x00000002 +#define RX_Q_CTRL_CLR_I_ERR 0x00000001 + +#define TX_Q_CTRL_POLL_ON 0x00000080 +#define TX_Q_CTRL_POLL_OFF 0x00000040 +#define TX_Q_CTRL_STOP 0x00000020 +#define TX_Q_CTRL_START 0x00000010 +#define TX_Q_CTRL_CLR_I_EOB 0x00000004 +#define TX_Q_CTRL_CLR_I_EOF 0x00000002 +#define TX_Q_CTRL_CLR_I_ERR 0x00000001 + + +/* Interrupt bits in the interrupts source register **************************/ +#define IRQ_HW_ERROR 0x80000000 +#define IRQ_RESERVED 0x40000000 +#define IRQ_PKT_TOUT_RX1 0x20000000 +#define IRQ_PKT_TOUT_RX2 0x10000000 +#define IRQ_PKT_TOUT_TX1 0x08000000 +#define IRQ_PKT_TOUT_TX2 0x04000000 +#define IRQ_I2C_READY 0x02000000 +#define IRQ_SW 0x01000000 +#define IRQ_EXTERNAL_REG 0x00800000 +#define IRQ_TIMER 0x00400000 +#define IRQ_MAC1 0x00200000 +#define IRQ_LINK_SYNC_C_M1 0x00100000 +#define IRQ_MAC2 0x00080000 +#define IRQ_LINK_SYNC_C_M2 0x00040000 +#define IRQ_EOB_RX1 0x00020000 +#define IRQ_EOF_RX1 0x00010000 +#define IRQ_CHK_RX1 0x00008000 +#define IRQ_EOB_RX2 0x00004000 +#define IRQ_EOF_RX2 0x00002000 +#define IRQ_CHK_RX2 0x00001000 +#define IRQ_EOB_SY_TX1 0x00000800 +#define IRQ_EOF_SY_TX1 0x00000400 +#define IRQ_CHK_SY_TX1 0x00000200 +#define IRQ_EOB_AS_TX1 0x00000100 +#define IRQ_EOF_AS_TX1 0x00000080 +#define IRQ_CHK_AS_TX1 0x00000040 +#define IRQ_EOB_SY_TX2 0x00000020 +#define IRQ_EOF_SY_TX2 0x00000010 +#define IRQ_CHK_SY_TX2 0x00000008 +#define IRQ_EOB_AS_TX2 0x00000004 +#define IRQ_EOF_AS_TX2 0x00000002 +#define IRQ_CHK_AS_TX2 0x00000001 + +#define DRIVER_IRQS (IRQ_SW | IRQ_EOF_RX1 | IRQ_EOF_RX2 | \ + IRQ_EOF_SY_TX1 | IRQ_EOF_AS_TX1 | \ + IRQ_EOF_SY_TX2 | IRQ_EOF_AS_TX2) + +#define SPECIAL_IRQS (IRQ_HW_ERROR | IRQ_PKT_TOUT_RX1 | IRQ_PKT_TOUT_RX2 | \ + IRQ_PKT_TOUT_TX1 | IRQ_PKT_TOUT_TX2 | \ + IRQ_I2C_READY | IRQ_EXTERNAL_REG | IRQ_TIMER | \ + IRQ_MAC1 | IRQ_LINK_SYNC_C_M1 | \ + IRQ_MAC2 | IRQ_LINK_SYNC_C_M2 | \ + IRQ_CHK_RX1 | IRQ_CHK_RX2 | \ + IRQ_CHK_SY_TX1 | IRQ_CHK_AS_TX1 | \ + IRQ_CHK_SY_TX2 | IRQ_CHK_AS_TX2) + +#define IRQ_MASK (IRQ_SW | IRQ_EOB_RX1 | IRQ_EOF_RX1 | \ + IRQ_EOB_RX2 | IRQ_EOF_RX2 | \ + IRQ_EOB_SY_TX1 | IRQ_EOF_SY_TX1 | \ + IRQ_EOB_AS_TX1 | IRQ_EOF_AS_TX1 | \ + IRQ_EOB_SY_TX2 | IRQ_EOF_SY_TX2 | \ + IRQ_EOB_AS_TX2 | IRQ_EOF_AS_TX2 | \ + IRQ_HW_ERROR | IRQ_PKT_TOUT_RX1 | IRQ_PKT_TOUT_RX2 | \ + IRQ_PKT_TOUT_TX1 | IRQ_PKT_TOUT_TX2 | \ + IRQ_I2C_READY | IRQ_EXTERNAL_REG | IRQ_TIMER | \ + IRQ_MAC1 | \ + IRQ_MAC2 | \ + IRQ_CHK_RX1 | IRQ_CHK_RX2 | \ + IRQ_CHK_SY_TX1 | IRQ_CHK_AS_TX1 | \ + IRQ_CHK_SY_TX2 | IRQ_CHK_AS_TX2) + +#define IRQ_HWE_MASK 0x00000FFF /* enable all HW irqs */ + +typedef struct s_TxPort TX_PORT; + +struct s_TxPort { + /* the transmit descriptor rings */ + caddr_t pTxDescrRing; /* descriptor area memory */ + SK_U64 VTxDescrRing; /* descr. area bus virt. addr. */ + TXD *pTxdRingHead; /* Head of Tx rings */ + TXD *pTxdRingTail; /* Tail of Tx rings */ + TXD *pTxdRingPrev; /* descriptor sent previously */ + int TxdRingFree; /* # of free entrys */ + spinlock_t TxDesRingLock; /* serialize descriptor accesses */ + caddr_t HwAddr; /* bmu registers address */ + int PortIndex; /* index number of port (0 or 1) */ +}; + +typedef struct s_RxPort RX_PORT; + +struct s_RxPort { + /* the receive descriptor rings */ + caddr_t pRxDescrRing; /* descriptor area memory */ + SK_U64 VRxDescrRing; /* descr. area bus virt. addr. */ + RXD *pRxdRingHead; /* Head of Rx rings */ + RXD *pRxdRingTail; /* Tail of Rx rings */ + RXD *pRxdRingPrev; /* descriptor given to BMU previously */ + int RxdRingFree; /* # of free entrys */ + spinlock_t RxDesRingLock; /* serialize descriptor accesses */ + int RxFillLimit; /* limit for buffers in ring */ + caddr_t HwAddr; /* bmu registers address */ + int PortIndex; /* index number of port (0 or 1) */ +}; + +typedef struct s_PerStrm PER_STRM; + +#define SK_ALLOC_IRQ 0x00000001 + +/**************************************************************************** + * Per board structure / Adapter Context structure: + * Allocated within attach(9e) and freed within detach(9e). + * Contains all 'per device' necessary handles, flags, locks etc.: + */ +struct s_AC { + SK_GEINIT GIni; /* GE init struct */ + SK_PNMI Pnmi; /* PNMI data struct */ + SK_VPD vpd; /* vpd data struct */ + SK_QUEUE Event; /* Event queue */ + SK_HWT Hwt; /* Hardware Timer control struct */ + SK_TIMCTRL Tim; /* Software Timer control struct */ + SK_I2C I2c; /* I2C relevant data structure */ + SK_ADDR Addr; /* for Address module */ + SK_CSUM Csum; /* for checksum module */ + SK_RLMT Rlmt; /* for rlmt module */ + spinlock_t SlowPathLock; /* Normal IRQ lock */ + SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */ + int RlmtMode; /* link check mode to set */ + + SK_IOC IoBase; /* register set of adapter */ + int BoardLevel; /* level of active hw init (0-2) */ + char DeviceStr[80]; /* adapter string from vpd */ + SK_U32 AllocFlag; /* flag allocation of resources */ + struct pci_dev PciDev; /* for access to pci config space */ + SK_U32 PciDevId; /* pci device id */ + struct net_device *dev; /* pointer to device struct */ + char Name[30]; /* driver name */ + struct net_device *Next; /* link all devices (for clearing) */ + int RxBufSize; /* length of receive buffers */ + struct net_device_stats stats; /* linux 'netstat -i' statistics */ + int Index; /* internal board index number */ + + /* adapter RAM sizes for queues of active port */ + int RxQueueSize; /* memory used for receive queue */ + int TxSQueueSize; /* memory used for sync. tx queue */ + int TxAQueueSize; /* memory used for async. tx queue */ + + int PromiscCount; /* promiscuous mode counter */ + int AllMultiCount; /* allmulticast mode counter */ + int MulticCount; /* number of different MC */ + /* addresses for this board */ + /* (may be more than HW can)*/ + + int ActivePort; /* the active XMAC port */ + int TxDescrPerRing; /* # of descriptors per tx ring */ + int RxDescrPerRing; /* # of descriptors per rx ring */ + + + caddr_t pDescrMem; /* Pointer to the descriptor area */ + /* the port structures with descriptor rings */ + TX_PORT TxPort[SK_MAX_MACS][2]; + RX_PORT RxPort[SK_MAX_MACS]; + + unsigned int CsOfs1; /* for checksum calculation */ + unsigned int CsOfs2; /* for checksum calculation */ + SK_U32 CsOfs; /* for checksum calculation */ + + SK_BOOL CheckQueue; /* check event queue soon */ +}; + + +#endif /* __INC_SKDRV2ND_H */ + diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skerror.h linux/drivers/net/sk98lin/h/skerror.h --- v2.3.28/linux/drivers/net/sk98lin/h/skerror.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skerror.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,75 @@ +/****************************************************************************** + * + * Name: skerror.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.3 $ + * Date: $Date: 1999/09/14 14:04:42 $ + * Purpose: SK specific Error log support + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * $Log: skerror.h,v $ + * Revision 1.3 1999/09/14 14:04:42 rwahl + * Added error base SK_ERRBASE_PECP. + * Changed error base for driver. + * + * Revision 1.2 1998/08/11 11:15:41 gklug + * chg: comments + * + * Revision 1.1 1998/08/11 11:09:38 gklug + * add: error bases + * add: error Classes + * first version + * + * + * + ******************************************************************************/ + +#ifndef _INC_SKERROR_H_ +#define _INC_SKERROR_H_ + +/* + * Define the Error Classes + */ +#define SK_ERRCL_OTHER (0) /* Other error */ +#define SK_ERRCL_CONFIG (1L<<0) /* Configuration error */ +#define SK_ERRCL_INIT (1L<<1) /* Initialization error */ +#define SK_ERRCL_NORES (1L<<2) /* Out of resources error */ +#define SK_ERRCL_SW (1L<<3) /* internal Software error */ +#define SK_ERRCL_HW (1L<<4) /* Hardware failure */ +#define SK_ERRCL_COMM (1L<<5) /* Communication error */ + + +/* + * Define Error code bases + */ +#define SK_ERRBASE_RLMT 100 /* Base Error number for RLMT */ +#define SK_ERRBASE_HWINIT 200 /* Base Error number for HWInit */ +#define SK_ERRBASE_VPD 300 /* Base Error number for VPD */ +#define SK_ERRBASE_PNMI 400 /* Base Error number for PNMI */ +#define SK_ERRBASE_CSUM 500 /* Base Error number for Checksum */ +#define SK_ERRBASE_SIRQ 600 /* Base Error number for Special IRQ */ +#define SK_ERRBASE_I2C 700 /* Base Error number for i2C module */ +#define SK_ERRBASE_QUEUE 800 /* Base Error number for Scheduler */ +#define SK_ERRBASE_ADDR 900 /* Base Error number for Address mod. */ +#define SK_ERRBASE_PECP 1000 /* Base Error number for PECP */ +#define SK_ERRBASE_DRV 1100 /* Base Error number for Driver */ + +#endif /* _INC_SKERROR_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgedrv.h linux/drivers/net/sk98lin/h/skgedrv.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgedrv.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgedrv.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,62 @@ +/****************************************************************************** + * + * Name: skgedrv.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.3 $ + * Date: $Date: 1998/12/01 13:31:39 $ + * Purpose: Interface with the driver + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgedrv.h,v $ + * Revision 1.3 1998/12/01 13:31:39 cgoos + * SWITCH INTERN Event added. + * + * Revision 1.2 1998/11/25 08:28:38 gklug + * rmv: PORT SWITCH Event + * + * Revision 1.1 1998/09/29 06:14:07 gklug + * add: driver events (initial version) + * + * + ******************************************************************************/ + +#ifndef __INC_SKGEDRV_H_ +#define __INC_SKGEDRV_H_ + +/* defines ********************************************************************/ + +/* + * Define the driver events. + * Usually the events are defined by the destination module. In case of the + * driver we put the definition of the events here. + */ +#define SK_DRV_PORT_RESET 1 /* The port needs to be reset */ +#define SK_DRV_NET_UP 2 /* The net is now operational */ +#define SK_DRV_NET_DOWN 3 /* The net is now down */ +#define SK_DRV_SWITCH_SOFT 4 /* Ports switch with both links conn */ +#define SK_DRV_SWITCH_HARD 5 /* Port switch due to link failure */ +#define SK_DRV_RLMT_SEND 6 /* Send a RLMT packet */ +#define SK_DRV_ADAP_FAIL 7 /* The whole adapter fails */ +#define SK_DRV_PORT_FAIL 8 /* One port fails */ +#define SK_DRV_SWITCH_INTERN 9 /* Port switch from driver to itself */ + +#endif /* __INC_SKGEDRV_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgehw.h linux/drivers/net/sk98lin/h/skgehw.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgehw.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgehw.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1715 @@ +/****************************************************************************** + * + * Name: skgehw.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.33 $ + * Date: $Date: 1999/08/27 11:17:10 $ + * Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product + * Family + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * $Log: skgehw.h,v $ + * Revision 1.33 1999/08/27 11:17:10 malthoff + * It's more savely to put bracket around marco parameters. + * Brackets added for PHY_READ and PHY_WRITE. + * + * Revision 1.32 1999/05/19 07:31:01 cgoos + * Changes for 1000Base-T. + * Added HWAC_LINK_LED macro. + * + * Revision 1.31 1999/03/12 13:27:40 malthoff + * Remove __STDC__. + * + * Revision 1.30 1999/02/09 09:28:20 malthoff + * Add PCI_ERRBITS. + * + * Revision 1.29 1999/01/26 08:55:48 malthoff + * Bugfix: The 16 bit field releations inside the descriptor are + * endianess dependend if the descriptor reversal feature + * (PCI_REV_DESC bit in PCI_OUR_REG_2) is enabled. + * Drivers which use this feature has to set the define + * SK_USE_REV_DESC. + * + * Revision 1.28 1998/12/10 11:10:22 malthoff + * bug fix: IS_IRQ_STAT and IS_IRQ_MST_ERR has been twisted. + * + * Revision 1.27 1998/11/13 14:19:21 malthoff + * Bug Fix: The bit definition of B3_PA_CTRL has completely + * changed from HW Spec v1.3 to v1.5. + * + * Revision 1.26 1998/11/04 08:31:48 cgoos + * Fixed byte ordering in XM_OUTADDR/XM_OUTHASH macros. + * + * Revision 1.25 1998/11/04 07:16:25 cgoos + * Changed byte ordering in XM_INADDR/XM_INHASH again. + * + * Revision 1.24 1998/11/02 11:08:43 malthoff + * RxCtrl and TxCtrl must be volatile. + * + * Revision 1.23 1998/10/28 13:50:45 malthoff + * Fix: Endian support missing in XM_IN/OUT-ADDR/HASH macros. + * + * Revision 1.22 1998/10/26 08:01:36 malthoff + * RX_MFF_CTRL1 is split up into RX_MFF_CTRL1, + * RX_MFF_STAT_TO, and RX_MFF_TIST_TO. + * TX_MFF_CTRL1 is split up TX_MFF_CTRL1 and TX_MFF_WAF. + * + * Revision 1.21 1998/10/20 07:43:10 malthoff + * Fix: XM_IN/OUT/ADDR/HASH macros: + * The pointer must be casted. + * + * Revision 1.20 1998/10/19 15:53:59 malthoff + * Remove ML proto definitions. + * + * Revision 1.19 1998/10/16 14:40:17 gklug + * fix: typo B0_XM_IMSK regs + * + * Revision 1.18 1998/10/16 09:46:54 malthoff + * Remove temp defines for ML diag prototyp. + * Fix register definition for B0_XM1_PHY_DATA, B0_XM1_PHY_DATA + * B0_XM2_PHY_DATA, B0_XM2_PHY_ADDR, B0_XA1_CSR, B0_XS1_CSR, + * B0_XS2_CSR, and B0_XA2_CSR. + * + * Revision 1.17 1998/10/14 06:03:14 cgoos + * Changed shifted constant to ULONG. + * + * Revision 1.16 1998/10/09 07:05:41 malthoff + * Rename ALL_PA_ENA_TO to PA_ENA_TO_ALL. + * + * Revision 1.15 1998/10/05 07:54:23 malthoff + * Split up RB_CTRL and it's bit definition into + * RB_CTRL, RB_TST1, and RB_TST2. + * Rename RB_RX_HTPP to RB_RX_LTPP. + * Add ALL_PA_ENA_TO. Modify F_WATER_MARK + * according to HW Spec. v1.5. + * Add MFF_TX_CTRL_DEF. + * + * Revision 1.14 1998/09/28 13:31:16 malthoff + * bug fix: B2_MAC_3 is 0x110 not 0x114 + * + * Revision 1.13 1998/09/24 14:42:56 malthoff + * Split the RX_MFF_TST into RX_MFF_CTRL2, + * RX_MFF_TST1, and RX_MFF_TST2. + * Rename RX_MFF_CTRL to RX_MFF_CTRL1. + * Add BMU bit CSR_SV_IDLE. + * Add macros PHY_READ() and PHY_WRITE(). + * Rename macro SK_ADDR() to SK_HW_ADDR() + * because of conflicts with the Address Module. + * + * Revision 1.12 1998/09/16 07:25:33 malthoff + * Change the parameter order in the XM_INxx and XM_OUTxx macros, + * to have the IoC as first parameter. + * + * Revision 1.11 1998/09/03 09:58:41 malthoff + * Rework the XM_xxx macros. Use {} instead of () to + * be compatible with SK_xxx macros which are defined + * with {}. + * + * Revision 1.10 1998/09/02 11:16:39 malthoff + * Temporary modify B2_I2C_SW to make tests with + * the GE/ML prototyp. + * + * Revision 1.9 1998/08/19 09:11:49 gklug + * fix: struct are removed from c-source (see CCC) + * add: typedefs for all structs + * + * Revision 1.8 1998/08/18 08:27:27 malthoff + * Add some temporary workarounds to test GE + * sources with the ML. + * + * Revision 1.7 1998/07/03 14:42:26 malthoff + * bug fix: Correct macro XMA(). + * Add temporary workaround to access the PCI config space over IO + * + * Revision 1.6 1998/06/23 11:30:36 malthoff + * Remove ';' with ',' in macors. + * + * Revision 1.5 1998/06/22 14:20:57 malthoff + * Add macro SK_ADDR(Base,Addr). + * + * Revision 1.4 1998/06/19 13:35:43 malthoff + * change 'pGec' with 'pAC' + * + * Revision 1.3 1998/06/17 14:58:16 cvs + * Lost keywords reinserted. + * + * Revision 1.1 1998/06/17 14:16:36 cvs + * created + * + * + ******************************************************************************/ + +#ifndef __INC_SKGEHW_H +#define __INC_SKGEHW_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines ********************************************************************/ + +/* + * Configuration Space header + * Since this module is used for different OS', those may be + * duplicate on some of them (e.g. Linux). But to keep the + * common source, we have to live with this... + */ +#define PCI_VENDOR_ID 0x00 /* 16 bit Vendor ID */ +#define PCI_DEVICE_ID 0x02 /* 16 bit Device ID */ +#define PCI_COMMAND 0x04 /* 16 bit Command */ +#define PCI_STATUS 0x06 /* 16 bit Status */ +#define PCI_REV_ID 0x08 /* 8 bit Revision ID */ +#define PCI_CLASS_CODE 0x09 /* 24 bit Class Code */ +#define PCI_CACHE_LSZ 0x0c /* 8 bit Cache Line Size */ +#define PCI_LAT_TIM 0x0d /* 8 bit Latency Timer */ +#define PCI_HEADER_T 0x0e /* 8 bit Header Type */ +#define PCI_BIST 0x0f /* 8 bit Built-in selftest */ +#define PCI_BASE_1ST 0x10 /* 32 bit 1st Base address */ +#define PCI_BASE_2ND 0x14 /* 32 bit 2nd Base address */ + /* Byte 18..2b: reserved */ +#define PCI_SUB_VID 0x2c /* 16 bit Subsystem Vendor ID */ +#define PCI_SUB_ID 0x2e /* 16 bit Subsystem ID */ +#define PCI_BASE_ROM 0x30 /* 32 bit Expansion ROM Base Address */ + /* Byte 34..33: reserved */ +#define PCI_CAP_PTR 0x34 /* 8 bit Capabilities Ptr */ + /* Byte 35..3b: reserved */ +#define PCI_IRQ_LINE 0x3c /* 8 bit Interrupt Line */ +#define PCI_IRQ_PIN 0x3d /* 8 bit Interrupt Pin */ +#define PCI_MIN_GNT 0x3e /* 8 bit Min_Gnt */ +#define PCI_MAX_LAT 0x3f /* 8 bit Max_Lat */ + /* Device Dependent Region */ +#define PCI_OUR_REG_1 0x40 /* 32 bit Our Register 1 */ +#define PCI_OUR_REG_2 0x44 /* 32 bit Our Register 2 */ + /* Power Management Region */ +#define PCI_PM_CAP_ID 0x48 /* 8 bit Power Management Cap. ID */ +#define PCI_PM_NITEM 0x49 /* 8 bit Next Item Ptr */ +#define PCI_PM_CAP_REG 0x4a /* 16 bit Power Management Capabilities */ +#define PCI_PM_CTL_STS 0x4c /* 16 bit Power Manag. Control/Status */ + /* Byte 0x4e: reserved */ +#define PCI_PM_DAT_REG 0x4f /* 8 bit Power Manag. Data Register */ + /* VPD Region */ +#define PCI_VPD_CAP_ID 0x50 /* 8 bit VPD Cap. ID */ +#define PCI_VPD_NITEM 0x51 /* 8 bit Next Item Ptr */ +#define PCI_VPD_ADR_REG 0x52 /* 16 bit VPD Address Register */ +#define PCI_VPD_DAT_REG 0x54 /* 32 bit VPD Data Register */ + /* Byte 58..ff: reserved */ + +/* + * I2C Address (PCI Config) + * + * Note: The temperature and voltage sensors are relocated on a different + * I2C bus. + */ +#define I2C_ADDR_VPD 0xA0 /* I2C address for the VPD EEPROM */ + +/* + * Define Bits and Values of the registers + */ +/* PCI_VENDOR_ID 16 bit Vendor ID */ +/* PCI_DEVICE_ID 16 bit Device ID */ +/* Values for Vendor ID and Device ID shall be patched into the code */ +/* PCI_COMMAND 16 bit Command */ + /* Bit 15..10: reserved */ +#define PCI_FBTEN (1<<9) /* Bit 9: Fast Back-To-Back enable */ +#define PCI_SERREN (1<<8) /* Bit 8: SERR enable */ +#define PCI_ADSTEP (1<<7) /* Bit 7: Address Stepping */ +#define PCI_PERREN (1<<6) /* Bit 6: Parity Report Response enable */ +#define PCI_VGA_SNOOP (1<<5) /* Bit 5: VGA palette snoop */ +#define PCI_MWIEN (1<<4) /* Bit 4: Memory write an inv cycl ena */ +#define PCI_SCYCEN (1<<3) /* Bit 3: Special Cycle enable */ +#define PCI_BMEN (1<<2) /* Bit 2: Bus Master enable */ +#define PCI_MEMEN (1<<1) /* Bit 1: Memory Space Access enable */ +#define PCI_IOEN (1<<0) /* Bit 0: IO Space Access enable */ + +/* PCI_STATUS 16 bit Status */ +#define PCI_PERR (1<<15) /* Bit 15: Parity Error */ +#define PCI_SERR (1<<14) /* Bit 14: Signaled SERR */ +#define PCI_RMABORT (1<<13) /* Bit 13: Received Master Abort */ +#define PCI_RTABORT (1<<12) /* Bit 12: Received Target Abort */ + /* Bit 11: reserved */ +#define PCI_DEVSEL (3<<9) /* Bit 10..9: DEVSEL Timing */ +#define PCI_DEV_FAST (0<<9) /* fast */ +#define PCI_DEV_MEDIUM (1<<9) /* medium */ +#define PCI_DEV_SLOW (2<<9) /* slow */ +#define PCI_DATAPERR (1<<8) /* Bit 8: DATA Parity error detected */ +#define PCI_FB2BCAP (1<<7) /* Bit 7: Fast Back-to-Back Capability */ +#define PCI_UDF (1<<6) /* Bit 6: User Defined Features */ +#define PCI_66MHZCAP (1<<5) /* Bit 5: 66 MHz PCI bus clock capable */ +#define PCI_NEWCAP (1<<4) /* Bit 4: New cap. list implemented */ + /* Bit 3..0: reserved */ + +#define PCI_ERRBITS (PCI_PERR | PCI_SERR | PCI_RMABORT | PCI_RTABORT |\ + PCI_DATAPERR) + +/* PCI_CLASS_CODE 24 bit Class Code */ +/* Byte 2: Base Class (02) */ +/* Byte 1: SubClass (00) */ +/* Byte 0: Programming Interface (00) */ + +/* PCI_CACHE_LSZ 8 bit Cache Line Size */ +/* Possible values: 0,2,4,8,16,32,64,128 */ + +/* PCI_HEADER_T 8 bit Header Type */ +#define PCI_HD_MF_DEV (1<<7) /* Bit 7: 0= single, 1= multi-func dev */ +#define PCI_HD_TYPE 0x7f /* Bit 6..0: Header Layout 0= normal */ + +/* PCI_BIST 8 bit Built-in selftest */ +/* Built-in Self test not supported (optional) */ + +/* PCI_BASE_1ST 32 bit 1st Base address */ +#define PCI_MEMSIZE 0x4000L /* use 16 kB Memory Base */ +#define PCI_MEMBASE_MSK 0xffffc000L /* Bit 31..14: Memory Base Address */ +#define PCI_MEMSIZE_MSK 0x00003ff0L /* Bit 13.. 4: Memory Size Req. */ +#define PCI_PREFEN (1L<<3) /* Bit 3: Prefetchable */ +#define PCI_MEM_TYP (3L<<2) /* Bit 2.. 1: Memory Type */ +#define PCI_MEM32BIT (0L<<1) /* Base addr anywhere in 32 Bit range */ +#define PCI_MEM1M (1L<<1) /* Base addr below 1 MegaByte */ +#define PCI_MEM64BIT (2L<<1) /* Base addr anywhere in 64 Bit range */ +#define PCI_MEMSPACE (1L<<0) /* Bit 0: Memory Space Indic. */ + +/* PCI_BASE_2ND 32 bit 2nd Base address */ +#define PCI_IOBASE 0xffffff00L /* Bit 31..8: I/O Base address */ +#define PCI_IOSIZE 0x000000fcL /* Bit 7..2: I/O Size Requirements */ + /* Bit 1: reserved */ +#define PCI_IOSPACE (1L<<0) /* Bit 0: I/O Space Indicator */ + +/* PCI_BASE_ROM 32 bit Expansion ROM Base Address */ +#define PCI_ROMBASE (0xfffeL<<17) /* Bit 31..17: ROM BASE address (1st)*/ +#define PCI_ROMBASZ (0x1cL<<14) /* Bit 16..14: Treat as BASE or SIZE */ +#define PCI_ROMSIZE (0x38L<<11) /* Bit 13..11: ROM Size Requirements */ + /* Bit 10.. 1: reserved */ +#define PCI_ROMEN (0x1L<<0) /* Bit 0: Address Decode enable */ + +/* Device Dependent Region */ +/* PCI_OUR_REG_1 32 bit Our Register 1 */ + /* Bit 31..26: reserved */ +#define PCI_VIO (1L<<25) /* Bit 25: PCI IO Voltage, */ + /* 0 = 3.3V / 1 = 5V */ +#define PCI_EN_BOOT (1L<<24) /* Bit 24: Enable BOOT via ROM */ + /* 1 = Don't boot wth ROM*/ + /* 0 = Boot with ROM */ +#define PCI_EN_IO (1L<<23) /* Bit 23: Mapping to IO space */ +#define PCI_EN_FPROM (1L<<22) /* Bit 22: FLASH mapped to mem? */ + /* 1 = Map Flash to Mem */ + /* 0 = Disable addr. dec*/ +#define PCI_PAGESIZE (3L<<20) /* Bit 21..20: FLASH Page Size */ +#define PCI_PAGE_16 (0L<<20) /* 16 k pages */ +#define PCI_PAGE_32K (1L<<20) /* 32 k pages */ +#define PCI_PAGE_64K (2L<<20) /* 64 k pages */ +#define PCI_PAGE_128K (3L<<20) /* 128 k pages */ + /* Bit 19: reserved */ +#define PCI_PAGEREG (7L<<16) /* Bit 18..16: Page Register */ +#define PCI_NOTAR (1L<<15) /* Bit 15: No turnaround cycle */ +#define PCI_FORCE_BE (1L<<14) /* Bit 14: Assert all BEs on MR */ +#define PCI_DIS_MRL (1L<<13) /* Bit 13: Disable Mem R Line */ +#define PCI_DIS_MRM (1L<<12) /* Bit 12: Disable Mem R multip */ +#define PCI_DIS_MWI (1L<<11) /* Bit 11: Disable Mem W & inv */ +#define PCI_DISC_CLS (1L<<10) /* Bit 10: Disc: cacheLsz bound */ +#define PCI_BURST_DIS (1L<<9) /* Bit 9: Burst Disable */ +#define PCI_DIS_PCI_CLK (1L<<8) /* Bit 8: Disable PCI clock driv*/ +#define PCI_SKEW_DAS (0xfL<<4) /* Bit 7..4: Skew Ctrl, DAS Ext */ +#define PCI_SKEW_BASE (0xfL<<0) /* Bit 3..0: Skew Ctrl, Base */ + + +/* PCI_OUR_REG_2 32 bit Our Register 2 */ +#define PCI_VPD_WR_THR (0xffL<<24) /* Bit 31..24: VPD Write Threshold */ +#define PCI_DEV_SEL (0x7fL<<17) /* Bit 23..17: EEPROM Device Select */ +#define PCI_VPD_ROM_SZ (7L<<14) /* Bit 16..14: VPD ROM Size */ + /* Bit 13..12: reserved */ +#define PCI_PATCH_DIR (0xfL<<8) /* Bit 11.. 8: Ext Patchs dir 3..0 */ +#define PCI_PATCH_DIR_0 (1L<<8) +#define PCI_PATCH_DIR_1 (1L<<9) +#define PCI_PATCH_DIR_2 (1L<<10) +#define PCI_PATCH_DIR_3 (1L<<11) +#define PCI_EXT_PATCHS (0xfL<<4) /* Bit 7..4: Extended Patches 3..0 */ +#define PCI_EXT_PATCH_0 (1L<<4) +#define PCI_EXT_PATCH_1 (1L<<5) +#define PCI_EXT_PATCH_2 (1L<<6) +#define PCI_EXT_PATCH_3 (1L<<7) +#define PCI_EN_DUMMY_RD (1L<<3) /* Bit 3: Enable Dummy Read */ +#define PCI_REV_DESC (1L<<2) /* Bit 2: Reverse Desc. Bytes */ + /* Bit 1: reserved */ +#define PCI_USEDATA64 (1L<<0) /* Bit 0: Use 64Bit Data bus ext*/ + + +/* Power Management Region */ +/* PCI_PM_CAP_REG 16 bit Power Management Capabilities */ +#define PCI_PME_SUP (0x1f<<11) /* Bit 15..11: PM Manag. Event Sup */ +#define PCI_PM_D2_SUB (1<<10) /* Bit 10: D2 Support Bit */ +#define PCI_PM_D1_SUB (1<<9) /* Bit 9: D1 Support Bit */ + /* Bit 8..6: reserved */ +#define PCI_PM_DSI (1<<5) /* Bit 5: Device Specific Init.*/ +#define PCI_PM_APS (1<<4) /* Bit 4: Auxialiary Power Src */ +#define PCI_PME_CLOCK (1<<3) /* Bit 3: PM Event Clock */ +#define PCI_PM_VER (7<<0) /* Bit 2..0: PM PCI Spec. version */ + +/* PCI_PM_CTL_STS 16 bit Power Manag. Control/Status */ +#define PCI_PME_STATUS (1<<15) /* Bit 15: PGA doesn't sup. PME# */ +#define PCI_PM_DAT_SCL (3<<13) /* Bit 14..13: dat reg Scaling factor*/ +#define PCI_PM_DAT_SEL (0xf<<9) /* Bit 12.. 9: PM data selector field*/ +#define PCI_PME_EN (1<<8) /* Bit 8: PGA doesn't sup. PME# */ + /* Bit 7.. 2: reserved */ +#define PCI_PM_STATE (3<<0) /* Bit 1.. 0: Power Management State*/ +#define PCI_PM_STATE_D0 (0<<0) /* D0: Operational (default) */ +#define PCI_PM_STATE_D1 (1<<0) /* D1: not supported */ +#define PCI_PM_STATE_D2 (2<<0) /* D2: not supported */ +#define PCI_PM_STATE_D3 (3<<0) /* D3: HOT, Power Down and Reset */ + +/* VPD Region */ +/* PCI_VPD_ADR_REG 16 bit VPD Address Register */ +#define PCI_VPD_FLAG (1L<<15) /* Bit 15: starts VPD rd/wd cycle*/ +#define PCI_VPD_ADDR (0x3fffL<<0) /* Bit 14..0: VPD address */ + +/* + * Control Register File: + * Bank 0 + */ +#define B0_RAP 0x0000 /* 8 bit Register Address Port */ + /* 0x0001 - 0x0003: reserved */ +#define B0_CTST 0x0004 /* 16 bit Control/Status register */ +#define B0_LED 0x0006 /* 8 Bit LED register */ + /* 0x0007: reserved */ +#define B0_ISRC 0x0008 /* 32 bit Interrupt Source Register */ +#define B0_IMSK 0x000c /* 32 bit Interrupt Mask Register */ +#define B0_HWE_ISRC 0x0010 /* 32 bit HW Error Interrupt Src Reg */ +#define B0_HWE_IMSK 0x0014 /* 32 bit HW Error Interrupt Mask Reg */ +#define B0_SP_ISRC 0x0018 /* 32 bit Special Interrupt Source Reg */ + /* 0x001c: reserved */ + +/* B0 XMAC 1 registers */ +#define B0_XM1_IMSK 0x0020 /* 16 bit r/w XMAC 1 Interrupt Mask Register*/ + /* 0x0022 - 0x0027 reserved */ +#define B0_XM1_ISRC 0x0028 /* 16 bit ro XMAC 1 Interrupt Status Reg */ + /* 0x002a - 0x002f reserved */ +#define B0_XM1_PHY_ADDR 0x0030 /* 16 bit r/w XMAC 1 PHY Address Register */ + /* 0x0032 - 0x0033 reserved */ +#define B0_XM1_PHY_DATA 0x0034 /* 16 bit r/w XMAC 1 PHY Data Register */ + /* 0x0036 - 0x003f reserved */ + +/* B0 XMAC 2 registers */ +#define B0_XM2_IMSK 0x0040 /* 16 bit r/w XMAC 2 Interrupt Mask Register*/ + /* 0x0042 - 0x0047 reserved */ +#define B0_XM2_ISRC 0x0048 /* 16 bit ro XMAC 2 Interrupt Status Reg */ + /* 0x004a - 0x004f reserved */ +#define B0_XM2_PHY_ADDR 0x0050 /* 16 bit r/w XMAC 2 PHY Address Register */ + /* 0x0052 - 0x0053 reserved */ +#define B0_XM2_PHY_DATA 0x0054 /* 16 bit r/w XMAC 2 PHY Data Register */ + /* 0x0056 - 0x005f reserved */ + +/* BMU Control Status Registers */ +#define B0_R1_CSR 0x0060 /* 32 bit BMU Ctrl/Stat Rx Queue 1 */ +#define B0_R2_CSR 0x0064 /* 32 bit BMU Ctrl/Stat Rx Queue 2 */ +#define B0_XS1_CSR 0x0068 /* 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */ +#define B0_XA1_CSR 0x006c /* 32 bit BMU Ctrl/Stat Async Tx Queue 1*/ +#define B0_XS2_CSR 0x0070 /* 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */ +#define B0_XA2_CSR 0x0074 /* 32 bit BMU Ctrl/Stat Async Tx Queue 2*/ + /* x0078 - 0x007f reserved */ + +/* + * Bank 1 + * - completely empty (this is the RAP Block window) + * Note: if RAP = 1 this page is reserved + */ + +/* + * Bank 2 + */ +/* NA reg = 48 bit Network Address Register, 3x16 or 8x8 bit readable */ + +#define B2_MAC_1 0x0100 /* NA reg MAC Address 1 */ + /* 0x0106 - 0x0107 reserved */ +#define B2_MAC_2 0x0108 /* NA reg MAC Address 2 */ + /* 0x010e - 0x010f reserved */ +#define B2_MAC_3 0x0110 /* NA reg MAC Address 3 */ + /* 0x0116 - 0x0117 reserved */ +#define B2_CONN_TYP 0x0118 /* 8 bit Connector type */ +#define B2_PMD_TYP 0x0119 /* 8 bit PMD type */ +#define B2_MAC_CFG 0x011a /* 8 bit MAC Configuration */ +#define B2_CHIP_REV 0x011b /* 8 bit Queen Chip Revision Number */ + /* Eprom registers are currently of no use */ +#define B2_E_0 0x011c /* 8 bit EPROM Byte 0 */ +#define B2_E_1 0x011d /* 8 bit EPROM Byte 1 */ +#define B2_E_2 0x011e /* 8 bit EPROM Byte 2 */ +#define B2_E_3 0x011f /* 8 bit EPROM Byte 3 */ +#define B2_FAR 0x0120 /* 32 bit Flash-Prom Addr Reg/Cnt */ +#define B2_FDP 0x0124 /* 8 bit Flash-Prom Data Port */ + /* 0x0125 - 0x0127: reserved */ +#define B2_LD_CRTL 0x0128 /* 8 bit EPROM loader control register */ +#define B2_LD_TEST 0x0129 /* 8 bit EPROM loader test register */ + /* 0x012a - 0x012f: reserved */ +#define B2_TI_INI 0x0130 /* 32 bit Timer init value */ +#define B2_TI_VAL 0x0134 /* 32 bit Timer value */ +#define B2_TI_CRTL 0x0138 /* 8 bit Timer control */ +#define B2_TI_TEST 0x0139 /* 8 Bit Timer Test */ + /* 0x013a - 0x013f: reserved */ +#define B2_IRQM_INI 0x0140 /* 32 bit IRQ Moderation Timer Init Reg.*/ +#define B2_IRQM_VAL 0x0144 /* 32 bit IRQ Moderation Timer Value */ +#define B2_IRQM_CTRL 0x0148 /* 8 bit IRQ Moderation Timer Control */ +#define B2_IRQM_TEST 0x0149 /* 8 bit IRQ Moderation Timer Test */ +#define B2_IRQM_MSK 0x014c /* 32 bit IRQ Moderation Mask */ +#define B2_IRQM_HWE_MSK 0x0150 /* 32 bit IRQ Moderation HW Error Mask */ + /* 0x0154 - 0x0157: reserved */ +#define B2_TST_CTRL1 0x0158 /* 8 bit Test Control Register 1 */ +#define B2_TST_CTRL2 0x0159 /* 8 bit Test Control Register 2 */ + /* 0x015a - 0x015b: reserved */ +#define B2_GP_IO 0x015c /* 32 bit General Purpose IO Register */ +#define B2_I2C_CTRL 0x0160 /* 32 bit I2C HW Control Register */ +#define B2_I2C_DATA 0x0164 /* 32 bit I2C HW Data Register */ +#define B2_I2C_IRQ 0x0168 /* 32 bit I2C HW IRQ Register */ +#define B2_I2C_SW 0x016c /* 32 bit I2C SW Port Register */ +#define B2_BSC_INI 0x0170 /* 32 bit Blink Source Counter Init Val */ +#define B2_BSC_VAL 0x0174 /* 32 bit Blink Source Counter Value */ +#define B2_BSC_CTRL 0x0178 /* 8 bit Blink Source Counter Control */ +#define B2_BSC_STAT 0x0179 /* 8 bit Blink Source Counter Status */ +#define B2_BSC_TST 0x017a /* 16 bit Blink Source Counter Test Reg */ + /* 0x017c - 0x017f: reserved */ + +/* + * Bank 3 + */ +#define B3_RAM_ADDR 0x0180 /* 32 bit RAM Address, to read or write */ +#define B3_RAM_DATA_LO 0x0184 /* 32 bit RAM Data Word (low dWord) */ +#define B3_RAM_DATA_HI 0x0188 /* 32 bit RAM Data Word (high dWord) */ + /* 0x018c - 0x018f: reserved */ +/* RAM Interface Registers */ +/* + * The HW-Spec. call this registers Timeout Value 0..11. But this names are + * not usable in SW. Please notice these are NOT real timeouts, these are + * the number of qWords transfered continously. + */ +#define B3_RI_WTO_R1 0x0190 /* 8 bit RAM Iface WR Timeout Queue R1 (TO0) */ +#define B3_RI_WTO_XA1 0x0191 /* 8 bit RAM Iface WR Timeout Queue XA1 (TO1) */ +#define B3_RI_WTO_XS1 0x0192 /* 8 bit RAM Iface WR Timeout Queue XS1 (TO2) */ +#define B3_RI_RTO_R1 0x0193 /* 8 bit RAM Iface RD Timeout Queue R1 (TO3) */ +#define B3_RI_RTO_XA1 0x0194 /* 8 bit RAM Iface RD Timeout Queue XA1 (TO4) */ +#define B3_RI_RTO_XS1 0x0195 /* 8 bit RAM Iface RD Timeout Queue XS1 (TO5) */ +#define B3_RI_WTO_R2 0x0196 /* 8 bit RAM Iface WR Timeout Queue R2 (TO6) */ +#define B3_RI_WTO_XA2 0x0197 /* 8 bit RAM Iface WR Timeout Queue XA2 (TO7) */ +#define B3_RI_WTO_XS2 0x0198 /* 8 bit RAM Iface WR Timeout Queue XS2 (TO8) */ +#define B3_RI_RTO_R2 0x0199 /* 8 bit RAM Iface RD Timeout Queue R2 (TO9) */ +#define B3_RI_RTO_XA2 0x019a /* 8 bit RAM Iface RD Timeout Queue XA2 (TO10)*/ +#define B3_RI_RTO_XS2 0x019b /* 8 bit RAM Iface RD Timeout Queue XS2 (TO11)*/ +#define B3_RI_TO_VAL 0x019c /* 8 bit RAM Iface Current Timeout Count Val */ + /* 0x019d - 0x019f reserved */ +#define B3_RI_CTRL 0x01a0 /* 16 bit RAM Iface Control Register */ +#define B3_RI_TEST 0x01a2 /* 8 bit RAM Iface Test Register */ + /* 0x01a3 - 0x01af reserved */ +/* MAC Arbiter Registers */ +/* Please notice these are the number of qWord tranfered continously and */ +/* NOT real timeouts */ +#define B3_MA_TOINI_RX1 0x01b0 /* 8 bit Timeout Init Value Rx Path MAC 1 */ +#define B3_MA_TOINI_RX2 0x01b1 /* 8 bit Timeout Init Value Rx Path MAC 2 */ +#define B3_MA_TOINI_TX1 0x01b2 /* 8 bit Timeout Init Value Tx Path MAC 1 */ +#define B3_MA_TOINI_TX2 0x01b3 /* 8 bit Timeout Init Value Tx Path MAC 2 */ +#define B3_MA_TOVAL_RX1 0x01b4 /* 8 bit Timeout Value Rx Path MAC 1 */ +#define B3_MA_TOVAL_RX2 0x01b5 /* 8 bit Timeout Value Rx Path MAC 1 */ +#define B3_MA_TOVAL_TX1 0x01b6 /* 8 bit Timeout Value Tx Path MAC 2 */ +#define B3_MA_TOVAL_TX2 0x01b7 /* 8 bit Timeout Value Tx Path MAC 2 */ +#define B3_MA_TO_CTRL 0x01b8 /* 16 bit MAC Arbiter Timeout Ctrl Reg */ +#define B3_MA_TO_TEST 0x01ba /* 16 bit MAC Arbiter Timeout Test Reg */ + /* 0x01bc - 0x01bf reserved */ +#define B3_MA_RCINI_RX1 0x01c0 /* 8 bit Recovery Init Value Rx Path MAC 1 */ +#define B3_MA_RCINI_RX2 0x01c1 /* 8 bit Recovery Init Value Rx Path MAC 2 */ +#define B3_MA_RCINI_TX1 0x01c2 /* 8 bit Recovery Init Value Tx Path MAC 1 */ +#define B3_MA_RCINI_TX2 0x01c3 /* 8 bit Recovery Init Value Tx Path MAC 2 */ +#define B3_MA_RCVAL_RX1 0x01c4 /* 8 bit Recovery Value Rx Path MAC 1 */ +#define B3_MA_RCVAL_RX2 0x01c5 /* 8 bit Recovery Value Rx Path MAC 1 */ +#define B3_MA_RCVAL_TX1 0x01c6 /* 8 bit Recovery Value Tx Path MAC 2 */ +#define B3_MA_RCVAL_TX2 0x01c7 /* 8 bit Recovery Value Tx Path MAC 2 */ +#define B3_MA_RC_CTRL 0x01c8 /* 16 bit MAC Arbiter Recovery Ctrl Reg */ +#define B3_MA_RC_TEST 0x01ca /* 16 bit MAC Arbiter Recovery Test Reg */ + /* 0x01cc - 0x01cf reserved */ +/* Packet Arbiter Registers, This are real timeouts */ +#define B3_PA_TOINI_RX1 0x01d0 /* 16 bit Timeout Init Val Rx Path MAC 1*/ + /* 0x01d2 - 0x01d3: reserved */ +#define B3_PA_TOINI_RX2 0x01d4 /* 16 bit Timeout Init Val Rx Path MAC 2*/ + /* 0x01d6 - 0x01d7: reserved */ +#define B3_PA_TOINI_TX1 0x01d8 /* 16 bit Timeout Init Val Tx Path MAC 1*/ + /* 0x01da - 0x01db: reserved */ +#define B3_PA_TOINI_TX2 0x01dc /* 16 bit Timeout Init Val Tx Path MAC 2*/ + /* 0x01de - 0x01df: reserved */ +#define B3_PA_TOVAL_RX1 0x01e0 /* 16 bit Timeout Val Rx Path MAC 1 */ + /* 0x01e2 - 0x01e3: reserved */ +#define B3_PA_TOVAL_RX2 0x01e4 /* 16 bit Timeout Val Rx Path MAC 2 */ + /* 0x01e6 - 0x01e7: reserved */ +#define B3_PA_TOVAL_TX1 0x01e8 /* 16 bit Timeout Val Tx Path MAC 1 */ + /* 0x01ea - 0x01eb: reserved */ +#define B3_PA_TOVAL_TX2 0x01ec /* 16 bit Timeout Val Tx Path MAC 2 */ + /* 0x01ee - 0x01ef: reserved */ +#define B3_PA_CTRL 0x01f0 /* 16 bit Packet Arbiter Ctrl Register */ +#define B3_PA_TEST 0x01f2 /* 16 bit Packet Arbiter Test Register */ + /* 0x01f4 - 0x01ff: reserved */ + +/* + * Bank 4 - 5 + */ + +/* Transmit Arbiter Registers MAC 1 and 2, user MR_ADDR() to address */ +#define TXA_ITI_INI 0x0200 /* 32 bit Tx Arb Interval Timer Init Val*/ +#define TXA_ITI_VAL 0x0204 /* 32 bit Tx Arb Interval Timer Value */ +#define TXA_LIM_INI 0x0208 /* 32 bit Tx Arb Limit Counter Init Val */ +#define TXA_LIM_VAL 0x020c /* 32 bit Tx Arb Limit Counter Value */ +#define TXA_CTRL 0x0210 /* 8 bit Tx Arbiter Control Register */ +#define TXA_TEST 0x0211 /* 8 bit Tx Arbiter Test Register */ +#define TXA_STAT 0x0212 /* 8 bit Tx Arbiter Status Register */ + /* 0x0213 - 0x027f: reserved */ + +/* + * Bank 6 + */ +/* External registers */ +#define B6_EXT_REG 0x0300 + +/* + * Bank 7 + */ +/* This is a copy of the Configuration register file (lower half) */ +#define B7_CFG_SPC 0x0380 + +/* + * Bank 8 - 15 + */ +/* Receive and Transmit Queue Registers, use Q_ADDR() to access */ +#define B8_Q_REGS 0x0400 + +/* Queue Register Offsets, use Q_ADDR() to access */ +#define Q_D 0x00 /* 8*32 bit Current Descriptor */ +#define Q_DA_L 0x20 /* 32 bit Current Descriptor Address Low dWord */ +#define Q_DA_H 0x24 /* 32 bit Current Descriptor Address High dWord */ +#define Q_AC_L 0x28 /* 32 bit Current Address Counter Low dWord */ +#define Q_AC_H 0x2c /* 32 bit Current Address Counter High dWord */ +#define Q_BC 0x30 /* 32 bit Current Byte Counter */ +#define Q_CSR 0x34 /* 32 bit BMU Control/Status Register */ +#define Q_F 0x38 /* 32 bit Flag Register */ +#define Q_T1 0x3c /* 32 bit Test Register 1 */ +#define Q_T1_TR 0x3c /* 8 bit Test Register 1 Transfer SM */ +#define Q_T1_WR 0x3d /* 8 bit Test Register 1 Write Descriptor SM */ +#define Q_T1_RD 0x3e /* 8 bit Test Register 1 Read Descriptor SM */ +#define Q_T1_SV 0x3f /* 8 bit Test Register 1 Supervisor SM */ +#define Q_T2 0x40 /* 32 bit Test Register 2 */ +#define Q_T3 0x44 /* 32 bit Test Register 3 */ + /* 0x48 - 0x7f: reserved */ + +/* + * Bank 16 - 23 + */ +/* RAM Buffer Registers */ +#define B16_RAM_REGS 0x0800 + +/* RAM Buffer Register Offsets */ +/* use RB_ADDR(Queue,Offs) to address */ +#define RB_START 0x00 /* 32 bit RAM Buffer Start Address */ +#define RB_END 0x04 /* 32 bit RAM Buffer End Address */ +#define RB_WP 0x08 /* 32 bit RAM Buffer Write Pointer */ +#define RB_RP 0x0c /* 32 bit RAM Buffer Read Pointer */ +#define RB_RX_UTPP 0x10 /* 32 bit Rx Upper Threshold, Pause Pack*/ +#define RB_RX_LTPP 0x14 /* 32 bit Rx Lower Threshold, Pause Pack*/ +#define RB_RX_UTHP 0x18 /* 32 bit Rx Upper Threshold, High Prio */ +#define RB_RX_LTHP 0x1c /* 32 bit Rx Lower Threshold, High Prio */ + /* 0x10 - 0x1f: reserved for Tx RAM Buffer Registers */ +#define RB_PC 0x20 /* 32 bit RAM Buffer Packet Counter */ +#define RB_LEV 0x24 /* 32 bit RAM Buffer Level Register */ +#define RB_CTRL 0x28 /* 8 bit RAM Buffer Control Register */ +#define RB_TST1 0x29 /* 8 bit RAM Buffer Test Register 1 */ +#define RB_TST2 0x2A /* 8 bit RAM Buffer Test Register 2 */ + /* 0x2c - 0x7f: reserved */ + +/* + * Bank 24 - 25 + */ +/* Receive MAC FIFO, Receive LED, and Link Sync regs, use MR_ADDR() to address*/ +#define RX_MFF_EA 0x0c00 /* 32 bit Receive MAC FIFO End Address */ +#define RX_MFF_WP 0x0c04 /* 32 bit Receive MAC FIFO Write Pointer*/ + /* 0x0c08 - 0x0c0b reserved */ +#define RX_MFF_RP 0x0c0c /* 32 bit Receive MAC FIFO Read Pointer */ +#define RX_MFF_PC 0x0c10 /* 32 bit Receive MAC FIFO Packet Cnt */ +#define RX_MFF_LEV 0x0c14 /* 32 bit Receive MAC FIFO Level */ +#define RX_MFF_CTRL1 0x0c18 /* 16 bit Receive MAC FIFO Control Reg 1*/ +#define RX_MFF_STAT_TO 0x0c1a /* 8 bit Receive MAC Status Timeout */ +#define RX_MFF_TIST_TO 0x0c1b /* 8 bit Receive MAC Timestamp Timeout */ +#define RX_MFF_CTRL2 0x0c1c /* 8 bit Receive MAC FIFO Control Reg 2*/ +#define RX_MFF_TST1 0x0c1d /* 8 bit Receive MAC FIFO Test Reg 1 */ +#define RX_MFF_TST2 0x0c1e /* 8 bit Receive MAC FIFO Test Reg 2 */ + /* 0x0c1f reserved */ +#define RX_LED_INI 0x0c20 /* 32 bit Receive LED Cnt Init Value */ +#define RX_LED_VAL 0x0c24 /* 32 bit Receive LED Cnt Current Value */ +#define RX_LED_CTRL 0x0c28 /* 8 bit Receive LED Cnt Control Reg */ +#define RX_LED_TST 0x0c29 /* 8 bit Receive LED Cnt Test Register */ + /* 0x0c2a - 0x0c2f reserved */ +#define LNK_SYNC_INI 0x0c30 /* 32 bit Link Sync Cnt Init Value */ +#define LNK_SYNC_VAL 0x0c34 /* 32 bit Link Sync Cnt Current Value */ +#define LNK_SYNC_CTRL 0x0c38 /* 8 bit Link Sync Cnt Control Register*/ +#define LNK_SYNC_TST 0x0c39 /* 8 bit Link Sync Cnt Test Register */ + /* 0x0c3a - 0x0c3b reserved */ +#define LNK_LED_REG 0x0c3c /* 8 bit Link LED Register */ + /* 0x0c3d - 0x0c7f reserved */ + +/* + * Bank 26 - 27 + */ +/* Transmit MAC FIFO and Transmit LED Registers, use MR_ADDR() to address */ +#define TX_MFF_EA 0x0d00 /* 32 bit Transmit MAC FIFO End Address */ +#define TX_MFF_WP 0x0d04 /* 32 bit Transmit MAC FIFO WR Pointer */ +#define TX_MFF_WSP 0x0d08 /* 32 bit Transmit MAC FIFO WR Shadow Pt*/ +#define TX_MFF_RP 0x0d0c /* 32 bit Transmit MAC FIFO RD Pointer */ +#define TX_MFF_PC 0x0d10 /* 32 bit Transmit MAC FIFO Packet Cnt */ +#define TX_MFF_LEV 0x0d14 /* 32 bit Transmit MAC FIFO Level */ +#define TX_MFF_CTRL1 0x0d18 /* 16 bit Transmit MAC FIFO Ctrl Reg 1 */ +#define TX_MFF_WAF 0x0d1a /* 8 bit Transmit MAC Wait after flush*/ + /* 0x0c1b reserved */ +#define TX_MFF_CTRL2 0x0d1c /* 8 bit Transmit MAC FIFO Ctrl Reg 2 */ +#define TX_MFF_TST1 0x0d1d /* 8 bit Transmit MAC FIFO Test Reg 1 */ +#define TX_MFF_TST2 0x0d1e /* 8 bit Transmit MAC FIFO Test Reg 2 */ + /* 0x0d1f reserved */ +#define TX_LED_INI 0x0d20 /* 32 bit Transmit LED Cnt Init Value */ +#define TX_LED_VAL 0x0d24 /* 32 bit Transmit LED Cnt Current Val */ +#define TX_LED_CTRL 0x0d28 /* 8 bit Transmit LED Cnt Control Reg */ +#define TX_LED_TST 0x0d29 /* 8 bit Transmit LED Cnt Test Register*/ + /* 0x0d2a - 0x0d7f reserved */ + +/* + * Bank 28 + */ +/* Descriptor Poll Timer Registers */ +#define B28_DPT_INI 0x0e00 /* 32 bit Descriptor Poll Timer Init Val*/ +#define B28_DPT_VAL 0x0e04 /* 32 bit Descriptor Poll Timer Curr Val*/ +#define B28_DPT_CTRL 0x0e08 /* 8 bit Descriptor Poll Timer Ctrl Reg*/ + /* 0x0e09: reserved */ +#define B28_DPT_TST 0x0e0a /* 8 bit Descriptor Poll Timer Test Reg*/ + /* 0x0e0b - 0x0e8f: reserved */ + +/* + * Bank 29 - 31 + */ +/* 0x0e90 - 0x0fff: reserved */ + +/* + * Bank 0x20 - 0x3f + */ +/* 0x1000 - 0x1fff: reserved */ + +/* + * Bank 0x40 - 0x4f + */ +/* XMAC 1 registers */ +#define B40_XMAC1 0x2000 + +/* + * Bank 0x50 - 0x5f + */ +/* 0x2800 - 0x2fff: reserved */ + +/* + * Bank 0x60 - 0x6f + */ +/* XMAC 2 registers */ +#define B40_XMAC2 0x3000 + +/* + * Bank 0x70 - 0x7f + */ +/* 0x3800 - 0x3fff: reserved */ + +/* + * Control Register Bit Definitions: + */ +/* B0_RAP 8 bit Register Address Port */ + /* Bit 7: reserved */ +#define RAP_RAP 0x3f /* Bit 6..0: 0 = block 0, .., 6f = block 6f*/ + +/* B0_CTST 16 bit Control/Status register */ + /* Bit 15..10: reserved */ +#define CS_BUS_CLOCK (1<<9) /* Bit 9: Bus Clock 0/1 = 33/66MHz */ +#define CS_BUS_SLOT_SZ (1<<8) /* Bit 8: Slot Size 0/1 = 32/64 bit slot*/ +#define CS_ST_SW_IRQ (1<<7) /* Bit 7: Set IRQ SW Request */ +#define CS_CL_SW_IRQ (1<<6) /* Bit 6: Clear IRQ SW Request */ +#define CS_STOP_DONE (1<<5) /* Bit 5: Stop Master is finished */ +#define CS_STOP_MAST (1<<4) /* Bit 4: Command Bit to stop the master*/ +#define CS_MRST_CLR (1<<3) /* Bit 3: Clear Master reset */ +#define CS_MRST_SET (1<<2) /* Bit 2: Set Master reset */ +#define CS_RST_CLR (1<<1) /* Bit 1: Clear Software reset */ +#define CS_RST_SET (1<<0) /* Bit 0: Set Software reset */ + +/* B0_LED 8 Bit LED register */ + /* Bit 7..2: reserved */ +#define LED_STAT_ON (1<<1) /* Bit 1: Status LED on */ +#define LED_STAT_OFF (1<<0) /* Bit 0: Status LED off */ + +/* B0_ISRC 32 bit Interrupt Source Register */ +/* B0_IMSK 32 bit Interrupt Mask Register */ +/* B0_SP_ISRC 32 bit Special Interrupt Source Reg */ +/* B2_IRQM_MSK 32 bit IRQ Moderation Mask */ +#define IS_ALL_MSK 0xbfffffffL /* All Interrupt bits */ +#define IS_HW_ERR (1UL<<31) /* Bit 31: Interrupt HW Error */ + /* Bit 30: reserved */ +#define IS_PA_TO_RX1 (1L<<29) /* Bit 29: Packet Arb Timeout Rx1*/ +#define IS_PA_TO_RX2 (1L<<28) /* Bit 28: Packet Arb Timeout Rx2*/ +#define IS_PA_TO_TX1 (1L<<27) /* Bit 27: Packet Arb Timeout Tx1*/ +#define IS_PA_TO_TX2 (1L<<26) /* Bit 26: Packet Arb Timeout Tx2*/ +#define IS_I2C_READY (1L<<25) /* Bit 25: IRQ on end of I2C tx */ +#define IS_IRQ_SW (1L<<24) /* Bit 24: SW forced IRQ */ +#define IS_EXT_REG (1L<<23) /* Bit 23: IRQ from external reg */ +#define IS_TIMINT (1L<<22) /* Bit 22: IRQ from Timer */ +#define IS_MAC1 (1L<<21) /* Bit 21: IRQ from MAC 1 */ +#define IS_LNK_SYNC_M1 (1L<<20) /* Bit 20: Link Sync Cnt wrap M1 */ +#define IS_MAC2 (1L<<19) /* Bit 19: IRQ from MAC 2 */ +#define IS_LNK_SYNC_M2 (1L<<18) /* Bit 18: Link Sync Cnt wrap M2 */ +/* Receive Queue 1 */ +#define IS_R1_B (1L<<17) /* Bit 17: Q_R1 End of Buffer */ +#define IS_R1_F (1L<<16) /* Bit 16: Q_R1 End of Frame */ +#define IS_R1_C (1L<<15) /* Bit 15: Q_R1 Encoding Error */ +/* Receive Queue 2 */ +#define IS_R2_B (1L<<14) /* Bit 14: Q_R2 End of Buffer */ +#define IS_R2_F (1L<<13) /* Bit 13: Q_R2 End of Frame */ +#define IS_R2_C (1L<<12) /* Bit 12: Q_R2 Encoding Error */ +/* Synchronous Transmit Queue 1 */ +#define IS_XS1_B (1L<<11) /* Bit 11: Q_XS1 End of Buffer */ +#define IS_XS1_F (1L<<10) /* Bit 10: Q_XS1 End of Frame */ +#define IS_XS1_C (1L<<9) /* Bit 9: Q_XS1 Encoding Error */ +/* Asynchronous Transmit Queue 1 */ +#define IS_XA1_B (1L<<8) /* Bit 8: Q_XA1 End of Buffer */ +#define IS_XA1_F (1L<<7) /* Bit 7: Q_XA1 End of Frame */ +#define IS_XA1_C (1L<<6) /* Bit 6: Q_XA1 Encoding Error */ +/* Synchronous Transmit Queue 2 */ +#define IS_XS2_B (1L<<5) /* Bit 5: Q_XS2 End of Buffer */ +#define IS_XS2_F (1L<<4) /* Bit 4: Q_XS2 End of Frame */ +#define IS_XS2_C (1L<<3) /* Bit 3: Q_XS2 Encoding Error */ +/* Asynchronous Transmit Queue 2 */ +#define IS_XA2_B (1L<<2) /* Bit 2: Q_XA2 End of Buffer */ +#define IS_XA2_F (1L<<1) /* Bit 1: Q_XA2 End of Frame */ +#define IS_XA2_C (1L<<0) /* Bit 0: Q_XA2 Encoding Error */ + + +/* B0_HWE_ISRC 32 bit HW Error Interrupt Src Reg */ +/* B0_HWE_IMSK 32 bit HW Error Interrupt Mask Reg */ +/* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ +#define IS_ERR_MSK 0x00000fffL /* All Error bits */ + /* Bit 31..12: reserved */ +#define IS_IRQ_MST_ERR (1L<<11) /* Bit 11: IRQ master error */ + /* PERR,RMABORT,RTABORT,DATAPERR */ +#define IS_IRQ_STAT (1L<<10) /* Bit 10: IRQ status execption */ + /* RMABORT, RTABORT, DATAPERR */ +#define IS_NO_STAT_M1 (1L<<9) /* Bit 9: No Rx Status from MAC1*/ +#define IS_NO_STAT_M2 (1L<<8) /* Bit 8: No Rx Status from MAC2*/ +#define IS_NO_TIST_M1 (1L<<7) /* Bit 7: No Timestamp from MAC1*/ +#define IS_NO_TIST_M2 (1L<<6) /* Bit 6: No Timestamp from MAC2*/ +#define IS_RAM_RD_PAR (1L<<5) /* Bit 5: RAM Read Parity Error */ +#define IS_RAM_WR_PAR (1L<<4) /* Bit 4: RAM Write Parity Error*/ +#define IS_M1_PAR_ERR (1L<<3) /* Bit 3: MAC 1 Parity Error */ +#define IS_M2_PAR_ERR (1L<<2) /* Bit 2: MAC 2 Parity Error */ +#define IS_R1_PAR_ERR (1L<<1) /* Bit 1: Queue R1 Parity Error */ +#define IS_R2_PAR_ERR (1L<<0) /* Bit 0: Queue R2 Parity Error */ + +/* B2_CONN_TYP 8 bit Connector type */ +/* B2_PMD_TYP 8 bit PMD type */ +/* Values of connector and PMD type comply to SysKonnect internal std */ + +/* B2_MAC_CFG 8 bit MAC Configuration */ + /* Bit 7..2: reserved */ +#define CFG_DIS_M2_CLK (1<<1) /* Bit 1: Disable Clock for 2nd MAC */ +#define CFG_SNG_MAC (1<<0) /* Bit 0: MAC Config: 1=2 MACs / 0=1 MAC*/ + +/* B2_CHIP_REV 8 bit Queen Chip Revision Number */ +#define FIRST_CHIP_REV 0x0a /* Initial Revision Value */ + +/* B2_FAR 32 bit Flash-Prom Addr Reg/Cnt */ +#define FAR_ADDR 0x1ffffL /* Bit 16..0: FPROM Address mask */ + +/* B2_LD_CRTL 8 bit EPROM loader control register */ +/* Bits are currently reserved */ + +/* B2_LD_TEST 8 bit EPROM loader test register */ + /* Bit 7..4: reserved */ +#define LD_T_ON (1<<3) /* Bit 3: Loader Testmode on */ +#define LD_T_OFF (1<<2) /* Bit 2: Loader Testmode off */ +#define LD_T_STEP (1<<1) /* Bit 1: Decrement FPROM addr. Counter */ +#define LD_START (1<<0) /* Bit 0: Start loading FPROM */ + +/* + * Timer Section + */ +/* B2_TI_CRTL 8 bit Timer control */ +/* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */ + /* Bit 7..3: reserved */ +#define TIM_START (1<<2) /* Bit 2: Start Timer */ +#define TIM_STOP (1<<1) /* Bit 1: Stop Timer */ +#define TIM_CLR_IRQ (1<<0) /* Bit 0: Clear Timer IRQ, (!IRQM) */ + +/* B2_TI_TEST 8 Bit Timer Test */ +/* B2_IRQM_TEST 8 bit IRQ Moderation Timer Test */ +/* B28_DPT_TST 8 bit Descriptor Poll Timer Test Reg */ + /* Bit 7..3: reserved */ +#define TIM_T_ON (1<<2) /* Bit 2: Test mode on */ +#define TIM_T_OFF (1<<1) /* Bit 1: Test mode off */ +#define TIM_T_STEP (1<<0) /* Bit 0: Test step */ + +/* B28_DPT_INI 32 bit Descriptor Poll Timer Init Val */ +/* B28_DPT_VAL 32 bit Descriptor Poll Timer Curr Val */ + /* Bit 31..24: reserved */ +#define DPT_MSK 0x00ffffffL /* Bit 23.. 0: Desc Poll Timer Bits */ + +/* B28_DPT_CTRL 8 bit Descriptor Poll Timer Ctrl Reg */ + /* Bit 7..2: reserved */ +#define DPT_START (1<<1) /* Bit 1: Start Desciptor Poll Timer */ +#define DPT_STOP (1<<0) /* Bit 0: Stop Desciptor Poll Timer */ + + +/* B2_TST_CTRL1 8 bit Test Control Register 1 */ +#define TST_FRC_DPERR_MR (1<<7) /* Bit 7: force DATAPERR on MST RD */ +#define TST_FRC_DPERR_MW (1<<6) /* Bit 6: force DATAPERR on MST WR */ +#define TST_FRC_DPERR_TR (1<<5) /* Bit 5: force DATAPERR on TRG RD */ +#define TST_FRC_DPERR_TW (1<<4) /* Bit 4: force DATAPERR on TRG WR */ +#define TST_FRC_APERR_M (1<<3) /* Bit 3: force ADDRPERR on MST */ +#define TST_FRC_APERR_T (1<<2) /* Bit 2: force ADDRPERR on TRG */ +#define TST_CFG_WRITE_ON (1<<1) /* Bit 1: Enable Config Reg WR */ +#define TST_CFG_WRITE_OFF (1<<0) /* Bit 0: Disable Config Reg WR */ + +/* B2_TST_CTRL2 8 bit Test Control Register 2 */ + /* Bit 7..4: reserved */ + /* force the following error on */ + /* the next master read/write */ +#define TST_FRC_DPERR_MR64 (1<<3) /* Bit 3: DataPERR RD 64 */ +#define TST_FRC_DPERR_MW64 (1<<2) /* Bit 2: DataPERR WR 64 */ +#define TST_FRC_APERR_1M64 (1<<1) /* Bit 1: AddrPERR on 1. phase */ +#define TST_FRC_APERR_2M64 (1<<0) /* Bit 0: AddrPERR on 2. phase */ + +/* B2_GP_IO 32 bit General Purpose IO Register */ + /* Bit 31..26: reserved */ +#define GP_DIR_9 (1L<<25) /* Bit 25: IO_9 direct, 0=I/1=O */ +#define GP_DIR_8 (1L<<24) /* Bit 24: IO_8 direct, 0=I/1=O */ +#define GP_DIR_7 (1L<<23) /* Bit 23: IO_7 direct, 0=I/1=O */ +#define GP_DIR_6 (1L<<22) /* Bit 22: IO_6 direct, 0=I/1=O */ +#define GP_DIR_5 (1L<<21) /* Bit 21: IO_5 direct, 0=I/1=O */ +#define GP_DIR_4 (1L<<20) /* Bit 20: IO_4 direct, 0=I/1=O */ +#define GP_DIR_3 (1L<<19) /* Bit 19: IO_3 direct, 0=I/1=O */ +#define GP_DIR_2 (1L<<18) /* Bit 18: IO_2 direct, 0=I/1=O */ +#define GP_DIR_1 (1L<<17) /* Bit 17: IO_1 direct, 0=I/1=O */ +#define GP_DIR_0 (1L<<16) /* Bit 16: IO_0 direct, 0=I/1=O */ + /* Bit 15..10: reserved */ +#define GP_IO_9 (1L<<9) /* Bit 9: IO_9 pin */ +#define GP_IO_8 (1L<<8) /* Bit 8: IO_8 pin */ +#define GP_IO_7 (1L<<7) /* Bit 7: IO_7 pin */ +#define GP_IO_6 (1L<<6) /* Bit 6: IO_6 pin */ +#define GP_IO_5 (1L<<5) /* Bit 5: IO_5 pin */ +#define GP_IO_4 (1L<<4) /* Bit 4: IO_4 pin */ +#define GP_IO_3 (1L<<3) /* Bit 3: IO_3 pin */ +#define GP_IO_2 (1L<<2) /* Bit 2: IO_2 pin */ +#define GP_IO_1 (1L<<1) /* Bit 1: IO_1 pin */ +#define GP_IO_0 (1L<<0) /* Bit 0: IO_0 pin */ + +/* B2_I2C_CTRL 32 bit I2C HW Control Register */ +#define I2C_FLAG (1UL<<31) /* Bit 31: Start read/write if WR*/ +#define I2C_ADDR (0x7fffL<<16) /* Bit 30..16: Addr to be RD/WR */ +#define I2C_DEV_SEL (0x7fL<<9) /* Bit 15.. 9: I2C Device Select */ + /* Bit 8.. 5: reserved */ +#define I2C_BURST_LEN (1L<<4) /* Bit 4: Burst Len, 1/4 bytes */ +#define I2C_DEV_SIZE (7L<<1) /* Bit 3.. 1: I2C Device Size */ +#define I2C_025K_DEV (0L<<1) /* 0: 256 Bytes or smal. */ +#define I2C_05K_DEV (1L<<1) /* 1: 512 Bytes */ +#define I2C_1K_DEV (2L<<1) /* 2: 1024 Bytes */ +#define I2C_2K_DEV (3L<<1) /* 3: 2048 Bytes */ +#define I2C_4K_DEV (4L<<1) /* 4: 4096 Bytes */ +#define I2C_8K_DEV (5L<<1) /* 5: 8192 Bytes */ +#define I2C_16K_DEV (6L<<1) /* 6: 16384 Bytes */ +#define I2C_32K_DEV (7L<<1) /* 7: 32768 Bytes */ +#define I2C_STOP (1L<<0) /* Bit 0: Interrupt I2C transfer*/ + +/* B2_I2C_IRQ 32 bit I2C HW IRQ Register */ + /* Bit 31..1 reserved */ +#define I2C_CLR_IRQ (1<<0) /* Bit 0: Clear I2C IRQ */ + +/* B2_I2C_SW 32 bit I2C HW SW Port Register */ + /* Bit 7..3: reserved */ +#define I2C_DATA_DIR (1<<2) /* Bit 2: direction of I2C_DATA */ +#define I2C_DATA (1<<1) /* Bit 1: I2C Data Port */ +#define I2C_CLK (1<<0) /* Bit 0: I2C Clock Port */ + +/* + * I2C Address + */ +#define I2C_SENS_ADDR LM80_ADDR /* I2C Sensor Address, (Volt and Temp)*/ + + +/* B2_BSC_CTRL 8 bit Blink Source Counter Control */ + /* Bit 7..2: reserved */ +#define BSC_START (1<<1) /* Bit 1: Start Blink Source Counter */ +#define BSC_STOP (1<<0) /* Bit 0: Stop Blink Source Counter */ + +/* B2_BSC_STAT 8 bit Blink Source Counter Status */ + /* Bit 7..1: reserved */ +#define BSC_SRC (1<<0) /* Bit 0: Blink Source, 0=Off / 1=On */ + +/* B2_BSC_TST 16 bit Blink Source Counter Test Reg */ +#define BSC_T_ON (1<<2) /* Bit 2: Test mode on */ +#define BSC_T_OFF (1<<1) /* Bit 1: Test mode off */ +#define BSC_T_STEP (1<<0) /* Bit 0: Test step */ + + +/* B3_RAM_ADDR 32 bit RAM Address, to read or write */ + /* Bit 31..19: reserved */ +#define RAM_ADR_RAN 0x0007ffffL /* Bit 18.. 0: RAM Address Range */ + +/* RAM Interface Registers */ +/* B3_RI_CTRL 16 bit RAM Iface Control Register */ + /* Bit 15..10: reserved */ +#define RI_CLR_RD_PERR (1<<9) /* Bit 9: Clear IRQ RAM Read Parity Err */ +#define RI_CLR_WR_PERR (1<<8) /* Bit 8: Clear IRQ RAM Write Parity Err*/ + /* Bit 7..2: reserved */ +#define RI_RST_CLR (1<<1) /* Bit 1: Clear RAM Interface Reset */ +#define RI_RST_SET (1<<0) /* Bit 0: Set RAM Interface Reset */ + +/* B3_RI_TEST 8 bit RAM Iface Test Register */ + /* Bit 15..4: reserved */ +#define RI_T_EV (1<<3) /* Bit 3: Timeout Event occured */ +#define RI_T_ON (1<<2) /* Bit 2: Timeout Timer Test On */ +#define RI_T_OFF (1<<1) /* Bit 1: Timeout Timer Test Off */ +#define RI_T_STEP (1<<0) /* Bit 0: Timeout Timer Step */ + +/* MAC Arbiter Registers */ +/* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */ + /* Bit 15..4: reserved */ +#define MA_FOE_ON (1<<3) /* Bit 3: XMAC Fast Output Enable ON */ +#define MA_FOE_OFF (1<<2) /* Bit 2: XMAC Fast Output Enable OFF */ +#define MA_RST_CLR (1<<1) /* Bit 1: Clear MAC Arbiter Reset */ +#define MA_RST_SET (1<<0) /* Bit 0: Set MAC Arbiter Reset */ + +/* B3_MA_RC_CTRL 16 bit MAC Arbiter Recovery Ctrl Reg */ + /* Bit 15..8: reserved */ +#define MA_ENA_REC_TX2 (1<<7) /* Bit 7: Enable Recovery Timer TX2 */ +#define MA_DIS_REC_TX2 (1<<6) /* Bit 6: Disable Recovery Timer TX2 */ +#define MA_ENA_REC_TX1 (1<<5) /* Bit 5: Enable Recovery Timer TX1 */ +#define MA_DIS_REC_TX1 (1<<4) /* Bit 4: Disable Recovery Timer TX1 */ +#define MA_ENA_REC_RX2 (1<<3) /* Bit 3: Enable Recovery Timer RX2 */ +#define MA_DIS_REC_RX2 (1<<2) /* Bit 2: Disable Recovery Timer RX2 */ +#define MA_ENA_REC_RX1 (1<<1) /* Bit 1: Enable Recovery Timer RX1 */ +#define MA_DIS_REC_RX1 (1<<0) /* Bit 0: Disable Recovery Timer RX1 */ + +/* Packet Arbiter Registers */ +/* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ + /* Bit 15..14: reserved */ +#define PA_CLR_TO_TX2 (1<<13) /* Bit 13: Clear IRQ Packet Timeout TX2 */ +#define PA_CLR_TO_TX1 (1<<12) /* Bit 12: Clear IRQ Packet Timeout TX1 */ +#define PA_CLR_TO_RX2 (1<<11) /* Bit 11: Clear IRQ Packet Timeout RX2 */ +#define PA_CLR_TO_RX1 (1<<10) /* Bit 10: Clear IRQ Packet Timeout RX1 */ +#define PA_ENA_TO_TX2 (1<<9) /* Bit 9: Enable Timeout Timer TX2 */ +#define PA_DIS_TO_TX2 (1<<8) /* Bit 8: Disable Timeout Timer TX2 */ +#define PA_ENA_TO_TX1 (1<<7) /* Bit 7: Enable Timeout Timer TX1 */ +#define PA_DIS_TO_TX1 (1<<6) /* Bit 6: Disable Timeout Timer TX1 */ +#define PA_ENA_TO_RX2 (1<<5) /* Bit 5: Enable Timeout Timer RX2 */ +#define PA_DIS_TO_RX2 (1<<4) /* Bit 4: Disable Timeout Timer RX2 */ +#define PA_ENA_TO_RX1 (1<<3) /* Bit 3: Enable Timeout Timer RX1 */ +#define PA_DIS_TO_RX1 (1<<2) /* Bit 2: Disable Timeout Timer RX1 */ +#define PA_RST_CLR (1<<1) /* Bit 1: Clear MAC Arbiter Reset */ +#define PA_RST_SET (1<<0) /* Bit 0: Set MAC Arbiter Reset */ + +#define PA_ENA_TO_ALL (PA_ENA_TO_RX1 | PA_ENA_TO_RX2 |\ + PA_ENA_TO_TX1 | PA_ENA_TO_TX2) + +/* Rx/Tx Path related Arbiter Test Registers */ +/* B3_MA_TO_TEST 16 bit MAC Arbiter Timeout Test Reg */ +/* B3_MA_RC_TEST 16 bit MAC Arbiter Recovery Test Reg */ +/* B3_PA_TEST 16 bit Packet Arbiter Test Register */ +/* Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */ +#define TX2_T_EV (1<<15) /* Bit 15: TX2 Timeout/Recv Event occured*/ +#define TX2_T_ON (1<<14) /* Bit 14: TX2 Timeout/Recv Timer Test On*/ +#define TX2_T_OFF (1<<13) /* Bit 13: TX2 Timeout/Recv Timer Tst Off*/ +#define TX2_T_STEP (1<<12) /* Bit 12: TX2 Timeout/Recv Timer Step */ +#define TX1_T_EV (1<<11) /* Bit 11: TX1 Timeout/Recv Event occured*/ +#define TX1_T_ON (1<<10) /* Bit 10: TX1 Timeout/Recv Timer Test On*/ +#define TX1_T_OFF (1<<9) /* Bit 9: TX1 Timeout/Recv Timer Tst Off*/ +#define TX1_T_STEP (1<<8) /* Bit 8: TX1 Timeout/Recv Timer Step */ +#define RX2_T_EV (1<<7) /* Bit 7: RX2 Timeout/Recv Event occured*/ +#define RX2_T_ON (1<<6) /* Bit 6: RX2 Timeout/Recv Timer Test On*/ +#define RX2_T_OFF (1<<5) /* Bit 5: RX2 Timeout/Recv Timer Tst Off*/ +#define RX2_T_STEP (1<<4) /* Bit 4: RX2 Timeout/Recv Timer Step */ +#define RX1_T_EV (1<<3) /* Bit 3: RX1 Timeout/Recv Event occured*/ +#define RX1_T_ON (1<<2) /* Bit 2: RX1 Timeout/Recv Timer Test On*/ +#define RX1_T_OFF (1<<1) /* Bit 1: RX1 Timeout/Recv Timer Tst Off*/ +#define RX1_T_STEP (1<<0) /* Bit 0: RX1 Timeout/Recv Timer Step */ + + +/* Transmit Arbiter Registers MAC 1 and 2, user MR_ADDR() to address */ +/* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */ +/* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */ +/* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */ +/* TXA_LIM_VAL 32 bit Tx Arb Limit Counter Value */ + /* Bit 31..24: reserved */ +#define TXA_MAX_VAL 0x00ffffffL /* Bit 23.. 0: Max TXA Timer/Cnt Val */ + +/* TXA_CTRL 8 bit Tx Arbiter Control Register */ +#define TXA_ENA_FSYNC (1<<7) /* Bit 7: Enable force of sync tx queue */ +#define TXA_DIS_FSYNC (1<<6) /* Bit 6: Disable force of sync tx queue*/ +#define TXA_ENA_ALLOC (1<<5) /* Bit 5: Enable alloc of free bandwidth*/ +#define TXA_DIS_ALLOC (1<<4) /* Bit 4: Disabl alloc of free bandwidth*/ +#define TXA_START_RC (1<<3) /* Bit 3: Start sync Rate Control */ +#define TXA_STOP_RC (1<<2) /* Bit 2: Stop sync Rate Control */ +#define TXA_ENA_ARB (1<<1) /* Bit 1: Enable Tx Arbiter */ +#define TXA_DIS_ARB (1<<0) /* Bit 0: Disable Tx Arbiter */ + +/* TXA_TEST 8 bit Tx Arbiter Test Register */ + /* Bit 7..6: reserved */ +#define TXA_INT_T_ON (1<<5) /* Bit 5: Tx Arb Interval Timer Test On */ +#define TXA_INT_T_OFF (1<<4) /* Bit 4: Tx Arb Interval Timer Test Off*/ +#define TXA_INT_T_STEP (1<<3) /* Bit 3: Tx Arb Interval Timer Step */ +#define TXA_LIM_T_ON (1<<2) /* Bit 2: Tx Arb Limit Timer Test On */ +#define TXA_LIM_T_OFF (1<<1) /* Bit 1: Tx Arb Limit Timer Test Off */ +#define TXA_LIM_T_STEP (1<<0) /* Bit 0: Tx Arb Limit Timer Step */ + +/* TXA_STAT 8 bit Tx Arbiter Status Register */ + /* Bit 7..1: reserved */ +#define TXA_PRIO_XS (1<<0) /* Bit 0: sync queue has prio to send */ + +/* Q_BC 32 bit Current Byte Counter */ + /* Bit 31..16: reserved */ +#define BC_MAX 0xffff /* Bit 15.. 0: Byte counter */ + +/* BMU Control Status Registers */ +/* B0_R1_CSR 32 bit BMU Ctrl/Stat Rx Queue 1 */ +/* B0_R2_CSR 32 bit BMU Ctrl/Stat Rx Queue 2 */ +/* B0_XA1_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */ +/* B0_XS1_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 1 */ +/* B0_XA2_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */ +/* B0_XS2_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 2 */ +/* Q_CSR 32 bit BMU Control/Status Register */ + /* Bit 31..25: reserved */ +#define CSR_SV_IDLE (1L<<24) /* Bit 24: BMU SM Idle */ + /* Bit 23..22: reserved */ +#define CSR_DESC_CLR (1L<<21) /* Bit 21: Clear Reset for Descr */ +#define CSR_DESC_SET (1L<<20) /* Bit 20: Set Reset for Descr */ +#define CSR_FIFO_CLR (1L<<19) /* Bit 19: Clear Reset for FIFO */ +#define CSR_FIFO_SET (1L<<18) /* Bit 18: Set Reset for FIFO */ +#define CSR_HPI_RUN (1L<<17) /* Bit 17: Release HPI SM */ +#define CSR_HPI_RST (1L<<16) /* Bit 16: Reset HPI SM to Idle */ +#define CSR_SV_RUN (1L<<15) /* Bit 15: Release Supervisor SM */ +#define CSR_SV_RST (1L<<14) /* Bit 14: Reset Supervisor SM */ +#define CSR_DREAD_RUN (1L<<13) /* Bit 13: Release Descr Read SM */ +#define CSR_DREAD_RST (1L<<12) /* Bit 12: Reset Descr Read SM */ +#define CSR_DWRITE_RUN (1L<<11) /* Bit 11: Rel. Descr Write SM */ +#define CSR_DWRITE_RST (1L<<10) /* Bit 10: Reset Descr Write SM */ +#define CSR_TRANS_RUN (1L<<9) /* Bit 9: Release Transfer SM */ +#define CSR_TRANS_RST (1L<<8) /* Bit 8: Reset Transfer SM */ +#define CSR_ENA_POL (1L<<7) /* Bit 7: Enable Descr Polling */ +#define CSR_DIS_POL (1L<<6) /* Bit 6: Disable Descr Polling */ +#define CSR_STOP (1L<<5) /* Bit 5: Stop Rx/Tx Queue */ +#define CSR_START (1L<<4) /* Bit 4: Start Rx/Tx Queue */ +#define CSR_IRQ_CL_P (1L<<3) /* Bit 3: (Rx) Clear Parity IRQ */ +#define CSR_IRQ_CL_B (1L<<2) /* Bit 2: Clear EOB IRQ */ +#define CSR_IRQ_CL_F (1L<<1) /* Bit 1: Clear EOF IRQ */ +#define CSR_IRQ_CL_C (1L<<0) /* Bit 0: Clear ERR IRQ */ + +#define CSR_SET_RESET (CSR_DESC_SET|CSR_FIFO_SET|CSR_HPI_RST|CSR_SV_RST|\ + CSR_DREAD_RST|CSR_DWRITE_RST|CSR_TRANS_RST) +#define CSR_CLR_RESET (CSR_DESC_CLR|CSR_FIFO_CLR|CSR_HPI_RUN|CSR_SV_RUN|\ + CSR_DREAD_RUN|CSR_DWRITE_RUN|CSR_TRANS_RUN) + + +/* Q_F 32 bit Flag Register */ + /* Bit 28..31: reserved */ +#define F_ALM_FULL (1L<<27) (Rx) /* Bit 27: (Rx) FIFO almost full */ +#define F_EMPTY (1L<<27) (Tx) /* Bit 27: (Tx) FIFO empty flag */ +#define F_FIFO_EOF (1L<<26) /* Bit 26: Fag bit in FIFO */ +#define F_WM_REACHED (1L<<25) /* Bit 25: Watermark reached */ + /* Bit 24: reserved */ +#define F_FIFO_LEVEL (0x1fL<<16) /* Bit 23..16: # of Qwords in FIFO */ + /* Bit 15..11: reserved */ +#define F_WATER_MARK 0x0007ffL /* Bit 10.. 0: Watermark */ + +/* Q_T1 32 bit Test Register 1 */ +/* Holds four State Machine control Bytes */ +#define SM_CRTL_SV (0xffL<<24) /* Bit 31..24: Control Supervisor SM */ +#define SM_CRTL_RD (0xffL<<16) /* Bit 23..16: Control Read Desc SM */ +#define SM_CRTL_WR (0xffL<<8) /* Bit 15.. 8: Control Write Desc SM */ +#define SM_CRTL_TR (0xffL<<0) /* Bit 7.. 0: Control Transfer SM */ + +/* Q_T1_TR 8 bit Test Register 1 Transfer SM */ +/* Q_T1_WR 8 bit Test Register 1 Write Descriptor SM */ +/* Q_T1_RD 8 bit Test Register 1 Read Descriptor SM */ +/* Q_T1_SV 8 bit Test Register 1 Supervisor SM */ +/* The control status byte of each machine looks like ... */ +#define SM_STATE 0xf0 /* Bit 7..4: State which shall be loaded */ +#define SM_LOAD (1<<3) /* Bit 3: Load the SM with SM_STATE */ +#define SM_TEST_ON (1<<2) /* Bit 2: Switch on SM Test Mode */ +#define SM_TEST_OFF (1<<1) /* Bit 1: Go off the Test Mode */ +#define SM_STEP (1<<0) /* Bit 0: Step the State Machine */ +/* The encoding of the states is not supported by the Diagnostics Tool */ + +/* Q_T2 32 bit Test Register 2 */ + /* Bit 31..8: reserved */ +#define T2_AC_T_ON (1<<7) /* Bit 7: Address Counter Test Mode on */ +#define T2_AC_T_OFF (1<<6) /* Bit 6: Address Counter Test Mode off*/ +#define T2_BC_T_ON (1<<5) /* Bit 5: Byte Counter Test Mode on */ +#define T2_BC_T_OFF (1<<4) /* Bit 4: Byte Counter Test Mode off */ +#define T2_STEP04 (1<<3) /* Bit 3: Inc AC/Dec BC by 4 */ +#define T2_STEP03 (1<<2) /* Bit 2: Inc AC/Dec BC by 3 */ +#define T2_STEP02 (1<<1) /* Bit 1: Inc AC/Dec BC by 2 */ +#define T2_STEP01 (1<<0) /* Bit 0: Inc AC/Dec BC by 1 */ + +/* Q_T3 32 bit Test Register 3 */ + /* Bit 31..7: reserved */ +#define T3_MUX (7<<4) /* Bit 6.. 4: Mux Position */ + /* Bit 3: reserved */ +#define T3_VRAM (7<<0) /* Bit 2.. 0: Virtual RAM Buffer Address */ + +/* RAM Buffer Register Offsets */ +/* use RB_ADDR(Queue,Offs) to address */ +/* RB_START 32 bit RAM Buffer Start Address */ +/* RB_END 32 bit RAM Buffer End Address */ +/* RB_WP 32 bit RAM Buffer Write Pointer */ +/* RB_RP 32 bit RAM Buffer Read Pointer */ +/* RB_RX_UTPP 32 bit Rx Upper Threshold, Pause Pack */ +/* RB_RX_LTPP 32 bit Rx Lower Threshold, Pasue Pack */ +/* RB_RX_UTHP 32 bit Rx Upper Threshold, High Prio */ +/* RB_RX_LTHP 32 bit Rx Lower Threshold, High Prio */ +/* RB_PC 32 bit RAM Buffer Packet Counter */ +/* RB_LEV 32 bit RAM Buffer Level Register */ + /* Bit 31..19: reserved */ +#define RB_MSK 0x0007ffff /* Bit 18.. 0: RAM Buffer Pointer Bits */ + +/* RB_TST2 8 bit RAM Buffer Test Register 2 */ + /* Bit 4..7: reserved */ +#define RB_PC_DEC (1<<3) /* Bit 3: Packet Counter Decrem */ +#define RB_PC_T_ON (1<<2) /* Bit 2: Packet Counter Test On */ +#define RB_PC_T_OFF (1<<1) /* Bit 1: Packet Counter Tst Off */ +#define RB_PC_INC (1<<0) /* Bit 0: Packet Counter Increm */ + +/* RB_TST1 8 bit RAM Buffer Test Register 1 */ + /* Bit 7: reserved */ +#define RB_WP_T_ON (1<<6) /* Bit 6: Write Pointer Test On */ +#define RB_WP_T_OFF (1<<5) /* Bit 5: Write Pointer Test Off */ +#define RB_WP_INC (1<<4) /* Bit 4: Write Pointer Increm */ + /* Bit 3: reserved */ +#define RB_RP_T_ON (1<<2) /* Bit 2: Read Pointer Test On */ +#define RB_RP_T_OFF (1<<1) /* Bit 1: Read Pointer Test Off */ +#define RB_RP_DEC (1<<0) /* Bit 0: Read Pointer Decrement */ + +/* RB_CTRL 8 bit RAM Buffer Control Register */ + /* Bit 7..6: reserved */ +#define RB_ENA_STFWD (1<<5) /* Bit 5: Enable Store & Forward */ +#define RB_DIS_STFWD (1<<4) /* Bit 4: Disab. Store & Forward */ +#define RB_ENA_OP_MD (1<<3) /* Bit 3: Enable Operation Mode */ +#define RB_DIS_OP_MD (1<<2) /* Bit 2: Disab. Operation Mode */ +#define RB_RST_CLR (1<<1) /* Bit 1: Clr RAM Buf STM Reset */ +#define RB_RST_SET (1<<0) /* Bit 0: Set RAM Buf STM Reset */ + + +/* Receive and Transmit MAC FIFO Registers, use MR_ADDR() to address */ +/* RX_MFF_EA 32 bit Receive MAC FIFO End Address */ +/* RX_MFF_WP 32 bit Receive MAC FIFO Write Pointer */ +/* RX_MFF_RP 32 bit Receive MAC FIFO Read Pointer */ +/* RX_MFF_PC 32 bit Receive MAC FIFO Packet Counter*/ +/* RX_MFF_LEV 32 bit Receive MAC FIFO Level */ +/* TX_MFF_EA 32 bit Transmit MAC FIFO End Address */ +/* TX_MFF_WP 32 bit Transmit MAC FIFO Write Pointer*/ +/* TX_MFF_WSP 32 bit Transmit MAC FIFO WR Shadow Pt*/ +/* TX_MFF_RP 32 bit Transmit MAC FIFO Read Pointer */ +/* TX_MFF_PC 32 bit Transmit MAC FIFO Packet Cnt */ +/* TX_MFF_LEV 32 bit Transmit MAC FIFO Level */ + /* Bit 31..6: reserved */ +#define MFF_MSK 0x007fL /* Bit 5..0: MAC FIFO Address/Pointer Bits */ + +/* RX_MFF_CTRL1 16 bit Receive MAC FIFO Control Reg 1 */ + /* Bit 15..14: reserved */ +#define MFF_ENA_RDY_PAT (1<<13) /* Bit 13: Enable Ready Patch */ +#define MFF_DIS_RDY_PAT (1<<12) /* Bit 12: Disable Ready Patch */ +#define MFF_ENA_TIM_PAT (1<<11) /* Bit 11: Enable Timing Patch */ +#define MFF_DIS_TIM_PAT (1<<10) /* Bit 10: Disable Timing Patch */ +#define MFF_ENA_ALM_FUL (1<<9) /* Bit 9: Enable AlmostFull Sign*/ +#define MFF_DIS_ALM_FUL (1<<8) /* Bit 8: Disab. AlmostFull Sign*/ +#define MFF_ENA_PAUSE (1<<7) /* Bit 7: Enable Pause Signaling*/ +#define MFF_DIS_PAUSE (1<<6) /* Bit 6: Disab. Pause Signaling*/ +#define MFF_ENA_FLUSH (1<<5) /* Bit 5: Enable Frame Flushing */ +#define MFF_DIS_FLUSH (1<<4) /* Bit 4: Disab. Frame Flushing */ +#define MFF_ENA_TIST (1<<3) /* Bit 3: Enable Timestamp Gener*/ +#define MFF_DIS_TIST (1<<2) /* Bit 2: Disab. Timestamp Gener*/ +#define MFF_CLR_INTIST (1<<1) /* Bit 1: Clear IRQ No Timestamp*/ +#define MFF_CLR_INSTAT (1<<0) /* Bit 0: Clear IRQ No Status */ + +#define MFF_RX_CTRL_DEF MFF_ENA_TIM_PAT + +/* TX_MFF_CTRL1 16 bit Transmit MAC FIFO Control Reg 1 */ +#define MFF_CLR_PERR (1<<15) /* Bit 15: Clear Parity Error IRQ*/ + /* Bit 14: reserved */ +#define MFF_ENA_PKT_REC (1<<13) /* Bit 13: Enable Packet Recovery*/ +#define MFF_DIS_PKT_REC (1<<12) /* Bit 12: Disable Packet Recov. */ +/* MFF_ENA_TIM_PAT (see RX_MFF_CTRL1)Bit 11: Enable Timing Patch */ +/* MFF_DIS_TIM_PAT (see RX_MFF_CTRL1)Bit 10: Disable Timing Patch */ +/* MFF_ENA_ALM_FUL (see RX_MFF_CTRL1)Bit 9: Enable AlmostFull Sign*/ +/* MFF_DIS_ALM_FUL (see RX_MFF_CTRL1)Bit 8: Disab. AlmostFull Sign*/ +#define MFF_ENA_W4E (1<<7) /* Bit 7: Enable Wait for Empty */ +#define MFF_DIS_W4E (1<<6) /* Bit 6: Disab. Wait for Empty */ +/* MFF_ENA_FLUSH (see RX_MFF_CTRL1)Bit 5: Enable Frame Flushing */ +/* MFF_DIS_FLUSH (see RX_MFF_CTRL1)Bit 4: Disab. Frame Flushing */ +#define MFF_ENA_LOOPB (1<<3) /* Bit 3: Enable Loopback */ +#define MFF_DIS_LOOPB (1<<2) /* Bit 2: Disable Loopback */ +#define MFF_CLR_MAC_RST (1<<1) /* Bit 1: Clear XMAC Reset */ +#define MFF_SET_MAC_RST (1<<0) /* Bit 0: Set XMAC Reset */ + +#define MFF_TX_CTRL_DEF (MFF_ENA_PKT_REC | MFF_ENA_TIM_PAT | MFF_ENA_FLUSH) + +/* RX_MFF_TST2 8 bit Receive MAC FIFO Test Register 2 */ +/* TX_MFF_TST2 8 bit Transmit MAC FIFO Test Register 2 */ + /* Bit 7: reserved */ +#define MFF_WSP_T_ON (1<<6) /* Bit 6: (Tx) Write Shadow Pt TestOn */ +#define MFF_WSP_T_OFF (1<<5) /* Bit 5: (Tx) Write Shadow Pt TstOff */ +#define MFF_WSP_INC (1<<4) /* Bit 4: (Tx) Write Shadow Pt Increm */ +#define MFF_PC_DEC (1<<3) /* Bit 3: Packet Counter Decrem */ +#define MFF_PC_T_ON (1<<2) /* Bit 2: Packet Counter Test On */ +#define MFF_PC_T_OFF (1<<1) /* Bit 1: Packet Counter Tst Off */ +#define MFF_PC_INC (1<<0) /* Bit 0: Packet Counter Increm */ + +/* RX_MFF_TST1 8 bit Receive MAC FIFO Test Register 1 */ +/* TX_MFF_TST1 8 bit Transmit MAC FIFO Test Register 1 */ + /* Bit 7: reserved */ +#define MFF_WP_T_ON (1<<6) /* Bit 6: Write Pointer Test On */ +#define MFF_WP_T_OFF (1<<5) /* Bit 5: Write Pointer Test Off */ +#define MFF_WP_INC (1<<4) /* Bit 4: Write Pointer Increm */ + /* Bit 3: reserved */ +#define MFF_RP_T_ON (1<<2) /* Bit 2: Read Pointer Test On */ +#define MFF_RP_T_OFF (1<<1) /* Bit 1: Read Pointer Test Off */ +#define MFF_RP_DEC (1<<0) /* Bit 0: Read Pointer Decrement */ + +/* RX_MFF_CTRL2 8 bit Receive MAC FIFO Control Reg 2 */ +/* TX_MFF_CTRL2 8 bit Transmit MAC FIFO Control Reg 2 */ + /* Bit 7..4: reserved */ +#define MFF_ENA_OP_MD (1<<3) /* Bit 3: Enable Operation Mode */ +#define MFF_DIS_OP_MD (1<<2) /* Bit 2: Disab. Operation Mode */ +#define MFF_RST_CLR (1<<1) /* Bit 1: Clear MAC FIFO Reset */ +#define MFF_RST_SET (1<<0) /* Bit 0: Set MAC FIFO Reset */ + + +/* Receive, Transmit, and Link LED Counter Registers */ +/* RX_LED_CTRL 8 bit Receive LED Cnt Control Reg */ +/* TX_LED_CTRL 8 bit Transmit LED Cnt Control Reg */ +/* LNK_SYNC_CTRL 8 bit Link Sync Cnt Control Register */ + /* Bit 7..3: reserved */ +#define LED_START (1<<2) /* Bit 2: Start Timer */ +#define LED_STOP (1<<1) /* Bit 1: Stop Timer */ +#define LED_STATE (1<<0) /* Bit 0:(Rx/Tx)LED State, 1=LED on */ +#define LED_CLR_IRQ (1<<0) /* Bit 0:(Lnk) Clear Link IRQ */ + +/* RX_LED_TST 8 bit Receive LED Cnt Test Register */ +/* TX_LED_TST 8 bit Transmit LED Cnt Test Register */ +/* LNK_SYNC_TST 8 bit Link Sync Cnt Test Register */ + /* Bit 7..3: reserved */ +#define LED_T_ON (1<<2) /* Bit 2: LED Counter Testmode On */ +#define LED_T_OFF (1<<1) /* Bit 1: LED Counter Testmode Off */ +#define LED_T_STEP (1<<0) /* Bit 0: LED Counter Step */ + +/* LNK_LED_REG 8 bit Link LED Register */ + /* Bit 7..6: reserved */ +#define LED_BLK_ON (1<<5) /* Bit 5: Link LED Blinking On */ +#define LED_BLK_OFF (1<<4) /* Bit 4: Link LED Blinking Off */ +#define LED_SYNC_ON (1<<3) /* Bit 3: Use Sync Wire to switch LED */ +#define LED_SYNC_OFF (1<<2) /* Bit 2: Disable Sync Wire Input */ +#define LED_ON (1<<1) /* Bit 1: switch LED on */ +#define LED_OFF (1<<0) /* Bit 0: switch LED off */ + + +/* Receive and Transmit Descriptors ******************************************/ + +/* Transmit Descriptor struct */ +typedef struct s_HwTxd { + SK_U32 volatile TxCtrl; /* Transmit Buffer Control Field */ + SK_U32 TxNext ; /* Physical Address Pointer to the next TxD */ + SK_U32 TxAdrLo ; /* Physical Tx Buffer Address lower dword */ + SK_U32 TxAdrHi ; /* Physical Tx Buffer Address upper dword */ + SK_U32 TxStat ; /* Transmit Frame Status Word */ +#ifndef SK_USE_REV_DESC + SK_U16 TxTcpOffs ; /* TCP Checksum Calculation Start Value */ + SK_U16 TxRes1 ; /* 16 bit reserved field */ + SK_U16 TxTcpWp ; /* TCP Checksum Write Position */ + SK_U16 TxTcpSp ; /* TCP Checksum Calculation Start Position */ +#else /* SK_USE_REV_DESC */ + SK_U16 TxRes1 ; /* 16 bit reserved field */ + SK_U16 TxTcpOffs ; /* TCP Checksum Calculation Start Value */ + SK_U16 TxTcpSp ; /* TCP Checksum Calculation Start Position */ + SK_U16 TxTcpWp ; /* TCP Checksum Write Position */ +#endif /* SK_USE_REV_DESC */ + SK_U32 TxRes2; /* 32 bit reserved field */ +} SK_HWTXD; + +/* Receive Descriptor struct */ +typedef struct s_HwRxd { + SK_U32 volatile RxCtrl; /* Receive Buffer Control Field */ + SK_U32 RxNext ; /* Physical Address Pointer to the next TxD */ + SK_U32 RxAdrLo ; /* Physical Receive Buffer Address lower dword*/ + SK_U32 RxAdrHi ; /* Physical Receive Buffer Address upper dword*/ + SK_U32 RxStat ; /* Receive Frame Status Word */ + SK_U32 RxTiSt ; /* Receive Timestamp provided by the XMAC */ +#ifndef SK_USE_REV_DESC + SK_U16 RxTcpSum1 ; /* TCP Checksum 1 */ + SK_U16 RxTcpSum2 ; /* TCP Checksum 2 */ + SK_U16 RxTcpSp1 ; /* TCP Checksum Calculation Start Position 1 */ + SK_U16 RxTcpSp2 ; /* TCP Checksum Calculation Start Position 2 */ +#else /* SK_USE_REV_DESC */ + SK_U16 RxTcpSum2 ; /* TCP Checksum 2 */ + SK_U16 RxTcpSum1 ; /* TCP Checksum 1 */ + SK_U16 RxTcpSp2 ; /* TCP Checksum Calculation Start Position 2 */ + SK_U16 RxTcpSp1 ; /* TCP Checksum Calculation Start Position 1 */ +#endif /* SK_USE_REV_DESC */ +} SK_HWRXD; + +/* + * Drivers which use the reverse descriptor feature (PCI_OUR_REG_2) + * should set the define SK_USE_REV_DESC. + * Structures are 'normaly' not endianess dependent. But in + * this case the SK_U16 fields are bound to bit positions inside the + * descriptor. RxTcpSum1 e.g. must start at bit 0 within the 6.th DWord. + * The bit positions inside a DWord are of course endianess dependent and + * swaps if the DWord is swaped by the hardware. + */ + + +/* Descriptor Bit Definition */ +/* TxCtrl Transmit Buffer Control Field */ +/* RxCtrl Receive Buffer Control Field */ +#define BMU_OWN (1UL<<31) /* Bit 31: OWN bit: 0=host/1=BMU */ +#define BMU_STF (1L<<30) /* Bit 30: Start of Frame ? */ +#define BMU_EOF (1L<<29) /* Bit 29: End of Frame ? */ +#define BMU_IRQ_EOB (1L<<28) /* Bit 28: Req "End of Buff" IRQ */ +#define BMU_IRQ_EOF (1L<<27) /* Bit 27: Req "End of Frame" IRQ*/ +/* TxCtrl specific bits */ +#define BMU_STFWD (1L<<26) /* Bit 26: (Tx) Store&Forward Frame */ +#define BMU_NO_FCS (1L<<25) /* Bit 25: (Tx) disable XMAC FCS gener*/ +#define BMU_SW (1L<<24) /* Bit 24: (Tx) 1 bit res. for SW use */ +/* RxCtrl specific bits */ +#define BMU_DEV_0 (1L<<26) /* Bit 26: (Rx) transfer data to Dev0 */ +#define BMU_STAT_VAL (1L<<25) /* Bit 25: (Rx) RxStat Valid */ +#define BMU_TIST_VAL (1L<<24) /* Bit 24: (Rx) RxTiSt Valid */ + /* Bit 23..16: BMU Check Opcodes */ +#define BMU_CHECK 0x00550000L /* Default BMU check */ +#define BMU_TCP_CHECK 0x00560000L /* Descr with TCP ext */ +#define BMU_BBC 0x0000FFFFL /* Bit 15..0: Buffer Byte Counter */ + +/* TxStat Transmit Frame Status Word */ +/* RxStat Receive Frame Status Word */ +/* + *Note: TxStat is reserved for ASIC loopback mode only + * + * The Bits of the Status words are defined in xmac_ii.h + * (see XMR_FS bits) + */ + +/* other defines *************************************************************/ + +/* + * FlashProm specification + */ +#define MAX_PAGES 0x20000L /* Every byte has a single page */ +#define MAX_FADDR 1 /* 1 byte per page */ +#define SKFDDI_PSZ 8 /* address PROM size */ + +/* macros ********************************************************************/ + +/* + * Receive and Transmit Queues + */ +#define Q_R1 0x0000 /* Receive Queue 1 */ +#define Q_R2 0x0080 /* Receive Queue 2 */ +#define Q_XS1 0x0200 /* Synchronous Transmit Queue 1 */ +#define Q_XA1 0x0280 /* Asynchronous Transmit Queue 1 */ +#define Q_XS2 0x0300 /* Synchronous Transmit Queue 2 */ +#define Q_XA2 0x0380 /* Asynchronous Transmit Queue 2 */ + +/* + * Macro Q_ADDR() + * + * Use this macro to address the Receive and Transmit Queue Registers. + * + * para Queue Queue to address. + * Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, and Q_XA2 + * Offs Queue register offset. + * Values: Q_D, Q_DA_L ... Q_T2, Q_T3 + * + * usage SK_IN32(pAC,Q_ADDR(Q_R2,Q_BC),pVal) + */ +#define Q_ADDR(Queue,Offs) (B8_Q_REGS + (Queue) + (Offs)) + +/* + * Macro RB_ADDR() + * + * Use this macro to address the RAM Buffer Registers. + * + * para Queue Queue to address. + * Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, and Q_XA2 + * Offs Queue register offset. + * Values: RB_START, RB_END ... RB_LEV, RB_CTRL + * + * usage SK_IN32(pAC,RB_ADDR(Q_R2,RB_RP),pVal) + */ +#define RB_ADDR(Queue,Offs) (B16_RAM_REGS + (Queue) + (Offs)) + + +/* + * MAC Related Registers + */ +#define MAC_1 0 /* belongs to the port near the slot */ +#define MAC_2 1 /* belongs to the port far away from the slot */ + +/* + * Macro MR_ADDR() + * + * Use this macro to address a MAC Related Registers in side the ASIC. + * + * para Queue Queue to address. + * Values: TXA_ITI_INI ... TXA_TEST, + * RX_MFF_EA ... RX_LED_TST, + * LNK_SYNC_INI ... LNK_LED_REG, and + * TX_MFF_EA ... TX_LED_TST + * Mac MAC to address. + * Values: MAC_1, MAC_2 + * + * usage SK_IN32(pAC,MR_ADDR(MAC_1,TX_MFF_EA),pVal) + */ +#define MR_ADDR(Mac,Offs) (((Mac) << 7) + (Offs)) + + + +/* + * macros to access the XMAC + * + * XM_IN16(), to read a 16 bit register (e.g. XM_MMU_CMD) + * XM_OUT16(), to write a 16 bit register (e.g. XM_MMU_CMD) + * XM_IN32(), to read a 32 bit register (e.g. XM_TX_EV_CNT) + * XM_OUT32(), to write a 32 bit register (e.g. XM_TX_EV_CNT) + * XM_INADDR(), to read a network address register (e.g. XM_SRC_CHK) + * XM_OUTADDR(), to write a network address register (e.g. XM_SRC_CHK) + * XM_INHASH(), to read the XM_HSM_CHK register + * XM_OUTHASH() to write the XM_HSM_CHK register + * + * para: Mac XMAC to address values: MAC_1 or MAC_2 + * IoC I/O context needed for SK IO macros + * Reg XMAC Register to read or write + * (p)Val Value or pointer to the value which should be read or + * written. + * + * usage: XM_OUT16(IoC, MAC_1, XM_MMU_CMD, Value) ; + */ + +#ifdef SK_LITTLE_ENDIAN +#define XM_WORD_LO 0 +#define XM_WORD_HI 1 +#else /* !SK_LITTLE_ENDIAN */ +#define XM_WORD_LO 1 +#define XM_WORD_HI 0 +#endif /* !SK_LITTLE_ENDIAN */ + +#define XMA(Mac,Reg) (((0x1000 << (Mac)) + 0x1000) | ((Reg) << 1)) + +#define XM_IN16(IoC,Mac,Reg,pVal) SK_IN16((IoC),XMA((Mac),(Reg)),(pVal)) +#define XM_OUT16(IoC,Mac,Reg,Val) SK_OUT16((IoC),XMA((Mac),(Reg)),(Val)) + +#define XM_IN32(IoC,Mac,Reg,pVal) { \ + SK_IN16((IoC),XMA((Mac),(Reg)), \ + (SK_U16 *)&((SK_U16 *)(pVal))[XM_WORD_LO]); \ + SK_IN16((IoC),XMA((Mac),(Reg+2)), \ + (SK_U16 *)&((SK_U16 *)(pVal))[XM_WORD_HI]); \ +} + +#define XM_OUT32(IoC,Mac,Reg,Val) { \ + SK_OUT16((IoC),XMA((Mac),(Reg)), (SK_U16)((Val) & 0x0000ffffL));\ + SK_OUT16((IoC),XMA((Mac),(Reg+2)),(SK_U16)(((Val)>>16) & 0x0000ffffL));\ +} + +/* + * Remember: we are always writing to / reading from LITTLE ENDIAN memory + */ + +#define XM_INADDR(IoC, Mac, Reg, pVal) { \ + SK_U16 Word; \ + SK_U8 *pByte; \ + pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \ + SK_IN16((IoC), XMA((Mac), (Reg)), &Word); \ + pByte[0] = (SK_U8) (Word & 0x00ff); \ + pByte[1] = (SK_U8) ((Word >> 8) & 0x00ff); \ + SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word); \ + pByte[2] = (SK_U8) (Word & 0x00ff); \ + pByte[3] = (SK_U8) ((Word >> 8) & 0x00ff); \ + SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word); \ + pByte[4] = (SK_U8) (Word & 0x00ff); \ + pByte[5] = (SK_U8) ((Word >> 8) & 0x00ff); \ +} + +#define XM_OUTADDR(IoC, Mac, Reg, pVal) { \ + SK_U8 *pByte; \ + pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \ + SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16) \ + (((SK_U16)(pByte[0]) & 0x00ff)| \ + (((SK_U16)(pByte[1]) << 8) & 0xff00))); \ + SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16) \ + (((SK_U16)(pByte[2]) & 0x00ff)| \ + (((SK_U16)(pByte[3]) << 8) & 0xff00))); \ + SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16) \ + (((SK_U16)(pByte[4]) & 0x00ff)| \ + (((SK_U16)(pByte[5]) << 8) & 0xff00))); \ +} + +#define XM_INHASH(IoC, Mac, Reg, pVal) { \ + SK_U16 Word; \ + SK_U8 *pByte; \ + pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \ + SK_IN16((IoC), XMA((Mac), (Reg)), &Word); \ + pByte[0] = (SK_U8) (Word & 0x00ff); \ + pByte[1] = (SK_U8) ((Word >> 8) & 0x00ff); \ + SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word); \ + pByte[2] = (SK_U8) (Word & 0x00ff); \ + pByte[3] = (SK_U8) ((Word >> 8) & 0x00ff); \ + SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word); \ + pByte[4] = (SK_U8) (Word & 0x00ff); \ + pByte[5] = (SK_U8) ((Word >> 8) & 0x00ff); \ + SK_IN16((IoC), XMA((Mac), (Reg+6)), &Word); \ + pByte[6] = (SK_U8) (Word & 0x00ff); \ + pByte[7] = (SK_U8) ((Word >> 8) & 0x00ff); \ +} + +#define XM_OUTHASH(IoC, Mac, Reg, pVal) { \ + SK_U8 *pByte; \ + pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \ + SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16) \ + (((SK_U16)(pByte[0]) & 0x00ff)| \ + (((SK_U16)(pByte[1]) << 8) & 0xff00))); \ + SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16) \ + (((SK_U16)(pByte[2]) & 0x00ff)| \ + (((SK_U16)(pByte[3]) << 8) & 0xff00))); \ + SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16) \ + (((SK_U16)(pByte[4]) & 0x00ff)| \ + (((SK_U16)(pByte[5]) << 8) & 0xff00))); \ + SK_OUT16((IoC), XMA((Mac), (Reg+6)), (SK_U16) \ + (((SK_U16)(pByte[6]) & 0x00ff)| \ + (((SK_U16)(pByte[7]) << 8) & 0xff00))); \ +} + +/* + * Different PHY Types + */ +#define SK_PHY_XMAC 0 /* integrated in Xmac II*/ +#define SK_PHY_BCOM 1 /* Broadcom BCM5400 */ +#define SK_PHY_LONE 2 /* Level One LXT1000 */ +#define SK_PHY_NAT 3 /* National DP83891 */ + +/* + * PHY addresses (bits 8..12 of PHY address reg) + */ +#define PHY_ADDR_XMAC (0<<8) +#define PHY_ADDR_BCOM (1<<8) +#define PHY_ADDR_LONE (3<<8) +#define PHY_ADDR_NAT (0<<8) + +/* + * macros to access the PHY + * + * PHY_READ() read a 16 bit value from the PHY + * PHY_WIRTE() write a 16 bit value to the PHY + * + * para: IoC I/O context needed for SK IO macros + * pPort Pointer to port struct for PhyAddr + * Mac XMAC to address values: MAC_1 or MAC_2 + * PhyReg PHY Register to read or write + * (p)Val Value or pointer to the value which should be read or + * written. + * + * usage: PHY_READ(IoC, pPort, MAC_1, PHY_CTRL, Value); + */ +#define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \ + SK_U16 Mmu; \ + \ + XM_OUT16((IoC),(Mac), XM_PHY_ADDR, (PhyReg)|(pPort)->PhyAddr); \ + XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ + if ((pPort)->PhyType != SK_PHY_XMAC) { \ + do { \ + XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + } while ((Mmu & XM_MMU_PHY_RDY) == 0); \ + XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ + } \ +} + +#define PHY_WRITE(IoC, pPort, Mac, PhyReg, Val) { \ + SK_U16 Mmu; \ + \ + if ((pPort)->PhyType != SK_PHY_XMAC) { \ + do { \ + XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + } while ((Mmu & XM_MMU_PHY_BUSY) != 0); \ + } \ + XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg)|(pPort)->PhyAddr); \ + XM_OUT16((IoC), (Mac), XM_PHY_DATA, (Val)); \ + if ((pPort)->PhyType != SK_PHY_XMAC) { \ + do { \ + XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + } while ((Mmu & XM_MMU_PHY_BUSY) != 0); \ + } \ +} + +/* + * Macro PCI_C() + * + * Use this macro to address PCI config register from the IO space. + * + * para Addr PCI configuration register to address. + * Values: PCI_VENDOR_ID ... PCI_VPD_ADDR, + * + * usage SK_IN16(pAC,PCI_C(PCI_VENDOR_ID),pVal); + */ +#define PCI_C(Addr) (B7_CFG_SPC + (Addr)) /* PCI Config Space */ + +/* + * Macro SK_ADDR(Base,Addr) + * + * Calculates the effective HW address + * + * para Base IO- or memory base address + * Addr Address offset + * + * usage: May be used in SK_INxx and SK_OUTxx macros + * #define SK_IN8(pAC,Addr,pVal) ...\ + * *pVal = (SK_U8) inp(SK_ADDR(pAC->Hw.Iop,Addr))) + */ +#ifdef SK_MEM_MAPPED_IO +#define SK_HW_ADDR(Base,Addr) ((Base)+(Addr)) +#else /* SK_MEM_MAPPED_IO */ +#define SK_HW_ADDR(Base,Addr) ((Base)+(((Addr)&0x7F)|((Addr)>>7 ? 0x80:0))) +#endif /* SK_MEM_MAPPED_IO */ + +#define SZ_LONG (sizeof(SK_U32)) + +/* + * Macro SK_HWAC_LINK_LED() + * + * Use this macro to set the link LED mode. + * para pAC Pointer to adapter context struct + * IoC I/O context needed for SK IO macros + * Port Port number + * Mode Mode to set for this LED + */ +#define SK_HWAC_LINK_LED(pAC, IoC, Port, Mode) \ +SK_OUT8(IoC, MR_ADDR(Port,LNK_LED_REG), Mode); + + +/* typedefs *******************************************************************/ + + +/* function prototypes ********************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INC_SKGEHW_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgehwt.h linux/drivers/net/sk98lin/h/skgehwt.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgehwt.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgehwt.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,71 @@ +/****************************************************************************** + * + * Name: skhwt.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.4 $ + * Date: $Date: 1998/08/19 09:50:58 $ + * Purpose: Defines for the hardware timer functions + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgehwt.h,v $ + * Revision 1.4 1998/08/19 09:50:58 gklug + * fix: remove struct keyword from c-code (see CCC) add typedefs + * + * Revision 1.3 1998/08/14 07:09:29 gklug + * fix: chg pAc -> pAC + * + * Revision 1.2 1998/08/07 12:54:21 gklug + * fix: first compiled version + * + * Revision 1.1 1998/08/07 09:32:58 gklug + * first version + * + * + * + * + * + ******************************************************************************/ + +/* + * SKGEHWT.H contains all defines and types for the timer functions + */ + +#ifndef _SKGEHWT_H_ +#define _SKGEHWT_H_ + +/* + * SK Hardware Timer + * - needed wherever the HWT module is used + * - use in Adapters context name pAC->Hwt + */ +typedef struct s_Hwt { + SK_U32 TStart ; /* HWT start */ + SK_U32 TStop ; /* HWT stop */ + int TActive ; /* HWT: flag : active/inactive */ +} SK_HWT; + +extern void SkHwtInit(SK_AC *pAC, SK_IOC Ioc); +extern void SkHwtStart(SK_AC *pAC, SK_IOC Ioc, SK_U32 Time); +extern void SkHwtStop(SK_AC *pAC, SK_IOC Ioc); +extern SK_U32 SkHwtRead(SK_AC *pAC,SK_IOC Ioc); +extern void SkHwtIsr(SK_AC *pAC, SK_IOC Ioc); +#endif /* _SKGEHWT_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgei2c.h linux/drivers/net/sk98lin/h/skgei2c.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgei2c.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgei2c.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,245 @@ +/****************************************************************************** + * + * Name: skgei2c.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.16 $ + * Date: $Date: 1999/11/12 08:24:10 $ + * Purpose: Special genesis defines for I2C + * (taken from Monalisa (taken from Concentrator)) + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgei2c.h,v $ + * Revision 1.16 1999/11/12 08:24:10 malthoff + * Change voltage warning and error limits + * (warning +-5%, error +-10%). + * + * Revision 1.15 1999/09/14 14:14:43 malthoff + * The 1000BT Dual Link adapter has got only one Fan. + * The second Fan has been removed. + * + * Revision 1.14 1999/05/27 13:40:50 malthoff + * Fan Divisor = 1. Assuming fan with 6500 rpm. + * + * Revision 1.13 1999/05/20 14:56:55 malthoff + * Bug Fix: Missing brace in SK_LM80_FAN_FAKTOR. + * + * Revision 1.12 1999/05/20 09:22:00 cgoos + * Changes for 1000Base-T (Fan sensors). + * + * Revision 1.11 1998/10/14 05:57:22 cgoos + * Fixed compilation warnings. + * + * Revision 1.10 1998/09/04 08:37:00 malthoff + * bugfix: correct the SK_I2C_GET_CTL() macro. + * + * Revision 1.9 1998/08/25 06:10:03 gklug + * add: thresholds for all sensors + * + * Revision 1.8 1998/08/20 11:37:42 gklug + * chg: change Ioc to IoC + * + * Revision 1.7 1998/08/20 08:53:11 gklug + * fix: compiler errors + * add: Threshold values + * + * Revision 1.6 1998/08/17 11:37:09 malthoff + * Bugfix in SK_I2C_CTL macro. The parameter 'dev' + * has to be shifted 9 bits. + * + * Revision 1.5 1998/08/17 06:52:21 malthoff + * Remove unrequired macros. + * Add macros for accessing I2C SW register. + * + * Revision 1.4 1998/08/13 08:30:18 gklug + * add: conversion factors for read values + * add: new state SEN_VALEXT to read extension value of temperature sensor + * + * Revision 1.3 1998/08/12 13:37:56 gklug + * rmv: error numbers and messages + * + * Revision 1.2 1998/08/11 07:54:38 gklug + * add: sensor states for GE sensors + * add: Macro to access I2c hardware register + * chg: Error messages for I2c errors + * + * Revision 1.1 1998/07/17 11:27:56 gklug + * Created. + * + * + * + ******************************************************************************/ + +/* + * SKGEI2C.H contains all SK-98xx specific defines for the I2C handling + */ + +#ifndef _INC_SKGEI2C_H_ +#define _INC_SKGEI2C_H_ + +/* + * Macros to access the B2_I2C_CTRL + */ +#define SK_I2C_CTL(IoC,flag,dev,reg,burst) \ + SK_OUT32(IoC,B2_I2C_CTRL,\ + (flag ? 0x80000000UL : 0x0L ) | \ + (((SK_U32) reg << 16) & I2C_ADDR) | \ + (((SK_U32) dev << 9) & I2C_DEV_SEL) | \ + (( burst << 4) & I2C_BURST_LEN) ) + +#define SK_I2C_STOP(IoC) { \ + SK_U32 I2cCtrl; \ + SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \ + SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \ +} + +#define SK_I2C_GET_CTL(Ioc,pI2cCtrl) SK_IN32(Ioc,B2_I2C_CTRL,pI2cCtrl) + +/* + * Macros to access the I2C SW Registers + */ +#define SK_I2C_SET_BIT(IoC, SetBits) { \ + SK_U8 OrgBits; \ + SK_IN8(IoC, B2_I2C_SW, &OrgBits); \ + SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SetBits)); \ +} + +#define SK_I2C_CLR_BIT(IoC,ClrBits) { \ + SK_U8 OrgBits; \ + SK_IN8(IoC, B2_I2C_SW, &OrgBits); \ + SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~(ClrBits)); \ +} + +#define SK_I2C_GET_SW(IoC,pI2cSw) SK_IN8(IoC,B2_I2C_SW,pI2cSw) + +/* + * define the possible sensor states + */ +#define SK_SEN_IDLE 0 /* Idle: sensor not read */ +#define SK_SEN_VALUE 1 /* Value Read cycle */ +#define SK_SEN_VALEXT 2 /* Extended Value Read cycle */ + +/* + * Conversion factor to convert read Voltage sensor to milli Volt + * Conversion factor to convert read Temperature sensor to 10th degree Celsius + */ +#define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */ +#define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */ +#define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for the + * extension value + */ +#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2)) +/* formula: counter = (22500*60)/(rpm * divisor * pulses/2) + * assuming: 6500rpm, 4 pulses, divisor 1 + */ + +/* + * Define sensor management data + * Maximum is reached on copperfield with dual Broadcom. + * Board specific maximum is in pAC->I2c.MaxSens + */ +#define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */ +#define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */ + +/* + * Defines for the individual Thresholds + */ + +/* Temperature sensor */ +#define SK_SEN_ERRHIGH0 800 /* Temperature High Err Threshold */ +#define SK_SEN_WARNHIGH0 700 /* Temperature High Warn Threshold */ +#define SK_SEN_WARNLOW0 100 /* Temperature Low Err Threshold */ +#define SK_SEN_ERRLOW0 0 /* Temperature Low Warn Threshold */ + +/* VCC which should be 5 V */ +#define SK_SEN_ERRHIGH1 5588 /* Voltage PCI High Err Threshold */ +#define SK_SEN_WARNHIGH1 5346 /* Voltage PCI High Warn Threshold */ +#define SK_SEN_WARNLOW1 4664 /* Voltage PCI Low Err Threshold */ +#define SK_SEN_ERRLOW1 4422 /* Voltage PCI Low Warn Threshold */ + +/* + * VIO may be 5 V or 3.3 V. Initialization takes two parts: + * 1. Initialize lowest lower limit and highest higher limit. + * 2. After the first value is read correct the upper or the lower limit to + * the appropriate C constant. + * + * Warning limits are +-5% of the exepected voltage. + * Error limits are +-10% of the expected voltage. + */ +#define SK_SEN_ERRHIGH2 5588 /* Voltage PCI-IO High Err Threshold */ +#define SK_SEN_WARNHIGH2 5346 /* Voltage PCI-IO High Warn Threshold */ +#define SK_SEN_WARNLOW2 3146 /* Voltage PCI-IO Low Err Threshold */ +#define SK_SEN_ERRLOW2 2970 /* Voltage PCI-IO Low Warn Threshold */ + +/* correction values for the second pass */ +#define SK_SEN_ERRHIGH2C 3630 /* Voltage PCI-IO High Err Threshold */ +#define SK_SEN_WARNHIGH2C 3476 /* Voltage PCI-IO High Warn Threshold */ +#define SK_SEN_WARNLOW2C 4664 /* Voltage PCI-IO Low Err Threshold */ +#define SK_SEN_ERRLOW2C 4422 /* Voltage PCI-IO Low Warn Threshold */ + +/* + * VDD voltage + */ +#define SK_SEN_ERRHIGH3 3630 /* Voltage ASIC High Err Threshold */ +#define SK_SEN_WARNHIGH3 3476 /* Voltage ASIC High Warn Threshold */ +#define SK_SEN_WARNLOW3 3146 /* Voltage ASIC Low Err Threshold */ +#define SK_SEN_ERRLOW3 2970 /* Voltage ASIC Low Warn Threshold */ + +/* + * PLC_3V3 voltage + * PHY_PLL_A_3V3 voltage + */ +#define SK_SEN_ERRHIGH4 3630 /* Voltage PMA High Err Threshold */ +#define SK_SEN_WARNHIGH4 3476 /* Voltage PMA High Warn Threshold */ +#define SK_SEN_WARNLOW4 3146 /* Voltage PMA Low Err Threshold */ +#define SK_SEN_ERRLOW4 2970 /* Voltage PMA Low Warn Threshold */ + +/* + * PHY_2V5 voltage + */ +#define SK_SEN_ERRHIGH5 2750 /* Voltage PHY High Err Threshold */ +#define SK_SEN_WARNHIGH5 2640 /* Voltage PHY High Warn Threshold */ +#define SK_SEN_WARNLOW5 2376 /* Voltage PHY Low Err Threshold */ +#define SK_SEN_ERRLOW5 2222 /* Voltage PHY Low Warn Threshold */ + +/* + * PHY_PLL_B_3V3 voltage + */ +#define SK_SEN_ERRHIGH6 3630 /* Voltage PMA High Err Threshold */ +#define SK_SEN_WARNHIGH6 3476 /* Voltage PMA High Warn Threshold */ +#define SK_SEN_WARNLOW6 3146 /* Voltage PMA Low Err Threshold */ +#define SK_SEN_ERRLOW6 2970 /* Voltage PMA Low Warn Threshold */ + +/* + * FAN 1 speed + */ +/* assuming: 6500rpm +-15%, 4 pulses, + * warning at: 80 % + * error at: 70 % + * no upper limit + */ +#define SK_SEN_ERRHIGH 20000 /* FAN Speed High Err Threshold */ +#define SK_SEN_WARNHIGH 20000 /* FAN Speed High Warn Threshold */ +#define SK_SEN_WARNLOW 5200 /* FAN Speed Low Err Threshold */ +#define SK_SEN_ERRLOW 4550 /* FAN Speed Low Warn Threshold */ + +extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen); +#endif /* n_INC_SKGEI2C_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgeinit.h linux/drivers/net/sk98lin/h/skgeinit.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgeinit.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgeinit.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,733 @@ +/****************************************************************************** + * + * Name: skgeinit.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.44 $ + * Date: $Date: 1999/10/26 07:34:15 $ + * Purpose: Structures and prototypes for the GE Init Module + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgeinit.h,v $ + * Revision 1.44 1999/10/26 07:34:15 malthoff + * The define SK_LNK_ON has been lost in v1.41. + * + * Revision 1.43 1999/10/06 09:30:16 cgoos + * Changed SK_XM_THR_JUMBO. + * + * Revision 1.42 1999/09/16 12:58:26 cgoos + * Changed SK_LED_STANDY macro to be independent of HW link sync. + * + * Revision 1.41 1999/07/30 06:56:14 malthoff + * Correct comment for SK_MS_STAT_UNSET. + * + * Revision 1.40 1999/05/27 13:38:46 cgoos + * Added SK_BMU_TX_WM. + * Made SK_BMU_TX_WM and SK_BMU_RX_WM user-definable. + * Changed XMAC Tx treshold to max. values. + * + * Revision 1.39 1999/05/20 14:35:26 malthoff + * Remove prototypes for SkGeLinkLED(). + * + * Revision 1.38 1999/05/19 11:59:12 cgoos + * Added SK_MS_CAP_INDETERMINATED define. + * + * Revision 1.37 1999/05/19 07:32:33 cgoos + * Changes for 1000Base-T. + * LED-defines for HWAC_LINK_LED macro. + * + * Revision 1.36 1999/04/08 14:00:24 gklug + * add:Port struct field PLinkResCt + * + * Revision 1.35 1999/03/25 07:43:07 malthoff + * Add error string for SKERR_HWI_E018MSG. + * + * Revision 1.34 1999/03/12 16:25:57 malthoff + * Remove PPollRxD and PPollTxD. + * Add SKERR_HWI_E017MSG. and SK_DPOLL_MAX. + * + * Revision 1.33 1999/03/12 13:34:41 malthoff + * Add Autonegotiation error codes. + * Change defines for parameter Mode in SkXmSetRxCmd(). + * Replace __STDC__ by SK_KR_PROTO. + * + * Revision 1.32 1999/01/25 14:40:20 mhaveman + * Added new return states for the virtual management port if multiple + * ports are active but differently configured. + * + * Revision 1.31 1998/12/11 15:17:02 gklug + * add: Link partnet autoneg states : Unknown Manual and Autonegotiation + * + * Revision 1.30 1998/12/07 12:17:04 gklug + * add: Link Partner autonegotiation flag + * + * Revision 1.29 1998/12/01 10:54:42 gklug + * add: variables for XMAC Errata + * + * Revision 1.28 1998/12/01 10:14:15 gklug + * add: PIsave saves the Interrupt status word + * + * Revision 1.27 1998/11/26 15:24:52 mhaveman + * Added link status states SK_LMODE_STAT_AUTOHALF and + * SK_LMODE_STAT_AUTOFULL which are used by PNMI. + * + * Revision 1.26 1998/11/26 14:53:01 gklug + * add:autoNeg Timeout variable + * + * Revision 1.25 1998/11/26 08:58:50 gklug + * add: Link Mode configuration (AUTO Sense mode) + * + * Revision 1.24 1998/11/24 13:30:27 gklug + * add: PCheckPar to port struct + * + * Revision 1.23 1998/11/18 13:23:26 malthoff + * Add SK_PKT_TO_MAX. + * + * Revision 1.22 1998/11/18 13:19:54 gklug + * add: PPrevShorts and PLinkBroken to port struct for WA XMAC Errata #C1 + * + * Revision 1.21 1998/10/26 08:02:57 malthoff + * Add GIRamOffs. + * + * Revision 1.20 1998/10/19 07:28:37 malthoff + * Add prototyp for SkGeInitRamIface(). + * + * Revision 1.19 1998/10/14 14:47:48 malthoff + * SK_TIMER should not be defined for Diagnostics. + * Add SKERR_HWI_E015MSG and SKERR_HWI_E016MSG. + * + * Revision 1.18 1998/10/14 14:00:03 gklug + * add: timer to port struct for workaround of Errata #2 + * + * Revision 1.17 1998/10/14 11:23:09 malthoff + * Add prototype for SkXmAutoNegDone(). + * Fix SkXmSetRxCmd() prototype statement. + * + * Revision 1.16 1998/10/14 05:42:29 gklug + * add: HWLinkUp flag to Port struct + * + * Revision 1.15 1998/10/09 08:26:33 malthoff + * Rename SK_RB_ULPP_B to SK_RB_LLPP_B. + * + * Revision 1.14 1998/10/09 07:11:13 malthoff + * bug fix: SK_FACT_53 is 85 not 117. + * Rework time out init values. + * Add GIPortUsage and corresponding defines. + * Add some error log messages. + * + * Revision 1.13 1998/10/06 14:13:14 malthoff + * Add prototyp for SkGeLoadLnkSyncCnt(). + * + * Revision 1.12 1998/10/05 11:29:53 malthoff + * bug fix: A comment was not closed. + * + * Revision 1.11 1998/10/05 08:01:59 malthoff + * Add default Timeout- Threshold- and + * Watermark constants. Add QRam start and end + * variables. Also add vars to store the polling + * mode and receive command. Add new Error Log + * Messages and function prototypes. + * + * Revision 1.10 1998/09/28 13:34:48 malthoff + * Add mode bits for LED functions. + * Move Autoneg and Flow Ctrl bits from shgesirq.h + * Add the required Error Log Entries + * and Function Prototypes. + * + * Revision 1.9 1998/09/16 14:38:41 malthoff + * Rework the SK_LNK_xxx defines. + * Add error log message defines. + * Add prototypes for skxmac2.c + * + * Revision 1.8 1998/09/11 05:29:18 gklug + * add: init state of a port + * + * Revision 1.7 1998/09/08 08:35:52 gklug + * add: defines of the Init Levels + * + * Revision 1.6 1998/09/03 13:48:42 gklug + * add: Link strati, capabilities to Port struct + * + * Revision 1.5 1998/09/03 13:30:59 malthoff + * Add SK_LNK_BLINK and SK_LNK_PERM. + * + * Revision 1.4 1998/09/03 09:55:31 malthoff + * Add constants for parameters Dir and RstMode + * when calling SkGeStopPort(). + * Rework the prototyp section. + * Add Queue Address offsets PRxQOff, PXsQOff, and PXaQOff. + * Remove Ioc with IoC. + * + * Revision 1.3 1998/08/19 09:11:54 gklug + * fix: struct are removed from c-source (see CCC) + * add: typedefs for all structs + * + * Revision 1.2 1998/07/28 12:38:26 malthoff + * The prototypes got the parameter 'IoC'. + * + * Revision 1.1 1998/07/23 09:50:24 malthoff + * Created. + * + * + ******************************************************************************/ + +#ifndef __INC_SKGEINIT_H_ +#define __INC_SKGEINIT_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines ********************************************************************/ + +/* + * defines for modifying Link LED behaviour (has been used with SkGeLinkLED()) + */ +#define SK_LNK_OFF LED_OFF +#define SK_LNK_ON (LED_ON | LED_BLK_OFF| LED_SYNC_OFF) +#define SK_LNK_BLINK (LED_ON | LED_BLK_ON | LED_SYNC_ON) +#define SK_LNK_PERM (LED_ON | LED_BLK_OFF| LED_SYNC_ON) +#define SK_LNK_TST (LED_ON | LED_BLK_ON | LED_SYNC_OFF) + +/* + * defines for parameter 'Mode' when calling SK_HWAC_LINK_LED() + */ +#define SK_LED_OFF LED_OFF +#define SK_LED_ACTIVE (LED_ON | LED_BLK_OFF| LED_SYNC_OFF) +#define SK_LED_STANDBY (LED_ON | LED_BLK_ON| LED_SYNC_OFF) + +/* + * defines for parameter 'Mode' when calling SkGeXmitLED() + */ +#define SK_LED_DIS 0 +#define SK_LED_ENA 1 +#define SK_LED_TST 2 + +/* + * Counter and Timer constants, for a host clock of 62.5 MHz + */ +#define SK_XMIT_DUR 0x002faf08L /* 50 ms */ +#define SK_BLK_DUR 0x01dcd650L /* 500 ms */ + +#define SK_DPOLL_DEF 0x00EE6B28L /* 250 ms */ +#define SK_DPOLL_MAX 0x00FFFFFFL /* ca. 268ms */ + +#define SK_FACT_62 100 /* is given in percent */ +#define SK_FACT_53 85 + +/* + * Timeout values + */ +#define SK_MAC_TO_53 72 /* MAC arbiter timeout */ +#define SK_PKT_TO_53 0x2000 /* Packet arbiter timeout */ +#define SK_PKT_TO_MAX 0xffff /* Maximum value */ +#define SK_RI_TO_53 36 /* RAM interface timeout */ + +/* + * RAM Buffer High Pause Threshold values + */ +#define SK_RB_ULPP ( 8 * 1024) /* Upper Level in kB/8 */ +#define SK_RB_LLPP_S (10 * 1024) /* Lower Level for small Queues */ +#define SK_RB_LLPP_B (16 * 1024) /* Lower Level for big Queues */ + +#ifndef SK_BMU_RX_WM +#define SK_BMU_RX_WM 0x600 /* BMU Rx Watermark */ +#endif +#ifndef SK_BMU_TX_WM +#define SK_BMU_TX_WM 0x600 /* BMU Rx Watermark */ +#endif + +/* XMAC II Tx Threshold */ +#define SK_XM_THR_REDL 0x01fb /* .. for redundant link usage */ +#define SK_XM_THR_SL 0x01fb /* .. for single link adapters */ +#define SK_XM_THR_MULL 0x01fb /* .. for multiple link usage */ +#define SK_XM_THR_JUMBO 0x03fc /* .. for jumbo frame usage */ + +/* values for GIPortUsage */ +#define SK_RED_LINK 1 /* redundant link usage */ +#define SK_MUL_LINK 2 /* multiple link usage */ +#define SK_JUMBO_LINK 3 /* driver uses jumbo frames */ + +/* Minimum RAM Buffer Receive Queue Size */ +#define SK_MIN_RXQ_SIZE 16 /* 16 kB */ +/* + * defines for parameter 'Dir' when calling SkGeStopPort() + */ +#define SK_STOP_TX 1 /* Stops the transmit path, resets the XMAC */ +#define SK_STOP_RX 2 /* Stops the receive path */ +#define SK_STOP_ALL 3 /* Stops rx and tx path, resets the XMAC */ + +/* + * defines for parameter 'RstMode' when calling SkGeStopPort() + */ +#define SK_SOFT_RST 1 /* perform a software reset */ +#define SK_HARD_RST 2 /* perform a hardware reset */ + +/* + * Define Init Levels + */ +#define SK_INIT_DATA 0 /* Init level 0: init data structures */ +#define SK_INIT_IO 1 /* Init level 1: init with IOs */ +#define SK_INIT_RUN 2 /* Init level 2: init for run time */ + +/* + * Set Link Mode Parameter + */ +#define SK_LMODE_HALF 1 /* Half Duplex Mode */ +#define SK_LMODE_FULL 2 /* Full Duplex Mode */ +#define SK_LMODE_AUTOHALF 3 /* AutoHalf Duplex Mode */ +#define SK_LMODE_AUTOFULL 4 /* AutoFull Duplex Mode */ +#define SK_LMODE_AUTOBOTH 5 /* AutoBoth Duplex Mode */ +#define SK_LMODE_AUTOSENSE 6 /* configured mode auto sensing */ +#define SK_LMODE_INDETERMINATED 7 /* Return value for virtual port if + * multiple ports are differently + * configured. + */ + +/* + * Autonegotiation timeout in 100ms granularity. + */ +#define SK_AND_MAX_TO 6 /* Wait 600 msec before link comes up */ + +/* + * Define Autonegotiation error codes here + */ +#define SK_AND_OK 0 /* no error */ +#define SK_AND_OTHER 1 /* other error than below */ +#define SK_AND_DUP_CAP 2 /* Duplex capabilities error */ + +/* + * Link Capability value + */ +#define SK_LMODE_CAP_HALF (1<<0) /* Half Duplex Mode */ +#define SK_LMODE_CAP_FULL (1<<1) /* Full Duplex Mode */ +#define SK_LMODE_CAP_AUTOHALF (1<<2) /* AutoHalf Duplex Mode */ +#define SK_LMODE_CAP_AUTOFULL (1<<3) /* AutoFull Duplex Mode */ +#define SK_LMODE_CAP_INDETERMINATED (1<<4) /* Return value for virtual port if + * multiple ports are differently + * configured. + */ + +/* + * Link mode current state + */ +#define SK_LMODE_STAT_UNKNOWN 1 /* Unknown Duplex Mode */ +#define SK_LMODE_STAT_HALF 2 /* Half Duplex Mode */ +#define SK_LMODE_STAT_FULL 3 /* Full Duplex Mode */ +#define SK_LMODE_STAT_AUTOHALF 4 /* Half Duplex Mode obtained by AutoNeg */ +#define SK_LMODE_STAT_AUTOFULL 5 /* Half Duplex Mode obtained by AutoNeg */ +#define SK_LMODE_STAT_INDETERMINATED 6 /* Return value for virtual port if + * multiple ports are differently + * configured. + */ +/* + * Set Flow Control Mode Parameter (and capabilities) + */ +#define SK_FLOW_MODE_NONE 1 /* No Flow Control */ +#define SK_FLOW_MODE_LOC_SEND 2 /* Local station sends PAUSE */ +#define SK_FLOW_MODE_SYMMETRIC 3 /* Both station may send PAUSE */ +#define SK_FLOW_MODE_SYM_OR_REM 4 /* Both station may send PAUSE or + * just the remote station may send + * PAUSE + */ +#define SK_FLOW_MODE_INDETERMINATED 5 /* Return value for virtual port if + * multiple ports are differently + * configured. + */ + +/* + * Flow Control Status Parameter + */ +#define SK_FLOW_STAT_NONE 1 /* No Flow Control */ +#define SK_FLOW_STAT_REM_SEND 2 /* Remote Station sends PAUSE */ +#define SK_FLOW_STAT_LOC_SEND 3 /* Local station sends PAUSE */ +#define SK_FLOW_STAT_SYMMETRIC 4 /* Both station may send PAUSE */ +#define SK_FLOW_STAT_INDETERMINATED 5 /* Return value for virtual port if + * multiple ports are differently + * configured. + */ +/* + * Master/Slave Mode capabilities + */ +#define SK_MS_CAP_AUTO (1<<0) /* Automatic resolution */ +#define SK_MS_CAP_MASTER (1<<1) /* This station is master */ +#define SK_MS_CAP_SLAVE (1<<2) /* This station is slave */ +#define SK_MS_CAP_INDETERMINATED (1<<3) /* Return value for virtual port if + * multiple ports are differently + * configured. + */ + +/* + * Set Master/Slave Mode Parameter (and capabilities) + */ +#define SK_MS_MODE_AUTO 1 /* Automatic resolution */ +#define SK_MS_MODE_MASTER 2 /* This station is master */ +#define SK_MS_MODE_SLAVE 3 /* This station is slave */ +#define SK_MS_MODE_INDETERMINATED 4 /* Return value for virtual port if + * multiple ports are differently + */ + +/* + * Master/Slave Status Parameter + */ +#define SK_MS_STAT_UNSET 1 /* The MS status is never been determ*/ +#define SK_MS_STAT_MASTER 2 /* This station is master */ +#define SK_MS_STAT_SLAVE 3 /* This station is slave */ +#define SK_MS_STAT_FAULT 4 /* MS resolution failed */ +#define SK_MS_STAT_INDETERMINATED 5 /* Return value for virtual port if + * multiple ports are differently + */ + +/* + * defines for parameter 'Mode' when calling SkXmSetRxCmd() + */ +#define SK_STRIP_FCS_ON (1<<0) /* Enable FCS stripping of rx frames */ +#define SK_STRIP_FCS_OFF (1<<1) /* Disable FCS stripping of rx frames */ +#define SK_STRIP_PAD_ON (1<<2) /* Enable pad byte stripping of rx f */ +#define SK_STRIP_PAD_OFF (1<<3) /* Disable pad byte stripping of rx f */ +#define SK_LENERR_OK_ON (1<<4) /* Don't chk fr for in range len error*/ +#define SK_LENERR_OK_OFF (1<<5) /* Check frames for in range len error*/ +#define SK_BIG_PK_OK_ON (1<<6) /* Don't set rcvError bit for big fr */ +#define SK_BIG_PK_OK_OFF (1<<7) /* Set rcvError bit for big frames */ + +/* + * States of PState + */ +#define SK_PRT_RESET 0 /* the port is reset */ +#define SK_PRT_STOP 1 /* the port is stopped (similar to sw reset) */ +#define SK_PRT_INIT 2 /* the port is initialized */ +#define SK_PRT_RUN 3 /* the port has an active link */ + +/* + * Default receive frame limit for Workaround of XMAC Errata + */ +#define SK_DEF_RX_WA_LIM SK_CONSTU64(100) + +/* + * Define link partner Status + */ +#define SK_LIPA_UNKNOWN 0 /* Link partner is in unknown state */ +#define SK_LIPA_MANUAL 1 /* Link partner is in detected manual state */ +#define SK_LIPA_AUTO 2 /* Link partner is in autonegotiation state */ + +/* + * Define Maximum Restarts before restart is ignored (3com WA) + */ +#define SK_MAX_LRESTART 3 /* Max. 3 times the link is restarted */ + +/* structures *****************************************************************/ + +/* + * Port Structure + */ +typedef struct s_GePort { +#ifndef SK_DIAG + SK_TIMER PWaTimer; /* Workaround Timer */ +#endif + SK_U64 PPrevShorts; /* Previous short Counter checking */ + SK_U64 PPrevRx; /* Previous RxOk Counter checking */ + SK_U64 PPrevFcs; /* Previous FCS Error Counter checking */ + SK_U64 PRxLim; /* Previous RxOk Counter checking */ + int PLinkResCt; /* Link Restart Counter */ + int PAutoNegTimeOut;/* AutoNegotiation timeout current value */ + int PRxQSize; /* Port Rx Queue Size in kB */ + int PXSQSize; /* Port Synchronous Transmit Queue Size in kB */ + int PXAQSize; /* Port Asynchronous Transmit Queue Size in kB*/ + SK_U32 PRxQRamStart; /* Receive Queue RAM Buffer Start Address */ + SK_U32 PRxQRamEnd; /* Receive Queue RAM Buffer End Address */ + SK_U32 PXsQRamStart; /* Sync Tx Queue RAM Buffer Start Address */ + SK_U32 PXsQRamEnd; /* Sync Tx Queue RAM Buffer End Address */ + SK_U32 PXaQRamStart; /* Async Tx Queue RAM Buffer Start Address */ + SK_U32 PXaQRamEnd; /* Async Tx Queue RAM Buffer End Address */ + int PRxQOff; /* Rx Queue Address Offset */ + int PXsQOff; /* Synchronous Tx Queue Address Offset */ + int PXaQOff; /* Asynchronous Tx Queue Address Offset */ + SK_U16 PRxCmd; /* Port Receive Command Configuration Value */ + SK_U16 PIsave; /* Saved Interrupt status word */ + SK_U16 PSsave; /* Saved PHY status word */ + SK_BOOL PHWLinkUp; /* The hardware Link is up (wireing) */ + SK_BOOL PState; /* Is port initialized ? */ + SK_BOOL PLinkBroken; /* Is Link broken ? */ + SK_BOOL PCheckPar; /* Do we check for parity errors ? */ + SK_U8 PLinkCap; /* Link Capabilities */ + SK_U8 PLinkModeConf; /* Link Mode configured */ + SK_U8 PLinkMode; /* Link Mode currently used */ + SK_U8 PLinkModeStatus; /* Link Mode Status */ + SK_U8 PFlowCtrlCap; /* Flow Control Capabilities */ + SK_U8 PFlowCtrlMode; /* Flow Control Mode */ + SK_U8 PFlowCtrlStatus; /* Flow Control Status */ + SK_U8 PMSCap; /* Master/Slave Capabilities */ + SK_U8 PMSMode; /* Master/Slave Mode */ + SK_U8 PMSStatus; /* Master/Slave Status */ + SK_U8 PAutoNegFail; /* Autonegotiation fail flag */ + SK_U8 PLipaAutoNeg; /* Autonegotiation possible with Link Partner */ + int PhyType; /* PHY used on this port */ + SK_U16 PhyAddr; /* MDIO/MDC PHY address */ +} SK_GEPORT; + +/* + * Gigabit Ethernet Initalization Struct + * (has to be included in the adapter context + */ +typedef struct s_GeInit { + int GIMacsFound; /* Number of MACs found on this adapter */ + int GIPciHwRev; /* PCI HW Revision Number */ + SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */ + int GIRamSize; /* The RAM size of the adapter in kB */ + int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */ + int GIPortUsage; /* driver port usage: SK_RED_LINK/SK_MUL_LINK */ + SK_U32 GIPollTimerVal; /* Descriptor Poll Timer Init Val in clk ticks*/ + int GILevel; /* Initialization Level Completed */ + SK_BOOL GIAnyPortAct; /* Is True if one or more port is initialized */ + SK_GEPORT GP[SK_MAX_MACS]; /* Port Dependent Information */ +} SK_GEINIT; + +/* + * Define the error numbers and messages for xmac_ii.c and skgeinit.c + */ +#define SKERR_HWI_E001 (SK_ERRBASE_HWINIT) +#define SKERR_HWI_E001MSG "SkXmClrExactAddr() has got illegal parameters" +#define SKERR_HWI_E002 (SKERR_HWI_E001+1) +#define SKERR_HWI_E002MSG "SkGeInit() Level 1 call missing" +#define SKERR_HWI_E003 (SKERR_HWI_E002+1) +#define SKERR_HWI_E003MSG "SkGeInit() called with illegal init Level" +#define SKERR_HWI_E004 (SKERR_HWI_E003+1) +#define SKERR_HWI_E004MSG "SkGeInitPort() Queue size illegal configured" +#define SKERR_HWI_E005 (SKERR_HWI_E004+1) +#define SKERR_HWI_E005MSG "SkGeInitPort() cannot init running ports" +#define SKERR_HWI_E006 (SKERR_HWI_E005+1) +#define SKERR_HWI_E006MSG "SkGeXmInit(): PState does not match HW state" +#define SKERR_HWI_E007 (SKERR_HWI_E006+1) +#define SKERR_HWI_E007MSG "SkXmInitDupMd() called with invalid Dup Mode" +#define SKERR_HWI_E008 (SKERR_HWI_E007+1) +#define SKERR_HWI_E008MSG "SkXmSetRxCmd() called with invalid Mode" +#define SKERR_HWI_E009 (SKERR_HWI_E008+1) +#define SKERR_HWI_E009MSG "SkGeCfgSync() called although PXSQSize zero" +#define SKERR_HWI_E010 (SKERR_HWI_E009+1) +#define SKERR_HWI_E010MSG "SkGeCfgSync() called with invalid parameters" +#define SKERR_HWI_E011 (SKERR_HWI_E010+1) +#define SKERR_HWI_E011MSG "SkGeInitPort() Receive Queue Size to small" +#define SKERR_HWI_E012 (SKERR_HWI_E011+1) +#define SKERR_HWI_E012MSG "SkGeInitPort() invalid Queue Size specified" +#define SKERR_HWI_E013 (SKERR_HWI_E012+1) +#define SKERR_HWI_E013MSG "SkGeInitPort() cfg changed for running queue" +#define SKERR_HWI_E014 (SKERR_HWI_E013+1) +#define SKERR_HWI_E014MSG "SkGeInitPort() unknown GIPortUsage specified" +#define SKERR_HWI_E015 (SKERR_HWI_E014+1) +#define SKERR_HWI_E015MSG "Illegal Link mode parameter" +#define SKERR_HWI_E016 (SKERR_HWI_E015+1) +#define SKERR_HWI_E016MSG "Illegal Flow control mode parameter" +#define SKERR_HWI_E017 (SKERR_HWI_E016+1) +#define SKERR_HWI_E017MSG "Illegal value specified for GIPollTimerVal" +#define SKERR_HWI_E018 (SKERR_HWI_E017+1) +#define SKERR_HWI_E018MSG "FATAL: SkGeStopPort() does not terminate" +#define SKERR_HWI_E019 (SKERR_HWI_E018+1) +#define SKERR_HWI_E019MSG "" + +/* function prototypes ********************************************************/ + +#ifndef SK_KR_PROTO + +/* + * public functions in skgeinit.c + */ +extern void SkGePollRxD( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_BOOL PollRxD); + +extern void SkGePollTxD( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_BOOL PollTxD); + +extern void SkGeYellowLED( + SK_AC *pAC, + SK_IOC IoC, + int State); + +extern int SkGeCfgSync( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_U32 IntTime, + SK_U32 LimCount, + int SyncMode); + +extern void SkGeLoadLnkSyncCnt( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_U32 CntVal); + +extern void SkGeStopPort( + SK_AC *pAC, + SK_IOC IoC, + int Port, + int Dir, + int RstMode); + +extern int SkGeInit( + SK_AC *pAC, + SK_IOC IoC, + int Level); + +extern void SkGeDeInit( + SK_AC *pAC, + SK_IOC IoC); + +extern int SkGeInitPort( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkGeXmitLED( + SK_AC *pAC, + SK_IOC IoC, + int Led, + int Mode); + +extern void SkGeInitRamIface( + SK_AC *pAC, + SK_IOC IoC); + +/* + * public functions in skxmac2.c + */ +extern void SkXmSetRxCmd( + SK_AC *pAC, + SK_IOC IoC, + int Port, + int Mode); + +extern void SkXmClrExactAddr( + SK_AC *pAC, + SK_IOC IoC, + int Port, + int StartNum, + int StopNum); + +extern void SkXmFlushTxFifo( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmFlushRxFifo( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmSoftRst( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmHardRst( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmInitMac( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmInitDupMd( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmInitPauseMd( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern int SkXmAutoNegDone( + SK_AC *pAC, + SK_IOC IoC, + int Port); + +extern void SkXmAutoNegLipaXmac( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_U16 IStatus); + +extern void SkXmAutoNegLipaBcom( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_U16 IStatus); + +extern void SkXmAutoNegLipaLone( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_U16 IStatus); + +extern void SkXmIrq( + SK_AC *pAC, + SK_IOC IoC, + int Port, + SK_U16 IStatus); + +#else /* SK_KR_PROTO */ + +/* + * public functions in skgeinit.c + */ +extern void SkGePollRxD(); +extern void SkGePollTxD(); +extern void SkGeYellowLED(); +extern int SkGeCfgSync(); +extern void SkGeLoadLnkSyncCnt(); +extern void SkGeStopPort(); +extern int SkGeInit(); +extern void SkGeDeInit(); +extern int SkGeInitPort(); +extern void SkGeXmitLED(); +extern void SkGeInitRamIface(); + +/* + * public functions in skxmac2.c + */ +extern void SkXmSetRxCmd(); +extern void SkXmClrExactAddr(); +extern void SkXmFlushTxFifo(); +extern void SkXmFlushRxFifo(); +extern void SkXmSoftRst(); +extern void SkXmHardRst(); +extern void SkXmInitMac(); +extern void SkXmInitDupMd(); +extern void SkXmInitPauseMd(); +extern int SkXmAutoNegDone(); +extern void SkXmAutoNegLipa(); +extern void SkXmIrq(); + +#endif /* SK_KR_PROTO */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INC_SKGEINIT_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgepnm2.h linux/drivers/net/sk98lin/h/skgepnm2.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgepnm2.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgepnm2.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,417 @@ +/***************************************************************************** + * + * Name: skgepnm2.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.24 $ + * Date: $Date: 1999/04/13 15:11:11 $ + * Purpose: Defines for Private Network Management Interface + * + ****************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/***************************************************************************** + * + * History: + * + * $Log: skgepnm2.h,v $ + * Revision 1.24 1999/04/13 15:11:11 mhaveman + * Changed copyright. + * + * Revision 1.23 1999/01/28 15:07:12 mhaveman + * Changed default threshold for port switches per hour from 10 + * to 240 which means 4 switches per minute. This fits better + * the granularity of 32 for the port switch estimate + * counter. + * + * Revision 1.22 1999/01/05 12:52:30 mhaveman + * Removed macro SK_PNMI_MICRO_SEC. + * + * Revision 1.21 1999/01/05 12:50:34 mhaveman + * Enlarged macro definition SK_PNMI_HUNDREDS_SEC() so that no 64-bit + * arithmetic is necessary if SK_TICKS_PER_SEC is 100. + * + * Revision 1.20 1998/12/09 14:02:53 mhaveman + * Defined macro SK_PNMI_DEF_RLMT_CHG_THRES for default port switch + * threshold. + * + * Revision 1.19 1998/12/03 11:28:41 mhaveman + * Removed SK_PNMI_CHECKPTR macro. + * + * Revision 1.18 1998/12/03 11:21:00 mhaveman + * -Added pointer check macro SK_PNMI_CHECKPTR + * -Added macros SK_PNMI_VPD_ARR_SIZE and SK_PNMI_VPD_STR_SIZE for + * VPD key evaluation. + * + * Revision 1.17 1998/11/20 13:20:33 mhaveman + * Fixed bug in SK_PNMI_SET_STAT macro. ErrorStatus was not correctly set. + * + * Revision 1.16 1998/11/20 08:08:49 mhaveman + * Macro SK_PNMI_CHECKFLAGS has got a if clause. + * + * Revision 1.15 1998/11/03 13:53:40 mhaveman + * Fixed alignment problem in macor SK_PNMI_SET_STAT macro. + * + * Revision 1.14 1998/10/30 15:50:13 mhaveman + * Added macro SK_PNMI_MICRO_SEC() + * + * Revision 1.13 1998/10/30 12:32:20 mhaveman + * Added forgotten cast in SK_PNMI_READ_U32 macro. + * + * Revision 1.12 1998/10/29 15:40:26 mhaveman + * -Changed SK_PNMI_TRAP_SENSOR_LEN because SensorDescr has now + * variable string length. + * -Defined SK_PNMI_CHECKFLAGS macro + * + * Revision 1.11 1998/10/29 08:53:34 mhaveman + * Removed SK_PNMI_RLM_XXX table indexed because these counters need + * not been saved over XMAC resets. + * + * Revision 1.10 1998/10/28 08:48:20 mhaveman + * -Added macros for storage according to alignment + * -Changed type of Instance to SK_U32 because of VPD + * -Removed trap structures. Not needed because of alignment problem + * -Changed type of Action form SK_U8 to int + * + * Revision 1.9 1998/10/21 13:34:45 mhaveman + * Shit, mismatched calculation of SK_PNMI_HUNDREDS_SEC. Corrected. + * + * Revision 1.8 1998/10/21 13:24:58 mhaveman + * Changed calculation of hundreds of seconds. + * + * Revision 1.7 1998/10/20 07:31:41 mhaveman + * Made type changes to unsigned int where possible. + * + * Revision 1.6 1998/09/04 17:04:05 mhaveman + * Added Sync counters to offset storage to provided settled values on + * port switch. + * + * Revision 1.5 1998/09/04 12:45:35 mhaveman + * Removed dummies for SK_DRIVER_ macros. They should be added by driver + * writer in skdrv2nd.h. + * + * Revision 1.4 1998/09/04 11:59:50 mhaveman + * Everything compiles now. Driver Macros for counting still missing. + * + * Revision 1.3 1998/08/24 12:01:35 mhaveman + * Intermediate state. + * + * Revision 1.2 1998/08/17 07:51:40 mhaveman + * Intermediate state. + * + * Revision 1.1 1998/08/11 09:08:40 mhaveman + * Intermediate state. + * + ****************************************************************************/ + +#ifndef _SKGEPNM2_H_ +#define _SKGEPNM2_H_ + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE !(FALSE) +#endif + +/* + * General definitions + */ +#define SK_PNMI_CHIPSET 1 /* XMAC11800FP */ + +#define SK_PNMI_BUS_PCI 1 /* PCI bus*/ + +/* + * Actions + */ +#define SK_PNMI_ACT_IDLE 1 +#define SK_PNMI_ACT_RESET 2 +#define SK_PNMI_ACT_SELFTEST 3 +#define SK_PNMI_ACT_RESETCNT 4 + +/* + * VPD releated defines + */ +#define SK_PNMI_VPD_ARR_SIZE 40 +#define SK_PNMI_VPD_STR_SIZE 5 + +#define SK_PNMI_VPD_RW 1 +#define SK_PNMI_VPD_RO 2 + +#define SK_PNMI_VPD_OK 0 +#define SK_PNMI_VPD_NOTFOUND 1 +#define SK_PNMI_VPD_CUT 2 +#define SK_PNMI_VPD_TIMEOUT 3 +#define SK_PNMI_VPD_FULL 4 +#define SK_PNMI_VPD_NOWRITE 5 +#define SK_PNMI_VPD_FATAL 6 + +#define SK_PNMI_VPD_IGNORE 0 +#define SK_PNMI_VPD_CREATE 1 +#define SK_PNMI_VPD_DELETE 2 + + +/* + * RLMT related defines + */ +#define SK_PNMI_DEF_RLMT_CHG_THRES 240 /* 4 changes per minute */ + +/* + * Internal table definitions + */ +#define SK_PNMI_GET 0 +#define SK_PNMI_PRESET 1 +#define SK_PNMI_SET 2 + +#define SK_PNMI_RO 0 +#define SK_PNMI_RW 1 + +typedef struct s_OidTabEntry { + SK_U32 Id; + SK_U32 InstanceNo; + unsigned int StructSize; + unsigned int Offset; + int Access; + int (* Func)(SK_AC *pAc, SK_IOC pIo, int action, + SK_U32 Id, char* pBuf, unsigned int* pLen, + SK_U32 Instance, unsigned int TableIndex); + SK_U16 Param; +} SK_PNMI_TAB_ENTRY; + + +/* + * Trap lengths + */ +#define SK_PNMI_TRAP_SIMPLE_LEN 17 +#define SK_PNMI_TRAP_SENSOR_LEN_BASE 46 +#define SK_PNMI_TRAP_RLMT_CHANGE_LEN 23 +#define SK_PNMI_TRAP_RLMT_PORT_LEN 23 + + +/* + * MAC statistic data structures + */ +#define SK_PNMI_HTX 0 +#define SK_PNMI_HTX_OCTET 1 +#define SK_PNMI_HTX_OCTETHIGH 1 +#define SK_PNMI_HTX_OCTETLOW 2 +#define SK_PNMI_HTX_BROADCAST 3 +#define SK_PNMI_HTX_MULTICAST 4 +#define SK_PNMI_HTX_UNICAST 5 +#define SK_PNMI_HTX_LONGFRAMES 6 +#define SK_PNMI_HTX_BURST 7 +#define SK_PNMI_HTX_PMACC 8 +#define SK_PNMI_HTX_MACC 9 +#define SK_PNMI_HTX_SINGLE_COL 10 +#define SK_PNMI_HTX_MULTI_COL 11 +#define SK_PNMI_HTX_EXCESS_COL 12 +#define SK_PNMI_HTX_LATE_COL 13 +#define SK_PNMI_HTX_DEFFERAL 14 +#define SK_PNMI_HTX_EXCESS_DEF 15 +#define SK_PNMI_HTX_UNDERRUN 16 +#define SK_PNMI_HTX_CARRIER 17 +#define SK_PNMI_HTX_UTILUNDER 18 +#define SK_PNMI_HTX_UTILOVER 19 +#define SK_PNMI_HTX_64 20 +#define SK_PNMI_HTX_127 21 +#define SK_PNMI_HTX_255 22 +#define SK_PNMI_HTX_511 23 +#define SK_PNMI_HTX_1023 24 +#define SK_PNMI_HTX_MAX 25 +#define SK_PNMI_HTX_RESERVED26 26 +#define SK_PNMI_HTX_RESERVED27 27 +#define SK_PNMI_HTX_RESERVED28 28 +#define SK_PNMI_HTX_RESERVED29 29 +#define SK_PNMI_HTX_RESERVED30 30 +#define SK_PNMI_HTX_RESERVED31 31 +#define SK_PNMI_HRX (32 + 0) +#define SK_PNMI_HRX_OCTET (32 + 1) +#define SK_PNMI_HRX_OCTETHIGH (32 + 1) +#define SK_PNMI_HRX_OCTETLOW (32 + 2) +#define SK_PNMI_HRX_BROADCAST (32 + 3) +#define SK_PNMI_HRX_MULTICAST (32 + 4) +#define SK_PNMI_HRX_UNICAST (32 + 5) +#define SK_PNMI_HRX_PMACC (32 + 6) +#define SK_PNMI_HRX_MACC (32 + 7) +#define SK_PNMI_HRX_PMACC_ERR (32 + 8) +#define SK_PNMI_HRX_MACC_UNKWN (32 + 9) +#define SK_PNMI_HRX_BURST (32 + 10) +#define SK_PNMI_HRX_MISSED (32 + 11) +#define SK_PNMI_HRX_FRAMING (32 + 12) +#define SK_PNMI_HRX_OVERFLOW (32 + 13) +#define SK_PNMI_HRX_JABBER (32 + 14) +#define SK_PNMI_HRX_CARRIER (32 + 15) +#define SK_PNMI_HRX_IRLENGTH (32 + 16) +#define SK_PNMI_HRX_SYMBOL (32 + 17) +#define SK_PNMI_HRX_SHORTS (32 + 18) +#define SK_PNMI_HRX_RUNT (32 + 19) +#define SK_PNMI_HRX_TOO_LONG (32 + 20) +#define SK_PNMI_HRX_FCS (32 + 21) +#define SK_PNMI_HRX_RESERVED22 (32 + 22) +#define SK_PNMI_HRX_CEXT (32 + 23) +#define SK_PNMI_HRX_UTILUNDER (32 + 24) +#define SK_PNMI_HRX_UTILOVER (32 + 25) +#define SK_PNMI_HRX_64 (32 + 26) +#define SK_PNMI_HRX_127 (32 + 27) +#define SK_PNMI_HRX_255 (32 + 28) +#define SK_PNMI_HRX_511 (32 + 29) +#define SK_PNMI_HRX_1023 (32 + 30) +#define SK_PNMI_HRX_MAX (32 + 31) + +#define SK_PNMI_HTX_SYNC 64 +#define SK_PNMI_HTX_SYNC_OCTET 65 + +#define SK_PNMI_MAX_IDX (SK_PNMI_CNT_NO) + +/* + * MAC specific data + */ +typedef struct s_PnmiStatAddr { + SK_BOOL GetOffset; /* TRUE: Call GetStatVal function */ + SK_U16 Param; /* XMAC register containing value */ +} SK_PNMI_STATADDR; + + +/* + * SK_PNMI_STRUCT_DATA copy offset evaluation macros + */ +#define SK_PNMI_OFF(e) ((SK_U32)&(((SK_PNMI_STRUCT_DATA *)0)->e)) +#define SK_PNMI_MAI_OFF(e) ((SK_U32)&(((SK_PNMI_STRUCT_DATA *)0)->e)) +#define SK_PNMI_VPD_OFF(e) ((SK_U32)&(((SK_PNMI_VPD *)0)->e)) +#define SK_PNMI_SEN_OFF(e) ((SK_U32)&(((SK_PNMI_SENSOR *)0)->e)) +#define SK_PNMI_CHK_OFF(e) ((SK_U32)&(((SK_PNMI_CHECKSUM *)0)->e)) +#define SK_PNMI_STA_OFF(e) ((SK_U32)&(((SK_PNMI_STAT *)0)->e)) +#define SK_PNMI_CNF_OFF(e) ((SK_U32)&(((SK_PNMI_CONF *)0)->e)) +#define SK_PNMI_RLM_OFF(e) ((SK_U32)&(((SK_PNMI_RLMT *)0)->e)) +#define SK_PNMI_MON_OFF(e) ((SK_U32)&(((SK_PNMI_RLMT_MONITOR *)0)->e)) +#define SK_PNMI_TRP_OFF(e) ((SK_U32)&(((SK_PNMI_TRAP *)0)->e)) + +#define SK_PNMI_SET_STAT(b,s,o) {SK_U32 Val32; char *pVal; \ + Val32 = (s); \ + pVal = (char *)(b) + ((SK_U32) \ + &(((SK_PNMI_STRUCT_DATA *)0)-> \ + ReturnStatus.ErrorStatus)); \ + SK_PNMI_STORE_U32(pVal, Val32); \ + Val32 = (o); \ + pVal = (char *)(b) + ((SK_U32) \ + &(((SK_PNMI_STRUCT_DATA *)0)-> \ + ReturnStatus.ErrorOffset)); \ + SK_PNMI_STORE_U32(pVal, Val32);} + +/* + * Time macros + */ +#if SK_TICKS_PER_SEC == 100 +#define SK_PNMI_HUNDREDS_SEC(t) (t) +#else +#define SK_PNMI_HUNDREDS_SEC(t) (((t) * 100) / (SK_TICKS_PER_SEC)) +#endif + +/* + * Macros to work around alignment problems + */ +#ifndef SK_PNMI_STORE_U16 +#define SK_PNMI_STORE_U16(p,v) {*(char *)(p) = *((char *)&(v)); \ + *((char *)(p) + 1) = \ + *(((char *)&(v)) + 1);} +#endif + +#ifndef SK_PNMI_STORE_U32 +#define SK_PNMI_STORE_U32(p,v) {*(char *)(p) = *((char *)&(v)); \ + *((char *)(p) + 1) = \ + *(((char *)&(v)) + 1); \ + *((char *)(p) + 2) = \ + *(((char *)&(v)) + 2); \ + *((char *)(p) + 3) = \ + *(((char *)&(v)) + 3);} +#endif + +#ifndef SK_PNMI_STORE_U64 +#define SK_PNMI_STORE_U64(p,v) {*(char *)(p) = *((char *)&(v)); \ + *((char *)(p) + 1) = \ + *(((char *)&(v)) + 1); \ + *((char *)(p) + 2) = \ + *(((char *)&(v)) + 2); \ + *((char *)(p) + 3) = \ + *(((char *)&(v)) + 3); \ + *((char *)(p) + 4) = \ + *(((char *)&(v)) + 4); \ + *((char *)(p) + 5) = \ + *(((char *)&(v)) + 5); \ + *((char *)(p) + 6) = \ + *(((char *)&(v)) + 6); \ + *((char *)(p) + 7) = \ + *(((char *)&(v)) + 7);} +#endif + +#ifndef SK_PNMI_READ_U16 +#define SK_PNMI_READ_U16(p,v) {*((char *)&(v)) = *(char *)(p); \ + *(((char *)&(v)) + 1) = \ + *((char *)(p) + 1);} +#endif + +#ifndef SK_PNMI_READ_U32 +#define SK_PNMI_READ_U32(p,v) {*((char *)&(v)) = *(char *)(p); \ + *(((char *)&(v)) + 1) = \ + *((char *)(p) + 1); \ + *(((char *)&(v)) + 2) = \ + *((char *)(p) + 2); \ + *(((char *)&(v)) + 3) = \ + *((char *)(p) + 3);} +#endif + +#ifndef SK_PNMI_READ_U64 +#define SK_PNMI_READ_U64(p,v) {*((char *)&(v)) = *(char *)(p); \ + *(((char *)&(v)) + 1) = \ + *((char *)(p) + 1); \ + *(((char *)&(v)) + 2) = \ + *((char *)(p) + 2); \ + *(((char *)&(v)) + 3) = \ + *((char *)(p) + 3); \ + *(((char *)&(v)) + 4) = \ + *((char *)(p) + 4); \ + *(((char *)&(v)) + 5) = \ + *((char *)(p) + 5); \ + *(((char *)&(v)) + 6) = \ + *((char *)(p) + 6); \ + *(((char *)&(v)) + 7) = \ + *((char *)(p) + 7);} +#endif + +/* + * Macros for Debug + */ +#ifdef DEBUG + +#define SK_PNMI_CHECKFLAGS(vSt) {if (pAC->Pnmi.MacUpdatedFlag > 0 || \ + pAC->Pnmi.RlmtUpdatedFlag > 0 || \ + pAC->Pnmi.SirqUpdatedFlag > 0) { \ + SK_DBG_MSG(pAC, \ + SK_DBGMOD_PNMI, \ + SK_DBGCAT_CTRL, \ + ("PNMI: ERR: %s MacUFlag=%d, RlmtUFlag=%d, SirqUFlag=%d\n", \ + vSt, \ + pAC->Pnmi.MacUpdatedFlag, \ + pAC->Pnmi.RlmtUpdatedFlag, \ + pAC->Pnmi.SirqUpdatedFlag))}} + +#else /* !DEBUG */ + +#define SK_PNMI_CHECKFLAGS(vSt) /* Nothing */ + +#endif /* !DEBUG */ + +#endif /* _SKGEPNM2_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgepnmi.h linux/drivers/net/sk98lin/h/skgepnmi.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgepnmi.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgepnmi.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,914 @@ +/***************************************************************************** + * + * Name: skgepnmi.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.37 $ + * Date: $Date: 1999/09/14 14:25:32 $ + * Purpose: Defines for Private Network Management Interface + * + ****************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/***************************************************************************** + * + * History: + * + * $Log: skgepnmi.h,v $ + * Revision 1.37 1999/09/14 14:25:32 rwahl + * Set MDB version for 1000Base-T (sensors, Master/Slave) changes. + * + * Revision 1.36 1999/05/20 09:24:56 cgoos + * Changes for 1000Base-T (sensors, Master/Slave). + * + * Revision 1.35 1999/04/13 15:10:51 mhaveman + * Replaced RLMT macros SK_RLMT_CHECK_xxx again by those of PNMI to + * grant unified interface. But PNMI macros will store the same + * value as RLMT macros. + * + * Revision 1.34 1999/04/13 15:03:49 mhaveman + * -Changed copyright + * -Removed SK_PNMI_RLMT_MODE_CHK_xxx macros. Those of RLMT should be + * used. + * + * Revision 1.33 1999/03/23 10:41:02 mhaveman + * Changed comments. + * + * Revision 1.32 1999/01/25 15:01:33 mhaveman + * Added support for multiple simultaniously active ports. + * + * Revision 1.31 1999/01/19 10:06:26 mhaveman + * Added new error log message. + * + * Revision 1.30 1999/01/05 10:34:49 mhaveman + * Fixed little error in RlmtChangeEstimate calculation. + * + * Revision 1.29 1999/01/05 09:59:41 mhaveman + * Redesigned port switch average calculation to avoid 64bit + * arithmetic. + * + * Revision 1.28 1998/12/08 10:05:48 mhaveman + * Defined macro SK_PNMI_MIN_STRUCT_SIZE. + * + * Revision 1.27 1998/12/03 14:39:35 mhaveman + * Fixed problem that LSTAT was enumerated wrong. + * + * Revision 1.26 1998/12/03 11:19:51 mhaveman + * Changed contents of errlog message SK_PNMI_ERR016MSG + * + * Revision 1.25 1998/12/01 10:40:04 mhaveman + * Changed size of SensorNumber, ChecksumNumber and RlmtPortNumber in + * SK_PNMI_STRUCT_DATA to be conform with OID definition. + * + * Revision 1.24 1998/11/20 08:09:27 mhaveman + * Added macros to convert between logical, physical port indexes and + * instances. + * + * Revision 1.23 1998/11/10 13:41:13 mhaveman + * Needed to change interface, because NT driver needs a return value + * of needed buffer space on TOO_SHORT errors. Therefore all + * SkPnmiGet/Preset/Set functions now have a pointer to the length + * parameter, where the needed space on error is returned. + * + * Revision 1.22 1998/11/03 12:05:51 mhaveman + * Added pAC parameter to counter macors. + * + * Revision 1.21 1998/11/02 10:47:36 mhaveman + * Added syslog messages for internal errors. + * + * Revision 1.20 1998/10/30 15:49:36 mhaveman + * -Removed unused SK_PNMI_UTILIZATION_BASE and EstOldCnt. + * -Redefined SK_PNMI_CHG_EST_BASE to hundreds of seconds. + * + * Revision 1.19 1998/10/29 15:38:44 mhaveman + * Changed string lengths of PNMI_STRUCT_DATA structure because + * string OIDs are now encoded with leading length ocetet. + * + * Revision 1.18 1998/10/29 08:52:27 mhaveman + * -Added byte to strings in PNMI_STRUCT_DATA structure. + * -Shortened SK_PNMI_RLMT structure to SK_MAX_MACS elements. + * + * Revision 1.17 1998/10/28 08:49:50 mhaveman + * -Changed type of Instance back to SK_U32 because of VPD + * -Changed type from SK_U8 to char of PciBusSpeed, PciBusWidth, PMD, + * and Connector. + * + * Revision 1.16 1998/10/22 10:42:31 mhaveman + * -Removed (SK_U32) casts for OIDs + * -excluded NDIS OIDs when they are already defined with ifndef _NDIS_ + * + * Revision 1.15 1998/10/20 13:56:28 mhaveman + * Headerfile includes now directly other header files to comile correctly. + * + * Revision 1.14 1998/10/20 07:31:09 mhaveman + * Made type changes to unsigned int where possible. + * + * Revision 1.13 1998/10/19 10:53:13 mhaveman + * -Casted OID definitions to SK_U32 + * -Renamed RlmtMAC... to RlmtPort... + * -Changed wrong type of VpdEntriesList from SK_U32 to char * + * + * Revision 1.12 1998/10/13 07:42:27 mhaveman + * -Added OIDs OID_SKGE_TRAP_NUMBER and OID_SKGE_ALL_DATA + * -Removed old cvs history entries + * -Renamed MacNumber to PortNumber + * + * Revision 1.11 1998/10/07 10:55:24 mhaveman + * -Added OID_MDB_VERSION. Therefore was a renumbering of the VPD OIDs + * necessary. + * -Added OID_GEN_ Ids to support the windows driver. + * + * Revision 1.10 1998/09/30 13:41:10 mhaveman + * Renamed some OIDs to reduce usage of 'MAC' which is replaced by 'PORT'. + * + * Revision 1.9 1998/09/04 17:06:17 mhaveman + * -Added SyncCounter as macro. + * -Renamed OID_SKGE_.._NO_DESCR_CTS to OID_SKGE_.._NO_BUF_CTS. + * -Added macros for driver description and version strings. + * + * Revision 1.8 1998/09/04 14:36:52 mhaveman + * Added OIDs and Structure to access value of macro counters which are + * counted by the driver. + * + * Revision 1.7 1998/09/04 11:59:36 mhaveman + * Everything compiles now. Driver Macros for counting still missing. + * + ****************************************************************************/ + +#ifndef _SKGEPNMI_H_ +#define _SKGEPNMI_H_ + +/* + * Include dependencies + */ +#include "h/sktypes.h" +#include "h/skerror.h" +#include "h/sktimer.h" +#include "h/ski2c.h" +#include "h/skaddr.h" +#include "h/skrlmt.h" + + +/* + * Management Database Version + */ +#define SK_PNMI_MDB_VERSION 0x00030000 /* 3.0 */ + + +/* + * Event definitions + */ +#define SK_PNMI_EVT_SIRQ_OVERFLOW 1 /* Counter overflow */ +#define SK_PNMI_EVT_SEN_WAR_LOW 2 /* Lower war thres exceeded */ +#define SK_PNMI_EVT_SEN_WAR_UPP 3 /* Upper war thres exceeded */ +#define SK_PNMI_EVT_SEN_ERR_LOW 4 /* Lower err thres exceeded */ +#define SK_PNMI_EVT_SEN_ERR_UPP 5 /* Upper err thres exceeded */ +#define SK_PNMI_EVT_CHG_EST_TIMER 6 /* Timer event for RLMT Chg */ +#define SK_PNMI_EVT_UTILIZATION_TIMER 7 /* Timer event for Utiliza. */ +#define SK_PNMI_EVT_CLEAR_COUNTER 8 /* Clear statistic counters */ +#define SK_PNMI_EVT_XMAC_RESET 9 /* XMAC will be reset */ + +#define SK_PNMI_EVT_RLMT_PORT_UP 10 /* Port came logically up */ +#define SK_PNMI_EVT_RLMT_PORT_DOWN 11 /* Port went logically down */ +#define SK_PNMI_EVT_RLMT_PORT_SWITCH 12 /* Switched active port */ +#define SK_PNMI_EVT_RLMT_SEGMENTATION 13 /* Two SP root bridges found */ +#define SK_PNMI_EVT_RLMT_ACTIVE_DOWN 14 /* Port went logically down */ +#define SK_PNMI_EVT_RLMT_ACTIVE_UP 15 /* Port came logically up */ + +/* + * Return values + */ +#define SK_PNMI_ERR_OK 0 +#define SK_PNMI_ERR_GENERAL 1 +#define SK_PNMI_ERR_TOO_SHORT 2 +#define SK_PNMI_ERR_BAD_VALUE 3 +#define SK_PNMI_ERR_READ_ONLY 4 +#define SK_PNMI_ERR_UNKNOWN_OID 5 +#define SK_PNMI_ERR_UNKNOWN_INST 6 + + +/* + * Return values of driver reset function SK_DRIVER_RESET() and + * driver event function SK_DRIVER_EVENT() + */ +#define SK_PNMI_ERR_OK 0 +#define SK_PNMI_ERR_FAIL 1 + + +/* + * Return values of driver test function SK_DRIVER_SELFTEST() + */ +#define SK_PNMI_TST_UNKNOWN (1 << 0) +#define SK_PNMI_TST_TRANCEIVER (1 << 1) +#define SK_PNMI_TST_ASIC (1 << 2) +#define SK_PNMI_TST_SENSOR (1 << 3) +#define SK_PNMI_TST_POWERMGMT (1 << 4) +#define SK_PNMI_TST_PCI (1 << 5) +#define SK_PNMI_TST_MAC (1 << 6) + + +/* + * RLMT specific definitions + */ +#define SK_PNMI_RLMT_STATUS_STANDBY 1 +#define SK_PNMI_RLMT_STATUS_ACTIVE 2 +#define SK_PNMI_RLMT_STATUS_ERROR 3 + +#define SK_PNMI_RLMT_LSTAT_PHY_DOWN 1 +#define SK_PNMI_RLMT_LSTAT_AUTONEG 2 +#define SK_PNMI_RLMT_LSTAT_LOG_DOWN 3 +#define SK_PNMI_RLMT_LSTAT_LOG_UP 4 +#define SK_PNMI_RLMT_LSTAT_INDETERMINATED 5 + +#define SK_PNMI_RLMT_MODE_CHK_LINK (SK_RLMT_CHECK_LINK) +#define SK_PNMI_RLMT_MODE_CHK_RX (SK_RLMT_CHECK_LOC_LINK) +#define SK_PNMI_RLMT_MODE_CHK_SPT (SK_RLMT_CHECK_SEG) +/* #define SK_PNMI_RLMT_MODE_CHK_EX */ + +/* + * OID definition + */ +#ifndef _NDIS_ /* Check, whether NDIS already included OIDs */ + +#define OID_GEN_XMIT_OK 0x00020101 +#define OID_GEN_RCV_OK 0x00020102 +#define OID_GEN_XMIT_ERROR 0x00020103 +#define OID_GEN_RCV_ERROR 0x00020104 +#define OID_GEN_RCV_NO_BUFFER 0x00020105 + +/* #define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 */ +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 +/* #define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 */ +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 +/* #define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 */ +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 +/* #define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 */ +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 +/* #define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 */ +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A +/* #define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B */ +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C +#define OID_GEN_RCV_CRC_ERROR 0x0002020D +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E + +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 +#define OID_802_3_CURRENT_ADDRESS 0x01010102 +/* #define OID_802_3_MULTICAST_LIST 0x01010103 */ +/* #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 */ +/* #define OID_802_3_MAC_OPTIONS 0x01010105 */ + +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 +#define OID_802_3_XMIT_DEFERRED 0x01020201 +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 +#define OID_802_3_RCV_OVERRUN 0x01020203 +#define OID_802_3_XMIT_UNDERRUN 0x01020204 +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 + +#endif /* _NDIS_ */ + +#define OID_SKGE_MDB_VERSION 0xFF010100 +#define OID_SKGE_SUPPORTED_LIST 0xFF010101 +#define OID_SKGE_VPD_FREE_BYTES 0xFF010102 +#define OID_SKGE_VPD_ENTRIES_LIST 0xFF010103 +#define OID_SKGE_VPD_ENTRIES_NUMBER 0xFF010104 +#define OID_SKGE_VPD_KEY 0xFF010105 +#define OID_SKGE_VPD_VALUE 0xFF010106 +#define OID_SKGE_VPD_ACCESS 0xFF010107 +#define OID_SKGE_VPD_ACTION 0xFF010108 + +#define OID_SKGE_PORT_NUMBER 0xFF010110 +#define OID_SKGE_DEVICE_TYPE 0xFF010111 +#define OID_SKGE_DRIVER_DESCR 0xFF010112 +#define OID_SKGE_DRIVER_VERSION 0xFF010113 +#define OID_SKGE_HW_DESCR 0xFF010114 +#define OID_SKGE_HW_VERSION 0xFF010115 +#define OID_SKGE_CHIPSET 0xFF010116 +#define OID_SKGE_ACTION 0xFF010117 +#define OID_SKGE_RESULT 0xFF010118 +#define OID_SKGE_BUS_TYPE 0xFF010119 +#define OID_SKGE_BUS_SPEED 0xFF01011A +#define OID_SKGE_BUS_WIDTH 0xFF01011B + +/*#define OID_SKGE_MULTICAST_LIST 0xFF01011C*/ + +#define OID_SKGE_SENSOR_NUMBER 0xFF020100 +#define OID_SKGE_SENSOR_INDEX 0xFF020101 +#define OID_SKGE_SENSOR_DESCR 0xFF020102 +#define OID_SKGE_SENSOR_TYPE 0xFF020103 +#define OID_SKGE_SENSOR_VALUE 0xFF020104 +#define OID_SKGE_SENSOR_WAR_THRES_LOW 0xFF020105 +#define OID_SKGE_SENSOR_WAR_THRES_UPP 0xFF020106 +#define OID_SKGE_SENSOR_ERR_THRES_LOW 0xFF020107 +#define OID_SKGE_SENSOR_ERR_THRES_UPP 0xFF020108 +#define OID_SKGE_SENSOR_STATUS 0xFF020109 +#define OID_SKGE_SENSOR_WAR_CTS 0xFF02010A +#define OID_SKGE_SENSOR_ERR_CTS 0xFF02010B +#define OID_SKGE_SENSOR_WAR_TIME 0xFF02010C +#define OID_SKGE_SENSOR_ERR_TIME 0xFF02010D + +#define OID_SKGE_CHKSM_NUMBER 0xFF020110 +#define OID_SKGE_CHKSM_RX_OK_CTS 0xFF020111 +#define OID_SKGE_CHKSM_RX_UNABLE_CTS 0xFF020112 +#define OID_SKGE_CHKSM_RX_ERR_CTS 0xFF020113 +#define OID_SKGE_CHKSM_TX_OK_CTS 0xFF020114 +#define OID_SKGE_CHKSM_TX_UNABLE_CTS 0xFF020115 + +#define OID_SKGE_STAT_TX 0xFF020120 +#define OID_SKGE_STAT_TX_OCTETS 0xFF020121 +#define OID_SKGE_STAT_TX_BROADCAST 0xFF020122 +#define OID_SKGE_STAT_TX_MULTICAST 0xFF020123 +#define OID_SKGE_STAT_TX_UNICAST 0xFF020124 +#define OID_SKGE_STAT_TX_LONGFRAMES 0xFF020125 +#define OID_SKGE_STAT_TX_BURST 0xFF020126 +#define OID_SKGE_STAT_TX_PFLOWC 0xFF020127 +#define OID_SKGE_STAT_TX_FLOWC 0xFF020128 +#define OID_SKGE_STAT_TX_SINGLE_COL 0xFF020129 +#define OID_SKGE_STAT_TX_MULTI_COL 0xFF02012A +#define OID_SKGE_STAT_TX_EXCESS_COL 0xFF02012B +#define OID_SKGE_STAT_TX_LATE_COL 0xFF02012C +#define OID_SKGE_STAT_TX_DEFFERAL 0xFF02012D +#define OID_SKGE_STAT_TX_EXCESS_DEF 0xFF02012E +#define OID_SKGE_STAT_TX_UNDERRUN 0xFF02012F +#define OID_SKGE_STAT_TX_CARRIER 0xFF020130 +/* #define OID_SKGE_STAT_TX_UTIL 0xFF020131 */ +#define OID_SKGE_STAT_TX_64 0xFF020132 +#define OID_SKGE_STAT_TX_127 0xFF020133 +#define OID_SKGE_STAT_TX_255 0xFF020134 +#define OID_SKGE_STAT_TX_511 0xFF020135 +#define OID_SKGE_STAT_TX_1023 0xFF020136 +#define OID_SKGE_STAT_TX_MAX 0xFF020137 +#define OID_SKGE_STAT_TX_SYNC 0xFF020138 +#define OID_SKGE_STAT_TX_SYNC_OCTETS 0xFF020139 +#define OID_SKGE_STAT_RX 0xFF02013A +#define OID_SKGE_STAT_RX_OCTETS 0xFF02013B +#define OID_SKGE_STAT_RX_BROADCAST 0xFF02013C +#define OID_SKGE_STAT_RX_MULTICAST 0xFF02013D +#define OID_SKGE_STAT_RX_UNICAST 0xFF02013E +#define OID_SKGE_STAT_RX_PFLOWC 0xFF02013F +#define OID_SKGE_STAT_RX_FLOWC 0xFF020140 +#define OID_SKGE_STAT_RX_PFLOWC_ERR 0xFF020141 +#define OID_SKGE_STAT_RX_FLOWC_UNKWN 0xFF020142 +#define OID_SKGE_STAT_RX_BURST 0xFF020143 +#define OID_SKGE_STAT_RX_MISSED 0xFF020144 +#define OID_SKGE_STAT_RX_FRAMING 0xFF020145 +#define OID_SKGE_STAT_RX_OVERFLOW 0xFF020146 +#define OID_SKGE_STAT_RX_JABBER 0xFF020147 +#define OID_SKGE_STAT_RX_CARRIER 0xFF020148 +#define OID_SKGE_STAT_RX_IR_LENGTH 0xFF020149 +#define OID_SKGE_STAT_RX_SYMBOL 0xFF02014A +#define OID_SKGE_STAT_RX_SHORTS 0xFF02014B +#define OID_SKGE_STAT_RX_RUNT 0xFF02014C +#define OID_SKGE_STAT_RX_CEXT 0xFF02014D +#define OID_SKGE_STAT_RX_TOO_LONG 0xFF02014E +#define OID_SKGE_STAT_RX_FCS 0xFF02014F +/* #define OID_SKGE_STAT_RX_UTIL 0xFF020150 */ +#define OID_SKGE_STAT_RX_64 0xFF020151 +#define OID_SKGE_STAT_RX_127 0xFF020152 +#define OID_SKGE_STAT_RX_255 0xFF020153 +#define OID_SKGE_STAT_RX_511 0xFF020154 +#define OID_SKGE_STAT_RX_1023 0xFF020155 +#define OID_SKGE_STAT_RX_MAX 0xFF020156 + +#define OID_SKGE_PHYS_CUR_ADDR 0xFF010120 +#define OID_SKGE_PHYS_FAC_ADDR 0xFF010121 +#define OID_SKGE_PMD 0xFF010122 +#define OID_SKGE_CONNECTOR 0xFF010123 +#define OID_SKGE_LINK_CAP 0xFF010124 +#define OID_SKGE_LINK_MODE 0xFF010125 +#define OID_SKGE_LINK_MODE_STATUS 0xFF010126 +#define OID_SKGE_LINK_STATUS 0xFF010127 +#define OID_SKGE_FLOWCTRL_CAP 0xFF010128 +#define OID_SKGE_FLOWCTRL_MODE 0xFF010129 +#define OID_SKGE_FLOWCTRL_STATUS 0xFF01012A +#define OID_SKGE_PHY_OPERATION_CAP 0xFF01012B +#define OID_SKGE_PHY_OPERATION_MODE 0xFF01012C +#define OID_SKGE_PHY_OPERATION_STATUS 0xFF01012D + +#define OID_SKGE_TRAP 0xFF010130 +#define OID_SKGE_TRAP_NUMBER 0xFF010131 + +#define OID_SKGE_RLMT_MODE 0xFF010140 +#define OID_SKGE_RLMT_PORT_NUMBER 0xFF010141 +#define OID_SKGE_RLMT_PORT_ACTIVE 0xFF010142 +#define OID_SKGE_RLMT_PORT_PREFERED 0xFF010143 +#define OID_SKGE_RLMT_CHANGE_CTS 0xFF020160 +#define OID_SKGE_RLMT_CHANGE_TIME 0xFF020161 +#define OID_SKGE_RLMT_CHANGE_ESTIM 0xFF020162 +#define OID_SKGE_RLMT_CHANGE_THRES 0xFF020163 + +#define OID_SKGE_RLMT_PORT_INDEX 0xFF020164 +#define OID_SKGE_RLMT_STATUS 0xFF020165 +#define OID_SKGE_RLMT_TX_HELLO_CTS 0xFF020166 +#define OID_SKGE_RLMT_RX_HELLO_CTS 0xFF020167 +#define OID_SKGE_RLMT_TX_SP_REQ_CTS 0xFF020168 +#define OID_SKGE_RLMT_RX_SP_CTS 0xFF020169 + +#define OID_SKGE_RLMT_MONITOR_NUMBER 0xFF010150 +#define OID_SKGE_RLMT_MONITOR_INDEX 0xFF010151 +#define OID_SKGE_RLMT_MONITOR_ADDR 0xFF010152 +#define OID_SKGE_RLMT_MONITOR_ERRS 0xFF010153 +#define OID_SKGE_RLMT_MONITOR_TIMESTAMP 0xFF010154 +#define OID_SKGE_RLMT_MONITOR_ADMIN 0xFF010155 + +#define OID_SKGE_TX_SW_QUEUE_LEN 0xFF020170 +#define OID_SKGE_TX_SW_QUEUE_MAX 0xFF020171 +#define OID_SKGE_TX_RETRY 0xFF020172 +#define OID_SKGE_RX_INTR_CTS 0xFF020173 +#define OID_SKGE_TX_INTR_CTS 0xFF020174 +#define OID_SKGE_RX_NO_BUF_CTS 0xFF020175 +#define OID_SKGE_TX_NO_BUF_CTS 0xFF020176 +#define OID_SKGE_TX_USED_DESCR_NO 0xFF020177 +#define OID_SKGE_RX_DELIVERED_CTS 0xFF020178 +#define OID_SKGE_RX_OCTETS_DELIV_CTS 0xFF020179 +#define OID_SKGE_RX_HW_ERROR_CTS 0xFF02017A +#define OID_SKGE_TX_HW_ERROR_CTS 0xFF02017B +#define OID_SKGE_IN_ERRORS_CTS 0xFF02017C +#define OID_SKGE_OUT_ERROR_CTS 0xFF02017D +#define OID_SKGE_ERR_RECOVERY_CTS 0xFF02017E +#define OID_SKGE_SYSUPTIME 0xFF02017F + +#define OID_SKGE_ALL_DATA 0xFF020190 + + +#define OID_SKGE_TRAP_SEN_WAR_LOW 500 +#define OID_SKGE_TRAP_SEN_WAR_UPP 501 +#define OID_SKGE_TRAP_SEN_ERR_LOW 502 +#define OID_SKGE_TRAP_SEN_ERR_UPP 503 +#define OID_SKGE_TRAP_RLMT_CHANGE_THRES 520 +#define OID_SKGE_TRAP_RLMT_CHANGE_PORT 521 +#define OID_SKGE_TRAP_RLMT_PORT_DOWN 522 +#define OID_SKGE_TRAP_RLMT_PORT_UP 523 +#define OID_SKGE_TRAP_RLMT_SEGMENTATION 524 + + +/* + * Define error numbers and messages for syslog + */ +#define SK_PNMI_ERR001 (SK_ERRBASE_PNMI + 1) +#define SK_PNMI_ERR001MSG "SkPnmiGetStruct: Unknown OID" +#define SK_PNMI_ERR002 (SK_ERRBASE_PNMI + 2) +#define SK_PNMI_ERR002MSG "SkPnmiGetStruct: Cannot read VPD keys" +#define SK_PNMI_ERR003 (SK_ERRBASE_PNMI + 3) +#define SK_PNMI_ERR003MSG "OidStruct: Called with wrong OID" +#define SK_PNMI_ERR004 (SK_ERRBASE_PNMI + 4) +#define SK_PNMI_ERR004MSG "OidStruct: Called with wrong action" +#define SK_PNMI_ERR005 (SK_ERRBASE_PNMI + 5) +#define SK_PNMI_ERR005MSG "Perform: Cannot reset driver" +#define SK_PNMI_ERR006 (SK_ERRBASE_PNMI + 6) +#define SK_PNMI_ERR006MSG "Perform: Unknown OID action command" +#define SK_PNMI_ERR007 (SK_ERRBASE_PNMI + 7) +#define SK_PNMI_ERR007MSG "General: Driver description not initialized" +#define SK_PNMI_ERR008 (SK_ERRBASE_PNMI + 8) +#define SK_PNMI_ERR008MSG "Addr: Tried to get unknown OID" +#define SK_PNMI_ERR009 (SK_ERRBASE_PNMI + 9) +#define SK_PNMI_ERR009MSG "Addr: Unknown OID" +#define SK_PNMI_ERR010 (SK_ERRBASE_PNMI + 10) +#define SK_PNMI_ERR010MSG "CsumStat: Unknown OID" +#define SK_PNMI_ERR011 (SK_ERRBASE_PNMI + 11) +#define SK_PNMI_ERR011MSG "SensorStat: Sensor descr string too long" +#define SK_PNMI_ERR012 (SK_ERRBASE_PNMI + 12) +#define SK_PNMI_ERR012MSG "SensorStat: Unknown OID" +#define SK_PNMI_ERR013 (SK_ERRBASE_PNMI + 13) +#define SK_PNMI_ERR013MSG "SensorStat: Unknown OID should be errored before" +#define SK_PNMI_ERR014 (SK_ERRBASE_PNMI + 14) +#define SK_PNMI_ERR014MSG "Vpd: Cannot read VPD keys" +#define SK_PNMI_ERR015 (SK_ERRBASE_PNMI + 15) +#define SK_PNMI_ERR015MSG "Vpd: Internal array for VPD keys to small" +#define SK_PNMI_ERR016 (SK_ERRBASE_PNMI + 16) +#define SK_PNMI_ERR016MSG "Vpd: Key string too long" +#define SK_PNMI_ERR017 (SK_ERRBASE_PNMI + 17) +#define SK_PNMI_ERR017MSG "Vpd: Invalid VPD status pointer" +#define SK_PNMI_ERR018 (SK_ERRBASE_PNMI + 18) +#define SK_PNMI_ERR018MSG "Vpd: VPD data not valid" +#define SK_PNMI_ERR019 (SK_ERRBASE_PNMI + 19) +#define SK_PNMI_ERR019MSG "Vpd: VPD entries list string too long" +#define SK_PNMI_ERR021 (SK_ERRBASE_PNMI + 21) +#define SK_PNMI_ERR021MSG "Vpd: VPD data string too long" +#define SK_PNMI_ERR022 (SK_ERRBASE_PNMI + 22) +#define SK_PNMI_ERR022MSG "Vpd: VPD data string too long should be errored before" +#define SK_PNMI_ERR023 (SK_ERRBASE_PNMI + 23) +#define SK_PNMI_ERR023MSG "Vpd: Unknown OID in get action" +#define SK_PNMI_ERR024 (SK_ERRBASE_PNMI + 24) +#define SK_PNMI_ERR024MSG "Vpd: Unknown OID in preset/set action" +#define SK_PNMI_ERR025 (SK_ERRBASE_PNMI + 25) +#define SK_PNMI_ERR025MSG "Vpd: Cannot write VPD after modify entry" +#define SK_PNMI_ERR026 (SK_ERRBASE_PNMI + 26) +#define SK_PNMI_ERR026MSG "Vpd: Cannot update VPD" +#define SK_PNMI_ERR027 (SK_ERRBASE_PNMI + 27) +#define SK_PNMI_ERR027MSG "Vpd: Cannot delete VPD entry" +#define SK_PNMI_ERR028 (SK_ERRBASE_PNMI + 28) +#define SK_PNMI_ERR028MSG "Vpd: Cannot update VPD after delete entry" +#define SK_PNMI_ERR029 (SK_ERRBASE_PNMI + 29) +#define SK_PNMI_ERR029MSG "General: Driver description string too long" +#define SK_PNMI_ERR030 (SK_ERRBASE_PNMI + 30) +#define SK_PNMI_ERR030MSG "General: Driver version not initialized" +#define SK_PNMI_ERR031 (SK_ERRBASE_PNMI + 31) +#define SK_PNMI_ERR031MSG "General: Driver version string too long" +#define SK_PNMI_ERR032 (SK_ERRBASE_PNMI + 32) +#define SK_PNMI_ERR032MSG "General: Cannot read VPD Name for HW descr" +#define SK_PNMI_ERR033 (SK_ERRBASE_PNMI + 33) +#define SK_PNMI_ERR033MSG "General: HW description string too long" +#define SK_PNMI_ERR034 (SK_ERRBASE_PNMI + 34) +#define SK_PNMI_ERR034MSG "General: Unknown OID" +#define SK_PNMI_ERR035 (SK_ERRBASE_PNMI + 35) +#define SK_PNMI_ERR035MSG "Rlmt: Unknown OID" +#define SK_PNMI_ERR036 (SK_ERRBASE_PNMI + 36) +#define SK_PNMI_ERR036MSG "Rlmt: Unknown OID should be errored before" +#define SK_PNMI_ERR037 (SK_ERRBASE_PNMI + 37) +#define SK_PNMI_ERR037MSG "Rlmt: SK_RLMT_MODE_CHANGE event return not 0" +#define SK_PNMI_ERR038 (SK_ERRBASE_PNMI + 38) +#define SK_PNMI_ERR038MSG "Rlmt: SK_RLMT_PREFPORT_CHANGE event return not 0" +#define SK_PNMI_ERR039 (SK_ERRBASE_PNMI + 39) +#define SK_PNMI_ERR039MSG "RlmtStat: Unknown OID" +#define SK_PNMI_ERR040 (SK_ERRBASE_PNMI + 40) +#define SK_PNMI_ERR040MSG "RlmtStat: Unknown OID should be errored before" +#define SK_PNMI_ERR041 (SK_ERRBASE_PNMI + 41) +#define SK_PNMI_ERR041MSG "MacPrivateConf: Unknown OID" +#define SK_PNMI_ERR042 (SK_ERRBASE_PNMI + 42) +#define SK_PNMI_ERR042MSG "MacPrivateConf: Unknown OID should be errored before" +#define SK_PNMI_ERR043 (SK_ERRBASE_PNMI + 43) +#define SK_PNMI_ERR043MSG "MacPrivateConf: SK_HWEV_SET_LMODE returned not 0" +#define SK_PNMI_ERR044 (SK_ERRBASE_PNMI + 44) +#define SK_PNMI_ERR044MSG "MacPrivateConf: SK_HWEV_SET_FLOWMODE returned not 0" +#define SK_PNMI_ERR045 (SK_ERRBASE_PNMI + 45) +#define SK_PNMI_ERR045MSG "MacPrivateConf: Unknown OID in set action" +#define SK_PNMI_ERR046 (SK_ERRBASE_PNMI + 46) +#define SK_PNMI_ERR046MSG "Monitor: Unknown OID" +#define SK_PNMI_ERR047 (SK_ERRBASE_PNMI + 47) +#define SK_PNMI_ERR047MSG "SirqUpdate: Event function returns not 0" +#define SK_PNMI_ERR048 (SK_ERRBASE_PNMI + 48) +#define SK_PNMI_ERR048MSG "RlmtUpdate: Event function returns not 0" +#define SK_PNMI_ERR049 (SK_ERRBASE_PNMI + 49) +#define SK_PNMI_ERR049MSG "" +#define SK_PNMI_ERR050 (SK_ERRBASE_PNMI + 50) +#define SK_PNMI_ERR050MSG "MacUpdate: Cannot update statistic counter" +#define SK_PNMI_ERR051 (SK_ERRBASE_PNMI + 51) +#define SK_PNMI_ERR051MSG "SkPnmiEvent: Port switch suspicious" + +/* + * Management counter macros called by the driver + */ +#define SK_PNMI_SET_DRIVER_DESCR(pAC,v) ((pAC)->Pnmi.pDriverDescription = \ + (char *)(v)) + +#define SK_PNMI_SET_DRIVER_VER(pAC,v) ((pAC)->Pnmi.pDriverVersion = \ + (char *)(v)) + +#define SK_PNMI_CNT_TX_QUEUE_LEN(pAC,v) \ + { \ + (pAC)->Pnmi.TxSwQueueLen = (SK_U64)(v); \ + if ((pAC)->Pnmi.TxSwQueueLen > (pAC)->Pnmi.TxSwQueueMax) { \ + (pAC)->Pnmi.TxSwQueueMax = (pAC)->Pnmi.TxSwQueueLen; \ + } \ + } +#define SK_PNMI_CNT_TX_RETRY(pAC) (((pAC)->Pnmi.TxRetryCts)++) +#define SK_PNMI_CNT_RX_INTR(pAC) (((pAC)->Pnmi.RxIntrCts)++) +#define SK_PNMI_CNT_TX_INTR(pAC) (((pAC)->Pnmi.TxIntrCts)++) +#define SK_PNMI_CNT_NO_RX_BUF(pAC) (((pAC)->Pnmi.RxNoBufCts)++) +#define SK_PNMI_CNT_NO_TX_BUF(pAC) (((pAC)->Pnmi.TxNoBufCts)++) +#define SK_PNMI_CNT_USED_TX_DESCR(pAC,v) \ + ((pAC)->Pnmi.TxUsedDescrNo=(SK_U64)(v)); +#define SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,v) \ + { \ + ((pAC)->Pnmi.RxDeliveredCts)++; \ + (pAC)->Pnmi.RxOctetsDeliveredCts += (SK_U64)(v); \ + } +#define SK_PNMI_CNT_ERR_RECOVERY(pAC) (((pAC)->Pnmi.ErrRecoveryCts)++); + +#define SK_PNMI_CNT_SYNC_OCTETS(pAC,p,v) \ + { \ + if (((p) >= 0) && ((p) < SK_MAX_MACS)) { \ + ((pAC)->Pnmi.StatSyncCts[p])++; \ + (pAC)->Pnmi.StatSyncOctetsCts[p] += (SK_U64)(v); \ + } \ + } + +/* + * Conversion Macros + */ +#define SK_PNMI_PORT_INST2LOG(i) ((unsigned int)(i) - 1) +#define SK_PNMI_PORT_LOG2INST(l) ((unsigned int)(l) + 1) +#define SK_PNMI_PORT_PHYS2LOG(p) ((unsigned int)(p) + 1) +#define SK_PNMI_PORT_LOG2PHYS(pAC,l) ((unsigned int)(l) - 1) +#define SK_PNMI_PORT_PHYS2INST(p) ((unsigned int)(p) + 2) +#define SK_PNMI_PORT_INST2PHYS(pAC,i) ((unsigned int)(i) - 2) + +/* + * Structure definition for SkPnmiGetStruct and SkPnmiSetStruct + */ +#define SK_PNMI_VPD_ENTRIES 20 +#define SK_PNMI_VPD_DATALEN 128 +#define SK_PNMI_MULTICAST_LISTLEN 64 +#define SK_PNMI_SENSOR_ENTRIES (SK_MAX_SENSORS) +#define SK_PNMI_CHECKSUM_ENTRIES 3 +#define SK_PNMI_MAC_ENTRIES (SK_MAX_MACS + 1) +#define SK_PNMI_MONITOR_ENTRIES 20 +#define SK_PNMI_TRAP_ENTRIES 10 +#define SK_PNMI_TRAPLEN 128 +#define SK_PNMI_STRINGLEN1 80 +#define SK_PNMI_STRINGLEN2 25 +#define SK_PNMI_TRAP_QUEUE_LEN 512 + +typedef struct s_PnmiVpd { + char VpdKey[5]; + char VpdValue[SK_PNMI_VPD_DATALEN]; + SK_U8 VpdAccess; + SK_U8 VpdAction; +} SK_PNMI_VPD; + +typedef struct s_PnmiSensor { + SK_U8 SensorIndex; + char SensorDescr[SK_PNMI_STRINGLEN2]; + SK_U8 SensorType; + SK_U32 SensorValue; + SK_U32 SensorWarningThresholdLow; + SK_U32 SensorWarningThresholdHigh; + SK_U32 SensorErrorThresholdLow; + SK_U32 SensorErrorThresholdHigh; + SK_U8 SensorStatus; + SK_U64 SensorWarningCts; + SK_U64 SensorErrorCts; + SK_U64 SensorWarningTimestamp; + SK_U64 SensorErrorTimestamp; +} SK_PNMI_SENSOR; + +typedef struct s_PnmiChecksum { + SK_U64 ChecksumRxOkCts; + SK_U64 ChecksumRxUnableCts; + SK_U64 ChecksumRxErrCts; + SK_U64 ChecksumTxOkCts; + SK_U64 ChecksumTxUnableCts; +} SK_PNMI_CHECKSUM; + +typedef struct s_PnmiStat { + SK_U64 StatTxOkCts; + SK_U64 StatTxOctetsOkCts; + SK_U64 StatTxBroadcastOkCts; + SK_U64 StatTxMulticastOkCts; + SK_U64 StatTxUnicastOkCts; + SK_U64 StatTxLongFramesCts; + SK_U64 StatTxBurstCts; + SK_U64 StatTxPauseMacCtrlCts; + SK_U64 StatTxMacCtrlCts; + SK_U64 StatTxSingleCollisionCts; + SK_U64 StatTxMultipleCollisionCts; + SK_U64 StatTxExcessiveCollisionCts; + SK_U64 StatTxLateCollisionCts; + SK_U64 StatTxDeferralCts; + SK_U64 StatTxExcessiveDeferralCts; + SK_U64 StatTxFifoUnderrunCts; + SK_U64 StatTxCarrierCts; + SK_U64 Dummy1; /* StatTxUtilization */ + SK_U64 StatTx64Cts; + SK_U64 StatTx127Cts; + SK_U64 StatTx255Cts; + SK_U64 StatTx511Cts; + SK_U64 StatTx1023Cts; + SK_U64 StatTxMaxCts; + SK_U64 StatTxSyncCts; + SK_U64 StatTxSyncOctetsCts; + SK_U64 StatRxOkCts; + SK_U64 StatRxOctetsOkCts; + SK_U64 StatRxBroadcastOkCts; + SK_U64 StatRxMulticastOkCts; + SK_U64 StatRxUnicastOkCts; + SK_U64 StatRxPauseMacCtrlCts; + SK_U64 StatRxMacCtrlCts; + SK_U64 StatRxPauseMacCtrlErrorCts; + SK_U64 StatRxMacCtrlUnknownCts; + SK_U64 StatRxBurstCts; + SK_U64 StatRxMissedCts; + SK_U64 StatRxFramingCts; + SK_U64 StatRxFifoOverflowCts; + SK_U64 StatRxJabberCts; + SK_U64 StatRxCarrierCts; + SK_U64 StatRxIRLengthCts; + SK_U64 StatRxSymbolCts; + SK_U64 StatRxShortsCts; + SK_U64 StatRxRuntCts; + SK_U64 StatRxCextCts; + SK_U64 StatRxTooLongCts; + SK_U64 StatRxFcsCts; + SK_U64 Dummy2; /* StatRxUtilization */ + SK_U64 StatRx64Cts; + SK_U64 StatRx127Cts; + SK_U64 StatRx255Cts; + SK_U64 StatRx511Cts; + SK_U64 StatRx1023Cts; + SK_U64 StatRxMaxCts; +} SK_PNMI_STAT; + +typedef struct s_PnmiConf { + char ConfMacCurrentAddr[6]; + char ConfMacFactoryAddr[6]; + SK_U8 ConfPMD; + SK_U8 ConfConnector; + SK_U8 ConfLinkCapability; + SK_U8 ConfLinkMode; + SK_U8 ConfLinkModeStatus; + SK_U8 ConfLinkStatus; + SK_U8 ConfFlowCtrlCapability; + SK_U8 ConfFlowCtrlMode; + SK_U8 ConfFlowCtrlStatus; + SK_U8 ConfPhyOperationCapability; + SK_U8 ConfPhyOperationMode; + SK_U8 ConfPhyOperationStatus; +} SK_PNMI_CONF; + +typedef struct s_PnmiRlmt { + SK_U32 RlmtIndex; + SK_U32 RlmtStatus; + SK_U64 RlmtTxHelloCts; + SK_U64 RlmtRxHelloCts; + SK_U64 RlmtTxSpHelloReqCts; + SK_U64 RlmtRxSpHelloCts; +} SK_PNMI_RLMT; + +typedef struct s_PnmiRlmtMonitor { + SK_U32 RlmtMonitorIndex; + char RlmtMonitorAddr[6]; + SK_U64 RlmtMonitorErrorCts; + SK_U64 RlmtMonitorTimestamp; + SK_U8 RlmtMonitorAdmin; +} SK_PNMI_RLMT_MONITOR; + +typedef struct s_PnmiRequestStatus { + SK_U32 ErrorStatus; + SK_U32 ErrorOffset; +} SK_PNMI_REQUEST_STATUS; + +typedef struct s_PnmiStrucData { + SK_U32 MgmtDBVersion; + SK_PNMI_REQUEST_STATUS ReturnStatus; + SK_U32 VpdFreeBytes; + char VpdEntriesList[SK_PNMI_VPD_DATALEN]; + SK_U32 VpdEntriesNumber; + SK_PNMI_VPD Vpd[SK_PNMI_VPD_ENTRIES]; + SK_U32 PortNumber; + SK_U32 DeviceType; + char DriverDescr[SK_PNMI_STRINGLEN1]; + char DriverVersion[SK_PNMI_STRINGLEN2]; + char HwDescr[SK_PNMI_STRINGLEN1]; + char HwVersion[SK_PNMI_STRINGLEN2]; + SK_U16 Chipset; + SK_U32 Action; + SK_U32 TestResult; + SK_U8 BusType; + SK_U8 BusSpeed; + SK_U8 BusWidth; + SK_U8 SensorNumber; + SK_PNMI_SENSOR Sensor[SK_PNMI_SENSOR_ENTRIES]; + SK_U8 ChecksumNumber; + SK_PNMI_CHECKSUM Checksum[SK_PNMI_CHECKSUM_ENTRIES]; + SK_PNMI_STAT Stat[SK_PNMI_MAC_ENTRIES]; + SK_PNMI_CONF Conf[SK_PNMI_MAC_ENTRIES]; + SK_U8 RlmtMode; + SK_U32 RlmtPortNumber; + SK_U8 RlmtPortActive; + SK_U8 RlmtPortPreferred; + SK_U64 RlmtChangeCts; + SK_U64 RlmtChangeTime; + SK_U64 RlmtChangeEstimate; + SK_U64 RlmtChangeThreshold; + SK_PNMI_RLMT Rlmt[SK_MAX_MACS]; + SK_U32 RlmtMonitorNumber; + SK_PNMI_RLMT_MONITOR RlmtMonitor[SK_PNMI_MONITOR_ENTRIES]; + SK_U32 TrapNumber; + SK_U8 Trap[SK_PNMI_TRAP_QUEUE_LEN]; + SK_U64 TxSwQueueLen; + SK_U64 TxSwQueueMax; + SK_U64 TxRetryCts; + SK_U64 RxIntrCts; + SK_U64 TxIntrCts; + SK_U64 RxNoBufCts; + SK_U64 TxNoBufCts; + SK_U64 TxUsedDescrNo; + SK_U64 RxDeliveredCts; + SK_U64 RxOctetsDeliveredCts; + SK_U64 RxHwErrorsCts; + SK_U64 TxHwErrorsCts; + SK_U64 InErrorsCts; + SK_U64 OutErrorsCts; + SK_U64 ErrRecoveryCts; + SK_U64 SysUpTime; +} SK_PNMI_STRUCT_DATA; + +#define SK_PNMI_STRUCT_SIZE (sizeof(SK_PNMI_STRUCT_DATA)) +#define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)&(((SK_PNMI_STRUCT_DATA *)0)->\ + VpdFreeBytes)) /* + * ReturnStatus field + * must be located + * before VpdFreeBytes + */ + +/* + * Various definitions + */ +#define SK_PNMI_MAX_PROTOS 3 + +#define SK_PNMI_SCNT_NOT 64 +#define SK_PNMI_CNT_NO 66 + +/* + * Estimate data structure + */ +typedef struct s_PnmiEstimate { + unsigned int EstValueIndex; + SK_U64 EstValue[7]; + SK_U64 Estimate; + SK_TIMER EstTimer; +} SK_PNMI_ESTIMATE; + + +/* + * PNMI specific adatper context structure + */ +typedef struct s_PnmiPort { + SK_U32 CounterHigh[SK_PNMI_SCNT_NOT]; + SK_U64 CounterOffset[SK_PNMI_CNT_NO]; + SK_U64 StatSyncCts; + SK_U64 StatSyncOctetsCts; + SK_BOOL ActiveFlag; +} SK_PNMI_PORT; + +typedef struct s_PnmiData { + SK_PNMI_PORT Port[SK_MAX_MACS]; + SK_U64 VirtualCounterOffset[SK_PNMI_CNT_NO]; + SK_U32 TestResult; + char HwVersion[10]; + + char *pDriverDescription; + char *pDriverVersion; + + char TrapBuf[SK_PNMI_TRAP_QUEUE_LEN]; + unsigned int TrapBufFree; + unsigned int TrapQueueBeg; + unsigned int TrapQueueEnd; + unsigned int TrapBufPad; + unsigned int TrapUnique; + + int MacUpdatedFlag; + int RlmtUpdatedFlag; + int SirqUpdatedFlag; + + SK_U64 RlmtChangeCts; + SK_U64 RlmtChangeTime; + SK_PNMI_ESTIMATE RlmtChangeEstimate; + SK_U64 RlmtChangeThreshold; + + SK_U32 DeviceType; + char PciBusSpeed; + char PciBusWidth; + char PMD; + char Connector; + + SK_U64 TxSwQueueLen; + SK_U64 TxSwQueueMax; + SK_U64 TxRetryCts; + SK_U64 RxIntrCts; + SK_U64 TxIntrCts; + SK_U64 RxNoBufCts; + SK_U64 TxNoBufCts; + SK_U64 TxUsedDescrNo; + SK_U64 RxDeliveredCts; + SK_U64 RxOctetsDeliveredCts; + SK_U64 ErrRecoveryCts; + SK_U64 StartUpTime; +} SK_PNMI; + + +/* + * Function prototypes + */ +extern int SkPnmiInit(SK_AC *pAc, SK_IOC IoC, int level); +extern int SkPnmiGetVar(SK_AC *pAc, SK_IOC IoC, SK_U32 Id, void* pBuf, + unsigned int* pLen, SK_U32 Instance); +extern int SkPnmiPreSetVar(SK_AC *pAc, SK_IOC IoC, SK_U32 Id, + void* pBuf, unsigned int *pLen, SK_U32 Instance); +extern int SkPnmiSetVar(SK_AC *pAc, SK_IOC IoC, SK_U32 Id, void* pBuf, + unsigned int *pLen, SK_U32 Instance); +extern int SkPnmiGetStruct(SK_AC *pAc, SK_IOC IoC, void* pBuf, + unsigned int *pLen); +extern int SkPnmiPreSetStruct(SK_AC *pAc, SK_IOC IoC, void* pBuf, + unsigned int *pLen); +extern int SkPnmiSetStruct(SK_AC *pAc, SK_IOC IoC, void* pBuf, + unsigned int *pLen); +extern int SkPnmiEvent(SK_AC *pAc, SK_IOC IoC, SK_U32 Event, + SK_EVPARA Param); + +#endif diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skgesirq.h linux/drivers/net/sk98lin/h/skgesirq.h --- v2.3.28/linux/drivers/net/sk98lin/h/skgesirq.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skgesirq.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,161 @@ +/****************************************************************************** + * + * Name: skgesirq.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.18 $ + * Date: $Date: 1999/05/19 07:32:59 $ + * Purpose: SK specific Gigabit Ethernet special IRQ functions + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * $Log: skgesirq.h,v $ + * Revision 1.18 1999/05/19 07:32:59 cgoos + * Changes for 1000Base-T. + * + * Revision 1.17 1999/03/12 13:29:31 malthoff + * Move Autonegotiation Error Codes to skgeinit.h. + * + * Revision 1.16 1999/03/08 10:11:28 gklug + * add: AutoNegDone return codes + * + * Revision 1.15 1998/11/18 13:20:53 gklug + * add: different timeouts for active and non-active links + * + * Revision 1.14 1998/11/04 07:18:14 cgoos + * Added prototype for SkXmRxTxEnable. + * + * Revision 1.13 1998/10/21 05:52:23 gklug + * add: parameter DoLoop to InitPhy function + * + * Revision 1.12 1998/10/19 06:45:03 cgoos + * Added prototype for SkXmInitPhy. + * + * Revision 1.11 1998/10/15 14:34:10 gklug + * add: WA_TIME is 500 msec + * + * Revision 1.10 1998/10/14 14:49:41 malthoff + * Remove err log defines E021 and E022. They are + * defined in skgeinit.h now. + * + * Revision 1.9 1998/10/14 14:00:39 gklug + * add: eroor logs for init phys + * + * Revision 1.8 1998/10/14 05:44:05 gklug + * add: E020 + * + * Revision 1.7 1998/10/02 06:24:58 gklug + * add: error messages + * + * Revision 1.6 1998/10/01 07:54:45 gklug + * add: PNMI debug module + * + * Revision 1.5 1998/09/28 13:36:31 malthoff + * Move the bit definitions for Autonegotiation + * and Flow Control to skgeinit.h. + * + * Revision 1.4 1998/09/15 12:29:34 gklug + * add: error logs + * + * Revision 1.3 1998/09/03 13:54:02 gklug + * add: function prototypes + * + * Revision 1.2 1998/09/03 10:24:36 gklug + * add: Events send by PNMI + * add: parameter definition for Flow Control etc. + * + * Revision 1.1 1998/08/27 11:50:27 gklug + * initial revision + * + * + ******************************************************************************/ + +#ifndef _INC_SKGESIRQ_H_ +#define _INC_SKGESIRQ_H_ + +/* + * Define the Event the special IRQ/INI module can handle + */ +#define SK_HWEV_WATIM 1 /* Timeout for WA errata #2 XMAC */ +#define SK_HWEV_PORT_START 2 /* Port Start Event by RLMT */ +#define SK_HWEV_PORT_STOP 3 /* Port Stop Event by RLMT */ +#define SK_HWEV_CLEAR_STAT 4 /* Clear Statistics by PNMI */ +#define SK_HWEV_UPDATE_STAT 5 /* Update Statistics by PNMI */ +#define SK_HWEV_SET_LMODE 6 /* Set Link Mode by PNMI */ +#define SK_HWEV_SET_FLOWMODE 7 /* Set Flow Control Mode by PNMI */ + +#define SK_WA_ACT_TIME (5000000L) /* 5 sec */ +#define SK_WA_INA_TIME (100000L) /* 100 msec */ + +/* + * Define the error numbers and messages + */ +#define SKERR_SIRQ_E001 (SK_ERRBASE_SIRQ+0) +#define SKERR_SIRQ_E001MSG "Unknown event" +#define SKERR_SIRQ_E002 (SKERR_SIRQ_E001+1) +#define SKERR_SIRQ_E002MSG "Packet timeout RX1" +#define SKERR_SIRQ_E003 (SKERR_SIRQ_E002+1) +#define SKERR_SIRQ_E003MSG "Packet timeout RX2" +#define SKERR_SIRQ_E004 (SKERR_SIRQ_E003+1) +#define SKERR_SIRQ_E004MSG "XMAC 1 not correctly initialized" +#define SKERR_SIRQ_E005 (SKERR_SIRQ_E004+1) +#define SKERR_SIRQ_E005MSG "XMAC 2 not correctly initialized" +#define SKERR_SIRQ_E006 (SKERR_SIRQ_E005+1) +#define SKERR_SIRQ_E006MSG "CHECK failure R1" +#define SKERR_SIRQ_E007 (SKERR_SIRQ_E006+1) +#define SKERR_SIRQ_E007MSG "CHECK failure R2" +#define SKERR_SIRQ_E008 (SKERR_SIRQ_E007+1) +#define SKERR_SIRQ_E008MSG "CHECK failure XS1" +#define SKERR_SIRQ_E009 (SKERR_SIRQ_E008+1) +#define SKERR_SIRQ_E009MSG "CHECK failure XA1" +#define SKERR_SIRQ_E010 (SKERR_SIRQ_E009+1) +#define SKERR_SIRQ_E010MSG "CHECK failure XS2" +#define SKERR_SIRQ_E011 (SKERR_SIRQ_E010+1) +#define SKERR_SIRQ_E011MSG "CHECK failure XA2" +#define SKERR_SIRQ_E012 (SKERR_SIRQ_E011+1) +#define SKERR_SIRQ_E012MSG "unexpected IRQ Master error" +#define SKERR_SIRQ_E013 (SKERR_SIRQ_E012+1) +#define SKERR_SIRQ_E013MSG "unexpected IRQ Status error" +#define SKERR_SIRQ_E014 (SKERR_SIRQ_E013+1) +#define SKERR_SIRQ_E014MSG "Parity error on RAM (read)" +#define SKERR_SIRQ_E015 (SKERR_SIRQ_E014+1) +#define SKERR_SIRQ_E015MSG "Parity error on RAM (write)" +#define SKERR_SIRQ_E016 (SKERR_SIRQ_E015+1) +#define SKERR_SIRQ_E016MSG "Parity error MAC 1" +#define SKERR_SIRQ_E017 (SKERR_SIRQ_E016+1) +#define SKERR_SIRQ_E017MSG "Parity error MAC 2" +#define SKERR_SIRQ_E018 (SKERR_SIRQ_E017+1) +#define SKERR_SIRQ_E018MSG "Parity error RX 1" +#define SKERR_SIRQ_E019 (SKERR_SIRQ_E018+1) +#define SKERR_SIRQ_E019MSG "Parity error RX 2" +#define SKERR_SIRQ_E020 (SKERR_SIRQ_E019+1) +#define SKERR_SIRQ_E020MSG "XMAC transmit FIFO underrun" +#define SKERR_SIRQ_E021 (SKERR_SIRQ_E020+1) +#define SKERR_SIRQ_E021MSG "Spurious I2C interrupt" +#define SKERR_SIRQ_E022 (SKERR_SIRQ_E020+1) +#define SKERR_SIRQ_E022MSG "Cable pair swap error" + +extern void SkGeSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus); +extern int SkGeSirqEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para); +extern void SkXmInitPhy( SK_AC *pAC, SK_IOC IoC, int Port, SK_BOOL DoLoop); +extern int SkXmRxTxEnable(SK_AC *pAC, SK_IOC IoC, int Port); +extern void SkHWLinkUp(SK_AC *pAC, SK_IOC IoC, int Port); +extern void SkHWLinkDown(SK_AC *pAC, SK_IOC IoC, int Port); + +#endif /* _INC_SKGESIRQ_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/ski2c.h linux/drivers/net/sk98lin/h/ski2c.h --- v2.3.28/linux/drivers/net/sk98lin/h/ski2c.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/ski2c.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,263 @@ +/****************************************************************************** + * + * Name: ski2c.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.27 $ + * Date: $Date: 1999/05/20 09:23:10 $ + * Purpose: Defines to access Voltage and Temperature Sensor + * (taken from Monalisa (taken from Concentrator)) + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: ski2c.h,v $ + * Revision 1.27 1999/05/20 09:23:10 cgoos + * Changes for 1000Base-T (Fan sensors). + * + * Revision 1.26 1998/12/01 13:45:47 gklug + * add: InitLevel to I2c struct + * + * Revision 1.25 1998/11/03 06:55:16 gklug + * add: Dummy Reads to I2c struct + * + * Revision 1.24 1998/10/02 14:28:59 cgoos + * Added prototype for SkI2cIsr. + * + * Revision 1.23 1998/09/08 12:20:11 gklug + * add: prototypes for init and read functions + * + * Revision 1.22 1998/09/08 07:37:56 gklug + * add: log error if PCI_IO voltage sensor could not be initialized + * + * Revision 1.21 1998/09/04 08:38:05 malthoff + * Change the values for I2C_READ and I2C_WRITE + * + * Revision 1.20 1998/08/25 07:52:22 gklug + * chg: Timestamps (last) added for logging + * + * Revision 1.19 1998/08/25 06:09:00 gklug + * rmv: warning and error levels of the individual sensors. + * add: timing definitions for sending traps and logging errors + * + * Revision 1.18 1998/08/20 11:41:15 gklug + * chg: omit STRCPY macro by using char * as Sensor Description + * + * Revision 1.17 1998/08/20 11:37:43 gklug + * chg: change Ioc to IoC + * + * Revision 1.16 1998/08/20 11:30:38 gklug + * fix: SenRead declaration + * + * Revision 1.15 1998/08/20 11:27:53 gklug + * fix: Compile bugs with new awrning constants + * + * Revision 1.14 1998/08/20 08:53:12 gklug + * fix: compiler errors + * add: Threshold values + * + * Revision 1.13 1998/08/19 12:21:16 gklug + * fix: remove struct from C files (see CCC) + * add: typedefs for all structs + * + * Revision 1.12 1998/08/19 10:57:41 gklug + * add: Warning levels + * + * Revision 1.11 1998/08/18 08:37:02 malthoff + * Prototypes not required for SK_DIAG. + * + * Revision 1.10 1998/08/17 13:54:00 gklug + * fix: declaration of event function + * + * Revision 1.9 1998/08/17 06:48:39 malthoff + * Remove some unrequired macros. + * Fix the compiler errors. + * + * Revision 1.8 1998/08/14 06:47:19 gklug + * fix: Values are intergers + * + * Revision 1.7 1998/08/14 06:26:05 gklug + * add: Init error message + * + * Revision 1.6 1998/08/13 08:31:08 gklug + * add: Error message + * + * Revision 1.5 1998/08/12 14:32:04 gklug + * add: new error code/message + * + * Revision 1.4 1998/08/12 13:39:08 gklug + * chg: names of error messages + * add: defines for Sensor type and thresholds + * + * Revision 1.3 1998/08/11 07:57:16 gklug + * add: sensor struct + * add: Timeout defines + * add: I2C control struct for pAC + * + * Revision 1.2 1998/07/17 11:29:02 gklug + * rmv: Microwire and SMTPANIC + * + * Revision 1.1 1998/06/19 14:30:10 malthoff + * Created. Sources taken from ML Project. + * + * + ******************************************************************************/ + +/* + * SKI2C.H contains all I2C specific defines + */ + +#ifndef _SKI2C_H_ +#define _SKI2C_H_ + +typedef struct s_Sensor SK_SENSOR; + +#include "h/skgei2c.h" + +/* + * Define the I2c events. + */ +#define SK_I2CEV_IRQ 1 /* IRQ happened Event */ +#define SK_I2CEV_TIM 2 /* Timeout event */ +#define SK_I2CEV_CLEAR 3 /* Clear Mib Values */ + +/* + * Define READ and WRITE Constants. + */ +#define I2C_READ 0 +#define I2C_WRITE 1 +#define I2C_BURST 1 +#define I2C_SIGLE 0 + +#define SKERR_I2C_E001 (SK_ERRBASE_I2C+0) +#define SKERR_I2C_E001MSG "Sensor index unknown" +#define SKERR_I2C_E002 (SKERR_I2C_E001+1) +#define SKERR_I2C_E002MSG "I2C: transfer does not complete.\n" +#define SKERR_I2C_E003 (SKERR_I2C_E002+1) +#define SKERR_I2C_E003MSG "lm80: NAK on device send.\n" +#define SKERR_I2C_E004 (SKERR_I2C_E003+1) +#define SKERR_I2C_E004MSG "lm80: NAK on register send.\n" +#define SKERR_I2C_E005 (SKERR_I2C_E004+1) +#define SKERR_I2C_E005MSG "lm80: NAK on device (2) send.\n" +#define SKERR_I2C_E006 (SKERR_I2C_E005+1) +#define SKERR_I2C_E006MSG "Unknown event" +#define SKERR_I2C_E007 (SKERR_I2C_E006+1) +#define SKERR_I2C_E007MSG "LM80 read out of state" +#define SKERR_I2C_E008 (SKERR_I2C_E007+1) +#define SKERR_I2C_E008MSG "unexpected sensor read completed" +#define SKERR_I2C_E009 (SKERR_I2C_E008+1) +#define SKERR_I2C_E009MSG "WARNING: temperature sensor out of range" +#define SKERR_I2C_E010 (SKERR_I2C_E009+1) +#define SKERR_I2C_E010MSG "WARNING: voltage sensor out of range" +#define SKERR_I2C_E011 (SKERR_I2C_E010+1) +#define SKERR_I2C_E011MSG "ERROR: temperature sensor out of range" +#define SKERR_I2C_E012 (SKERR_I2C_E011+1) +#define SKERR_I2C_E012MSG "ERROR: voltage sensor out of range" +#define SKERR_I2C_E013 (SKERR_I2C_E012+1) +#define SKERR_I2C_E013MSG "ERROR: couldn't init sensor" +#define SKERR_I2C_E014 (SKERR_I2C_E013+1) +#define SKERR_I2C_E014MSG "WARNING: fan sensor out of range" +#define SKERR_I2C_E015 (SKERR_I2C_E014+1) +#define SKERR_I2C_E015MSG "ERROR: fan sensor out of range" + +/* + * Define Timeout values + */ +#define SK_I2C_TIM_LONG 2000000L /* 2 second */ +#define SK_I2C_TIM_SHORT 100000L /* 100 milli second */ + +/* + * Define trap and error log hold times + */ +#ifndef SK_SEN_ERR_TR_HOLD +#define SK_SEN_ERR_TR_HOLD (4*SK_TICKS_PER_SEC) +#endif +#ifndef SK_SEN_ERR_LOG_HOLD +#define SK_SEN_ERR_LOG_HOLD (60*SK_TICKS_PER_SEC) +#endif +#ifndef SK_SEN_WARN_TR_HOLD +#define SK_SEN_WARN_TR_HOLD (15*SK_TICKS_PER_SEC) +#endif +#ifndef SK_SEN_WARN_LOG_HOLD +#define SK_SEN_WARN_LOG_HOLD (15*60*SK_TICKS_PER_SEC) +#endif + +/* + * Defines for SenType + */ +#define SK_SEN_TEMP 1 +#define SK_SEN_VOLT 2 +#define SK_SEN_FAN 3 + +/* + * Define for the ErrorFlag + */ +#define SK_SEN_ERR_OK 1 /* Error Flag: O.K. */ +#define SK_SEN_ERR_WARN 2 /* Error Flag: Warning */ +#define SK_SEN_ERR_ERR 3 /* Error Flag: Error */ + +/* + * Define the Sensor struct + */ +struct s_Sensor { + char *SenDesc; /* Description */ + int SenType; /* Voltage or Temperature */ + SK_I32 SenValue; /* Current value of the sensor */ + SK_I32 SenThreErrHigh; /* High error Threshhold of this sensor */ + SK_I32 SenThreWarnHigh;/* High warning Threshhold of this sensor */ + SK_I32 SenThreErrLow; /* Lower error Threshold of the sensor */ + SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */ + int SenErrFlag; /* Sensor indicated an error */ + SK_BOOL SenInit; /* Is sensor initialized? */ + SK_U64 SenErrCts; /* Error trap counter */ + SK_U64 SenWarnCts; /* Warning trap counter */ + SK_U64 SenBegErrTS; /* Begin error timestamp */ + SK_U64 SenBegWarnTS; /* Begin warning timestamp */ + SK_U64 SenLastErrTrapTS; /* Last error trap timestamp */ + SK_U64 SenLastErrLogTS; /* Last error log timestamp */ + SK_U64 SenLastWarnTrapTS; /* Last warning trap timestamp */ + SK_U64 SenLastWarnLogTS; /* Last warning log timestamp */ + int SenState; /* Sensor State (see HW specific include) */ + int (*SenRead)(SK_AC *pAC, SK_IOC IoC,struct s_Sensor *pSen) ; + /* Sensors read function */ + SK_U16 SenReg; /* Register Address for this sensor */ + SK_U8 SenDev; /* DeviceSelection for this sensor */ +} ; + + +typedef struct s_I2c { + SK_SENSOR SenTable[SK_MAX_SENSORS]; /* Sensor Table */ + int CurrSens; /* Which sensor is currently queried */ + int MaxSens; /* Max. number of sensors */ + int InitLevel; /* Initialized Level */ +#ifndef SK_DIAG + int DummyReads; /* Number of non-checked dummy reads */ + SK_TIMER SenTimer; /* Sensors timer */ +#endif /* !SK_DIAG */ +} SK_I2C; + +extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen); +#ifndef SK_DIAG +extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, + SK_EVPARA Para); +extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level); +extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC); + +#endif +#endif /* n_SKI2C_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skqueue.h linux/drivers/net/sk98lin/h/skqueue.h --- v2.3.28/linux/drivers/net/sk98lin/h/skqueue.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skqueue.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,136 @@ +/****************************************************************************** + * + * Name: skqueue.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.12 $ + * Date: $Date: 1998/09/08 08:48:01 $ + * Purpose: Defines for the Event queue + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skqueue.h,v $ + * Revision 1.12 1998/09/08 08:48:01 gklug + * add: init level handling + * + * Revision 1.11 1998/09/03 14:15:11 gklug + * add: CSUM and HWAC Eventclass and function. + * fix: pParaPtr according to CCC + * + * Revision 1.10 1998/08/20 12:43:03 gklug + * add: typedef SK_QUEUE + * + * Revision 1.9 1998/08/19 09:50:59 gklug + * fix: remove struct keyword from c-code (see CCC) add typedefs + * + * Revision 1.8 1998/08/18 07:00:01 gklug + * fix: SK_PTR not defined use void * instead. + * + * Revision 1.7 1998/08/17 13:43:19 gklug + * chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR + * + * Revision 1.6 1998/08/14 07:09:30 gklug + * fix: chg pAc -> pAC + * + * Revision 1.5 1998/08/11 14:26:44 gklug + * chg: Event Dispatcher returns now int. + * + * Revision 1.4 1998/08/11 12:15:21 gklug + * add: Error numbers of skqueue module + * + * Revision 1.3 1998/08/07 12:54:23 gklug + * fix: first compiled version + * + * Revision 1.2 1998/08/07 09:34:00 gklug + * adapt structure defs to CCC + * add: prototypes for functions + * + * Revision 1.1 1998/07/30 14:52:12 gklug + * Initial version. + * Defines Event Classes, Event structs and queue management variables. + * + * + * + ******************************************************************************/ + +/* + * SKQUEUE.H contains all defines and types for the event queue + */ + +#ifndef _SKQUEUE_H_ +#define _SKQUEUE_H_ + + +/* + * define the event classes to be served + */ +#define SKGE_DRV 1 /* Driver Event Class */ +#define SKGE_RLMT 2 /* RLMT Event Class */ +#define SKGE_I2C 3 /* i2C Event Class */ +#define SKGE_PNMI 4 /* PNMI Event Class */ +#define SKGE_CSUM 5 /* Checksum Event Class */ +#define SKGE_HWAC 6 /* Hardware Access Event Class */ + +/* + * define event queue as circular buffer + */ +#define SK_MAX_EVENT 64 + +/* + * Parameter union for the Para stuff + */ +typedef union u_EvPara { + void *pParaPtr; /* Parameter Pointer */ + SK_U64 Para64; /* Parameter 64bit version */ + SK_U32 Para32[2]; /* Parameter Array of 32bit parameters */ +} SK_EVPARA; + +/* + * Event Queue + * skqueue.c + * events are class/value pairs + * class is addressee, e.g. RMT, PCM etc. + * value is command, e.g. line state change, ring op change etc. + */ +typedef struct s_EventElem { + SK_U32 Class ; /* Event class */ + SK_U32 Event ; /* Event value */ + SK_EVPARA Para ; /* Event parameter */ +} SK_EVENTELEM; + +typedef struct s_Queue { + SK_EVENTELEM EvQueue[SK_MAX_EVENT]; + SK_EVENTELEM *EvPut ; + SK_EVENTELEM *EvGet ; +} SK_QUEUE; + +extern void SkEventInit(SK_AC *pAC, SK_IOC Ioc, int Level); +extern void SkEventQueue(SK_AC *pAC, SK_U32 Class, SK_U32 Event, + SK_EVPARA Para); +extern int SkEventDispatcher(SK_AC *pAC,SK_IOC Ioc); + + +/* Define Error Numbers and messages */ +#define SKERR_Q_E001 (SK_ERRBASE_QUEUE+0) +#define SKERR_Q_E001MSG "Event queue overflow" +#define SKERR_Q_E002 (SKERR_Q_E001+1) +#define SKERR_Q_E002MSG "Undefined event class" +#endif /* _SKQUEUE_H_ */ + diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skrlmt.h linux/drivers/net/sk98lin/h/skrlmt.h --- v2.3.28/linux/drivers/net/sk98lin/h/skrlmt.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skrlmt.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,494 @@ +/****************************************************************************** + * + * Name: skrlmt.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.26 $ + * Date: $Date: 1999/10/04 14:01:19 $ + * Purpose: Header file for Redundant Link ManagemenT. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skrlmt.h,v $ + * Revision 1.26 1999/10/04 14:01:19 rassmann + * Corrected reaction to reception of BPDU frames. + * Added parameter descriptions to "For Readme" section skrlmt.txt. + * Clarified usage of lookahead result *pForRlmt. + * Requested driver to present RLMT packets as soon as poosible. + * + * Revision 1.25 1999/07/20 12:53:39 rassmann + * Fixed documentation errors for lookahead macros. + * + * Revision 1.24 1999/05/28 11:15:56 rassmann + * Changed behaviour to reflect Design Spec v1.2. + * Controlling Link LED(s). + * Introduced RLMT Packet Version field in RLMT Packet. + * Newstyle lookahead macros (checking meta-information before looking at + * the packet). + * + * Revision 1.23 1999/01/28 12:50:42 rassmann + * Not using broadcast time stamps in CheckLinkState mode. + * + * Revision 1.22 1999/01/27 14:13:04 rassmann + * Monitoring broadcast traffic. + * Switching more reliably and not too early if switch is + * configured for spanning tree. + * + * Revision 1.21 1998/12/08 13:11:25 rassmann + * Stopping SegTimer at RlmtStop. + * + * Revision 1.20 1998/11/24 12:37:33 rassmann + * Implemented segmentation check. + * + * Revision 1.19 1998/11/17 13:43:06 rassmann + * Handling (logical) tx failure. + * Sending packet on logical address after PORT_SWITCH. + * + * Revision 1.18 1998/11/13 16:56:56 rassmann + * Added macro version of SkRlmtLookaheadPacket. + * + * Revision 1.17 1998/11/06 18:06:05 rassmann + * Corrected timing when RLMT checks fail. + * Clearing tx counter earlier in periodical checks. + * + * Revision 1.16 1998/11/03 13:53:50 rassmann + * RLMT should switch now (at least in mode 3). + * + * Revision 1.15 1998/10/22 11:39:52 rassmann + * Corrected signed/unsigned mismatches. + * Corrected receive list handling and address recognition. + * + * Revision 1.14 1998/10/15 15:16:36 rassmann + * Finished Spanning Tree checking. + * Checked with lint. + * + * Revision 1.13 1998/09/24 19:16:08 rassmann + * Code cleanup. + * Introduced Timer for PORT_DOWN due to no RX. + * + * Revision 1.12 1998/09/16 11:09:52 rassmann + * Syntax corrections. + * + * Revision 1.11 1998/09/15 11:28:50 rassmann + * Syntax corrections. + * + * Revision 1.10 1998/09/14 17:07:38 rassmann + * Added code for port checking via LAN. + * Changed Mbuf definition. + * + * Revision 1.9 1998/09/07 11:14:15 rassmann + * Syntax corrections. + * + * Revision 1.8 1998/09/07 09:06:08 rassmann + * Syntax corrections. + * + * Revision 1.7 1998/09/04 19:41:34 rassmann + * Syntax corrections. + * Started entering code for checking local links. + * + * Revision 1.6 1998/09/04 12:14:28 rassmann + * Interface cleanup. + * + * Revision 1.5 1998/09/02 16:55:29 rassmann + * Updated to reflect new DRV/HWAC/RLMT interface. + * + * Revision 1.4 1998/09/02 07:26:02 afischer + * typedef for SK_RLMT_PORT + * + * Revision 1.3 1998/08/27 14:29:03 rassmann + * Code cleanup. + * + * Revision 1.2 1998/08/27 14:26:25 rassmann + * Updated interface. + * + * Revision 1.1 1998/08/21 08:29:10 rassmann + * First public version. + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This is the header file for Redundant Link ManagemenT. + * + * Include File Hierarchy: + * + * "skdrv1st.h" + * ... + * "sktypes.h" + * "skqueue.h" + * "skaddr.h" + * "skrlmt.h" + * ... + * "skdrv2nd.h" + * + ******************************************************************************/ + +#ifndef __INC_SKRLMT_H +#define __INC_SKRLMT_H + +#ifdef __cplusplus +xxxx /* not supported yet - force error */ +extern "C" { +#endif /* cplusplus */ + +/* defines ********************************************************************/ + +#define SK_RLMT_NET_DOWN_TEMP 1 /* NET_DOWN due to last port down. */ +#define SK_RLMT_NET_DOWN_FINAL 2 /* NET_DOWN due to RLMT_STOP. */ + +/* ----- Default queue sizes - must be multiples of 8 KB ----- */ + +/* Less than 8 KB free in RX queue => pause frames. */ +#define SK_RLMT_STANDBY_QRXSIZE 128 /* Size of rx standby queue in KB. */ +#define SK_RLMT_STANDBY_QXASIZE 32 /* Size of async standby queue in KB. */ +#define SK_RLMT_STANDBY_QXSSIZE 0 /* Size of sync standby queue in KB. */ + +#define SK_RLMT_MAX_TX_BUF_SIZE 60 /* Maximum RLMT transmit size. */ + +/* ----- PORT states ----- */ + +#define SK_RLMT_PS_INIT 0 /* Port state: Init. */ +#define SK_RLMT_PS_LINK_DOWN 1 /* Port state: Link down. */ +#define SK_RLMT_PS_DOWN 2 /* Port state: Port down. */ +#define SK_RLMT_PS_GOING_UP 3 /* Port state: Going up. */ +#define SK_RLMT_PS_UP 4 /* Port state: Up. */ + +/* ----- RLMT states ----- */ + +#define SK_RLMT_RS_INIT 0 /* RLMT state: Init. */ +#define SK_RLMT_RS_NET_DOWN 1 /* RLMT state: Net down. */ +#define SK_RLMT_RS_NET_UP 2 /* RLMT state: Net up. */ + +/* ----- PORT events ----- */ + +#define SK_RLMT_LINK_UP 1001 /* Link came up. */ +#define SK_RLMT_LINK_DOWN 1002 /* Link went down. */ +#define SK_RLMT_PORT_ADDR 1003 /* Port address changed. */ + +/* ----- RLMT events ----- */ + +#define SK_RLMT_START 2001 /* Start RLMT. */ +#define SK_RLMT_STOP 2002 /* Stop RLMT. */ +#define SK_RLMT_PACKET_RECEIVED 2003 /* Packet was received for RLMT. */ +#define SK_RLMT_STATS_CLEAR 2004 /* Clear statistics. */ +#define SK_RLMT_STATS_UPDATE 2005 /* Update statistics. */ +#define SK_RLMT_PREFPORT_CHANGE 2006 /* Change preferred port. */ +#define SK_RLMT_MODE_CHANGE 2007 /* New RlmtMode. */ + +/* ----- RLMT mode bits ----- */ + +#define SK_RLMT_CHECK_LINK 1 /* Check Link. */ +#define SK_RLMT_CHECK_LOC_LINK 2 /* Check other link on same adapter. */ +#define SK_RLMT_CHECK_SEG 4 /* Check segmentation. */ + +#ifndef RLMT_CHECK_REMOTE +#define SK_RLMT_CHECK_OTHERS SK_RLMT_CHECK_LOC_LINK +#else /* RLMT_CHECK_REMOTE */ +#define SK_RLMT_CHECK_REM_LINK 8 /* Check link(s) on other adapter(s). */ +#define SK_RLMT_MAX_REMOTE_PORTS_CHECKED 3 +#define SK_RLMT_CHECK_OTHERS (SK_RLMT_CHECK_LOC_LINK | \ + SK_RLMT_CHECK_REM_LINK) +#endif /* RLMT_CHECK_REMOTE */ + +/* ----- RLMT modes ----- */ + +/* Check Link State. */ +#define SK_RLMT_MODE_CLS (SK_RLMT_CHECK_LINK) + +/* Check Local Ports: check other links on the same adapter. */ +#define SK_RLMT_MODE_CLP (SK_RLMT_CHECK_LINK | \ + SK_RLMT_CHECK_LOC_LINK) + +/* Check Local Ports and Segmentation Status. */ +#define SK_RLMT_MODE_CLPSS (SK_RLMT_CHECK_LINK | \ + SK_RLMT_CHECK_LOC_LINK | \ + SK_RLMT_CHECK_SEG) + +#ifdef RLMT_CHECK_REMOTE +/* Check Local and Remote Ports: check links (local or remote). */ + Name of define TBD! +#define SK_RLMT_MODE_CRP (SK_RLMT_CHECK_LINK | \ + SK_RLMT_CHECK_LOC_LINK | \ + SK_RLMT_CHECK_REM_LINK) + +/* Check Local and Remote Ports and Segmentation Status. */ + Name of define TBD! +#define SK_RLMT_MODE_CRPSS (SK_RLMT_CHECK_LINK | \ + SK_RLMT_CHECK_LOC_LINK | \ + SK_RLMT_CHECK_REM_LINK | \ + SK_RLMT_CHECK_SEG) +#endif /* RLMT_CHECK_REMOTE */ + +/* ----- RLMT lookahead result bits ----- */ + +#define SK_RLMT_RX_RLMT 1 /* Give packet to RLMT. */ +#define SK_RLMT_RX_PROTOCOL 2 /* Give packet to protocol. */ + +/* Macros */ + +#if 0 +SK_AC *pAC /* adapter context */ +SK_U32 PortIdx /* receiving port */ +unsigned PacketLength /* received packet's length */ +SK_BOOL IsBc /* Flag: broadcast received */ +unsigned *pOffset /* Result: offset of bytes to present + to SK_RLMT_LOOKAHEAD */ +unsigned *pNumBytes /* Result: #Bytes to present + to SK_RLMT_LOOKAHEAD */ +#endif /* 0 */ + + +#define SK_RLMT_PRE_LOOKAHEAD(pAC,PortIdx,PacketLength,IsBc,pOffset,pNumBytes) { \ + SK_AC *_pAC; \ + SK_U32 _PortIdx; \ + _pAC = (pAC); \ + _PortIdx = (SK_U32)(PortIdx); \ + _pAC->Rlmt.Port[_PortIdx].PacketsRx++; \ + _pAC->Rlmt.Port[_PortIdx].PacketsPerTimeSlot++; \ + if ((IsBc) && _pAC->Rlmt.RlmtMode != SK_RLMT_MODE_CLS) { \ + *(pOffset) = 6; \ + *(pNumBytes) = 6; \ + } \ + else { \ + *(pOffset) = 0; \ + if ((PacketLength) > SK_RLMT_MAX_TX_BUF_SIZE) { \ + _pAC->Rlmt.Port[_PortIdx].DataPacketsPerTimeSlot++; \ + *(pNumBytes) = 0; \ + } \ + else { \ + *(pNumBytes) = 6; \ + } \ + } \ +} + +#if 0 +SK_AC *pAC /* adapter context */ +SK_U32 PortIdx /* receiving port */ +SK_U8 *pLaPacket, /* received packet's data (points to pOffset) */ +SK_BOOL IsBc /* Flag: broadcast received */ +SK_BOOL IsMc /* Flag: multicast received */ +unsigned *pForRlmt /* Result: bits SK_RLMT_RX_RLMT, + SK_RLMT_RX_PROTOCOL */ +SK_RLMT_LOOKAHEAD() expects *pNumBytes from +packet offset *pOffset (s.a.) at *pLaPacket. + +If you use SK_RLMT_LOOKAHEAD in a path where you already know if the packet is +BC, MC, or UC, you should use constants for IsBc and IsMc, so that your compiler +can trash unneeded parts of the if construction. +#endif /* 0 */ +#define SK_RLMT_LOOKAHEAD(pAC,PortIdx,pLaPacket,IsBc,IsMc,pForRlmt) { \ + SK_AC *_pAC; \ + SK_U32 _PortIdx; \ + SK_U8 *_pLaPacket; \ + _pAC = (pAC); \ + _PortIdx = (SK_U32)(PortIdx); \ + _pLaPacket = (SK_U8 *)(pLaPacket); \ + if (IsBc) {\ + if (!SK_ADDR_EQUAL( \ + _pLaPacket, \ + _pAC->Addr.CurrentMacAddress.a)) { \ + _pAC->Rlmt.Port[_PortIdx].BcTimeStamp = \ + SkOsGetTime(_pAC); \ + } \ + _pAC->Rlmt.Port[_PortIdx].DataPacketsPerTimeSlot++; \ + *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ + } \ + else if (IsMc) { \ + if (SK_ADDR_EQUAL(_pLaPacket, BridgeMcAddr.a)) { \ + _pAC->Rlmt.Port[_PortIdx].BpduPacketsPerTimeSlot++; \ + if (_pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) { \ + *(pForRlmt) = SK_RLMT_RX_RLMT | \ + SK_RLMT_RX_PROTOCOL; \ + } \ + else { \ + *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ + } \ + } \ + else if (SK_ADDR_EQUAL(_pLaPacket, SkRlmtMcAddr.a)) { \ + *(pForRlmt) = SK_RLMT_RX_RLMT; \ + } \ + else { \ + _pAC->Rlmt.Port[_PortIdx].DataPacketsPerTimeSlot++; \ + *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ + } \ + } \ + else { \ + if (SK_ADDR_EQUAL( \ + _pLaPacket, \ + _pAC->Addr.Port[_PortIdx].CurrentMacAddress.a)) { \ + *(pForRlmt) = SK_RLMT_RX_RLMT; \ + } \ + else { \ + _pAC->Rlmt.Port[_PortIdx].DataPacketsPerTimeSlot++; \ + *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ + } \ + } \ +} + +#ifdef SK_RLMT_FAST_LOOKAHEAD +Error: SK_RLMT_FAST_LOOKAHEAD no longer used. Use new macros for lookahead. +#endif /* SK_RLMT_FAST_LOOKAHEAD */ + +/* typedefs *******************************************************************/ + +typedef struct s_RootId { + SK_U8 Id[8]; /* Root Bridge Id. */ +} SK_RLMT_ROOT_ID; + +typedef struct s_port { + SK_MAC_ADDR CheckAddr; + SK_BOOL SuspectTx; +} SK_PORT_CHECK; + +typedef struct s_RlmtPort { + +/* ----- Public part (read-only) ----- */ + + SK_U8 PortState; /* Current state of this port. */ + + /* For PNMI */ + + SK_BOOL LinkDown; + SK_BOOL PortDown; + + SK_U64 TxHelloCts; + SK_U64 RxHelloCts; + SK_U64 TxSpHelloReqCts; + SK_U64 RxSpHelloCts; + +/* ----- Private part ----- */ + + SK_BOOL PortStarted; /* Port is started. */ + SK_BOOL PortNoRx; /* NoRx for >= 1 time slot. */ + SK_U32 CheckingState; /* Checking State. */ + + SK_U64 PacketsRx; /* Total packets received. */ + SK_U32 PacketsPerTimeSlot; /* Packets rxed between TOs. */ + SK_U32 DataPacketsPerTimeSlot; /* Data packets ... */ +#if 0 + SK_U32 RlmtAcksPerTimeSlot; /* RLMT Acks rxed in TS. */ + SK_U32 RlmtChksPerTimeSlot; /* RLMT Chks rxed in TS. */ +#endif /* 0 */ + SK_U32 BpduPacketsPerTimeSlot; /* BPDU packets rxed in TS. */ + SK_U64 BcTimeStamp; /* Time of last BC receive. */ + SK_U64 GuTimeStamp; /* Time of entering GOING_UP. */ + + SK_TIMER UpTimer; /* Timer struct Link/Port up. */ + SK_TIMER DownRxTimer; /* Timer struct down rx. */ + SK_TIMER DownTxTimer; /* Timer struct down tx. */ + + SK_U8 Random[4]; /* Random value. */ + unsigned PortsChecked; /* #ports checked. */ + unsigned PortsSuspect; /* #ports checked that are s. */ + SK_PORT_CHECK PortCheck[1]; +/* SK_PORT_CHECK PortCheck[SK_MAX_MACS - 1]; */ + + SK_BOOL RootIdSet; + SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */ +} SK_RLMT_PORT; + +#ifdef SK_RLMT_MBUF_PRIVATE +typedef struct s_RlmtMbuf { + some content +} SK_RLMT_MBUF; +#endif /* SK_RLMT_MBUF_PRIVATE */ + +#ifdef SK_LA_INFO +typedef struct s_Rlmt_PacketInfo { + unsigned PacketLength; /* Length of packet. */ + unsigned PacketType; /* Directed/Multicast/Broadcast. */ +} SK_RLMT_PINFO; +#endif /* SK_LA_INFO */ + +typedef struct s_Rlmt { + +/* ----- Public part (read-only) ----- */ + + SK_U8 RlmtState; /* Current RLMT state. */ + SK_RLMT_PORT Port[SK_MAX_MACS]; /* Array of available ports. */ + SK_U32 PrefPort; /* Preferred port. */ + + /* For PNMI */ + + SK_U32 RlmtMode; /* Check ... */ + SK_U32 MacActive; /* Active port. */ + SK_U32 MacPreferred; /* 0xFFFFFFFF: Automatic. */ + +/* ----- Private part ----- */ + + int LinksUp; /* #Links up. */ + int PortsUp; /* #Ports up. */ + SK_U32 TimeoutValue; /* RLMT timeout value. */ + SK_TIMER LocTimer; /* Timer struct. */ + + SK_U32 CheckingState; /* Checking State. */ + SK_BOOL RootIdSet; + SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */ + SK_TIMER SegTimer; /* Timer struct. */ +} SK_RLMT; + +extern SK_MAC_ADDR BridgeMcAddr; +extern SK_MAC_ADDR SkRlmtMcAddr; + +/* function prototypes ********************************************************/ + + +#ifndef SK_KR_PROTO + +/* Functions provided by SkRlmt */ + +/* ANSI/C++ compliant function prototypes */ + +extern void SkRlmtInit( + SK_AC *pAC, + SK_IOC IoC, + int Level); + +#ifdef SK_RLMT_SLOW_LOOKAHEAD +extern SK_BOOL SkRlmtLookaheadPacket( + SK_AC *pAC, + SK_U32 PortIdx, + SK_U8 *pLaPacket, + unsigned PacketLength, + unsigned LaLength); +#endif /* SK_RLMT_SLOW_LOOKAHEAD */ + +extern int SkRlmtEvent( + SK_AC *pAC, + SK_IOC IoC, + SK_U32 Event, + SK_EVPARA Para); + +#else /* defined(SK_KR_PROTO)) */ + +/* Non-ANSI/C++ compliant function prototypes */ + +xxxx /* not supported yet - force error */ + +#endif /* defined(SK_KR_PROTO)) */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INC_SKRLMT_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/sktimer.h linux/drivers/net/sk98lin/h/sktimer.h --- v2.3.28/linux/drivers/net/sk98lin/h/sktimer.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/sktimer.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,96 @@ +/****************************************************************************** + * + * Name: sktimer.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.8 $ + * Date: $Date: 1998/09/08 08:48:02 $ + * Purpose: Defines for the timer functions + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: sktimer.h,v $ + * Revision 1.8 1998/09/08 08:48:02 gklug + * add: init level handling + * + * Revision 1.7 1998/08/20 12:31:29 gklug + * fix: SK_TIMCTRL needs to be defined + * + * Revision 1.6 1998/08/19 09:51:00 gklug + * fix: remove struct keyword from c-code (see CCC) add typedefs + * + * Revision 1.5 1998/08/17 13:43:21 gklug + * chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR + * + * Revision 1.4 1998/08/14 07:09:31 gklug + * fix: chg pAc -> pAC + * + * Revision 1.3 1998/08/07 12:54:24 gklug + * fix: first compiled version + * + * Revision 1.2 1998/08/07 09:35:29 gklug + * add: Timer control struct for Adapters context + * add: function prototypes + * + * Revision 1.1 1998/08/05 11:27:01 gklug + * First version: adapted from SMT + * + * + ******************************************************************************/ + +/* + * SKTIMER.H contains all defines and types for the timer functions + */ + +#ifndef _SKTIMER_H_ +#define _SKTIMER_H_ + +#include "h/skqueue.h" + +/* + * SK timer + * - needed wherever a timer is used. Put this in your data structure + * wherever you want. + */ +typedef struct s_Timer SK_TIMER; + +struct s_Timer { + SK_TIMER *TmNext ; /* linked list */ + SK_U32 TmClass ; /* Timer Event class */ + SK_U32 TmEvent ; /* Timer Event value */ + SK_EVPARA TmPara ; /* Timer Event parameter */ + SK_U32 TmDelta ; /* delta time */ + int TmActive ; /* flag : active/inactive */ +} ; + +/* + * Timer control struct. + * - use in Adapters context name pAC->Tim + */ +typedef struct s_TimCtrl { + SK_TIMER *StQueue ; /* Head of Timer queue */ +} SK_TIMCTRL ; + +extern void SkTimerInit(SK_AC *pAC,SK_IOC Ioc, int Level); +extern void SkTimerStop(SK_AC *pAC,SK_IOC Ioc,SK_TIMER *pTimer); +extern void SkTimerStart(SK_AC *pAC,SK_IOC Ioc,SK_TIMER *pTimer, + SK_U32 Time,SK_U32 Class,SK_U32 Event,SK_EVPARA Para); +extern void SkTimerDone(SK_AC *pAC,SK_IOC Ioc); +#endif /* _SKTIMER_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/sktypes.h linux/drivers/net/sk98lin/h/sktypes.h --- v2.3.28/linux/drivers/net/sk98lin/h/sktypes.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/sktypes.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,81 @@ +/****************************************************************************** + * + * Name: sktypes.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.1 $ + * Date: $Date: 1999/02/16 07:41:40 $ + * Purpose: Define data types for Linux + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + + /***************************************************************************** + * + * History: + * + * $Log: sktypes.h,v $ + * Revision 1.1 1999/02/16 07:41:40 cgoos + * First version. + * + * + * + *****************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * In this file, all data types that are needed by the common modules + * are mapped to Linux data types. + * + * + * Include File Hierarchy: + * + * + ******************************************************************************/ + +#ifndef __INC_SKTYPES_H +#define __INC_SKTYPES_H + + +/* defines *******************************************************************/ + +/* + * Data types with a specific size. 'I' = signed, 'U' = unsigned. + */ +#define SK_I8 s8 +#define SK_U8 u8 +#define SK_I16 s16 +#define SK_U16 u16 +#define SK_I32 s32 +#define SK_U32 u32 +#define SK_I64 s64 +#define SK_U64 u64 + +#define SK_UPTR ulong /* casting pointer <-> integral */ + +/* +* Boolean type. +*/ +#define SK_BOOL SK_U8 +#define SK_FALSE 0 +#define SK_TRUE (!SK_FALSE) + +/* typedefs *******************************************************************/ + +/* function prototypes ********************************************************/ + +#endif /* __INC_SKTYPES_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/skvpd.h linux/drivers/net/sk98lin/h/skvpd.h --- v2.3.28/linux/drivers/net/sk98lin/h/skvpd.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/skvpd.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,295 @@ +/****************************************************************************** + * + * Name: skvpd.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.8 $ + * Date: $Date: 1999/03/11 14:26:40 $ + * Purpose: Defines and Macros for VPD handling + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skvpd.h,v $ + * Revision 1.8 1999/03/11 14:26:40 malthoff + * Replace __STDC__ with SK_KR_PROTO. + * + * Revision 1.7 1998/10/28 07:27:17 gklug + * rmv: SWAP macros + * add: VPD_IN/OUT8 macros + * chg: interface definition + * + * Revision 1.6 1998/10/22 10:03:44 gklug + * fix: use SK_OUT16 instead of SK_OUTW + * + * Revision 1.5 1998/10/14 07:05:31 cgoos + * Changed constants in SK_SWAP_32 to UL. + * + * Revision 1.4 1998/08/19 08:14:09 gklug + * fix: remove struct keyword as much as possible from the c-code (see CCC) + * + * Revision 1.3 1998/08/18 08:18:56 malthoff + * Modify VPD in and out macros for SK_DIAG + * + * Revision 1.2 1998/07/03 14:49:08 malthoff + * Add VPD_INxx() and VPD_OUTxx() macros for the Diagnostics tool. + * + * Revision 1.1 1998/06/19 14:08:03 malthoff + * Created. + * + * + ******************************************************************************/ + +/* + * skvpd.h contains Diagnostic specific defines for VPD handling + */ + +#ifndef __INC_SKVPD_H_ +#define __INC_SKVPD_H_ + +/* + * Define Resource Type Identifiers and VPD keywords + */ +#define RES_ID 0x82 /* Resource Type ID String (Product Name) */ +#define RES_VPD_R 0x90 /* start of VPD read only area */ +#define RES_VPD_W 0x91 /* start of VPD read/write area */ +#define RES_END 0x78 /* Resource Type End Tag */ + +#ifndef VPD_NAME +#define VPD_NAME "Name" /* Product Name, VPD name of RES_ID */ +#endif /* VPD_NAME */ +#define VPD_PN "PN" /* Adapter Part Number */ +#define VPD_EC "EC" /* Adapter Engineering Level */ +#define VPD_MN "MN" /* Manufacture ID */ +#define VPD_SN "SN" /* Serial Number */ +#define VPD_CP "CP" /* Extended Capability */ +#define VPD_RV "RV" /* Checksum and Reserved */ +#define VPD_YA "YA" /* Asset Tag Identifier */ +#define VPD_VL "VL" /* First Error Log Message (SK specific) */ +#define VPD_VF "VF" /* Second Error Log Message (SK specific) */ +#define VPD_RW "RW" /* Remaining Read / Write Area */ + +/* 'type' values for vpd_setup_para() */ +#define VPD_RO_KEY 1 /* RO keys are "PN", "EC", "MN", "SN", "RV" */ +#define VPD_RW_KEY 2 /* RW keys are "Yx", "Vx", and "RW" */ + +/* 'op' values for vpd_setup_para() */ +#define ADD_KEY 1 /* add the key at the pos "RV" or "RW" */ +#define OWR_KEY 2 /* overwrite key if already exists */ + +/* + * Define READ and WRITE Constants. + */ +#define VPD_SIZE 512 +#define VPD_READ 0x0000 +#define VPD_WRITE 0x8000 + +#define VPD_STOP(pAC,IoC) VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG,VPD_WRITE) + +#define VPD_GET_RES_LEN(p) ((unsigned int) \ + (* (SK_U8 *)&(p)[1]) |\ + ((* (SK_U8 *)&(p)[2]) << 8)) +#define VPD_GET_VPD_LEN(p) ((unsigned int)(* (SK_U8 *)&(p)[2])) +#define VPD_GET_VAL(p) ((char *)&(p)[3]) + +#define VPD_MAX_LEN 50 + +/* VPD status */ + /* bit 7..1 reserved */ +#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */ + /* and vpd_free_rw valid */ + +/* + * VPD structs + */ +typedef struct s_vpd_status { + unsigned short vpd_status ; /* VPD status, description see above */ + int vpd_free_ro ; /* unused bytes in read only area */ + int vpd_free_rw ; /* bytes available in read/write area */ +} SK_VPD_STATUS; + +typedef struct s_vpd { + SK_VPD_STATUS v ; /* VPD status structure */ + char vpd_buf[VPD_SIZE] ; /* VPD buffer */ +} SK_VPD; + +typedef struct s_vpd_para { + unsigned int p_len ; /* parameter length */ + char *p_val ; /* points to the value */ +} SK_VPD_PARA; + +/* + * structure of Large Resource Type Identifiers + */ +/* was removed, because of alignment problems */ + +/* + * sturcture of VPD keywords + */ +typedef struct s_vpd_key { + char p_key[2] ; /* 2 bytes ID string */ + unsigned char p_len ; /* 1 byte length */ + char p_val ; /* start of the value string */ +} SK_VPD_KEY; + + +/* + * System specific VPD macros + */ +#ifndef SKDIAG +#ifndef VPD_DO_IO +#define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val) +#define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val) +#define VPD_OUT32(pAC,IoC,Addr,Val) (void)SkPciWriteCfgDWord(pAC,Addr,Val) +#define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal) +#define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal) +#define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal) +#else /* VPD_DO_IO */ +#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val) +#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val) +#define VPD_OUT32(pAC,IoC,Addr,Val) SK_OUT32(IoC,PCI_C(Addr),Val) +#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal) +#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal) +#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal) +#endif /* VPD_DO_IO */ +#else /* SKDIAG */ +#define VPD_OUT8(pAC,Ioc,Addr,Val) { \ + if ((pAC)->DgT.DgUseCfgCycle) \ + SkPciWriteCfgByte(pAC,Addr,Val) ; \ + else \ + SK_OUT8(pAC,PCI_C(Addr),Val); \ + } +#define VPD_OUT16(pAC,Ioc,Addr,Val) { \ + if ((pAC)->DgT.DgUseCfgCycle) \ + SkPciWriteCfgWord(pAC,Addr,Val) ; \ + else \ + SK_OUT16(pAC,PCI_C(Addr),Val); \ + } +#define VPD_OUT32(pAC,Ioc,Addr,Val) { \ + if ((pAC)->DgT.DgUseCfgCycle) \ + SkPciWriteCfgDWord(pAC,Addr,Val) ; \ + else \ + SK_OUT32(pAC,PCI_C(Addr),Val); \ + } +#define VPD_IN8(pAC,Ioc,Addr,pVal) { \ + if ((pAC)->DgT.DgUseCfgCycle) \ + SkPciReadCfgByte(pAC,Addr,pVal) ; \ + else \ + SK_IN8(pAC,PCI_C(Addr),pVal); \ + } +#define VPD_IN16(pAC,Ioc,Addr,pVal) { \ + if ((pAC)->DgT.DgUseCfgCycle) \ + SkPciReadCfgWord(pAC,Addr,pVal) ; \ + else \ + SK_IN16(pAC,PCI_C(Addr),pVal); \ + } +#define VPD_IN32(pAC,Ioc,Addr,pVal) { \ + if ((pAC)->DgT.DgUseCfgCycle) \ + SkPciReadCfgDWord(pAC,Addr,pVal) ; \ + else \ + SK_IN32(pAC,PCI_C(Addr),pVal); \ + } +#endif /* nSKDIAG */ + +/* function prototypes ********************************************************/ + +#ifndef SK_KR_PROTO +extern SK_U32 VpdReadDWord( + SK_AC *pAC, + SK_IOC IoC, + int addr) ; + +extern int VpdSetupPara( + SK_AC *pAC, + char *key, + char *buf, + int len, + int type, + int op) ; + +extern SK_VPD_STATUS *VpdStat( + SK_AC *pAC, + SK_IOC IoC) ; + +extern int VpdKeys( + SK_AC *pAC, + SK_IOC IoC, + char *buf, + int *len, + int *elements) ; + +extern int VpdRead( + SK_AC *pAC, + SK_IOC IoC, + char *key, + char *buf, + int *len) ; + +extern SK_BOOL VpdMayWrite( + char *key) ; + +extern int VpdWrite( + SK_AC *pAC, + SK_IOC IoC, + char *key, + char *buf) ; + +extern int VpdDelete( + SK_AC *pAC, + SK_IOC IoC, + char *key) ; + +extern int VpdUpdate( + SK_AC *pAC, + SK_IOC IoC); + +extern void VpdErrLog( + SK_AC *pAC, + SK_IOC IoC, + char *msg) ; + +#ifdef SKDIAG +extern int VpdReadBlock( + SK_AC *pAC, + SK_IOC IoC, + char *buf, + int addr, + int len) ; + +extern int VpdWriteBlock( + SK_AC *pAC, + SK_IOC IoC, + char *buf, + int addr, + int len) ; +#endif /* SKDIAG */ +#else /* SK_KR_PROTO */ +extern SK_U32 VpdReadDWord() ; +extern int VpdSetupPara() ; +extern SK_VPD_STATUS *VpdStat() ; +extern int VpdKeys() ; +extern int VpdRead() ; +extern SK_BOOL VpdMayWrite() ; +extern int VpdWrite() ; +extern int VpdDelete() ; +extern int VpdUpdate() ; +extern void VpdErrLog() ; +#endif /* SK_KR_PROTO */ + +#endif /* __INC_SKVPD_H_ */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/h/xmac_ii.h linux/drivers/net/sk98lin/h/xmac_ii.h --- v2.3.28/linux/drivers/net/sk98lin/h/xmac_ii.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/h/xmac_ii.h Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1155 @@ +/****************************************************************************** + * + * Name: xmac_ii.h + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.25 $ + * Date: $Date: 1999/08/12 19:19:38 $ + * Purpose: Defines and Macros for XaQti's Gigabit Ethernet Controller + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: xmac_ii.h,v $ + * Revision 1.25 1999/08/12 19:19:38 malthoff + * Add PHY_B_AC_TX_TST bit according to BCOM A1 errata sheet. + * + * Revision 1.24 1999/07/30 11:27:21 cgoos + * Fixed a missing end-of-comment. + * + * Revision 1.23 1999/07/30 07:03:31 malthoff + * Cut some long comments. + * Correct the XMAC PHY ID definitions. + * + * Revision 1.22 1999/05/19 07:33:18 cgoos + * Changes for 1000Base-T. + * + * Revision 1.21 1999/03/25 07:46:11 malthoff + * Add XM_HW_CFG, XM_TS_READ, and XM_TS_LOAD registers. + * + * Revision 1.20 1999/03/12 13:36:09 malthoff + * Remove __STDC__. + * + * Revision 1.19 1998/12/10 12:22:54 gklug + * fix: RX_PAGE must be in interrupt mask + * + * Revision 1.18 1998/12/10 10:36:36 gklug + * fix: swap of pause bits + * + * Revision 1.17 1998/11/18 13:21:45 gklug + * fix: Default interrupt mask + * + * Revision 1.16 1998/10/29 15:53:21 gklug + * fix: Default mask uses ASS (GP0) signal + * + * Revision 1.15 1998/10/28 13:52:52 malthoff + * Add new bits in RX_CMD register. + * + * Revision 1.14 1998/10/19 15:34:53 gklug + * fix: typos + * + * Revision 1.13 1998/10/14 07:19:03 malthoff + * bug fix: Every define which describes bit 31 + * must be declared as unsigned long 'UL'. + * fix bit definitions of PHY_AN_RFB and PHY_AN_PAUSE. + * Remove ANP defines. Rework the RFB defines. + * + * Revision 1.12 1998/10/14 06:22:44 cgoos + * Changed shifted constant to ULONG. + * + * Revision 1.11 1998/10/14 05:43:26 gklug + * add: shift pause codeing + * fix: PAUSE bits definition + * + * Revision 1.10 1998/10/13 09:19:21 malthoff + * Again change XMR_FS_ANY_ERR because of new info from XaQti. + * + * Revision 1.9 1998/10/09 07:58:30 malthoff + * Add XMR_FS_FCS_ERR to XMR_FS_ANY_ERR. + * + * Revision 1.8 1998/10/09 07:18:17 malthoff + * bug fix of a bug fix: XM_PAUSE_MODE and XM_DEF_MODE + * are not inverted! Bug XM_DEF_MSK is inverted. + * + * Revision 1.7 1998/10/05 08:04:32 malthoff + * bug fix: XM_PAUSE_MODE and XM_DEF_MODE + * must be inverted declarations. + * + * Revision 1.6 1998/09/28 13:38:18 malthoff + * Add default modes and masks XM_DEF_MSK, + * XM_PAUSE_MODE and XM_DEF_MODE + * + * Revision 1.5 1998/09/16 14:42:04 malthoff + * Bug Fix: XM_GP_PORT is a 32 bit (not a 16 bit) register. + * + * Revision 1.4 1998/08/20 14:59:47 malthoff + * Rework this file after reading the XaQti data sheet + * "Differences between Rev. B2 & Rev. C XMAC II". + * This file is now 100% XMAC II Rev. C complained. + * + * Revision 1.3 1998/06/29 12:18:23 malthoff + * Correct XMR_FS_ANY_ERR definition. + * + * Revision 1.2 1998/06/29 12:10:56 malthoff + * Add define XMR_FS_ANY_ERR. + * + * Revision 1.1 1998/06/19 13:37:17 malthoff + * created. + * + * + ******************************************************************************/ + +#ifndef __INC_XMAC_H +#define __INC_XMAC_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines ********************************************************************/ + +/* + * XMAC II registers + * + * The XMAC registers are 16 or 32 bits wide. The XMACs host processor + * interface is set to 16 bit mode, therefore ALL registers will be + * addressed with 16 bit accesses. + * + * The following macros are provided to access the XMAC registers + * XM_IN16(), XM_OUT16, XM_IN32(), MX_OUT32(), XM_INADR(), XM_OUTADR(), + * XM_INHASH(), and XM_OUTHASH(). + * The macros are defined in SkGeHw.h. + * + * Note: NA reg = Network Address e.g DA, SA etc. + * + */ +#define XM_MMU_CMD 0x0000 /* 16 bit r/w MMU Command Register */ + /* 0x0004: reserved */ +#define XM_POFF 0x0008 /* 32 bit r/w Packet Offset Register */ +#define XM_BURST 0x000c /* 32 bit r/w Burst Register for half duplex*/ +#define XM_1L_VLAN_TAG 0x0010 /* 16 bit r/w One Level VLAN Tag ID */ +#define XM_2L_VLAN_TAG 0x0014 /* 16 bit r/w Two Level VLAN Tag ID */ + /* 0x0018 - 0x001e: reserved */ +#define XM_TX_CMD 0x0020 /* 16 bit r/w Transmit Command Register */ +#define XM_TX_RT_LIM 0x0024 /* 16 bit r/w Transmit Retry Limit Register */ +#define XM_TX_STIME 0x0028 /* 16 bit r/w Transmit Slottime Register */ +#define XM_TX_IPG 0x002c /* 16 bit r/w Transmit Inter Packet Gap */ +#define XM_RX_CMD 0x0030 /* 16 bit r/w Receive Command Register */ +#define XM_PHY_ADDR 0x0034 /* 16 bit r/w PHY Address Register */ +#define XM_PHY_DATA 0x0038 /* 16 bit r/w PHY Data Register */ + /* 0x003c: reserved */ +#define XM_GP_PORT 0x0040 /* 32 bit r/w General Purpose Port Register */ +#define XM_IMSK 0x0044 /* 16 bit r/w Interrupt Mask Register */ +#define XM_ISRC 0x0048 /* 16 bit ro Interrupt Status Register */ +#define XM_HW_CFG 0x004c /* 16 bit r/w Hardware Config Register */ + /* 0x0050 - 0x005e: reserved */ +#define XM_TX_LO_WM 0x0060 /* 16 bit r/w Tx FIFO Low Water Mark */ +#define XM_TX_HI_WM 0x0062 /* 16 bit r/w Tx FIFO High Water Mark */ +#define XM_TX_THR 0x0064 /* 16 bit r/w Tx Request Threshold */ +#define XM_HT_THR 0x0066 /* 16 bit r/w Host Request Threshold */ +#define XM_PAUSE_DA 0x0068 /* NA reg r/w Pause Destination Address */ + /* 0x006e: reserved */ +#define XM_CTL_PARA 0x0070 /* 32 bit r/w Control Parameter Register */ +#define XM_MAC_OPCODE 0x0074 /* 16 bit r/w Opcode for MAC control frames */ +#define XM_MAC_PTIME 0x0076 /* 16 bit r/w Pause time for MAC ctrl frames*/ +#define XM_TX_STAT 0x0078 /* 32 bit ro Tx Status LIFO Register */ + + /* 0x0080 - 0x00fc: 16 NA reg r/w Exakt Match Address Registers */ + /* use the XM_EMX() macro to address */ +#define XM_EXM_START 0x0080 /* r/w Start Address of the EXM Regs */ + + /* + * XM_EXM(Reg) + * + * returns the XMAC address offset off specified Exakt Match Addr Reg + * + * para: Reg EXM register to addr (0 .. 15) + * + * usage: XM_INADDR(XMAC_1,pAC,XM_EXM(i),&val[i]) ; + */ +#define XM_EXM(Reg) (XM_EXM_START + ((Reg) << 3)) + +#define XM_SRC_CHK 0x0100 /* NA reg r/w Source Check Address Register */ +#define XM_SA 0x0108 /* NA reg r/w Station Address Register */ +#define XM_HSM 0x0110 /* 64 bit r/w Hash Match Address Registers */ +#define XM_RX_LO_WM 0x0118 /* 16 bit r/w Receive Low Water Mark */ +#define XM_RX_HI_WM 0x011a /* 16 bit r/w Receive High Water Mark */ +#define XM_RX_THR 0x011c /* 32 bit r/w Receive Request Threshold */ +#define XM_DEV_ID 0x0120 /* 32 bit ro Device ID Register */ +#define XM_MODE 0x0124 /* 32 bit r/w Mode Register */ +#define XM_LSA 0x0128 /* NA reg ro Last Source Register */ + /* 0x012e: reserved */ +#define XM_TS_READ 0x0130 /* 32 bit ro TimeStamp Read Regeister */ +#define XM_TS_LOAD 0x0134 /* 32 bit ro TimeStamp Load Value */ + /* 0x0138 - 0x01fe: reserved */ +#define XM_STAT_CMD 0x0200 /* 16 bit r/w Statistics Command Register */ +#define XM_RX_CNT_EV 0x0204 /* 32 bit ro Rx Counter Event Register */ +#define XM_TX_CNT_EV 0x0208 /* 32 bit ro Tx Counter Event Register */ +#define XM_RX_EV_MSK 0x020c /* 32 bit r/w Rx Counter Event Mask */ +#define XM_TX_EV_MSK 0x0210 /* 32 bit r/w Tx Counter Event Mask */ + /* 0x0204 - 0x027e: reserved */ +#define XM_TXF_OK 0x0280 /* 32 bit ro Frames Transmitted OK Conuter */ +#define XM_TXO_OK_HI 0x0284 /* 32 bit ro Octets Transmitted OK High Cnt*/ +#define XM_TXO_OK_LO 0x0288 /* 32 bit ro Octets Transmitted OK Low Cnt */ +#define XM_TXF_BC_OK 0x028c /* 32 bit ro Broadcast Frames Xmitted OK */ +#define XM_TXF_MC_OK 0x0290 /* 32 bit ro Multicast Frames Xmitted OK */ +#define XM_TXF_UC_OK 0x0294 /* 32 bit ro Unicast Frames Xmitted OK */ +#define XM_TXF_LONG 0x0298 /* 32 bit ro Tx Long Frame Counter */ +#define XM_TXE_BURST 0x029c /* 32 bit ro Tx Burst Event Counter */ +#define XM_TXF_MPAUSE 0x02a0 /* 32 bit ro Tx Pause MAC Ctrl Frame Cnt */ +#define XM_TXF_MCTRL 0x02a4 /* 32 bit ro Tx MAC Ctrl Frame Counter */ +#define XM_TXF_SNG_COL 0x02a8 /* 32 bit ro Tx Single Colliosion Counter */ +#define XM_TXF_MUL_COL 0x02ac /* 32 bit ro Tx Multiple Collision Counter */ +#define XM_TXF_ABO_COL 0x02b0 /* 32 bit ro Tx aborted due to Exessive Col*/ +#define XM_TXF_LAT_COL 0x02b4 /* 32 bit ro Tx Late Collision Counter */ +#define XM_TXF_DEF 0x02b8 /* 32 bit ro Tx Deferred Frame Counter */ +#define XM_TXF_EX_DEF 0x02bc /* 32 bit ro Tx Excessive Deferall Counter */ +#define XM_TXE_FIFO_UR 0x02c0 /* 32 bit ro Tx FIFO Underrun Event Cnt */ +#define XM_TXE_CS_ERR 0x02c4 /* 32 bit ro Tx Carrier Sence Error Cnt */ +#define XM_TXP_UTIL 0x02c8 /* 32 bit ro Tx Utilization in % */ + /* 0x02cc - 0x02ce: reserved */ +#define XM_TXF_64B 0x02d0 /* 32 bit ro 64 Byte Tx Frame Counter */ +#define XM_TXF_127B 0x02d4 /* 32 bit ro 65-127 Byte Tx Frame Counter */ +#define XM_TXF_255B 0x02d8 /* 32 bit ro 128-255 Byte Tx Frame Counter */ +#define XM_TXF_511B 0x02dc /* 32 bit ro 256-511 Byte Tx Frame Counter */ +#define XM_TXF_1023B 0x02e0 /* 32 bit ro 512-1023 Byte Tx Frame Counter*/ +#define XM_TXF_MAX_SZ 0x02e4 /* 32 bit ro 1024-MaxSize Byte Tx Frame Cnt*/ + /* 0x02e8 - 0x02fe: reserved */ +#define XM_RXF_OK 0x0300 /* 32 bit ro Frames Received OK */ +#define XM_RXO_OK_HI 0x0304 /* 32 bit ro Octets Received OK High Cnt */ +#define XM_RXO_OK_LO 0x0308 /* 32 bit ro Octets Received OK Low Counter*/ +#define XM_RXF_BC_OK 0x030c /* 32 bit ro Broadcast Frames Received OK */ +#define XM_RXF_MC_OK 0x0310 /* 32 bit ro Multicast Frames Received OK */ +#define XM_RXF_UC_OK 0x0314 /* 32 bit ro Unicast Frames Received OK */ +#define XM_RXF_MPAUSE 0x0318 /* 32 bit ro Rx Pause MAC Ctrl Frame Cnt */ +#define XM_RXF_MCTRL 0x031c /* 32 bit ro Rx MAC Ctrl Frame Counter */ +#define XM_RXF_INV_MP 0x0320 /* 32 bit ro Rx invalid Pause Frame Cnt */ +#define XM_RXF_INV_MOC 0x0324 /* 32 bit ro Rx Frames with inv. MAC Opcode*/ +#define XM_RXE_BURST 0x0328 /* 32 bit ro Rx Burst Event Counter */ +#define XM_RXE_FMISS 0x032c /* 32 bit ro Rx Missed Frames Event Cnt */ +#define XM_RXF_FRA_ERR 0x0330 /* 32 bit ro Rx Framing Error Counter */ +#define XM_RXE_FIFO_OV 0x0334 /* 32 bit ro Rx FIFO overflow Event Cnt */ +#define XM_RXF_JAB_PKT 0x0338 /* 32 bit ro Rx Jabber Packet Frame Cnt */ +#define XM_RXE_CAR_ERR 0x033c /* 32 bit ro Rx Carrier Event Error Cnt */ +#define XM_RXF_LEN_ERR 0x0340 /* 32 bit ro Rx in Range Length Error */ +#define XM_RXE_SYM_ERR 0x0344 /* 32 bit ro Rx Symbol Error Counter */ +#define XM_RXE_SHT_ERR 0x0348 /* 32 bit ro Rx Short Event Error Cnt */ +#define XM_RXE_RUNT 0x034c /* 32 bit ro Rx Runt Event Counter */ +#define XM_RXF_LNG_ERR 0x0350 /* 32 bit ro Rx Frame too Long Error Cnt */ +#define XM_RXF_FCS_ERR 0x0354 /* 32 bit ro Rx Frame Check Seq. Error Cnt */ + /* 0x0358 - 0x035a: reserved */ +#define XM_RXF_CEX_ERR 0x035c /* 32 bit ro Rx Carrier Ext Error Frame Cnt*/ +#define XM_RXP_UTIL 0x0360 /* 32 bit ro Rx Utilization in % */ + /* 0x0364 - 0x0366: reserved */ +#define XM_RXF_64B 0x0368 /* 32 bit ro 64 Byte Rx Frame Counter */ +#define XM_RXF_127B 0x036c /* 32 bit ro 65-127 Byte Rx Frame Counter */ +#define XM_RXF_255B 0x0370 /* 32 bit ro 128-255 Byte Rx Frame Counter */ +#define XM_RXF_511B 0x0374 /* 32 bit ro 256-511 Byte Rx Frame Counter */ +#define XM_RXF_1023B 0x0378 /* 32 bit ro 512-1023 Byte Rx Frame Counter*/ +#define XM_RXF_MAX_SZ 0x037c /* 32 bit ro 1024-MaxSize Byte Rx Frame Cnt*/ + /* 0x02e8 - 0x02fe: reserved */ + + +/*----------------------------------------------------------------------------*/ +/* + * XMAC Bit Definitions + * + * If the bit access behaviour differs from the register access behaviour + * (r/w, ro) this is docomented after the bit number. The following bit + * access behaviours are used: + * (sc) self clearing + * (ro) read only + */ + +/* XM_MMU_CMD 16 bit r/w MMU Comamnd Register */ + /* Bit 15..13: reserved */ +#define XM_MMU_PHY_RDY (1<<12) /* Bit 12: PHY Read Ready */ +#define XM_MMU_PHY_BUSY (1<<11) /* Bit 11: PHY Busy */ +#define XM_MMU_IGN_PF (1<<10) /* Bit 10: Ignore Pause Frame */ +#define XM_MMU_MAC_LB (1<<9) /* Bit 9: Enable MAC Loopback */ + /* Bit 8: reserved */ +#define XM_MMU_FRC_COL (1<<7) /* Bit 7: Force Collision */ +#define XM_MMU_SIM_COL (1<<6) /* Bit 6: Simulate Collision */ +#define XM_MMU_NO_PRE (1<<5) /* Bit 5: No MDIO Preamble */ +#define XM_MMU_GMII_FD (1<<4) /* Bit 4: GMII uses Full Duplex */ +#define XM_MMU_RAT_CTRL (1<<3) /* Bit 3: Enable Rate Control */ +#define XM_MMU_GMII_LOOP (1<<2) /* Bit 2: PHY is in Lookback Mode */ +#define XM_MMU_ENA_RX (1<<1) /* Bit 1: Enable Receiver */ +#define XM_MMU_ENA_TX (1<<0) /* Bit 0: Enable Transmitter */ + + +/* XM_TX_CMD 16 bit r/w Transmit Command Register */ + /* Bit 15..7: reserved */ +#define XM_TX_BK2BK (1<<6) /* Bit 6: Ignor Carrier Sense (tx Bk2Bk)*/ +#define XM_TX_ENC_BYP (1<<5) /* Bit 5: Set Encoder in Bypass Mode */ +#define XM_TX_SAM_LINE (1<<4) /* Bit 4: (sc) Start utilization calculation */ +#define XM_TX_NO_GIG_MD (1<<3) /* Bit 3: Disable Carrier Extension */ +#define XM_TX_NO_PRE (1<<2) /* Bit 2: Disable Preamble Generation */ +#define XM_TX_NO_CRC (1<<1) /* Bit 1: Disable CRC Generation */ +#define XM_TX_AUTO_PAD (1<<0) /* Bit 0: Enable Automatic Padding */ + + +/* XM_TX_RT_LIM 16 bit r/w Transmit Retry Limit Register */ + /* Bit 15..5: reserved */ +#define XM_RT_LIM_MSK 0x1f /* Bit 4..0: Tx Retry Limit */ + + +/* XM_TX_STIME 16 bit r/w Transmit Slottime Register */ + /* Bit 15..7: reserved */ +#define XM_STIME_MSK 0x7f /* Bit 6..0: Tx Slottime bits */ + + +/* XM_TX_IPG 16 bit r/w Transmit Inter Packet Gap */ + /* Bit 15..8: reserved */ +#define XM_IPG_MSK 0xff /* Bit 7..0: IPG value bits */ + + +/* XM_RX_CMD 16 bit r/w Receive Command Register */ + /* Bit 15..9: reserved */ +#define XM_RX_LENERR_OK (1<<8) /* Bit 8 don't set Rx Err bit for */ + /* inrange error packets */ +#define XM_RX_BIG_PK_OK (1<<7) /* Bit 7 don't set Rx Err bit for */ + /* jumbo packets */ +#define XM_RX_IPG_CAP (1<<6) /* Bit 6 repl. type field with IPG */ +#define XM_RX_TP_MD (1<<5) /* Bit 5: Enable transparent Mode */ +#define XM_RX_STRIP_FCS (1<<4) /* Bit 4: Enable FCS Stripping */ +#define XM_RX_SELF_RX (1<<3) /* Bit 3: Enable Rx of own packets */ +#define XM_RX_SAM_LINE (1<<2) /* Bit 2: (sc) Start utilization calculation */ +#define XM_RX_STRIP_PAD (1<<1) /* Bit 1: Strip pad bytes of rx frames */ +#define XM_RX_DIS_CEXT (1<<0) /* Bit 0: Disable carrier ext. check */ + + +/* XM_PHY_ADDR 16 bit r/w PHY Address Register */ + /* Bit 15..5: reserved */ +#define XM_PHY_ADDR_SZ 0x1f /* Bit 4..0: PHY Address bits */ + + +/* XM_GP_PORT 32 bit r/w General Purpose Port Register */ + /* Bit 31..7: reserved */ +#define XM_GP_ANIP (1L<<6) /* Bit 6: (ro) Auto Negotiation in Progress */ +#define XM_GP_FRC_INT (1L<<5) /* Bit 5: (sc) Force Interrupt */ + /* Bit 4: reserved */ +#define XM_GP_RES_MAC (1L<<3) /* Bit 3: (sc) Reset MAC and FIFOs */ +#define XM_GP_RES_STAT (1L<<2) /* Bit 2: (sc) Reset the statistics module */ + /* Bit 1: reserved */ +#define XM_GP_INP_ASS (1L<<0) /* Bit 0: (ro) GP Input Pin asserted */ + + +/* XM_IMSK 16 bit r/w Interrupt Mask Register */ +/* XM_ISRC 16 bit ro Interrupt Status Register */ + /* Bit 15: reserved */ +#define XM_IS_LNK_AE (1<<14) /* Bit 14: Link Asynchronous Event */ +#define XM_IS_TX_ABORT (1<<13) /* Bit 13: Transmit Abort, late Col. etc */ +#define XM_IS_FRC_INT (1<<12) /* Bit 12: Force INT bit set in GP */ +#define XM_IS_INP_ASS (1<<11) /* Bit 11: Input Asserted, GP bit 0 set */ +#define XM_IS_LIPA_RC (1<<10) /* Bit 10: Link Partner requests config */ +#define XM_IS_RX_PAGE (1<<9) /* Bit 9: Page Received */ +#define XM_IS_TX_PAGE (1<<8) /* Bit 8: Next Page Loaded for Transmit */ +#define XM_IS_AND (1<<7) /* Bit 7: Auto Negotiation Done */ +#define XM_IS_TSC_OV (1<<6) /* Bit 6: Time Stamp Counter Overflow */ +#define XM_IS_RXC_OV (1<<5) /* Bit 5: Rx Counter Event Overflow */ +#define XM_IS_TXC_OV (1<<4) /* Bit 4: Tx Counter Event Overflow */ +#define XM_IS_RXF_OV (1<<3) /* Bit 3: Receive FIFO Overflow */ +#define XM_IS_TXF_UR (1<<2) /* Bit 2: Transmit FIFO Underrun */ +#define XM_IS_TX_COMP (1<<1) /* Bit 1: Frame Tx Complete */ +#define XM_IS_RX_COMP (1<<0) /* Bit 0: Frame Rx Complete */ + +#define XM_DEF_MSK (~(XM_IS_INP_ASS | XM_IS_LIPA_RC | XM_IS_RX_PAGE |\ + XM_IS_AND | XM_IS_RXC_OV | XM_IS_TXC_OV |\ + XM_IS_TXF_UR)) + + +/* XM_HW_CFG 16 bit r/w Hardware Config Register */ + /* Bit 15.. 4: reserved */ +#define XM_HW_GEN_EOP (1<<3) /* Bit 3: generate End of Packet pulse */ +#define XM_HW_COM4SIG (1<<2) /* Bit 2: use Comma Detect for Sig. Det.*/ + /* Bit 1: reserved */ +#define XM_HW_GMII_MD (1<<0) /* Bit 0: GMII Interface selected */ + + +/* XM_TX_LO_WM 16 bit r/w Tx FIFO Low Water Mark */ +/* XM_TX_HI_WM 16 bit r/w Tx FIFO High Water Mark */ + /* Bit 15..10 reserved */ +#define XM_TX_WM_MSK 0x01ff /* Bit 9.. 0 Tx FIFO Watermark bits */ + +/* XM_TX_THR 16 bit r/w Tx Request Threshold */ +/* XM_HT_THR 16 bit r/w Host Request Threshold */ +/* XM_RX_THR 16 bit r/w Receive Request Threshold */ + /* Bit 15..11 reserved */ +#define XM_THR_MSK 0x03ff /* Bit 10.. 0 Tx FIFO Watermark bits */ + + +/* XM_TX_STAT 32 bit ro Tx Status LIFO Register */ +#define XM_ST_VALID (1UL<<31) /* Bit 31: Status Valid */ +#define XM_ST_BYTE_CNT (0x3fffL<<17) /* Bit 30..17: Tx frame Length */ +#define XM_ST_RETRY_CNT (0x1fL<<12) /* Bit 16..12: Retry Count */ +#define XM_ST_EX_COL (1L<<11) /* Bit 11: Excessive Collisions */ +#define XM_ST_EX_DEF (1L<<10) /* Bit 10: Excessive Deferral */ +#define XM_ST_BURST (1L<<9) /* Bit 9: p. xmitted in burst md*/ +#define XM_ST_DEFER (1L<<8) /* Bit 8: packet was defered */ +#define XM_ST_BC (1L<<7) /* Bit 7: Broadcast packet */ +#define XM_ST_MC (1L<<6) /* Bit 6: Multicast packet */ +#define XM_ST_UC (1L<<5) /* Bit 5: Unicast packet */ +#define XM_ST_TX_UR (1L<<4) /* Bit 4: FIFO Underrun occured */ +#define XM_ST_CS_ERR (1L<<3) /* Bit 3: Carrier Sense Error */ +#define XM_ST_LAT_COL (1L<<2) /* Bit 2: Late Collision Error */ +#define XM_ST_MUL_COL (1L<<1) /* Bit 1: Multiple Collisions */ +#define XM_ST_SGN_COL (1L<<0) /* Bit 0: Single Collision */ + +/* XM_RX_LO_WM 16 bit r/w Receive Low Water Mark */ +/* XM_RX_HI_WM 16 bit r/w Receive High Water Mark */ + /* Bit 15..11: reserved */ +#define XM_RX_WM_MSK 0x03ff /* Bit 11.. 0: Rx FIFO Watermark bits */ + + +/* XM_DEV_ID 32 bit ro Device ID Register */ +#define XM_DEV_OUI (0x00ffffffUL<<8) /* Bit 31..8: Device OUI */ +#define XM_DEV_REV (0x07L << 5) /* Bit 7..5: Chip Rev Num */ + + +/* XM_MODE 32 bit r/w Mode Register */ + /* Bit 31..27: reserved */ +#define XM_MD_ENA_REJ (1L<<26) /* Bit 26: Enable Frame Reject */ +#define XM_MD_SPOE_E (1L<<25) /* Bit 25: Send Pause on Edge */ + /* extern generated */ +#define XM_MD_TX_REP (1L<<24) /* Bit 24: Transmit Repeater Mode*/ +#define XM_MD_SPOFF_I (1L<<23) /* Bit 23: Send Pause on FIFOfull*/ + /* intern generated */ +#define XM_MD_LE_STW (1L<<22) /* Bit 22: Rx Stat Word in Lit En*/ +#define XM_MD_TX_CONT (1L<<21) /* Bit 21: Send Continuous */ +#define XM_MD_TX_PAUSE (1L<<20) /* Bit 20: (sc) Send Pause Frame */ +#define XM_MD_ATS (1L<<19) /* Bit 19: Append Time Stamp */ +#define XM_MD_SPOL_I (1L<<18) /* Bit 18: Send Pause on Low */ + /* intern generated */ +#define XM_MD_SPOH_I (1L<<17) /* Bit 17: Send Pause on High */ + /* intern generated */ +#define XM_MD_CAP (1L<<16) /* Bit 16: Check Address Pair */ +#define XM_MD_ENA_HSH (1L<<15) /* Bit 15: Enable Hashing */ +#define XM_MD_CSA (1L<<14) /* Bit 14: Check Station Address */ +#define XM_MD_CAA (1L<<13) /* Bit 13: Check Address Array */ +#define XM_MD_RX_MCTRL (1L<<12) /* Bit 12: Rx MAC Control Frames */ +#define XM_MD_RX_RUNT (1L<<11) /* Bit 11: Rx Runt Frames */ +#define XM_MD_RX_IRLE (1L<<10) /* Bit 10: Rx in Range Len Err F */ +#define XM_MD_RX_LONG (1L<<9) /* Bit 9: Rx Long Frames */ +#define XM_MD_RX_CRCE (1L<<8) /* Bit 8: Rx CRC Error Frames */ +#define XM_MD_RX_ERR (1L<<7) /* Bit 7: Rx Error Frames */ +#define XM_MD_DIS_UC (1L<<6) /* Bit 6: Disable Rx Unicast */ +#define XM_MD_DIS_MC (1L<<5) /* Bit 5: Disable Rx Multicast */ +#define XM_MD_DIS_BC (1L<<4) /* Bit 4: Disable Rx Boradcast */ +#define XM_MD_ENA_PROM (1L<<3) /* Bit 3: Enable Promiscuous */ +#define XM_MD_ENA_BE (1L<<2) /* Bit 2: Enable Big Endian */ +#define XM_MD_FTF (1L<<1) /* Bit 1: (sc) Flush Tx FIFO */ +#define XM_MD_FRF (1L<<0) /* Bit 0: (sc) Flush Rx FIFO */ + +#define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I) +#define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\ + XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA |\ + XM_MD_CAA) + +/* XM_STAT_CMD 16 bit r/w Statistics Command Register */ + /* Bit 16..6: reserved */ +#define XM_SC_SNP_RXC (1<<5) /* Bit 5: (sc) Snap Rx Counters */ +#define XM_SC_SNP_TXC (1<<4) /* Bit 4: (sc) Snap Tx Counters */ +#define XM_SC_CP_RXC (1<<3) /* Bit 3: Copy Rx Counters Continuously */ +#define XM_SC_CP_TXC (1<<2) /* Bit 2: Copy Tx Counters Continuously */ +#define XM_SC_CLR_RXC (1<<1) /* Bit 1: (sc) Clear Rx Counters */ +#define XM_SC_CLR_TXC (1<<0) /* Bit 0: (sc) Clear Tx Counters */ + + +/* XM_RX_CNT_EV 32 bit ro Rx Counter Event Register */ +/* XM_RX_EV_MSK 32 bit r/w Rx Counter Event Mask */ +#define XMR_MAX_SZ_OV (1UL<<31) /* Bit 31: 1024-MaxSize Rx Cnt Ov*/ +#define XMR_1023B_OV (1L<<30) /* Bit 30: 512-1023Byte Rx Cnt Ov*/ +#define XMR_511B_OV (1L<<29) /* Bit 29: 256-511 Byte Rx Cnt Ov*/ +#define XMR_255B_OV (1L<<28) /* Bit 28: 128-255 Byte Rx Cnt Ov*/ +#define XMR_127B_OV (1L<<27) /* Bit 27: 65-127 Byte Rx Cnt Ov */ +#define XMR_64B_OV (1L<<26) /* Bit 26: 64 Byte Rx Cnt Ov */ +#define XMR_UTIL_OV (1L<<25) /* Bit 25: Rx Util Cnt Overflow */ +#define XMR_UTIL_UR (1L<<24) /* Bit 24: Rx Util Cnt Underrun */ +#define XMR_CEX_ERR_OV (1L<<23) /* Bit 23: CEXT Err Cnt Ov */ + /* Bit 22: reserved */ +#define XMR_FCS_ERR_OV (1L<<21) /* Bit 21: Rx FCS Error Cnt Ov */ +#define XMR_LNG_ERR_OV (1L<<20) /* Bit 20: Rx too Long Err Cnt Ov*/ +#define XMR_RUNT_OV (1L<<19) /* Bit 19: Runt Event Cnt Ov */ +#define XMR_SHT_ERR_OV (1L<<18) /* Bit 18: Rx Short Ev Err Cnt Ov*/ +#define XMR_SYM_ERR_OV (1L<<17) /* Bit 17: Rx Sym Err Cnt Ov */ + /* Bit 16: reserved */ +#define XMR_CAR_ERR_OV (1L<<15) /* Bit 15: Rx Carr Ev Err Cnt Ov */ +#define XMR_JAB_PKT_OV (1L<<14) /* Bit 14: Rx Jabb Packet Cnt Ov */ +#define XMR_FIFO_OV (1L<<13) /* Bit 13: Rx FIFO Ov Ev Cnt Ov */ +#define XMR_FRA_ERR_OV (1L<<12) /* Bit 12: Rx Framing Err Cnt Ov */ +#define XMR_FMISS_OV (1L<<11) /* Bit 11: Rx Missed Ev Cnt Ov */ +#define XMR_BURST (1L<<10) /* Bit 10: Rx Burst Event Cnt Ov */ +#define XMR_INV_MOC (1L<<9) /* Bit 9: Rx with inv. MAC OC Ov*/ +#define XMR_INV_MP (1L<<8) /* Bit 8: Rx inv Pause Frame Ov */ +#define XMR_MCTRL_OV (1L<<7) /* Bit 7: Rx MAC Ctrl-F Cnt Ov */ +#define XMR_MPAUSE_OV (1L<<6) /* Bit 6: Rx Pause MAC Ctrl-F Ov*/ +#define XMR_UC_OK_OV (1L<<5) /* Bit 5: Rx Unicast Frame CntOv*/ +#define XMR_MC_OK_OV (1L<<4) /* Bit 4: Rx Multicast Cnt Ov */ +#define XMR_BC_OK_OV (1L<<3) /* Bit 3: Rx Broadcast Cnt Ov */ +#define XMR_OK_LO_OV (1L<<2) /* Bit 2: Octets Rx OK Low CntOv*/ +#define XMR_OK_HI_OV (1L<<1) /* Bit 1: Octets Rx OK Hi Cnt Ov*/ +#define XMR_OK_OV (1L<<0) /* Bit 0: Frames Received Ok Ov */ + +#define XMR_DEF_MSK 0x00000006L /* all bits excepting 1 and 2 */ + +/* XM_TX_CNT_EV 32 bit ro Tx Counter Event Register */ +/* XM_TX_EV_MSK 32 bit r/w Tx Counter Event Mask */ + /* Bit 31..26: reserved */ +#define XMT_MAX_SZ_OV (1L<<25) /* Bit 25: 1024-MaxSize Tx Cnt Ov*/ +#define XMT_1023B_OV (1L<<24) /* Bit 24: 512-1023Byte Tx Cnt Ov*/ +#define XMT_511B_OV (1L<<23) /* Bit 23: 256-511 Byte Tx Cnt Ov*/ +#define XMT_255B_OV (1L<<22) /* Bit 22: 128-255 Byte Tx Cnt Ov*/ +#define XMT_127B_OV (1L<<21) /* Bit 21: 65-127 Byte Tx Cnt Ov */ +#define XMT_64B_OV (1L<<20) /* Bit 20: 64 Byte Tx Cnt Ov */ +#define XMT_UTIL_OV (1L<<19) /* Bit 19: Tx Util Cnt Overflow */ +#define XMT_UTIL_UR (1L<<18) /* Bit 18: Tx Util Cnt Underrun */ +#define XMT_CS_ERR_OV (1L<<17) /* Bit 17: Tx Carr Sen Err Cnt Ov*/ +#define XMT_FIFO_UR_OV (1L<<16) /* Bit 16: Tx FIFO Ur Ev Cnt Ov */ +#define XMT_EX_DEF_OV (1L<<15) /* Bit 15: Tx Ex Deferall Cnt Ov */ +#define XMT_DEF (1L<<14) /* Bit 14: Tx Deferred Cnt Ov */ +#define XMT_LAT_COL_OV (1L<<13) /* Bit 13: Tx Late Col Cnt Ov */ +#define XMT_ABO_COL_OV (1L<<12) /* Bit 12: Tx abo dueto Ex Col Ov*/ +#define XMT_MUL_COL_OV (1L<<11) /* Bit 11: Tx Mult Col Cnt Ov */ +#define XMT_SNG_COL (1L<<10) /* Bit 10: Tx Single Col Cnt Ov */ +#define XMT_MCTRL_OV (1L<<9) /* Bit 9: Tx MAC Ctrl Counter Ov*/ +#define XMT_MPAUSE (1L<<8) /* Bit 8: Tx Pause MAC Ctrl-F Ov*/ +#define XMT_BURST (1L<<7) /* Bit 7: Tx Burst Event Cnt Ov */ +#define XMT_LONG (1L<<6) /* Bit 6: Tx Long Frame Cnt Ov */ +#define XMT_UC_OK_OV (1L<<5) /* Bit 5: Tx Unicast Cnt Ov */ +#define XMT_MC_OK_OV (1L<<4) /* Bit 4: Tx Multicast Cnt Ov */ +#define XMT_BC_OK_OV (1L<<3) /* Bit 3: Tx Broadcast Cnt Ov */ +#define XMT_OK_LO_OV (1L<<2) /* Bit 2: Octets Tx OK Low CntOv*/ +#define XMT_OK_HI_OV (1L<<1) /* Bit 1: Octets Tx OK Hi Cnt Ov*/ +#define XMT_OK_OV (1L<<0) /* Bit 0: Frames Tx Ok Ov */ + +#define XMT_DEF_MSK 0x00000006L /* all bits excepting 1 and 2 */ + +/* + * Receive Frame Status Encoding + */ +#define XMR_FS_LEN (0x3fffUL<<18) /* Bit 31..18: Rx Frame Length */ +#define XMR_FS_2L_VLAN (1L<<17) /* Bit 17: tagged wh 2Lev VLAN ID*/ +#define XMR_FS_1L_VLAN (1L<<16) /* Bit 16: tagged wh 1Lev VLAN ID*/ +#define XMR_FS_BC (1L<<15) /* Bit 15: Broadcast Frame */ +#define XMR_FS_MC (1L<<14) /* Bit 14: Multicast Frame */ +#define XMR_FS_UC (1L<<13) /* Bit 13: Unicast Frame */ + /* Bit 12: reserved */ +#define XMR_FS_BURST (1L<<11) /* Bit 11: Burst Mode */ +#define XMR_FS_CEX_ERR (1L<<10) /* Bit 10: Carrier Ext. Error */ +#define XMR_FS_802_3 (1L<<9) /* Bit 9: 802.3 Frame */ +#define XMR_FS_COL_ERR (1L<<8) /* Bit 8: Collision Error */ +#define XMR_FS_CAR_ERR (1L<<7) /* Bit 7: Carrier Event Error */ +#define XMR_FS_LEN_ERR (1L<<6) /* Bit 6: In-Range Length Error */ +#define XMR_FS_FRA_ERR (1L<<5) /* Bit 5: Framing Error */ +#define XMR_FS_RUNT (1L<<4) /* Bit 4: Runt Error */ +#define XMR_FS_LNG_ERR (1L<<3) /* Bit 3: Gaint Error */ +#define XMR_FS_FCS_ERR (1L<<2) /* Bit 2: Frame Check Sequ Err */ +#define XMR_FS_ERR (1L<<1) /* Bit 1: Frame Error */ +#define XMR_FS_MCTRL (1L<<0) /* Bit 0: MAC Control Packet */ + +/* + * XMR_FS_ERR will be set if + * XMR_FS_FCS_ERR, XMR_FS_LNG_ERR, XMR_FS_RUNT, + * XMR_FS_FRA_ERR, XMR_FS_LEN_ERR, or XMR_FS_CEX_ERR + * is set. XMR_FS_LNG_ERR and XMR_FS_LEN_ERR will issue + * XMR_FS_ERR unless the corresponding bit in the Receive Command + * Register is set. + */ +#define XMR_FS_ANY_ERR XMR_FS_ERR + +/*----------------------------------------------------------------------------*/ +/* + * XMAC-PHY Registers, indirect addressed over the XMAC + */ +#define PHY_XMAC_CTRL 0x00 /* 16 bit r/w PHY Control Register */ +#define PHY_XMAC_STAT 0x01 /* 16 bit r/w PHY Status Register */ +#define PHY_XMAC_ID0 0x02 /* 16 bit ro PHY ID0 Register */ +#define PHY_XMAC_ID1 0x03 /* 16 bit ro PHY ID1 Register */ +#define PHY_XMAC_AUNE_ADV 0x04 /* 16 bit r/w Autoneg Advertisement */ +#define PHY_XMAC_AUNE_LP 0x05 /* 16 bit ro Link Partner Abi Reg */ +#define PHY_XMAC_AUNE_EXP 0x06 /* 16 bit ro Autoneg Expansion Reg */ +#define PHY_XMAC_NEPG 0x07 /* 16 bit r/w Next Page Register */ +#define PHY_XMAC_NEPG_LP 0x08 /* 16 bit ro Next Page Link P Reg */ + /* 0x09 - 0x0e: reserved */ +#define PHY_XMAC_EXT_STAT 0x0f /* 16 bit ro Ext Status Register */ +#define PHY_XMAC_RES_ABI 0x10 /* 16 bit ro PHY Resolved Ability */ + +/*----------------------------------------------------------------------------*/ +/* + * Broadcom-PHY Registers, indirect addressed over XMAC + */ +#define PHY_BCOM_CTRL 0x00 /* 16 bit r/w PHY Control Register */ +#define PHY_BCOM_STAT 0x01 /* 16 bit ro PHY Status Register */ +#define PHY_BCOM_ID0 0x02 /* 16 bit ro PHY ID0 Register */ +#define PHY_BCOM_ID1 0x03 /* 16 bit ro PHY ID1 Register */ +#define PHY_BCOM_AUNE_ADV 0x04 /* 16 bit r/w Autoneg Advertisement */ +#define PHY_BCOM_AUNE_LP 0x05 /* 16 bit ro Link Part Ability Reg */ +#define PHY_BCOM_AUNE_EXP 0x06 /* 16 bit ro Autoneg Expansion Reg */ +#define PHY_BCOM_NEPG 0x07 /* 16 bit r/w Next Page Register */ +#define PHY_BCOM_NEPG_LP 0x08 /* 16 bit ro Next Page Link P Reg */ + /* Broadcom-specific registers */ +#define PHY_BCOM_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */ +#define PHY_BCOM_1000T_STAT 0x0a /* 16 bit ro 1000Base-T Status Reg */ + /* 0x0b - 0x0e: reserved */ +#define PHY_BCOM_EXT_STAT 0x0f /* 16 bit ro Extended Status Reg */ +#define PHY_BCOM_P_EXT_CTRL 0x10 /* 16 bit r/w PHY Extended Ctrl Reg */ +#define PHY_BCOM_P_EXT_STAT 0x11 /* 16 bit ro PHY Extended Stat Reg */ +#define PHY_BCOM_RE_CTR 0x12 /* 16 bit r/w Receive Error Counter */ +#define PHY_BCOM_FC_CTR 0x13 /* 16 bit r/w False Carr Sense Cnt */ +#define PHY_BCOM_RNO_CTR 0x14 /* 16 bit r/w Receiver NOT_OK Cnt */ + /* 0x15 - 0x17: reserved */ +#define PHY_BCOM_AUX_CTRL 0x18 /* 16 bit r/w Auxiliary Control Reg */ +#define PHY_BCOM_AUX_STAT 0x19 /* 16 bit ro Auxiliary Stat Summary*/ +#define PHY_BCOM_INT_STAT 0x1a /* 16 bit ro Interrupt Status Reg */ +#define PHY_BCOM_INT_MASK 0x1b /* 16 bit r/w Interrupt Mask Reg */ + /* 0x1c: reserved */ + /* 0x1d - 0x1f: test registers */ + +/*----------------------------------------------------------------------------*/ +/* + * Level One-PHY Registers, indirect addressed over XMAC + */ +#define PHY_LONE_CTRL 0x00 /* 16 bit r/w PHY Control Register */ +#define PHY_LONE_STAT 0x01 /* 16 bit ro PHY Status Register */ +#define PHY_LONE_ID0 0x02 /* 16 bit ro PHY ID0 Register */ +#define PHY_LONE_ID1 0x03 /* 16 bit ro PHY ID1 Register */ +#define PHY_LONE_AUNE_ADV 0x04 /* 16 bit r/w Autoneg Advertisement */ +#define PHY_LONE_AUNE_LP 0x05 /* 16 bit ro Link Part Ability Reg */ +#define PHY_LONE_AUNE_EXP 0x06 /* 16 bit ro Autoneg Expansion Reg */ +#define PHY_LONE_NEPG 0x07 /* 16 bit r/w Next Page Register */ +#define PHY_LONE_NEPG_LP 0x08 /* 16 bit ro Next Page Link Partner*/ + /* Level One-specific registers */ +#define PHY_LONE_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg*/ +#define PHY_LONE_1000T_STAT 0x0a /* 16 bit ro 1000Base-T Status Reg */ + /* 0x0b -0x0e: reserved */ +#define PHY_LONE_EXT_STAT 0x0f /* 16 bit ro Extended Status Reg */ +#define PHY_LONE_PORT_CFG 0x10 /* 16 bit r/w Port Configuration Reg*/ +#define PHY_LONE_Q_STAT 0x11 /* 16 bit ro Quick Status Reg */ +#define PHY_LONE_INT_ENAB 0x12 /* 16 bit r/w Interrupt Enable Reg */ +#define PHY_LONE_INT_STAT 0x13 /* 16 bit ro Interrupt Status Reg */ +#define PHY_LONE_LED_CFG 0x14 /* 16 bit r/w LED Configuration Reg */ +#define PHY_LONE_PORT_CTRL 0x15 /* 16 bit r/w Port Control Reg */ +#define PHY_LONE_CIM 0x16 /* 16 bit ro CIM Reg */ + /* 0x17 -0x1c: reserved */ + +/*----------------------------------------------------------------------------*/ +/* + * National-PHY Registers, indirect addressed over XMAC + */ +#define PHY_NAT_CTRL 0x00 /* 16 bit r/w PHY Control Register */ +#define PHY_NAT_STAT 0x01 /* 16 bit r/w PHY Status Register */ +#define PHY_NAT_ID0 0x02 /* 16 bit ro PHY ID0 Register */ +#define PHY_NAT_ID1 0x03 /* 16 bit ro PHY ID1 Register */ +#define PHY_NAT_AUNE_ADV 0x04 /* 16 bit r/w Autonegotiation Advertisement */ +#define PHY_NAT_AUNE_LP 0x05 /* 16 bit ro Link Partner Ability Reg */ +#define PHY_NAT_AUNE_EXP 0x06 /* 16 bit ro Autonegotiation Expansion Reg */ +#define PHY_NAT_NEPG 0x07 /* 16 bit r/w Next Page Register */ +#define PHY_NAT_NEPG_LP 0x08 /* 16 bit ro Next Page Link Partner Reg */ + /* National-specific registers */ +#define PHY_NAT_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg */ +#define PHY_NAT_1000T_STAT 0x0a /* 16 bit ro 1000Base-T Status Reg */ + /* 0x0b -0x0e: reserved */ +#define PHY_NAT_EXT_STAT 0x0f /* 16 bit ro Extended Status Register */ +#define PHY_NAT_EXT_CTRL1 0x10 /* 16 bit ro Extended Control Reg1 */ +#define PHY_NAT_Q_STAT1 0x11 /* 16 bit ro Quick Status Reg1 */ +#define PHY_NAT_10B_OP 0x12 /* 16 bit ro 10Base-T Operations Reg */ +#define PHY_NAT_EXT_CTRL2 0x13 /* 16 bit ro Extended Control Reg1 */ +#define PHY_NAT_Q_STAT2 0x14 /* 16 bit ro Quick Status Reg2 */ + /* 0x15 -0x18: reserved */ +#define PHY_NAT_PHY_ADDR 0x19 /* 16 bit ro PHY Address Register */ + + +/*----------------------------------------------------------------------------*/ + +/* + * PHY bit definitions + * Bits defined as PHY_X_..., PHY_B_..., PHY_L_... or PHY_N_... are + * Xmac/Broadcom/LevelOne/National-specific. + * All other are general. + */ + +/***** PHY_XMAC_CTRL 16 bit r/w PHY Control Register *****/ +/***** PHY_BCOM_CTRL 16 bit r/w PHY Control Register *****/ +/***** PHY_LONE_CTRL 16 bit r/w PHY Control Register *****/ +#define PHY_CT_RESET (1<<15) /* Bit 15: (sc) clear all PHY releated regs */ +#define PHY_CT_LOOP (1<<14) /* Bit 14: enable Loopback over PHY */ +#define PHY_CT_SPS_LSB (1<<13) /* Bit 13: (BC,L1) Speed select, lower bit */ +#define PHY_CT_ANE (1<<12) /* Bit 12: Autonegotiation Enabled */ +#define PHY_CT_PDOWN (1<<11) /* Bit 11: (BC,L1) Power Down Mode */ +#define PHY_CT_ISOL (1<<10) /* Bit 10: (BC,L1) Isolate Mode */ +#define PHY_CT_RE_CFG (1<<9) /* Bit 9: (sc) Restart Autonegotiation */ +#define PHY_CT_DUP_MD (1<<8) /* Bit 8: Duplex Mode */ +#define PHY_CT_COL_TST (1<<7) /* Bit 7: (BC,L1) Collsion Test enabled */ +#define PHY_CT_SPS_MSB (1<<6) /* Bit 6: (BC,L1) Speed select, upper bit */ + /* Bit 5..0: reserved */ + +#define PHY_B_CT_SP1000 (1<<6) /* Bit 6: enable speed of 1000 MBit/s */ +#define PHY_B_CT_SP100 (1<<13) /* Bit 13: enable speed of 100 MBit/s */ +#define PHY_B_CT_SP10 (0) /* Bit 6/13 not set, speed of 10 MBit/s */ + +#define PHY_L_CT_SP1000 (1<<6) /* Bit 6: enable speed of 1000 MBit/s */ +#define PHY_L_CT_SP100 (1<<13) /* Bit 13: enable speed of 100 MBit/s */ +#define PHY_L_CT_SP10 (0) /* Bit 6/13 not set, speed of 10 MBit/s */ + + +/***** PHY_XMAC_STAT 16 bit r/w PHY Status Register *****/ +/***** PHY_BCOM_STAT 16 bit r/w PHY Status Register *****/ +/***** PHY_LONE_STAT 16 bit r/w PHY Status Register *****/ + /* Bit 15..9: reserved */ + /* (BC/L1) 100/10 MBit/s cap bits ignored*/ +#define PHY_ST_EXT_ST (1<<8) /* Bit 8: Extended Status Present */ + /* Bit 7: reserved */ +#define PHY_ST_PRE_SUB (1<<6) /* Bit 6: (BC/L1) preamble suppression */ +#define PHY_ST_AN_OVER (1<<5) /* Bit 5: Autonegotiation Over */ +#define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remode Fault Condition Occured*/ +#define PHY_ST_AN_CAP (1<<3) /* Bit 3: Autonegotiation Capability */ +#define PHY_ST_LSYNC (1<<2) /* Bit 2: Link Synchronized */ +#define PHY_ST_JAP_DET (1<<1) /* Bit 1: (BC/L1) Japper Detected */ +#define PHY_ST_EXT_REG (1<<0) /* Bit 0: Extended Register available */ + + +/* PHY_XMAC_ID1 16 bit ro PHY ID1 Register */ +/* PHY_BCOM_ID1 16 bit ro PHY ID1 Register */ +/* PHY_LONE_ID1 16 bit ro PHY ID1 Register */ +#define PHY_I1_OUI (0x3f<<10) /* Bit 15..10: Organiz. Unique ID */ +#define PHY_I1_MOD_NUM (0x3f<<4) /* Bit 9.. 4: Model Number */ +#define PHY_I1_REV (0x0f<<0) /* Bit 3.. 0: Revision Number */ + + +/***** PHY_XMAC_AUNE_ADV 16 bit r/w Autoneg Advertisement *****/ +/***** PHY_XMAC_AUNE_LP 16 bit ro Link Partner Ability Reg *****/ +#define PHY_AN_NXT_PG (1<<15) /* Bit 15: Request Next Page */ +#define PHY_X_AN_ACK (1<<14) /* Bit 14: (ro) Acknowledge Received */ +#define PHY_X_AN_RFB (3<<12) /* Bit 13..12: Remode Fault Bits */ + /* Bit 11.. 9: reserved */ +#define PHY_X_AN_PAUSE (3<<7) /* Bit 8.. 7: Pause Bits */ +#define PHY_X_AN_HD (1<<6) /* Bit 6: Half Duplex */ +#define PHY_X_AN_FD (1<<5) /* Bit 5: Full Duplex */ + /* Bit 4.. 0: reserved */ + +/***** PHY_BCOM_AUNE_ADV 16 bit r/w Autoneg Advertisement *****/ +/***** PHY_BCOM_AUNE_LP 16 bit ro Link Partner Ability Reg *****/ +/* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */ + /* Bit 14: reserved */ +#define PHY_B_AN_RF (1<<13) /* Bit 13: Remote Fault */ + /* Bit 12: reserved */ +#define PHY_B_AN_ASP (1<<11) /* Bit 11: Asymetric Pause */ +#define PHY_B_AN_PC (1<<10) /* Bit 10: Pause Capable */ + /* Bit 9..5: 100/10 BT cap bits ingnored */ +#define PHY_B_AN_SEL (0x1f<<0)/* Bit 4..0: Selector Field, 00001=Ethernet*/ + +/***** PHY_LONE_AUNE_ADV 16 bit r/w Autoneg Advertisement *****/ +/***** PHY_LONE_AUNE_LP 16 bit ro Link Partner Ability Reg *****/ +/* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */ + /* Bit 14: reserved */ +#define PHY_L_AN_RF (1<<13) /* Bit 13: Remote Fault */ + /* Bit 12: reserved */ +#define PHY_L_AN_ASP (1<<11) /* Bit 11: Asymetric Pause */ +#define PHY_L_AN_PC (1<<10) /* Bit 10: Pause Capable */ + /* Bit 9..5: 100/10 BT cap bits ingnored */ +#define PHY_L_AN_SEL (0x1f<<0)/* Bit 4..0: Selector Field, 00001=Ethernet*/ + +/***** PHY_NAT_AUNE_ADV 16 bit r/w Autoneg Advertisement *****/ +/***** PHY_NAT_AUNE_LP 16 bit ro Link Partner Ability Reg *****/ +/* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */ + /* Bit 14: reserved */ +#define PHY_N_AN_RF (1<<13) /* Bit 13: Remote Fault */ + /* Bit 12: reserved */ +#define PHY_N_AN_100F (1<<11) /* Bit 11: 100Base-T2 FD Support */ +#define PHY_N_AN_100H (1<<10) /* Bit 10: 100Base-T2 HD Support */ + /* Bit 9..5: 100/10 BT cap bits ingnored */ +#define PHY_N_AN_SEL (0x1f<<0)/* Bit 4..0: Selector Field, 00001=Ethernet*/ + +/* field type definition for PHY_x_AN_SEL */ +#define PHY_SEL_TYPE 0x01 /* 00001 = Ethernet */ + +/***** PHY_XMAC_AUNE_EXP 16 bit ro Autoneg Expansion Reg *****/ + /* Bit 15..4: reserved */ +#define PHY_AN_LP_NP (1<<3) /* Bit 3: Link Partner can Next Page */ +#define PHY_AN_LOC_NP (1<<2) /* Bit 2: Local PHY can Next Page */ +#define PHY_AN_RX_PG (1<<1) /* Bit 1: Page Received */ + /* Bit 0: reserved */ + +/***** PHY_BCOM_AUNE_EXP 16 bit ro Autoneg Expansion Reg *****/ + /* Bit 15..5: reserved */ +#define PHY_B_AN_PDF (1<<4) /* Bit 4: Parallel Detection Fault */ +/* PHY_AN_LP_NP (see XMAC) Bit 3: Link Partner can Next Page */ +/* PHY_AN_LOC_NP (see XMAC) Bit 2: Local PHY can Next Page */ +/* PHY_AN_RX_PG (see XMAC) Bit 1: Page Received */ +#define PHY_B_AN_LP_CAP (1<<0) /* Bit 0: Link Partner Autoneg Cap. */ + +/***** PHY_LONE_AUNE_EXP 16 bit ro Autoneg Expansion Reg *****/ +#define PHY_L_AN_BP (1<<5) /* Bit 5: Base Page Indication */ +#define PHY_L_AN_PDF (1<<4) /* Bit 4: Parallel Detection Fault */ +/* PHY_AN_LP_NP (see XMAC) Bit 3: Link Partner can Next Page */ +/* PHY_AN_LOC_NP (see XMAC) Bit 2: Local PHY can Next Page */ +/* PHY_AN_RX_PG (see XMAC) Bit 1: Page Received */ +#define PHY_B_AN_LP_CAP (1<<0) /* Bit 0: Link Partner Autoneg Cap. */ + + +/***** PHY_XMAC_NEPG 16 bit r/w Next Page Register *****/ +/***** PHY_BCOM_NEPG 16 bit r/w Next Page Register *****/ +/***** PHY_LONE_NEPG 16 bit r/w Next Page Register *****/ +/***** PHY_XMAC_NEPG_LP 16 bit ro Next Page Link Partner *****/ +/***** PHY_BCOM_NEPG_LP 16 bit ro Next Page Link Partner *****/ +/***** PHY_LONE_NEPG_LP 16 bit ro Next Page Link Partner *****/ +#define PHY_NP_MORE (1<<15) /* Bit 15: More, Next Pages to follow */ +#define PHY_NP_ACK1 (1<<14) /* Bit 14: (ro) Ack 1, for receiving a message*/ +#define PHY_NP_MSG_VAL (1<<13) /* Bit 13: Message Page valid */ +#define PHY_NP_ACK2 (1<<12) /* Bit 12: Ack 2, comply with msg content*/ +#define PHY_NP_TOG (1<<11) /* Bit 11: Toggle Bit, ensure sync */ +#define PHY_NP_MSG 0x07ff /* Bit 10..0: Message from/to Link Partner */ + +/* + * XMAC-Specific + */ +/***** PHY_XMAC_EXT_STAT 16 bit r/w Extended Status Register *****/ +#define PHY_X_EX_FD (1<<15) /* Bit 15: Device Supports Full Duplex */ +#define PHY_X_EX_HD (1<<14) /* Bit 14: Device Supports Half Duplex */ + /* Bit 13..0: reserved */ + +/***** PHY_XMAC_RES_ABI 16 bit ro PHY Resolved Ability *****/ + /* Bit 15..9: reserved */ +#define PHY_X_RS_PAUSE (3<<7) /* Bit 8..7: selected Pause Mode */ +#define PHY_X_RS_HD (1<<6) /* Bit 6: Half Duplex Mode selected */ +#define PHY_X_RS_FD (1<<5) /* Bit 5: Full Duplex Mode selected */ +#define PHY_X_RS_ABLMIS (1<<4) /* Bit 4: duplex or pause cap mismatch */ +#define PHY_X_RS_PAUMIS (1<<3) /* Bit 3: pause capability missmatch */ + /* Bit 2..0: reserved */ +/* + * Remote Fault Bits (PHY_X_AN_RFB) encoding + */ +#define X_RFB_OK (0<<12) /* Bit 12..13 No errors, Link OK */ +#define X_RFB_LF (1<<12) /* Bit 12..13 Link Failure */ +#define X_RFB_OFF (2<<12) /* Bit 12..13 Offline */ +#define X_RFB_AN_ERR (3<<12) /* Bit 12..13 Autonegotiation Error */ + +/* + * Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding + */ +#define PHY_X_P_NO_PAUSE (0<<7) /* Bit 8..7: no Pause Mode */ +#define PHY_X_P_SYM_MD (1<<7) /* Bit 8..7: symmetric Pause Mode */ +#define PHY_X_P_ASYM_MD (2<<7) /* Bit 8..7: asymmetric Pause Mode */ +#define PHY_X_P_BOTH_MD (3<<7) /* Bit 8..7: both Pause Mode */ + + +/* + * Broadcom-Specific + */ +/***** PHY_BCOM_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ +#define PHY_B_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */ +#define PHY_B_1000C_MSE (1<<12) /* Bit 12: Master/Slave Enable */ +#define PHY_B_1000C_MSC (1<<11) /* Bit 11: M/S Configuration */ +#define PHY_B_1000C_RD (1<<10) /* Bit 10: Repeater/DTE */ +#define PHY_B_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */ +#define PHY_B_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */ + /* Bit 7..0: reserved */ + +/***** PHY_BCOM_1000T_STAT 16 bit ro 1000Base-T Status Reg *****/ +#define PHY_B_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */ +#define PHY_B_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */ +#define PHY_B_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */ +#define PHY_B_1000S_RRS (1<<12) /* Bit 12: Remote Receiver Status */ +#define PHY_B_1000S_LP_FD (1<<11) /* Bit 11: Link Partner can FD */ +#define PHY_B_1000S_LP_HD (1<<10) /* Bit 10: Link Partner can HD */ + /* Bit 9..8: reserved */ +#define PHY_B_1000S_IEC (255<<0)/* Bit 7..0: Idle Error Count */ + +/***** PHY_BCOM_EXT_STAT 16 bit ro Extended Status Register *****/ +#define PHY_B_ES_X_FD_CAP (1<<15) /* Bit 15: 1000Base-X FD capable */ +#define PHY_B_ES_X_HD_CAP (1<<14) /* Bit 14: 1000Base-X HD capable */ +#define PHY_B_ES_T_FD_CAP (1<<13) /* Bit 13: 1000Base-T FD capable */ +#define PHY_B_ES_T_HD_CAP (1<<12) /* Bit 12: 1000Base-T HD capable */ + /* Bit 11..0: reserved */ + +/***** PHY_BCOM_P_EXT_CTRL 16 bit r/w PHY Extended Control Reg *****/ +#define PHY_B_PEC_MAC_PHY (1<<15) /* Bit 15: 10BIT/GMI-Interface */ +#define PHY_B_PEC_DIS_CROSS (1<<14) /* Bit 14: Disable MDI Crossover */ +#define PHY_B_PEC_TX_DIS (1<<13) /* Bit 13: Tx output Disabled */ +#define PHY_B_PEC_INT_DIS (1<<12) /* Bit 12: Interrupts Disabled */ +#define PHY_B_PEC_F_INT (1<<11) /* Bit 11: Force Interrupt */ +#define PHY_B_PEC_BY_45 (1<<10) /* Bit 10: Bypass 4B5B-Decoder */ +#define PHY_B_PEC_BY_SCR (1<<9) /* Bit 9: Bypass Scrambler */ +#define PHY_B_PEC_BY_MLT3 (1<<8) /* Bit 8: Bypass MLT3 Encoder */ +#define PHY_B_PEC_BY_RXA (1<<7) /* Bit 7: Bypass Rx Alignm. */ +#define PHY_B_PEC_RES_SCR (1<<6) /* Bit 6: Reset Scrambler */ +#define PHY_B_PEC_EN_LTR (1<<5) /* Bit 5: Ena LED Traffic Mode */ +#define PHY_B_PEC_LED_ON (1<<4) /* Bit 4: Force LED's on */ +#define PHY_B_PEC_LED_OFF (1<<3) /* Bit 3: Force LED's off */ +#define PHY_B_PEC_EX_IPG (1<<2) /* Bit 2: Extend Tx IPG Mode */ +#define PHY_B_PEC_3_LED (1<<1) /* Bit 1: Three Link LED mode */ +#define PHY_B_PEC_HIGH_LA (1<<0) /* Bit 0: GMII Fifo Elasticy */ + +/***** PHY_BCOM_P_EXT_STAT 16 bit ro PHY Extended Status Reg *****/ + /* Bit 15..14: reserved */ +#define PHY_B_PES_CROSS_STAT (1<<13) /* Bit 13: MDI Crossover Status */ +#define PHY_B_PES_INT_STAT (1<<12) /* Bit 12: Interrupt Status */ +#define PHY_B_PES_RRS (1<<11) /* Bit 11: Remote Receiver Stat. */ +#define PHY_B_PES_LRS (1<<10) /* Bit 10: Local Receiver Stat. */ +#define PHY_B_PES_LOCKED (1<<9) /* Bit 9: Locked */ +#define PHY_B_PES_LS (1<<8) /* Bit 8: Link Status */ +#define PHY_B_PES_RF (1<<7) /* Bit 7: Remote Fault */ +#define PHY_B_PES_CE_ER (1<<6) /* Bit 6: Carrier Ext Error */ +#define PHY_B_PES_BAD_SSD (1<<5) /* Bit 5: Bad SSD */ +#define PHY_B_PES_BAD_ESD (1<<4) /* Bit 4: Bad ESD */ +#define PHY_B_PES_RX_ER (1<<3) /* Bit 3: Receive Error */ +#define PHY_B_PES_TX_ER (1<<2) /* Bit 2: Transmit Error */ +#define PHY_B_PES_LOCK_ER (1<<1) /* Bit 1: Lock Error */ +#define PHY_B_PES_MLT3_ER (1<<0) /* Bit 0: MLT3 code Error */ + +/***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/ + /* Bit 15..8: reserved */ +#define PHY_B_FC_CTR (255<<0)/* Bit 7..0: False Carrier Counter */ + +/***** PHY_BCOM_RNO_CTR 16 bit r/w Receive NOT_OK Counter *****/ +#define PHY_B_RC_LOC (255<<8)/* Bit 15..8: Local Rx NOT_OK cnt */ +#define PHY_B_RC_REM (255<<0)/* Bit 7..0: Remote Rx NOT_OK cnt */ + +/***** PHY_BCOM_AUX_CTRL 16 bit r/w Auxiliary Control Reg *****/ +#define PHY_B_AC_L_SQE (1<<15) /* Bit 15: Low Squelch */ +#define PHY_B_AC_LONG_PACK (1<<14) /* Bit 14: Rx Long Packets */ +#define PHY_B_AC_ER_CTRL (3<<12) /* Bit 13..12: Edgerate Control */ + /* Bit 11: reserved */ +#define PHY_B_AC_TX_TST (1<<10) /* Bit 10: tx test bit, always 1 */ + /* Bit 9.. 8: reserved */ +#define PHY_B_AC_DIS_PRF (1<<7) /* Bit 7: dis part resp filter */ + /* Bit 6.. 4: reserved */ +#define PHY_B_AC_DIAG (1<<3) /* Bit 3: Diagnostic Mode */ + /* Bit 2.. 0: reserved */ + +/***** PHY_BCOM_AUX_STAT 16 bit ro Auxiliary Status Reg *****/ +#define PHY_B_AS_AN_C (1<<15) /* Bit 15: AutoNeg complete */ +#define PHY_B_AS_AN_CA (1<<14) /* Bit 14: AN Complete Ack */ +#define PHY_B_AS_ANACK_D (1<<13) /* Bit 13: AN Ack Detect */ +#define PHY_B_AS_ANAB_D (1<<12) /* Bit 12: AN Ability Detect */ +#define PHY_B_AS_NPW (1<<11) /* Bit 11: AN Next Page Wait */ +#define PHY_B_AS_AN_RES (7<<8) /* Bit 10..8: AN HDC */ +#define PHY_B_AS_PDF (1<<7) /* Bit 7: Parallel Detect. Fault*/ +#define PHY_B_AS_RF (1<<6) /* Bit 6: Remote Fault */ +#define PHY_B_AS_ANP_R (1<<5) /* Bit 5: AN Page Received */ +#define PHY_B_AS_LP_ANAB (1<<4) /* Bit 4: LP AN Ability */ +#define PHY_B_AS_LP_NPAB (1<<3) /* Bit 3: LP Next Page Ability */ +#define PHY_B_AS_LS (1<<2) /* Bit 2: Link Status */ +#define PHY_B_AS_PRR (1<<1) /* Bit 1: Pause Resolution-Rx */ +#define PHY_B_AS_PRT (1<<0) /* Bit 0: Pause Resolution-Tx */ + +/***** PHY_BCOM_INT_STAT 16 bit ro Interrupt Status Reg *****/ +/***** PHY_BCOM_INT_MASK 16 bit r/w Interrupt Mask Reg *****/ + /* Bit 15: reserved */ +#define PHY_B_IS_PSE (1<<14) /* Bit 14: Pair Swap Error */ +#define PHY_B_IS_MDXI_SC (1<<13) /* Bit 13: MDIX Status Change */ +#define PHY_B_IS_HCT (1<<12) /* Bit 12: counter above 32k */ +#define PHY_B_IS_LCT (1<<11) /* Bit 11: all counter below 128 */ +#define PHY_B_IS_AN_PR (1<<10) /* Bit 10: Page Received */ +#define PHY_B_IS_NO_HDCL (1<<9) /* Bit 9: No HCD Link */ +#define PHY_B_IS_NO_HDC (1<<8) /* Bit 8: No HCD */ +#define PHY_B_IS_NEG_USHDC (1<<7) /* Bit 7: Negotiated Unsup. HCD */ +#define PHY_B_IS_SCR_S_ER (1<<6) /* Bit 6: Scrambler Sync Error */ +#define PHY_B_IS_RRS_CHANGE (1<<5) /* Bit 5: Remote Rx Stat Change */ +#define PHY_B_IS_LRS_CHANGE (1<<4) /* Bit 4: Local Rx Stat Change */ +#define PHY_B_IS_DUP_CHANGE (1<<3) /* Bit 3: Duplex Mode Change */ +#define PHY_B_IS_LSP_CHANGE (1<<2) /* Bit 2: Link Speed Change */ +#define PHY_B_IS_LST_CHANGE (1<<1) /* Bit 1: Link Status Changed */ +#define PHY_B_IS_CRC_ER (1<<0) /* Bit 0: CRC Error */ + +#define PHY_B_DEF_MSK (~(PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) + + +/* + * Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding + */ +#define PHY_B_P_NO_PAUSE (0<<10) /* Bit 11..10: no Pause Mode */ +#define PHY_B_P_SYM_MD (1<<10) /* Bit 11..10: symmetric Pause Mode */ +#define PHY_B_P_ASYM_MD (2<<10) /* Bit 11..10: asymmetric Pause Mode */ +#define PHY_B_P_BOTH_MD (3<<10) /* Bit 11..10: both Pause Mode */ + +/* + * Resolved Duplex mode and Capabilities (Aux Status Summary Reg) + */ +#define PHY_B_RES_1000FD (7<<8) /* Bit 10..8: 1000Base-T Full Dup. */ +#define PHY_B_RES_1000HD (6<<8) /* Bit 10..8: 1000Base-T Half Dup. */ +/* others: 100/10: invalid for us */ + +/* + * Level One-Specific + */ +/***** PHY_LONE_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ +#define PHY_L_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */ +#define PHY_L_1000C_MSE (1<<12) /* Bit 12: Master/Slave Enable */ +#define PHY_L_1000C_MSC (1<<11) /* Bit 11: M/S Configuration */ +#define PHY_L_1000C_RD (1<<10) /* Bit 10: Repeater/DTE */ +#define PHY_L_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */ +#define PHY_L_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */ + /* Bit 7..0: reserved */ + +/***** PHY_LONE_1000T_STAT 16 bit ro 1000Base-T Status Reg *****/ +#define PHY_L_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */ +#define PHY_L_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */ +#define PHY_L_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */ +#define PHY_L_1000S_RRS (1<<12) /* Bit 12: Remote Receiver Status*/ +#define PHY_L_1000S_LP_FD (1<<11) /* Bit 11: Link Partner can FD */ +#define PHY_L_1000S_LP_HD (1<<10) /* Bit 10: Link Partner can HD */ + /* Bit 9..8: reserved */ +#define PHY_B_1000S_IEC (255<<0)/* Bit 7..0: Idle Error Count */ + +/***** PHY_LONE_EXT_STAT 16 bit ro Extended Status Register *****/ +#define PHY_L_ES_X_FD_CAP (1<<15) /* Bit 15: 1000Base-X FD capable */ +#define PHY_L_ES_X_HD_CAP (1<<14) /* Bit 14: 1000Base-X HD capable */ +#define PHY_L_ES_T_FD_CAP (1<<13) /* Bit 13: 1000Base-T FD capable */ +#define PHY_L_ES_T_HD_CAP (1<<12) /* Bit 12: 1000Base-T HD capable */ + /* Bit 11..0: reserved */ + +/***** PHY_LONE_PORT_CFG 16 bit r/w Port Configuration Reg *****/ +#define PHY_L_PC_REP_MODE (1<<15) /* Bit 15: Repeater Mode */ + /* Bit 14: reserved */ +#define PHY_L_PC_TX_DIS (1<<13) /* Bit 13: Tx output Disabled */ +#define PHY_L_PC_BY_SCR (1<<12) /* Bit 12: Bypass Scrambler */ +#define PHY_L_PC_BY_45 (1<<11) /* Bit 11: Bypass 4B5B-Decoder */ +#define PHY_L_PC_JAB_DIS (1<<10) /* Bit 10: Jabber Disabled */ +#define PHY_L_PC_SQE (1<<9) /* Bit 9: Enable Heartbeat */ +#define PHY_L_PC_TP_LOOP (1<<8) /* Bit 8: TP Loopback */ +#define PHY_L_PC_SSS (1<<7) /* Bit 7: Smart Speed Selection */ +#define PHY_L_PC_FIFO_SIZE (1<<6) /* Bit 6: FIFO Size */ +#define PHY_L_PC_PRE_EN (1<<5) /* Bit 5: Preamble Enable */ +#define PHY_L_PC_CIM (1<<4) /* Bit 4: Carrier Integrity Mon */ +#define PHY_L_PC_10_SER (1<<3) /* Bit 3: Use Serial Output */ +#define PHY_L_PC_ANISOL (1<<2) /* Bit 2: Unisolate Port */ +#define PHY_L_PC_TEN_BIT (1<<1) /* Bit 1: 10bit iface mode on */ +#define PHY_L_PC_ALTCLOCK (1<<0) /* Bit 0: (ro) ALTCLOCK Mode on */ + +/***** PHY_LONE_Q_STAT 16 bit ro Quick Status Reg *****/ +#define PHY_L_QS_D_RATE (3<<14) /* Bit 15..14: Data Rate */ +#define PHY_L_QS_TX_STAT (1<<13) /* Bit 13: Transmitting */ +#define PHY_L_QS_RX_STAT (1<<12) /* Bit 12: Receiving */ +#define PHY_L_QS_COL_STAT (1<<11) /* Bit 11: Collision */ +#define PHY_L_QS_L_STAT (1<<10) /* Bit 10: Link is up */ +#define PHY_L_QS_DUP_MOD (1<<9) /* Bit 9: Full/Half Duplex */ +#define PHY_L_QS_AN (1<<8) /* Bit 8: AutoNeg is On */ +#define PHY_L_QS_AN_C (1<<7) /* Bit 7: AN is Complete */ +#define PHY_L_QS_LLE (7<<4) /* Bit 6: Line Length Estim. */ +#define PHY_L_QS_PAUSE (1<<3) /* Bit 3: LP advertised Pause */ +#define PHY_L_QS_AS_PAUSE (1<<2) /* Bit 2: LP adv. asym. Pause */ +#define PHY_L_QS_ISOLATE (1<<1) /* Bit 1: CIM Isolated */ +#define PHY_L_QS_EVENT (1<<0) /* Bit 0: Event has occurred */ + +/***** PHY_LONE_INT_ENAB 16 bit r/w Interrupt Enable Reg *****/ +/***** PHY_LONE_INT_STAT 16 bit ro Interrupt Status Reg *****/ + /* Bit 15..14: reserved */ +#define PHY_L_IS_AN_F (1<<13) /* Bit 13: Autoneg fault */ + /* Bit 12: not described */ +#define PHY_L_IS_CROSS (1<<11) /* Bit 11: Crossover used */ +#define PHY_L_IS_POL (1<<10) /* Bit 10: Polarity correct. used*/ +#define PHY_L_IS_SS (1<<9) /* Bit 9: Smart Speed Downgrade*/ +#define PHY_L_IS_CFULL (1<<8) /* Bit 8: Counter Full */ +#define PHY_L_IS_AN_C (1<<7) /* Bit 7: AutoNeg Complete */ +#define PHY_L_IS_SPEED (1<<6) /* Bit 6: Speed Changed */ +#define PHY_L_IS_DUP (1<<5) /* Bit 5: Duplex Changed */ +#define PHY_L_IS_LS (1<<4) /* Bit 4: Link Status Changed */ +#define PHY_L_IS_ISOL (1<<3) /* Bit 3: Isolate Occured */ +#define PHY_L_IS_MDINT (1<<2) /* Bit 2: (ro) STAT: MII Int Pending */ +#define PHY_L_IS_INTEN (1<<1) /* Bit 1: ENAB: Enable IRQs */ +#define PHY_L_IS_FORCE (1<<0) /* Bit 0: ENAB: Force Interrupt */ + +#define PHY_L_DEF_MSK (PHY_L_IS_LS | PHY_L_IS_ISOL | \ + PHY_L_IS_INTEN) /* int. mask */ + +/***** PHY_LONE_LED_CFG 16 bit r/w LED Configuration Reg *****/ +#define PHY_L_LC_LEDC (3<<14) /* Bit 15..14: Col/Blink/On/Off */ +#define PHY_L_LC_LEDR (3<<12) /* Bit 13..12: Rx/Blink/On/Off */ +#define PHY_L_LC_LEDT (3<<10) /* Bit 11..10: Tx/Blink/On/Off */ +#define PHY_L_LC_LEDG (3<<8) /* Bit 9..8: Giga/Blink/On/Off */ +#define PHY_L_LC_LEDS (3<<6) /* Bit 7..6: 10-100/Blink/On/Off */ +#define PHY_L_LC_LEDL (3<<4) /* Bit 5..4: Link/Blink/On/Off */ +#define PHY_L_LC_LEDF (3<<2) /* Bit 3..2: Duplex/Blink/On/Off */ +#define PHY_L_LC_PSTRECH (1<<1) /* Bit 1: Strech LED Pulses */ +#define PHY_L_LC_FREQ (1<<0) /* Bit 0: 30/100 ms */ + +/***** PHY_LONE_PORT_CTRL 16 bit r/w Port Control Reg *****/ +#define PHY_L_PC_TX_TCLK (1<<15) /* Bit 15: Enable TX_TCLK */ + /* Bit 14: reserved */ +#define PHY_L_PC_ALT_NP (1<<13) /* Bit 14: Alternate Next Page */ +#define PHY_L_PC_GMII_ALT (1<<12) /* Bit 13: Alternate GMII driver */ + /* Bit 11: reserved */ +#define PHY_L_PC_TEN_CRS (1<<10) /* Bit 10: Extend CRS*/ + /* Bit 9..0: not described */ + +/***** PHY_LONE_CIM 16 bit ro CIM Reg *****/ +#define PHY_L_CIM_ISOL (255<<8)/* Bit 15..8: Isolate Count */ +#define PHY_L_CIM_FALSE_CAR (255<<0)/* Bit 7..0: False Carrier Count */ + + +/* + * Pause Bits (PHY_L_AN_ASP and PHY_L_AN_PC) encoding + */ +#define PHY_L_P_NO_PAUSE (0<<10) /* Bit 11..10: no Pause Mode */ +#define PHY_L_P_SYM_MD (1<<10) /* Bit 11..10: symmetric Pause Mode */ +#define PHY_L_P_ASYM_MD (2<<10) /* Bit 11..10: asymmetric Pause Mode */ +#define PHY_L_P_BOTH_MD (3<<10) /* Bit 11..10: both Pause Mode */ + + +/* + * National-Specific + */ +/***** PHY_NAT_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ +#define PHY_N_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */ +#define PHY_N_1000C_MSE (1<<12) /* Bit 12: Master/Slave Enable */ +#define PHY_N_1000C_MSC (1<<11) /* Bit 11: M/S Configuration */ +#define PHY_N_1000C_RD (1<<10) /* Bit 10: Repeater/DTE */ +#define PHY_N_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */ +#define PHY_N_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */ +#define PHY_N_1000C_APC (1<<7) /* Bit 7: Asymetric Pause Cap. */ + /* Bit 6..0: reserved */ + +/***** PHY_NAT_1000T_STAT 16 bit ro 1000Base-T Status Reg *****/ +#define PHY_N_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */ +#define PHY_N_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */ +#define PHY_N_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */ +#define PHY_N_1000S_RRS (1<<12) /* Bit 12: Remote Receiver Status*/ +#define PHY_N_1000S_LP_FD (1<<11) /* Bit 11: Link Partner can FD */ +#define PHY_N_1000S_LP_HD (1<<10) /* Bit 10: Link Partner can HD */ +#define PHY_N_1000C_LP_APC (1<<9) /* Bit 9: LP Asym. Pause Cap. */ + /* Bit 8: reserved */ +#define PHY_N_1000S_IEC (255<<0)/* Bit 7..0: Idle Error Count */ + +/***** PHY_NAT_EXT_STAT 16 bit ro Extended Status Register *****/ +#define PHY_N_ES_X_FD_CAP (1<<15) /* Bit 15: 1000Base-X FD capable */ +#define PHY_N_ES_X_HD_CAP (1<<14) /* Bit 14: 1000Base-X HD capable */ +#define PHY_N_ES_T_FD_CAP (1<<13) /* Bit 13: 1000Base-T FD capable */ +#define PHY_N_ES_T_HD_CAP (1<<12) /* Bit 12: 1000Base-T HD capable */ + /* Bit 11..0: reserved */ + +/* todo: those are still missing */ +/***** PHY_NAT_EXT_CTRL1 16 bit ro Extended Control Reg1 *****/ +/***** PHY_NAT_Q_STAT1 16 bit ro Quick Status Reg1 *****/ +/***** PHY_NAT_10B_OP 16 bit ro 10Base-T Operations Reg *****/ +/***** PHY_NAT_EXT_CTRL2 16 bit ro Extended Control Reg1 *****/ +/***** PHY_NAT_Q_STAT2 16 bit ro Quick Status Reg2 *****/ +/***** PHY_NAT_PHY_ADDR 16 bit ro PHY Address Register *****/ + +/* typedefs *******************************************************************/ + + +/* function prototypes ********************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INC_XMAC_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skaddr.c linux/drivers/net/sk98lin/skaddr.c --- v2.3.28/linux/drivers/net/sk98lin/skaddr.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skaddr.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1300 @@ +/****************************************************************************** + * + * Name: skaddr.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.33 $ + * Date: $Date: 1999/05/28 10:56:06 $ + * Purpose: Manage Addresses (Multicast and Unicast) and Promiscuous Mode + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skaddr.c,v $ + * Revision 1.33 1999/05/28 10:56:06 rassmann + * Editorial changes. + * + * Revision 1.32 1999/03/31 10:59:20 rassmann + * Returning Success instead of DupAddr if address shall be overridden + * with same value. + * + * Revision 1.31 1999/01/14 16:18:17 rassmann + * Corrected multicast initialization. + * + * Revision 1.30 1999/01/04 10:30:35 rassmann + * SkAddrOverride only possible after SK_INIT_IO phase. + * + * Revision 1.29 1998/12/29 13:13:10 rassmann + * An address override is now preserved in the SK_INIT_IO phase. + * All functions return an int now. + * Extended parameter checking. + * + * Revision 1.28 1998/12/01 11:45:53 rassmann + * Code cleanup. + * + * Revision 1.27 1998/12/01 09:22:49 rassmann + * SkAddrMcAdd and SkAddrMcUpdate returned SK_MC_FILTERING_INEXACT + * too often. + * + * Revision 1.26 1998/11/24 12:39:44 rassmann + * Reserved multicast entry for BPDU address. + * 13 multicast entries left for protocol. + * + * Revision 1.25 1998/11/17 16:54:23 rassmann + * Using exact match for up to 14 multicast addresses. + * Still receiving all multicasts if more addresses are added. + * + * Revision 1.24 1998/11/13 17:24:31 rassmann + * Changed return value of SkAddrOverride to int. + * + * Revision 1.23 1998/11/13 16:56:18 rassmann + * Added macro SK_ADDR_COMPARE. + * Changed return type of SkAddrOverride to SK_BOOL. + * + * Revision 1.22 1998/11/04 17:06:17 rassmann + * Corrected McUpdate and PromiscuousChange functions. + * + * Revision 1.21 1998/10/29 14:34:04 rassmann + * Clearing SK_ADDR struct at startup. + * + * Revision 1.20 1998/10/28 18:16:34 rassmann + * Avoiding I/Os before SK_INIT_RUN level. + * Aligning InexactFilter. + * + * Revision 1.19 1998/10/28 11:29:28 rassmann + * Programming physical address in SkAddrMcUpdate. + * Corrected programming of exact match entries. + * + * Revision 1.18 1998/10/28 10:34:48 rassmann + * Corrected reading of physical addresses. + * + * Revision 1.17 1998/10/28 10:26:13 rassmann + * Getting ports' current MAC addresses from EPROM now. + * Added debug output. + * + * Revision 1.16 1998/10/27 16:20:12 rassmann + * Reading MAC address byte by byte. + * + * Revision 1.15 1998/10/22 11:39:09 rassmann + * Corrected signed/unsigned mismatches. + * + * Revision 1.14 1998/10/19 17:12:35 rassmann + * Syntax corrections. + * + * Revision 1.13 1998/10/19 17:02:19 rassmann + * Now reading permanent MAC addresses from CRF. + * + * Revision 1.12 1998/10/15 15:15:48 rassmann + * Changed Flags Parameters from SK_U8 to int. + * Checked with lint. + * + * Revision 1.11 1998/09/24 19:15:12 rassmann + * Code cleanup. + * + * Revision 1.10 1998/09/18 20:18:54 rassmann + * Added HW access. + * Implemented swapping. + * + * Revision 1.9 1998/09/16 11:32:00 rassmann + * Including skdrv1st.h again. :( + * + * Revision 1.8 1998/09/16 11:09:34 rassmann + * Syntax corrections. + * + * Revision 1.7 1998/09/14 17:06:34 rassmann + * Minor changes. + * + * Revision 1.6 1998/09/07 08:45:41 rassmann + * Syntax corrections. + * + * Revision 1.5 1998/09/04 19:40:19 rassmann + * Interface enhancements. + * + * Revision 1.4 1998/09/04 12:14:12 rassmann + * Interface cleanup. + * + * Revision 1.3 1998/09/02 16:56:40 rassmann + * Updated interface. + * + * Revision 1.2 1998/08/27 14:26:09 rassmann + * Updated interface. + * + * Revision 1.1 1998/08/21 08:30:22 rassmann + * First public version. + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This module is intended to manage multicast addresses, address override, + * and promiscuous mode on GEnesis adapters. + * + * Address Layout: + * port address: physical MAC address + * 1st exact match: logical MAC address + * 2nd exact match: RLMT multicast + * exact match 3-13: OS-specific multicasts + * + * Include File Hierarchy: + * + * "skdrv1st.h" + * "skdrv2nd.h" + * + ******************************************************************************/ + +#ifndef lint +static const char SysKonnectFileId[] = + "@(#) $Id: skaddr.c,v 1.33 1999/05/28 10:56:06 rassmann Exp $ (C) SysKonnect."; +#endif /* !defined(lint) */ + +#define __SKADDR_C + +#ifdef __cplusplus +xxxx /* not supported yet - force error */ +extern "C" { +#endif /* cplusplus */ + +#include "h/skdrv1st.h" +#include "h/skdrv2nd.h" + +/* defines ********************************************************************/ + +#define SK_ADDR_CHEAT YES /* Cheat. */ + +/* + * G32: + * POLY equ 04C11DB6h ; CRC polynominal term + * bit-reversed: 6DB88320 + */ + +#define CRC32_POLY 0xEDB88320UL /* CRC32-Poly - XMAC: Little Endian */ +#if 0 +#define CRC32_POLY 0x6DB88320UL /* CRC32-Poly - XMAC: Little Endian */ +#endif /* 0 */ +#define HASH_BITS 6 /* #bits in hash */ +#define SK_MC_BIT 0x01 + +/* Error numbers and messages. */ + +#define SKERR_ADDR_E001 (SK_ERRBASE_ADDR + 0) +#define SKERR_ADDR_E001MSG "Bad Flags." +#define SKERR_ADDR_E002 (SKERR_ADDR_E001 + 1) +#define SKERR_ADDR_E002MSG "New Error." + +/* typedefs *******************************************************************/ + +/* None. */ + +/* global variables ***********************************************************/ + +/* 64-bit hash values with all bits set. */ + +SK_U16 OnesHash[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; + +/* local variables ************************************************************/ + +#ifdef DEBUG +static int Next0[SK_MAX_MACS] = {0, 0}; +#endif /* DEBUG */ + +/* functions ******************************************************************/ + +#if 0 +void SkAddrDummy(void) +{ + SkAddrInit(NULL, NULL, 0); +} /* SkAddrDummy */ +#endif /* 0 */ + +/****************************************************************************** + * + * SkAddrInit - initialize data, set state to init + * + * Description: + * + * SK_INIT_DATA + * ============ + * + * This routine clears the multicast tables and resets promiscuous mode. + * Some entries are reserved for the "logical board address", the + * SK-RLMT multicast address, and the BPDU multicast address. + * + * + * SK_INIT_IO + * ========== + * + * All permanent MAC addresses are read from EPROM. + * If the current MAC addresses are not already set in software, + * they are set to the values of the permanent addresses. + * The current addresses are written to the corresponding XMAC. + * + * + * SK_INIT_RUN + * =========== + * + * Nothing. + * + * Context: + * init, pageable + * + * Returns: + * SK_ADDR_SUCCESS + */ +int SkAddrInit( +SK_AC *pAC, /* the adapter context */ +SK_IOC IoC, /* I/O context */ +int Level) /* initialization level */ +{ + int j; + SK_U32 i; + SK_U8 *InAddr; + SK_U16 *OutAddr; + SK_ADDR_PORT *pAPort; + + switch (Level) { + case SK_INIT_DATA: + SK_MEMSET((char *)&pAC->Addr, 0, sizeof(SK_ADDR)); + + for (i = 0; i < SK_MAX_MACS; i++) { + pAPort = &pAC->Addr.Port[i]; + pAPort->PromMode = SK_PROM_MODE_NONE; + + pAPort->FirstExactMatchRlmt = + SK_ADDR_FIRST_MATCH_RLMT; + pAPort->FirstExactMatchDrv = + SK_ADDR_FIRST_MATCH_DRV; + pAPort->NextExactMatchRlmt = + SK_ADDR_FIRST_MATCH_RLMT; + pAPort->NextExactMatchDrv = + SK_ADDR_FIRST_MATCH_DRV; + +#if 0 + /* Not here ... */ + + /* Reset Promiscuous mode. */ + + (void)SkAddrPromiscuousChange( + pAC, + IoC, + i, + SK_PROM_MODE_NONE); +#endif /* 0 */ + } + +#ifdef DEBUG + for (i = 0; i < SK_MAX_MACS; i++) { + if (pAC->Addr.Port[i].NextExactMatchRlmt < + SK_ADDR_FIRST_MATCH_RLMT) { + Next0[i] |= 4; + } + } +#endif /* DEBUG */ + + /* pAC->Addr.InitDone = SK_INIT_DATA; */ + break; + + case SK_INIT_IO: + pAC->Addr.ActivePort = pAC->Rlmt.MacActive; + +#ifdef DEBUG + for (i = 0; i < SK_MAX_MACS; i++) { + if (pAC->Addr.Port[i].NextExactMatchRlmt < + SK_ADDR_FIRST_MATCH_RLMT) { + Next0[i] |= 8; + } + } +#endif /* DEBUG */ + + /* Read permanent virtual address from Control Register File. */ + + for (j = 0; j < SK_MAC_ADDR_LEN; j++) { + InAddr = (SK_U8 *)&pAC->Addr.PermanentMacAddress.a[j]; + SK_IN8(IoC, B2_MAC_1 + j, InAddr); + } + + if (!pAC->Addr.CurrentMacAddressSet) { + /* + * Set the current virtual MAC address + * to the permanent one. + */ + + pAC->Addr.CurrentMacAddress = + pAC->Addr.PermanentMacAddress; + pAC->Addr.CurrentMacAddressSet = SK_TRUE; + } + + /* Set the current virtual MAC address. */ + + pAC->Addr.Port[pAC->Addr.ActivePort].Exact[0] = + pAC->Addr.CurrentMacAddress; + +#ifdef xDEBUG + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_INIT, + ("Permanent MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.PermanentMacAddress.a[0], + pAC->Addr.PermanentMacAddress.a[1], + pAC->Addr.PermanentMacAddress.a[2], + pAC->Addr.PermanentMacAddress.a[3], + pAC->Addr.PermanentMacAddress.a[4], + pAC->Addr.PermanentMacAddress.a[5])) + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_INIT, + ("Virtual MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.CurrentMacAddress.a[0], + pAC->Addr.CurrentMacAddress.a[1], + pAC->Addr.CurrentMacAddress.a[2], + pAC->Addr.CurrentMacAddress.a[3], + pAC->Addr.CurrentMacAddress.a[4], + pAC->Addr.CurrentMacAddress.a[5])) +#endif /* DEBUG */ + +#if 0 + /* Not here ... */ + + (void)SkAddrMcUpdate(pAC, IoC, pAC->Addr.ActivePort); +#endif /* 0 */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pAPort = &pAC->Addr.Port[i]; + + /* + * Read permanent port addresses from + * Control Register File. + */ + + for (j = 0; j < SK_MAC_ADDR_LEN; j++) { + InAddr = (SK_U8 *) + &pAPort->PermanentMacAddress.a[j]; + SK_IN8(IoC, B2_MAC_2 + 8 * i + j, InAddr); + } + + if (!pAPort->CurrentMacAddressSet) { + /* + * Set the current and previous physical + * MAC address of this port to its permanent + * MAC address. + */ + + pAPort->CurrentMacAddress = + pAPort->PermanentMacAddress; + pAPort->PreviousMacAddress = + pAPort->PermanentMacAddress; + pAPort->CurrentMacAddressSet = SK_TRUE; + } + + /* Set port's current MAC addresses. */ + + OutAddr = (SK_U16 *)&pAPort->CurrentMacAddress.a[0]; + XM_OUTADDR(IoC, i, XM_SA, OutAddr); + +#ifdef xDEBUG + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_INIT, + ("Permanent Physical MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAPort->PermanentMacAddress.a[0], + pAPort->PermanentMacAddress.a[1], + pAPort->PermanentMacAddress.a[2], + pAPort->PermanentMacAddress.a[3], + pAPort->PermanentMacAddress.a[4], + pAPort->PermanentMacAddress.a[5])) + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_INIT, + ("Phsical MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAPort->CurrentMacAddress.a[0], + pAPort->CurrentMacAddress.a[1], + pAPort->CurrentMacAddress.a[2], + pAPort->CurrentMacAddress.a[3], + pAPort->CurrentMacAddress.a[4], + pAPort->CurrentMacAddress.a[5])) +#endif /* DEBUG */ + } + /* pAC->Addr.InitDone = SK_INIT_IO; */ + break; + + case SK_INIT_RUN: +#ifdef DEBUG + for (i = 0; i < SK_MAX_MACS; i++) { + if (pAC->Addr.Port[i].NextExactMatchRlmt < + SK_ADDR_FIRST_MATCH_RLMT) { + Next0[i] |= 16; + } + } +#endif /* DEBUG */ + + /* pAC->Addr.InitDone = SK_INIT_RUN; */ + break; + + default: /* error */ + break; + } + + return (SK_ADDR_SUCCESS); +} /* SkAddrInit */ + + +/****************************************************************************** + * + * SkAddrMcClear - clear the multicast table + * + * Description: + * This routine clears the multicast table + * (either entry 2 or entries 3-16 and InexactFilter) of the given port. + * If not suppressed by Flag SK_MC_SW_ONLY, the hardware is updated + * immediately. + * + * Context: + * runtime, pageable + * may be called starting with SK_INIT_DATA with flag SK_MC_SW_ONLY + * may be called after SK_INIT_IO without limitation + * + * Returns: + * SK_ADDR_SUCCESS + * SK_ADDR_ILLEGAL_PORT + */ +int SkAddrMcClear( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* Index of affected port */ +int Flags) /* permanent/non-perm, sw-only */ +{ + int i; + + if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + if (Flags & SK_ADDR_PERMANENT) { + + /* Clear RLMT multicast addresses. */ + + pAC->Addr.Port[PortIdx].NextExactMatchRlmt = + SK_ADDR_FIRST_MATCH_RLMT; + } + else { /* not permanent => DRV */ + + /* Clear InexactFilter. */ + + for (i = 0; i < 8; i++) { + pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i] = 0; + } + + /* Clear DRV multicast addresses. */ + + pAC->Addr.Port[PortIdx].NextExactMatchDrv = + SK_ADDR_FIRST_MATCH_DRV; + } + + if (!(Flags & SK_MC_SW_ONLY)) { + (void)SkAddrMcUpdate(pAC, IoC, PortIdx); + } + + return (SK_ADDR_SUCCESS); +} /* SkAddrMcClear */ + +#ifndef SK_ADDR_CHEAT +// RA;:;: +/****************************************************************************** + * + * SkCrc32McHash - hash multicast address + * + * Description: + * This routine computes the hash value for a multicast address. + * + * Notes: + * The code was adapted from the XaQti data sheet. + * + * Context: + * runtime, pageable + * + * Returns: + * Hash value of multicast address. + */ +unsigned SkCrc32McHash( +unsigned char *pMc) /* Multicast address */ +{ + unsigned Idx; + unsigned Bit; + unsigned Data; + unsigned Crc; + + Crc = 0xFFFFFFFFUL; + for (Idx = 0; Idx < SK_MAC_ADDR_LEN; Idx++) { + Data = *pMc++; + for (Bit = 0; Bit < 8; Bit++, Data >>= 1) { + Crc = (Crc >> 1) ^ + (((Crc ^ Data) & 1) ? CRC32_POLY : 0); + } + } + + return (Crc & ((1 << HASH_BITS) - 1)); + +} /* SkCrc32McHash */ + +#endif /* not SK_ADDR_CHEAT */ + +/****************************************************************************** + * + * SkAddrMcAdd - add a multicast address to a port + * + * Description: + * This routine enables reception for a given address on the given port. + * + * Notes: + * The return code is only valid for SK_PROM_MODE_NONE. + * + * In the current version, only RLMT may add addresses to the non-active + * port. + * + * The multicast bit is only checked if there are no free exact match + * entries. + * + * Context: + * runtime, pageable + * may be called after SK_INIT_DATA + * + * Returns: + * SK_MC_FILTERING_EXACT + * SK_MC_FILTERING_INEXACT + * SK_MC_ILLEGAL_ADDRESS + * SK_MC_ILLEGAL_PORT + * SK_MC_RLMT_OVERFLOW + */ +int SkAddrMcAdd( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* Port Index */ +SK_MAC_ADDR *pMc, /* multicast address to be added */ +int Flags) /* permanent/non-permanent */ +{ + int i; + SK_U8 Inexact; +#ifndef SK_ADDR_CHEAT + unsigned HashBit; +#endif /* !defined(SK_ADDR_CHEAT) */ + + if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + if (Flags & SK_ADDR_PERMANENT) { +#ifdef DEBUG + if (pAC->Addr.Port[PortIdx].NextExactMatchRlmt < + SK_ADDR_FIRST_MATCH_RLMT) { + Next0[PortIdx] |= 1; + return (SK_MC_RLMT_OVERFLOW); + } +#endif /* DEBUG */ + + if (pAC->Addr.Port[PortIdx].NextExactMatchRlmt > + SK_ADDR_LAST_MATCH_RLMT) { + return (SK_MC_RLMT_OVERFLOW); + } + + /* Set an RLMT multicast address. */ + + pAC->Addr.Port[PortIdx].Exact[ + pAC->Addr.Port[PortIdx].NextExactMatchRlmt++] = *pMc; + + return (SK_MC_FILTERING_EXACT); + } + + /* Not PERMANENT => DRV */ + + if (PortIdx != pAC->Addr.ActivePort) { + + /* Only RLMT is allowed to do this. */ + + return (SK_MC_ILLEGAL_PORT); + } + +#ifdef DEBUG + if (pAC->Addr.Port[PortIdx].NextExactMatchDrv < + SK_ADDR_FIRST_MATCH_DRV) { + Next0[PortIdx] |= 2; + return (SK_MC_RLMT_OVERFLOW); + } +#endif /* DEBUG */ + + if (pAC->Addr.Port[PortIdx].NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) { + + /* Set exact match entry. */ + + pAC->Addr.Port[PortIdx].Exact[ + pAC->Addr.Port[PortIdx].NextExactMatchDrv++] = *pMc; + + /* Clear InexactFilter. */ + + for (i = 0; i < 8; i++) { + pAC->Addr.Port[PortIdx + ].InexactFilter.Bytes[i] = 0; + } + } + else { + if (!(pMc->a[0] & SK_MC_BIT)) { + + /* + * Hashing only possible with + * multicast addresses. + */ + + return (SK_MC_ILLEGAL_ADDRESS); + } +#ifndef SK_ADDR_CHEAT + /* Compute hash value of address. */ +RA;:;: untested + HashBit = SkCrc32McHash(&pMc->a[0]); + + /* Add bit to InexactFilter. */ + + pAC->Addr.Port[PortIdx].InexactFilter.Bytes[HashBit / 8] |= + 1 << (HashBit % 8); + +#else /* SK_ADDR_CHEAT */ + + /* Set all bits in InexactFilter. */ + + for (i = 0; i < 8; i++) { + pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i] = 0xFF; + } +#endif /* SK_ADDR_CHEAT */ + } + + for (Inexact = 0, i = 0; i < 8; i++) { + Inexact |= pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; + } + + if (Inexact == 0 && pAC->Addr.Port[PortIdx].PromMode == 0) { + return (SK_MC_FILTERING_EXACT); + } + else { + return (SK_MC_FILTERING_INEXACT); + } +} /* SkAddrMcAdd */ + + +/****************************************************************************** + * + * SkAddrMcUpdate - update the HW MC address table and set the MAC address + * + * Description: + * This routine enables reception of the addresses contained in a local + * table for a given port. + * It also programs the port's current physical MAC address. + * + * Notes: + * The return code is only valid for SK_PROM_MODE_NONE. + * + * Context: + * runtime, pageable + * may be called after SK_INIT_IO + * + * Returns: + * SK_MC_FILTERING_EXACT + * SK_MC_FILTERING_INEXACT + * SK_ADDR_ILLEGAL_PORT + */ +int SkAddrMcUpdate( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx) /* Port Index */ +{ + SK_U32 i; + SK_U8 Inexact; + SK_U16 *OutAddr; + SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Reg. */ + SK_ADDR_PORT *pAPort; + + if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_CTRL, + ("SkAddrMcUpdate on Port %u.\n", PortIdx)) + + pAPort = &pAC->Addr.Port[PortIdx]; + +#ifdef DEBUG + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_CTRL, + ("Next0 on Port %d: %d\n", PortIdx, Next0[PortIdx])) +#endif /* DEBUG */ + + for (i = 0; /* Also program the virtual address. */ + i < pAPort->NextExactMatchRlmt; + i++) { + + /* Set exact match address i on HW. */ + + OutAddr = (SK_U16 *)&pAPort->Exact[i].a[0]; + XM_OUTADDR(IoC, PortIdx, XM_EXM(i), OutAddr); + } + + /* Clear other permanent exact match addresses on HW. */ + + if (pAPort->NextExactMatchRlmt <= SK_ADDR_LAST_MATCH_RLMT) { + SkXmClrExactAddr( + pAC, + IoC, + PortIdx, + pAPort->NextExactMatchRlmt, + SK_ADDR_LAST_MATCH_RLMT); + } + + for (i = pAPort->FirstExactMatchDrv; + i < pAPort->NextExactMatchDrv; + i++) { + + OutAddr = (SK_U16 *)&pAPort->Exact[i].a[0]; + XM_OUTADDR(IoC, PortIdx, XM_EXM(i), OutAddr); + + } + + /* Clear other non-permanent exact match addresses on HW. */ + + if (pAPort->NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) { + SkXmClrExactAddr( + pAC, + IoC, + PortIdx, + pAPort->NextExactMatchDrv, + SK_ADDR_LAST_MATCH_DRV); + } + + for (Inexact = 0xFF, i = 0; i < 8; i++) { + Inexact &= pAPort->InexactFilter.Bytes[i]; + } + if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) { + + /* Set all bits in 64-bit hash register. */ + + XM_OUTHASH(IoC, PortIdx, XM_HSM, &OnesHash); + + /* Set bit 15 in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + LoMode |= XM_MD_ENA_HSH; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + else if (Inexact != 0xFF) { + + /* Clear bit 15 in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + LoMode &= ~XM_MD_ENA_HSH; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + else { + /* Set 64-bit hash register to InexactFilter. */ + + XM_OUTHASH( + IoC, + PortIdx, + XM_HSM, + &pAPort->InexactFilter.Bytes[0]); + + /* Set bit 15 in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + LoMode |= XM_MD_ENA_HSH; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + + if (pAPort->PromMode != SK_PROM_MODE_NONE) { + (void)SkAddrPromiscuousChange( + pAC, + IoC, + PortIdx, + pAPort->PromMode); + } + + /* Set port's current MAC address. */ + + OutAddr = (SK_U16 *)&pAPort->CurrentMacAddress.a[0]; + XM_OUTADDR(IoC, PortIdx, XM_SA, OutAddr); + +#ifdef DEBUG + for (i = 0; /* Also program the virtual address. */ + i < pAPort->NextExactMatchRlmt; + i++) { + SK_U8 InAddr8[6]; + SK_U16 *InAddr; + + /* Get exact match address i from port PortIdx. */ + + InAddr = (SK_U16 *)&InAddr8[0]; + XM_INADDR(IoC, PortIdx, XM_EXM(i), InAddr); + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("MC address %d on Port %u: %02x %02x %02x %02x %02x %02x -- %02x %02x %02x %02x %02x %02x.\n", + i, + PortIdx, + InAddr8[0], + InAddr8[1], + InAddr8[2], + InAddr8[3], + InAddr8[4], + InAddr8[5], + pAPort->Exact[i].a[0], + pAPort->Exact[i].a[1], + pAPort->Exact[i].a[2], + pAPort->Exact[i].a[3], + pAPort->Exact[i].a[4], + pAPort->Exact[i].a[5])) + } +#endif /* DEBUG */ + + /* Determine return value. */ + + for (Inexact = 0, i = 0; i < 8; i++) { + Inexact |= pAPort->InexactFilter.Bytes[i]; + } + if (Inexact == 0 && pAPort->PromMode == 0) { + return (SK_MC_FILTERING_EXACT); + } + else { + return (SK_MC_FILTERING_INEXACT); + } +} /* SkAddrMcUpdate */ + + +/****************************************************************************** + * + * SkAddrOverride - override a port's MAC address + * + * Description: + * This routine overrides the MAC address of one port. + * + * Context: + * runtime, pageable + * may be called after SK_INIT_IO + * + * Returns: + * SK_ADDR_SUCCESS if successful. + * SK_ADDR_DUPLICATE_ADDRESS if duplicate MAC address. + * SK_ADDR_MULTICAST_ADDRESS if multicast or broadcast address. + * SK_ADDR_TOO_EARLY if SK_INIT_IO was not executed before. + */ +int SkAddrOverride( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* Port Index */ +SK_MAC_ADDR *pNewAddr, /* new MAC address */ +int Flags) /* logical/physical address */ +{ + SK_U32 i; + SK_U16 *OutAddr; + SK_EVPARA Para; +#if 0 + SK_MAC_ADDR NewAddr; /* new MAC address */ + SK_U8 AddrBits; +#endif /* 0 */ + + if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + if (pNewAddr->a[0] & SK_MC_BIT) { + return (SK_ADDR_MULTICAST_ADDRESS); + } + +#if 0 +DANGEROUS! + if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical address. */ + if (!pAC->Addr.Port[PortIdx].CurrentMacAddressSet) { + pAC->Addr.Port[PortIdx].PreviousMacAddress = *pNewAddr; + pAC->Addr.Port[PortIdx].CurrentMacAddress = *pNewAddr; + pAC->Addr.Port[PortIdx].CurrentMacAddressSet = SK_TRUE; + return (SK_ADDR_SUCCESS); + } + } + else { + if (!pAC->Addr.CurrentMacAddressSet) { + pAC->Addr.CurrentMacAddress = *pNewAddr; + pAC->Addr.CurrentMacAddressSet = SK_TRUE; + return (SK_ADDR_SUCCESS); + } + } +DANGEROUS! +#endif /* 0 */ + + if (!pAC->Addr.CurrentMacAddressSet) { + return (SK_ADDR_TOO_EARLY); + } + + if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical address. */ + if (SK_ADDR_EQUAL(pNewAddr->a, pAC->Addr.CurrentMacAddress.a)) { + return (SK_ADDR_DUPLICATE_ADDRESS); + } + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (!pAC->Addr.Port[i].CurrentMacAddressSet) { + return (SK_ADDR_TOO_EARLY); + } + + if (SK_ADDR_EQUAL( + pNewAddr->a, + pAC->Addr.Port[i].CurrentMacAddress.a)) { + if (i == PortIdx) { + return (SK_ADDR_SUCCESS); + } + else { + return (SK_ADDR_DUPLICATE_ADDRESS); + } + } + } + + pAC->Addr.Port[PortIdx].PreviousMacAddress = + pAC->Addr.Port[PortIdx].CurrentMacAddress; + pAC->Addr.Port[PortIdx].CurrentMacAddress = *pNewAddr; + + /* Change port's address. */ + + OutAddr = (SK_U16 *)pNewAddr; + XM_OUTADDR(IoC, PortIdx, XM_SA, OutAddr); + + /* Report address change to RLMT. */ + + Para.Para32[0] = PortIdx; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_PORT_ADDR, Para); + } + else { /* Logical Address. */ + if (SK_ADDR_EQUAL(pNewAddr->a, pAC->Addr.CurrentMacAddress.a)) { + return (SK_ADDR_SUCCESS); + } + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (!pAC->Addr.Port[i].CurrentMacAddressSet) { + return (SK_ADDR_TOO_EARLY); + } + + if (SK_ADDR_EQUAL( + pNewAddr->a, + pAC->Addr.Port[i].CurrentMacAddress.a)) { + return (SK_ADDR_DUPLICATE_ADDRESS); + } + } + + pAC->Addr.CurrentMacAddress = *pNewAddr; + pAC->Addr.Port[PortIdx].Exact[0] = *pNewAddr; + +#ifdef DEBUG + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_CTRL, + ("Permanent MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.PermanentMacAddress.a[0], + pAC->Addr.PermanentMacAddress.a[1], + pAC->Addr.PermanentMacAddress.a[2], + pAC->Addr.PermanentMacAddress.a[3], + pAC->Addr.PermanentMacAddress.a[4], + pAC->Addr.PermanentMacAddress.a[5])) + SK_DBG_MSG( + pAC, + SK_DBGMOD_ADDR, + SK_DBGCAT_CTRL, + ("New Virtual MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.CurrentMacAddress.a[0], + pAC->Addr.CurrentMacAddress.a[1], + pAC->Addr.CurrentMacAddress.a[2], + pAC->Addr.CurrentMacAddress.a[3], + pAC->Addr.CurrentMacAddress.a[4], + pAC->Addr.CurrentMacAddress.a[5])) +#endif /* DEBUG */ + + /* Write address to first exact match entry of active port. */ + + (void)SkAddrMcUpdate(pAC, IoC, PortIdx); + } + + return (SK_ADDR_SUCCESS); +} /* SkAddrOverride */ + + +/****************************************************************************** + * + * SkAddrPromiscuousChange - set promiscuous mode for given port + * + * Description: + * This routine manages promiscuous mode: + * - none + * - all LLC frames + * - all MC frames + * + * Context: + * runtime, pageable + * may be called after SK_INIT_IO + * + * Returns: + * SK_ADDR_SUCCESS + * SK_ADDR_ILLEGAL_PORT + */ +int SkAddrPromiscuousChange( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* port whose promiscuous mode changes */ +int NewPromMode) /* new promiscuous mode */ +{ + int i; + SK_BOOL InexactModeBit; + SK_U8 Inexact; + SK_U8 HwInexact; + SK_FILTER64 HwInexactFilter; + SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Register. */ + int CurPromMode = SK_PROM_MODE_NONE; + + if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + /* Read CurPromMode from Hardware. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + + if (LoMode & XM_MD_ENA_PROM) { + CurPromMode |= SK_PROM_MODE_LLC; + } + + for (Inexact = 0xFF, i = 0; i < 8; i++) { + Inexact &= pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; + } + if (Inexact == 0xFF) { + CurPromMode |= (pAC->Addr.Port[PortIdx].PromMode & + SK_PROM_MODE_ALL_MC); + } + else { + /* Read InexactModeBit (bit 15 in mode register). */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + + InexactModeBit = (LoMode & XM_MD_ENA_HSH) != 0; + + /* Read 64-bit hash register from HW. */ + + XM_INHASH(IoC, PortIdx, XM_HSM, &HwInexactFilter.Bytes[0]); + + for (HwInexact = 0xFF, i = 0; i < 8; i++) { + HwInexact &= HwInexactFilter.Bytes[i]; + } + + if (InexactModeBit && (HwInexact == 0xFF)) { + CurPromMode |= SK_PROM_MODE_ALL_MC; + } + } + + pAC->Addr.Port[PortIdx].PromMode = NewPromMode; + + if (NewPromMode == CurPromMode) { + return (SK_ADDR_SUCCESS); + } + + if ((NewPromMode & SK_PROM_MODE_ALL_MC) && + !(CurPromMode & SK_PROM_MODE_ALL_MC)) { /* All MC. */ + + /* Set all bits in 64-bit hash register. */ + + XM_OUTHASH(IoC, PortIdx, XM_HSM, &OnesHash); + + /* Set bit 15 in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + LoMode |= XM_MD_ENA_HSH; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + else if ((CurPromMode & SK_PROM_MODE_ALL_MC) && + !(NewPromMode & SK_PROM_MODE_ALL_MC)) { /* Norm MC. */ + + for (Inexact = 0, i = 0; i < 8; i++) { + Inexact |= + pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; + } + if (Inexact == 0) { + /* Clear bit 15 in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + LoMode &= ~XM_MD_ENA_HSH; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + else { + /* Set 64-bit hash register to InexactFilter. */ + + XM_OUTHASH( + IoC, + PortIdx, + XM_HSM, + &pAC->Addr.Port[PortIdx + ].InexactFilter.Bytes[0]); + + /* Set bit 15 in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + LoMode |= XM_MD_ENA_HSH; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + } + + if ((NewPromMode & SK_PROM_MODE_LLC) && + !(CurPromMode & SK_PROM_MODE_LLC)) { /* Prom. LLC */ + + /* Set promiscuous bit in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); +#if 0 + /* Receive MAC frames. */ + + LoMode |= XM_MD_RX_MCTRL; +#endif /* 0 */ + LoMode |= XM_MD_ENA_PROM; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + else if ((CurPromMode & SK_PROM_MODE_LLC) && + !(NewPromMode & SK_PROM_MODE_LLC)) { /* Norm. LLC. */ + + /* Clear promiscuous bit in mode register. */ + + XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); +#if 0 + /* Don't receive MAC frames. */ + + LoMode &= ~XM_MD_RX_MCTRL; +#endif /* 0 */ + LoMode &= ~XM_MD_ENA_PROM; + XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); + } + + return (SK_ADDR_SUCCESS); +} /* SkAddrPromiscuousChange */ + + +/****************************************************************************** + * + * SkAddrSwap - swap address info + * + * Description: + * This routine swaps address info of two ports. + * + * Context: + * runtime, pageable + * may be called after SK_INIT_IO + * + * Returns: + * SK_ADDR_SUCCESS + * SK_ADDR_ILLEGAL_PORT + */ +int SkAddrSwap( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 FromPortIdx, /* Port1 Index */ +SK_U32 ToPortIdx) /* Port2 Index */ +{ + int i; + SK_U8 Byte; + SK_MAC_ADDR MacAddr; + SK_U32 DWord; + + if (FromPortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + if (ToPortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { + return (SK_ADDR_ILLEGAL_PORT); + } + + /* + * Swap + * - Exact Match Entries + * - FirstExactMatchRlmt; + * - NextExactMatchRlmt; + * - FirstExactMatchDrv; + * - NextExactMatchDrv; + * - 64-bit filter + * - Promiscuous Mode + * of ports. + */ + + for (i = 0; i < SK_ADDR_EXACT_MATCHES; i++) { + MacAddr = pAC->Addr.Port[FromPortIdx].Exact[i]; + pAC->Addr.Port[FromPortIdx].Exact[i] = + pAC->Addr.Port[ToPortIdx].Exact[i]; + pAC->Addr.Port[ToPortIdx].Exact[i] = MacAddr; + } + + for (i = 0; i < 8; i++) { + Byte = pAC->Addr.Port[FromPortIdx].InexactFilter.Bytes[i]; + pAC->Addr.Port[FromPortIdx].InexactFilter.Bytes[i] = + pAC->Addr.Port[ToPortIdx].InexactFilter.Bytes[i]; + pAC->Addr.Port[ToPortIdx].InexactFilter.Bytes[i] = Byte; + } + + i = pAC->Addr.Port[FromPortIdx].PromMode; + pAC->Addr.Port[FromPortIdx].PromMode = + pAC->Addr.Port[ToPortIdx].PromMode; + pAC->Addr.Port[ToPortIdx].PromMode = i; + + DWord = pAC->Addr.Port[FromPortIdx].FirstExactMatchRlmt; + pAC->Addr.Port[FromPortIdx].FirstExactMatchRlmt = + pAC->Addr.Port[ToPortIdx].FirstExactMatchRlmt; + pAC->Addr.Port[ToPortIdx].FirstExactMatchRlmt = DWord; + + DWord = pAC->Addr.Port[FromPortIdx].NextExactMatchRlmt; + pAC->Addr.Port[FromPortIdx].NextExactMatchRlmt = + pAC->Addr.Port[ToPortIdx].NextExactMatchRlmt; + pAC->Addr.Port[ToPortIdx].NextExactMatchRlmt = DWord; + + DWord = pAC->Addr.Port[FromPortIdx].FirstExactMatchDrv; + pAC->Addr.Port[FromPortIdx].FirstExactMatchDrv = + pAC->Addr.Port[ToPortIdx].FirstExactMatchDrv; + pAC->Addr.Port[ToPortIdx].FirstExactMatchDrv = DWord; + + DWord = pAC->Addr.Port[FromPortIdx].NextExactMatchDrv; + pAC->Addr.Port[FromPortIdx].NextExactMatchDrv = + pAC->Addr.Port[ToPortIdx].NextExactMatchDrv; + pAC->Addr.Port[ToPortIdx].NextExactMatchDrv = DWord; + + pAC->Addr.ActivePort = ToPortIdx; + + (void)SkAddrMcUpdate(pAC, IoC, FromPortIdx); + (void)SkAddrMcUpdate(pAC, IoC, ToPortIdx); + + return (SK_ADDR_SUCCESS); +} /* SkAddrSwap */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skcsum.c linux/drivers/net/sk98lin/skcsum.c --- v2.3.28/linux/drivers/net/sk98lin/skcsum.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skcsum.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,847 @@ +/****************************************************************************** + * + * Name: skcsum.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.3 $ + * Date: $Date: 1999/05/10 08:39:33 $ + * Purpose: Store/verify Internet checksum in send/receive packets. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skcsum.c,v $ + * Revision 1.3 1999/05/10 08:39:33 mkarl + * prevent overflows in SKCS_HTON16 + * fixed a bug in pseudo header checksum calculation + * added some comments + * + * Revision 1.2 1998/10/22 11:53:28 swolf + * Now using SK_DBG_MSG. + * + * Revision 1.1 1998/09/01 15:35:41 swolf + * initial revision + * + * 13-May-1998 sw Created. + * + ******************************************************************************/ + +#ifdef SK_USE_CSUM /* Check if CSUM is to be used. */ + +#ifndef lint +static const char SysKonnectFileId[] = "@(#)" + "$Id: skcsum.c,v 1.3 1999/05/10 08:39:33 mkarl Exp $" + " (C) SysKonnect."; +#endif /* !lint */ + +/****************************************************************************** + * + * Description: + * + * This is the "GEnesis" common module "CSUM". + * + * This module contains the code necessary to calculate, store, and verify the + * Internet Checksum of IP, TCP, and UDP frames. + * + * "GEnesis" is an abbreviation of "Gigabit Ethernet Network System in Silicon" + * and is the code name of this SysKonnect project. + * + * Compilation Options: + * + * SK_USE_CSUM - Define if CSUM is to be used. Otherwise, CSUM will be an + * empty module. + * + * SKCS_OVERWRITE_PROTO - Define to overwrite the default protocol id + * definitions. In this case, all SKCS_PROTO_xxx definitions must be made + * external. + * + * SKCS_OVERWRITE_STATUS - Define to overwrite the default return status + * definitions. In this case, all SKCS_STATUS_xxx definitions must be made + * external. + * + * Include File Hierarchy: + * + * "h/skdrv1st.h" + * "h/skcsum.h" + * "h/sktypes.h" + * "h/skqueue.h" + * "h/skdrv2nd.h" + * + ******************************************************************************/ + +#include "h/skdrv1st.h" +#include "h/skcsum.h" +#include "h/skdrv2nd.h" + +/* defines ********************************************************************/ + +/* The size of an Ethernet MAC header. */ +#define SKCS_ETHERNET_MAC_HEADER_SIZE (6+6+2) + +/* The size of the used topology's MAC header. */ +#define SKCS_MAC_HEADER_SIZE SKCS_ETHERNET_MAC_HEADER_SIZE + +/* The size of the IP header without any option fields. */ +#define SKCS_IP_HEADER_SIZE 20 + +/* + * Field offsets within the IP header. + */ + +/* "Internet Header Version" and "Length". */ +#define SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH 0 + +/* "Total Length". */ +#define SKCS_OFS_IP_TOTAL_LENGTH 2 + +/* "Flags" "Fragment Offset". */ +#define SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET 6 + +/* "Next Level Protocol" identifier. */ +#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL 9 + +/* Source IP address. */ +#define SKCS_OFS_IP_SOURCE_ADDRESS 12 + +/* Destination IP address. */ +#define SKCS_OFS_IP_DESTINATION_ADDRESS 16 + +/* IP "Next Level Protocol" identifiers (see RFC 790). */ +#define SKCS_PROTO_ID_TCP 6 /* Transport Control Protocol */ +#define SKCS_PROTO_ID_UDP 17 /* User Datagram Protocol */ + +/* IP "Don't Fragment" bit. */ +#define SKCS_IP_DONT_FRAGMENT SKCS_HTON16(0x4000) + +/* Add a byte offset to a pointer. */ +#define SKCS_IDX(pPtr, Ofs) ((void *) ((char *) (pPtr) + (Ofs))) + +/* + * Macros that convert host to network representation and vice versa, i.e. + * little/big endian conversion on little endian machines only. + */ +#ifdef SK_LITTLE_ENDIAN +#define SKCS_HTON16(Val16) (((unsigned) (Val16) >> 8) | (((Val16) & 0xFF) << 8)) +#endif /* SK_LITTLE_ENDIAN */ +#ifdef SK_BIG_ENDIAN +#define SKCS_HTON16(Val16) (Val16) +#endif /* SK_BIG_ENDIAN */ +#define SKCS_NTOH16(Val16) SKCS_HTON16(Val16) + +/* typedefs *******************************************************************/ + +/* function prototypes ********************************************************/ + +/****************************************************************************** + * + * SkCsGetSendInfo - get checksum information for a send packet + * + * Description: + * Get all checksum information necessary to send a TCP or UDP packet. The + * function checks the IP header passed to it. If the high-level protocol + * is either TCP or UDP the pseudo header checksum is calculated and + * returned. + * + * The function returns the total length of the IP header (including any + * IP option fields), which is the same as the start offset of the IP data + * which in turn is the start offset of the TCP or UDP header. + * + * The function also returns the TCP or UDP pseudo header checksum, which + * should be used as the start value for the hardware checksum calculation. + * (Note that any actual pseudo header checksum can never calculate to + * zero.) + * + * Note: + * There is a bug in the ASIC whic may lead to wrong checksums. + * + * Arguments: + * pAc - A pointer to the adapter context struct. + * + * pIpHeader - Pointer to IP header. Must be at least the IP header *not* + * including any option fields, i.e. at least 20 bytes. + * + * Note: This pointer will be used to address 8-, 16-, and 32-bit + * variables with the respective alignment offsets relative to the pointer. + * Thus, the pointer should point to a 32-bit aligned address. If the + * target system cannot address 32-bit variables on non 32-bit aligned + * addresses, then the pointer *must* point to a 32-bit aligned address. + * + * pPacketInfo - A pointer to the packet information structure for this + * packet. Before calling this SkCsGetSendInfo(), the following field must + * be initialized: + * + * ProtocolFlags - Initialize with any combination of + * SKCS_PROTO_XXX bit flags. SkCsGetSendInfo() will only work on + * the protocols specified here. Any protocol(s) not specified + * here will be ignored. + * + * Note: Only one checksum can be calculated in hardware. Thus, if + * SKCS_PROTO_IP is specified in the 'ProtocolFlags', + * SkCsGetSendInfo() must calculate the IP header checksum in + * software. It might be a better idea to have the calling + * protocol stack calculate the IP header checksum. + * + * Returns: N/A + * On return, the following fields in 'pPacketInfo' may or may not have + * been filled with information, depending on the protocol(s) found in the + * packet: + * + * ProtocolFlags - Returns the SKCS_PROTO_XXX bit flags of the protocol(s) + * that were both requested by the caller and actually found in the packet. + * Protocol(s) not specified by the caller and/or not found in the packet + * will have their respective SKCS_PROTO_XXX bit flags reset. + * + * Note: For IP fragments, TCP and UDP packet information is ignored. + * + * IpHeaderLength - The total length in bytes of the complete IP header + * including any option fields is returned here. This is the start offset + * of the IP data, i.e. the TCP or UDP header if present. + * + * IpHeaderChecksum - If IP has been specified in the 'ProtocolFlags', the + * 16-bit Internet Checksum of the IP header is returned here. This value + * is to be stored into the packet's 'IP Header Checksum' field. + * + * PseudoHeaderChecksum - If this is a TCP or UDP packet and if TCP or UDP + * has been specified in the 'ProtocolFlags', the 16-bit Internet Checksum + * of the TCP or UDP pseudo header is returned here. + */ +void SkCsGetSendInfo( +SK_AC *pAc, /* Adapter context struct. */ +void *pIpHeader, /* IP header. */ +SKCS_PACKET_INFO *pPacketInfo) /* Packet information struct. */ +{ + /* Internet Header Version found in IP header. */ + unsigned InternetHeaderVersion; + + /* Length of the IP header as found in IP header. */ + unsigned IpHeaderLength; + + /* Bit field specifiying the desired/found protocols. */ + unsigned ProtocolFlags; + + /* Next level protocol identifier found in IP header. */ + unsigned NextLevelProtocol; + + /* Length of IP data portion. */ + unsigned IpDataLength; + + /* TCP/UDP pseudo header checksum. */ + unsigned long PseudoHeaderChecksum; + + /* Pointer to next level protocol statistics structure. */ + SKCS_PROTO_STATS *NextLevelProtoStats; + + /* Temporary variable. */ + unsigned Tmp; + + Tmp = *(SK_U8 *) + SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH); + + /* Get the Internet Header Version (IHV). */ + /* Note: The IHV is stored in the upper four bits. */ + + InternetHeaderVersion = Tmp >> 4; + + /* Check the Internet Header Version. */ + /* Note: We currently only support IP version 4. */ + + if (InternetHeaderVersion != 4) { /* IPv4? */ + SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX, + ("Tx: Unknown Internet Header Version %u.\n", + InternetHeaderVersion)); + pPacketInfo->ProtocolFlags = 0; + pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].TxUnableCts++; + return; + } + + /* Get the IP header length (IHL). */ + /* + * Note: The IHL is stored in the lower four bits as the number of + * 4-byte words. + */ + + IpHeaderLength = (Tmp & 0xf) * 4; + pPacketInfo->IpHeaderLength = IpHeaderLength; + + /* Check the IP header length. */ + + /* 04-Aug-1998 sw - Really check the IHL? Necessary? */ + + if (IpHeaderLength < 5*4) { + SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX, + ("Tx: Invalid IP Header Length %u.\n", IpHeaderLength)); + pPacketInfo->ProtocolFlags = 0; + pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].TxUnableCts++; + return; + } + + /* This is an IPv4 frame with a header of valid length. */ + + pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].TxOkCts++; + + /* Check if we should calculate the IP header checksum. */ + + ProtocolFlags = pPacketInfo->ProtocolFlags; + + if (ProtocolFlags & SKCS_PROTO_IP) { + pPacketInfo->IpHeaderChecksum = + SkCsCalculateChecksum(pIpHeader, IpHeaderLength); + } + + /* Get the next level protocol identifier. */ + + NextLevelProtocol = + *(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); + + /* + * Check if this is a TCP or UDP frame and if we should calculate the + * TCP/UDP pseudo header checksum. + * + * Also clear all protocol bit flags of protocols not present in the + * frame. + */ + + if ((ProtocolFlags & SKCS_PROTO_TCP) != 0 && + NextLevelProtocol == SKCS_PROTO_ID_TCP) { + /* TCP/IP frame. */ + ProtocolFlags &= SKCS_PROTO_TCP | SKCS_PROTO_IP; + NextLevelProtoStats = + &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_TCP]; + } + else if ((ProtocolFlags & SKCS_PROTO_UDP) != 0 && + NextLevelProtocol == SKCS_PROTO_ID_UDP) { + /* UDP/IP frame. */ + ProtocolFlags &= SKCS_PROTO_UDP | SKCS_PROTO_IP; + NextLevelProtoStats = + &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_UDP]; + } + else { + /* + * Either not a TCP or UDP frame and/or TCP/UDP processing not + * specified. + */ + pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP; + return; + } + + /* Check if this is an IP fragment. */ + + /* + * Note: An IP fragment has a non-zero "Fragment Offset" field and/or + * the "More Fragments" bit set. Thus, if both the "Fragment Offset" + * and the "More Fragments" are zero, it is *not* a fragment. We can + * easily check both at the same time since they are in the same 16-bit + * word. + */ + + if ((*(SK_U16 *) + SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) & + ~SKCS_IP_DONT_FRAGMENT) != 0) { + /* IP fragment; ignore all other protocols. */ + pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP; + NextLevelProtoStats->TxUnableCts++; + return; + } + + /* + * Calculate the TCP/UDP pseudo header checksum. + */ + + /* Get total length of IP header and data. */ + + IpDataLength = + *(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH); + + /* Get length of IP data portion. */ + + IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength; + + /* Calculate the sum of all pseudo header fields (16-bit). */ + + PseudoHeaderChecksum = + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_SOURCE_ADDRESS + 0) + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_SOURCE_ADDRESS + 2) + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_DESTINATION_ADDRESS + 0) + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_DESTINATION_ADDRESS + 2) + + (unsigned long) (NextLevelProtocol << 8) + + (unsigned long) SKCS_HTON16(IpDataLength); + + /* Add-in any carries. */ + + SKCS_OC_ADD(PseudoHeaderChecksum, PseudoHeaderChecksum, 0); + + /* Add-in any new carry. */ + + SKCS_OC_ADD(pPacketInfo->PseudoHeaderChecksum, PseudoHeaderChecksum, 0); + + NextLevelProtoStats->TxOkCts++; /* Success. */ +} + +/****************************************************************************** + * + * SkCsGetReceiveInfo - verify checksum information for a received packet + * + * Description: + * Verify a received frame's checksum. The function returns a status code + * reflecting the result of the verification. + * + * Note: + * Before calling this function you have to verify that the frame is + * not padded and Checksum1 and Checksum2 are bigger than 1. + * + * Arguments: + * pAc - Pointer to adapter context struct. + * + * pIpHeader - Pointer to IP header. Must be at least the length in bytes + * of the received IP header including any option fields. + * + * Note: The actual length of the IP header is stored in the lower four + * bits of the first octet of the IP header as the number of 4-byte words, + * so it must be multiplied by four to get the length in bytes. Thus, the + * maximum IP header length is 15 * 4 = 60 bytes. + * + * Checksum1 - The first 16-bit Internet Checksum calculated by the + * hardware starting at the offset returned by SkCsSetReceiveFlags(). + * + * Checksum2 - The second 16-bit Internet Checksum calculated by the + * hardware starting at the offset returned by SkCsSetReceiveFlags(). + * + * Returns: + * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. + * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. + * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). + * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). + * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). + * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). + * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. + * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. + * + * Note: The SKCS_STATUS_XXX values returned here are *not* defined by + * the CSUM module but must be defined in some header file by the module + * using CSUM. In this way, the calling module can assign return values + * for its own needs, e.g. by assigning bit flags to the individual + * protocols. + */ +SKCS_STATUS SkCsGetReceiveInfo( +SK_AC *pAc, /* Adapter context struct. */ +void *pIpHeader, /* IP header. */ +unsigned Checksum1, /* Hardware checksum 1. */ +unsigned Checksum2) /* Hardware checksum 2. */ +{ + /* Internet Header Version found in IP header. */ + unsigned InternetHeaderVersion; + + /* Length of the IP header as found in IP header. */ + unsigned IpHeaderLength; + + /* Length of IP data portion. */ + unsigned IpDataLength; + + /* IP header checksum. */ + unsigned IpHeaderChecksum; + + /* IP header options checksum, if any. */ + unsigned IpOptionsChecksum; + + /* IP data checksum, i.e. TCP/UDP checksum. */ + unsigned IpDataChecksum; + + /* Next level protocol identifier found in IP header. */ + unsigned NextLevelProtocol; + + /* The checksum of the "next level protocol", i.e. TCP or UDP. */ + unsigned long NextLevelProtocolChecksum; + + /* Pointer to next level protocol statistics structure. */ + SKCS_PROTO_STATS *NextLevelProtoStats; + + /* Temporary variable. */ + unsigned Tmp; + + Tmp = *(SK_U8 *) + SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH); + + /* Get the Internet Header Version (IHV). */ + /* Note: The IHV is stored in the upper four bits. */ + + InternetHeaderVersion = Tmp >> 4; + + /* Check the Internet Header Version. */ + /* Note: We currently only support IP version 4. */ + + if (InternetHeaderVersion != 4) { /* IPv4? */ + SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_RX, + ("Rx: Unknown Internet Header Version %u.\n", + InternetHeaderVersion)); + pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].RxUnableCts++; + return (SKCS_STATUS_UNKNOWN_IP_VERSION); + } + + /* Get the IP header length (IHL). */ + /* + * Note: The IHL is stored in the lower four bits as the number of + * 4-byte words. + */ + + IpHeaderLength = (Tmp & 0xf) * 4; + + /* Check the IP header length. */ + + /* 04-Aug-1998 sw - Really check the IHL? Necessary? */ + + if (IpHeaderLength < 5*4) { + SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_RX, + ("Rx: Invalid IP Header Length %u.\n", IpHeaderLength)); + pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].RxErrCts++; + return (SKCS_STATUS_IP_CSUM_ERROR); + } + + /* This is an IPv4 frame with a header of valid length. */ + + /* Get the IP header and data checksum. */ + + IpDataChecksum = Checksum2; + + /* + * The IP header checksum is calculated as follows: + * + * IpHeaderChecksum = Checksum1 - Checksum2 + */ + + SKCS_OC_SUB(IpHeaderChecksum, Checksum1, Checksum2); + + /* Check if any IP header options. */ + + if (IpHeaderLength > SKCS_IP_HEADER_SIZE) { + + /* Get the IP options checksum. */ + + IpOptionsChecksum = SkCsCalculateChecksum( + SKCS_IDX(pIpHeader, SKCS_IP_HEADER_SIZE), + IpHeaderLength - SKCS_IP_HEADER_SIZE); + + /* Adjust the IP header and IP data checksums. */ + + SKCS_OC_ADD(IpHeaderChecksum, + IpHeaderChecksum, IpOptionsChecksum); + + SKCS_OC_SUB(IpDataChecksum, + IpDataChecksum, IpOptionsChecksum); + } + + /* Check if the IP header checksum is ok. */ + /* + * NOTE: We must check the IP header checksum even if the caller does + * not want us to do so because we cannot do any further processing of + * the packet without a valid IP checksum. + */ + + if (IpHeaderChecksum != 0xFFFF) { + pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].RxErrCts++; + return (SKCS_STATUS_IP_CSUM_ERROR); + } + + /* Get the next level protocol identifier. */ + + NextLevelProtocol = + *(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); + + /* + * Check if this is a TCP or UDP frame and if we should calculate the + * TCP/UDP pseudo header checksum. + * + * Also clear all protocol bit flags of protocols not present in the + * frame. + */ + + if ((pAc->Csum.ReceiveFlags & SKCS_PROTO_TCP) != 0 && + NextLevelProtocol == SKCS_PROTO_ID_TCP) { + /* TCP/IP frame. */ + NextLevelProtoStats = + &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_TCP]; + } + else if ((pAc->Csum.ReceiveFlags & SKCS_PROTO_UDP) != 0 && + NextLevelProtocol == SKCS_PROTO_ID_UDP) { + /* UDP/IP frame. */ + NextLevelProtoStats = + &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_UDP]; + } + else { + /* + * Either not a TCP or UDP frame and/or TCP/UDP processing not + * specified. + */ + return (SKCS_STATUS_IP_CSUM_OK); + } + + /* Check if this is an IP fragment. */ + + /* + * Note: An IP fragment has a non-zero "Fragment Offset" field and/or + * the "More Fragments" bit set. Thus, if both the "Fragment Offset" + * and the "More Fragments" are zero, it is *not* a fragment. We can + * easily check both at the same time since they are in the same 16-bit + * word. + */ + + if ((*(SK_U16 *) + SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) & + ~SKCS_IP_DONT_FRAGMENT) != 0) { + /* IP fragment; ignore all other protocols. */ + NextLevelProtoStats->RxUnableCts++; + return (SKCS_STATUS_IP_FRAGMENT); + } + + /* + * Calculate the TCP/UDP checksum. + */ + + /* Get total length of IP header and data. */ + + IpDataLength = + *(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH); + + /* Get length of IP data portion. */ + + IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength; + + NextLevelProtocolChecksum = + + /* Calculate the pseudo header checksum. */ + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_SOURCE_ADDRESS + 0) + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_SOURCE_ADDRESS + 2) + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_DESTINATION_ADDRESS + 0) + + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, + SKCS_OFS_IP_DESTINATION_ADDRESS + 2) + + (unsigned long) (NextLevelProtocol << 8) + + (unsigned long) SKCS_HTON16(IpDataLength) + + + /* Add the TCP/UDP header checksum. */ + + (unsigned long) IpDataChecksum; + + /* Add-in any carries. */ + + SKCS_OC_ADD(NextLevelProtocolChecksum, NextLevelProtocolChecksum, 0); + + /* Add-in any new carry. */ + + SKCS_OC_ADD(NextLevelProtocolChecksum, NextLevelProtocolChecksum, 0); + + /* Check if the TCP/UDP checksum is ok. */ + + if ((unsigned) NextLevelProtocolChecksum == 0xFFFF) { + + /* TCP/UDP checksum ok. */ + + NextLevelProtoStats->RxOkCts++; + + return (NextLevelProtocol == SKCS_PROTO_ID_TCP ? + SKCS_STATUS_TCP_CSUM_OK : SKCS_STATUS_UDP_CSUM_OK); + } + + /* TCP/UDP checksum error. */ + + NextLevelProtoStats->RxErrCts++; + + return (NextLevelProtocol == SKCS_PROTO_ID_TCP ? + SKCS_STATUS_TCP_CSUM_ERROR : SKCS_STATUS_UDP_CSUM_ERROR); +} + +/****************************************************************************** + * + * SkCsSetReceiveFlags - set checksum receive flags + * + * Description: + * Use this function to set the various receive flags. According to the + * protocol flags set by the caller, the start offsets within received + * packets of the two hardware checksums are returned. These offsets must + * be stored in all receive descriptors. + * + * Arguments: + * pAc - Pointer to adapter context struct. + * + * ReceiveFlags - Any combination of SK_PROTO_XXX flags of the protocols + * for which the caller wants checksum information on received frames. + * + * pChecksum1Offset - The start offset of the first receive descriptor + * hardware checksum to be calculated for received frames is returned + * here. + * + * pChecksum2Offset - The start offset of the second receive descriptor + * hardware checksum to be calculated for received frames is returned + * here. + * + * Returns: N/A + * Returns the two hardware checksum start offsets. + */ +void SkCsSetReceiveFlags( +SK_AC *pAc, /* Adapter context struct. */ +unsigned ReceiveFlags, /* New receive flags. */ +unsigned *pChecksum1Offset, /* Offset for hardware checksum 1. */ +unsigned *pChecksum2Offset) /* Offset for hardware checksum 2. */ +{ + /* Save the receive flags. */ + + pAc->Csum.ReceiveFlags = ReceiveFlags; + + /* First checksum start offset is the IP header. */ + *pChecksum1Offset = SKCS_MAC_HEADER_SIZE; + + /* + * Second checksum start offset is the IP data. Note that this may vary + * if there are any IP header options in the actual packet. + */ + *pChecksum2Offset = SKCS_MAC_HEADER_SIZE + SKCS_IP_HEADER_SIZE; +} + +#ifndef SkCsCalculateChecksum +/****************************************************************************** + * + * SkCsCalculateChecksum - calculate checksum for specified data + * + * Description: + * Calculate and return the 16-bit Internet Checksum for the specified + * data. + * + * Arguments: + * pData - Pointer to data for which the checksum shall be calculated. + * Note: The pointer should be aligned on a 16-bit boundary. + * + * Length - Length in bytes of data to checksum. + * + * Returns: + * The 16-bit Internet Checksum for the specified data. + * + * Note: The checksum is calculated in the machine's natural byte order, + * i.e. little vs. big endian. Thus, the resulting checksum is different + * for the same input data on little and big endian machines. + * + * However, when written back to the network packet, the byte order is + * always in correct network order. + */ +unsigned SkCsCalculateChecksum( +void *pData, /* Data to checksum. */ +unsigned Length) /* Length of data. */ +{ + SK_U16 *pU16; /* Pointer to the data as 16-bit words. */ + unsigned long Checksum; /* Checksum; must be at least 32 bits. */ + + /* Sum up all 16-bit words. */ + + pU16 = (SK_U16 *) pData; + for (Checksum = 0; Length > 1; Length -= 2) { + Checksum += *pU16++; + } + + /* If this is an odd number of bytes, add-in the last byte. */ + + if (Length > 0) { +#ifdef SK_BIG_ENDIAN + /* Add the last byte as the high byte. */ + Checksum += ((unsigned) *(SK_U8 *) pU16) << 8; +#else /* !SK_BIG_ENDIAN */ + /* Add the last byte as the low byte. */ + Checksum += *(SK_U8 *) pU16; +#endif /* !SK_BIG_ENDIAN */ + } + + /* Add-in any carries. */ + + SKCS_OC_ADD(Checksum, Checksum, 0); + + /* Add-in any new carry. */ + + SKCS_OC_ADD(Checksum, Checksum, 0); + + /* Note: All bits beyond the 16-bit limit are now zero. */ + + return ((unsigned) Checksum); +} +#endif /* SkCsCalculateChecksum */ + +/****************************************************************************** + * + * SkCsEvent - the CSUM event dispatcher + * + * Description: + * This is the event handler for the CSUM module. + * + * Arguments: + * pAc - Pointer to adapter context. + * + * Ioc - I/O context. + * + * Event - Event id. + * + * Param - Event dependent parameter. + * + * Returns: + * The 16-bit Internet Checksum for the specified data. + * + * Note: The checksum is calculated in the machine's natural byte order, + * i.e. little vs. big endian. Thus, the resulting checksum is different + * for the same input data on little and big endian machines. + * + * However, when written back to the network packet, the byte order is + * always in correct network order. + */ +int SkCsEvent( +SK_AC *pAc, /* Pointer to adapter context. */ +SK_IOC Ioc, /* I/O context. */ +SK_U32 Event, /* Event id. */ +SK_EVPARA Param) /* Event dependent parameter. */ +{ + int ProtoIndex; + + switch (Event) { + /* + * Clear protocol statistics. + * + * Param - Protocol index, or -1 for all protocols. + */ + case SK_CSUM_EVENT_CLEAR_PROTO_STATS: + + ProtoIndex = (int) Param.Para32[0]; + if (ProtoIndex < 0) { /* Clear for all protocols. */ + memset(&pAc->Csum.ProtoStats[0], 0, + sizeof(pAc->Csum.ProtoStats)); + } + else { /* Clear for individual protocol. */ + memset(&pAc->Csum.ProtoStats[ProtoIndex], 0, + sizeof(pAc->Csum.ProtoStats[ProtoIndex])); + } + break; + default: + break; + } + return (0); /* Success. */ +} + +#endif /* SK_USE_CSUM */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skge.c linux/drivers/net/sk98lin/skge.c --- v2.3.28/linux/drivers/net/sk98lin/skge.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skge.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,3676 @@ +/****************************************************************************** + * + * Name: skge.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.25 $ + * Date: $Date: 1999/10/07 14:47:52 $ + * Purpose: The main driver source module + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * Driver for SysKonnect Gigabit Ethernet Server Adapters: + * + * SK-9841 (single link 1000Base-LX) + * SK-9842 (dual link 1000Base-LX) + * SK-9843 (single link 1000Base-SX) + * SK-9844 (dual link 1000Base-SX) + * SK-9821 (single link 1000Base-T) + * SK-9822 (dual link 1000Base-T) + * + * Created 10-Feb-1999, based on Linux' acenic.c, 3c59x.c and + * SysKonnects GEnesis Solaris driver + * Author: Christoph Goos (cgoos@syskonnect.de) + * + * Address all question to: linux@syskonnect.de + * + * The technical manual for the adapters is available from SysKonnect's + * web pages: www.syskonnect.com + * Goto "Support" and search Knowledge Base for "manual". + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skge.c,v $ + * Revision 1.25 1999/10/07 14:47:52 cgoos + * Changed 984x to 98xx. + * + * Revision 1.24 1999/09/30 07:21:01 cgoos + * Removed SK_RLMT_SLOW_LOOKAHEAD option. + * Giving spanning tree packets also to OS now. + * + * Revision 1.23 1999/09/29 07:36:50 cgoos + * Changed assignment for IsBc/IsMc. + * + * Revision 1.22 1999/09/28 12:57:09 cgoos + * Added CheckQueue also to Single-Port-ISR. + * + * Revision 1.21 1999/09/28 12:42:41 cgoos + * Changed parameter strings for RlmtMode. + * + * Revision 1.20 1999/09/28 12:37:57 cgoos + * Added CheckQueue for fast delivery of RLMT frames. + * + * Revision 1.19 1999/09/16 07:57:25 cgoos + * Copperfield changes. + * + * Revision 1.18 1999/09/03 13:06:30 cgoos + * Fixed RlmtMode=CheckSeg bug: wrong DEV_KFREE_SKB in RLMT_SEND caused + * double allocated skb's. + * FrameStat in ReceiveIrq was accessed via wrong Rxd. + * Queue size for async. standby Tx queue was zero. + * FillRxLimit of 0 could cause problems with ReQueue, changed to 1. + * Removed debug output of checksum statistic. + * + * Revision 1.17 1999/08/11 13:55:27 cgoos + * Transmit descriptor polling was not reenabled after SkGePortInit. + * + * Revision 1.16 1999/07/27 15:17:29 cgoos + * Added some "\n" in output strings (removed while debuging...). + * + * Revision 1.15 1999/07/23 12:09:30 cgoos + * Performance optimization, rx checksumming, large frame support. + * + * Revision 1.14 1999/07/14 11:26:27 cgoos + * Removed Link LED settings (now in RLMT). + * Added status output at NET UP. + * Fixed SMP problems with Tx and SWITCH running in parallel. + * Fixed return code problem at RLMT_SEND event. + * + * Revision 1.13 1999/04/07 10:11:42 cgoos + * Fixed Single Port problems. + * Fixed Multi-Adapter problems. + * Always display startup string. + * + * Revision 1.12 1999/03/29 12:26:37 cgoos + * Reversed locking to fine granularity. + * Fixed skb double alloc problem (caused by incorrect xmit return code). + * Enhanced function descriptions. + * + * Revision 1.11 1999/03/15 13:10:51 cgoos + * Changed device identifier in output string to ethX. + * + * Revision 1.10 1999/03/15 12:12:34 cgoos + * Changed copyright notice. + * + * Revision 1.9 1999/03/15 12:10:17 cgoos + * Changed locking to one driver lock. + * Added check of SK_AC-size (for consistency with library). + * + * Revision 1.8 1999/03/08 11:44:02 cgoos + * Fixed missing dev->tbusy in SkGeXmit. + * Changed large frame (jumbo) buffer number. + * Added copying of short frames. + * + * Revision 1.7 1999/03/04 13:26:57 cgoos + * Fixed spinlock calls for SMP. + * + * Revision 1.6 1999/03/02 09:53:51 cgoos + * Added descriptor revertion for big endian machines. + * + * Revision 1.5 1999/03/01 08:50:59 cgoos + * Fixed SkGeChangeMtu. + * Fixed pci config space accesses. + * + * Revision 1.4 1999/02/18 15:48:44 cgoos + * Corrected some printk's. + * + * Revision 1.3 1999/02/18 12:45:55 cgoos + * Changed SK_MAX_CARD_PARAM to default 16 + * + * Revision 1.2 1999/02/18 10:55:32 cgoos + * Removed SkGeDrvTimeStamp function. + * Printing "ethX:" before adapter type at adapter init. + * + * + * 10-Feb-1999 cg Created, based on Linux' acenic.c, 3c59x.c and + * SysKonnects GEnesis Solaris driver + * + ******************************************************************************/ + +/****************************************************************************** + * + * Possible compiler options (#define xxx / -Dxxx): + * + * debugging can be enable by changing SK_DEBUG_CHKMOD and + * SK_DEBUG_CHKCAT in makefile (described there). + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This is the main module of the Linux GE driver. + * + * All source files except skge.c, skdrv1st.h, skdrv2nd.h and sktypes.h + * are part of SysKonnect's COMMON MODULES for the SK-98xx adapters. + * Those are used for drivers on multiple OS', so some thing may seem + * unnecessary complicated on Linux. Please do not try to 'clean up' + * them without VERY good reasons, because this will make it more + * difficult to keep the Linux driver in synchronisation with the + * other versions. + * + * Include file hierarchy: + * + * + * + * "h/skdrv1st.h" + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * those three depending on kernel version used: + * + * + * + * + * + * "h/skerror.h" + * "h/skdebug.h" + * "h/sktypes.h" + * "h/lm80.h" + * "h/xmac_ii.h" + * + * "h/skdrv2nd.h" + * "h/skqueue.h" + * "h/skgehwt.h" + * "h/sktimer.h" + * "h/ski2c.h" + * "h/skgepnmi.h" + * "h/skvpd.h" + * "h/skgehw.h" + * "h/skgeinit.h" + * "h/skaddr.h" + * "h/skgesirq.h" + * "h/skcsum.h" + * "h/skrlmt.h" + * + ******************************************************************************/ + +static const char SysKonnectFileId[] = "@(#)" __FILE__ " (C) SysKonnect."; +static const char SysKonnectBuildNumber[] = + "@(#)SK-BUILD: 3.02 (19991111) PL: 01"; + +#include + +#include "h/skdrv1st.h" +#include "h/skdrv2nd.h" + +/* defines ******************************************************************/ + +#define BOOT_STRING "sk98lin: Network Device Driver v3.02\n" \ + "Copyright (C) 1999 SysKonnect" + +#define VER_STRING "3.02" + + +/* for debuging on x86 only */ +/* #define BREAKPOINT() asm(" int $3"); */ + +/* use of a transmit complete interrupt */ +#define USE_TX_COMPLETE + +/* use interrupt moderation (for tx complete only) */ +// #define USE_INT_MOD +#define INTS_PER_SEC 1000 + +/* + * threshold for copying small receive frames + * set to 0 to avoid copying, set to 9001 to copy all frames + */ +#define SK_COPY_THRESHOLD 200 + +/* number of adapters that can be configured via command line params */ +#define SK_MAX_CARD_PARAM 16 + +/* + * use those defines for a compile-in version of the driver instead + * of command line parameters + */ +// #define AUTO_NEG_A {"Sense", } +// #define AUTO_NEG_B {"Sense", } +// #define DUP_CAP_A {"Both", } +// #define DUP_CAP_B {"Both", } +// #define FLOW_CTRL_A {"SymOrRem", } +// #define FLOW_CTRL_B {"SymOrRem", } +// #define ROLE_A {"Auto", } +// #define ROLE_B {"Auto", } +// #define PREF_PORT {"A", } +// #define RLMT_MODE {"CheckLink", } + + +#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb); + +/* function prototypes ******************************************************/ +static void FreeResources(struct net_device *dev); +int init_module(void); +void cleanup_module(void); +static int SkGeBoardInit(struct net_device *dev, SK_AC *pAC); +static SK_BOOL BoardAllocMem(SK_AC *pAC); +static void BoardFreeMem(SK_AC *pAC); +static void BoardInitMem(SK_AC *pAC); +static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, + int*, SK_BOOL); + +static void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); +static void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); +static int SkGeOpen(struct net_device *dev); +static int SkGeClose(struct net_device *dev); +static int SkGeXmit(struct sk_buff *skb, struct net_device *dev); +static int SkGeSetMacAddr(struct net_device *dev, void *p); +static void SkGeSetRxMode(struct net_device *dev); +static struct net_device_stats *SkGeStats(struct net_device *dev); +static int SkGeIoctl(struct net_device *dev, struct ifreq *rq, int cmd); +static void GetConfiguration(SK_AC*); +static void ProductStr(SK_AC*); +static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); +static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); +static void FillRxRing(SK_AC*, RX_PORT*); +static SK_BOOL FillRxDescriptor(SK_AC*, RX_PORT*); +static void ReceiveIrq(SK_AC*, RX_PORT*); +static void ClearAndStartRx(SK_AC*, int); +static void ClearTxIrq(SK_AC*, int, int); +static void ClearRxRing(SK_AC*, RX_PORT*); +static void ClearTxRing(SK_AC*, TX_PORT*); +static void SetQueueSizes(SK_AC *pAC); +static int SkGeChangeMtu(struct net_device *dev, int new_mtu); +static void PortReInitBmu(SK_AC*, int); +static int SkGeIocMib(SK_AC*, unsigned int, int); +#ifdef DEBUG +static void DumpMsg(struct sk_buff*, char*); +static void DumpData(char*, int); +static void DumpLong(char*, int); +#endif + + +/* global variables *********************************************************/ +static const char *BootString = BOOT_STRING; +static struct net_device *root_dev = NULL; +static int probed __initdata = 0; + +/* local variables **********************************************************/ +static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}}; +static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480}; + +/***************************************************************************** + * + * skge_probe - find all SK-98xx adapters + * + * Description: + * This function scans the PCI bus for SK-98xx adapters. Resources for + * each adapter are allocated and the adapter is brought into Init 1 + * state. + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +int __init skge_probe (struct net_device *dev) +{ +int boards_found = 0; +int version_disp = 0; +SK_AC *pAC; +struct pci_dev *pdev = NULL; +unsigned int base_address; + + if (probed) + return -ENODEV; + probed++; + + /* display driver info */ + if (!version_disp) + { + /* set display flag to TRUE so that */ + /* we only display this string ONCE */ + version_disp = 1; + printk("%s\n", BootString); + } + + if (!pci_present()) /* is PCI support present? */ + return -ENODEV; + + while((pdev = pci_find_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) + { + dev = NULL; + + if (pdev->vendor != PCI_VENDOR_ID_SYSKONNECT || + pdev->device != PCI_DEVICE_ID_SYSKONNECT_GE) { + continue; + } + dev = init_etherdev(dev, sizeof(SK_AC)); + + if (dev == NULL){ + printk(KERN_ERR "Unable to allocate etherdev " + "structure!\n"); + break; + } + + if (!dev->priv) + dev->priv = kmalloc(sizeof(SK_AC), GFP_KERNEL); + if (dev->priv == NULL){ + printk(KERN_ERR "Unable to allocate adapter " + "structure!\n"); + break; + } + + + memset(dev->priv, 0, sizeof(SK_AC)); + + pAC = dev->priv; + pAC->PciDev = *pdev; + pAC->PciDevId = pdev->device; + pAC->dev = dev; + sprintf(pAC->Name, "SysKonnect SK-98xx"); + pAC->CheckQueue = SK_FALSE; + + dev->irq = pdev->irq; + + dev->open = &SkGeOpen; + dev->stop = &SkGeClose; + dev->hard_start_xmit = &SkGeXmit; + dev->get_stats = &SkGeStats; + dev->set_multicast_list = &SkGeSetRxMode; + dev->set_mac_address = &SkGeSetMacAddr; + dev->do_ioctl = &SkGeIoctl; + dev->change_mtu = &SkGeChangeMtu; + + /* + * Dummy value. + */ + dev->base_addr = 42; + + pci_set_master(pdev); + + base_address = pdev->resource[0].start; + +#ifdef SK_BIG_ENDIAN + /* + * On big endian machines, we use the adapter's aibility of + * reading the descriptors as big endian. + */ + { + SK_U32 our2; + SkPciReadCfgDWord(pAC, PCI_OUR_REG_2, &our2); + our2 |= PCI_REV_DESC; + SkPciWriteCfgDWord(pAC, PCI_OUR_REG_2, our2); + } +#endif /* BIG ENDIAN */ + + /* + * Remap the regs into kernel space. + */ + + + pAC->IoBase = (char*)ioremap(base_address, 0x4000); + if (!pAC->IoBase){ + printk(KERN_ERR "%s: Unable to map I/O register, " + "SK 98xx No. %i will be disabled.\n", + dev->name, boards_found); + break; + } + pAC->Index = boards_found; + + if (SkGeBoardInit(dev, pAC)) { + FreeResources(dev); + continue; + } + + memcpy((caddr_t) &dev->dev_addr, + (caddr_t) &pAC->Addr.CurrentMacAddress, 6); + + boards_found++; + + /* + * This is bollocks, but we need to tell the net-init + * code that it shall go for the next device. + */ +#ifndef MODULE + dev->base_addr = 0; +#endif + } + + /* + * If we're at this point we're going through skge_probe() for + * the first time. Return success (0) if we've initialized 1 + * or more boards. Otherwise, return failure (-ENODEV). + */ + +#ifdef MODULE + return boards_found; +#else + if (boards_found > 0) + return 0; + else + return -ENODEV; +#endif +} /* skge_probe */ + + +/***************************************************************************** + * + * FreeResources - release resources allocated for adapter + * + * Description: + * This function releases the IRQ, unmaps the IO and + * frees the desriptor ring. + * + * Returns: N/A + * + */ +static void FreeResources(struct net_device *dev) +{ +SK_U32 AllocFlag; +SK_AC *pAC; + + if (dev->priv) { + pAC = (SK_AC*) dev->priv; + AllocFlag = pAC->AllocFlag; + if (AllocFlag & SK_ALLOC_IRQ) { + free_irq(dev->irq, dev); + } + if (pAC->IoBase) { + iounmap(pAC->IoBase); + } + if (pAC->pDescrMem) { + BoardFreeMem(pAC); + } + } + +} /* FreeResources */ + + +#ifdef MODULE + +MODULE_AUTHOR("Christoph Goos "); +MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver"); +MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(DupCap_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(FlowCtrl_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(FlowCtrl_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(Role_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(Role_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(PrefPort, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +MODULE_PARM(RlmtMode, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); +/* not used, just there because every driver should have them: */ +MODULE_PARM(options, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "i"); +MODULE_PARM(debug, "i"); + +#endif // MODULE + + +#ifdef AUTO_NEG_A +static char *AutoNeg_A[SK_MAX_CARD_PARAM] = AUTO_NEG_A; +#else +static char *AutoNeg_A[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef DUP_CAP_A +static char *DupCap_A[SK_MAX_CARD_PARAM] = DUP_CAP_A; +#else +static char *DupCap_A[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef FLOW_CTRL_A +static char *FlowCtrl_A[SK_MAX_CARD_PARAM] = FLOW_CTRL_A; +#else +static char *FlowCtrl_A[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef ROLE_A +static char *Role_A[SK_MAX_CARD_PARAM] = ROLE_A; +#else +static char *Role_A[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef AUTO_NEG_B +static char *AutoNeg_B[SK_MAX_CARD_PARAM] = AUTO_NEG_B; +#else +static char *AutoNeg_B[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef DUP_CAP_B +static char *DupCap_B[SK_MAX_CARD_PARAM] = DUP_CAP_B; +#else +static char *DupCap_B[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef FLOW_CTRL_B +static char *FlowCtrl_B[SK_MAX_CARD_PARAM] = FLOW_CTRL_B; +#else +static char *FlowCtrl_B[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef ROLE_B +static char *Role_B[SK_MAX_CARD_PARAM] = ROLE_B; +#else +static char *Role_B[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef PREF_PORT +static char *PrefPort[SK_MAX_CARD_PARAM] = PREF_PORT; +#else +static char *PrefPort[SK_MAX_CARD_PARAM] = {"", }; +#endif + +#ifdef RLMT_MODE +static char *RlmtMode[SK_MAX_CARD_PARAM] = RLMT_MODE; +#else +static char *RlmtMode[SK_MAX_CARD_PARAM] = {"", }; +#endif + + +#ifdef MODULE + +static int debug = 0; /* not used */ +static int options[SK_MAX_CARD_PARAM] = {0, }; /* not used */ + + +/***************************************************************************** + * + * init_module - module initialization function + * + * Description: + * Very simple, only call skge_probe and return approriate result. + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +int init_module(void) +{ +int cards; + + root_dev = NULL; + + /* just to avoid warnings ... */ + debug = 0; + options[0] = 0; + + cards = skge_probe(NULL); + if (cards == 0) { + printk("No adapter found\n"); + } + return cards ? 0 : -ENODEV; +} /* init_module */ + + +/***************************************************************************** + * + * cleanup_module - module unload function + * + * Description: + * Disable adapter if it is still running, free resources, + * free device struct. + * + * Returns: N/A + */ +void cleanup_module(void) +{ +SK_AC *pAC; +struct net_device *next; +unsigned long Flags; +SK_EVPARA EvPara; + + while (root_dev) { + pAC = (SK_AC*)root_dev->priv; + next = pAC->Next; + + root_dev->tbusy = 1; + SkGeYellowLED(pAC, pAC->IoBase, 0); + + if(pAC->BoardLevel == 2) { + /* board is still alive */ + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); + SkEventDispatcher(pAC, pAC->IoBase); + /* disable interrupts */ + SK_OUT32(pAC->IoBase, B0_IMSK, 0); + SkGeDeInit(pAC, pAC->IoBase); + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + pAC->BoardLevel = 0; + /* We do NOT check here, if IRQ was pending, of course*/ + } + + if(pAC->BoardLevel == 1) { + /* board is still alive */ + SkGeDeInit(pAC, pAC->IoBase); + pAC->BoardLevel = 0; + } + + FreeResources(root_dev); + + root_dev->get_stats = NULL; + /* + * otherwise unregister_netdev calls get_stats with + * invalid IO ... :-( + */ + unregister_netdev(root_dev); + kfree(root_dev); + + root_dev = next; + } +} +#endif /* cleanup_module */ + + +/***************************************************************************** + * + * SkGeBoardInit - do level 0 and 1 initialization + * + * Description: + * This function prepares the board hardware for running. The desriptor + * ring is set up, the IRQ is allocated and the configuration settings + * are examined. + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +static int __init SkGeBoardInit(struct net_device *dev, SK_AC *pAC) +{ +short i; +unsigned long Flags; +char *DescrString = "sk98lin: Driver for Linux"; /* this is given to PNMI */ +char *VerStr = VER_STRING; +int Ret; /* return code of request_irq */ + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("IoBase: %08lX\n", (unsigned long)pAC->IoBase)); + for (i=0; iTxPort[i][0].HwAddr = pAC->IoBase + TxQueueAddr[i][0]; + pAC->TxPort[i][0].PortIndex = i; + pAC->RxPort[i].HwAddr = pAC->IoBase + RxQueueAddr[i]; + pAC->RxPort[i].PortIndex = i; + } + + /* Initialize the mutexes */ + + for (i=0; iTxPort[i][0].TxDesRingLock); + spin_lock_init(&pAC->RxPort[i].RxDesRingLock); + } + spin_lock_init(&pAC->SlowPathLock); + + /* level 0 init common modules here */ + + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + /* Does a RESET on board ...*/ + if (SkGeInit(pAC, pAC->IoBase, 0) != 0) { + printk("HWInit (0) failed.\n"); + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + return(-EAGAIN); + } + SkI2cInit( pAC, pAC->IoBase, 0); + SkEventInit(pAC, pAC->IoBase, 0); + SkPnmiInit( pAC, pAC->IoBase, 0); + SkAddrInit( pAC, pAC->IoBase, 0); + SkRlmtInit( pAC, pAC->IoBase, 0); + SkTimerInit(pAC, pAC->IoBase, 0); + + pAC->BoardLevel = 0; + pAC->RxBufSize = ETH_BUF_SIZE; + + SK_PNMI_SET_DRIVER_DESCR(pAC, DescrString); + SK_PNMI_SET_DRIVER_VER(pAC, VerStr); + + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + + GetConfiguration(pAC); + + /* level 1 init common modules here (HW init) */ + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + if (SkGeInit(pAC, pAC->IoBase, 1) != 0) { + printk("HWInit (1) failed.\n"); + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + return(-EAGAIN); + } + SkI2cInit( pAC, pAC->IoBase, 1); + SkEventInit(pAC, pAC->IoBase, 1); + SkPnmiInit( pAC, pAC->IoBase, 1); + SkAddrInit( pAC, pAC->IoBase, 1); + SkRlmtInit( pAC, pAC->IoBase, 1); + SkTimerInit(pAC, pAC->IoBase, 1); + + pAC->BoardLevel = 1; + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + + if (pAC->GIni.GIMacsFound == 2) { + Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); + } else if (pAC->GIni.GIMacsFound == 1) { + Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, + pAC->Name, dev); + } else { + printk(KERN_WARNING "%s: illegal number of ports: %d\n", + dev->name, pAC->GIni.GIMacsFound); + return -EAGAIN; + } + if (Ret) { + printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", + dev->name, dev->irq); + return -EAGAIN; + } + pAC->AllocFlag |= SK_ALLOC_IRQ; + + /* Alloc memory for this board (Mem for RxD/TxD) : */ + if(!BoardAllocMem(pAC)) { + printk("No memory for descriptor rings\n"); + return(-EAGAIN); + } + + SkCsSetReceiveFlags(pAC, + SKCS_PROTO_IP | SKCS_PROTO_TCP | SKCS_PROTO_UDP, + &pAC->CsOfs1, &pAC->CsOfs2); + pAC->CsOfs = (pAC->CsOfs2 << 16) | pAC->CsOfs1; + + BoardInitMem(pAC); + + SetQueueSizes(pAC); + + /* Print adapter specific string from vpd */ + ProductStr(pAC); + printk("%s: %s\n", dev->name, pAC->DeviceStr); + + SkGeYellowLED(pAC, pAC->IoBase, 1); + + /* + * Register the device here + */ + pAC->Next = root_dev; + root_dev = dev; + + return (0); +} /* SkGeBoardInit */ + + +/***************************************************************************** + * + * BoardAllocMem - allocate the memory for the descriptor rings + * + * Description: + * This function allocates the memory for all descriptor rings. + * Each ring is aligned for the desriptor alignment and no ring + * has a 4 GByte boundary in it (because the upper 32 bit must + * be constant for all descriptiors in one rings). + * + * Returns: + * SK_TRUE, if all memory could be allocated + * SK_FALSE, if not + */ +static SK_BOOL BoardAllocMem( +SK_AC *pAC) +{ +caddr_t pDescrMem; /* pointer to descriptor memory area */ +size_t AllocLength; /* length of complete descriptor area */ +int i; /* loop counter */ +unsigned long BusAddr; + + + /* rings plus one for alignment (do not cross 4 GB boundary) */ + /* RX_RING_SIZE is assumed bigger than TX_RING_SIZE */ +#if (BITS_PER_LONG == 32) + AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound + 8; +#else + AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound + + RX_RING_SIZE + 8; +#endif + pDescrMem = kmalloc(AllocLength, GFP_KERNEL); + if (pDescrMem == NULL) { + return (SK_FALSE); + } + pAC->pDescrMem = pDescrMem; + memset(pDescrMem, 0, AllocLength); + /* Descriptors need 8 byte alignment */ + BusAddr = virt_to_bus(pDescrMem); + if (BusAddr & (DESCR_ALIGN-1)) { + pDescrMem += DESCR_ALIGN - (BusAddr & (DESCR_ALIGN-1)); + } + for (i=0; iGIni.GIMacsFound; i++) { + if ((virt_to_bus(pDescrMem) & ~0xFFFFFFFFULL) != + (virt_to_bus(pDescrMem+TX_RING_SIZE) & ~0xFFFFFFFFULL)) { + pDescrMem += TX_RING_SIZE; + } + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, + ("TX%d/A: pDescrMem: %lX, PhysDescrMem: %lX\n", + i, (unsigned long) pDescrMem, + (unsigned long)virt_to_bus(pDescrMem))); + pAC->TxPort[i][0].pTxDescrRing = pDescrMem; + pAC->TxPort[i][0].VTxDescrRing = virt_to_bus(pDescrMem); + pDescrMem += TX_RING_SIZE; + + if ((virt_to_bus(pDescrMem) & ~0xFFFFFFFFULL) != + (virt_to_bus(pDescrMem+RX_RING_SIZE) & ~0xFFFFFFFFULL)) { + pDescrMem += RX_RING_SIZE; + } + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, + ("RX%d: pDescrMem: %lX, PhysDescrMem: %lX\n", + i, (unsigned long) pDescrMem, + (unsigned long)(virt_to_bus(pDescrMem)))); + pAC->RxPort[i].pRxDescrRing = pDescrMem; + pAC->RxPort[i].VRxDescrRing = virt_to_bus(pDescrMem); + pDescrMem += RX_RING_SIZE; + } /* for */ + + return (SK_TRUE); +} /* BoardAllocMem */ + + +/**************************************************************************** + * + * BoardFreeMem - reverse of BoardAllocMem + * + * Description: + * Free all memory allocated in BoardAllocMem: adapter context, + * descriptor rings, locks. + * + * Returns: N/A + */ +static void BoardFreeMem( +SK_AC *pAC) +{ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("BoardFreeMem\n")); + kfree(pAC->pDescrMem); +} /* BoardFreeMem */ + + +/***************************************************************************** + * + * BoardInitMem - initiate the descriptor rings + * + * Description: + * This function sets the descriptor rings up in memory. + * The adapter is initialized with the descriptor start addresses. + * + * Returns: N/A + */ +static void BoardInitMem( +SK_AC *pAC) /* pointer to adapter context */ +{ +int i; /* loop counter */ +int RxDescrSize; /* the size of a rx descriptor rounded up to alignment*/ +int TxDescrSize; /* the size of a tx descriptor rounded up to alignment*/ + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("BoardInitMem\n")); + + RxDescrSize = (((sizeof(RXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN; + pAC->RxDescrPerRing = RX_RING_SIZE / RxDescrSize; + TxDescrSize = (((sizeof(TXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN; + pAC->TxDescrPerRing = TX_RING_SIZE / RxDescrSize; + + for (i=0; iGIni.GIMacsFound; i++) { + SetupRing( + pAC, + pAC->TxPort[i][0].pTxDescrRing, + pAC->TxPort[i][0].VTxDescrRing, + (RXD**)&pAC->TxPort[i][0].pTxdRingHead, + (RXD**)&pAC->TxPort[i][0].pTxdRingTail, + (RXD**)&pAC->TxPort[i][0].pTxdRingPrev, + &pAC->TxPort[i][0].TxdRingFree, + SK_TRUE); + SetupRing( + pAC, + pAC->RxPort[i].pRxDescrRing, + pAC->RxPort[i].VRxDescrRing, + &pAC->RxPort[i].pRxdRingHead, + &pAC->RxPort[i].pRxdRingTail, + &pAC->RxPort[i].pRxdRingPrev, + &pAC->RxPort[i].RxdRingFree, + SK_FALSE); + } +} /* BoardInitMem */ + + +/***************************************************************************** + * + * SetupRing - create one descriptor ring + * + * Description: + * This function creates one descriptor ring in the given memory area. + * The head, tail and number of free descriptors in the ring are set. + * + * Returns: + * none + */ +static void SetupRing( +SK_AC *pAC, +void *pMemArea, /* a pointer to the memory area for the ring */ +uintptr_t VMemArea, /* the virtual bus address of the memory area */ +RXD **ppRingHead, /* address where the head should be written */ +RXD **ppRingTail, /* address where the tail should be written */ +RXD **ppRingPrev, /* address where the tail should be written */ +int *pRingFree, /* address where the # of free descr. goes */ +SK_BOOL IsTx) /* flag: is this a tx ring */ +{ +int i; /* loop counter */ +int DescrSize; /* the size of a descriptor rounded up to alignment*/ +int DescrNum; /* number of descriptors per ring */ +RXD *pDescr; /* pointer to a descriptor (receive or transmit) */ +RXD *pNextDescr; /* pointer to the next descriptor */ +RXD *pPrevDescr; /* pointer to the previous descriptor */ +uintptr_t VNextDescr; /* the virtual bus address of the next descriptor */ + + if (IsTx == SK_TRUE) { + DescrSize = (((sizeof(TXD) - 1) / DESCR_ALIGN) + 1) * + DESCR_ALIGN; + DescrNum = TX_RING_SIZE / DescrSize; + } + else { + DescrSize = (((sizeof(RXD) - 1) / DESCR_ALIGN) + 1) * + DESCR_ALIGN; + DescrNum = RX_RING_SIZE / DescrSize; + } + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, + ("Descriptor size: %d Descriptor Number: %d\n", + DescrSize,DescrNum)); + + pDescr = (RXD*) pMemArea; + pPrevDescr = NULL; + pNextDescr = (RXD*) (((char*)pDescr) + DescrSize); + VNextDescr = VMemArea + DescrSize; + for(i=0; iVNextRxd = VNextDescr & 0xffffffffULL; + pDescr->pNextRxd = pNextDescr; + pDescr->TcpSumStarts = pAC->CsOfs; + /* advance on step */ + pPrevDescr = pDescr; + pDescr = pNextDescr; + pNextDescr = (RXD*) (((char*)pDescr) + DescrSize); + VNextDescr += DescrSize; + } + pPrevDescr->pNextRxd = (RXD*) pMemArea; + pPrevDescr->VNextRxd = VMemArea; + pDescr = (RXD*) pMemArea; + *ppRingHead = (RXD*) pMemArea; + *ppRingTail = *ppRingHead; + *ppRingPrev = pPrevDescr; + *pRingFree = DescrNum; +} /* SetupRing */ + + +/***************************************************************************** + * + * PortReInitBmu - re-initiate the descriptor rings for one port + * + * Description: + * This function reinitializes the descriptor rings of one port + * in memory. The port must be stopped before. + * The HW is initialized with the descriptor start addresses. + * + * Returns: + * none + */ +static void PortReInitBmu( +SK_AC *pAC, /* pointer to adapter context */ +int PortIndex) /* index of the port for which to re-init */ +{ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("PortReInitBmu ")); + + /* set address of first descriptor of ring in BMU */ + SK_OUT32(pAC->IoBase, TxQueueAddr[PortIndex][TX_PRIO_LOW]+ + TX_Q_CUR_DESCR_LOW, + (uint32_t)(((caddr_t) + (pAC->TxPort[PortIndex][TX_PRIO_LOW].pTxdRingHead) - + pAC->TxPort[PortIndex][TX_PRIO_LOW].pTxDescrRing + + pAC->TxPort[PortIndex][TX_PRIO_LOW].VTxDescrRing) & + 0xFFFFFFFF)); + SK_OUT32(pAC->IoBase, TxQueueAddr[PortIndex][TX_PRIO_LOW]+ + TX_Q_DESCR_HIGH, + (uint32_t)(((caddr_t) + (pAC->TxPort[PortIndex][TX_PRIO_LOW].pTxdRingHead) - + pAC->TxPort[PortIndex][TX_PRIO_LOW].pTxDescrRing + + pAC->TxPort[PortIndex][TX_PRIO_LOW].VTxDescrRing) >> 32)); + SK_OUT32(pAC->IoBase, RxQueueAddr[PortIndex]+RX_Q_CUR_DESCR_LOW, + (uint32_t)(((caddr_t)(pAC->RxPort[PortIndex].pRxdRingHead) - + pAC->RxPort[PortIndex].pRxDescrRing + + pAC->RxPort[PortIndex].VRxDescrRing) & 0xFFFFFFFF)); + SK_OUT32(pAC->IoBase, RxQueueAddr[PortIndex]+RX_Q_DESCR_HIGH, + (uint32_t)(((caddr_t)(pAC->RxPort[PortIndex].pRxdRingHead) - + pAC->RxPort[PortIndex].pRxDescrRing + + pAC->RxPort[PortIndex].VRxDescrRing) >> 32)); +} /* PortReInitBmu */ + + +/**************************************************************************** + * + * SkGeIsr - handle adapter interrupts + * + * Description: + * The interrupt routine is called when the network adapter + * generates an interrupt. It may also be called if another device + * shares this interrupt vector with the driver. + * + * Returns: N/A + * + */ +static void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs) +{ +struct net_device *dev = (struct net_device *)dev_id; +SK_AC *pAC; +SK_U32 IntSrc; /* interrupts source register contents */ + + pAC = (SK_AC*) dev->priv; + + /* + * Check and process if its our interrupt + */ + SK_IN32(pAC->IoBase, B0_SP_ISRC, &IntSrc); + if (IntSrc == 0) { + return; + } + + while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { +#if 0 /* software irq currently not used */ + if (IntSrc & IRQ_SW) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("Software IRQ\n")); + } +#endif + if (IntSrc & IRQ_EOF_RX1) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF RX1 IRQ\n")); + ReceiveIrq(pAC, &pAC->RxPort[0]); + SK_PNMI_CNT_RX_INTR(pAC); + } + if (IntSrc & IRQ_EOF_RX2) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF RX2 IRQ\n")); + ReceiveIrq(pAC, &pAC->RxPort[1]); + SK_PNMI_CNT_RX_INTR(pAC); + } +#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ + if (IntSrc & IRQ_EOF_AS_TX1) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF AS TX1 IRQ\n")); + SK_PNMI_CNT_TX_INTR(pAC); + spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); + spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + } + if (IntSrc & IRQ_EOF_AS_TX2) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF AS TX2 IRQ\n")); + SK_PNMI_CNT_TX_INTR(pAC); + spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); + FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]); + spin_unlock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); + } +#if 0 /* only if sync. queues used */ + if (IntSrc & IRQ_EOF_SY_TX1) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF SY TX1 IRQ\n")); + SK_PNMI_CNT_TX_INTR(pAC); + spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); + spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + ClearTxIrq(pAC, 0, TX_PRIO_HIGH); + } + if (IntSrc & IRQ_EOF_SY_TX2) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF SY TX2 IRQ\n")); + SK_PNMI_CNT_TX_INTR(pAC); + spin_lock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); + FreeTxDescriptors(pAC, 1, TX_PRIO_HIGH); + spin_unlock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); + ClearTxIrq(pAC, 1, TX_PRIO_HIGH); + } +#endif /* 0 */ +#endif /* USE_TX_COMPLETE */ + + /* do all IO at once */ + if (IntSrc & IRQ_EOF_RX1) + ClearAndStartRx(pAC, 0); + if (IntSrc & IRQ_EOF_RX2) + ClearAndStartRx(pAC, 1); +#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ + if (IntSrc & IRQ_EOF_AS_TX1) + ClearTxIrq(pAC, 0, TX_PRIO_LOW); + if (IntSrc & IRQ_EOF_AS_TX2) + ClearTxIrq(pAC, 1, TX_PRIO_LOW); +#endif + SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc); + } /* while (IntSrc & IRQ_MASK != 0) */ + + if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC, + ("SPECIAL IRQ\n")); + pAC->CheckQueue = SK_FALSE; + spin_lock(&pAC->SlowPathLock); + if (IntSrc & SPECIAL_IRQS) + SkGeSirqIsr(pAC, pAC->IoBase, IntSrc); + SkEventDispatcher(pAC, pAC->IoBase); + spin_unlock(&pAC->SlowPathLock); + } + /* + * do it all again is case we cleared an interrupt that + * came in after handling the ring (OUTs may be delayed + * in hardware buffers, but are through after IN) + */ + ReceiveIrq(pAC, &pAC->RxPort[pAC->ActivePort]); +// ReceiveIrq(pAC, &pAC->RxPort[1]); + +#if 0 +// #ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ + spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); + spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + + spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); + FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]); + spin_unlock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); + +#if 0 /* only if sync. queues used */ + spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); + spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + + spin_lock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); + FreeTxDescriptors(pAC, 1, TX_PRIO_HIGH); + spin_unlock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); +#endif /* 0 */ +#endif /* USE_TX_COMPLETE */ + + /* IRQ is processed - Enable IRQs again*/ + SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); + + return; +} /* SkGeIsr */ + + +/**************************************************************************** + * + * SkGeIsrOnePort - handle adapter interrupts for single port adapter + * + * Description: + * The interrupt routine is called when the network adapter + * generates an interrupt. It may also be called if another device + * shares this interrupt vector with the driver. + * This is the same as above, but handles only one port. + * + * Returns: N/A + * + */ +static void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs) +{ +struct net_device *dev = (struct net_device *)dev_id; +SK_AC *pAC; +SK_U32 IntSrc; /* interrupts source register contents */ + + pAC = (SK_AC*) dev->priv; + + /* + * Check and process if its our interrupt + */ + SK_IN32(pAC->IoBase, B0_SP_ISRC, &IntSrc); + if (IntSrc == 0) { + return; + } + + while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { +#if 0 /* software irq currently not used */ + if (IntSrc & IRQ_SW) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("Software IRQ\n")); + } +#endif + if (IntSrc & IRQ_EOF_RX1) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF RX1 IRQ\n")); + ReceiveIrq(pAC, &pAC->RxPort[0]); + SK_PNMI_CNT_RX_INTR(pAC); + } +#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ + if (IntSrc & IRQ_EOF_AS_TX1) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF AS TX1 IRQ\n")); + SK_PNMI_CNT_TX_INTR(pAC); + spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); + spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + } +#if 0 /* only if sync. queues used */ + if (IntSrc & IRQ_EOF_SY_TX1) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_INT_SRC, + ("EOF SY TX1 IRQ\n")); + SK_PNMI_CNT_TX_INTR(pAC); + spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); + spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + ClearTxIrq(pAC, 0, TX_PRIO_HIGH); + } +#endif /* 0 */ +#endif /* USE_TX_COMPLETE */ + + /* do all IO at once */ + if (IntSrc & IRQ_EOF_RX1) + ClearAndStartRx(pAC, 0); +#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ + if (IntSrc & IRQ_EOF_AS_TX1) + ClearTxIrq(pAC, 0, TX_PRIO_LOW); +#endif + SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc); + } /* while (IntSrc & IRQ_MASK != 0) */ + + if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC, + ("SPECIAL IRQ\n")); + pAC->CheckQueue = SK_FALSE; + spin_lock(&pAC->SlowPathLock); + if (IntSrc & SPECIAL_IRQS) + SkGeSirqIsr(pAC, pAC->IoBase, IntSrc); + SkEventDispatcher(pAC, pAC->IoBase); + spin_unlock(&pAC->SlowPathLock); + } + /* + * do it all again is case we cleared an interrupt that + * came in after handling the ring (OUTs may be delayed + * in hardware buffers, but are through after IN) + */ + ReceiveIrq(pAC, &pAC->RxPort[0]); + +#if 0 +// #ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ + spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); + spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); + +#if 0 /* only if sync. queues used */ + spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); + spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); + +#endif /* 0 */ +#endif /* USE_TX_COMPLETE */ + + /* IRQ is processed - Enable IRQs again*/ + SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); + + return; +} /* SkGeIsrOnePort */ + + +/**************************************************************************** + * + * SkGeOpen - handle start of initialized adapter + * + * Description: + * This function starts the initialized adapter. + * The board level variable is set and the adapter is + * brought to full functionality. + * The device flags are set for operation. + * Do all necessary level 2 initialization, enable interrupts and + * give start command to RLMT. + * + * Returns: + * 0 on success + * != 0 on error + */ +static int SkGeOpen( +struct net_device *dev) +{ +SK_AC *pAC; /* pointer to adapter context struct */ +unsigned int Flags; /* for spin lock */ +int i; +SK_EVPARA EvPara; /* an event parameter union */ + + pAC = (SK_AC*) dev->priv; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeOpen: pAC=0x%lX:\n", (unsigned long)pAC)); + + if (pAC->BoardLevel == 0) { + /* level 1 init common modules here */ + if (SkGeInit(pAC, pAC->IoBase, 1) != 0) { + printk("%s: HWInit(1) failed\n", pAC->dev->name); + return (-1); + } + SkI2cInit (pAC, pAC->IoBase, 1); + SkEventInit (pAC, pAC->IoBase, 1); + SkPnmiInit (pAC, pAC->IoBase, 1); + SkAddrInit (pAC, pAC->IoBase, 1); + SkRlmtInit (pAC, pAC->IoBase, 1); + SkTimerInit (pAC, pAC->IoBase, 1); + pAC->BoardLevel = 1; + } + + /* level 2 init modules here */ + SkGeInit (pAC, pAC->IoBase, 2); + SkI2cInit (pAC, pAC->IoBase, 2); + SkEventInit (pAC, pAC->IoBase, 2); + SkPnmiInit (pAC, pAC->IoBase, 2); + SkAddrInit (pAC, pAC->IoBase, 2); + SkRlmtInit (pAC, pAC->IoBase, 2); + SkTimerInit (pAC, pAC->IoBase, 2); + pAC->BoardLevel = 2; + + for (i=0; iGIni.GIMacsFound; i++) { + // Enable transmit descriptor polling. + SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE); + FillRxRing(pAC, &pAC->RxPort[i]); + } + SkGeYellowLED(pAC, pAC->IoBase, 1); + +#ifdef USE_INT_MOD +// moderate only TX complete interrupts (these are not time critical) +#define IRQ_MOD_MASK (IRQ_EOF_AS_TX1 | IRQ_EOF_AS_TX2) + { + unsigned long ModBase; + ModBase = 53125000 / INTS_PER_SEC; + SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase); + SK_OUT32(pAC->IoBase, B2_IRQM_MSK, IRQ_MOD_MASK); + SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_START); + } +#endif + + /* enable Interrupts */ + SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); + SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK); + + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); + if (pAC->RlmtMode != 0) { + EvPara.Para32[0] = pAC->RlmtMode; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_MODE_CHANGE, + EvPara); + } + SkEventDispatcher(pAC, pAC->IoBase); + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + + dev->tbusy = 0; + dev->interrupt = 0; + dev->start = 1; + + MOD_INC_USE_COUNT; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeOpen suceeded\n")); + + return (0); +} /* SkGeOpen */ + + +/**************************************************************************** + * + * SkGeClose - Stop initialized adapter + * + * Description: + * Close initialized adapter. + * + * Returns: + * 0 - on success + * error code - on error + */ +static int SkGeClose( +struct net_device *dev) +{ +SK_AC *pAC; +unsigned int Flags; /* for spin lock */ +int i; +SK_EVPARA EvPara; + + dev->start = 0; + set_bit(0, (void*)&dev->tbusy); + + pAC = (SK_AC*) dev->priv; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeClose: pAC=0x%lX ", (unsigned long)pAC)); + + /* + * Clear multicast table, promiscuous mode .... + */ + SkAddrMcClear(pAC, pAC->IoBase, pAC->ActivePort, 0); + SkAddrPromiscuousChange(pAC, pAC->IoBase, pAC->ActivePort, + SK_PROM_MODE_NONE); + + + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + /* disable interrupts */ + SK_OUT32(pAC->IoBase, B0_IMSK, 0); + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); + SkEventDispatcher(pAC, pAC->IoBase); + SK_OUT32(pAC->IoBase, B0_IMSK, 0); + /* stop the hardware */ + SkGeDeInit(pAC, pAC->IoBase); + pAC->BoardLevel = 0; + + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + + for (i=0; iGIni.GIMacsFound; i++) { + /* clear all descriptor rings */ + ReceiveIrq(pAC, &pAC->RxPort[i]); + ClearRxRing(pAC, &pAC->RxPort[i]); + ClearTxRing(pAC, &pAC->TxPort[i][TX_PRIO_LOW]); + } + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeClose: done ")); + + MOD_DEC_USE_COUNT; + + return (0); +} /* SkGeClose */ + +/***************************************************************************** + * + * SkGeXmit - Linux frame transmit function + * + * Description: + * The system calls this function to send frames onto the wire. + * It puts the frame in the tx descriptor ring. If the ring is + * full then, the 'tbusy' flag is set. + * + * Returns: + * 0, if everything is ok + * !=0, on error + * WARNING: returning 1 in 'tbusy' case caused system crashes (double + * allocated skb's) !!! + */ +static int SkGeXmit(struct sk_buff *skb, struct net_device *dev) +{ +SK_AC *pAC; +int Rc; /* return code of XmitFrame */ + + pAC = (SK_AC*) dev->priv; + + Rc = XmitFrame(pAC, &pAC->TxPort[pAC->ActivePort][TX_PRIO_LOW], skb); + + if (Rc == 0) { + /* transmitter out of resources */ + set_bit(0, (void*) &dev->tbusy); + return (0); + } + dev->trans_start = jiffies; + return (0); +} /* SkGeXmit */ + + +/***************************************************************************** + * + * XmitFrame - fill one socket buffer into the transmit ring + * + * Description: + * This function puts a message into the transmit descriptor ring + * if there is a descriptors left. + * Linux skb's consist of only one continuous buffer. + * The first step locks the ring. It is held locked + * all time to avoid problems with SWITCH_../PORT_RESET. + * Then the descriptoris allocated. + * The second part is linking the buffer to the descriptor. + * At the very last, the Control field of the descriptor + * is made valid for the BMU and a start TX command is given + * if necessary. + * + * Returns: + * > 0 - on succes: the number of bytes in the message + * = 0 - on resource shortage: this frame sent or dropped, now + * the ring is full ( -> set tbusy) + * < 0 - on failure: other problems (not used) + */ +static int XmitFrame( +SK_AC *pAC, /* pointer to adapter context */ +TX_PORT *pTxPort, /* pointer to struct of port to send to */ +struct sk_buff *pMessage) /* pointer to send-message */ +{ +TXD *pTxd; /* the rxd to fill */ +unsigned int Flags; +SK_U64 PhysAddr; +int BytesSend; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, + ("X")); + + spin_lock_irqsave(&pTxPort->TxDesRingLock, Flags); + + if (pTxPort->TxdRingFree == 0) { + /* no enough free descriptors in ring at the moment */ + FreeTxDescriptors(pAC, pTxPort); + if (pTxPort->TxdRingFree == 0) { + spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); + SK_PNMI_CNT_NO_TX_BUF(pAC); + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_TX_PROGRESS, + ("XmitFrame failed\n")); + /* this message can not be sent now */ + DEV_KFREE_SKB(pMessage); + return (0); + } + } + /* advance head counter behind descriptor needed for this frame */ + pTxd = pTxPort->pTxdRingHead; + pTxPort->pTxdRingHead = pTxd->pNextTxd; + pTxPort->TxdRingFree--; + /* the needed descriptor is reserved now */ + + /* + * everything allocated ok, so add buffer to descriptor + */ + +#ifdef SK_DUMP_TX + DumpMsg(pMessage, "XmitFrame"); +#endif + + /* set up descriptor and CONTROL dword */ + PhysAddr = virt_to_bus(pMessage->data); + pTxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff); + pTxd->VDataHigh = (SK_U32) (PhysAddr >> 32); + pTxd->pMBuf = pMessage; + pTxd->TBControl = TX_CTRL_OWN_BMU | TX_CTRL_STF | + TX_CTRL_CHECK_DEFAULT | TX_CTRL_SOFTWARE | +#ifdef USE_TX_COMPLETE + TX_CTRL_EOF | TX_CTRL_EOF_IRQ | pMessage->len; +#else + TX_CTRL_EOF | pMessage->len; +#endif + + if ((pTxPort->pTxdRingPrev->TBControl & TX_CTRL_OWN_BMU) == 0) { + /* previous descriptor already done, so give tx start cmd */ + /* StartTx(pAC, pTxPort->HwAddr); */ + SK_OUT8(pTxPort->HwAddr, TX_Q_CTRL, TX_Q_CTRL_START); + } + pTxPort->pTxdRingPrev = pTxd; + + + BytesSend = pMessage->len; + /* after releasing the lock, the skb may be immidiately freed */ + if (pTxPort->TxdRingFree != 0) { + spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); + return (BytesSend); + } + else { + /* ring full: set tbusy on return */ + spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); + return (0); + } +} /* XmitFrame */ + + +/***************************************************************************** + * + * FreeTxDescriptors - release descriptors from the descriptor ring + * + * Description: + * This function releases descriptors from a transmit ring if they + * have been sent by the BMU. + * If a descriptors is sent, it can be freed and the message can + * be freed, too. + * The SOFTWARE controllable bit is used to prevent running around a + * completely free ring for ever. If this bit is no set in the + * frame (by XmitFrame), this frame has never been sent or is + * already freed. + * The Tx descriptor ring lock must be held while calling this function !!! + * + * Returns: + * none + */ +static void FreeTxDescriptors( +SK_AC *pAC, /* pointer to the adapter context */ +TX_PORT *pTxPort) /* pointer to destination port structure */ +{ +TXD *pTxd; /* pointer to the checked descriptor */ +TXD *pNewTail; /* pointer to 'end' of the ring */ +SK_U32 Control; /* TBControl field of descriptor */ + + pNewTail = pTxPort->pTxdRingTail; + pTxd = pNewTail; + + /* + * loop forever; exits if TX_CTRL_SOFTWARE bit not set in start frame + * or TX_CTRL_OWN_BMU bit set in any frame + */ + while (1) { + Control = pTxd->TBControl; + if ((Control & TX_CTRL_SOFTWARE) == 0) { + /* + * software controllable bit is set in first + * fragment when given to BMU. Not set means that + * this fragment was never sent or is already + * freed ( -> ring completely free now). + */ + pTxPort->pTxdRingTail = pTxd; + pAC->dev->tbusy = 0; + return; + } + if (Control & TX_CTRL_OWN_BMU) { + pTxPort->pTxdRingTail = pTxd; + if (pTxPort->TxdRingFree > 0) { + pAC->dev->tbusy = 0; + } + return; + } + + DEV_KFREE_SKB(pTxd->pMBuf); /* free message */ + pTxPort->TxdRingFree++; + pTxd->TBControl &= ~TX_CTRL_SOFTWARE; + pTxd = pTxd->pNextTxd; /* point behind fragment with EOF */ + } /* while(forever) */ +} /* FreeTxDescriptors */ + + +/***************************************************************************** + * + * FillRxRing - fill the receive ring with valid descriptors + * + * Description: + * This function fills the receive ring descriptors with data + * segments and makes them valid for the BMU. + * The active ring is filled completely, if possible. + * The non-active ring is filled only partial to save memory. + * + * Description of rx ring structure: + * head - points to the descriptor which will be used next by the BMU + * tail - points to the next descriptor to give to the BMU + * + * Returns: N/A + */ +static void FillRxRing( +SK_AC *pAC, /* pointer to the adapter context */ +RX_PORT *pRxPort) /* ptr to port struct for which the ring + should be filled */ +{ +unsigned int Flags; + + spin_lock_irqsave(&pRxPort->RxDesRingLock, Flags); + while (pRxPort->RxdRingFree > pRxPort->RxFillLimit) { + if(!FillRxDescriptor(pAC, pRxPort)) + break; + } + spin_unlock_irqrestore(&pRxPort->RxDesRingLock, Flags); +} /* FillRxRing */ + + +/***************************************************************************** + * + * FillRxDescriptor - fill one buffer into the receive ring + * + * Description: + * The function allocates a new receive buffer and + * puts it into the next descriptor. + * + * Returns: + * SK_TRUE - a buffer was added to the ring + * SK_FALSE - a buffer could not be added + */ +static SK_BOOL FillRxDescriptor( +SK_AC *pAC, /* pointer to the adapter context struct */ +RX_PORT *pRxPort) /* ptr to port struct of ring to fill */ +{ +struct sk_buff *pMsgBlock; /* pointer to a new message block */ +RXD *pRxd; /* the rxd to fill */ +SK_U16 Length; /* data fragment length */ +SK_U64 PhysAddr; /* physical address of a rx buffer */ + + pMsgBlock = alloc_skb(pAC->RxBufSize, GFP_ATOMIC); + if (pMsgBlock == NULL) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_ENTRY, + ("%s: Allocation of rx buffer failed !\n", + pAC->dev->name)); + SK_PNMI_CNT_NO_RX_BUF(pAC); + return(SK_FALSE); + } + skb_reserve(pMsgBlock, 2); /* to align IP frames */ + /* skb allocated ok, so add buffer */ + pRxd = pRxPort->pRxdRingTail; + pRxPort->pRxdRingTail = pRxd->pNextRxd; + pRxPort->RxdRingFree--; + Length = pAC->RxBufSize; + PhysAddr = virt_to_bus(pMsgBlock->data); + pRxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff); + pRxd->VDataHigh = (SK_U32) (PhysAddr >> 32); + pRxd->pMBuf = pMsgBlock; + pRxd->RBControl = RX_CTRL_OWN_BMU | RX_CTRL_STF | + RX_CTRL_EOF_IRQ | RX_CTRL_CHECK_CSUM | Length; + return (SK_TRUE); + +} /* FillRxDescriptor */ + + +/***************************************************************************** + * + * ReQueueRxBuffer - fill one buffer back into the receive ring + * + * Description: + * Fill a given buffer back into the rx ring. The buffer + * has been previously allocated and aligned, and its phys. + * address calculated, so this is no more necessary. + * + * Returns: N/A + */ +static void ReQueueRxBuffer( +SK_AC *pAC, /* pointer to the adapter context struct */ +RX_PORT *pRxPort, /* ptr to port struct of ring to fill */ +struct sk_buff *pMsg, /* pointer to the buffer */ +SK_U32 PhysHigh, /* phys address high dword */ +SK_U32 PhysLow) /* phys address low dword */ +{ +RXD *pRxd; /* the rxd to fill */ +SK_U16 Length; /* data fragment length */ + + pRxd = pRxPort->pRxdRingTail; + pRxPort->pRxdRingTail = pRxd->pNextRxd; + pRxPort->RxdRingFree--; + Length = pAC->RxBufSize; + pRxd->VDataLow = PhysLow; + pRxd->VDataHigh = PhysHigh; + pRxd->pMBuf = pMsg; + pRxd->RBControl = RX_CTRL_OWN_BMU | RX_CTRL_STF | + RX_CTRL_EOF_IRQ | RX_CTRL_CHECK_CSUM | Length; + return; +} /* ReQueueRxBuffer */ + + +/***************************************************************************** + * + * ReceiveIrq - handle a receive IRQ + * + * Description: + * This function is called when a receive IRQ is set. + * It walks the receive descriptor ring and sends up all + * frames that are complete. + * + * Returns: N/A + */ +static void ReceiveIrq( +SK_AC *pAC, /* pointer to adapter context */ +RX_PORT *pRxPort) /* pointer to receive port struct */ +{ +RXD *pRxd; /* pointer to receive descriptors */ +SK_U32 Control; /* control field of descriptor */ +struct sk_buff *pMsg; /* pointer to message holding frame */ +struct sk_buff *pNewMsg; /* pointer to a new message for copying frame */ +int FrameLength; /* total length of received frame */ +SK_MBUF *pRlmtMbuf; /* ptr to a buffer for giving a frame to rlmt */ +SK_EVPARA EvPara; /* an event parameter union */ +int PortIndex = pRxPort->PortIndex; +unsigned int Offset; +unsigned int NumBytes; +unsigned int ForRlmt; +SK_BOOL IsBc; +SK_BOOL IsMc; +SK_U32 FrameStat; +unsigned short Csum1; +unsigned short Csum2; +unsigned short Type; +int Result; + +rx_start: + /* do forever; exit if RX_CTRL_OWN_BMU found */ + while (pRxPort->RxdRingFree < pAC->RxDescrPerRing) { + pRxd = pRxPort->pRxdRingHead; + + Control = pRxd->RBControl; + + /* check if this descriptor is ready */ + if ((Control & RX_CTRL_OWN_BMU) != 0) { + /* this descriptor is not yet ready */ + FillRxRing(pAC, pRxPort); + return; + } + + /* get length of frame and check it */ + FrameLength = Control & RX_CTRL_LEN_MASK; + if (FrameLength > pAC->RxBufSize) + goto rx_failed; + + /* check for STF and EOF */ + if ((Control & (RX_CTRL_STF | RX_CTRL_EOF)) != + (RX_CTRL_STF | RX_CTRL_EOF)) + goto rx_failed; + + /* here we have a complete frame in the ring */ + pMsg = pRxd->pMBuf; + + /* + * if short frame then copy data to reduce memory waste + */ + if (FrameLength < SK_COPY_THRESHOLD) { + pNewMsg = alloc_skb(FrameLength+2, GFP_ATOMIC); + if (pNewMsg == NULL) { + /* use original skb */ + /* set length in message */ + skb_put(pMsg, FrameLength); + } + else { + /* alloc new skb and copy data */ + skb_reserve(pNewMsg, 2); + skb_put(pNewMsg, FrameLength); + eth_copy_and_sum(pNewMsg, pMsg->data, + FrameLength, 0); + ReQueueRxBuffer(pAC, pRxPort, pMsg, + pRxd->VDataHigh, pRxd->VDataLow); + pMsg = pNewMsg; + } + } + else { + /* set length in message */ + skb_put(pMsg, FrameLength); + /* hardware checksum */ + Type = ntohs(*((short*)&pMsg->data[12])); + if (Type == 0x800) { + Csum1= pRxd->TcpSums & 0xffff; + Csum2=(pRxd->TcpSums >> 16) & 0xffff; + if ((Csum1 & 0xfffe) && (Csum2 & 0xfffe)) { + Result = SkCsGetReceiveInfo(pAC, + &pMsg->data[14], + Csum1, Csum2); + if (Result == + SKCS_STATUS_IP_FRAGMENT || + Result == + SKCS_STATUS_IP_CSUM_OK || + Result == + SKCS_STATUS_TCP_CSUM_OK || + Result == + SKCS_STATUS_UDP_CSUM_OK) { + pMsg->ip_summed = + CHECKSUM_UNNECESSARY; + } + } /* checksum calculation valid */ + } /* IP frame */ + } /* frame > SK_COPY_TRESHOLD */ + + FrameStat = pRxd->FrameStat; + pRxd = pRxd->pNextRxd; + pRxPort->pRxdRingHead = pRxd; + pRxPort->RxdRingFree ++; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS, + ("Received frame of length %d on port %d\n", + FrameLength, PortIndex)); + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS, + ("Number of free rx descriptors: %d\n", + pRxPort->RxdRingFree)); + + if ((Control & RX_CTRL_STAT_VALID) == RX_CTRL_STAT_VALID && + (FrameStat & + (XMR_FS_ANY_ERR | XMR_FS_1L_VLAN | XMR_FS_2L_VLAN)) + == 0) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_RX_PROGRESS,("V")); + ForRlmt = SK_RLMT_RX_PROTOCOL; + IsBc = (FrameStat & XMR_FS_BC)==XMR_FS_BC; + SK_RLMT_PRE_LOOKAHEAD(pAC, PortIndex, FrameLength, + IsBc, &Offset, &NumBytes); + if (NumBytes != 0) { + IsMc = (FrameStat & XMR_FS_MC)==XMR_FS_MC; + SK_RLMT_LOOKAHEAD(pAC, PortIndex, + &pMsg->data[Offset], + IsBc, IsMc, &ForRlmt); + } + if (ForRlmt == SK_RLMT_RX_PROTOCOL) { + /* send up only frames from active port */ + if (PortIndex == pAC->ActivePort) { + /* frame for upper layer */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_RX_PROGRESS, + ("U")); +#ifdef DUMP_RX + DumpMsg(pMsg, "Rx"); +#endif + pMsg->dev = pAC->dev; + pMsg->protocol = eth_type_trans(pMsg, + pAC->dev); + SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC, + FrameLength); + netif_rx(pMsg); + pAC->dev->last_rx = jiffies; + } + else { + /* drop frame */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_RX_PROGRESS, + ("D")); + DEV_KFREE_SKB(pMsg); + } + } /* if not for rlmt */ + else { + /* packet for rlmt */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_RX_PROGRESS, ("R")); + pRlmtMbuf = SkDrvAllocRlmtMbuf(pAC, + pAC->IoBase, FrameLength); + if (pRlmtMbuf != NULL) { + pRlmtMbuf->pNext = NULL; + pRlmtMbuf->Length = FrameLength; + pRlmtMbuf->PortIdx = PortIndex; + EvPara.pParaPtr = pRlmtMbuf; + memcpy((char*)(pRlmtMbuf->pData), + (char*)(pMsg->data), + FrameLength); + SkEventQueue(pAC, SKGE_RLMT, + SK_RLMT_PACKET_RECEIVED, + EvPara); + pAC->CheckQueue = SK_TRUE; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_RX_PROGRESS, + ("Q")); + } + if ((pAC->dev->flags & + (IFF_PROMISC | IFF_ALLMULTI)) != 0 || + (ForRlmt & SK_RLMT_RX_PROTOCOL) == + SK_RLMT_RX_PROTOCOL) { + pMsg->dev = pAC->dev; + pMsg->protocol = eth_type_trans(pMsg, + pAC->dev); + netif_rx(pMsg); + pAC->dev->last_rx = jiffies; + } + else { + DEV_KFREE_SKB(pMsg); + } + + } /* if packet for rlmt */ + } /* if valid frame */ + else { + /* there is a receive error in this frame */ + if ((FrameStat & XMR_FS_1L_VLAN) != 0) { + printk("%s: Received frame" + " with VLAN Level 1 header, check" + " switch configuration\n", + pAC->dev->name); + } + if ((FrameStat & XMR_FS_2L_VLAN) != 0) { + printk("%s: Received frame" + " with VLAN Level 2 header, check" + " switch configuration\n", + pAC->dev->name); + } + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, + SK_DBGCAT_DRV_RX_PROGRESS, + ("skge: Error in received frame, dropped!\n" + "Control: %x\nRxStat: %x\n", + Control, FrameStat)); + DEV_KFREE_SKB(pMsg); + } + } /* while */ + FillRxRing(pAC, pRxPort); + /* do not start if called from Close */ + if (pAC->BoardLevel > 0) { + ClearAndStartRx(pAC, PortIndex); + } + return; + +rx_failed: + /* remove error frame */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR, + ("Schrottdescriptor, length: 0x%x\n", FrameLength)); + DEV_KFREE_SKB(pRxd->pMBuf); + pRxd->pMBuf = NULL; + pRxPort->RxdRingFree++; + pRxPort->pRxdRingHead = pRxd->pNextRxd; + goto rx_start; + +} /* ReceiveIrq */ + + +/***************************************************************************** + * + * ClearAndStartRx - give a start receive command to BMU, clear IRQ + * + * Description: + * This function sends a start command and a clear interrupt + * command for one receive queue to the BMU. + * + * Returns: N/A + * none + */ +static void ClearAndStartRx( +SK_AC *pAC, /* pointer to the adapter context */ +int PortIndex) /* index of the receive port (XMAC) */ +{ + SK_OUT8(pAC->IoBase, RxQueueAddr[PortIndex]+RX_Q_CTRL, + RX_Q_CTRL_START | RX_Q_CTRL_CLR_I_EOF); +} /* ClearAndStartRx */ + + +/***************************************************************************** + * + * ClearTxIrq - give a clear transmit IRQ command to BMU + * + * Description: + * This function sends a clear tx IRQ command for one + * transmit queue to the BMU. + * + * Returns: N/A + */ +static void ClearTxIrq( +SK_AC *pAC, /* pointer to the adapter context */ +int PortIndex, /* index of the transmit port (XMAC) */ +int Prio) /* priority or normal queue */ +{ + SK_OUT8(pAC->IoBase, TxQueueAddr[PortIndex][Prio]+TX_Q_CTRL, + TX_Q_CTRL_CLR_I_EOF); +} /* ClearTxIrq */ + + +/***************************************************************************** + * + * ClearRxRing - remove all buffers from the receive ring + * + * Description: + * This function removes all receive buffers from the ring. + * The receive BMU must be stopped before calling this function. + * + * Returns: N/A + */ +static void ClearRxRing( +SK_AC *pAC, /* pointer to adapter context */ +RX_PORT *pRxPort) /* pointer to rx port struct */ +{ +RXD *pRxd; /* pointer to the current descriptor */ +unsigned int Flags; + + if (pRxPort->RxdRingFree == pAC->RxDescrPerRing) { + return; + } + spin_lock_irqsave(&pRxPort->RxDesRingLock, Flags); + pRxd = pRxPort->pRxdRingHead; + do { + if (pRxd->pMBuf != NULL) { + DEV_KFREE_SKB(pRxd->pMBuf); + pRxd->pMBuf = NULL; + } + pRxd->RBControl &= RX_CTRL_OWN_BMU; + pRxd = pRxd->pNextRxd; + pRxPort->RxdRingFree++; + } while (pRxd != pRxPort->pRxdRingTail); + pRxPort->pRxdRingTail = pRxPort->pRxdRingHead; + spin_unlock_irqrestore(&pRxPort->RxDesRingLock, Flags); +} /* ClearRxRing */ + + +/***************************************************************************** + * + * ClearTxRing - remove all buffers from the transmit ring + * + * Description: + * This function removes all transmit buffers from the ring. + * The transmit BMU must be stopped before calling this function + * and transmitting at the upper level must be disabled. + * The BMU own bit of all descriptors is cleared, the rest is + * done by calling FreeTxDescriptors. + * + * Returns: N/A + */ +static void ClearTxRing( +SK_AC *pAC, /* pointer to adapter context */ +TX_PORT *pTxPort) /* pointer to tx prt struct */ +{ +TXD *pTxd; /* pointer to the current descriptor */ +int i; +unsigned int Flags; + + spin_lock_irqsave(&pTxPort->TxDesRingLock, Flags); + pTxd = pTxPort->pTxdRingHead; + for (i=0; iTxDescrPerRing; i++) { + pTxd->TBControl &= ~TX_CTRL_OWN_BMU; + pTxd = pTxd->pNextTxd; + } + FreeTxDescriptors(pAC, pTxPort); + spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); +} /* ClearTxRing */ + + +/***************************************************************************** + * + * SetQueueSizes - configure the sizes of rx and tx queues + * + * Description: + * This function assigns the sizes for active and passive port + * to the appropriate HWinit structure variables. + * The passive port(s) get standard values, all remaining RAM + * is given to the active port. + * The queue sizes are in kbyte and must be multiple of 8. + * The limits for the number of buffers filled into the rx rings + * is also set in this routine. + * + * Returns: + * none + */ +static void SetQueueSizes( +SK_AC *pAC) /* pointer to the adapter context */ +{ +int StandbyRam; /* adapter RAM used for a standby port */ +int RemainingRam; /* adapter RAM available for the active port */ +int RxRam; /* RAM used for the active port receive queue */ +int i; /* loop counter */ + + StandbyRam = SK_RLMT_STANDBY_QRXSIZE + SK_RLMT_STANDBY_QXASIZE + + SK_RLMT_STANDBY_QXSSIZE; + RemainingRam = pAC->GIni.GIRamSize - + (pAC->GIni.GIMacsFound-1) * StandbyRam; + for (i=0; iGIni.GIMacsFound; i++) { + pAC->GIni.GP[i].PRxQSize = SK_RLMT_STANDBY_QRXSIZE; + pAC->GIni.GP[i].PXSQSize = SK_RLMT_STANDBY_QXSSIZE; + pAC->GIni.GP[i].PXAQSize = SK_RLMT_STANDBY_QXASIZE; + } + RxRam = (RemainingRam * 8 / 10) & ~7; + pAC->GIni.GP[pAC->ActivePort].PRxQSize = RxRam; + pAC->GIni.GP[pAC->ActivePort].PXSQSize = 0; + pAC->GIni.GP[pAC->ActivePort].PXAQSize = + (RemainingRam - RxRam) & ~7; + pAC->RxQueueSize = RxRam; + pAC->TxSQueueSize = 0; + pAC->TxAQueueSize = (RemainingRam - RxRam) & ~7; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("queue sizes settings - rx:%d txA:%d txS:%d\n", + pAC->RxQueueSize,pAC->TxAQueueSize, pAC->TxSQueueSize)); + + for (i=0; iRxPort[i].RxFillLimit = pAC->RxDescrPerRing; + } + for (i=0; iGIni.GIMacsFound; i++) { + pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing - 100; + } + /* + * Do not set the Limit to 0, because this could cause + * wrap around with ReQueue'ed buffers (a buffer could + * be requeued in the same position, made accessable to + * the hardware, and the hardware could change its + * contents! + */ + pAC->RxPort[pAC->ActivePort].RxFillLimit = 1; + +#ifdef DEBUG + for (i=0; iGIni.GIMacsFound; i++) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, + ("i: %d, RxQSize: %d, PXSQsize: %d, PXAQSize: %d\n", + i, + pAC->GIni.GP[i].PRxQSize, + pAC->GIni.GP[i].PXSQSize, + pAC->GIni.GP[i].PXAQSize)); + } +#endif +} /* SetQueueSizes */ + + +/***************************************************************************** + * + * SkGeSetMacAddr - Set the hardware MAC address + * + * Description: + * This function sets the MAC address used by the adapter. + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +static int SkGeSetMacAddr(struct net_device *dev, void *p) +{ +SK_AC *pAC = (SK_AC*) dev->priv; +struct sockaddr *addr = p; +unsigned int Flags; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeSetMacAddr starts now...\n")); + if(dev->start) { + return -EBUSY; + } + memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); + + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + SkAddrOverride(pAC, pAC->IoBase, pAC->ActivePort, + (SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); + + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + return 0; +} /* SkGeSetMacAddr */ + + +/***************************************************************************** + * + * SkGeSetRxMode - set receive mode + * + * Description: + * This function sets the receive mode of an adapter. The adapter + * supports promiscuous mode, allmulticast mode and a number of + * multicast addresses. If more multicast addresses the available + * are selected, a hash function in the hardware is used. + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +static void SkGeSetRxMode(struct net_device *dev) +{ +SK_AC *pAC; +struct dev_mc_list *pMcList; +int i; +unsigned int Flags; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeSetRxMode starts now... ")); + pAC = (SK_AC*) dev->priv; + + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + if (dev->flags & IFF_PROMISC) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("PROMISCUOUS mode\n")); + SkAddrPromiscuousChange(pAC, pAC->IoBase, pAC->ActivePort, + SK_PROM_MODE_LLC); + } else if (dev->flags & IFF_ALLMULTI) { + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("ALLMULTI mode\n")); + SkAddrPromiscuousChange(pAC, pAC->IoBase, pAC->ActivePort, + SK_PROM_MODE_ALL_MC); + } else { + SkAddrPromiscuousChange(pAC, pAC->IoBase, pAC->ActivePort, + SK_PROM_MODE_NONE); + SkAddrMcClear(pAC, pAC->IoBase, pAC->ActivePort, 0); + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("Number of MC entries: %d ", dev->mc_count)); + + pMcList = dev->mc_list; + for (i=0; imc_count; i++, pMcList = pMcList->next) { + SkAddrMcAdd(pAC, pAC->IoBase, pAC->ActivePort, + (SK_MAC_ADDR*)pMcList->dmi_addr, 0); + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MCA, + ("%02x:%02x:%02x:%02x:%02x:%02x\n", + pMcList->dmi_addr[0], + pMcList->dmi_addr[1], + pMcList->dmi_addr[2], + pMcList->dmi_addr[3], + pMcList->dmi_addr[4], + pMcList->dmi_addr[5])); + } + SkAddrMcUpdate(pAC, pAC->IoBase, pAC->ActivePort); + + } + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + + return; +} /* SkGeSetRxMode */ + + +/***************************************************************************** + * + * SkGeChangeMtu - set the MTU to another value + * + * Description: + * This function sets is called whenever the MTU size is changed + * (ifconfig mtu xxx dev ethX). If the MTU is bigger than standard + * ethernet MTU size, long frame support is activated. + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +static int SkGeChangeMtu(struct net_device *dev, int NewMtu) +{ +SK_AC *pAC; +unsigned int Flags; +int i; +SK_EVPARA EvPara; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeChangeMtu starts now...\n")); + + pAC = (SK_AC*) dev->priv; + if ((NewMtu < 68) || (NewMtu > SK_JUMBO_MTU)) { + return -EINVAL; + } + + pAC->RxBufSize = NewMtu + 32; + dev->mtu = NewMtu; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("New MTU: %d\n", NewMtu)); + + /* prevent reconfiguration while changing the MTU */ + + /* disable interrupts */ + SK_OUT32(pAC->IoBase, B0_IMSK, 0); + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); + SkEventDispatcher(pAC, pAC->IoBase); + + for (i=0; iGIni.GIMacsFound; i++) { + spin_lock_irqsave( + &pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock, Flags); + } + pAC->dev->tbusy = 1; + + /* + * adjust number of rx buffers allocated + */ + if (NewMtu > 1500) { + /* use less rx buffers */ + for (i=0; iGIni.GIMacsFound; i++) { + if (i == pAC->ActivePort) + pAC->RxPort[i].RxFillLimit = + pAC->RxDescrPerRing - 100; + else + pAC->RxPort[i].RxFillLimit = + pAC->RxDescrPerRing - 10; + + } + } + else { + /* use normal anoumt of rx buffers */ + for (i=0; iGIni.GIMacsFound; i++) { + if (i == pAC->ActivePort) + pAC->RxPort[i].RxFillLimit = 1; + else + pAC->RxPort[i].RxFillLimit = + pAC->RxDescrPerRing - 100; + } + } + + SkGeDeInit(pAC, pAC->IoBase); + + /* + * enable/disable hardware support for long frames + */ + if (NewMtu > 1500) { + pAC->GIni.GIPortUsage = SK_JUMBO_LINK; + for (i=0; iGIni.GIMacsFound; i++) { + pAC->GIni.GP[i].PRxCmd = + XM_RX_STRIP_FCS | XM_RX_LENERR_OK; + } + } + else { + pAC->GIni.GIPortUsage = SK_RED_LINK; + for (i=0; iGIni.GIMacsFound; i++) { + pAC->GIni.GP[i].PRxCmd = + XM_RX_STRIP_FCS | XM_RX_LENERR_OK; + } + } + + SkGeInit( pAC, pAC->IoBase, 1); + SkI2cInit( pAC, pAC->IoBase, 1); + SkEventInit(pAC, pAC->IoBase, 1); + SkPnmiInit( pAC, pAC->IoBase, 1); + SkAddrInit( pAC, pAC->IoBase, 1); + SkRlmtInit( pAC, pAC->IoBase, 1); + SkTimerInit(pAC, pAC->IoBase, 1); + + SkGeInit( pAC, pAC->IoBase, 2); + SkI2cInit( pAC, pAC->IoBase, 2); + SkEventInit(pAC, pAC->IoBase, 2); + SkPnmiInit( pAC, pAC->IoBase, 2); + SkAddrInit( pAC, pAC->IoBase, 2); + SkRlmtInit( pAC, pAC->IoBase, 2); + SkTimerInit(pAC, pAC->IoBase, 2); + + /* + * clear and reinit the rx rings here + */ + for (i=0; iGIni.GIMacsFound; i++) { + ReceiveIrq(pAC, &pAC->RxPort[i]); + ClearRxRing(pAC, &pAC->RxPort[i]); + FillRxRing(pAC, &pAC->RxPort[i]); + + // Enable transmit descriptor polling. + SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE); + FillRxRing(pAC, &pAC->RxPort[i]); + }; + + SkGeYellowLED(pAC, pAC->IoBase, 1); + +#ifdef USE_INT_MOD + { + unsigned long ModBase; + ModBase = 53125000 / INTS_PER_SEC; + SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase); + SK_OUT32(pAC->IoBase, B2_IRQM_MSK, IRQ_MOD_MASK); + SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_START); + } +#endif + + pAC->dev->tbusy = 0; + for (i=pAC->GIni.GIMacsFound-1; i>=0; i--) { + spin_unlock_irqrestore( + &pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock, Flags); + } + + /* enable Interrupts */ + SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); + SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK); + + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); + SkEventDispatcher(pAC, pAC->IoBase); + + + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + + return 0; +} /* SkGeChangeMtu */ + + +/***************************************************************************** + * + * SkGeStats - return ethernet device statistics + * + * Description: + * This function return statistic data about the ethernet device + * to the operating system. + * + * Returns: + * pointer to the statistic structure. + */ +static struct net_device_stats *SkGeStats(struct net_device *dev) +{ +SK_AC *pAC = (SK_AC*) dev->priv; +SK_PNMI_STRUCT_DATA *pPnmiStruct; /* structure for all Pnmi-Data */ +SK_PNMI_STAT *pPnmiStat; /* pointer to virtual XMAC stat. data */SK_PNMI_CONF *pPnmiConf; /* pointer to virtual link config. */ +unsigned int Size; /* size of pnmi struct */ +unsigned int Flags; /* for spin lock */ + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeStats starts now...\n")); + pPnmiStruct = &pAC->PnmiStruct; + memset(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA)); + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + Size = SK_PNMI_STRUCT_SIZE; + SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size); + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + pPnmiStat = &pPnmiStruct->Stat[0]; + pPnmiConf = &pPnmiStruct->Conf[0]; + + pAC->stats.rx_packets = (SK_U32) pPnmiStruct->RxDeliveredCts & 0xFFFFFFFF; + pAC->stats.tx_packets = (SK_U32) pPnmiStat->StatTxOkCts & 0xFFFFFFFF; + pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; + pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; + pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; + pAC->stats.tx_errors = (SK_U32) pPnmiStat->StatTxSingleCollisionCts & 0xFFFFFFFF; + pAC->stats.rx_dropped = (SK_U32) pPnmiStruct->RxNoBufCts & 0xFFFFFFFF; + pAC->stats.tx_dropped = (SK_U32) pPnmiStruct->TxNoBufCts & 0xFFFFFFFF; + pAC->stats.multicast = (SK_U32) pPnmiStat->StatRxMulticastOkCts & 0xFFFFFFFF; + pAC->stats.collisions = (SK_U32) pPnmiStat->StatTxSingleCollisionCts & 0xFFFFFFFF; + + /* detailed rx_errors: */ + pAC->stats.rx_length_errors = (SK_U32) pPnmiStat->StatRxRuntCts & 0xFFFFFFFF; + pAC->stats.rx_over_errors = (SK_U32) pPnmiStat->StatRxFifoOverflowCts & 0xFFFFFFFF; + pAC->stats.rx_crc_errors = (SK_U32) pPnmiStat->StatRxFcsCts & 0xFFFFFFFF; + pAC->stats.rx_frame_errors = (SK_U32) pPnmiStat->StatRxFramingCts & 0xFFFFFFFF; + pAC->stats.rx_fifo_errors = (SK_U32) pPnmiStat->StatRxFifoOverflowCts & 0xFFFFFFFF; + pAC->stats.rx_missed_errors = (SK_U32) pPnmiStat->StatRxMissedCts & 0xFFFFFFFF; + + /* detailed tx_errors */ + pAC->stats.tx_aborted_errors = (SK_U32) 0; + pAC->stats.tx_carrier_errors = (SK_U32) pPnmiStat->StatTxCarrierCts & 0xFFFFFFFF; + pAC->stats.tx_fifo_errors = (SK_U32) pPnmiStat->StatTxFifoUnderrunCts & 0xFFFFFFFF; + pAC->stats.tx_heartbeat_errors = (SK_U32) pPnmiStat->StatTxCarrierCts & 0xFFFFFFFF; + pAC->stats.tx_window_errors = (SK_U32) 0; + + return(&pAC->stats); +} /* SkGeStats */ + + +/***************************************************************************** + * + * SkGeIoctl - IO-control function + * + * Description: + * This function is called if an ioctl is issued on the device. + * There are three subfunction for reading, writing and test-writing + * the private MIB data structure (usefull for SysKonnect-internal tools). + * + * Returns: + * 0, if everything is ok + * !=0, on error + */ +static int SkGeIoctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ +SK_AC *pAC; +SK_GE_IOCTL Ioctl; +unsigned int Err = 0; +int Size; + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeIoctl starts now...\n")); + pAC = (SK_AC*) dev->priv; + + if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) { + return -EFAULT; + } + + switch(cmd) { + case SK_IOCTL_SETMIB: + case SK_IOCTL_PRESETMIB: + if (!capable(CAP_NET_ADMIN)) return -EPERM; + case SK_IOCTL_GETMIB: + if(copy_from_user(&pAC->PnmiStruct, Ioctl.pData, + Ioctl.LenPnmiStruct)? + Ioctl.Len : sizeof(pAC->PnmiStruct))) { + return -EFAULT; + } + Size = SkGeIocMib(pAC, Ioctl.Len, cmd); + if(copy_to_user(Ioctl.pData, &pAC->PnmiStruct, + Ioctl.Lenifr_data, &Ioctl, sizeof(SK_GE_IOCTL))) { + return -EFAULT; + } + break; + default: + Err = -EOPNOTSUPP; + } + return(Err); +} /* SkGeIoctl */ + + +/***************************************************************************** + * + * SkGeIocMib - handle a GetMib, SetMib- or PresetMib-ioctl message + * + * Description: + * This function reads/writes the MIB data using PNMI (Private Network + * Management Interface). + * The destination for the data must be provided with the + * ioctl call and is given to the driver in the form of + * a user space address. + * Copying from the user-provided data area into kernel messages + * and back is done by copy_from_user and copy_to_user calls in + * SkGeIoctl. + * + * Returns: + * returned size from PNMI call + */ +static int SkGeIocMib( +SK_AC *pAC, /* pointer to the adapter context */ +unsigned int Size, /* length of ioctl data */ +int mode) /* flag for set/preset */ +{ +unsigned int Flags; /* for spin lock */ + + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("SkGeIocMib starts now...\n")); + /* access MIB */ + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + switch(mode) { + case SK_IOCTL_GETMIB: + SkPnmiGetStruct(pAC, pAC->IoBase, &pAC->PnmiStruct, &Size); + break; + case SK_IOCTL_PRESETMIB: + SkPnmiPreSetStruct(pAC, pAC->IoBase, &pAC->PnmiStruct, &Size); + break; + case SK_IOCTL_SETMIB: + SkPnmiSetStruct(pAC, pAC->IoBase, &pAC->PnmiStruct, &Size); + break; + default: + break; + } + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, + ("MIB data access succeeded\n")); + return (Size); +} /* SkGeIocMib */ + + +/***************************************************************************** + * + * GetConfiguration - read configuration information + * + * Description: + * This function reads per-adapter configuration information from + * the options provided on the command line. + * + * Returns: + * none + */ +static void GetConfiguration( +SK_AC *pAC) /* pointer to the adapter context structure */ +{ +SK_I32 Port; /* preferred port */ +int AutoNeg; /* auto negotiation off (0) or on (1) */ +int DuplexCap; /* duplex capabilities (0=both, 1=full, 2=half */ +int MSMode; /* master / slave mode selection */ +SK_BOOL AutoSet; +SK_BOOL DupSet; +/* + * The two parameters AutoNeg. and DuplexCap. map to one configuration + * parameter. The mapping is described by this table: + * DuplexCap -> | both | full | half | + * AutoNeg | | | | + * ----------------------------------------------------------------- + * Off | illegal | Full | Half | + * ----------------------------------------------------------------- + * On | AutoBoth | AutoFull | AutoHalf | + * ----------------------------------------------------------------- + * Sense | AutoSense | AutoSense | AutoSense | + */ +int Capabilities[3][3] = + { { -1, SK_LMODE_FULL, SK_LMODE_HALF}, + {SK_LMODE_AUTOBOTH, SK_LMODE_AUTOFULL, SK_LMODE_AUTOHALF}, + {SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE} }; +#define DC_BOTH 0 +#define DC_FULL 1 +#define DC_HALF 2 +#define AN_OFF 0 +#define AN_ON 1 +#define AN_SENS 2 + + /* settings for port A */ + AutoNeg = AN_SENS; /* default: do auto Sense */ + AutoSet = SK_FALSE; + if (AutoNeg_A != NULL && pAC->IndexIndex] != NULL) { + AutoSet = SK_TRUE; + if (strcmp(AutoNeg_A[pAC->Index],"")==0) { + AutoSet = SK_FALSE; + } + else if (strcmp(AutoNeg_A[pAC->Index],"On")==0) { + AutoNeg = AN_ON; + } + else if (strcmp(AutoNeg_A[pAC->Index],"Off")==0) { + AutoNeg = AN_OFF; + } + else if (strcmp(AutoNeg_A[pAC->Index],"Sense")==0) { + AutoNeg = AN_SENS; + } + else printk("%s: Illegal value for AutoNeg_A\n", + pAC->dev->name); + } + + DuplexCap = DC_BOTH; + DupSet = SK_FALSE; + if (DupCap_A != NULL && pAC->IndexIndex] != NULL) { + DupSet = SK_TRUE; + if (strcmp(DupCap_A[pAC->Index],"")==0) { + DupSet = SK_FALSE; + } + else if (strcmp(DupCap_A[pAC->Index],"Both")==0) { + DuplexCap = DC_BOTH; + } + else if (strcmp(DupCap_A[pAC->Index],"Full")==0) { + DuplexCap = DC_FULL; + } + else if (strcmp(DupCap_A[pAC->Index],"Half")==0) { + DuplexCap = DC_HALF; + } + else printk("%s: Illegal value for DupCap_A\n", + pAC->dev->name); + } + + /* check for illegal combinations */ + if (AutoSet && AutoNeg==AN_SENS && DupSet) { + printk("%s, Port A: DuplexCapabilities" + " ignored using Sense mode\n", pAC->dev->name); + } + if (AutoSet && AutoNeg==AN_OFF && DupSet && DuplexCap==DC_BOTH){ + printk("%s, Port A: Illegal combination" + " of values AutoNeg. and DuplexCap.\n Using " + "Full Duplex\n", pAC->dev->name); + + DuplexCap = DC_FULL; + } + if (AutoSet && AutoNeg==AN_OFF && !DupSet) { + DuplexCap = DC_FULL; + } + + if (!AutoSet && DupSet) { + printk("%s, Port A: Duplex setting not" + " possible in\n default AutoNegotiation mode" + " (Sense).\n Using AutoNegotiation On\n", + pAC->dev->name); + AutoNeg = AN_ON; + } + + /* set the desired mode */ + pAC->GIni.GP[0].PLinkModeConf = + Capabilities[AutoNeg][DuplexCap]; + + pAC->GIni.GP[0].PFlowCtrlMode = SK_FLOW_MODE_SYM_OR_REM; + if (FlowCtrl_A != NULL && pAC->IndexIndex] != NULL) { + if (strcmp(FlowCtrl_A[pAC->Index],"") == 0) { + } + else if (strcmp(FlowCtrl_A[pAC->Index],"SymOrRem") == 0) { + pAC->GIni.GP[0].PFlowCtrlMode = + SK_FLOW_MODE_SYM_OR_REM; + } + else if (strcmp(FlowCtrl_A[pAC->Index],"Sym")==0) { + pAC->GIni.GP[0].PFlowCtrlMode = + SK_FLOW_MODE_SYMMETRIC; + } + else if (strcmp(FlowCtrl_A[pAC->Index],"LocSend")==0) { + pAC->GIni.GP[0].PFlowCtrlMode = + SK_FLOW_MODE_LOC_SEND; + } + else if (strcmp(FlowCtrl_A[pAC->Index],"None")==0) { + pAC->GIni.GP[0].PFlowCtrlMode = + SK_FLOW_MODE_NONE; + } + else printk("Illegal value for FlowCtrl_A\n"); + } + if (AutoNeg==AN_OFF && pAC->GIni.GP[0].PFlowCtrlMode!= + SK_FLOW_MODE_NONE) { + printk("%s, Port A: FlowControl" + " impossible without AutoNegotiation," + " disabled\n", pAC->dev->name); + pAC->GIni.GP[0].PFlowCtrlMode = SK_FLOW_MODE_NONE; + } + + MSMode = SK_MS_MODE_AUTO; /* default: do auto select */ + if (Role_A != NULL && pAC->IndexIndex] != NULL) { + if (strcmp(Role_A[pAC->Index],"")==0) { + } + else if (strcmp(Role_A[pAC->Index],"Auto")==0) { + MSMode = SK_MS_MODE_AUTO; + } + else if (strcmp(Role_A[pAC->Index],"Master")==0) { + MSMode = SK_MS_MODE_MASTER; + } + else if (strcmp(Role_A[pAC->Index],"Slave")==0) { + MSMode = SK_MS_MODE_SLAVE; + } + else printk("%s: Illegal value for Role_A\n", + pAC->dev->name); + } + pAC->GIni.GP[0].PMSMode = MSMode; + + + /* settings for port B */ + AutoNeg = AN_SENS; /* default: do auto Sense */ + AutoSet = SK_FALSE; + if (AutoNeg_B != NULL && pAC->IndexIndex] != NULL) { + AutoSet = SK_TRUE; + if (strcmp(AutoNeg_B[pAC->Index],"")==0) { + AutoSet = SK_FALSE; + } + else if (strcmp(AutoNeg_B[pAC->Index],"On")==0) { + AutoNeg = AN_ON; + } + else if (strcmp(AutoNeg_B[pAC->Index],"Off")==0) { + AutoNeg = AN_OFF; + } + else if (strcmp(AutoNeg_B[pAC->Index],"Sense")==0) { + AutoNeg = AN_SENS; + } + else printk("Illegal value for AutoNeg_B\n"); + } + + DuplexCap = DC_BOTH; + DupSet = SK_FALSE; + if (DupCap_B != NULL && pAC->IndexIndex] != NULL) { + DupSet = SK_TRUE; + if (strcmp(DupCap_B[pAC->Index],"")==0) { + DupSet = SK_FALSE; + } + else if (strcmp(DupCap_B[pAC->Index],"Both")==0) { + DuplexCap = DC_BOTH; + } + else if (strcmp(DupCap_B[pAC->Index],"Full")==0) { + DuplexCap = DC_FULL; + } + else if (strcmp(DupCap_B[pAC->Index],"Half")==0) { + DuplexCap = DC_HALF; + } + else printk("Illegal value for DupCap_B\n"); + } + + /* check for illegal combinations */ + if (AutoSet && AutoNeg==AN_SENS && DupSet) { + printk("%s, Port B: DuplexCapabilities" + " ignored using Sense mode\n", pAC->dev->name); + } + if (AutoSet && AutoNeg==AN_OFF && DupSet && DuplexCap==DC_BOTH){ + printk("%s, Port B: Illegal combination" + " of values AutoNeg. and DuplexCap.\n Using " + "Full Duplex\n", pAC->dev->name); + + DuplexCap = DC_FULL; + } + if (AutoSet && AutoNeg==AN_OFF && !DupSet) { + DuplexCap = DC_FULL; + } + + if (!AutoSet && DupSet) { + printk("%s, Port B: Duplex setting not" + " possible in\n default AutoNegotiation mode" + " (Sense).\n Using AutoNegotiation On\n", + pAC->dev->name); + AutoNeg = AN_ON; + } + + /* set the desired mode */ + pAC->GIni.GP[1].PLinkModeConf = + Capabilities[AutoNeg][DuplexCap]; + + pAC->GIni.GP[1].PFlowCtrlMode = SK_FLOW_MODE_SYM_OR_REM; + if (FlowCtrl_B != NULL && pAC->IndexIndex] != NULL) { + if (strcmp(FlowCtrl_B[pAC->Index],"") == 0) { + } + else if (strcmp(FlowCtrl_B[pAC->Index],"SymOrRem") == 0) { + pAC->GIni.GP[1].PFlowCtrlMode = + SK_FLOW_MODE_SYM_OR_REM; + } + else if (strcmp(FlowCtrl_B[pAC->Index],"Sym")==0) { + pAC->GIni.GP[1].PFlowCtrlMode = + SK_FLOW_MODE_SYMMETRIC; + } + else if (strcmp(FlowCtrl_B[pAC->Index],"LocSend")==0) { + pAC->GIni.GP[1].PFlowCtrlMode = + SK_FLOW_MODE_LOC_SEND; + } + else if (strcmp(FlowCtrl_B[pAC->Index],"None")==0) { + pAC->GIni.GP[1].PFlowCtrlMode = + SK_FLOW_MODE_NONE; + } + else printk("Illegal value for FlowCtrl_B\n"); + } + if (AutoNeg==AN_OFF && pAC->GIni.GP[1].PFlowCtrlMode!= + SK_FLOW_MODE_NONE) { + printk("%s, Port B: FlowControl" + " impossible without AutoNegotiation," + " disabled\n", pAC->dev->name); + pAC->GIni.GP[1].PFlowCtrlMode = SK_FLOW_MODE_NONE; + } + + MSMode = SK_MS_MODE_AUTO; /* default: do auto select */ + if (Role_B != NULL && pAC->IndexIndex] != NULL) { + if (strcmp(Role_B[pAC->Index],"")==0) { + } + else if (strcmp(Role_B[pAC->Index],"Auto")==0) { + MSMode = SK_MS_MODE_AUTO; + } + else if (strcmp(Role_B[pAC->Index],"Master")==0) { + MSMode = SK_MS_MODE_MASTER; + } + else if (strcmp(Role_B[pAC->Index],"Slave")==0) { + MSMode = SK_MS_MODE_SLAVE; + } + else printk("%s: Illegal value for Role_B\n", + pAC->dev->name); + } + pAC->GIni.GP[1].PMSMode = MSMode; + + + /* settings for both ports */ + pAC->ActivePort = 0; + if (PrefPort != NULL && pAC->IndexIndex] != NULL) { + if (strcmp(PrefPort[pAC->Index],"") == 0) { /* Auto */ + pAC->ActivePort = 0; + pAC->Rlmt.MacPreferred = -1; /* auto */ + pAC->Rlmt.PrefPort = 0; + } + else if (strcmp(PrefPort[pAC->Index],"A") == 0) { + /* + * do not set ActivePort here, thus a port + * switch is issued after net up. + */ + Port = 0; + pAC->Rlmt.MacPreferred = Port; + pAC->Rlmt.PrefPort = Port; + } + else if (strcmp(PrefPort[pAC->Index],"B") == 0) { + /* + * do not set ActivePort here, thus a port + * switch is issued after net up. + */ + Port = 1; + pAC->Rlmt.MacPreferred = Port; + pAC->Rlmt.PrefPort = Port; + } + else printk("%s: Illegal value for PrefPort\n", + pAC->dev->name); + } + + if (RlmtMode != NULL && pAC->IndexIndex] != NULL) { + if (strcmp(RlmtMode[pAC->Index], "") == 0) { + pAC->RlmtMode = 0; + } + else if (strcmp(RlmtMode[pAC->Index], "CheckLinkState") == 0) { + pAC->RlmtMode = SK_RLMT_CHECK_LINK; + } + else if (strcmp(RlmtMode[pAC->Index], "CheckLocalPort") == 0) { + pAC->RlmtMode = SK_RLMT_CHECK_LINK | + SK_RLMT_CHECK_LOC_LINK; + } + else if (strcmp(RlmtMode[pAC->Index], "CheckSeg") == 0) { + pAC->RlmtMode = SK_RLMT_CHECK_LINK | + SK_RLMT_CHECK_LOC_LINK | + SK_RLMT_CHECK_SEG; + } + else { + printk("%s: Illegal value for" + " RlmtMode, using default\n", pAC->dev->name); + pAC->RlmtMode = 0; + } + } + else { + pAC->RlmtMode = 0; + } +} /* GetConfiguration */ + + +/***************************************************************************** + * + * ProductStr - return a adapter identification string from vpd + * + * Description: + * This function reads the product name string from the vpd area + * and puts it the field pAC->DeviceString. + * + * Returns: N/A + */ +static void ProductStr( +SK_AC *pAC /* pointer to adapter context */ +) +{ +int StrLen = 80; /* length of the string, defined in SK_AC */ +char Keyword[] = VPD_NAME; /* vpd productname identifier */ +int ReturnCode; /* return code from vpd_read */ +unsigned int Flags; + + spin_lock_irqsave(&pAC->SlowPathLock, Flags); + ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, pAC->DeviceStr, + &StrLen); + spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); + if (ReturnCode != 0) { + /* there was an error reading the vpd data */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR, + ("Error reading VPD data: %d\n", ReturnCode)); + pAC->DeviceStr[0] = '\0'; + } +} /* ProductStr */ + + + + +/****************************************************************************/ +/* functions for common modules *********************************************/ +/****************************************************************************/ + + +/***************************************************************************** + * + * SkDrvAllocRlmtMbuf - allocate an RLMT mbuf + * + * Description: + * This routine returns an RLMT mbuf or NULL. The RLMT Mbuf structure + * is embedded into a socket buff data area. + * + * Context: + * runtime + * + * Returns: + * NULL or pointer to Mbuf. + */ +SK_MBUF *SkDrvAllocRlmtMbuf( +SK_AC *pAC, /* pointer to adapter context */ +SK_IOC IoC, /* the IO-context */ +unsigned BufferSize) /* size of the requested buffer */ +{ +SK_MBUF *pRlmtMbuf; /* pointer to a new rlmt-mbuf structure */ +struct sk_buff *pMsgBlock; /* pointer to a new message block */ + + pMsgBlock = alloc_skb(BufferSize + sizeof(SK_MBUF), GFP_ATOMIC); + if (pMsgBlock == NULL) { + return (NULL); + } + pRlmtMbuf = (SK_MBUF*) pMsgBlock->data; + skb_reserve(pMsgBlock, sizeof(SK_MBUF)); + pRlmtMbuf->pNext = NULL; + pRlmtMbuf->pOs = pMsgBlock; + pRlmtMbuf->pData = pMsgBlock->data; /* Data buffer. */ + pRlmtMbuf->Size = BufferSize; /* Data buffer size. */ + pRlmtMbuf->Length = 0; /* Length of packet (<= Size). */ + return (pRlmtMbuf); + +} /* SkDrvAllocRlmtMbuf */ + + +/***************************************************************************** + * + * SkDrvFreeRlmtMbuf - free an RLMT mbuf + * + * Description: + * This routine frees one or more RLMT mbuf(s). + * + * Context: + * runtime + * + * Returns: + * Nothing + */ +void SkDrvFreeRlmtMbuf( +SK_AC *pAC, /* pointer to adapter context */ +SK_IOC IoC, /* the IO-context */ +SK_MBUF *pMbuf) /* size of the requested buffer */ +{ +SK_MBUF *pFreeMbuf; +SK_MBUF *pNextMbuf; + + pFreeMbuf = pMbuf; + do { + pNextMbuf = pFreeMbuf->pNext; + DEV_KFREE_SKB(pFreeMbuf->pOs); + pFreeMbuf = pNextMbuf; + } while ( pFreeMbuf != NULL ); +} /* SkDrvFreeRlmtMbuf */ + + +/***************************************************************************** + * + * SkOsGetTime - provide a time value + * + * Description: + * This routine provides a time value. The unit is 1/HZ (defined by Linux). + * It is not used for absolute time, but only for time differences. + * + * + * Returns: + * Time value + */ +SK_U64 SkOsGetTime(SK_AC *pAC) +{ + return jiffies; +} /* SkOsGetTime */ + + +/***************************************************************************** + * + * SkPciReadCfgDWord - read a 32 bit value from pci config space + * + * Description: + * This routine reads a 32 bit value from the pci configuration + * space. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +int SkPciReadCfgDWord( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U32 *pVal) /* pointer to store the read value */ +{ + pci_read_config_dword(&pAC->PciDev, PciAddr, pVal); + return(0); +} /* SkPciReadCfgDWord */ + + +/***************************************************************************** + * + * SkPciReadCfgWord - read a 16 bit value from pci config space + * + * Description: + * This routine reads a 16 bit value from the pci configuration + * space. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +int SkPciReadCfgWord( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U16 *pVal) /* pointer to store the read value */ +{ + pci_read_config_word(&pAC->PciDev, PciAddr, pVal); + return(0); +} /* SkPciReadCfgWord */ + + +/***************************************************************************** + * + * SkPciReadCfgByte - read a 8 bit value from pci config space + * + * Description: + * This routine reads a 8 bit value from the pci configuration + * space. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +int SkPciReadCfgByte( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U8 *pVal) /* pointer to store the read value */ +{ + pci_read_config_byte(&pAC->PciDev, PciAddr, pVal); + return(0); +} /* SkPciReadCfgByte */ + + +/***************************************************************************** + * + * SkPciWriteCfgDWord - write a 32 bit value to pci config space + * + * Description: + * This routine writes a 32 bit value to the pci configuration + * space. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +int SkPciWriteCfgDWord( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U32 Val) /* pointer to store the read value */ +{ + pci_write_config_dword(&pAC->PciDev, PciAddr, Val); + return(0); +} /* SkPciWriteCfgDWord */ + + +/***************************************************************************** + * + * SkPciWriteCfgWord - write a 16 bit value to pci config space + * + * Description: + * This routine writes a 16 bit value to the pci configuration + * space. The flag PciConfigUp indicates whether the config space + * is accesible or must be set up first. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +int SkPciWriteCfgWord( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U16 Val) /* pointer to store the read value */ +{ + pci_write_config_word(&pAC->PciDev, PciAddr, Val); + return(0); +} /* SkPciWriteCfgWord */ + + +/***************************************************************************** + * + * SkPciWriteCfgWord - write a 8 bit value to pci config space + * + * Description: + * This routine writes a 8 bit value to the pci configuration + * space. The flag PciConfigUp indicates whether the config space + * is accesible or must be set up first. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +int SkPciWriteCfgByte( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U8 Val) /* pointer to store the read value */ +{ + pci_write_config_byte(&pAC->PciDev, PciAddr, Val); + return(0); +} /* SkPciWriteCfgByte */ + + +/***************************************************************************** + * + * SkDrvEvent - handle driver events + * + * Description: + * This function handles events from all modules directed to the driver + * + * Context: + * Is called under protection of slow path lock. + * + * Returns: + * 0 if everything ok + * < 0 on error + * + */ +int SkDrvEvent( +SK_AC *pAC, /* pointer to adapter context */ +SK_IOC IoC, /* io-context */ +SK_U32 Event, /* event-id */ +SK_EVPARA Param) /* event-parameter */ +{ +SK_MBUF *pRlmtMbuf; /* pointer to a rlmt-mbuf structure */ +struct sk_buff *pMsg; /* pointer to a message block */ +int FromPort; /* the port from which we switch away */ +int ToPort; /* the port we switch to */ +SK_EVPARA NewPara; /* parameter for further events */ +int Stat; +unsigned int Flags; + + switch (Event) { + case SK_DRV_ADAP_FAIL: + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("ADAPTER FAIL EVENT\n")); + printk("%s: Adapter failed.\n", pAC->dev->name); + /* disable interrupts */ + SK_OUT32(pAC->IoBase, B0_IMSK, 0); + /* cgoos */ + break; + case SK_DRV_PORT_FAIL: + FromPort = Param.Para32[0]; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("PORT FAIL EVENT, Port: %d\n", FromPort)); + if (FromPort == 0) { + printk("%s: Port A failed.\n", pAC->dev->name); + } else { + printk("%s: Port B failed.\n", pAC->dev->name); + } + /* cgoos */ + break; + case SK_DRV_PORT_RESET: /* SK_U32 PortIdx */ + /* action list 4 */ + FromPort = Param.Para32[0]; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("PORT RESET EVENT, Port: %d ", FromPort)); + NewPara.Para64 = FromPort; + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara); + spin_lock_irqsave( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST); + spin_unlock_irqrestore( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + + /* clear rx ring from received frames */ + ReceiveIrq(pAC, &pAC->RxPort[FromPort]); + + ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); + spin_lock_irqsave( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + SkGeInitPort(pAC, IoC, FromPort); + SkAddrMcUpdate(pAC,IoC, FromPort); + PortReInitBmu(pAC, FromPort); + SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); + ClearAndStartRx(pAC, FromPort); + spin_unlock_irqrestore( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + break; + case SK_DRV_NET_UP: /* SK_U32 PortIdx */ + /* action list 5 */ + FromPort = Param.Para32[0]; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("NET UP EVENT, Port: %d ", Param.Para32[0])); + printk("%s: network connection up using" + " port %c\n", pAC->dev->name, 'A'+Param.Para32[0]); + printk(" speed: 1000\n"); + Stat = pAC->GIni.GP[FromPort].PLinkModeStatus; + if (Stat == SK_LMODE_STAT_AUTOHALF || + Stat == SK_LMODE_STAT_AUTOFULL) { + printk(" autonegotiation: yes\n"); + } + else { + printk(" autonegotiation: no\n"); + } + if (Stat == SK_LMODE_STAT_AUTOHALF || + Stat == SK_LMODE_STAT_HALF) { + printk(" duplex mode: half\n"); + } + else { + printk(" duplex mode: full\n"); + } + Stat = pAC->GIni.GP[FromPort].PFlowCtrlStatus; + if (Stat == SK_FLOW_STAT_REM_SEND ) { + printk(" flowctrl: remote send\n"); + } + else if (Stat == SK_FLOW_STAT_LOC_SEND ){ + printk(" flowctrl: local send\n"); + } + else if (Stat == SK_FLOW_STAT_SYMMETRIC ){ + printk(" flowctrl: symmetric\n"); + } + else { + printk(" flowctrl: none\n"); + } + if (pAC->GIni.GP[FromPort].PhyType != SK_PHY_XMAC) { + Stat = pAC->GIni.GP[FromPort].PMSStatus; + if (Stat == SK_MS_STAT_MASTER ) { + printk(" role: master\n"); + } + else if (Stat == SK_MS_STAT_SLAVE ) { + printk(" role: slave\n"); + } + else { + printk(" role: ???\n"); + } + } + + if (Param.Para32[0] != pAC->ActivePort) { + NewPara.Para32[0] = pAC->ActivePort; + NewPara.Para32[1] = Param.Para32[0]; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_INTERN, + NewPara); + } + break; + case SK_DRV_NET_DOWN: /* SK_U32 Reason */ + /* action list 7 */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("NET DOWN EVENT ")); + printk("%s: network connection down\n", pAC->dev->name); + break; + case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("PORT SWITCH HARD ")); + case SK_DRV_SWITCH_SOFT: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ + /* action list 6 */ + printk("%s: switching to port %c\n", pAC->dev->name, + 'A'+Param.Para32[1]); + case SK_DRV_SWITCH_INTERN: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ + FromPort = Param.Para32[0]; + ToPort = Param.Para32[1]; + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("PORT SWITCH EVENT, From: %d To: %d (Pref %d) ", + FromPort, ToPort, pAC->Rlmt.PrefPort)); + NewPara.Para64 = FromPort; + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara); + NewPara.Para64 = ToPort; + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara); + spin_lock_irqsave( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + spin_lock_irqsave( + &pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock, Flags); + SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST); + SkGeStopPort(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST); + spin_unlock_irqrestore( + &pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock, Flags); + spin_unlock_irqrestore( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + + ReceiveIrq(pAC, &pAC->RxPort[FromPort]); /* clears rx ring */ + ReceiveIrq(pAC, &pAC->RxPort[ToPort]); /* clears rx ring */ + + ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); + ClearTxRing(pAC, &pAC->TxPort[ToPort][TX_PRIO_LOW]); + spin_lock_irqsave( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + spin_lock_irqsave( + &pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock, Flags); + pAC->ActivePort = ToPort; + SetQueueSizes(pAC); + SkGeInitPort(pAC, IoC, FromPort); + SkGeInitPort(pAC, IoC, ToPort); + if (Event == SK_DRV_SWITCH_SOFT) { + SkXmRxTxEnable(pAC, IoC, FromPort); + } + SkXmRxTxEnable(pAC, IoC, ToPort); + SkAddrSwap(pAC, IoC, FromPort, ToPort); + SkAddrMcUpdate(pAC, IoC, FromPort); + SkAddrMcUpdate(pAC, IoC, ToPort); + PortReInitBmu(pAC, FromPort); + PortReInitBmu(pAC, ToPort); + SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); + SkGePollTxD(pAC, IoC, ToPort, SK_TRUE); + ClearAndStartRx(pAC, FromPort); + ClearAndStartRx(pAC, ToPort); + spin_unlock_irqrestore( + &pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock, Flags); + spin_unlock_irqrestore( + &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, + Flags); + break; + case SK_DRV_RLMT_SEND: /* SK_MBUF *pMb */ + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("RLS ")); + pRlmtMbuf = (SK_MBUF*) Param.pParaPtr; + pMsg = (struct sk_buff*) pRlmtMbuf->pOs; + skb_put(pMsg, pRlmtMbuf->Length); + XmitFrame(pAC, &pAC->TxPort[pRlmtMbuf->PortIdx][TX_PRIO_LOW], + pMsg); + break; + default: + break; + } + SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, + ("END EVENT ")); + + return (0); +} /* SkDrvEvent */ + + +/***************************************************************************** + * + * SkErrorLog - log errors + * + * Description: + * This function logs errors to the system buffer and to the console + * + * Returns: + * 0 if everything ok + * < 0 on error + * + */ +void SkErrorLog( +SK_AC *pAC, +int ErrClass, +int ErrNum, +char *pErrorMsg) +{ +char ClassStr[80]; + + switch (ErrClass) { + case SK_ERRCL_OTHER: + strcpy(ClassStr, "Other error"); + break; + case SK_ERRCL_CONFIG: + strcpy(ClassStr, "Configuration error"); + break; + case SK_ERRCL_INIT: + strcpy(ClassStr, "Initialization error"); + break; + case SK_ERRCL_NORES: + strcpy(ClassStr, "Out of resources error"); + break; + case SK_ERRCL_SW: + strcpy(ClassStr, "internal Software error"); + break; + case SK_ERRCL_HW: + strcpy(ClassStr, "Hardware failure"); + break; + case SK_ERRCL_COMM: + strcpy(ClassStr, "Communication error"); + break; + } + printk(KERN_INFO "%s: -- ERROR --\n Class: %s\n" + " Nr: 0x%x\n Msg: %s\n", pAC->dev->name, + ClassStr, ErrNum, pErrorMsg); + +} /* SkErrorLog */ + +#ifdef DEBUG /***************************************************************/ +/* "debug only" section *****************************************************/ +/****************************************************************************/ + + +/***************************************************************************** + * + * DumpMsg - print a frame + * + * Description: + * This function prints frames to the system logfile/to the console. + * + * Returns: N/A + * + */ +static void DumpMsg(struct sk_buff *skb, char *str) +{ + int msglen; + + if (skb == NULL) { + printk("DumpMsg(): NULL-Message\n"); + return; + } + + if (skb->data == NULL) { + printk("DumpMsg(): Message empty\n"); + return; + } + + msglen = skb->len; + if (msglen > 64) + msglen = 64; + + printk("--- Begin of message from %s , len %d (from %d) ----\n", str, msglen, skb->len); + + DumpData((char *)skb->data, msglen); + + printk("------- End of message ---------\n"); +} /* DumpMsg */ + + + +/***************************************************************************** + * + * DumpData - print a data area + * + * Description: + * This function prints a area of data to the system logfile/to the + * console. + * + * Returns: N/A + * + */ +static void DumpData(char *p, int size) +{ +register int i; +int haddr, addr; +char hex_buffer[180]; +char asc_buffer[180]; +char HEXCHAR[] = "0123456789ABCDEF"; + + addr = 0; + haddr = 0; + hex_buffer[0] = 0; + asc_buffer[0] = 0; + for (i=0; i < size; ) { + if (*p >= '0' && *p <='z') + asc_buffer[addr] = *p; + else + asc_buffer[addr] = '.'; + addr++; + asc_buffer[addr] = 0; + hex_buffer[haddr] = HEXCHAR[(*p & 0xf0) >> 4]; + haddr++; + hex_buffer[haddr] = HEXCHAR[*p & 0x0f]; + haddr++; + hex_buffer[haddr] = ' '; + haddr++; + hex_buffer[haddr] = 0; + p++; + i++; + if (i%16 == 0) { + printk("%s %s\n", hex_buffer, asc_buffer); + addr = 0; + haddr = 0; + } + } +} /* DumpData */ + + +/***************************************************************************** + * + * DumpLong - print a data area as long values + * + * Description: + * This function prints a area of data to the system logfile/to the + * console. + * + * Returns: N/A + * + */ +static void DumpLong(char *pc, int size) +{ +register int i; +int haddr, addr; +char hex_buffer[180]; +char asc_buffer[180]; +char HEXCHAR[] = "0123456789ABCDEF"; +long *p; +int l; + + addr = 0; + haddr = 0; + hex_buffer[0] = 0; + asc_buffer[0] = 0; + p = (long*) pc; + for (i=0; i < size; ) { + l = (long) *p; + hex_buffer[haddr] = HEXCHAR[(l >> 28) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[(l >> 24) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[(l >> 20) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[(l >> 16) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[(l >> 12) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[(l >> 8) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[(l >> 4) & 0xf]; + haddr++; + hex_buffer[haddr] = HEXCHAR[l & 0x0f]; + haddr++; + hex_buffer[haddr] = ' '; + haddr++; + hex_buffer[haddr] = 0; + p++; + i++; + if (i%8 == 0) { + printk("%4x %s\n", (i-8)*4, hex_buffer); + haddr = 0; + } + } + printk("------------------------\n"); +} /* DumpLong */ + +#endif /* DEBUG */ + +/* + * Local variables: + * compile-command: "make" + * End: + */ + diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skgehwt.c linux/drivers/net/sk98lin/skgehwt.c --- v2.3.28/linux/drivers/net/sk98lin/skgehwt.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skgehwt.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,213 @@ +/****************************************************************************** + * + * Name: skgehwt.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.12 $ + * Date: $Date: 1998/10/15 15:11:34 $ + * Purpose: Hardware Timer. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgehwt.c,v $ + * Revision 1.12 1998/10/15 15:11:34 gklug + * fix: ID_sccs to SysKonnectFileId + * + * Revision 1.11 1998/10/08 15:27:51 gklug + * chg: correction factor is host clock dependent + * + * Revision 1.10 1998/09/15 14:18:31 cgoos + * Changed more BOOLEANs to SK_xxx + * + * Revision 1.9 1998/09/15 14:16:06 cgoos + * Changed line 107: FALSE to SK_FALSE + * + * Revision 1.8 1998/08/24 13:04:44 gklug + * fix: typo + * + * Revision 1.7 1998/08/19 09:50:49 gklug + * fix: remove struct keyword from c-code (see CCC) add typedefs + * + * Revision 1.6 1998/08/17 09:59:02 gklug + * fix: typos + * + * Revision 1.5 1998/08/14 07:09:10 gklug + * fix: chg pAc -> pAC + * + * Revision 1.4 1998/08/10 14:14:52 gklug + * rmv: unneccessary SK_ADDR macro + * + * Revision 1.3 1998/08/07 12:53:44 gklug + * fix: first compiled version + * + * Revision 1.2 1998/08/07 09:19:29 gklug + * adapt functions to the C coding conventions + * rmv unneccessary functions. + * + * Revision 1.1 1998/08/05 11:28:36 gklug + * first version: adapted from SMT/FDDI + * + * + * + * + ******************************************************************************/ + + +/* + Event queue and dispatcher +*/ +static const char SysKonnectFileId[] = + "$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.12 1998/10/15 15:11:34 gklug Exp $" ; + +#include "h/skdrv1st.h" /* Driver Specific Definitions */ +#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ + +#ifdef __C2MAN__ +/* + Hardware Timer function queue management. + + General Description: + + */ +intro() +{} +#endif + +/* + * Prototypes of local functions. + */ +#define SK_HWT_MAX (65000) + +/* correction factor */ +#define SK_HWT_FAC (1000 * (SK_U32)pAC->GIni.GIHstClkFact / 100) + +/* + * Initialize hardware timer. + * + * Must be called during init level 1. + */ +void SkHwtInit( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc) /* IoContext */ +{ + pAC->Hwt.TStart = 0 ; + pAC->Hwt.TStop = 0 ; + pAC->Hwt.TActive = SK_FALSE ; + + SkHwtStop(pAC,Ioc) ; +} + +/* + * + * Start hardware timer (clock ticks are 16us). + * + */ +void SkHwtStart( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc, /* IoContext */ +SK_U32 Time) /* Time in units of 16us to load the timer with. */ +{ + SK_U32 Cnt ; + + if (Time > SK_HWT_MAX) + Time = SK_HWT_MAX ; + + pAC->Hwt.TStart = Time ; + pAC->Hwt.TStop = 0L ; + + Cnt = Time ; + + /* + * if time < 16 us + * time = 16 us + */ + if (!Cnt) { + Cnt++ ; + } + + SK_OUT32(Ioc, B2_TI_INI, Cnt * SK_HWT_FAC) ; + SK_OUT16(Ioc, B2_TI_CRTL, TIM_START) ; /* Start timer. */ + + pAC->Hwt.TActive = SK_TRUE ; +} + +/* + * Stop hardware timer. + * and clear the timer IRQ + */ +void SkHwtStop( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc) /* IoContext */ +{ + SK_OUT16(Ioc, B2_TI_CRTL, TIM_STOP) ; + SK_OUT16(Ioc, B2_TI_CRTL, TIM_CLR_IRQ) ; + + pAC->Hwt.TActive = SK_FALSE ; +} + + +/* + * Stop hardware timer and read time elapsed since last start. + * + * returns + * The elapsed time since last start in units of 16us. + * + */ +SK_U32 SkHwtRead( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc) /* IoContext */ +{ + SK_U32 TRead ; + SK_U32 IStatus ; + + if (pAC->Hwt.TActive) { + SkHwtStop(pAC,Ioc) ; + + SK_IN32(Ioc, B2_TI_VAL, &TRead); + TRead /= SK_HWT_FAC; + + SK_IN32(Ioc, B0_ISRC, &IStatus); + + /* Check if timer expired (or wraparound). */ + if ((TRead > pAC->Hwt.TStart) || (IStatus & IS_TIMINT)) { + SkHwtStop(pAC,Ioc) ; + pAC->Hwt.TStop = pAC->Hwt.TStart ; + } else { + pAC->Hwt.TStop = pAC->Hwt.TStart - TRead ; + } + } + return (pAC->Hwt.TStop) ; +} + +/* + * interrupt source= timer + */ +void SkHwtIsr( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc) /* IoContext */ +{ + SkHwtStop(pAC,Ioc); + pAC->Hwt.TStop = pAC->Hwt.TStart; + SkTimerDone(pAC,Ioc) ; +} + +/* End of file */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skgeinit.c linux/drivers/net/sk98lin/skgeinit.c --- v2.3.28/linux/drivers/net/sk98lin/skgeinit.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skgeinit.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1847 @@ +/****************************************************************************** + * + * Name: skgeinit.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.54 $ + * Date: $Date: 1999/10/26 07:32:54 $ + * Purpose: Contains functions to initialize the GE HW + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgeinit.c,v $ + * Revision 1.54 1999/10/26 07:32:54 malthoff + * Initialize PHWLinkUp with SK_FALSE. Required for Diagnostics. + * + * Revision 1.53 1999/08/12 19:13:50 malthoff + * Fix for 1000BT. Do not owerwrite XM_MMU_CMD when + * disabling receiver and transmitter. Other bits + * may be lost. + * + * Revision 1.52 1999/07/01 09:29:54 gklug + * fix: DoInitRamQueue needs pAC + * + * Revision 1.51 1999/07/01 08:42:21 gklug + * chg: use Store & forward for RAM buffer when Jumbos are used + * + * Revision 1.50 1999/05/27 13:19:38 cgoos + * Added Tx PCI watermark initialization. + * Removed Tx RAM queue Store & Forward setting. + * + * Revision 1.49 1999/05/20 14:32:45 malthoff + * SkGeLinkLED() is completly removed now. + * + * Revision 1.48 1999/05/19 07:28:24 cgoos + * SkGeLinkLED no more available for drivers. + * Changes for 1000Base-T. + * + * Revision 1.47 1999/04/08 13:57:45 gklug + * add: Init of new port struct fiels PLinkResCt + * chg: StopPort Timer check + * + * Revision 1.46 1999/03/25 07:42:15 malthoff + * SkGeStopPort(): Add workaround for cache incoherency. + * Create error log entry, disable port, and + * exit loop if it does not terminate. + * Add XM_RX_LENERR_OK to the default value for the + * XMAC receive command register. + * + * Revision 1.45 1999/03/12 16:24:47 malthoff + * Remove PPollRxD and PPollTxD. + * Add check for GIPollTimerVal. + * + * Revision 1.44 1999/03/12 13:40:23 malthoff + * Fix: SkGeXmitLED(), SK_LED_TST mode does not work. + * Add: Jumbo frame support. + * Chg: Resolution of parameter IntTime in SkGeCfgSync(). + * + * Revision 1.43 1999/02/09 10:29:46 malthoff + * Bugfix: The previous modification again also for the second location. + * + * Revision 1.42 1999/02/09 09:35:16 malthoff + * Bugfix: The bits '66 MHz Capable' and 'NEWCAP are reset while + * clearing the error bits in the PCI status register. + * + * Revision 1.41 1999/01/18 13:07:02 malthoff + * Bugfix: Do not use CFG cycles after during Init- or Runtime, because + * they may not be available after Boottime. + * + * Revision 1.40 1999/01/11 12:40:49 malthoff + * Bug fix: PCI_STATUS: clearing error bits sets the UDF bit. + * + * Revision 1.39 1998/12/11 15:17:33 gklug + * chg: Init LipaAutoNeg with Unknown + * + * Revision 1.38 1998/12/10 11:02:57 malthoff + * Disable Error Log Message when calling SkGeInit(level 2) + * more than once. + * + * Revision 1.37 1998/12/07 12:18:25 gklug + * add: refinement of autosense mode: take into account the autoneg cap of LiPa + * + * Revision 1.36 1998/12/07 07:10:39 gklug + * fix: init values of LinkBroken/ Capabilities for management + * + * Revision 1.35 1998/12/02 10:56:20 gklug + * fix: do NOT init LoinkSync Counter. + * + * Revision 1.34 1998/12/01 10:53:21 gklug + * add: init of additional Counters for workaround + * + * Revision 1.33 1998/12/01 10:00:49 gklug + * add: init PIsave var in Port struct + * + * Revision 1.32 1998/11/26 14:50:40 gklug + * chg: Default is autosensing with AUTOFULL mode + * + * Revision 1.31 1998/11/25 15:36:16 gklug + * fix: do NOT stop LED Timer when port should be stoped + * + * Revision 1.30 1998/11/24 13:15:28 gklug + * add: Init PCkeckPar struct member + * + * Revision 1.29 1998/11/18 13:19:27 malthoff + * Disable packet arbiter timeouts on receive side. + * Use maximum timeout value for packet arbiter + * transmit timeouts. + * Add TestStopBit() function to handle stop RX/TX + * problem with active descriptor poll timers. + * Bug Fix: Descriptor Poll Timer not started, beacuse + * GIPollTimerVal was initilaized with 0. + * + * Revision 1.28 1998/11/13 14:24:26 malthoff + * Bug Fix: SkGeStopPort() may hang if a Packet Arbiter Timout + * is pending or occurs while waiting for TX_STOP and RX_STOP. + * The PA timeout is cleared now while waiting for TX- or RX_STOP. + * + * Revision 1.27 1998/11/02 11:04:36 malthoff + * fix the last fix + * + * Revision 1.26 1998/11/02 10:37:03 malthoff + * Fix: SkGePollTxD() enables always the synchronounous poll timer. + * + * Revision 1.25 1998/10/28 07:12:43 cgoos + * Fixed "LED_STOP" in SkGeLnkSyncCnt, "== SK_INIT_IO" in SkGeInit. + * Removed: Reset of RAM Interface in SkGeStopPort. + * + * Revision 1.24 1998/10/27 08:13:12 malthoff + * Remove temporary code. + * + * Revision 1.23 1998/10/26 07:45:03 malthoff + * Add Address Calculation Workaround: If the EPROM byte + * Id is 3, the address offset is 512 kB. + * Initialize default values for PLinkMode and PFlowCtrlMode. + * + * Revision 1.22 1998/10/22 09:46:47 gklug + * fix SysKonnectFileId typo + * + * Revision 1.21 1998/10/20 12:11:56 malthoff + * Don't dendy the Queue config if the size of the unused + * rx qeueu is zero. + * + * Revision 1.20 1998/10/19 07:27:58 malthoff + * SkGeInitRamIface() is public to be called by diagnostics. + * + * Revision 1.19 1998/10/16 13:33:45 malthoff + * Fix: enabling descriptor polling is not allowed until + * the descriptor addresses are set. Descriptor polling + * must be handled by the driver. + * + * Revision 1.18 1998/10/16 10:58:27 malthoff + * Remove temp. code for Diag prototype. + * Remove lint warning for dummy reads. + * Call SkGeLoadLnkSyncCnt() during SkGeInitPort(). + * + * Revision 1.17 1998/10/14 09:16:06 malthoff + * Change parameter LimCount and programming of + * the limit counter in SkGeCfgSync(). + * + * Revision 1.16 1998/10/13 09:21:16 malthoff + * Don't set XM_RX_SELF_RX in RxCmd Reg, because it's + * like a Loopback Mode in half duplex. + * + * Revision 1.15 1998/10/09 06:47:40 malthoff + * SkGeInitMacArb(): set recovery counters init value + * to zero although this counters are not uesd. + * Bug fix in Rx Upper/Lower Pause Threshold calculation. + * Add XM_RX_SELF_RX to RxCmd. + * + * Revision 1.14 1998/10/06 15:15:53 malthoff + * Make sure no pending IRQ is cleared in SkGeLoadLnkSyncCnt(). + * + * Revision 1.13 1998/10/06 14:09:36 malthoff + * Add SkGeLoadLnkSyncCnt(). Modify + * the 'port stopped' condition according + * to the current problem report. + * + * Revision 1.12 1998/10/05 08:17:21 malthoff + * Add functions: SkGePollRxD(), SkGePollTxD(), + * DoCalcAddr(), SkGeCheckQSize(), + * DoInitRamQueue(), and SkGeCfgSync(). + * Add coding for SkGeInitMacArb(), SkGeInitPktArb(), + * SkGeInitMacFifo(), SkGeInitRamBufs(), + * SkGeInitRamIface(), and SkGeInitBmu(). + * + * Revision 1.11 1998/09/29 08:26:29 malthoff + * bug fix: SkGeInit0() 'i' should be increment. + * + * Revision 1.10 1998/09/28 13:19:01 malthoff + * Coding time: Save the done work. + * Modify SkGeLinkLED(), add SkGeXmitLED(), + * define SkGeCheckQSize(), SkGeInitMacArb(), + * SkGeInitPktArb(), SkGeInitMacFifo(), + * SkGeInitRamBufs(), SkGeInitRamIface(), + * and SkGeInitBmu(). Do coding for SkGeStopPort(), + * SkGeInit1(), SkGeInit2(), and SkGeInit3(). + * Do coding for SkGeDinit() and SkGeInitPort(). + * + * Revision 1.9 1998/09/16 14:29:05 malthoff + * Some minor changes. + * + * Revision 1.8 1998/09/11 05:29:14 gklug + * add: init state of a port + * + * Revision 1.7 1998/09/04 09:26:25 malthoff + * Short temporary modification. + * + * Revision 1.6 1998/09/04 08:27:59 malthoff + * Remark the do-while in StopPort() because it never ends + * without a GE adapter. + * + * Revision 1.5 1998/09/03 14:05:45 malthoff + * Change comment for SkGeInitPort(). Do not + * repair the queue sizes if invalid. + * + * Revision 1.4 1998/09/03 10:03:19 malthoff + * Implement the new interface according to the + * reviewed interface specification. + * + * Revision 1.3 1998/08/19 09:11:25 gklug + * fix: struct are removed from c-source (see CCC) + * + * Revision 1.2 1998/07/28 12:33:58 malthoff + * Add 'IoC' parameter in function declaration and SK IO macros. + * + * Revision 1.1 1998/07/23 09:48:57 malthoff + * Creation. First dummy 'C' file. + * SkGeInit(Level 0) is card_start for ML. + * SkGeDeInit() is card_stop for ML. + * + * + ******************************************************************************/ + +#include "h/skdrv1st.h" +#include "h/xmac_ii.h" +#include "h/skdrv2nd.h" + +/* defines ********************************************************************/ + +/* defines for SkGeXmitLed() */ +#define XMIT_LED_INI 0 +#define XMIT_LED_CNT (RX_LED_VAL - RX_LED_INI) +#define XMIT_LED_CTRL (RX_LED_CTRL- RX_LED_INI) +#define XMIT_LED_TST (RX_LED_TST - RX_LED_INI) + +/* Queue Size units */ +#define QZ_UNITS 0x7 + +/* Types of RAM Buffer Queues */ +#define SK_RX_SRAM_Q 1 /* small receive queue */ +#define SK_RX_BRAM_Q 2 /* big receive queue */ +#define SK_TX_RAM_Q 3 /* small or big transmit queue */ + +/* typedefs *******************************************************************/ +/* global variables ***********************************************************/ + +/* local variables ************************************************************/ + +static const char SysKonnectFileId[] = + "@(#)$Id: skgeinit.c,v 1.54 1999/10/26 07:32:54 malthoff Exp $ (C) SK "; + +struct s_QOffTab { + int RxQOff; /* Receive Queue Address Offset */ + int XsQOff; /* Sync Tx Queue Address Offset */ + int XaQOff; /* Async Tx Queue Address Offset */ +}; +static struct s_QOffTab QOffTab[] = { + { Q_R1, Q_XS1, Q_XA1 }, { Q_R2, Q_XS2, Q_XA2 } +}; + + +/****************************************************************************** + * + * SkGePollRxD() - Enable/Disable Descriptor Polling of RxD Ring + * + * Description: + * Enable or disable the descriptor polling the receive descriptor + * ring (RxD) of port 'port'. + * The new configuration is *not* saved over any SkGeStopPort() and + * SkGeInitPort() calls. + * + * Returns: + * nothing + */ +void SkGePollRxD( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL PollRxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + if (PollRxD) { + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_ENA_POL); + } + else { + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_DIS_POL); + } +} + +/****************************************************************************** + * + * SkGePollTxD() - Enable/Disable Descriptor Polling of TxD Rings + * + * Description: + * Enable or disable the descriptor polling the transmit descriptor + * ring(s) (RxD) of port 'port'. + * The new configuration is *not* saved over any SkGeStopPort() and + * SkGeInitPort() calls. + * + * Returns: + * nothing + */ +void SkGePollTxD( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL PollTxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ +{ + SK_GEPORT *pPrt; + SK_U32 DWord; + + pPrt = &pAC->GIni.GP[Port]; + + if (PollTxD) { + DWord = CSR_ENA_POL; + } + else { + DWord = CSR_DIS_POL; + } + + if (pPrt->PXSQSize != 0) { + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), DWord); + } + if (pPrt->PXAQSize != 0) { + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), DWord); + } +} + + +/****************************************************************************** + * + * SkGeYellowLED() - Switch the yellow LED on or off. + * + * Description: + * Switch the yellow LED on or off. + * + * Note: + * This function may be called any time after SkGeInit(Level 1). + * + * Returns: + * nothing + */ +void SkGeYellowLED( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int State) /* yellow LED state, 0 = OFF, 0 != ON */ +{ + if (State == 0) { + /* Switch yellow LED OFF */ + SK_OUT8(IoC, B0_LED, LED_STAT_OFF) ; + } + else { + /* Switch yellow LED ON */ + SK_OUT8(IoC, B0_LED, LED_STAT_ON) ; + } +} + +/****************************************************************************** + * + * SkGeXmitLED() - Modify the Operational Mode of a transmission LED. + * + * Description: + * The Rx or Tx LED which is specified by 'Led' will be + * enabled, disabled or switched on in test mode. + * + * Note: + * 'Led' must contain the address offset of the LEDs INI register. + * + * Usage: + * SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_ENA); + * + * Returns: + * nothing + */ +void SkGeXmitLED( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Led, /* offset to the LED Init Value register */ +int Mode) /* Mode may be SK_LED_DIS, SK_LED_ENA, SK_LED_TST */ +{ + SK_U32 LedIni; + + switch (Mode) { + case SK_LED_ENA: + LedIni = SK_XMIT_DUR * (SK_U32)pAC->GIni.GIHstClkFact / 100; + SK_OUT32(IoC, Led+XMIT_LED_INI, LedIni); + SK_OUT8(IoC, Led+XMIT_LED_CTRL, LED_START); + break ; + case SK_LED_TST: + SK_OUT8(IoC, Led+XMIT_LED_TST, LED_T_ON); + SK_OUT32(IoC, Led+XMIT_LED_CNT, 100); + SK_OUT8(IoC, Led+XMIT_LED_CTRL, LED_START); + break ; + case SK_LED_DIS: + default: + /* + * Do NOT stop the LED Timer here. The LED might be + * in on state. But it needs to go off. + */ + SK_OUT32(IoC, Led+XMIT_LED_CNT, 0); + SK_OUT8(IoC, Led+XMIT_LED_TST, LED_T_OFF); + break ; + } + + /* + * 1000BT: The Transmit LED is driven by the PHY. + * But the default LED configuration is used for + * Level One and Broadcom PHYs. + * (Broadcom: It may be that PHY_B_PEC_EN_LTR has to be set.) + * (In this case it has to be added here. But we will see. XXX) + */ +} + +/****************************************************************************** + * + * DoCalcAddr() - Calculates the start and the end address of a queue. + * + * Description: + * This function calculates the start- end the end address + * of a queue. Afterwards the 'StartVal' is incremented to the + * next start position. + * If the port is already initialized the calculated values + * will be checked against the configured values and an + * error will be returned, if they are not equal. + * If the port is not initialized the values will be written to + * *StartAdr and *EndAddr. + * + * Returns: + * 0: success + * 1: configuration error + */ +static int DoCalcAddr( +SK_AC *pAC, /* adapter context */ +SK_GEPORT *pPrt, /* port index */ +int QuSize, /* size of the queue to configure in kB */ +SK_U32 *StartVal, /* start value for address calculation */ +SK_U32 *QuStartAddr, /* start addr to calculate */ +SK_U32 *QuEndAddr) /* end address to calculate */ +{ + SK_U32 EndVal; + SK_U32 NextStart; + int Rtv; + + Rtv = 0; + if (QuSize == 0) { + EndVal = *StartVal; + NextStart = EndVal; + } + else { + EndVal = *StartVal + ((SK_U32)QuSize * 1024) - 1; + NextStart = EndVal + 1; + } + + if (pPrt->PState >= SK_PRT_INIT) { + if (*StartVal != *QuStartAddr || EndVal != *QuEndAddr) { + Rtv = 1; + } + } + else { + *QuStartAddr = *StartVal; + *QuEndAddr = EndVal; + } + + *StartVal = NextStart; + return (Rtv); +} + + +/****************************************************************************** + * + * SkGeCheckQSize() - Checks the Adapters Queue Size Configuration + * + * Description: + * This function verifies the Queue Size Configuration specified + * in the variabels PRxQSize, PXSQSize, and PXAQSize of all + * used ports. + * This requirements must be fullfilled to have a valid configuration: + * - The size of all queues must not exceed GIRamSize. + * - The queue sizes must be specified in units of 8 kB. + * - The size of rx queues of available ports must not be + * smaller than 16kB. + * - The RAM start and end addresses must not be changed + * for ports which are already initialized. + * Furthermore SkGeCheckQSize() defines the Start and End + * Addresses of all ports and stores them into the HWAC port + * structure. + * + * Returns: + * 0: Queue Size Configuration valid + * 1: Queue Size Configuration invalid + */ +static int SkGeCheckQSize( +SK_AC *pAC, /* adapter context */ +int Port) /* port index */ +{ + SK_GEPORT *pPrt; + int UsedMem; + int i; + int Rtv; + int Rtv2; + SK_U32 StartAddr; + + UsedMem = 0; + Rtv = 0; + for (i = 0; i < pAC->GIni.GIMacsFound; i++) { + pPrt = &pAC->GIni.GP[i]; + + if (( pPrt->PRxQSize & QZ_UNITS) || + (pPrt->PXSQSize & QZ_UNITS) || + (pPrt->PXAQSize & QZ_UNITS)) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SKERR_HWI_E012, + SKERR_HWI_E012MSG); + Rtv = 1; + goto CheckQSizeEnd; + } + + UsedMem += pPrt->PRxQSize + pPrt->PXSQSize + pPrt->PXAQSize; + + if (i == Port && pPrt->PRxQSize < SK_MIN_RXQ_SIZE) { + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SKERR_HWI_E011, + SKERR_HWI_E011MSG); + Rtv = 1; + goto CheckQSizeEnd; + } + } + if (UsedMem > pAC->GIni.GIRamSize) { + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E012, SKERR_HWI_E012MSG); + Rtv = 1; + goto CheckQSizeEnd; + } + + /* Now start address calculation */ + StartAddr = pAC->GIni.GIRamOffs; + for (i = 0; i < pAC->GIni.GIMacsFound; i++) { + pPrt = &pAC->GIni.GP[i]; + + /* Calculate/Check values for the receive queue */ + Rtv2 = DoCalcAddr(pAC, pPrt, pPrt->PRxQSize, &StartAddr, + &pPrt->PRxQRamStart, &pPrt->PRxQRamEnd); + Rtv |= Rtv2; + + /* Calculate/Check values for the synchronous tx queue */ + Rtv2 = DoCalcAddr(pAC, pPrt, pPrt->PXSQSize, &StartAddr, + &pPrt->PXsQRamStart, &pPrt->PXsQRamEnd); + Rtv |= Rtv2; + + /* Calculate/Check values for the asynchronous tx queue */ + Rtv2 = DoCalcAddr(pAC, pPrt, pPrt->PXAQSize, &StartAddr, + &pPrt->PXaQRamStart, &pPrt->PXaQRamEnd); + Rtv |= Rtv2; + + if (Rtv) { + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SKERR_HWI_E013, + SKERR_HWI_E013MSG); + break; + } + } + + +CheckQSizeEnd: + return (Rtv); +} + +/****************************************************************************** + * + * SkGeInitMacArb() - Initialize the MAC Arbiter + * + * Description: + * This function initializes the MAC Arbiter. + * It must not be called if there is still an + * initilaized or active port. + * + * Returns: + * nothing: + */ +static void SkGeInitMacArb( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + /* release local reset */ + SK_OUT16(IoC, B3_MA_TO_CTRL, MA_RST_CLR); + + /* configure timeout values */ + SK_OUT8(IoC, B3_MA_TOINI_RX1, SK_MAC_TO_53); + SK_OUT8(IoC, B3_MA_TOINI_RX2, SK_MAC_TO_53); + SK_OUT8(IoC, B3_MA_TOINI_TX1, SK_MAC_TO_53); + SK_OUT8(IoC, B3_MA_TOINI_TX2, SK_MAC_TO_53); + + SK_OUT8(IoC, B3_MA_RCINI_RX1, 0); + SK_OUT8(IoC, B3_MA_RCINI_RX2, 0); + SK_OUT8(IoC, B3_MA_RCINI_TX1, 0); + SK_OUT8(IoC, B3_MA_RCINI_TX2, 0); + + /* recovery values are needed for XMAC II Rev. B2 only */ + /* Fast Output Enable Mode was intended to use with Rev. B2, but now? */ + + /* + * There is not start or enable buttom to push, therefore + * the MAC arbiter is configured and enabled now. + */ +} + +/****************************************************************************** + * + * SkGeInitPktArb() - Initialize the Packet Arbiter + * + * Description: + * This function initializes the Packet Arbiter. + * It must not be called if there is still an + * initilaized or active port. + * + * Returns: + * nothing: + */ +static void SkGeInitPktArb( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + /* release local reset */ + SK_OUT16(IoC, B3_PA_CTRL, PA_RST_CLR); + + /* configure timeout values */ + SK_OUT16(IoC, B3_PA_TOINI_RX1, SK_PKT_TO_MAX); + SK_OUT16(IoC, B3_PA_TOINI_RX2, SK_PKT_TO_MAX); + SK_OUT16(IoC, B3_PA_TOINI_TX1, SK_PKT_TO_MAX); + SK_OUT16(IoC, B3_PA_TOINI_TX2, SK_PKT_TO_MAX); + + /* enable timeout timers if jumbo frames not used */ + if (pAC->GIni.GIPortUsage != SK_JUMBO_LINK) { + if (pAC->GIni.GIMacsFound == 1) { + SK_OUT16(IoC, B3_PA_CTRL, PA_ENA_TO_TX1); + } + else { + SK_OUT16(IoC, B3_PA_CTRL,(PA_ENA_TO_TX1|PA_ENA_TO_TX2)); + } + } +} + +/****************************************************************************** + * + * SkGeInitMacFifo() - Initialize the MAC FIFOs + * + * Description: + * Initialize all MAC FIFOs of the specified port + * + * Returns: + * nothing + */ +static void SkGeInitMacFifo( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + /* + * For each FIFO: + * - release local reset + * - use default value for MAC FIFO size + * - setup defaults for the control register + * - enable the FIFO + */ + /* Configure RX MAC FIFO */ + SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_RST_CLR); + SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_RX_CTRL_DEF); + SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_ENA_OP_MD); + + /* Configure TX MAC FIFO */ + SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_RST_CLR); + SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), MFF_TX_CTRL_DEF); + SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_ENA_OP_MD); + + /* Enable frame flushing if jumbo frames used */ + if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { + SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_ENA_FLUSH); + } +} + +/****************************************************************************** + * + * SkGeLoadLnkSyncCnt() - Load the Link Sync Counter and starts counting + * + * Description: + * This function starts the Link Sync Counter of the specified + * port and enables the generation of an Link Sync IRQ. + * The Link Sync Counter may be used to detect an active link, + * if autonegotiation is not used. + * + * Note: + * o To ensure receiving the Link Sync Event the LinkSyncCounter + * should be initialized BEFORE clearing the XMACs reset! + * o Enable IS_LNK_SYNC_M1 and IS_LNK_SYNC_M2 after calling this + * function. + * + * Retruns: + * nothing + */ +void SkGeLoadLnkSyncCnt( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U32 CntVal) /* Counter value */ +{ + SK_U32 OrgIMsk; + SK_U32 NewIMsk; + SK_U32 ISrc; + SK_BOOL IrqPend; + + /* stop counter */ + SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_STOP); + + /* + * ASIC problem: + * Each time starting the Link Sync Counter an IRQ is generated + * by the adapter. See problem report entry from 21.07.98 + * + * Workaround: Disable Link Sync IRQ and clear the unexpeced IRQ + * if no IRQ is already pending. + */ + IrqPend = SK_FALSE; + SK_IN32(IoC, B0_ISRC, &ISrc); + SK_IN32(IoC, B0_IMSK, &OrgIMsk); + if (Port == MAC_1) { + NewIMsk = OrgIMsk & ~IS_LNK_SYNC_M1; + if (ISrc & IS_LNK_SYNC_M1) { + IrqPend = SK_TRUE; + } + } + else { + NewIMsk = OrgIMsk & ~IS_LNK_SYNC_M2; + if (ISrc & IS_LNK_SYNC_M2) { + IrqPend = SK_TRUE; + } + } + if (!IrqPend) { + SK_OUT32(IoC, B0_IMSK, NewIMsk); + } + + /* load counter */ + SK_OUT32(IoC, MR_ADDR(Port,LNK_SYNC_INI), CntVal); + + /* start counter */ + SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_START); + + if (!IrqPend) { + /* clear the unexpected IRQ, and restore the interrupt mask */ + SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_CLR_IRQ); + SK_OUT32(IoC, B0_IMSK, OrgIMsk); + } +} + +/****************************************************************************** + * + * SkGeCfgSync() - Configure synchronous bandwidth for this port. + * + * Description: + * This function may be used to configure synchronous bandwidth + * to the specified port. This may be done any time after + * initializing the port. The configuration values are NOT saved + * in the HWAC port structure and will be overwritten any + * time when stopping and starting the port. + * Any values for the synchronous configuration will be ignored + * if the size of the synchronous queue is zero! + * + * The default configuration for the synchronous service is + * TXA_ENA_FSYNC. This means if the size of + * the synchronous queue is unequal zero but no specific + * synchronous bandwidth is configured, the synchronous queue + * will always have the 'unlimitted' transmit priority! + * + * This mode will be restored if the synchronous bandwidth is + * deallocated ('IntTime' = 0 and 'LimCount' = 0). + * + * Returns: + * 0: success + * 1: paramter configuration error + * 2: try to configure quality of service although no + * synchronous queue is configured + */ +int SkGeCfgSync( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U32 IntTime, /* Interval Timer Value in units of 8ns */ +SK_U32 LimCount, /* Number of bytes to transfer during IntTime */ +int SyncMode) /* Sync Mode: TXA_ENA_ALLOC | TXA_DIS_ALLOC | 0 */ +{ + int Rtv; + + Rtv = 0; + + /* check the parameters */ + if (LimCount > IntTime || + (LimCount == 0 && IntTime != 0) || + (LimCount !=0 && IntTime == 0)) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, SKERR_HWI_E010MSG); + Rtv = 1; + goto CfgSyncEnd; + } + if (pAC->GIni.GP[Port].PXSQSize != 0) { + /* calculate register values */ + IntTime = (IntTime / 2) * pAC->GIni.GIHstClkFact / 100; + LimCount = LimCount / 8; + if (IntTime > TXA_MAX_VAL || LimCount > TXA_MAX_VAL) { + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, + SKERR_HWI_E010MSG); + Rtv = 1; + goto CfgSyncEnd; + } + + /* + * - Enable 'Force Sync' to ensure the synchronous queue + * has the priority while configuring the new values. + * - Also 'disable alloc' to ensure the settings complies + * to the SyncMode parameter. + * - Disable 'Rate Control' to configure the new values. + * - write IntTime and Limcount + * - start 'Rate Control' and disable 'Force Sync' + * if Interval Timer or Limit Counter not zero. + */ + SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + TXA_ENA_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); + SK_OUT32(IoC, MR_ADDR(Port,TXA_ITI_INI), IntTime); + SK_OUT32(IoC, MR_ADDR(Port,TXA_LIM_INI), LimCount); + SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + (SyncMode & (TXA_ENA_ALLOC|TXA_DIS_ALLOC))); + if (IntTime != 0 || LimCount != 0) { + SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + TXA_DIS_FSYNC|TXA_START_RC); + } + } + else { + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E009, SKERR_HWI_E009MSG); + Rtv = 2; + } + +CfgSyncEnd: + return (Rtv); +} + +/****************************************************************************** + * + * DoInitRamQueue() - Initilaize the RAM Buffer Address of a single Queue + * + * Desccription: + * If the queue is used, enable and initilaize it. + * Make sure the queue is still reset, if it is not used. + * + * Returns: + * nothing + */ +static void DoInitRamQueue( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int QuIoOffs, /* Queue IO Address Offset */ +SK_U32 QuStartAddr, /* Queue Start Address */ +SK_U32 QuEndAddr, /* Queue End Address */ +int QuType) /* Queue Type (SK_RX_SRAM_Q|SK_RX_BRAM_Q|SK_TX_RAM_Q) */ +{ + SK_U32 RxUpThresVal; + SK_U32 RxLoThresVal; + + if (QuStartAddr != QuEndAddr) { + /* calculate thresholds, assume we have a big Rx queue */ + RxUpThresVal = (QuEndAddr + 1 - QuStartAddr - SK_RB_ULPP) / 8; + RxLoThresVal = (QuEndAddr + 1 - QuStartAddr - SK_RB_LLPP_B)/8; + + /* build HW address format */ + QuStartAddr = QuStartAddr / 8; + QuEndAddr = QuEndAddr / 8; + + /* release local reset */ + SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_RST_CLR); + + /* configure addresses */ + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_START), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_END), QuEndAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_WP), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RP), QuStartAddr); + + switch (QuType) { + case SK_RX_SRAM_Q: + /* configure threshold for small Rx Queue */ + RxLoThresVal += (SK_RB_LLPP_B - SK_RB_LLPP_S) / 8; + + /* continue with SK_RX_BRAM_Q */ + case SK_RX_BRAM_Q: + /* write threshold for Rx Queue */ + + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_UTPP), + RxUpThresVal); + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_LTPP), + RxLoThresVal); + /* the high priority threshold not used */ + break; + case SK_TX_RAM_Q: + /* + * Do NOT use Store and forward under normal + * operation due to performance optimization. + * But if Jumbo frames are configured we NEED + * the store and forward of the RAM buffer. + */ + if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { + /* + * enable Store & Forward Mode for the + * Tx Side + */ + SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), + RB_ENA_STFWD); + } + break; + } + + /* set queue operational */ + SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_ENA_OP_MD); + } + else { + /* ensure the queue is still disabled */ + SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_RST_SET); + } +} + +/****************************************************************************** + * + * SkGeInitRamBufs() - Initialize the RAM Buffer Queues + * + * Description: + * Initialize all RAM Buffer Queues of the specified port + * + * Returns: + * nothing + */ +static void SkGeInitRamBufs( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + int RxQType; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PRxQSize == SK_MIN_RXQ_SIZE) { + RxQType = SK_RX_SRAM_Q; /* small Rx Queue */ + } + else { + RxQType = SK_RX_BRAM_Q; /* big Rx Queue */ + } + + DoInitRamQueue(pAC, IoC, pPrt->PRxQOff, pPrt->PRxQRamStart, + pPrt->PRxQRamEnd, RxQType); + DoInitRamQueue(pAC, IoC, pPrt->PXsQOff, pPrt->PXsQRamStart, + pPrt->PXsQRamEnd, SK_TX_RAM_Q); + DoInitRamQueue(pAC, IoC, pPrt->PXaQOff, pPrt->PXaQRamStart, + pPrt->PXaQRamEnd, SK_TX_RAM_Q); +} + +/****************************************************************************** + * + * SkGeInitRamIface() - Initialize the RAM Interface + * + * Description: + * This function initializes the Adapbers RAM Interface. + * + * Note: + * This function is used in the diagnostics. + * + * Returns: + * nothing + */ +void SkGeInitRamIface( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + /* release local reset */ + SK_OUT16(IoC, B3_RI_CTRL, RI_RST_CLR); + + /* configure timeout values */ + SK_OUT8(IoC, B3_RI_WTO_R1, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_WTO_XA1, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_WTO_XS1, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_RTO_R1, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_RTO_XA1, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_RTO_XS1, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_WTO_R2, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_WTO_XA2, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_WTO_XS2, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_RTO_R2, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_RTO_XA2, SK_RI_TO_53); + SK_OUT8(IoC, B3_RI_RTO_XS2, SK_RI_TO_53); +} + +/****************************************************************************** + * + * SkGeInitBmu() - Initialize the BMU state machines + * + * Description: + * Initialize all BMU state machines of the specified port + * + * Returns: + * nothing + */ +static void SkGeInitBmu( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + /* Rx Queue: Release all local resets and set the watermark */ + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_F), SK_BMU_RX_WM); + + /* + * Tx Queue: Release all local resets if the queue is used! + * set watermark + */ + if (pPrt->PXSQSize != 0) { + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_F), SK_BMU_TX_WM); + } + if (pPrt->PXAQSize != 0) { + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_F), SK_BMU_TX_WM); + } + /* + * Do NOT enable the descriptor poll timers here, because + * the descriptor addresses are not specified yet. + */ +} + +/****************************************************************************** + * + * TestStopBit() - Test the stop bit of the queue + * + * Description: + * Stopping a queue is not as simple as it seems to be. + * If descriptor polling is enabled, it may happen + * that RX/TX stop is done and SV idle is NOT set. + * In this case we have to issue another stop command. + * + * Retruns: + * The queues control status register + */ +static SK_U32 TestStopBit( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* IO Context */ +int QuIoOffs) /* Queue IO Address Offset */ +{ + SK_U32 QuCsr; /* CSR contents */ + + SK_IN32(IoC, Q_ADDR(QuIoOffs,Q_CSR), &QuCsr); + if ((QuCsr & (CSR_STOP|CSR_SV_IDLE)) == 0) { + SK_OUT32(IoC, Q_ADDR(QuIoOffs,Q_CSR), CSR_STOP); + SK_IN32(IoC, Q_ADDR(QuIoOffs,Q_CSR), &QuCsr); + } + return (QuCsr); +} + +/****************************************************************************** + * + * SkGeStopPort() - Stop the Rx/Tx activity of the port 'Port'. + * + * Description: + * After calling this function the descriptor rings and rx and tx + * queues of this port may be reconfigured. + * + * It is possible to stop the receive and transmit path seperate or + * both together. + * + * Dir = SK_STOP_TX Stops the transmit path only and resets + * the XMAC. The receive queue is still and + * the pending rx frames may still transfered + * into the RxD. + * SK_STOP_RX Stop the receive path. The tansmit path + * has to be stoped once before. + * SK_STOP_ALL SK_STOP_TX + SK_STOP_RX + * + * RstMode=SK_SOFT_RST Resets the XMAC. The PHY is still alive. + * SK_HARD_RST Resets the XMAC and the PHY. + * + * Example: + * 1) A Link Down event was signaled for a port. Therefore the activity + * of this port should be stoped and a hardware reset should be issued + * to enable the workaround of XMAC errata #2. But the received frames + * should not be discarded. + * ... + * SkGeStopPort(pAC, IoC, Port, SK_STOP_TX, SK_HARD_RST); + * (transfer all pending rx frames) + * SkGeStopPort(pAC, IoC, Port, SK_STOP_RX, SK_HARD_RST); + * ... + * + * 2) An event was issued which request the driver to switch + * the 'virtual active' link to an other already active port + * as soon as possible. The frames in the receive queue of this + * port may be lost. But the PHY must not be reset during this + * event. + * ... + * SkGeStopPort(pAC, IoC, Port, SK_STOP_ALL, SK_SOFT_RST); + * ... + * + * Extended Description: + * If SK_STOP_TX is set, + * o disable the XMACs receive and transmiter to prevent + * from sending incomplete frames + * o stop the port's transmit queues before terminating the + * BMUs to prevent from performing incomplete PCI cycles + * on the PCI bus + * - The network rx and tx activity and PCI tx transfer is + * disabled now. + * o reset the XMAC depending on the RstMode + * o Stop Interval Timer and Limit Counter of Tx Arbiter, + * also disable Force Sync bit and Enable Alloc bit. + * o perform a local reset of the port's tx path + * - reset the PCI FIFO of the async tx queue + * - reset the PCI FIFO of the sync tx queue + * - reset the RAM Buffer async tx queue + * - reset the RAM Butter sync tx queue + * - reset the MAC Tx FIFO + * o switch Link and Tx LED off, stop the LED counters + * + * If SK_STOP_RX is set, + * o stop the port's receive queue + * - The path data transfer activity is fully stopped now. + * o perform a local reset of the port's rx path + * - reset the PCI FIFO of the rx queue + * - reset the RAM Buffer receive queue + * - reset the MAC Rx FIFO + * o switch Rx LED off, stop the LED counter + * + * If all ports are stopped, + * o reset the RAM Interface. + * + * Notes: + * o This function may be called during the driver states RESET_PORT and + * SWITCH_PORT. + */ +void SkGeStopPort( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* port to stop (MAC_1 + n) */ +int Dir, /* Direction to Stop (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */ +int RstMode)/* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */ +{ +#ifndef SK_DIAG + SK_EVPARA Para; +#endif /* !SK_DIAG */ + SK_GEPORT *pPrt; + SK_U32 DWord; + SK_U16 Word; + SK_U32 XsCsr; + SK_U32 XaCsr; + int i; + SK_BOOL AllPortsDis; + SK_U64 ToutStart; + int ToutCnt; + + pPrt = &pAC->GIni.GP[Port]; + + if (Dir & SK_STOP_TX) { + /* disable the XMACs receiver and transmitter */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Word); + XM_OUT16(IoC, Port, XM_MMU_CMD, + Word & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); + + /* dummy read to ensure writing */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Word); + + /* stop both transmit queues */ + /* + * If the BMU is in the reset state CSR_STOP will terminate + * immediately. + */ + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_STOP); + + ToutStart = SkOsGetTime(pAC); + ToutCnt = 0; + do { + /* + * Clear packet arbiter timeout to make sure + * this loop will terminate + */ + if (Port == MAC_1) { + Word = PA_CLR_TO_TX1; + } + else { + Word = PA_CLR_TO_TX2; + } + SK_OUT16(IoC, B3_PA_CTRL, Word); + + /* + * If the transfer stucks at the XMAC the STOP command + * will not terminate if we don't flush the XMACs + * transmit FIFO ! + */ + XM_IN32(IoC, Port, XM_MODE, &DWord); + DWord |= XM_MD_FTF ; + XM_OUT32(IoC, Port, XM_MODE, DWord); + + XsCsr = TestStopBit(pAC, IoC, pPrt->PXsQOff); + XaCsr = TestStopBit(pAC, IoC, pPrt->PXaQOff); + + if (ToutStart + (SK_TICKS_PER_SEC / 18) < + SkOsGetTime(pAC)) { + + /* + * Timeout of 1/18 second reached. + */ + ToutCnt++; + switch (ToutCnt) { + case 1: + /* + * Cache Incoherency workaround: + * Assume a start command has been + * lost while sending the frame. + */ + ToutStart = SkOsGetTime(pAC); + if (XsCsr & CSR_STOP) { + SK_OUT32(IoC, + Q_ADDR(pPrt->PXsQOff, + Q_CSR), CSR_START); + } + if (XaCsr & CSR_STOP) { + SK_OUT32(IoC, + Q_ADDR(pPrt->PXaQOff, + Q_CSR), CSR_START); + } + break; + case 2: + default: /* Fatal Error, Loop aborted */ + /* Create an Error Log Entry */ + SK_ERR_LOG(pAC, SK_ERRCL_HW, + SKERR_HWI_E018, + SKERR_HWI_E018MSG); +#ifndef SK_DIAG + Para.Para64 = Port; + SkEventQueue(pAC, SKGE_DRV, + SK_DRV_PORT_FAIL, Para); +#endif /* !SK_DIAG */ + return; + } + } + + /* + * because of the ASIC problem report entry from 21.08.98 + * it is required to wait until CSR_STOP is reset and + * CSR_SV_IDLE is set. + */ + } while ((XsCsr & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE || + (XaCsr & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE); + + /* reset the XMAC depending on the RstMode */ + if (RstMode == SK_SOFT_RST) { + SkXmSoftRst(pAC, IoC, Port); + } + else { + SkXmHardRst(pAC, IoC, Port); + } + + /* + * Stop Interval Timer and Limit Counter of Tx Arbiter, + * also disable Force Sync bit and Enable Alloc bit. + */ + SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); + SK_OUT32(IoC, MR_ADDR(Port,TXA_ITI_INI), 0x00000000L); + SK_OUT32(IoC, MR_ADDR(Port,TXA_LIM_INI), 0x00000000L); + + /* + * perform a local reset of the port's tx path + * - reset the PCI FIFO of the async tx queue + * - reset the PCI FIFO of the sync tx queue + * - reset the RAM Buffer async tx queue + * - reset the RAM Butter sync tx queue + * - reset the MAC Tx FIFO + */ + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_SET_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_SET_RESET); + SK_OUT8(IoC, RB_ADDR(pPrt->PXaQOff,RB_CTRL), RB_RST_SET); + SK_OUT8(IoC, RB_ADDR(pPrt->PXsQOff,RB_CTRL), RB_RST_SET); + /* Note: MFF_RST_SET does NOT reset the XMAC! */ + SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_RST_SET); + + /* switch Link and Tx LED off, stop the LED counters */ + /* Link LED is switched off by the RLMT and the Diag itself */ + SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_DIS); + } + + if (Dir & SK_STOP_RX) { + /* + * The RX Stop Command will not terminate if no buffers + * are queued in the RxD ring. But it will always reach + * the Idle state. Therefore we can use this feature to + * stop the transfer of received packets. + */ + /* stop the port's receive queue */ + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_STOP); + i = 100; + do { + /* + * Clear packet arbiter timeout to make sure + * this loop will terminate + */ + if (Port == MAC_1) { + Word = PA_CLR_TO_RX1; + } + else { + Word = PA_CLR_TO_RX2; + } + SK_OUT16(IoC, B3_PA_CTRL, Word); + + DWord = TestStopBit(pAC, IoC, pPrt->PRxQOff); + if (i != 0) { + i--; + } + + /* finish if CSR_STOP is done or CSR_SV_IDLE is true and i==0 */ + /* + * because of the ASIC problem report entry from 21.08.98 + * it is required to wait until CSR_STOP is reset and + * CSR_SV_IDLE is set. + */ + } while ((DWord & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE && + ((DWord & CSR_SV_IDLE) == 0 || i != 0)); + + /* The path data transfer activity is fully stopped now. */ + + /* + * perform a local reset of the port's rx path + * - reset the PCI FIFO of the rx queue + * - reset the RAM Buffer receive queue + * - reset the MAC Rx FIFO + */ + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_SET_RESET); + SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff,RB_CTRL), RB_RST_SET); + SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_RST_SET); + + /* switch Rx LED off, stop the LED counter */ + SkGeXmitLED(pAC, IoC, MR_ADDR(Port,RX_LED_INI), SK_LED_DIS); + + } + + /* + * If all ports are stopped reset the RAM Interface. + */ + for (i = 0, AllPortsDis = SK_TRUE; i < pAC->GIni.GIMacsFound; i++) { + if (pAC->GIni.GP[i].PState != SK_PRT_RESET && + pAC->GIni.GP[i].PState != SK_PRT_STOP) { + + AllPortsDis = SK_FALSE; + break; + } + } + if (AllPortsDis) { + pAC->GIni.GIAnyPortAct = SK_FALSE; + } +} + +/****************************************************************************** + * + * SkGeInit0() - Level 0 Initialization + * + * Description: + * - Initialize the BMU address offsets + * + * Returns: + * nothing + */ +static void SkGeInit0( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + int i; + SK_GEPORT *pPrt; + + for (i = 0; i < SK_MAX_MACS; i++) { + pPrt = &pAC->GIni.GP[i]; + pPrt->PState = SK_PRT_RESET; + pPrt->PRxQOff = QOffTab[i].RxQOff; + pPrt->PXsQOff = QOffTab[i].XsQOff; + pPrt->PXaQOff = QOffTab[i].XaQOff; + pPrt->PCheckPar = SK_FALSE; + pPrt->PRxCmd = XM_RX_STRIP_FCS | XM_RX_LENERR_OK; + pPrt->PIsave = 0; + pPrt->PPrevShorts = 0; + pPrt->PLinkResCt = 0; + pPrt->PPrevRx = 0; + pPrt->PPrevFcs = 0; + pPrt->PRxLim = SK_DEF_RX_WA_LIM; + pPrt->PLinkMode = SK_LMODE_AUTOFULL; + pPrt->PLinkModeConf = SK_LMODE_AUTOSENSE; + pPrt->PFlowCtrlMode = SK_FLOW_MODE_SYM_OR_REM; + pPrt->PLinkBroken = SK_TRUE; /* See WA code */ + pPrt->PLinkCap = (SK_LMODE_CAP_HALF | SK_LMODE_CAP_FULL | + SK_LMODE_CAP_AUTOHALF | SK_LMODE_CAP_AUTOFULL); + pPrt->PLinkModeStatus = SK_LMODE_STAT_UNKNOWN; + pPrt->PFlowCtrlCap = SK_FLOW_MODE_SYM_OR_REM; + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; + pPrt->PMSCap = (SK_MS_CAP_AUTO | SK_MS_CAP_MASTER | + SK_MS_CAP_SLAVE); + pPrt->PMSMode = SK_MS_MODE_AUTO; + pPrt->PMSStatus = SK_MS_STAT_UNSET; + pPrt->PAutoNegFail = SK_FALSE; + pPrt->PLipaAutoNeg = SK_LIPA_UNKNOWN; + pPrt->PHWLinkUp = SK_FALSE; + } + + pAC->GIni.GIPortUsage = SK_RED_LINK; + pAC->GIni.GIAnyPortAct = SK_FALSE; +} + +/****************************************************************************** + * + * SkGeInit1() - Level 1 Initialization + * + * Description: + * o Do a software reset. + * o Clear all reset bits. + * o Verify that the detected hardware is present. + * Return an error if not. + * o Get the hardware configuration + * + Read the number of MACs/Ports. + * + Read the RAM size. + * + Read the PCI Revision ID. + * + Find out the adapters host clock speed + * + Read and check the PHY type + * + * Returns: + * 0: success + * 5: Unexpected PHY type detected + */ +static int SkGeInit1( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + SK_U8 Byte; + SK_U16 Word; + int RetVal; + int i; + + RetVal = 0; + + /* Do the reset */ + SK_OUT8(IoC, B0_CTST, CS_RST_SET); + + /* Release the reset */ + SK_OUT8(IoC, B0_CTST, CS_RST_CLR); + + /* Reset all error bits in the PCI STATUS register */ + /* + * Note: Cfg cycles cannot be used, because they are not + * available on some platforms after 'boot time'. + */ + SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); + SK_IN16(IoC, PCI_C(PCI_STATUS), &Word); + SK_OUT16(IoC, PCI_C(PCI_STATUS), Word | PCI_ERRBITS); + SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF); + + /* Release Master_Reset */ + SK_OUT8(IoC, B0_CTST, CS_MRST_CLR); + + /* Read number of MACs */ + SK_IN8(IoC, B2_MAC_CFG, &Byte); + if (Byte & CFG_SNG_MAC) { + pAC->GIni.GIMacsFound = 1; + } + else { + pAC->GIni.GIMacsFound = 2; + } + SK_IN8(IoC, PCI_C(PCI_REV_ID), &Byte); + pAC->GIni.GIPciHwRev = (int) Byte; + + /* Read the adapters RAM size */ + SK_IN8(IoC, B2_E_0, &Byte); + if (Byte == 3) { + pAC->GIni.GIRamSize = (int)(Byte-1) * 512; + pAC->GIni.GIRamOffs = (SK_U32)512 * 1024; + } + else { + pAC->GIni.GIRamSize = (int)Byte * 512; + pAC->GIni.GIRamOffs = 0; + } + + /* All known GE Adapters works with 53.125 MHz host clock */ + pAC->GIni.GIHstClkFact = SK_FACT_53; + pAC->GIni.GIPollTimerVal = + SK_DPOLL_DEF * (SK_U32)pAC->GIni.GIHstClkFact / 100; + + /* Read the PHY type */ + SK_IN8(IoC, B2_E_1, &Byte); + Byte &= 0x0f; /* the PHY type is stored in the lower nibble */ + for (i=0; iGIni.GIMacsFound; i++) { + pAC->GIni.GP[i].PhyType = Byte; + switch (Byte) { + case SK_PHY_XMAC: + pAC->GIni.GP[i].PhyAddr = PHY_ADDR_XMAC; + break; + case SK_PHY_BCOM: + pAC->GIni.GP[i].PhyAddr = PHY_ADDR_BCOM; + break; + case SK_PHY_LONE: + pAC->GIni.GP[i].PhyAddr = PHY_ADDR_LONE; + break; + case SK_PHY_NAT: + pAC->GIni.GP[i].PhyAddr = PHY_ADDR_NAT; + break; + default: + /* ERROR: unexpected PHY typ detected */ + RetVal = 5; + break; + } + } + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_INIT, + ("PHY type: %d PHY addr: %x\n", pAC->GIni.GP[i].PhyType, + pAC->GIni.GP[i].PhyAddr)) ; + + return (RetVal); +} + +/****************************************************************************** + * + * SkGeInit2() - Level 2 Initialization + * + * Description: + * - start the Blink Source Counter + * - start the Descriptor Poll Timer + * - configure the MAC-Arbiter + * - configure the Packet-Arbiter + * - enable the Tx Arbiters + * - enable the RAM Interface Arbiter + * + * Returns: + * nothing + */ +static void SkGeInit2( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + SK_GEPORT *pPrt; + SK_U32 DWord; + int i; + + /* start the Blink Source Counter */ + DWord = SK_BLK_DUR * (SK_U32)pAC->GIni.GIHstClkFact / 100; + SK_OUT32(IoC, B2_BSC_INI, DWord); + SK_OUT8(IoC, B2_BSC_CTRL, BSC_START); + + /* start the Descriptor Poll Timer */ + if (pAC->GIni.GIPollTimerVal != 0) { + if (pAC->GIni.GIPollTimerVal > SK_DPOLL_MAX) { + pAC->GIni.GIPollTimerVal = SK_DPOLL_MAX; + + /* Create an Error Log Entry */ + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E017, + SKERR_HWI_E017MSG); + } + SK_OUT32(IoC, B28_DPT_INI, pAC->GIni.GIPollTimerVal); + SK_OUT8(IoC, B28_DPT_CTRL, DPT_START); + } + + /* + * Configure + * - the MAC-Arbiter and + * - the Paket Arbiter + * + * The MAC and the packet arbiter will be started once + * and never be stopped. + */ + SkGeInitMacArb(pAC, IoC); + SkGeInitPktArb(pAC, IoC); + + /* enable the Tx Arbiters */ + SK_OUT8(IoC, MR_ADDR(MAC_1,TXA_CTRL), TXA_ENA_ARB); + if (pAC->GIni.GIMacsFound > 1) { + SK_OUT8(IoC, MR_ADDR(MAC_2,TXA_CTRL), TXA_ENA_ARB); + } + + /* enable the RAM Interface Arbiter */ + SkGeInitRamIface(pAC, IoC); + + for (i = 0; i < SK_MAX_MACS; i++) { + pPrt = &pAC->GIni.GP[i]; + if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { + pPrt->PRxCmd |= XM_RX_BIG_PK_OK; + } + } +} + +/****************************************************************************** + * + * SkGeInit() - Initialize the GE Adapter with the specified level. + * + * Description: + * Level 0: Initialize the Module structures. + * Level 1: Generic Hardware Initialization. The + * IOP/MemBase pointer has to be set before + * calling this level. + * + * o Do a software reset. + * o Clear all reset bits. + * o Verify that the detected hardware is present. + * Return an error if not. + * o Get the hardware configuration + * + Set GIMacsFound with the number of MACs. + * + Store the RAM size in GIRamSize. + * + Save the PCI Revision ID in GIPciHwRev. + * o return an error + * if Number of MACs > SK_MAX_MACS + * + * After returning from Level 0 the adapter + * may be accessed with IO operations. + * + * Level 2: start the Blink Source Counter + * + * Returns: + * 0: success + * 1: Number of MACs exceeds SK_MAX_MACS ( after level 1) + * 2: Adapter not present or not accessable + * 3: Illegal initialization level + * 4: Initialization Level 1 Call missing + * 5: Unexpected PHY type detected + */ +int SkGeInit( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Level) /* initialization level */ +{ + int RetVal; /* return value */ + SK_U32 DWord; + + RetVal = 0; + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_INIT, + ("SkGeInit(Level %d)\n",Level)) ; + + switch (Level) { + case SK_INIT_DATA: + /* Initialization Level 0 */ + SkGeInit0(pAC,IoC) ; + pAC->GIni.GILevel = SK_INIT_DATA; + break; + case SK_INIT_IO: + /* Initialization Level 1 */ + RetVal = SkGeInit1(pAC,IoC) ; + + /* Check if the adapter seems to be accessable */ + SK_OUT32(IoC, B2_IRQM_INI, 0x11335577L); + SK_IN32(IoC, B2_IRQM_INI, &DWord); + SK_OUT32(IoC, B2_IRQM_INI, 0x00000000L); + if (DWord != 0x11335577L) { + RetVal = 2; + break; + } + + /* Check if the number of GIMacsFound matches SK_MAX_MACS */ + if (pAC->GIni.GIMacsFound > SK_MAX_MACS) { + RetVal = 1; + break; + } + + /* Level 1 successfully passed */ + pAC->GIni.GILevel = SK_INIT_IO; + break; + case SK_INIT_RUN: + /* Initialization Level 2 */ + if (pAC->GIni.GILevel != SK_INIT_IO) { +#ifndef SK_DIAG + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E002, + SKERR_HWI_E002MSG); +#endif + RetVal = 4; + break; + } + SkGeInit2(pAC,IoC) ; + + /* Level 2 successfully passed */ + pAC->GIni.GILevel = SK_INIT_RUN; + break; + default: + /* Create an Error Log Entry */ + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E003, SKERR_HWI_E003MSG); + RetVal = 3 ; + break; + } + + return (RetVal); +} + +/****************************************************************************** + * + * SkGeDeInit() - Deinitialize the adapter. + * + * Description: + * All ports of the adapter will be stopped if not already done. + * Do a software reset and switch off all LEDs. + * + * Returns: + * nothing + */ +void SkGeDeInit( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + int i; + SK_U16 Word; + + /* Stop all current transfer activity */ + for (i = 0; i < pAC->GIni.GIMacsFound; i++) { + if (pAC->GIni.GP[i].PState != SK_PRT_STOP && + pAC->GIni.GP[i].PState != SK_PRT_RESET) { + + SkGeStopPort(pAC, IoC, i, SK_STOP_ALL, SK_HARD_RST); + } + } + + /* Reset all bits in the PCI STATUS register */ + /* + * Note: Cfg cycles cannot be used, because they are not + * available on some platforms after 'boot time'. + */ + SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); + SK_IN16(IoC, PCI_C(PCI_STATUS), &Word); + SK_OUT16(IoC, PCI_C(PCI_STATUS), Word | PCI_ERRBITS); + SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_OFF); + + /* Do the reset, all LEDs are switched off now */ + SK_OUT8(IoC, B0_CTST, CS_RST_SET); +} + +/****************************************************************************** + * + * SkGeInitPort() Initialize the specified prot. + * + * Description: + * PRxQSize, PXSQSize, and PXAQSize has to be + * configured for the specified port before calling this + * function. The descriptor rings has to be initialized, too. + * + * o (Re)configure queues of the specified port. + * o configure the XMAC of the specified port. + * o put ASIC and XMAC(s) in operational mode. + * o initialize Rx/Tx and Sync LED + * o initialize RAM Buffers and MAC FIFOs + * + * The port is ready to connect when returning. + * + * Note: + * The XMACs Rx and Tx state machine is still disabled when + * returning. + * + * Returns: + * 0: success + * 1: Queue size initialization error. The configured values + * for PRxQSize, PXSQSize, or PXAQSize are invalid for one + * or more queues. The specified port was NOT initialized. + * An error log entry was generated. + * 2: The port has to be stopped before it can be initilaized again. + */ +int SkGeInitPort( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port to configure */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + if (SkGeCheckQSize(pAC,Port) != 0) { + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E004, SKERR_HWI_E004MSG); + return (1); + } + if (pPrt->PState == SK_PRT_INIT || pPrt->PState == SK_PRT_RUN) { + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E005, SKERR_HWI_E005MSG); + return (2); + } + + /* Configuration ok, initialize the Port now */ + + /* Initialize Rx, Tx and Link LED */ + /* + * If 1000BT Phy needs LED initialization than swap + * LED and XMAC initialization order + */ + SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_ENA); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port,RX_LED_INI), SK_LED_ENA); + /* The Link LED is initialized by RLMT or Diagnostics itself */ + + /* Do NOT initialize the Link Sync Counter */ + + /* + * Configure + * - XMAC + * - MAC FIFOs + * - RAM Buffers + * - enable Force Sync bit if synchronous queue available + * - BMUs + */ + SkXmInitMac(pAC, IoC, Port); + SkGeInitMacFifo(pAC, IoC, Port); + SkGeInitRamBufs(pAC, IoC, Port); + if (pPrt->PXSQSize != 0) { + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_ENA_FSYNC); + } + SkGeInitBmu(pAC, IoC, Port); + + /* Mark port as initialized. */ + pPrt->PState = SK_PRT_INIT; + pAC->GIni.GIAnyPortAct = SK_TRUE; + + return (0); +} diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skgepnmi.c linux/drivers/net/sk98lin/skgepnmi.c --- v2.3.28/linux/drivers/net/sk98lin/skgepnmi.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skgepnmi.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,7142 @@ +/***************************************************************************** + * + * Name: skgepnmi.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.69 $ + * Date: $Date: 1999/10/18 11:42:15 $ + * Purpose: Private Network Management Interface + * + ****************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/***************************************************************************** + * + * History: + * + * $Log: skgepnmi.c,v $ + * Revision 1.69 1999/10/18 11:42:15 rwahl + * Added typecasts for checking event dependent param (debug only). + * + * Revision 1.68 1999/10/06 09:35:59 cgoos + * Added state check to PHY_READ call (hanged if called during startup). + * + * Revision 1.67 1999/09/22 09:53:20 rwahl + * - Read Broadcom register for updating fcs error counter (1000Base-T). + * + * Revision 1.66 1999/08/26 13:47:56 rwahl + * Added SK_DRIVER_SENDEVENT when queueing RLMT_CHANGE_THRES trap. + * + * Revision 1.65 1999/07/26 07:49:35 cgoos + * Added two typecasts to avoid compiler warnings. + * + * Revision 1.64 1999/05/20 09:24:12 cgoos + * Changes for 1000Base-T (sensors, Master/Slave). + * + * Revision 1.63 1999/04/13 15:11:58 mhaveman + * Moved include of rlmt.h to header skgepnmi.h because some macros + * are needed there. + * + * Revision 1.62 1999/04/13 15:08:07 mhaveman + * Replaced again SK_RLMT_CHECK_LINK with SK_PNMI_RLMT_MODE_CHK_LINK + * to grant unified interface by only using the PNMI header file. + * SK_PNMI_RLMT_MODE_CHK_LINK is defined the same as SK_RLMT_CHECK_LINK. + * + * Revision 1.61 1999/04/13 15:02:48 mhaveman + * Changes caused by review: + * -Changed some comments + * -Removed redundant check for OID_SKGE_PHYS_FAC_ADDR + * -Optimized PRESET check. + * -Meaning of error SK_ADDR_DUPLICATE_ADDRESS changed. Set of same + * address will now not cause this error. Removed corresponding check. + * + * Revision 1.60 1999/03/23 10:41:23 mhaveman + * Added comments. + * + * Revision 1.59 1999/02/19 08:01:28 mhaveman + * Fixed bug 10372 that after counter reset all ports were displayed + * as inactive. + * + * Revision 1.58 1999/02/16 18:04:47 mhaveman + * Fixed problem of twisted OIDs SENSOR_WAR_TIME and SENSOR_ERR_TIME. + * + * Revision 1.56 1999/01/27 12:29:11 mhaveman + * SkTimerStart was called with time value in milli seconds but needs + * micro seconds. + * + * Revision 1.55 1999/01/25 15:00:38 mhaveman + * Added support to allow multiple ports to be active. If this feature in + * future will be used, the Management Data Base variables PORT_ACTIVE + * and PORT_PREFERED should be moved to the port specific part of RLMT. + * Currently they return the values of the first active physical port + * found. A set to the virtual port will actually change all active + * physical ports. A get returns the melted values of all active physical + * ports. If the port values differ a return value INDETERMINATED will + * be returned. This effects especially the CONF group. + * + * Revision 1.54 1999/01/19 10:10:22 mhaveman + * -Fixed bug 10354: Counter values of virtual port were wrong after port + * switches + * -Added check if a switch to the same port is notified. + * + * Revision 1.53 1999/01/07 09:25:21 mhaveman + * Forgot to initialize a variable. + * + * Revision 1.52 1999/01/05 10:34:33 mhaveman + * Fixed little error in RlmtChangeEstimate calculation. + * + * Revision 1.51 1999/01/05 09:59:07 mhaveman + * -Moved timer start to init level 2 + * -Redesigned port switch average calculation to avoid 64bit + * arithmetic. + * + * Revision 1.50 1998/12/10 15:13:59 mhaveman + * -Fixed: PHYS_CUR_ADDR returned wrong addresses + * -Fixed: RLMT_PORT_PREFERED and RLMT_CHANGE_THRES preset returned + * always BAD_VALUE. + * -Fixed: TRAP buffer seemed to sometimes suddenly empty + * + * Revision 1.49 1998/12/09 16:17:07 mhaveman + * Fixed: Couldnot delete VPD keys on UNIX. + * + * Revision 1.48 1998/12/09 14:11:10 mhaveman + * -Add: Debugmessage for XMAC_RESET supressed to minimize output. + * -Fixed: RlmtChangeThreshold will now be initialized. + * -Fixed: VPD_ENTRIES_LIST extended value with unnecessary space char. + * -Fixed: On VPD key creation an invalid key name could be created + * (e.g. A5) + * -Some minor changes in comments and code. + * + * Revision 1.47 1998/12/08 16:00:31 mhaveman + * -Fixed: For RLMT_PORT_ACTIVE will now be returned a 0 if no port + * is active. + * -Fixed: For the RLMT statistics group only the last value was + * returned and the rest of the buffer was filled with 0xff + * -Fixed: Mysteriously the preset on RLMT_MODE still returned + * BAD_VALUE. + * Revision 1.46 1998/12/08 10:04:56 mhaveman + * -Fixed: Preset on RLMT_MODE returned always BAD_VALUE error. + * -Fixed: Alignment error in GetStruct + * -Fixed: If for Get/Preset/SetStruct the buffer size is equal or + * larger than SK_PNMI_MIN_STRUCT_SIZE the return value is stored + * to the buffer. In this case the caller should always return + * ok to its upper routines. Only if the buffer size is less + * than SK_PNMI_MIN_STRUCT_SIZE and the return value is unequal + * to 0, an error should be returned by the caller. + * -Fixed: Wrong number of instances with RLMT statistic. + * -Fixed: Return now SK_LMODE_STAT_UNKNOWN if the LinkModeStatus is 0. + * + * Revision 1.45 1998/12/03 17:17:24 mhaveman + * -Removed for VPD create action the buffer size limitation to 4 bytes. + * -Pass now physical/active physical port to ADDR for CUR_ADDR set + * + * Revision 1.44 1998/12/03 15:14:35 mhaveman + * Another change to Vpd instance evaluation. + * + * Revision 1.43 1998/12/03 14:18:10 mhaveman + * -Fixed problem in PnmiSetStruct. It was impossible to set any value. + * -Removed VPD key evaluation for VPD_FREE_BYTES and VPD_ACTION. + * + * Revision 1.42 1998/12/03 11:31:47 mhaveman + * Inserted cast to satisfy lint. + * + * Revision 1.41 1998/12/03 11:28:16 mhaveman + * Removed SK_PNMI_CHECKPTR + * + * Revision 1.40 1998/12/03 11:19:07 mhaveman + * Fixed problems + * -A set to virtual port will now be ignored. A set with broadcast + * address to any port will be ignored. + * -GetStruct function made VPD instance calculation wrong. + * -Prefered port returned -1 instead of 0. + * + * Revision 1.39 1998/11/26 15:30:29 mhaveman + * Added sense mode to link mode. + * + * Revision 1.38 1998/11/23 15:34:00 mhaveman + * -Fixed bug for RX counters. On an RX overflow interrupt the high + * words of all RX counters were incremented. + * -SET operations on FLOWCTRL_MODE and LINK_MODE accept now the + * value 0, which has no effect. It is usefull for multiple instance + * SETs. + * + * Revision 1.37 1998/11/20 08:02:04 mhaveman + * -Fixed: Ports were compared with MAX_SENSORS + * -Fixed: Crash in GetTrapEntry with MEMSET macro + * -Fixed: Conversions between physical, logical port index and instance + * + * Revision 1.36 1998/11/16 07:48:53 mhaveman + * Casted SK_DRIVER_SENDEVENT with (void) to eleminate compiler warnings + * on Solaris. + * + * Revision 1.35 1998/11/16 07:45:34 mhaveman + * SkAddrOverride now returns value and will be checked. + * + * Revision 1.34 1998/11/10 13:40:37 mhaveman + * Needed to change interface, because NT driver needs a return value + * of needed buffer space on TOO_SHORT errors. Therefore all + * SkPnmiGet/Preset/Set functions now have a pointer to the length + * parameter, where the needed space on error is returned. + * + * Revision 1.33 1998/11/03 13:52:46 mhaveman + * Made file lint conform. + * + * Revision 1.32 1998/11/03 13:19:07 mhaveman + * The events SK_HWEV_SET_LMODE and SK_HWEV_SET_FLOWMODE pass now in + * Para32[0] the physical MAC index and in Para32[1] the new mode. + * + * Revision 1.31 1998/11/03 12:30:40 gklug + * fix: compiler warning memset + * + * Revision 1.30 1998/11/03 12:04:46 mhaveman + * Fixed problem in SENSOR_VALUE, which wrote beyond the buffer end + * Fixed alignment problem with CHIPSET. + * + * Revision 1.29 1998/11/02 11:23:54 mhaveman + * Corrected SK_ERROR_LOG to SK_ERR_LOG. Sorry. + * + * Revision 1.28 1998/11/02 10:47:16 mhaveman + * Added syslog messages for internal errors. + * + * Revision 1.27 1998/10/30 15:48:06 mhaveman + * Fixed problems after simulation of SK_PNMI_EVT_CHG_EST_TIMER and + * RlmtChangeThreshold calculation. + * + * Revision 1.26 1998/10/29 15:36:55 mhaveman + * -Fixed bug in trap buffer handling. + * -OID_SKGE_DRIVER_DESCR, OID_SKGE_DRIVER_VERSION, OID_SKGE_HW_DESCR, + * OID_SKGE_HW_VERSION, OID_SKGE_VPD_ENTRIES_LIST, OID_SKGE_VPD_KEY, + * OID_SKGE_VPD_VALUE, and OID_SKGE_SENSOR_DESCR return values with + * a leading octet before each string storing the string length. + * -Perform a RlmtUpdate during SK_PNMI_EVT_XMAC_RESET to minimize + * RlmtUpdate calls in GetStatVal. + * -Inserted SK_PNMI_CHECKFLAGS macro increase readability. + * + * Revision 1.25 1998/10/29 08:50:36 mhaveman + * Fixed problems after second event simulation. + * + * Revision 1.24 1998/10/28 08:44:37 mhaveman + * -Fixed alignment problem + * -Fixed problems during event simulation + * -Fixed sequence of error return code (INSTANCE -> ACCESS -> SHORT) + * -Changed type of parameter Instance back to SK_U32 because of VPD + * -Updated new VPD function calls + * + * Revision 1.23 1998/10/23 10:16:37 mhaveman + * Fixed bugs after buffer test simulation. + * + * Revision 1.22 1998/10/21 13:23:52 mhaveman + * -Call syntax of SkOsGetTime() changed to SkOsGetTime(pAc). + * -Changed calculation of hundrets of seconds. + * + * Revision 1.20 1998/10/20 07:30:45 mhaveman + * Made type changes to unsigned integer where possible. + * + * Revision 1.19 1998/10/19 10:51:30 mhaveman + * -Made Bug fixes after simulation run + * -Renamed RlmtMAC... to RlmtPort... + * -Marked workarounds with Errata comments + * + * Revision 1.18 1998/10/14 07:50:08 mhaveman + * -For OID_SKGE_LINK_STATUS the link down detection has moved from RLMT + * to HWACCESS. + * -Provided all MEMCPY/MEMSET macros with (char *) pointers, because + * Solaris throwed warnings when mapping to bcopy/bset. + * + * Revision 1.17 1998/10/13 07:42:01 mhaveman + * -Added OIDs OID_SKGE_TRAP_NUMBER and OID_SKGE_ALL_DATA + * -Removed old cvs history entries + * -Renamed MacNumber to PortNumber + * + * Revision 1.16 1998/10/07 10:52:49 mhaveman + * -Inserted handling of some OID_GEN_ Ids for windows + * -Fixed problem with 803.2 statistic. + * + * Revision 1.15 1998/10/01 09:16:29 mhaveman + * Added Debug messages for function call and UpdateFlag tracing. + * + * Revision 1.14 1998/09/30 13:39:09 mhaveman + * -Reduced namings of 'MAC' by replacing them with 'PORT'. + * -Completed counting of OID_SKGE_RX_HW_ERROR_CTS, + * OID_SKGE_TX_HW_ERROR_CTS, + * OID_SKGE_IN_ERRORS_CTS, and OID_SKGE_OUT_ERROR_CTS. + * -SET check for RlmtMode + * + * Revision 1.13 1998/09/28 13:13:08 mhaveman + * Hide strcmp, strlen, and strncpy behind macros SK_STRCMP, SK_STRLEN, + * and SK_STRNCPY. (Same reasons as for mem.. and MEM..) + * + * Revision 1.12 1998/09/16 08:18:36 cgoos + * Fix: XM_INxx and XM_OUTxx called with different parameter order: + * sometimes IoC,Mac,... sometimes Mac,IoC,... Now always first variant. + * Fix: inserted "Pnmi." into some pAC->pDriverDescription / Version. + * Change: memset, memcpy to makros SK_MEMSET, SK_MEMCPY + * + * Revision 1.11 1998/09/04 17:01:45 mhaveman + * Added SyncCounter as macro and OID_SKGE_.._NO_DESCR_CTS to + * OID_SKGE_RX_NO_BUF_CTS. + * + * Revision 1.10 1998/09/04 14:35:35 mhaveman + * Added macro counters, that are counted by driver. + * + ****************************************************************************/ + + +static const char SysKonnectFileId[] = + "@(#) $Id: skgepnmi.c,v 1.69 1999/10/18 11:42:15 rwahl Exp $ (C) SysKonnect."; + +#include "h/skdrv1st.h" +#include "h/sktypes.h" +#include "h/xmac_ii.h" + +#include "h/skdebug.h" +#include "h/skqueue.h" +#include "h/skgepnmi.h" +#include "h/skgesirq.h" +#include "h/skcsum.h" +#include "h/skvpd.h" +#include "h/skgehw.h" +#include "h/skgeinit.h" +#include "h/skdrv2nd.h" +#include "h/skgepnm2.h" + + +/* + * Public Function prototypes + */ +int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int level); +int SkPnmiGetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, + unsigned int *pLen, SK_U32 Instance); +int SkPnmiPreSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, + unsigned int *pLen, SK_U32 Instance); +int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf, + unsigned int *pLen, SK_U32 Instance); +int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, unsigned int *pLen); +int SkPnmiPreSetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, unsigned int *pLen); +int SkPnmiSetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, unsigned int *pLen); +int SkPnmiEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Param); + + +/* + * Private Function prototypes + */ +static int Addr(SK_AC *pAC, SK_IOC IoC, int action, + SK_U32 Id, char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static SK_U8 CalculateLinkModeStatus(SK_AC *pAC, SK_IOC IoC, unsigned int + PhysPortIndex); +static SK_U8 CalculateLinkStatus(SK_AC *pAC, SK_IOC IoC, unsigned int + PhysPortIndex); +static void CopyMac(char *pDst, SK_MAC_ADDR *pMac); +static void CopyTrapQueue(SK_AC *pAC, char *pDstBuf); +static int CsumStat(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int General(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static SK_U64 GetPhysStatVal(SK_AC *pAC, SK_IOC IoC, + unsigned int PhysPortIndex, unsigned int StatIndex); +static SK_U64 GetStatVal(SK_AC *pAC, SK_IOC IoC, unsigned int LogPortIndex, + unsigned int StatIndex); +static char* GetTrapEntry(SK_AC *pAC, SK_U32 TrapId, unsigned int Size); +static void GetTrapQueueLen(SK_AC *pAC, unsigned int *pLen, + unsigned int *pEntries); +static int GetVpdKeyArr(SK_AC *pAC, SK_IOC IoC, char *pKeyArr, + unsigned int KeyArrLen, unsigned int *pKeyNo); +static int LookupId(SK_U32 Id); +static int Mac8023Stat(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int MacPrivateConf(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int MacPrivateStat(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int MacUpdate(SK_AC *pAC, SK_IOC IoC, unsigned int FirstMac, + unsigned int LastMac); +static int Monitor(SK_AC *pAC, SK_IOC IoC, int action, + SK_U32 Id, char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int OidStruct(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int Perform(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int* pLen, SK_U32 Instance, + unsigned int TableIndex); +static int PnmiStruct(SK_AC *pAC, SK_IOC IoC, int Action, char *pBuf, + unsigned int *pLen); +static int PnmiVar(SK_AC *pAC, SK_IOC IoC, int Action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance); +static void QueueRlmtNewMacTrap(SK_AC *pAC, unsigned int ActiveMac); +static void QueueRlmtPortTrap(SK_AC *pAC, SK_U32 TrapId, + unsigned int PortIndex); +static void QueueSensorTrap(SK_AC *pAC, SK_U32 TrapId, + unsigned int SensorIndex); +static void QueueSimpleTrap(SK_AC *pAC, SK_U32 TrapId); +static void ResetCounter(SK_AC *pAC, SK_IOC IoC); +static int Rlmt(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int RlmtStat(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int RlmtUpdate(SK_AC *pAC, SK_IOC IoC); +static int SensorStat(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); +static int SirqUpdate(SK_AC *pAC, SK_IOC IoC); +static void VirtualConf(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, char *pBuf); +static int Vpd(SK_AC *pAC, SK_IOC IoC, int action, SK_U32 Id, + char *pBuf, unsigned int *pLen, SK_U32 Instance, + unsigned int TableIndex); + + +/****************************************************************************** + * + * Global variables + */ + +/* + * Table to correlate OID with handler function and index to + * hardware register stored in StatAddress if applicable. + */ +static const SK_PNMI_TAB_ENTRY IdTable[] = { + {OID_GEN_XMIT_OK, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX}, + {OID_GEN_RCV_OK, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX}, + {OID_GEN_XMIT_ERROR, + 0, + 0, + 0, + SK_PNMI_RO, General, 0}, + {OID_GEN_RCV_ERROR, + 0, + 0, + 0, + SK_PNMI_RO, General, 0}, + {OID_GEN_RCV_NO_BUFFER, + 0, + 0, + 0, + SK_PNMI_RO, General, 0}, + {OID_GEN_DIRECTED_FRAMES_XMIT, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_UNICAST}, + {OID_GEN_MULTICAST_FRAMES_XMIT, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_MULTICAST}, + {OID_GEN_BROADCAST_FRAMES_XMIT, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_BROADCAST}, + {OID_GEN_DIRECTED_FRAMES_RCV, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX_UNICAST}, + {OID_GEN_MULTICAST_FRAMES_RCV, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX_MULTICAST}, + {OID_GEN_BROADCAST_FRAMES_RCV, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX_BROADCAST}, + {OID_GEN_RCV_CRC_ERROR, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX_FCS}, + {OID_GEN_TRANSMIT_QUEUE_LENGTH, + 0, + 0, + 0, + SK_PNMI_RO, General, 0}, + {OID_802_3_PERMANENT_ADDRESS, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, 0}, + {OID_802_3_CURRENT_ADDRESS, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, 0}, + {OID_802_3_RCV_ERROR_ALIGNMENT, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX_FRAMING}, + {OID_802_3_XMIT_ONE_COLLISION, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_SINGLE_COL}, + {OID_802_3_XMIT_MORE_COLLISIONS, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_MULTI_COL}, + {OID_802_3_XMIT_DEFERRED, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_DEFFERAL}, + {OID_802_3_XMIT_MAX_COLLISIONS, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_EXCESS_COL}, + {OID_802_3_RCV_OVERRUN, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HRX_OVERFLOW}, + {OID_802_3_XMIT_UNDERRUN, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_UNDERRUN}, + {OID_802_3_XMIT_TIMES_CRS_LOST, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_CARRIER}, + {OID_802_3_XMIT_LATE_COLLISIONS, + 0, + 0, + 0, + SK_PNMI_RO, Mac8023Stat, SK_PNMI_HTX_LATE_COL}, + {OID_SKGE_MDB_VERSION, + 1, + 0, + SK_PNMI_MAI_OFF(MgmtDBVersion), + SK_PNMI_RO, General, 0}, + {OID_SKGE_SUPPORTED_LIST, + 0, + 0, + 0, + SK_PNMI_RO, General, 0}, + {OID_SKGE_ALL_DATA, + 0, + 0, + 0, + SK_PNMI_RW, OidStruct, 0}, + {OID_SKGE_VPD_FREE_BYTES, + 1, + 0, + SK_PNMI_MAI_OFF(VpdFreeBytes), + SK_PNMI_RO, Vpd, 0}, + {OID_SKGE_VPD_ENTRIES_LIST, + 1, + 0, + SK_PNMI_MAI_OFF(VpdEntriesList), + SK_PNMI_RO, Vpd, 0}, + {OID_SKGE_VPD_ENTRIES_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(VpdEntriesNumber), + SK_PNMI_RO, Vpd, 0}, + {OID_SKGE_VPD_KEY, + SK_PNMI_VPD_ENTRIES, + sizeof(SK_PNMI_VPD), + SK_PNMI_OFF(Vpd) + SK_PNMI_VPD_OFF(VpdKey), + SK_PNMI_RO, Vpd, 0}, + {OID_SKGE_VPD_VALUE, + SK_PNMI_VPD_ENTRIES, + sizeof(SK_PNMI_VPD), + SK_PNMI_OFF(Vpd) + SK_PNMI_VPD_OFF(VpdValue), + SK_PNMI_RO, Vpd, 0}, + {OID_SKGE_VPD_ACCESS, + SK_PNMI_VPD_ENTRIES, + sizeof(SK_PNMI_VPD), + SK_PNMI_OFF(Vpd) + SK_PNMI_VPD_OFF(VpdAccess), + SK_PNMI_RO, Vpd, 0}, + {OID_SKGE_VPD_ACTION, + SK_PNMI_VPD_ENTRIES, + sizeof(SK_PNMI_VPD), + SK_PNMI_OFF(Vpd) + SK_PNMI_VPD_OFF(VpdAction), + SK_PNMI_RW, Vpd, 0}, + {OID_SKGE_PORT_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(PortNumber), + SK_PNMI_RO, General, 0}, + {OID_SKGE_DEVICE_TYPE, + 1, + 0, + SK_PNMI_MAI_OFF(DeviceType), + SK_PNMI_RO, General, 0}, + {OID_SKGE_DRIVER_DESCR, + 1, + 0, + SK_PNMI_MAI_OFF(DriverDescr), + SK_PNMI_RO, General, 0}, + {OID_SKGE_DRIVER_VERSION, + 1, + 0, + SK_PNMI_MAI_OFF(DriverVersion), + SK_PNMI_RO, General, 0}, + {OID_SKGE_HW_DESCR, + 1, + 0, + SK_PNMI_MAI_OFF(HwDescr), + SK_PNMI_RO, General, 0}, + {OID_SKGE_HW_VERSION, + 1, + 0, + SK_PNMI_MAI_OFF(HwVersion), + SK_PNMI_RO, General, 0}, + {OID_SKGE_CHIPSET, + 1, + 0, + SK_PNMI_MAI_OFF(Chipset), + SK_PNMI_RO, General, 0}, + {OID_SKGE_ACTION, + 1, + 0, + SK_PNMI_MAI_OFF(Action), + SK_PNMI_RW, Perform, 0}, + {OID_SKGE_RESULT, + 1, + 0, + SK_PNMI_MAI_OFF(TestResult), + SK_PNMI_RO, General, 0}, + {OID_SKGE_BUS_TYPE, + 1, + 0, + SK_PNMI_MAI_OFF(BusType), + SK_PNMI_RO, General, 0}, + {OID_SKGE_BUS_SPEED, + 1, + 0, + SK_PNMI_MAI_OFF(BusSpeed), + SK_PNMI_RO, General, 0}, + {OID_SKGE_BUS_WIDTH, + 1, + 0, + SK_PNMI_MAI_OFF(BusWidth), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_SW_QUEUE_LEN, + 1, + 0, + SK_PNMI_MAI_OFF(TxSwQueueLen), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_SW_QUEUE_MAX, + 1, + 0, + SK_PNMI_MAI_OFF(TxSwQueueMax), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_RETRY, + 1, + 0, + SK_PNMI_MAI_OFF(TxRetryCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RX_INTR_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(RxIntrCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_INTR_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(TxIntrCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RX_NO_BUF_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(RxNoBufCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_NO_BUF_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(TxNoBufCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_USED_DESCR_NO, + 1, + 0, + SK_PNMI_MAI_OFF(TxUsedDescrNo), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RX_DELIVERED_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(RxDeliveredCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RX_OCTETS_DELIV_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(RxOctetsDeliveredCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RX_HW_ERROR_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(RxHwErrorsCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TX_HW_ERROR_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(TxHwErrorsCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_IN_ERRORS_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(InErrorsCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_OUT_ERROR_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(OutErrorsCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_ERR_RECOVERY_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(ErrRecoveryCts), + SK_PNMI_RO, General, 0}, + {OID_SKGE_SYSUPTIME, + 1, + 0, + SK_PNMI_MAI_OFF(SysUpTime), + SK_PNMI_RO, General, 0}, + {OID_SKGE_SENSOR_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(SensorNumber), + SK_PNMI_RO, General, 0}, + {OID_SKGE_SENSOR_INDEX, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorIndex), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_DESCR, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorDescr), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_TYPE, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorType), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_VALUE, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorValue), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_WAR_THRES_LOW, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorWarningThresholdLow), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_WAR_THRES_UPP, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorWarningThresholdHigh), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_ERR_THRES_LOW, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorErrorThresholdLow), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_ERR_THRES_UPP, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorErrorThresholdHigh), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_STATUS, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorStatus), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_WAR_CTS, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorWarningCts), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_ERR_CTS, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorErrorCts), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_WAR_TIME, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorWarningTimestamp), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_SENSOR_ERR_TIME, + SK_PNMI_SENSOR_ENTRIES, + sizeof(SK_PNMI_SENSOR), + SK_PNMI_OFF(Sensor) + SK_PNMI_SEN_OFF(SensorErrorTimestamp), + SK_PNMI_RO, SensorStat, 0}, + {OID_SKGE_CHKSM_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(ChecksumNumber), + SK_PNMI_RO, General, 0}, + {OID_SKGE_CHKSM_RX_OK_CTS, + SKCS_NUM_PROTOCOLS, + sizeof(SK_PNMI_CHECKSUM), + SK_PNMI_OFF(Checksum) + SK_PNMI_CHK_OFF(ChecksumRxOkCts), + SK_PNMI_RO, CsumStat, 0}, + {OID_SKGE_CHKSM_RX_UNABLE_CTS, + SKCS_NUM_PROTOCOLS, + sizeof(SK_PNMI_CHECKSUM), + SK_PNMI_OFF(Checksum) + SK_PNMI_CHK_OFF(ChecksumRxUnableCts), + SK_PNMI_RO, CsumStat, 0}, + {OID_SKGE_CHKSM_RX_ERR_CTS, + SKCS_NUM_PROTOCOLS, + sizeof(SK_PNMI_CHECKSUM), + SK_PNMI_OFF(Checksum) + SK_PNMI_CHK_OFF(ChecksumRxErrCts), + SK_PNMI_RO, CsumStat, 0}, + {OID_SKGE_CHKSM_TX_OK_CTS, + SKCS_NUM_PROTOCOLS, + sizeof(SK_PNMI_CHECKSUM), + SK_PNMI_OFF(Checksum) + SK_PNMI_CHK_OFF(ChecksumTxOkCts), + SK_PNMI_RO, CsumStat, 0}, + {OID_SKGE_CHKSM_TX_UNABLE_CTS, + SKCS_NUM_PROTOCOLS, + sizeof(SK_PNMI_CHECKSUM), + SK_PNMI_OFF(Checksum) + SK_PNMI_CHK_OFF(ChecksumTxUnableCts), + SK_PNMI_RO, CsumStat, 0}, + {OID_SKGE_STAT_TX, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX}, + {OID_SKGE_STAT_TX_OCTETS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxOctetsOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_OCTET}, + {OID_SKGE_STAT_TX_BROADCAST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxBroadcastOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_BROADCAST}, + {OID_SKGE_STAT_TX_MULTICAST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxMulticastOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_MULTICAST}, + {OID_SKGE_STAT_TX_UNICAST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxUnicastOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_UNICAST}, + {OID_SKGE_STAT_TX_LONGFRAMES, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxLongFramesCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_LONGFRAMES}, + {OID_SKGE_STAT_TX_BURST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxBurstCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_BURST}, + {OID_SKGE_STAT_TX_PFLOWC, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxPauseMacCtrlCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_PMACC}, + {OID_SKGE_STAT_TX_FLOWC, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxMacCtrlCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_MACC}, + {OID_SKGE_STAT_TX_SINGLE_COL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxSingleCollisionCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_SINGLE_COL}, + {OID_SKGE_STAT_TX_MULTI_COL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxMultipleCollisionCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_MULTI_COL}, + {OID_SKGE_STAT_TX_EXCESS_COL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxExcessiveCollisionCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_EXCESS_COL}, + {OID_SKGE_STAT_TX_LATE_COL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxLateCollisionCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_LATE_COL}, + {OID_SKGE_STAT_TX_DEFFERAL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxDeferralCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_DEFFERAL}, + {OID_SKGE_STAT_TX_EXCESS_DEF, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxExcessiveDeferralCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_EXCESS_DEF}, + {OID_SKGE_STAT_TX_UNDERRUN, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxFifoUnderrunCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_UNDERRUN}, + {OID_SKGE_STAT_TX_CARRIER, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxCarrierCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_CARRIER}, +/* {OID_SKGE_STAT_TX_UTIL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxUtilization), + SK_PNMI_RO, MacPrivateStat, (SK_U16)(-1)}, */ + {OID_SKGE_STAT_TX_64, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTx64Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_64}, + {OID_SKGE_STAT_TX_127, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTx127Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_127}, + {OID_SKGE_STAT_TX_255, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTx255Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_255}, + {OID_SKGE_STAT_TX_511, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTx511Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_511}, + {OID_SKGE_STAT_TX_1023, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTx1023Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_1023}, + {OID_SKGE_STAT_TX_MAX, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxMaxCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_MAX}, + {OID_SKGE_STAT_TX_SYNC, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxSyncCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_SYNC}, + {OID_SKGE_STAT_TX_SYNC_OCTETS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatTxSyncOctetsCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HTX_SYNC_OCTET}, + {OID_SKGE_STAT_RX, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX}, + {OID_SKGE_STAT_RX_OCTETS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxOctetsOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_OCTET}, + {OID_SKGE_STAT_RX_BROADCAST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxBroadcastOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_BROADCAST}, + {OID_SKGE_STAT_RX_MULTICAST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxMulticastOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_MULTICAST}, + {OID_SKGE_STAT_RX_UNICAST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxUnicastOkCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_UNICAST}, + {OID_SKGE_STAT_RX_PFLOWC, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxPauseMacCtrlCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_PMACC}, + {OID_SKGE_STAT_RX_FLOWC, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxMacCtrlCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_MACC}, + {OID_SKGE_STAT_RX_PFLOWC_ERR, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxPauseMacCtrlErrorCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_PMACC_ERR}, + {OID_SKGE_STAT_RX_FLOWC_UNKWN, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxMacCtrlUnknownCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_MACC_UNKWN}, + {OID_SKGE_STAT_RX_BURST, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxBurstCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_BURST}, + {OID_SKGE_STAT_RX_MISSED, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxMissedCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_MISSED}, + {OID_SKGE_STAT_RX_FRAMING, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxFramingCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_FRAMING}, + {OID_SKGE_STAT_RX_OVERFLOW, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxFifoOverflowCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_OVERFLOW}, + {OID_SKGE_STAT_RX_JABBER, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxJabberCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_JABBER}, + {OID_SKGE_STAT_RX_CARRIER, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxCarrierCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_CARRIER}, + {OID_SKGE_STAT_RX_IR_LENGTH, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxIRLengthCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_IRLENGTH}, + {OID_SKGE_STAT_RX_SYMBOL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxSymbolCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_SYMBOL}, + {OID_SKGE_STAT_RX_SHORTS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxShortsCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_SHORTS}, + {OID_SKGE_STAT_RX_RUNT, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxRuntCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_RUNT}, + {OID_SKGE_STAT_RX_CEXT, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxCextCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_CEXT}, + {OID_SKGE_STAT_RX_TOO_LONG, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxTooLongCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_TOO_LONG}, + {OID_SKGE_STAT_RX_FCS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxFcsCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_FCS}, +/* {OID_SKGE_STAT_RX_UTIL, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxUtilization), + SK_PNMI_RO, MacPrivateStat, (SK_U16)(-1)}, */ + {OID_SKGE_STAT_RX_64, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRx64Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_64}, + {OID_SKGE_STAT_RX_127, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRx127Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_127}, + {OID_SKGE_STAT_RX_255, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRx255Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_255}, + {OID_SKGE_STAT_RX_511, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRx511Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_511}, + {OID_SKGE_STAT_RX_1023, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRx1023Cts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_1023}, + {OID_SKGE_STAT_RX_MAX, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxMaxCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_MAX}, + {OID_SKGE_PHYS_CUR_ADDR, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfMacCurrentAddr), + SK_PNMI_RW, Addr, 0}, + {OID_SKGE_PHYS_FAC_ADDR, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfMacFactoryAddr), + SK_PNMI_RO, Addr, 0}, + {OID_SKGE_PMD, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPMD), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_CONNECTOR, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfConnector), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_LINK_CAP, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfLinkCapability), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_LINK_MODE, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfLinkMode), + SK_PNMI_RW, MacPrivateConf, 0}, + {OID_SKGE_LINK_MODE_STATUS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfLinkModeStatus), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_LINK_STATUS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfLinkStatus), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_FLOWCTRL_CAP, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfFlowCtrlCapability), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_FLOWCTRL_MODE, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfFlowCtrlMode), + SK_PNMI_RW, MacPrivateConf, 0}, + {OID_SKGE_FLOWCTRL_STATUS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfFlowCtrlStatus), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_PHY_OPERATION_CAP, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyOperationCapability), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_PHY_OPERATION_MODE, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyOperationMode), + SK_PNMI_RW, MacPrivateConf, 0}, + {OID_SKGE_PHY_OPERATION_STATUS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_CONF), + SK_PNMI_OFF(Conf) + SK_PNMI_CNF_OFF(ConfPhyOperationStatus), + SK_PNMI_RO, MacPrivateConf, 0}, + {OID_SKGE_TRAP, + 1, + 0, + SK_PNMI_MAI_OFF(Trap), + SK_PNMI_RO, General, 0}, + {OID_SKGE_TRAP_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(TrapNumber), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RLMT_MODE, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtMode), + SK_PNMI_RW, Rlmt, 0}, + {OID_SKGE_RLMT_PORT_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtPortNumber), + SK_PNMI_RO, Rlmt, 0}, + {OID_SKGE_RLMT_PORT_ACTIVE, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtPortActive), + SK_PNMI_RO, Rlmt, 0}, + {OID_SKGE_RLMT_PORT_PREFERED, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtPortPreferred), + SK_PNMI_RW, Rlmt, 0}, + {OID_SKGE_RLMT_CHANGE_CTS, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtChangeCts), + SK_PNMI_RO, Rlmt, 0}, + {OID_SKGE_RLMT_CHANGE_TIME, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtChangeTime), + SK_PNMI_RO, Rlmt, 0}, + {OID_SKGE_RLMT_CHANGE_ESTIM, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtChangeEstimate), + SK_PNMI_RO, Rlmt, 0}, + {OID_SKGE_RLMT_CHANGE_THRES, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtChangeThreshold), + SK_PNMI_RW, Rlmt, 0}, + {OID_SKGE_RLMT_PORT_INDEX, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_RLMT), + SK_PNMI_OFF(Rlmt) + SK_PNMI_RLM_OFF(RlmtIndex), + SK_PNMI_RO, RlmtStat, 0}, + {OID_SKGE_RLMT_STATUS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_RLMT), + SK_PNMI_OFF(Rlmt) + SK_PNMI_RLM_OFF(RlmtStatus), + SK_PNMI_RO, RlmtStat, 0}, + {OID_SKGE_RLMT_TX_HELLO_CTS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_RLMT), + SK_PNMI_OFF(Rlmt) + SK_PNMI_RLM_OFF(RlmtTxHelloCts), + SK_PNMI_RO, RlmtStat, 0}, + {OID_SKGE_RLMT_RX_HELLO_CTS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_RLMT), + SK_PNMI_OFF(Rlmt) + SK_PNMI_RLM_OFF(RlmtRxHelloCts), + SK_PNMI_RO, RlmtStat, 0}, + {OID_SKGE_RLMT_TX_SP_REQ_CTS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_RLMT), + SK_PNMI_OFF(Rlmt) + SK_PNMI_RLM_OFF(RlmtTxSpHelloReqCts), + SK_PNMI_RO, RlmtStat, 0}, + {OID_SKGE_RLMT_RX_SP_CTS, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_RLMT), + SK_PNMI_OFF(Rlmt) + SK_PNMI_RLM_OFF(RlmtRxSpHelloCts), + SK_PNMI_RO, RlmtStat, 0}, + {OID_SKGE_RLMT_MONITOR_NUMBER, + 1, + 0, + SK_PNMI_MAI_OFF(RlmtMonitorNumber), + SK_PNMI_RO, General, 0}, + {OID_SKGE_RLMT_MONITOR_INDEX, + SK_PNMI_MONITOR_ENTRIES, + sizeof(SK_PNMI_RLMT_MONITOR), + SK_PNMI_OFF(RlmtMonitor) + SK_PNMI_MON_OFF(RlmtMonitorIndex), + SK_PNMI_RO, Monitor, 0}, + {OID_SKGE_RLMT_MONITOR_ADDR, + SK_PNMI_MONITOR_ENTRIES, + sizeof(SK_PNMI_RLMT_MONITOR), + SK_PNMI_OFF(RlmtMonitor) + SK_PNMI_MON_OFF(RlmtMonitorAddr), + SK_PNMI_RO, Monitor, 0}, + {OID_SKGE_RLMT_MONITOR_ERRS, + SK_PNMI_MONITOR_ENTRIES, + sizeof(SK_PNMI_RLMT_MONITOR), + SK_PNMI_OFF(RlmtMonitor) + SK_PNMI_MON_OFF(RlmtMonitorErrorCts), + SK_PNMI_RO, Monitor, 0}, + {OID_SKGE_RLMT_MONITOR_TIMESTAMP, + SK_PNMI_MONITOR_ENTRIES, + sizeof(SK_PNMI_RLMT_MONITOR), + SK_PNMI_OFF(RlmtMonitor) + SK_PNMI_MON_OFF(RlmtMonitorTimestamp), + SK_PNMI_RO, Monitor, 0}, + {OID_SKGE_RLMT_MONITOR_ADMIN, + SK_PNMI_MONITOR_ENTRIES, + sizeof(SK_PNMI_RLMT_MONITOR), + SK_PNMI_OFF(RlmtMonitor) + SK_PNMI_MON_OFF(RlmtMonitorAdmin), + SK_PNMI_RW, Monitor, 0}, +}; + +/* + * Table for hardware register saving on resets and port switches +*/ +static const SK_PNMI_STATADDR StatAddress[SK_PNMI_MAX_IDX] = { + /* 0 */ {TRUE, XM_TXF_OK}, + /* 1 */ {TRUE, 0}, + /* 2 */ {FALSE, 0}, + /* 3 */ {TRUE, XM_TXF_BC_OK}, + /* 4 */ {TRUE, XM_TXF_MC_OK}, + /* 5 */ {TRUE, XM_TXF_UC_OK}, + /* 6 */ {TRUE, XM_TXF_LONG}, + /* 7 */ {TRUE, XM_TXE_BURST}, + /* 8 */ {TRUE, XM_TXF_MPAUSE}, + /* 9 */ {TRUE, XM_TXF_MCTRL}, + /* 10 */ {TRUE, XM_TXF_SNG_COL}, + /* 11 */ {TRUE, XM_TXF_MUL_COL}, + /* 12 */ {TRUE, XM_TXF_ABO_COL}, + /* 13 */ {TRUE, XM_TXF_LAT_COL}, + /* 14 */ {TRUE, XM_TXF_DEF}, + /* 15 */ {TRUE, XM_TXF_EX_DEF}, + /* 16 */ {TRUE, XM_TXE_FIFO_UR}, + /* 17 */ {TRUE, XM_TXE_CS_ERR}, + /* 18 */ {FALSE, 0}, + /* 19 */ {FALSE, 0}, + /* 20 */ {TRUE, XM_TXF_64B}, + /* 21 */ {TRUE, XM_TXF_127B}, + /* 22 */ {TRUE, XM_TXF_255B}, + /* 23 */ {TRUE, XM_TXF_511B}, + /* 24 */ {TRUE, XM_TXF_1023B}, + /* 25 */ {TRUE, XM_TXF_MAX_SZ}, + /* 26 */ {FALSE, 0}, + /* 27 */ {FALSE, 0}, + /* 28 */ {FALSE, 0}, + /* 29 */ {FALSE, 0}, + /* 30 */ {FALSE, 0}, + /* 31 */ {FALSE, 0}, + /* 32 */ {TRUE, XM_RXF_OK}, + /* 33 */ {TRUE, 0}, + /* 34 */ {FALSE, 0}, + /* 35 */ {TRUE, XM_RXF_BC_OK}, + /* 36 */ {TRUE, XM_RXF_MC_OK}, + /* 37 */ {TRUE, XM_RXF_UC_OK}, + /* 38 */ {TRUE, XM_RXF_MPAUSE}, + /* 39 */ {TRUE, XM_RXF_MCTRL}, + /* 40 */ {TRUE, XM_RXF_INV_MP}, + /* 41 */ {TRUE, XM_RXF_INV_MOC}, + /* 42 */ {TRUE, XM_RXE_BURST}, + /* 43 */ {TRUE, XM_RXE_FMISS}, + /* 44 */ {TRUE, XM_RXF_FRA_ERR}, + /* 45 */ {TRUE, XM_RXE_FIFO_OV}, + /* 46 */ {TRUE, XM_RXF_JAB_PKT}, + /* 47 */ {TRUE, XM_RXE_CAR_ERR}, + /* 48 */ {TRUE, XM_RXF_LEN_ERR}, + /* 49 */ {TRUE, XM_RXE_SYM_ERR}, + /* 50 */ {TRUE, XM_RXE_SHT_ERR}, + /* 51 */ {TRUE, XM_RXE_RUNT}, + /* 52 */ {TRUE, XM_RXF_LNG_ERR}, + /* 53 */ {TRUE, XM_RXF_FCS_ERR}, + /* 54 */ {FALSE, 0}, + /* 55 */ {TRUE, XM_RXF_CEX_ERR}, + /* 56 */ {FALSE, 0}, + /* 57 */ {FALSE, 0}, + /* 58 */ {TRUE, XM_RXF_64B}, + /* 59 */ {TRUE, XM_RXF_127B}, + /* 60 */ {TRUE, XM_RXF_255B}, + /* 61 */ {TRUE, XM_RXF_511B}, + /* 62 */ {TRUE, XM_RXF_1023B}, + /* 63 */ {TRUE, XM_RXF_MAX_SZ}, + /* 64 */ {FALSE, 0}, + /* 65 */ {FALSE, 0} +}; + + +/***************************************************************************** + * + * Public functions + * + */ + +/***************************************************************************** + * + * SkPnmiInit - Init function of PNMI + * + * Description: + * SK_INIT_DATA: Initialises the data structures + * SK_INIT_IO: Resets the XMAC statistics, determines the device and + * connector type. + * SK_INIT_RUN: Starts a timer event for port switch per hour + * calculation. + * + * Returns: + * Always 0 + */ + +int SkPnmiInit( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Level) /* Initialization level */ +{ + unsigned int PortMax; /* Number of ports */ + unsigned int PortIndex; /* Current port index in loop */ + SK_U16 Val16; /* Multiple purpose 16 bit variable */ + SK_U8 Val8; /* Mulitple purpose 8 bit variable */ + SK_EVPARA EventParam; /* Event struct for timer event */ + + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiInit: Called, level=%d\n", Level)); + + switch (Level) { + + case SK_INIT_DATA: + SK_MEMSET((char *)&pAC->Pnmi, 0, sizeof(pAC->Pnmi)); + pAC->Pnmi.TrapBufFree = SK_PNMI_TRAP_QUEUE_LEN; + pAC->Pnmi.StartUpTime = SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC)); + pAC->Pnmi.RlmtChangeThreshold = SK_PNMI_DEF_RLMT_CHG_THRES; + for (PortIndex = 0; PortIndex < SK_MAX_MACS; PortIndex ++) { + + pAC->Pnmi.Port[PortIndex].ActiveFlag = SK_FALSE; + } + break; + + case SK_INIT_IO: + /* + * Reset MAC counters + */ + PortMax = pAC->GIni.GIMacsFound; + + for (PortIndex = 0; PortIndex < PortMax; PortIndex ++) { + + Val16 = XM_SC_CLR_RXC | XM_SC_CLR_TXC; + XM_OUT16(IoC, PortIndex, XM_STAT_CMD, Val16); + /* Clear two times according to Errata #3 */ + XM_OUT16(IoC, PortIndex, XM_STAT_CMD, Val16); + } + + /* + * Get pci bus speed + */ + SK_IN16(IoC, B0_CTST, &Val16); + if ((Val16 & CS_BUS_CLOCK) == 0) { + + pAC->Pnmi.PciBusSpeed = 33; + } + else { + pAC->Pnmi.PciBusSpeed = 66; + } + + /* + * Get pci bus width + */ + SK_IN16(IoC, B0_CTST, &Val16); + if ((Val16 & CS_BUS_SLOT_SZ) == 0) { + + pAC->Pnmi.PciBusWidth = 32; + } + else { + pAC->Pnmi.PciBusWidth = 64; + } + + /* + * Get PMD and DeviceType + */ + SK_IN8(IoC, B2_PMD_TYP, &Val8); + switch (Val8) { + case 'S': + pAC->Pnmi.PMD = 3; + if (pAC->GIni.GIMacsFound > 1) { + + pAC->Pnmi.DeviceType = 0x00020002; + } + else { + pAC->Pnmi.DeviceType = 0x00020001; + } + break; + + case 'L': + pAC->Pnmi.PMD = 2; + if (pAC->GIni.GIMacsFound > 1) { + + pAC->Pnmi.DeviceType = 0x00020004; + } + else { + pAC->Pnmi.DeviceType = 0x00020003; + } + break; + + case 'C': + pAC->Pnmi.PMD = 4; + if (pAC->GIni.GIMacsFound > 1) { + + pAC->Pnmi.DeviceType = 0x00020006; + } + else { + pAC->Pnmi.DeviceType = 0x00020005; + } + break; + + case 'T': + pAC->Pnmi.PMD = 5; + if (pAC->GIni.GIMacsFound > 1) { + + pAC->Pnmi.DeviceType = 0x00020008; + } + else { + pAC->Pnmi.DeviceType = 0x00020007; + } + break; + + default : + pAC->Pnmi.PMD = 1; + pAC->Pnmi.DeviceType = 0; + break; + } + + /* + * Get connector + */ + SK_IN8(IoC, B2_CONN_TYP, &Val8); + switch (Val8) { + case 'C': + pAC->Pnmi.Connector = 2; + break; + + case 'D': + pAC->Pnmi.Connector = 3; + break; + + case 'F': + pAC->Pnmi.Connector = 4; + break; + + case 'J': + pAC->Pnmi.Connector = 5; + break; + + default: + pAC->Pnmi.Connector = 1; + break; + } + break; + + case SK_INIT_RUN: + /* + * Start timer for RLMT change counter + */ + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + SkTimerStart(pAC, IoC, &pAC->Pnmi.RlmtChangeEstimate.EstTimer, + 28125000, SKGE_PNMI, SK_PNMI_EVT_CHG_EST_TIMER, + EventParam); + break; + + default: + break; /* Nothing todo */ + } + + return (0); +} + +/***************************************************************************** + * + * SkPnmiGetVar - Retrieves the value of a single OID + * + * Description: + * Calls a general sub-function for all this stuff. If the instance + * -1 is passed, the values of all instances are returned in an + * array of values. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed + * SK_PNMI_ERR_GENERAL A general severe internal error occured + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to take + * the data. + * SK_PNMI_ERR_UNKNOWN_OID The requested OID is unknown + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +int SkPnmiGetVar( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +SK_U32 Id, /* Object ID that is to be processed */ +void *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance) /* Instance (1..n) that is to be queried or -1 */ +{ + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiGetVar: Called, Id=0x%x, BufLen=%d\n", Id, + *pLen)); + + return (PnmiVar(pAC, IoC, SK_PNMI_GET, Id, (char *)pBuf, pLen, + Instance)); +} + +/***************************************************************************** + * + * SkPnmiPreSetVar - Presets the value of a single OID + * + * Description: + * Calls a general sub-function for all this stuff. The preset does + * the same as a set, but returns just before finally setting the + * new value. This is usefull to check if a set might be successfull. + * If as instance a -1 is passed, an array of values is supposed and + * all instance of the OID will be set. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_OID The requested OID is unknown. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +int SkPnmiPreSetVar( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +SK_U32 Id, /* Object ID that is to be processed */ +void *pBuf, /* Buffer which stores the mgmt data to be set */ +unsigned int *pLen, /* Total length of mgmt data */ +SK_U32 Instance) /* Instance (1..n) that is to be set or -1 */ +{ + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiPreSetVar: Called, Id=0x%x, BufLen=%d\n", + Id, *pLen)); + + return (PnmiVar(pAC, IoC, SK_PNMI_PRESET, Id, (char *)pBuf, pLen, + Instance)); +} + +/***************************************************************************** + * + * SkPnmiSetVar - Sets the value of a single OID + * + * Description: + * Calls a general sub-function for all this stuff. The preset does + * the same as a set, but returns just before finally setting the + * new value. This is usefull to check if a set might be successfull. + * If as instance a -1 is passed, an array of values is supposed and + * all instance of the OID will be set. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_OID The requested OID is unknown. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +int SkPnmiSetVar( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +SK_U32 Id, /* Object ID that is to be processed */ +void *pBuf, /* Buffer which stores the mgmt data to be set */ +unsigned int *pLen, /* Total length of mgmt data */ +SK_U32 Instance) /* Instance (1..n) that is to be set or -1 */ +{ + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiSetVar: Called, Id=0x%x, BufLen=%d\n", Id, + *pLen)); + + return (PnmiVar(pAC, IoC, SK_PNMI_SET, Id, (char *)pBuf, pLen, + Instance)); +} + +/***************************************************************************** + * + * SkPnmiGetStruct - Retrieves the management database in SK_PNMI_STRUCT_DATA + * + * Description: + * Runs through the IdTable, queries the single OIDs and stores the + * returned data into the management database structure + * SK_PNMI_STRUCT_DATA. The offset of the OID in the structure + * is stored in the IdTable. The return value of the function will also + * be stored in SK_PNMI_STRUCT_DATA if the passed buffer has the + * minimum size of SK_PNMI_MIN_STRUCT_SIZE. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed + * SK_PNMI_ERR_GENERAL A general severe internal error occured + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to take + * the data. + */ + +int SkPnmiGetStruct( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +void *pBuf, /* Buffer which will store the retrieved data */ +unsigned int *pLen) /* Length of buffer */ +{ + int Ret; + unsigned int TableIndex; + unsigned int DstOffset; + unsigned int InstanceNo; + unsigned int InstanceCnt; + SK_U32 Instance; + unsigned int TmpLen; + char KeyArr[SK_PNMI_VPD_ARR_SIZE][SK_PNMI_VPD_STR_SIZE]; + + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiGetStruct: Called, BufLen=%d\n", *pLen)); + + if (*pLen < SK_PNMI_STRUCT_SIZE) { + + if (*pLen >= SK_PNMI_MIN_STRUCT_SIZE) { + + SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_TOO_SHORT, + (SK_U32)(-1)); + } + + *pLen = SK_PNMI_STRUCT_SIZE; + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* Update statistic */ + SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On call"); + + if ((Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1)) != + SK_PNMI_ERR_OK) { + + SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1)); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (Ret); + } + + if ((Ret = RlmtUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1)); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (Ret); + } + + if ((Ret = SirqUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1)); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (Ret); + } + + /* + * Increment semaphores to indicate that an update was + * already done + */ + pAC->Pnmi.MacUpdatedFlag ++; + pAC->Pnmi.RlmtUpdatedFlag ++; + pAC->Pnmi.SirqUpdatedFlag ++; + + /* Get vpd keys for instance calculation */ + Ret = GetVpdKeyArr(pAC, IoC, &KeyArr[0][0], sizeof(KeyArr), &TmpLen); + if (Ret != SK_PNMI_ERR_OK) { + + pAC->Pnmi.MacUpdatedFlag --; + pAC->Pnmi.RlmtUpdatedFlag --; + pAC->Pnmi.SirqUpdatedFlag --; + + SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On return"); + SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1)); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (SK_PNMI_ERR_GENERAL); + } + + /* Retrieve values */ + SK_MEMSET((char *)pBuf, 0, SK_PNMI_STRUCT_SIZE); + for (TableIndex = 0; TableIndex < sizeof(IdTable)/sizeof(IdTable[0]); + TableIndex ++) { + + InstanceNo = IdTable[TableIndex].InstanceNo; + + for (InstanceCnt = 1; InstanceCnt <= InstanceNo; + InstanceCnt ++) { + + DstOffset = IdTable[TableIndex].Offset + + (InstanceCnt - 1) * + IdTable[TableIndex].StructSize; + + /* + * For the VPD the instance is not an index number + * but the key itself. Determin with the instance + * counter the VPD key to be used. + */ + if (IdTable[TableIndex].Id == OID_SKGE_VPD_KEY || + IdTable[TableIndex].Id == OID_SKGE_VPD_VALUE || + IdTable[TableIndex].Id == OID_SKGE_VPD_ACCESS || + IdTable[TableIndex].Id == OID_SKGE_VPD_ACTION) { + + SK_PNMI_READ_U32(KeyArr[InstanceCnt - 1], + Instance); + } + else { + Instance = (SK_U32)InstanceCnt; + } + + TmpLen = *pLen - DstOffset; + Ret = IdTable[TableIndex].Func(pAC, IoC, SK_PNMI_GET, + IdTable[TableIndex].Id, (char *)pBuf + + DstOffset, &TmpLen, Instance, TableIndex); + + /* + * An unknown instance error means that we reached + * the last instance of that variable. Proceed with + * the next OID in the table and ignore the return + * code. + */ + if (Ret == SK_PNMI_ERR_UNKNOWN_INST) { + + break; + } + + if (Ret != SK_PNMI_ERR_OK) { + + pAC->Pnmi.MacUpdatedFlag --; + pAC->Pnmi.RlmtUpdatedFlag --; + pAC->Pnmi.SirqUpdatedFlag --; + + SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On return"); + SK_PNMI_SET_STAT(pBuf, Ret, DstOffset); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (Ret); + } + } + } + + pAC->Pnmi.MacUpdatedFlag --; + pAC->Pnmi.RlmtUpdatedFlag --; + pAC->Pnmi.SirqUpdatedFlag --; + + *pLen = SK_PNMI_STRUCT_SIZE; + SK_PNMI_CHECKFLAGS("SkPnmiGetStruct: On return"); + SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_OK, (SK_U32)(-1)); + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * SkPnmiPreSetStruct - Presets the management database in SK_PNMI_STRUCT_DATA + * + * Description: + * Calls a general sub-function for all this set stuff. The preset does + * the same as a set, but returns just before finally setting the + * new value. This is usefull to check if a set might be successfull. + * The sub-function runs through the IdTable, checks which OIDs are able + * to set, and calls the handler function of the OID to perform the + * preset. The return value of the function will also be stored in + * SK_PNMI_STRUCT_DATA if the passed buffer has the minimum size of + * SK_PNMI_MIN_STRUCT_SIZE. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + */ + +int SkPnmiPreSetStruct( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +void *pBuf, /* Buffer which contains the data to be set */ +unsigned int *pLen) /* Length of buffer */ +{ + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiPreSetStruct: Called, BufLen=%d\n", *pLen)); + + return (PnmiStruct(pAC, IoC, SK_PNMI_PRESET, (char *)pBuf, pLen)); +} + +/***************************************************************************** + * + * SkPnmiSetStruct - Sets the management database in SK_PNMI_STRUCT_DATA + * + * Description: + * Calls a general sub-function for all this set stuff. The return value + * of the function will also be stored in SK_PNMI_STRUCT_DATA if the + * passed buffer has the minimum size of SK_PNMI_MIN_STRUCT_SIZE. + * The sub-function runs through the IdTable, checks which OIDs are able + * to set, and calls the handler function of the OID to perform the + * set. The return value of the function will also be stored in + * SK_PNMI_STRUCT_DATA if the passed buffer has the minimum size of + * SK_PNMI_MIN_STRUCT_SIZE. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + */ + +int SkPnmiSetStruct( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +void *pBuf, /* Buffer which contains the data to be set */ +unsigned int *pLen) /* Length of buffer */ +{ + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiSetStruct: Called, BufLen=%d\n", *pLen)); + + return (PnmiStruct(pAC, IoC, SK_PNMI_SET, (char *)pBuf, pLen)); +} + +/***************************************************************************** + * + * SkPnmiEvent - Event handler + * + * Description: + * Handles the following events: + * SK_PNMI_EVT_SIRQ_OVERFLOW When a hardware counter overflows an + * interrupt will be generated which is + * first handled by SIRQ which generates a + * this event. The event increments the + * upper 32 bit of the 64 bit counter. + * SK_PNMI_EVT_SEN_XXX The event is generated by the I2C module + * when a sensor reports a warning or + * error. The event will store a trap + * message in the trap buffer. + * SK_PNMI_EVT_CHG_EST_TIMER The timer event was initiated by this + * module and is used to calculate the + * port switches per hour. + * SK_PNMI_EVT_CLEAR_COUNTER The event clears all counters and + * timestamps. + * SK_PNMI_EVT_XMAC_RESET The event is generated by the driver + * before a hard reset of the XMAC is + * performed. All counters will be saved + * and added to the hardware counter + * values after reset to grant continuous + * counter values. + * SK_PNMI_EVT_RLMT_PORT_UP Generated by RLMT to notify that a port + * went logically up. A trap message will + * be stored to the trap buffer. + * SK_PNMI_EVT_RLMT_PORT_DOWN Generated by RLMT to notify that a port + * went logically down. A trap message will + * be stored to the trap buffer. + * SK_PNMI_EVT_RLMT_PORT_SWITCH Generated by RLMT to notify that the + * active port switched. PNMI will split + * this into two message ACTIVE_DOWN and + * ACTIVE_UP to be future compatible with + * load balancing and card fail over. + * SK_PNMI_EVT_RLMT_SEGMENTATION Generated by RLMT to notify that two + * spanning tree root bridges were + * detected. A trap message will be stored + * to the trap buffer. + * SK_PNMI_EVT_RLMT_ACTIVE_DOWN Notifies PNMI that an active port went + * down. PNMI will not further add the + * statistic values to the virtual port. + * SK_PNMI_EVT_RLMT_ACTIVE_UP Notifies PNMI that a port went up and + * is now an active port. PNMI will now + * add the statistic data of this port to + * the virtual port. + * + * Returns: + * Always 0 + */ + +int SkPnmiEvent( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +SK_U32 Event, /* Event-Id */ +SK_EVPARA Param) /* Event dependent parameter */ +{ + unsigned int PhysPortIndex; + int CounterIndex; + int Ret; + SK_U16 MacStatus; + SK_U64 OverflowStatus; + SK_U64 Mask; + SK_U32 MacCntEvent; + SK_U64 Value; + SK_U16 Register; + SK_EVPARA EventParam; + SK_U64 NewestValue; + SK_U64 OldestValue; + SK_U64 Delta; + SK_PNMI_ESTIMATE *pEst; + + +#ifdef DEBUG + if (Event != SK_PNMI_EVT_XMAC_RESET) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: SkPnmiEvent: Called, Event=0x%x, Param=0x%x\n", + (unsigned long)Event, (unsigned long)Param.Para64)); + } +#endif + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On call"); + + switch (Event) { + + case SK_PNMI_EVT_SIRQ_OVERFLOW: + PhysPortIndex = (int)Param.Para32[0]; + MacStatus = (SK_U16)Param.Para32[1]; +#ifdef DEBUG + if (PhysPortIndex >= SK_MAX_MACS) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_SIRQ_OVERFLOW parameter wrong, PhysPortIndex=0x%x\n", + PhysPortIndex)); + return (0); + } +#endif + OverflowStatus = 0; + + /* + * Check which source caused an overflow interrupt. The + * interrupt source is a self-clearing register. We only + * need to check the interrupt source once. Another check + * will be done by the SIRQ module to be sure that no + * interrupt get lost during process time. + */ + if ((MacStatus & XM_IS_RXC_OV) == XM_IS_RXC_OV) { + + XM_IN32(IoC, PhysPortIndex, XM_RX_CNT_EV, + &MacCntEvent); + OverflowStatus |= (SK_U64)MacCntEvent << 32; + } + if ((MacStatus & XM_IS_TXC_OV) == XM_IS_TXC_OV) { + + XM_IN32(IoC, PhysPortIndex, XM_TX_CNT_EV, + &MacCntEvent); + OverflowStatus |= (SK_U64)MacCntEvent; + } + if (OverflowStatus == 0) { + + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return"); + return (0); + } + + /* + * Check the overflow status register and increment + * the upper dword of corresponding counter. + */ + for (CounterIndex = 0; CounterIndex < sizeof(Mask) * 8; + CounterIndex ++) { + + Mask = (SK_U64)1 << CounterIndex; + if ((OverflowStatus & Mask) == 0) { + + continue; + } + + switch (CounterIndex) { + + case SK_PNMI_HTX_UTILUNDER: + case SK_PNMI_HTX_UTILOVER: + XM_IN16(IoC, PhysPortIndex, XM_TX_CMD, + &Register); + Register |= XM_TX_SAM_LINE; + XM_OUT16(IoC, PhysPortIndex, XM_TX_CMD, + Register); + break; + + case SK_PNMI_HRX_UTILUNDER: + case SK_PNMI_HRX_UTILOVER: + XM_IN16(IoC, PhysPortIndex, XM_RX_CMD, + &Register); + Register |= XM_RX_SAM_LINE; + XM_OUT16(IoC, PhysPortIndex, XM_RX_CMD, + Register); + break; + + case SK_PNMI_HTX_OCTETHIGH: + case SK_PNMI_HTX_OCTETLOW: + case SK_PNMI_HTX_RESERVED26: + case SK_PNMI_HTX_RESERVED27: + case SK_PNMI_HTX_RESERVED28: + case SK_PNMI_HTX_RESERVED29: + case SK_PNMI_HTX_RESERVED30: + case SK_PNMI_HTX_RESERVED31: + case SK_PNMI_HRX_OCTETHIGH: + case SK_PNMI_HRX_OCTETLOW: + case SK_PNMI_HRX_IRLENGTH: + case SK_PNMI_HRX_RESERVED22: + case SK_PNMI_HTX_SYNC: + case SK_PNMI_HTX_SYNC_OCTET: + break; + + default: + pAC->Pnmi.Port[PhysPortIndex]. + CounterHigh[CounterIndex] ++; + } + } + break; + + case SK_PNMI_EVT_SEN_WAR_LOW: +#ifdef DEBUG + if ((unsigned int)Param.Para64 >= (unsigned int)pAC->I2c.MaxSens) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_SEN_WAR_LOW parameter wrong, SensorIndex=%d\n", + (unsigned int)Param.Para64)); + return (0); + } +#endif + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueSensorTrap(pAC, OID_SKGE_TRAP_SEN_WAR_LOW, + (unsigned int)Param.Para64); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + case SK_PNMI_EVT_SEN_WAR_UPP: +#ifdef DEBUG + if ((unsigned int)Param.Para64 >= (unsigned int)pAC->I2c.MaxSens) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR:SkPnmiEvent: SK_PNMI_EVT_SEN_WAR_UPP parameter wrong, SensorIndex=%d\n", + (unsigned int)Param.Para64)); + return (0); + } +#endif + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueSensorTrap(pAC, OID_SKGE_TRAP_SEN_WAR_UPP, + (unsigned int)Param.Para64); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + case SK_PNMI_EVT_SEN_ERR_LOW: +#ifdef DEBUG + if ((unsigned int)Param.Para64 >= (unsigned int)pAC->I2c.MaxSens) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_SEN_ERR_LOW parameter wrong, SensorIndex=%d\n", + (unsigned int)Param.Para64)); + return (0); + } +#endif + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueSensorTrap(pAC, OID_SKGE_TRAP_SEN_ERR_LOW, + (unsigned int)Param.Para64); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + case SK_PNMI_EVT_SEN_ERR_UPP: +#ifdef DEBUG + if ((unsigned int)Param.Para64 >= (unsigned int)pAC->I2c.MaxSens) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_SEN_ERR_UPP parameter wrong, SensorIndex=%d\n", + (unsigned int)Param.Para64)); + return (0); + } +#endif + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueSensorTrap(pAC, OID_SKGE_TRAP_SEN_ERR_UPP, + (unsigned int)Param.Para64); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + case SK_PNMI_EVT_CHG_EST_TIMER: + /* + * Calculate port switch average on a per hour basis + * Time interval for check : 28125 ms + * Number of values for average : 8 + * + * Be careful in changing these values, on change check + * - typedef of SK_PNMI_ESTIMATE (Size of EstValue + * array one less than value number) + * - Timer initilization SkTimerStart() in SkPnmiInit + * - Delta value below must be multiplicated with + * power of 2 + * + */ + pEst = &pAC->Pnmi.RlmtChangeEstimate; + CounterIndex = pEst->EstValueIndex + 1; + if (CounterIndex == 7) { + + CounterIndex = 0; + } + pEst->EstValueIndex = CounterIndex; + + NewestValue = pAC->Pnmi.RlmtChangeCts; + OldestValue = pEst->EstValue[CounterIndex]; + pEst->EstValue[CounterIndex] = NewestValue; + + /* + * Calculate average. Delta stores the number of + * port switches per 28125 * 8 = 225000 ms + */ + if (NewestValue >= OldestValue) { + + Delta = NewestValue - OldestValue; + } + else { + /* Overflow situation */ + Delta = (SK_U64)(0 - OldestValue) + NewestValue; + } + + /* + * Extrapolate delta to port switches per hour. + * Estimate = Delta * (3600000 / 225000) + * = Delta * 16 + * = Delta << 4 + */ + pAC->Pnmi.RlmtChangeEstimate.Estimate = Delta << 4; + + /* + * Check if threshold is exceeded. If the threshold is + * permanently exceeded every 28125 ms an event will be + * generated to remind the user of this condition. + */ + if ((pAC->Pnmi.RlmtChangeThreshold != 0) && + (pAC->Pnmi.RlmtChangeEstimate.Estimate >= + pAC->Pnmi.RlmtChangeThreshold)) { + + QueueSimpleTrap(pAC, OID_SKGE_TRAP_RLMT_CHANGE_THRES); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + } + + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + SkTimerStart(pAC, IoC, &pAC->Pnmi.RlmtChangeEstimate.EstTimer, + 28125000, SKGE_PNMI, SK_PNMI_EVT_CHG_EST_TIMER, + EventParam); + break; + + case SK_PNMI_EVT_CLEAR_COUNTER: + /* + * Set all counters and timestamps to zero + */ + ResetCounter(pAC, IoC); + break; + + case SK_PNMI_EVT_XMAC_RESET: + /* + * To grant continuous counter values store the current + * XMAC statistic values to the entries 1..n of the + * CounterOffset array. XMAC Errata #2 + */ +#ifdef DEBUG + if ((unsigned int)Param.Para64 >= SK_MAX_MACS) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_XMAC_RESET parameter wrong, PhysPortIndex=%d\n", + (unsigned int)Param.Para64)); + return (0); + } +#endif + PhysPortIndex = (unsigned int)Param.Para64; + + /* + * Update XMAC statistic to get fresh values + */ + Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1); + if (Ret != SK_PNMI_ERR_OK) { + + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return"); + return (0); + } + /* + * Increment semaphore to indicate that an update was + * already done + */ + pAC->Pnmi.MacUpdatedFlag ++; + + for (CounterIndex = 0; CounterIndex < SK_PNMI_MAX_IDX; + CounterIndex ++) { + + if (!StatAddress[CounterIndex].GetOffset) { + + continue; + } + + pAC->Pnmi.Port[PhysPortIndex]. + CounterOffset[CounterIndex] = GetPhysStatVal( + pAC, IoC, PhysPortIndex, CounterIndex); + pAC->Pnmi.Port[PhysPortIndex]. + CounterHigh[CounterIndex] = 0; + } + + pAC->Pnmi.MacUpdatedFlag --; + break; + + case SK_PNMI_EVT_RLMT_PORT_UP: +#ifdef DEBUG + if ((unsigned int)Param.Para32[0] >= SK_MAX_MACS) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_RLMT_PORT_UP parameter wrong, PhysPortIndex=%d\n", + (unsigned int)Param.Para32[0])); + + return (0); + } +#endif + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueRlmtPortTrap(pAC, OID_SKGE_TRAP_RLMT_PORT_UP, + (unsigned int)Param.Para32[0]); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + case SK_PNMI_EVT_RLMT_PORT_DOWN: +#ifdef DEBUG + if ((unsigned int)Param.Para32[0] >= SK_MAX_MACS) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_RLMT_PORT_DOWN parameter wrong, PhysPortIndex=%d\n", + (unsigned int)Param.Para32[0])); + + return (0); + } +#endif + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueRlmtPortTrap(pAC, OID_SKGE_TRAP_RLMT_PORT_DOWN, + (unsigned int)Param.Para32[0]); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + case SK_PNMI_EVT_RLMT_ACTIVE_DOWN: + PhysPortIndex = (unsigned int)Param.Para32[0]; +#ifdef DEBUG + if (PhysPortIndex >= SK_MAX_MACS) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_RLMT_ACTIVE_DOWN parameter too high, PhysPort=%d\n", + PhysPortIndex)); + } +#endif + /* + * Nothing to do if port is already inactive + */ + if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) { + + return (0); + } + + /* + * Update statistic counters to calculate new offset + * for the virtual port and increment semaphore to + * indicate that an update was already done. + */ + if (MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1) != + SK_PNMI_ERR_OK) { + + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return"); + return (0); + } + pAC->Pnmi.MacUpdatedFlag ++; + + /* + * Calculate new counter offset for virtual port to + * grant continous counting on port switches. The virtual + * port consists of all currently active ports. The port + * down event indicates that a port is removed fromt the + * virtual port. Therefore add the counter value of the + * removed port to the CounterOffset for the virtual port + * to grant the same counter value. + */ + for (CounterIndex = 0; CounterIndex < SK_PNMI_MAX_IDX; + CounterIndex ++) { + + if (!StatAddress[CounterIndex].GetOffset) { + + continue; + } + + Value = GetPhysStatVal(pAC, IoC, PhysPortIndex, + CounterIndex); + + pAC->Pnmi.VirtualCounterOffset[CounterIndex] += Value; + } + + /* + * Set port to inactive + */ + pAC->Pnmi.Port[PhysPortIndex].ActiveFlag = SK_FALSE; + + pAC->Pnmi.MacUpdatedFlag --; + break; + + case SK_PNMI_EVT_RLMT_ACTIVE_UP: + PhysPortIndex = (unsigned int)Param.Para32[0]; +#ifdef DEBUG + if (PhysPortIndex >= SK_MAX_MACS) { + + SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_CTRL, + ("PNMI: ERR: SkPnmiEvent: SK_PNMI_EVT_RLMT_ACTIVE_UP parameter too high, PhysPort=%d\n", + PhysPortIndex)); + } +#endif + /* + * Nothing to do if port is already active + */ + if (pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) { + + return (0); + } + + /* + * Statistic maintanence + */ + pAC->Pnmi.RlmtChangeCts ++; + pAC->Pnmi.RlmtChangeTime = + SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC)); + + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueRlmtNewMacTrap(pAC, PhysPortIndex); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + + /* + * Update statistic counters to calculate new offset + * for the virtual port and increment semaphore to indicate + * that an update was already done. + */ + if (MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1) != + SK_PNMI_ERR_OK) { + + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return"); + return (0); + } + pAC->Pnmi.MacUpdatedFlag ++; + + /* + * Calculate new counter offset for virtual port to + * grant continous counting on port switches. A new port + * is added to the virtual port. Therefore substract the + * counter value of the new port from the CounterOffset + * for the virtual port to grant the same value. + */ + for (CounterIndex = 0; CounterIndex < SK_PNMI_MAX_IDX; + CounterIndex ++) { + + if (!StatAddress[CounterIndex].GetOffset) { + + continue; + } + + Value = GetPhysStatVal(pAC, IoC, PhysPortIndex, + CounterIndex); + + pAC->Pnmi.VirtualCounterOffset[CounterIndex] -= Value; + } + + /* + * Set port to active + */ + pAC->Pnmi.Port[PhysPortIndex].ActiveFlag = SK_TRUE; + + pAC->Pnmi.MacUpdatedFlag --; + break; + + case SK_PNMI_EVT_RLMT_PORT_SWITCH: + /* + * This event becomes obsolete if RLMT generates directly + * the events SK_PNMI_EVT_RLMT_ACTIVE_DOWN and + * SK_PNMI_EVT_RLMT_ACTIVE_UP. The events are here emulated. + * PNMI handles that multiple ports may become active. + * Increment semaphore to indicate that an update was + * already done. + */ + if (MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1) != + SK_PNMI_ERR_OK) { + + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return"); + return (0); + } + pAC->Pnmi.MacUpdatedFlag ++; + + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_RLMT_ACTIVE_DOWN, Param); + Param.Para32[0] = Param.Para32[1]; + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_RLMT_ACTIVE_UP, Param); + + pAC->Pnmi.MacUpdatedFlag --; + break; + + case SK_PNMI_EVT_RLMT_SEGMENTATION: + /* + * Store a trap message in the trap buffer and generate + * an event for user space applications with the + * SK_DRIVER_SENDEVENT macro. + */ + QueueSimpleTrap(pAC, OID_SKGE_TRAP_RLMT_SEGMENTATION); + (void)SK_DRIVER_SENDEVENT(pAC, IoC); + break; + + default: + break; + } + + SK_PNMI_CHECKFLAGS("SkPnmiEvent: On return"); + return (0); +} + + +/****************************************************************************** + * + * Private functions + * + */ + +/***************************************************************************** + * + * PnmiVar - Gets, presets, and sets single OIDs + * + * Description: + * Looks up the requested OID, calls the corresponding handler + * function, and passes the parameters with the get, preset, or + * set command. The function is called by SkGePnmiGetVar, + * SkGePnmiPreSetVar, or SkGePnmiSetVar. + * + * Returns: + * SK_PNMI_ERR_XXX. For details have a look to the description of the + * calling functions. + */ + +static int PnmiVar( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer which stores the mgmt data to be set */ +unsigned int *pLen, /* Total length of mgmt data */ +SK_U32 Instance) /* Instance (1..n) that is to be set or -1 */ +{ + unsigned int TableIndex; + int Ret; + + + if ((TableIndex = LookupId(Id)) == (unsigned int)(-1)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_OID); + } + + SK_PNMI_CHECKFLAGS("PnmiVar: On call"); + + Ret = IdTable[TableIndex].Func(pAC, IoC, Action, Id, pBuf, pLen, + Instance, TableIndex); + + SK_PNMI_CHECKFLAGS("PnmiVar: On return"); + + return (Ret); +} + +/***************************************************************************** + * + * PnmiStruct - Presets and Sets data in structure SK_PNMI_STRUCT_DATA + * + * Description: + * The return value of the function will also be stored in + * SK_PNMI_STRUCT_DATA if the passed buffer has the minimum size of + * SK_PNMI_MIN_STRUCT_SIZE. The sub-function runs through the IdTable, + * checks which OIDs are able to set, and calls the handler function of + * the OID to perform the set. The return value of the function will + * also be stored in SK_PNMI_STRUCT_DATA if the passed buffer has the + * minimum size of SK_PNMI_MIN_STRUCT_SIZE. The function is called + * by SkGePnmiPreSetStruct and SkGePnmiSetStruct. + * + * Returns: + * SK_PNMI_ERR_XXX. The codes are described in the calling functions. + */ + +static int PnmiStruct( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Set action to be performed */ +char *pBuf, /* Buffer which contains the data to be set */ +unsigned int *pLen) /* Length of buffer */ +{ + int Ret; + unsigned int TableIndex; + unsigned int DstOffset; + unsigned int Len; + unsigned int InstanceNo; + unsigned int InstanceCnt; + SK_U32 Instance; + SK_U32 Id; + + + /* Check if the passed buffer has the right size */ + if (*pLen < SK_PNMI_STRUCT_SIZE) { + + /* Check if we can return the error within the buffer */ + if (*pLen >= SK_PNMI_MIN_STRUCT_SIZE) { + + SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_TOO_SHORT, + (SK_U32)(-1)); + } + + *pLen = SK_PNMI_STRUCT_SIZE; + return (SK_PNMI_ERR_TOO_SHORT); + } + + SK_PNMI_CHECKFLAGS("PnmiStruct: On call"); + + /* + * Update the values of RLMT and SIRQ and increment semaphores to + * indicate that an update was already done. + */ + if ((Ret = RlmtUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1)); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (Ret); + } + + if ((Ret = SirqUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + SK_PNMI_SET_STAT(pBuf, Ret, (SK_U32)(-1)); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (Ret); + } + + pAC->Pnmi.RlmtUpdatedFlag ++; + pAC->Pnmi.SirqUpdatedFlag ++; + + /* Preset/Set values */ + for (TableIndex = 0; TableIndex < sizeof(IdTable)/sizeof(IdTable[0]); + TableIndex ++) { + + if (IdTable[TableIndex].Access != SK_PNMI_RW) { + + continue; + } + + InstanceNo = IdTable[TableIndex].InstanceNo; + Id = IdTable[TableIndex].Id; + + for (InstanceCnt = 1; InstanceCnt <= InstanceNo; + InstanceCnt ++) { + + DstOffset = IdTable[TableIndex].Offset + + (InstanceCnt - 1) * + IdTable[TableIndex].StructSize; + + /* + * Because VPD multiple instance variables are + * not setable we do not need to evaluate VPD + * instances. Have a look to VPD instance + * calculation in SkPnmiGetStruct(). + */ + Instance = (SK_U32)InstanceCnt; + + /* + * Evaluate needed buffer length + */ + Len = 0; + Ret = IdTable[TableIndex].Func(pAC, IoC, + SK_PNMI_GET, IdTable[TableIndex].Id, + NULL, &Len, Instance, TableIndex); + + if (Ret == SK_PNMI_ERR_UNKNOWN_INST) { + + break; + } + if (Ret != SK_PNMI_ERR_TOO_SHORT) { + + pAC->Pnmi.RlmtUpdatedFlag --; + pAC->Pnmi.SirqUpdatedFlag --; + + SK_PNMI_CHECKFLAGS("PnmiStruct: On return"); + SK_PNMI_SET_STAT(pBuf, + SK_PNMI_ERR_GENERAL, DstOffset); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (SK_PNMI_ERR_GENERAL); + } + if (Id == OID_SKGE_VPD_ACTION) { + + switch (*(pBuf + DstOffset)) { + + case SK_PNMI_VPD_CREATE: + Len = 3 + *(pBuf + DstOffset + 3); + break; + + case SK_PNMI_VPD_DELETE: + Len = 3; + break; + + default: + Len = 1; + break; + } + } + + /* Call the OID handler function */ + Ret = IdTable[TableIndex].Func(pAC, IoC, Action, + IdTable[TableIndex].Id, pBuf + DstOffset, + &Len, Instance, TableIndex); + + if (Ret != SK_PNMI_ERR_OK) { + + pAC->Pnmi.RlmtUpdatedFlag --; + pAC->Pnmi.SirqUpdatedFlag --; + + SK_PNMI_CHECKFLAGS("PnmiStruct: On return"); + SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_BAD_VALUE, + DstOffset); + *pLen = SK_PNMI_MIN_STRUCT_SIZE; + return (SK_PNMI_ERR_BAD_VALUE); + } + } + } + + pAC->Pnmi.RlmtUpdatedFlag --; + pAC->Pnmi.SirqUpdatedFlag --; + + SK_PNMI_CHECKFLAGS("PnmiStruct: On return"); + SK_PNMI_SET_STAT(pBuf, SK_PNMI_ERR_OK, (SK_U32)(-1)); + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * LookupId - Lookup an OID in the IdTable + * + * Description: + * Scans the IdTable to find the table entry of an OID. + * + * Returns: + * The table index or -1 if not found. + */ + +static int LookupId( +SK_U32 Id) /* Object identifier to be searched */ +{ + int i; + int Len = sizeof(IdTable)/sizeof(IdTable[0]); + + for (i=0; i sizeof(SK_U32)) { + + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* Check if the command is a known one */ + SK_PNMI_READ_U32(pBuf, ActionOp); + if (*pLen > sizeof(SK_U32) || + (ActionOp != SK_PNMI_ACT_IDLE && + ActionOp != SK_PNMI_ACT_RESET && + ActionOp != SK_PNMI_ACT_SELFTEST && + ActionOp != SK_PNMI_ACT_RESETCNT)) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* A preset ends here */ + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + switch (ActionOp) { + + case SK_PNMI_ACT_IDLE: + /* Nothing to do */ + break; + + case SK_PNMI_ACT_RESET: + /* + * Perform a driver reset or something that comes near + * to this. + */ + Ret = SK_DRIVER_RESET(pAC, IoC); + if (Ret != 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR005, + SK_PNMI_ERR005MSG); + + return (SK_PNMI_ERR_GENERAL); + } + break; + + case SK_PNMI_ACT_SELFTEST: + /* + * Perform a driver selftest or something similar to this. + * Currently this feature is not used and will probably + * implemented in another way. + */ + Ret = SK_DRIVER_SELFTEST(pAC, IoC); + pAC->Pnmi.TestResult = Ret; + break; + + case SK_PNMI_ACT_RESETCNT: + /* Set all counters and timestamps to zero */ + ResetCounter(pAC, IoC); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR006, + SK_PNMI_ERR006MSG); + + return (SK_PNMI_ERR_GENERAL); + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * Mac8023Stat - OID handler of OID_GEN_XXX and OID_802_3_XXX + * + * Description: + * Retrieves the statistic values of the virtual port (logical + * index 0). Only special OIDs of NDIS are handled which consist + * of a 32 bit instead of a 64 bit value. The OIDs are public + * because perhaps some other platform can use them too. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int Mac8023Stat( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + int Ret; + SK_U32 StatVal; + + + /* + * Only the active Mac is returned + */ + if (Instance != (SK_U32)(-1) && Instance != 1) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + /* + * Check action type + */ + if (Action != SK_PNMI_GET) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Check length + */ + switch (Id) { + + case OID_802_3_PERMANENT_ADDRESS: + case OID_802_3_CURRENT_ADDRESS: + if (*pLen < sizeof(SK_MAC_ADDR)) { + + *pLen = sizeof(SK_MAC_ADDR); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + default: + if (*pLen < 4) { + + *pLen = 4; + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + } + + /* + * Update all statistics, because we retrieve virtual MAC, which + * consists of multiple physical statistics and increment semaphore + * to indicate that an update was already done. + */ + Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1); + if ( Ret != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + pAC->Pnmi.MacUpdatedFlag ++; + + /* + * Get value (MAC Index 0 identifies the virtual MAC) + */ + switch (Id) { + + case OID_802_3_PERMANENT_ADDRESS: + CopyMac(pBuf, &pAC->Addr.PermanentMacAddress); + *pLen = sizeof(SK_MAC_ADDR); + break; + + case OID_802_3_CURRENT_ADDRESS: + CopyMac(pBuf, &pAC->Addr.CurrentMacAddress); + *pLen = sizeof(SK_MAC_ADDR); + break; + + default: + StatVal = (SK_U32)GetStatVal(pAC, IoC, 0, + IdTable[TableIndex].Param); + SK_PNMI_STORE_U32(pBuf, StatVal); + *pLen = sizeof(SK_U32); + break; + } + + pAC->Pnmi.MacUpdatedFlag --; + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * MacPrivateStat - OID handler function of OID_SKGE_STAT_XXX + * + * Description: + * Retrieves the XMAC statistic data. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int MacPrivateStat( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + unsigned int LogPortMax; + unsigned int LogPortIndex; + unsigned int PhysPortMax; + unsigned int Limit; + unsigned int Offset; + int Ret; + SK_U64 StatVal; + + + /* + * Calculate instance if wished. MAC index 0 is the virtual + * MAC. + */ + PhysPortMax = pAC->GIni.GIMacsFound; + LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax); + + if ((Instance != (SK_U32)(-1))) { + + if ((Instance < 1) || (Instance > LogPortMax)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + LogPortIndex = SK_PNMI_PORT_INST2LOG(Instance); + Limit = LogPortIndex + 1; + } + else { + LogPortIndex = 0; + Limit = LogPortMax; + } + + /* + * Check action + */ + if (Action != SK_PNMI_GET) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Check length + */ + if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U64)) { + + *pLen = (Limit - LogPortIndex) * sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* + * Update XMAC statistic and increment semaphore to indicate that + * an update was already done. + */ + Ret = MacUpdate(pAC, IoC, 0, PhysPortMax - 1); + if (Ret != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + pAC->Pnmi.MacUpdatedFlag ++; + + /* + * Get value + */ + Offset = 0; + for (; LogPortIndex < Limit; LogPortIndex ++) { + + switch (Id) { + +/* XXX not yet implemented due to XMAC problems + case OID_SKGE_STAT_TX_UTIL: + return (SK_PNMI_ERR_GENERAL); +*/ +/* XXX not yet implemented due to XMAC problems + case OID_SKGE_STAT_RX_UTIL: + return (SK_PNMI_ERR_GENERAL); +*/ + default: + StatVal = GetStatVal(pAC, IoC, LogPortIndex, + IdTable[TableIndex].Param); + SK_PNMI_STORE_U64(pBuf + Offset, StatVal); + break; + } + + Offset += sizeof(SK_U64); + } + *pLen = Offset; + + pAC->Pnmi.MacUpdatedFlag --; + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * Addr - OID handler function of OID_SKGE_PHYS_CUR_ADDR and _FAC_ADDR + * + * Description: + * Get/Presets/Sets the current and factory MAC address. The MAC + * address of the virtual port, which is reported to the OS, may + * not be changed, but the physical ones. A set to the virtual port + * will be ignored. No error should be reported because otherwise + * a multiple instance set (-1) would always fail. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int Addr( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + int Ret; + unsigned int LogPortMax; + unsigned int PhysPortMax; + unsigned int LogPortIndex; + unsigned int PhysPortIndex; + unsigned int Limit; + unsigned int Offset = 0; + + + /* + * Calculate instance if wished + */ + PhysPortMax = pAC->GIni.GIMacsFound; + LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax); + + if ((Instance != (SK_U32)(-1))) { + + if ((Instance < 1) || (Instance > SKCS_NUM_PROTOCOLS)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + LogPortIndex = SK_PNMI_PORT_INST2LOG(Instance); + Limit = LogPortIndex + 1; + } + else { + LogPortIndex = 0; + Limit = LogPortMax; + } + + /* + * Perform Action + */ + if (Action == SK_PNMI_GET) { + + /* + * Check length + */ + if (*pLen < (Limit - LogPortIndex) * 6) { + + *pLen = (Limit - LogPortIndex) * 6; + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* + * Get value + */ + for (; LogPortIndex < Limit; LogPortIndex ++) { + + switch (Id) { + + case OID_SKGE_PHYS_CUR_ADDR: + if (LogPortIndex == 0) { + + CopyMac(pBuf + Offset, &pAC->Addr. + CurrentMacAddress); + } + else { + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + CopyMac(pBuf + Offset, &pAC->Addr. + Port[PhysPortIndex]. + CurrentMacAddress); + } + Offset += 6; + break; + + case OID_SKGE_PHYS_FAC_ADDR: + if (LogPortIndex == 0) { + + CopyMac(pBuf + Offset, &pAC->Addr. + PermanentMacAddress); + } + else { + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + CopyMac(pBuf + Offset, &pAC->Addr. + Port[PhysPortIndex]. + PermanentMacAddress); + } + Offset += 6; + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR008, + SK_PNMI_ERR008MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + + *pLen = Offset; + } + else { + /* + * The logical MAC address may not be changed only + * the physical ones + */ + if (Id == OID_SKGE_PHYS_FAC_ADDR) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Only the current address may be changed + */ + if (Id != OID_SKGE_PHYS_CUR_ADDR) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR009, + SK_PNMI_ERR009MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + /* + * Check length + */ + if (*pLen < (Limit - LogPortIndex) * 6) { + + *pLen = (Limit - LogPortIndex) * 6; + return (SK_PNMI_ERR_TOO_SHORT); + } + if (*pLen > (Limit - LogPortIndex) * 6) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* + * Check Action + */ + if (Action == SK_PNMI_PRESET) { + + *pLen = 0; + return (SK_PNMI_ERR_OK); + } + + /* + * Set OID_SKGE_MAC_CUR_ADDR + */ + for (; LogPortIndex < Limit; LogPortIndex ++, Offset += 6) { + + /* + * A set to virtual port and set of broadcast + * address will be ignored + */ + if (LogPortIndex == 0 || SK_MEMCMP(pBuf + Offset, + "\xff\xff\xff\xff\xff\xff", 6) == 0) { + + continue; + } + + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, + LogPortIndex); + + Ret = SkAddrOverride(pAC, IoC, PhysPortIndex, + (SK_MAC_ADDR *)(pBuf + Offset), + (LogPortIndex == 0 ? SK_ADDR_VIRTUAL_ADDRESS : + SK_ADDR_PHYSICAL_ADDRESS)); + if (Ret != SK_ADDR_OVERRIDE_SUCCESS) { + + return (SK_PNMI_ERR_GENERAL); + } + } + *pLen = Offset; + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * CsumStat - OID handler function of OID_SKGE_CHKSM_XXX + * + * Description: + * Retrieves the statistic values of the CSUM module. The CSUM data + * structure must be available in the SK_AC even if the CSUM module + * is not included, because PNMI reads the statistic data from the + * CSUM part of SK_AC directly. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int CsumStat( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + unsigned int Index; + unsigned int Limit; + unsigned int Offset = 0; + SK_U64 StatVal; + + + /* + * Calculate instance if wished + */ + if (Instance != (SK_U32)(-1)) { + + if ((Instance < 1) || (Instance > SKCS_NUM_PROTOCOLS)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + Index = (unsigned int)Instance - 1; + Limit = (unsigned int)Instance; + } + else { + Index = 0; + Limit = SKCS_NUM_PROTOCOLS; + } + + /* + * Check action + */ + if (Action != SK_PNMI_GET) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Check length + */ + if (*pLen < (Limit - Index) * sizeof(SK_U64)) { + + *pLen = (Limit - Index) * sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* + * Get value + */ + for (; Index < Limit; Index ++) { + + switch (Id) { + + case OID_SKGE_CHKSM_RX_OK_CTS: + StatVal = pAC->Csum.ProtoStats[Index].RxOkCts; + break; + + case OID_SKGE_CHKSM_RX_UNABLE_CTS: + StatVal = pAC->Csum.ProtoStats[Index].RxUnableCts; + break; + + case OID_SKGE_CHKSM_RX_ERR_CTS: + StatVal = pAC->Csum.ProtoStats[Index].RxErrCts; + break; + + case OID_SKGE_CHKSM_TX_OK_CTS: + StatVal = pAC->Csum.ProtoStats[Index].TxOkCts; + break; + + case OID_SKGE_CHKSM_TX_UNABLE_CTS: + StatVal = pAC->Csum.ProtoStats[Index].TxUnableCts; + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR010, + SK_PNMI_ERR010MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + SK_PNMI_STORE_U64(pBuf + Offset, StatVal); + Offset += sizeof(SK_U64); + } + + /* + * Store used buffer space + */ + *pLen = Offset; + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * SensorStat - OID handler function of OID_SKGE_SENSOR_XXX + * + * Description: + * Retrieves the statistic values of the I2C module, which handles + * the temperature and voltage sensors. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int SensorStat( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + unsigned int i; + unsigned int Index; + unsigned int Limit; + unsigned int Offset; + unsigned int Len; + SK_U32 Val32; + SK_U64 Val64; + + + /* + * Calculate instance if wished + */ + if ((Instance != (SK_U32)(-1))) { + + if ((Instance < 1) || (Instance > (SK_U32)pAC->I2c.MaxSens)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + Index = (unsigned int)Instance -1; + Limit = (unsigned int)Instance; + } + else { + Index = 0; + Limit = (unsigned int) pAC->I2c.MaxSens; + } + + /* + * Check action + */ + if (Action != SK_PNMI_GET) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Check length + */ + switch (Id) { + + case OID_SKGE_SENSOR_VALUE: + case OID_SKGE_SENSOR_WAR_THRES_LOW: + case OID_SKGE_SENSOR_WAR_THRES_UPP: + case OID_SKGE_SENSOR_ERR_THRES_LOW: + case OID_SKGE_SENSOR_ERR_THRES_UPP: + if (*pLen < (Limit - Index) * sizeof(SK_U32)) { + + *pLen = (Limit - Index) * sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_SENSOR_DESCR: + for (Offset = 0, i = Index; i < Limit; i ++) { + + Len = (unsigned int) + SK_STRLEN(pAC->I2c.SenTable[i].SenDesc) + 1; + if (Len >= SK_PNMI_STRINGLEN2) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR011, + SK_PNMI_ERR011MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + Offset += Len; + } + if (*pLen < Offset) { + + *pLen = Offset; + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_SENSOR_INDEX: + case OID_SKGE_SENSOR_TYPE: + case OID_SKGE_SENSOR_STATUS: + if (*pLen < Limit - Index) { + + *pLen = Limit - Index; + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_SENSOR_WAR_CTS: + case OID_SKGE_SENSOR_WAR_TIME: + case OID_SKGE_SENSOR_ERR_CTS: + case OID_SKGE_SENSOR_ERR_TIME: + if (*pLen < (Limit - Index) * sizeof(SK_U64)) { + + *pLen = (Limit - Index) * sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR012, + SK_PNMI_ERR012MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + + } + + /* + * Get value + */ + for (Offset = 0; Index < Limit; Index ++) { + + switch (Id) { + + case OID_SKGE_SENSOR_INDEX: + *(pBuf + Offset) = (char)Index; + Offset += sizeof(char); + break; + + case OID_SKGE_SENSOR_DESCR: + Len = SK_STRLEN(pAC->I2c.SenTable[Index].SenDesc); + SK_MEMCPY(pBuf + Offset + 1, + pAC->I2c.SenTable[Index].SenDesc, Len); + *(pBuf + Offset) = (char)Len; + Offset += Len + 1; + break; + + case OID_SKGE_SENSOR_TYPE: + *(pBuf + Offset) = + (char)pAC->I2c.SenTable[Index].SenType; + Offset += sizeof(char); + break; + + case OID_SKGE_SENSOR_VALUE: + Val32 = (SK_U32)pAC->I2c.SenTable[Index].SenValue; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_SENSOR_WAR_THRES_LOW: + Val32 = (SK_U32)pAC->I2c.SenTable[Index]. + SenThreWarnLow; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_SENSOR_WAR_THRES_UPP: + Val32 = (SK_U32)pAC->I2c.SenTable[Index]. + SenThreWarnHigh; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_SENSOR_ERR_THRES_LOW: + Val32 = (SK_U32)pAC->I2c.SenTable[Index]. + SenThreErrLow; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_SENSOR_ERR_THRES_UPP: + Val32 = pAC->I2c.SenTable[Index].SenThreErrHigh; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_SENSOR_STATUS: + *(pBuf + Offset) = + (char)pAC->I2c.SenTable[Index].SenErrFlag; + Offset += sizeof(char); + break; + + case OID_SKGE_SENSOR_WAR_CTS: + Val64 = pAC->I2c.SenTable[Index].SenWarnCts; + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + case OID_SKGE_SENSOR_ERR_CTS: + Val64 = pAC->I2c.SenTable[Index].SenErrCts; + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + case OID_SKGE_SENSOR_WAR_TIME: + Val64 = SK_PNMI_HUNDREDS_SEC(pAC->I2c.SenTable[Index]. + SenBegWarnTS); + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + case OID_SKGE_SENSOR_ERR_TIME: + Val64 = SK_PNMI_HUNDREDS_SEC(pAC->I2c.SenTable[Index]. + SenBegErrTS); + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR013, + SK_PNMI_ERR013MSG); + + return (SK_PNMI_ERR_GENERAL); + } + } + + /* + * Store used buffer space + */ + *pLen = Offset; + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * Vpd - OID handler function of OID_SKGE_VPD_XXX + * + * Description: + * Get/preset/set of VPD data. As instance the name of a VPD key + * can be passed. The Instance parameter is a SK_U32 and can be + * used as a string buffer for the VPD key, because their maximum + * length is 4 byte. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int Vpd( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + SK_VPD_STATUS *pVpdStatus; + unsigned int BufLen; + char Buf[256]; + char KeyArr[SK_PNMI_VPD_ARR_SIZE][SK_PNMI_VPD_STR_SIZE]; + char KeyStr[SK_PNMI_VPD_STR_SIZE]; + unsigned int KeyNo; + unsigned int Offset; + unsigned int Index; + unsigned int FirstIndex; + unsigned int LastIndex; + unsigned int Len; + int Ret; + SK_U32 Val32; + + /* + * Get array of all currently stored VPD keys + */ + Ret = GetVpdKeyArr(pAC, IoC, &KeyArr[0][0], sizeof(KeyArr), + &KeyNo); + if (Ret != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + + /* + * If instance is not -1, try to find the requested VPD key for + * the multiple instance variables. The other OIDs as for example + * OID VPD_ACTION are single instance variables and must be + * handled separatly. + */ + FirstIndex = 0; + LastIndex = KeyNo; + + if ((Instance != (SK_U32)(-1))) { + + if (Id == OID_SKGE_VPD_KEY || Id == OID_SKGE_VPD_VALUE || + Id == OID_SKGE_VPD_ACCESS) { + + SK_STRNCPY(KeyStr, (char *)&Instance, 4); + KeyStr[4] = 0; + + for (Index = 0; Index < KeyNo; Index ++) { + + if (SK_STRCMP(KeyStr, KeyArr[Index]) == 0) { + + FirstIndex = Index; + LastIndex = Index+1; + break; + } + } + if (Index == KeyNo) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + } + else if (Instance != 1) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + } + + /* + * Get value, if a query should be performed + */ + if (Action == SK_PNMI_GET) { + + switch (Id) { + + case OID_SKGE_VPD_FREE_BYTES: + /* Check length of buffer */ + if (*pLen < sizeof(SK_U32)) { + + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + /* Get number of free bytes */ + pVpdStatus = VpdStat(pAC, IoC); + if (pVpdStatus == NULL) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR017, + SK_PNMI_ERR017MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + if ((pVpdStatus->vpd_status & VPD_VALID) == 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR018, + SK_PNMI_ERR018MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + Val32 = (SK_U32)pVpdStatus->vpd_free_rw; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_VPD_ENTRIES_LIST: + /* Check length */ + for (Len = 0, Index = 0; Index < KeyNo; Index ++) { + + Len += SK_STRLEN(KeyArr[Index]) + 1; + } + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* Get value */ + *(pBuf) = (char)Len - 1; + for (Offset = 1, Index = 0; Index < KeyNo; Index ++) { + + Len = SK_STRLEN(KeyArr[Index]); + SK_MEMCPY(pBuf + Offset, KeyArr[Index], Len); + + Offset += Len; + + if (Index < KeyNo - 1) { + + *(pBuf + Offset) = ' '; + Offset ++; + } + } + *pLen = Offset; + break; + + case OID_SKGE_VPD_ENTRIES_NUMBER: + /* Check length */ + if (*pLen < sizeof(SK_U32)) { + + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + + Val32 = (SK_U32)KeyNo; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_VPD_KEY: + /* Check buffer length, if it is large enough */ + for (Len = 0, Index = FirstIndex; + Index < LastIndex; Index ++) { + + Len += SK_STRLEN(KeyArr[Index]) + 1; + } + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* + * Get the key to an intermediate buffer, because + * we have to prepend a length byte. + */ + for (Offset = 0, Index = FirstIndex; + Index < LastIndex; Index ++) { + + Len = SK_STRLEN(KeyArr[Index]); + + *(pBuf + Offset) = (char)Len; + SK_MEMCPY(pBuf + Offset + 1, KeyArr[Index], + Len); + Offset += Len + 1; + } + *pLen = Offset; + break; + + case OID_SKGE_VPD_VALUE: + /* Check the buffer length if it is large enough */ + for (Offset = 0, Index = FirstIndex; + Index < LastIndex; Index ++) { + + BufLen = 256; + if (VpdRead(pAC, IoC, KeyArr[Index], Buf, + (int *)&BufLen) > 0 || + BufLen >= SK_PNMI_VPD_DATALEN) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR021, + SK_PNMI_ERR021MSG); + + return (SK_PNMI_ERR_GENERAL); + } + Offset += BufLen + 1; + } + if (*pLen < Offset) { + + *pLen = Offset; + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* + * Get the value to an intermediate buffer, because + * we have to prepend a length byte. + */ + for (Offset = 0, Index = FirstIndex; + Index < LastIndex; Index ++) { + + BufLen = 256; + if (VpdRead(pAC, IoC, KeyArr[Index], Buf, + (int *)&BufLen) > 0 || + BufLen >= SK_PNMI_VPD_DATALEN) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR022, + SK_PNMI_ERR022MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + *(pBuf + Offset) = (char)BufLen; + SK_MEMCPY(pBuf + Offset + 1, Buf, BufLen); + Offset += BufLen + 1; + } + *pLen = Offset; + break; + + case OID_SKGE_VPD_ACCESS: + if (*pLen < LastIndex - FirstIndex) { + + *pLen = LastIndex - FirstIndex; + return (SK_PNMI_ERR_TOO_SHORT); + } + + for (Offset = 0, Index = FirstIndex; + Index < LastIndex; Index ++) { + + if (VpdMayWrite(KeyArr[Index])) { + + *(pBuf + Offset) = SK_PNMI_VPD_RW; + } + else { + *(pBuf + Offset) = SK_PNMI_VPD_RO; + } + Offset ++; + } + *pLen = Offset; + break; + + case OID_SKGE_VPD_ACTION: + Offset = LastIndex - FirstIndex; + if (*pLen < Offset) { + + *pLen = Offset; + return (SK_PNMI_ERR_TOO_SHORT); + } + SK_MEMSET(pBuf, 0, Offset); + *pLen = Offset; + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR023, + SK_PNMI_ERR023MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + else { + /* The only OID which can be set is VPD_ACTION */ + if (Id != OID_SKGE_VPD_ACTION) { + + if (Id == OID_SKGE_VPD_FREE_BYTES || + Id == OID_SKGE_VPD_ENTRIES_LIST || + Id == OID_SKGE_VPD_ENTRIES_NUMBER || + Id == OID_SKGE_VPD_KEY || + Id == OID_SKGE_VPD_VALUE || + Id == OID_SKGE_VPD_ACCESS) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR024, + SK_PNMI_ERR024MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + /* + * From this point we handle VPD_ACTION. Check the buffer + * length. It should at least have the size of one byte. + */ + if (*pLen < 1) { + + *pLen = 1; + return (SK_PNMI_ERR_TOO_SHORT); + } + + /* + * The first byte contains the VPD action type we should + * perform. + */ + switch (*pBuf) { + + case SK_PNMI_VPD_IGNORE: + /* Nothing to do */ + break; + + case SK_PNMI_VPD_CREATE: + /* + * We have to create a new VPD entry or we modify + * an existing one. Check first the buffer length. + */ + if (*pLen < 4) { + + *pLen = 4; + return (SK_PNMI_ERR_TOO_SHORT); + } + KeyStr[0] = pBuf[1]; + KeyStr[1] = pBuf[2]; + KeyStr[2] = 0; + + /* + * Is the entry writable or does it belong to the + * read-only area? + */ + if (!VpdMayWrite(KeyStr)) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + Offset = (int)pBuf[3] & 0xFF; + + SK_MEMCPY(Buf, pBuf + 4, Offset); + Buf[Offset] = 0; + + /* A preset ends here */ + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + /* Write the new entry or modify an existing one */ + Ret = VpdWrite(pAC, IoC, KeyStr, Buf); + if (Ret == SK_PNMI_VPD_NOWRITE ) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + else if (Ret != SK_PNMI_VPD_OK) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR025, + SK_PNMI_ERR025MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + /* + * Perform an update of the VPD data. This is + * not mandantory, but just to be sure. + */ + Ret = VpdUpdate(pAC, IoC); + if (Ret != SK_PNMI_VPD_OK) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR026, + SK_PNMI_ERR026MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + break; + + case SK_PNMI_VPD_DELETE: + /* Check if the buffer size is plausible */ + if (*pLen < 3) { + + *pLen = 3; + return (SK_PNMI_ERR_TOO_SHORT); + } + if (*pLen > 3) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + KeyStr[0] = pBuf[1]; + KeyStr[1] = pBuf[2]; + KeyStr[2] = 0; + + /* Find the passed key in the array */ + for (Index = 0; Index < KeyNo; Index ++) { + + if (SK_STRCMP(KeyStr, KeyArr[Index]) == 0) { + + break; + } + } + /* + * If we cannot find the key it is wrong, so we + * return an appropriate error value. + */ + if (Index == KeyNo) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + /* Ok, you wanted it and you will get it */ + Ret = VpdDelete(pAC, IoC, KeyStr); + if (Ret != SK_PNMI_VPD_OK) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR027, + SK_PNMI_ERR027MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + /* + * Perform an update of the VPD data. This is + * not mandantory, but just to be sure. + */ + Ret = VpdUpdate(pAC, IoC); + if (Ret != SK_PNMI_VPD_OK) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR028, + SK_PNMI_ERR028MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + break; + + default: + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * General - OID handler function of various single instance OIDs + * + * Description: + * The code is simple. No description necessary. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int General( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + int Ret; + unsigned int Index; + unsigned int Len; + unsigned int Offset; + unsigned int Val; + SK_U8 Val8; + SK_U16 Val16; + SK_U32 Val32; + SK_U64 Val64; + SK_U64 Val64RxHwErrs = 0; + SK_U64 Val64TxHwErrs = 0; + char Buf[256]; + + + /* + * Check instance. We only handle single instance variables + */ + if (Instance != (SK_U32)(-1) && Instance != 1) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + /* + * Check action. We only allow get requests. + */ + if (Action != SK_PNMI_GET) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Check length for the various supported OIDs + */ + switch (Id) { + + case OID_SKGE_PORT_NUMBER: + case OID_SKGE_DEVICE_TYPE: + case OID_SKGE_RESULT: + case OID_SKGE_RLMT_MONITOR_NUMBER: + case OID_GEN_XMIT_ERROR: + case OID_GEN_RCV_ERROR: + case OID_GEN_RCV_NO_BUFFER: + case OID_GEN_TRANSMIT_QUEUE_LENGTH: + case OID_SKGE_TRAP_NUMBER: + case OID_SKGE_MDB_VERSION: + if (*pLen < sizeof(SK_U32)) { + + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_CHIPSET: + if (*pLen < sizeof(SK_U16)) { + + *pLen = sizeof(SK_U16); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_BUS_TYPE: + case OID_SKGE_BUS_SPEED: + case OID_SKGE_BUS_WIDTH: + case OID_SKGE_SENSOR_NUMBER: + case OID_SKGE_CHKSM_NUMBER: + if (*pLen < sizeof(SK_U8)) { + + *pLen = sizeof(SK_U8); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_TX_SW_QUEUE_LEN: + case OID_SKGE_TX_SW_QUEUE_MAX: + case OID_SKGE_TX_RETRY: + case OID_SKGE_RX_INTR_CTS: + case OID_SKGE_TX_INTR_CTS: + case OID_SKGE_RX_NO_BUF_CTS: + case OID_SKGE_TX_NO_BUF_CTS: + case OID_SKGE_TX_USED_DESCR_NO: + case OID_SKGE_RX_DELIVERED_CTS: + case OID_SKGE_RX_OCTETS_DELIV_CTS: + case OID_SKGE_RX_HW_ERROR_CTS: + case OID_SKGE_TX_HW_ERROR_CTS: + case OID_SKGE_IN_ERRORS_CTS: + case OID_SKGE_OUT_ERROR_CTS: + case OID_SKGE_ERR_RECOVERY_CTS: + case OID_SKGE_SYSUPTIME: + if (*pLen < sizeof(SK_U64)) { + + *pLen = sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + default: + /* Checked later */ + break; + } + + /* Update statistic */ + if (Id == OID_SKGE_RX_HW_ERROR_CTS || + Id == OID_SKGE_TX_HW_ERROR_CTS || + Id == OID_SKGE_IN_ERRORS_CTS || + Id == OID_SKGE_OUT_ERROR_CTS || + Id == OID_GEN_XMIT_ERROR || + Id == OID_GEN_RCV_ERROR) { + + /* Force the XMAC to update its statistic counters and + * Increment semaphore to indicate that an update was + * already done. + */ + Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1); + if (Ret != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + pAC->Pnmi.MacUpdatedFlag ++; + + /* + * Some OIDs consist of multiple hardware counters. Those + * values which are contained in all of them will be added + * now. + */ + switch (Id) { + + case OID_SKGE_RX_HW_ERROR_CTS: + case OID_SKGE_IN_ERRORS_CTS: + case OID_GEN_RCV_ERROR: + Val64RxHwErrs = + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_MISSED) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FRAMING) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_OVERFLOW)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_JABBER) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CARRIER) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_IRLENGTH)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SYMBOL) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SHORTS) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_RUNT) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FCS) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CEXT); + break; + + case OID_SKGE_TX_HW_ERROR_CTS: + case OID_SKGE_OUT_ERROR_CTS: + case OID_GEN_XMIT_ERROR: + Val64TxHwErrs = + GetStatVal(pAC, IoC, 0, + SK_PNMI_HTX_EXCESS_COL) + + GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_LATE_COL)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_UNDERRUN)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_CARRIER)+ + GetStatVal(pAC, IoC, 0, + SK_PNMI_HTX_EXCESS_COL); + break; + } + } + + /* + * Retrieve value + */ + switch (Id) { + + case OID_SKGE_SUPPORTED_LIST: + Len = sizeof(IdTable)/sizeof(IdTable[0]) * sizeof(SK_U32); + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + for (Offset = 0, Index = 0; Offset < Len; + Offset += sizeof(SK_U32), Index ++) { + + Val32 = (SK_U32)IdTable[Index].Id; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + } + *pLen = Len; + break; + + case OID_SKGE_PORT_NUMBER: + Val32 = (SK_U32)pAC->GIni.GIMacsFound; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_DEVICE_TYPE: + Val32 = (SK_U32)pAC->Pnmi.DeviceType; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_DRIVER_DESCR: + if (pAC->Pnmi.pDriverDescription == NULL) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR007, + SK_PNMI_ERR007MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + Len = SK_STRLEN(pAC->Pnmi.pDriverDescription) + 1; + if (Len > SK_PNMI_STRINGLEN1) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR029, + SK_PNMI_ERR029MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + *pBuf = (char)(Len - 1); + SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverDescription, Len - 1); + *pLen = Len; + break; + + case OID_SKGE_DRIVER_VERSION: + if (pAC->Pnmi.pDriverVersion == NULL) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030, + SK_PNMI_ERR030MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + Len = SK_STRLEN(pAC->Pnmi.pDriverVersion) + 1; + if (Len > SK_PNMI_STRINGLEN1) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031, + SK_PNMI_ERR031MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + *pBuf = (char)(Len - 1); + SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverVersion, Len - 1); + *pLen = Len; + break; + + case OID_SKGE_HW_DESCR: + /* + * The hardware description is located in the VPD. This + * query may move to the initialisation routine. But + * the VPD data is cached and therefore a call here + * will not make much difference. + */ + Len = 256; + if (VpdRead(pAC, IoC, VPD_NAME, Buf, (int *)&Len) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR032, + SK_PNMI_ERR032MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + Len ++; + if (Len > SK_PNMI_STRINGLEN1) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR033, + SK_PNMI_ERR033MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + *pBuf = (char)(Len - 1); + SK_MEMCPY(pBuf + 1, Buf, Len - 1); + *pLen = Len; + break; + + case OID_SKGE_HW_VERSION: + /* Oh, I love to do some string manipulation */ + if (*pLen < 5) { + + *pLen = 5; + return (SK_PNMI_ERR_TOO_SHORT); + } + Val8 = (SK_U8)pAC->GIni.GIPciHwRev; + pBuf[0] = 4; + pBuf[1] = 'v'; + pBuf[2] = (char)(0x30 | ((Val8 >> 4) & 0x0F)); + pBuf[3] = '.'; + pBuf[4] = (char)(0x30 | (Val8 & 0x0F)); + *pLen = 5; + break; + + case OID_SKGE_CHIPSET: + Val16 = SK_PNMI_CHIPSET; + SK_PNMI_STORE_U16(pBuf, Val16); + *pLen = sizeof(SK_U16); + break; + + case OID_SKGE_BUS_TYPE: + *pBuf = (char)SK_PNMI_BUS_PCI; + *pLen = sizeof(char); + break; + + case OID_SKGE_BUS_SPEED: + *pBuf = pAC->Pnmi.PciBusSpeed; + *pLen = sizeof(char); + break; + + case OID_SKGE_BUS_WIDTH: + *pBuf = pAC->Pnmi.PciBusWidth; + *pLen = sizeof(char); + break; + + case OID_SKGE_RESULT: + Val32 = pAC->Pnmi.TestResult; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_SENSOR_NUMBER: + *pBuf = (char)pAC->I2c.MaxSens; + *pLen = sizeof(char); + break; + + case OID_SKGE_CHKSM_NUMBER: + *pBuf = SKCS_NUM_PROTOCOLS; + *pLen = sizeof(char); + break; + + case OID_SKGE_TRAP_NUMBER: + GetTrapQueueLen(pAC, &Len, &Val); + Val32 = (SK_U32)Val; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_TRAP: + GetTrapQueueLen(pAC, &Len, &Val); + if (*pLen < Len) { + + *pLen = Len; + return (SK_PNMI_ERR_TOO_SHORT); + } + CopyTrapQueue(pAC, pBuf); + *pLen = Len; + break; + + case OID_SKGE_RLMT_MONITOR_NUMBER: +/* XXX Not yet implemented by RLMT therefore we return zero elements */ + Val32 = 0; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_TX_SW_QUEUE_LEN: + Val64 = pAC->Pnmi.TxSwQueueLen; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_TX_SW_QUEUE_MAX: + Val64 = pAC->Pnmi.TxSwQueueMax; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_TX_RETRY: + Val64 = pAC->Pnmi.TxRetryCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RX_INTR_CTS: + Val64 = pAC->Pnmi.RxIntrCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_TX_INTR_CTS: + Val64 = pAC->Pnmi.TxIntrCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RX_NO_BUF_CTS: + Val64 = pAC->Pnmi.RxNoBufCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_TX_NO_BUF_CTS: + Val64 = pAC->Pnmi.TxNoBufCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_TX_USED_DESCR_NO: + Val64 = pAC->Pnmi.TxUsedDescrNo; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RX_DELIVERED_CTS: + Val64 = pAC->Pnmi.RxDeliveredCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RX_OCTETS_DELIV_CTS: + Val64 = pAC->Pnmi.RxOctetsDeliveredCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RX_HW_ERROR_CTS: + SK_PNMI_STORE_U64(pBuf, Val64RxHwErrs); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_TX_HW_ERROR_CTS: + SK_PNMI_STORE_U64(pBuf, Val64TxHwErrs); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_IN_ERRORS_CTS: + Val64 = Val64RxHwErrs + pAC->Pnmi.RxNoBufCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_OUT_ERROR_CTS: + Val64 = Val64TxHwErrs + pAC->Pnmi.TxNoBufCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_ERR_RECOVERY_CTS: + Val64 = pAC->Pnmi.ErrRecoveryCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_SYSUPTIME: + Val64 = SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC)); + Val64 -= pAC->Pnmi.StartUpTime; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_MDB_VERSION: + Val32 = SK_PNMI_MDB_VERSION; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_GEN_RCV_ERROR: + Val32 = (SK_U32)(Val64RxHwErrs + pAC->Pnmi.RxNoBufCts); + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_GEN_XMIT_ERROR: + Val32 = (SK_U32)(Val64TxHwErrs + pAC->Pnmi.TxNoBufCts); + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_GEN_RCV_NO_BUFFER: + Val32 = (SK_U32)pAC->Pnmi.RxNoBufCts; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_GEN_TRANSMIT_QUEUE_LENGTH: + Val32 = (SK_U32)pAC->Pnmi.TxSwQueueLen; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR034, + SK_PNMI_ERR034MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + if (Id == OID_SKGE_RX_HW_ERROR_CTS || + Id == OID_SKGE_TX_HW_ERROR_CTS || + Id == OID_SKGE_IN_ERRORS_CTS || + Id == OID_SKGE_OUT_ERROR_CTS || + Id == OID_GEN_XMIT_ERROR || + Id == OID_GEN_RCV_ERROR) { + + pAC->Pnmi.MacUpdatedFlag --; + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * Rlmt - OID handler function of OID_SKGE_RLMT_XXX single instance. + * + * Description: + * Get/Presets/Sets the RLMT OIDs. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int Rlmt( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + int Ret; + unsigned int PhysPortIndex; + unsigned int PhysPortMax; + SK_EVPARA EventParam; + SK_U32 Val32; + SK_U64 Val64; + + + /* + * Check instance. Only single instance OIDs are allowed here. + */ + if (Instance != (SK_U32)(-1) && Instance != 1) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + /* + * Perform the requested action + */ + if (Action == SK_PNMI_GET) { + + /* + * Check if the buffer length is large enough. + */ + + switch (Id) { + + case OID_SKGE_RLMT_MODE: + case OID_SKGE_RLMT_PORT_ACTIVE: + case OID_SKGE_RLMT_PORT_PREFERED: + if (*pLen < sizeof(SK_U8)) { + + *pLen = sizeof(SK_U8); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_RLMT_PORT_NUMBER: + if (*pLen < sizeof(SK_U32)) { + + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_RLMT_CHANGE_CTS: + case OID_SKGE_RLMT_CHANGE_TIME: + case OID_SKGE_RLMT_CHANGE_ESTIM: + case OID_SKGE_RLMT_CHANGE_THRES: + if (*pLen < sizeof(SK_U64)) { + + *pLen = sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR035, + SK_PNMI_ERR035MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + /* + * Update RLMT statistic and increment semaphores to indicate + * that an update was already done. Maybe RLMT will hold its + * statistic always up to date some time. Then we can + * remove this type of call. + */ + if ((Ret = RlmtUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + pAC->Pnmi.RlmtUpdatedFlag ++; + + /* + * Retrieve Value + */ + switch (Id) { + + case OID_SKGE_RLMT_MODE: + *pBuf = (char)pAC->Rlmt.RlmtMode; + *pLen = sizeof(char); + break; + + case OID_SKGE_RLMT_PORT_NUMBER: + Val32 = (SK_U32)pAC->GIni.GIMacsFound; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + break; + + case OID_SKGE_RLMT_PORT_ACTIVE: + *pBuf = 0; + /* + * If multiple ports may become active this OID + * doesn't make sense any more. A new variable in + * the port structure should be created. However, + * for this variable the first active port is + * returned. + */ + PhysPortMax = pAC->GIni.GIMacsFound; + + for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + if (pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) { + + *pBuf = (char)SK_PNMI_PORT_PHYS2LOG( + PhysPortIndex); + break; + } + } + *pLen = sizeof(char); + break; + + case OID_SKGE_RLMT_PORT_PREFERED: + *pBuf = (char)SK_PNMI_PORT_PHYS2LOG( + pAC->Rlmt.MacPreferred); + *pLen = sizeof(char); + break; + + case OID_SKGE_RLMT_CHANGE_CTS: + Val64 = pAC->Pnmi.RlmtChangeCts; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RLMT_CHANGE_TIME: + Val64 = pAC->Pnmi.RlmtChangeTime; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RLMT_CHANGE_ESTIM: + Val64 = pAC->Pnmi.RlmtChangeEstimate.Estimate; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + case OID_SKGE_RLMT_CHANGE_THRES: + Val64 = pAC->Pnmi.RlmtChangeThreshold; + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR036, + SK_PNMI_ERR036MSG); + + pAC->Pnmi.RlmtUpdatedFlag --; + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + pAC->Pnmi.RlmtUpdatedFlag --; + } + else { + /* Perform a preset or set */ + switch (Id) { + + case OID_SKGE_RLMT_MODE: + /* Check if the buffer length is plausible */ + if (*pLen < sizeof(char)) { + + *pLen = sizeof(char); + return (SK_PNMI_ERR_TOO_SHORT); + } + /* Check if the value range is correct */ + if (*pLen != sizeof(char) || + (*pBuf & SK_PNMI_RLMT_MODE_CHK_LINK) == 0 || + *(SK_U8 *)pBuf > 15) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + /* The preset ends here */ + if (Action == SK_PNMI_PRESET) { + + *pLen = 0; + return (SK_PNMI_ERR_OK); + } + /* Send an event to RLMT to change the mode */ + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + EventParam.Para32[0] |= (SK_U32)(*pBuf); + if (SkRlmtEvent(pAC, IoC, SK_RLMT_MODE_CHANGE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR037, + SK_PNMI_ERR037MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + break; + + case OID_SKGE_RLMT_PORT_PREFERED: + /* Check if the buffer length is plausible */ + if (*pLen < sizeof(char)) { + + *pLen = sizeof(char); + return (SK_PNMI_ERR_TOO_SHORT); + } + /* Check if the value range is correct */ + if (*pLen != sizeof(char) || *(SK_U8 *)pBuf > + (SK_U8)pAC->GIni.GIMacsFound) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + /* The preset ends here */ + if (Action == SK_PNMI_PRESET) { + + *pLen = 0; + return (SK_PNMI_ERR_OK); + } + + /* + * Send an event to RLMT change the preferred port. + * A param of -1 means automatic mode. RLMT will + * make the decision which is the preferred port. + */ + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + EventParam.Para32[0] = (SK_U32)(*pBuf) - 1; + if (SkRlmtEvent(pAC, IoC, SK_RLMT_PREFPORT_CHANGE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR038, + SK_PNMI_ERR038MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + break; + + case OID_SKGE_RLMT_CHANGE_THRES: + /* Check if the buffer length is plausible */ + if (*pLen < sizeof(SK_U64)) { + + *pLen = sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + /* + * There are not many restrictions to the + * value range. + */ + if (*pLen != sizeof(SK_U64)) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + /* A preset ends here */ + if (Action == SK_PNMI_PRESET) { + + *pLen = 0; + return (SK_PNMI_ERR_OK); + } + /* + * Store the new threshold, which will be taken + * on the next timer event. + */ + SK_PNMI_READ_U64(pBuf, Val64); + pAC->Pnmi.RlmtChangeThreshold = Val64; + break; + + default: + /* The other OIDs are not be able for set */ + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * RlmtStat - OID handler function of OID_SKGE_RLMT_XXX multiple instance. + * + * Description: + * Performs get requests on multiple instance variables. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int RlmtStat( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + unsigned int PhysPortMax; + unsigned int PhysPortIndex; + unsigned int Limit; + unsigned int Offset; + int Ret; + SK_U32 Val32; + SK_U64 Val64; + + + /* + * Calculate the port indexes from the instance + */ + PhysPortMax = pAC->GIni.GIMacsFound; + + if ((Instance != (SK_U32)(-1))) { + + if ((Instance < 1) || (Instance > PhysPortMax)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + PhysPortIndex = Instance - 1; + Limit = PhysPortIndex + 1; + } + else { + PhysPortIndex = 0; + Limit = PhysPortMax; + } + + /* + * Currently only get requests are allowed. + */ + if (Action != SK_PNMI_GET) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Check if the buffer length is large enough. + */ + switch (Id) { + + case OID_SKGE_RLMT_PORT_INDEX: + case OID_SKGE_RLMT_STATUS: + if (*pLen < (Limit - PhysPortIndex) * sizeof(SK_U32)) { + + *pLen = (Limit - PhysPortIndex) * sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + case OID_SKGE_RLMT_TX_HELLO_CTS: + case OID_SKGE_RLMT_RX_HELLO_CTS: + case OID_SKGE_RLMT_TX_SP_REQ_CTS: + case OID_SKGE_RLMT_RX_SP_CTS: + if (*pLen < (Limit - PhysPortIndex) * sizeof(SK_U64)) { + + *pLen = (Limit - PhysPortIndex) * sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR039, + SK_PNMI_ERR039MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + + } + + /* + * Update statistic and increment semaphores to indicate that + * an update was already done. + */ + if ((Ret = RlmtUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + pAC->Pnmi.RlmtUpdatedFlag ++; + + /* + * Get value + */ + Offset = 0; + for (; PhysPortIndex < Limit; PhysPortIndex ++) { + + switch (Id) { + + case OID_SKGE_RLMT_PORT_INDEX: + Val32 = PhysPortIndex; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_RLMT_STATUS: + if (pAC->Rlmt.Port[PhysPortIndex].PortState == + SK_RLMT_PS_INIT || + pAC->Rlmt.Port[PhysPortIndex].PortState == + SK_RLMT_PS_DOWN) { + + Val32 = SK_PNMI_RLMT_STATUS_ERROR; + } + else if (pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) { + + Val32 = SK_PNMI_RLMT_STATUS_ACTIVE; + } + else { + Val32 = SK_PNMI_RLMT_STATUS_STANDBY; + } + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + Offset += sizeof(SK_U32); + break; + + case OID_SKGE_RLMT_TX_HELLO_CTS: + Val64 = pAC->Rlmt.Port[PhysPortIndex].TxHelloCts; + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + case OID_SKGE_RLMT_RX_HELLO_CTS: + Val64 = pAC->Rlmt.Port[PhysPortIndex].RxHelloCts; + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + case OID_SKGE_RLMT_TX_SP_REQ_CTS: + Val64 = pAC->Rlmt.Port[PhysPortIndex].TxSpHelloReqCts; + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + case OID_SKGE_RLMT_RX_SP_CTS: + Val64 = pAC->Rlmt.Port[PhysPortIndex].RxSpHelloCts; + SK_PNMI_STORE_U64(pBuf + Offset, Val64); + Offset += sizeof(SK_U64); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR040, + SK_PNMI_ERR040MSG); + + pAC->Pnmi.RlmtUpdatedFlag --; + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + *pLen = Offset; + + pAC->Pnmi.RlmtUpdatedFlag --; + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * MacPrivateConf - OID handler function of OIDs concerning the configuration + * + * Description: + * Get/Presets/Sets the OIDs concerning the configuration. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int MacPrivateConf( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + unsigned int PhysPortMax; + unsigned int PhysPortIndex; + unsigned int LogPortMax; + unsigned int LogPortIndex; + unsigned int Limit; + unsigned int Offset; + char Val8; + int Ret; + SK_EVPARA EventParam; + + + /* + * Calculate instance if wished. MAC index 0 is the virtual + * MAC. + */ + PhysPortMax = pAC->GIni.GIMacsFound; + LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax); + + if ((Instance != (SK_U32)(-1))) { + + if ((Instance < 1) || (Instance > LogPortMax)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + LogPortIndex = SK_PNMI_PORT_INST2LOG(Instance); + Limit = LogPortIndex + 1; + } + else { + LogPortIndex = 0; + Limit = LogPortMax; + } + + /* + * Perform action + */ + if (Action == SK_PNMI_GET) { + + /* + * Check length + */ + switch (Id) { + + case OID_SKGE_PMD: + case OID_SKGE_CONNECTOR: + case OID_SKGE_LINK_CAP: + case OID_SKGE_LINK_MODE: + case OID_SKGE_LINK_MODE_STATUS: + case OID_SKGE_LINK_STATUS: + case OID_SKGE_FLOWCTRL_CAP: + case OID_SKGE_FLOWCTRL_MODE: + case OID_SKGE_FLOWCTRL_STATUS: + case OID_SKGE_PHY_OPERATION_CAP: + case OID_SKGE_PHY_OPERATION_MODE: + case OID_SKGE_PHY_OPERATION_STATUS: + if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U8)) { + + *pLen = (Limit - LogPortIndex) * + sizeof(SK_U8); + return (SK_PNMI_ERR_TOO_SHORT); + } + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR041, + SK_PNMI_ERR041MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + + /* + * Update statistic and increment semaphore to indicate + * that an update was already done. + */ + if ((Ret = SirqUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) { + + *pLen = 0; + return (Ret); + } + pAC->Pnmi.SirqUpdatedFlag ++; + + /* + * Get value + */ + Offset = 0; + for (; LogPortIndex < Limit; LogPortIndex ++) { + + switch (Id) { + + case OID_SKGE_PMD: + *(pBuf + Offset) = pAC->Pnmi.PMD; + Offset += sizeof(char); + break; + + case OID_SKGE_CONNECTOR: + *(pBuf + Offset) = pAC->Pnmi.Connector; + Offset += sizeof(char); + break; + + case OID_SKGE_LINK_CAP: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical ports */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PLinkCap; + } + Offset += sizeof(char); + break; + + case OID_SKGE_LINK_MODE: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical ports */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PLinkModeConf; + } + + Offset += sizeof(char); + break; + + case OID_SKGE_LINK_MODE_STATUS: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical port */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = + CalculateLinkModeStatus(pAC, + IoC, PhysPortIndex); + } + Offset += sizeof(char); + break; + + case OID_SKGE_LINK_STATUS: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical ports */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = + CalculateLinkStatus(pAC, + IoC, PhysPortIndex); + } + Offset += sizeof(char); + break; + + case OID_SKGE_FLOWCTRL_CAP: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical ports */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PFlowCtrlCap; + } + Offset += sizeof(char); + break; + + case OID_SKGE_FLOWCTRL_MODE: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical port */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PFlowCtrlMode; + } + Offset += sizeof(char); + break; + + case OID_SKGE_FLOWCTRL_STATUS: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical port */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PFlowCtrlStatus; + } + Offset += sizeof(char); + break; + + case OID_SKGE_PHY_OPERATION_CAP: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical ports */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PMSCap; + } + Offset += sizeof(char); + break; + + case OID_SKGE_PHY_OPERATION_MODE: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical port */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PMSMode; + } + Offset += sizeof(char); + break; + + case OID_SKGE_PHY_OPERATION_STATUS: + if (LogPortIndex == 0) { + + /* Get value for virtual port */ + VirtualConf(pAC, IoC, Id, pBuf + + Offset); + } + else { + /* Get value for physical port */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + + *(pBuf + Offset) = pAC->GIni.GP[ + PhysPortIndex].PMSStatus; + } + Offset += sizeof(char); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR042, + SK_PNMI_ERR042MSG); + + pAC->Pnmi.SirqUpdatedFlag --; + return (SK_PNMI_ERR_GENERAL); + } + } + *pLen = Offset; + pAC->Pnmi.SirqUpdatedFlag --; + + return (SK_PNMI_ERR_OK); + } + + /* + * From here SET or PRESET action. Check if the passed + * buffer length is plausible. + */ + switch (Id) { + + case OID_SKGE_LINK_MODE: + case OID_SKGE_FLOWCTRL_MODE: + if (*pLen < Limit - LogPortIndex) { + + *pLen = Limit - LogPortIndex; + return (SK_PNMI_ERR_TOO_SHORT); + } + if (*pLen != Limit - LogPortIndex) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + break; + + default: + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* + * Perform preset or set + */ + Offset = 0; + for (; LogPortIndex < Limit; LogPortIndex ++) { + + switch (Id) { + + case OID_SKGE_LINK_MODE: + /* Check the value range */ + Val8 = *(pBuf + Offset); + if (Val8 == 0) { + + Offset += sizeof(char); + break; + } + if (Val8 < SK_LMODE_HALF || + Val8 > SK_LMODE_AUTOSENSE) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* The preset ends here */ + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + if (LogPortIndex == 0) { + + /* + * The virtual port consists of all currently + * active ports. Find them and send an event + * with the new link mode to SIRQ. + */ + for (PhysPortIndex = 0; + PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + if (!pAC->Pnmi.Port[PhysPortIndex]. + ActiveFlag) { + + continue; + } + + EventParam.Para32[0] = PhysPortIndex; + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_LMODE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR043, + SK_PNMI_ERR043MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + } + else { + /* + * Send an event with the new link mode to + * the SIRQ module. + */ + EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_LMODE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR043, + SK_PNMI_ERR043MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + Offset += sizeof(char); + break; + + case OID_SKGE_FLOWCTRL_MODE: + /* Check the value range */ + Val8 = *(pBuf + Offset); + if (Val8 == 0) { + + Offset += sizeof(char); + break; + } + if (Val8 < SK_FLOW_MODE_NONE || + Val8 > SK_FLOW_MODE_SYM_OR_REM) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* The preset ends here */ + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + if (LogPortIndex == 0) { + + /* + * The virtual port consists of all currently + * active ports. Find them and send an event + * with the new flow control mode to SIRQ. + */ + for (PhysPortIndex = 0; + PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + if (!pAC->Pnmi.Port[PhysPortIndex]. + ActiveFlag) { + + continue; + } + + EventParam.Para32[0] = PhysPortIndex; + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_FLOWMODE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR044, + SK_PNMI_ERR044MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + } + else { + /* + * Send an event with the new flow control + * mode to the SIRQ module. + */ + EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_FLOWMODE, EventParam) + > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR044, + SK_PNMI_ERR044MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + Offset += sizeof(char); + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR045, + SK_PNMI_ERR045MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * Monitor - OID handler function for RLMT_MONITOR_XXX + * + * Description: + * Because RLMT currently does not support the monitoring of + * remote adapter cards, we return always an empty table. + * + * Returns: + * SK_PNMI_ERR_OK The request was successfully performed. + * SK_PNMI_ERR_GENERAL A general severe internal error occured. + * SK_PNMI_ERR_TOO_SHORT The passed buffer is too short to contain + * the correct data (e.g. a 32bit value is + * needed, but a 16 bit value was passed). + * SK_PNMI_ERR_BAD_VALUE The passed value is not in the valid + * value range. + * SK_PNMI_ERR_READ_ONLY The OID is read-only and cannot be set. + * SK_PNMI_ERR_UNKNOWN_INST The requested instance of the OID doesn't + * exist (e.g. port instance 3 on a two port + * adapter. + */ + +static int Monitor( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +int Action, /* Get/PreSet/Set action */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf, /* Buffer to which to mgmt data will be retrieved */ +unsigned int *pLen, /* On call: buffer length. On return: used buffer */ +SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ +unsigned int TableIndex) /* Index to the Id table */ +{ + unsigned int Index; + unsigned int Limit; + unsigned int Offset; + unsigned int Entries; + + + /* + * Calculate instance if wished. + */ +/* XXX Not yet implemented. Return always an empty table. */ + Entries = 0; + + if ((Instance != (SK_U32)(-1))) { + + if ((Instance < 1) || (Instance > Entries)) { + + *pLen = 0; + return (SK_PNMI_ERR_UNKNOWN_INST); + } + + Index = (unsigned int)Instance - 1; + Limit = (unsigned int)Instance; + } + else { + Index = 0; + Limit = Entries; + } + + /* + * Get/Set value + */ + if (Action == SK_PNMI_GET) { + + for (Offset=0; Index < Limit; Index ++) { + + switch (Id) { + + case OID_SKGE_RLMT_MONITOR_INDEX: + case OID_SKGE_RLMT_MONITOR_ADDR: + case OID_SKGE_RLMT_MONITOR_ERRS: + case OID_SKGE_RLMT_MONITOR_TIMESTAMP: + case OID_SKGE_RLMT_MONITOR_ADMIN: + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR046, + SK_PNMI_ERR046MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + *pLen = Offset; + } + else { + /* Only MONITOR_ADMIN can be set */ + if (Id != OID_SKGE_RLMT_MONITOR_ADMIN) { + + *pLen = 0; + return (SK_PNMI_ERR_READ_ONLY); + } + + /* Check if the length is plausible */ + if (*pLen < (Limit - Index)) { + + return (SK_PNMI_ERR_TOO_SHORT); + } + /* Okay, we have a wide value range */ + if (*pLen != (Limit - Index)) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } +/* + for (Offset=0; Index < Limit; Index ++) { + } +*/ +/* + * XXX Not yet implemented. Return always BAD_VALUE, because the table + * is empty. + */ + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * VirtualConf - Calculates the values of configuration OIDs for virtual port + * + * Description: + * We handle here the get of the configuration group OIDs, which are + * a little bit complicated. The virtual port consists of all currently + * active physical ports. If multiple ports are active and configured + * differently we get in some trouble to return a single value. So we + * get the value of the first active port and compare it with that of + * the other active ports. If they are not the same, we return a value + * that indicates that the state is indeterminated. + * + * Returns: + * Nothing + */ + +static void VirtualConf( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +SK_U32 Id, /* Object ID that is to be processed */ +char *pBuf) /* Buffer to which to mgmt data will be retrieved */ +{ + unsigned int PhysPortMax; + unsigned int PhysPortIndex; + SK_U8 Val8; + SK_BOOL PortActiveFlag; + + + *pBuf = 0; + PortActiveFlag = SK_FALSE; + PhysPortMax = pAC->GIni.GIMacsFound; + + for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + /* Check if the physical port is active */ + if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) { + + continue; + } + + PortActiveFlag = SK_TRUE; + + switch (Id) { + + case OID_SKGE_LINK_CAP: + + /* + * Different capabilities should not happen, but + * in the case of the cases OR them all together. + * From a curious point of view the virtual port + * is capable of all found capabilities. + */ + *pBuf |= pAC->GIni.GP[PhysPortIndex].PLinkCap; + break; + + case OID_SKGE_LINK_MODE: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PLinkModeConf; + continue; + } + + /* + * If we find an active port with a different link + * mode than the first one we return a value that + * indicates that the link mode is indeterminated. + */ + if (*pBuf != pAC->GIni.GP[PhysPortIndex].PLinkModeConf + ) { + + *pBuf = SK_LMODE_INDETERMINATED; + } + break; + + case OID_SKGE_LINK_MODE_STATUS: + /* Get the link mode of the physical port */ + Val8 = CalculateLinkModeStatus(pAC, IoC, + PhysPortIndex); + + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = Val8; + continue; + } + + /* + * If we find an active port with a different link + * mode status than the first one we return a value + * that indicates that the link mode status is + * indeterminated. + */ + if (*pBuf != Val8) { + + *pBuf = SK_LMODE_STAT_INDETERMINATED; + } + break; + + case OID_SKGE_LINK_STATUS: + /* Get the link status of the physical port */ + Val8 = CalculateLinkStatus(pAC, IoC, PhysPortIndex); + + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = Val8; + continue; + } + + /* + * If we find an active port with a different link + * status than the first one, we return a value + * that indicates that the link status is + * indeterminated. + */ + if (*pBuf != Val8) { + + *pBuf = SK_PNMI_RLMT_LSTAT_INDETERMINATED; + } + break; + + case OID_SKGE_FLOWCTRL_CAP: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PFlowCtrlCap; + continue; + } + + /* + * From a curious point of view the virtual port + * is capable of all found capabilities. + */ + *pBuf |= pAC->GIni.GP[PhysPortIndex].PFlowCtrlCap; + break; + + case OID_SKGE_FLOWCTRL_MODE: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PFlowCtrlMode; + continue; + } + + /* + * If we find an active port with a different flow + * control mode than the first one, we return a value + * that indicates that the mode is indeterminated. + */ + if (*pBuf != pAC->GIni.GP[PhysPortIndex]. + PFlowCtrlMode) { + + *pBuf = SK_FLOW_MODE_INDETERMINATED; + } + break; + + case OID_SKGE_FLOWCTRL_STATUS: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PFlowCtrlStatus; + continue; + } + + /* + * If we find an active port with a different flow + * control status than the first one, we return a + * value that indicates that the status is + * indeterminated. + */ + if (*pBuf != pAC->GIni.GP[PhysPortIndex]. + PFlowCtrlStatus) { + + *pBuf = SK_FLOW_STAT_INDETERMINATED; + } + break; + case OID_SKGE_PHY_OPERATION_CAP: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PMSCap; + continue; + } + + /* + * From a curious point of view the virtual port + * is capable of all found capabilities. + */ + *pBuf |= pAC->GIni.GP[PhysPortIndex].PMSCap; + break; + + case OID_SKGE_PHY_OPERATION_MODE: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PMSMode; + continue; + } + + /* + * If we find an active port with a different master/ + * slave mode than the first one, we return a value + * that indicates that the mode is indeterminated. + */ + if (*pBuf != pAC->GIni.GP[PhysPortIndex]. + PMSMode) { + + *pBuf = SK_MS_MODE_INDETERMINATED; + } + break; + + case OID_SKGE_PHY_OPERATION_STATUS: + /* Check if it is the first active port */ + if (*pBuf == 0) { + + *pBuf = pAC->GIni.GP[PhysPortIndex]. + PMSStatus; + continue; + } + + /* + * If we find an active port with a different master/ + * slave status than the first one, we return a + * value that indicates that the status is + * indeterminated. + */ + if (*pBuf != pAC->GIni.GP[PhysPortIndex]. + PMSStatus) { + + *pBuf = SK_MS_STAT_INDETERMINATED; + } + break; + } + } + + /* + * If no port is active return an indeterminated answer + */ + if (!PortActiveFlag) { + + switch (Id) { + + case OID_SKGE_LINK_CAP: + *pBuf = SK_LMODE_CAP_INDETERMINATED; + break; + + case OID_SKGE_LINK_MODE: + *pBuf = SK_LMODE_INDETERMINATED; + break; + + case OID_SKGE_LINK_MODE_STATUS: + *pBuf = SK_LMODE_STAT_INDETERMINATED; + break; + + case OID_SKGE_LINK_STATUS: + *pBuf = SK_PNMI_RLMT_LSTAT_INDETERMINATED; + break; + + case OID_SKGE_FLOWCTRL_CAP: + case OID_SKGE_FLOWCTRL_MODE: + *pBuf = SK_FLOW_MODE_INDETERMINATED; + break; + + case OID_SKGE_FLOWCTRL_STATUS: + *pBuf = SK_FLOW_STAT_INDETERMINATED; + break; + + case OID_SKGE_PHY_OPERATION_CAP: + *pBuf = SK_MS_CAP_INDETERMINATED; + break; + + case OID_SKGE_PHY_OPERATION_MODE: + *pBuf = SK_MS_MODE_INDETERMINATED; + break; + + case OID_SKGE_PHY_OPERATION_STATUS: + *pBuf = SK_MS_STAT_INDETERMINATED; + break; + } + } +} + +/***************************************************************************** + * + * CalculateLinkStatus - Determins the link status of a physical port + * + * Description: + * Determins the link status the following way: + * LSTAT_PHY_DOWN: Link is down + * LSTAT_AUTONEG: Auto-negotiation failed + * LSTAT_LOG_DOWN: Link is up but RLMT did not yet put the port + * logically up. + * LSTAT_LOG_UP: RLMT marked the port as up + * + * Returns: + * Link status of physical port + */ + +static SK_U8 CalculateLinkStatus( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +unsigned int PhysPortIndex) /* Physical port index */ +{ + SK_U8 Result; + + + if (!pAC->GIni.GP[PhysPortIndex].PHWLinkUp) { + + Result = SK_PNMI_RLMT_LSTAT_PHY_DOWN; + } + else if (pAC->GIni.GP[PhysPortIndex].PAutoNegFail > 0) { + + Result = SK_PNMI_RLMT_LSTAT_AUTONEG; + } + else if (!pAC->Rlmt.Port[PhysPortIndex].PortDown) { + + Result = SK_PNMI_RLMT_LSTAT_LOG_UP; + } + else { + Result = SK_PNMI_RLMT_LSTAT_LOG_DOWN; + } + + return (Result); +} + +/***************************************************************************** + * + * CalculateLinkModeStatus - Determins the link mode status of a phys. port + * + * Description: + * The COMMON module only tells us if the mode is half or full duplex. + * But in the decade of auto sensing it is usefull for the user to + * know if the mode was negotiated or forced. Therefore we have a + * look to the mode, which was last used by the negotiation process. + * + * Returns: + * The link mode status + */ + +static SK_U8 CalculateLinkModeStatus( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +unsigned int PhysPortIndex) /* Physical port index */ +{ + SK_U8 Result; + + + /* Get the current mode, which can be full or half duplex */ + Result = pAC->GIni.GP[PhysPortIndex].PLinkModeStatus; + + /* Check if no valid mode could be found (link is down) */ + if (Result < SK_LMODE_STAT_HALF) { + + Result = SK_LMODE_STAT_UNKNOWN; + } + else if (pAC->GIni.GP[PhysPortIndex].PLinkMode >= SK_LMODE_AUTOHALF) { + + /* + * Auto-negotiation was used to bring up the link. Change + * the already found duplex status that it indicates + * auto-negotiation was involved. + */ + if (Result == SK_LMODE_STAT_HALF) { + + Result = SK_LMODE_STAT_AUTOHALF; + } + else if (Result == SK_LMODE_STAT_FULL) { + + Result = SK_LMODE_STAT_AUTOFULL; + } + } + + return (Result); +} + +/***************************************************************************** + * + * GetVpdKeyArr - Obtain an array of VPD keys + * + * Description: + * Read the VPD keys and build an array of VPD keys, which are + * easy to access. + * + * Returns: + * SK_PNMI_ERR_OK Task successfully performed. + * SK_PNMI_ERR_GENERAL Something went wrong. + */ + +static int GetVpdKeyArr( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +char *pKeyArr, /* Ptr KeyArray */ +unsigned int KeyArrLen, /* Length of array in bytes */ +unsigned int *pKeyNo) /* Number of keys */ +{ + unsigned int BufKeysLen = 128; + char BufKeys[128]; + unsigned int StartOffset; + unsigned int Offset; + int Index; + int Ret; + + + SK_MEMSET(pKeyArr, 0, KeyArrLen); + + /* + * Get VPD key list + */ + Ret = VpdKeys(pAC, IoC, (char *)&BufKeys, (int *)&BufKeysLen, + (int *)pKeyNo); + if (Ret > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR014, + SK_PNMI_ERR014MSG); + + return (SK_PNMI_ERR_GENERAL); + } + /* If no keys are available return now */ + if (*pKeyNo == 0 || BufKeysLen == 0) { + + return (SK_PNMI_ERR_OK); + } + /* + * If the key list is too long for us trunc it and give a + * errorlog notification. This case should not happen because + * the maximum number of keys is limited due to RAM limitations + */ + if (*pKeyNo > SK_PNMI_VPD_ARR_SIZE) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR015, + SK_PNMI_ERR015MSG); + + *pKeyNo = SK_PNMI_VPD_ARR_SIZE; + } + + /* + * Now build an array of fixed string length size and copy + * the keys together. + */ + for (Index = 0, StartOffset = 0, Offset = 0; Offset < BufKeysLen; + Offset ++) { + + if (BufKeys[Offset] != 0) { + + continue; + } + + if (Offset - StartOffset > SK_PNMI_VPD_STR_SIZE) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR016, + SK_PNMI_ERR016MSG); + return (SK_PNMI_ERR_GENERAL); + } + + SK_STRNCPY(pKeyArr + Index * SK_PNMI_VPD_STR_SIZE, + &BufKeys[StartOffset], SK_PNMI_VPD_STR_SIZE); + + Index ++; + StartOffset = Offset + 1; + } + + /* Last key not zero terminated? Get it anyway */ + if (StartOffset < Offset) { + + SK_STRNCPY(pKeyArr + Index * SK_PNMI_VPD_STR_SIZE, + &BufKeys[StartOffset], SK_PNMI_VPD_STR_SIZE); + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * SirqUpdate - Let the SIRQ update its internal values + * + * Description: + * Just to be sure that the SIRQ module holds its internal data + * structures up to date, we send an update event before we make + * any access. + * + * Returns: + * SK_PNMI_ERR_OK Task successfully performed. + * SK_PNMI_ERR_GENERAL Something went wrong. + */ + +static int SirqUpdate( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC) /* IO context handle */ +{ + SK_EVPARA EventParam; + + + /* Was the module already updated during the current PNMI call? */ + if (pAC->Pnmi.SirqUpdatedFlag > 0) { + + return (SK_PNMI_ERR_OK); + } + + /* Send an synchronuous update event to the module */ + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + if (SkGeSirqEvent(pAC, IoC, SK_HWEV_UPDATE_STAT, EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR047, + SK_PNMI_ERR047MSG); + + return (SK_PNMI_ERR_GENERAL); + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * RlmtUpdate - Let the RLMT update its internal values + * + * Description: + * Just to be sure that the RLMT module holds its internal data + * structures up to date, we send an update event before we make + * any access. + * + * Returns: + * SK_PNMI_ERR_OK Task successfully performed. + * SK_PNMI_ERR_GENERAL Something went wrong. + */ + +static int RlmtUpdate( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC) /* IO context handle */ +{ + SK_EVPARA EventParam; + + + /* Was the module already updated during the current PNMI call? */ + if (pAC->Pnmi.RlmtUpdatedFlag > 0) { + + return (SK_PNMI_ERR_OK); + } + + /* Send an synchronuous update event to the module */ + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + if (SkRlmtEvent(pAC, IoC, SK_RLMT_STATS_UPDATE, EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR048, + SK_PNMI_ERR048MSG); + + return (SK_PNMI_ERR_GENERAL); + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * MacUpdate - Force the XMAC to output the current statistic + * + * Description: + * The XMAC holds its statistic internally. To obtain the current + * values we must send a command so that the statistic data will + * be written to a predefined memory area on the adapter. + * + * Returns: + * SK_PNMI_ERR_OK Task successfully performed. + * SK_PNMI_ERR_GENERAL Something went wrong. + */ + +static int MacUpdate( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +unsigned int FirstMac, /* Index of the first Mac to be updated */ +unsigned int LastMac) /* Index of the last Mac to be updated */ +{ + unsigned int MacIndex; + SK_U16 StatReg; + unsigned int WaitIndex; + + + /* + * Were the statistics already updated during the + * current PNMI call? + */ + if (pAC->Pnmi.MacUpdatedFlag > 0) { + + return (SK_PNMI_ERR_OK); + } + + /* Send an update command to all XMACs specified */ + for (MacIndex = FirstMac; MacIndex <= LastMac; MacIndex ++) { + + StatReg = XM_SC_SNP_TXC | XM_SC_SNP_RXC; + XM_OUT16(IoC, MacIndex, XM_STAT_CMD, StatReg); + + /* + * It is an auto-clearing register. If the command bits + * went to zero again, the statistics are transfered. + * Normally the command should be executed immediately. + * But just to be sure we execute a loop. + */ + for (WaitIndex = 0; WaitIndex < 10; WaitIndex ++) { + + XM_IN16(IoC, MacIndex, XM_STAT_CMD, &StatReg); + if ((StatReg & (XM_SC_SNP_TXC | XM_SC_SNP_RXC)) == + 0) { + + break; + } + } + if (WaitIndex == 10 ) { + + SK_ERR_LOG(pAC, SK_ERRCL_HW, SK_PNMI_ERR050, + SK_PNMI_ERR050MSG); + + return (SK_PNMI_ERR_GENERAL); + } + } + + return (SK_PNMI_ERR_OK); +} + +/***************************************************************************** + * + * GetStatVal - Retrieve an XMAC statistic counter + * + * Description: + * Retrieves the statistic counter of a virtual or physical port. The + * virtual port is identified by the index 0. It consists of all + * currently active ports. To obtain the counter value for this port + * we must add the statistic counter of all active ports. To grant + * continuous counter values for the virtual port even when port + * switches occur we must additionally add a delta value, which was + * calculated during a SK_PNMI_EVT_RLMT_ACTIVE_UP event. + * + * Returns: + * Requested statistic value + */ + +static SK_U64 GetStatVal( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +unsigned int LogPortIndex, /* Index of the logical Port to be processed */ +unsigned int StatIndex) /* Index to statistic value */ +{ + unsigned int PhysPortIndex; + unsigned int PhysPortMax; + SK_U64 Val = 0; + + + if (LogPortIndex == 0) { + + PhysPortMax = pAC->GIni.GIMacsFound; + + /* Add counter of all active ports */ + for (PhysPortIndex = 0; PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + if (pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) { + + Val += GetPhysStatVal(pAC, IoC, PhysPortIndex, + StatIndex); + } + } + + /* Correct value because of port switches */ + Val += pAC->Pnmi.VirtualCounterOffset[StatIndex]; + } + else { + /* Get counter value of physical port */ + PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex); + Val = GetPhysStatVal(pAC, IoC, PhysPortIndex, StatIndex); + } + + return (Val); +} + +/***************************************************************************** + * + * GetPhysStatVal - Get counter value for physical port + * + * Description: + * Builds a 64bit counter value. Except for the octet counters + * the lower 32bit are counted in hardware and the upper 32bit + * in software by monitoring counter overflow interrupts in the + * event handler. To grant continous counter values during XMAC + * resets (caused by a workaround) we must add a delta value. + * The delta was calculated in the event handler when a + * SK_PNMI_EVT_XMAC_RESET was received. + * + * Returns: + * Counter value + */ + +static SK_U64 GetPhysStatVal( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC, /* IO context handle */ +unsigned int PhysPortIndex, /* Index of the logical Port to be processed */ +unsigned int StatIndex) /* Index to statistic value */ +{ + SK_U64 Val = 0; + SK_U32 LowVal; + SK_U32 HighVal; + + + switch (StatIndex) { + + case SK_PNMI_HTX_OCTET: + XM_IN32(IoC, PhysPortIndex, XM_TXO_OK_LO, &LowVal); + XM_IN32(IoC, PhysPortIndex, XM_TXO_OK_HI, &HighVal); + break; + + case SK_PNMI_HRX_OCTET: + XM_IN32(IoC, PhysPortIndex, XM_RXO_OK_LO, &LowVal); + XM_IN32(IoC, PhysPortIndex, XM_RXO_OK_HI, &HighVal); + break; + + case SK_PNMI_HTX_OCTETLOW: + case SK_PNMI_HRX_OCTETLOW: + return (Val); + + case SK_PNMI_HTX_SYNC: + LowVal = (SK_U32)pAC->Pnmi.Port[PhysPortIndex].StatSyncCts; + HighVal = (SK_U32) + (pAC->Pnmi.Port[PhysPortIndex].StatSyncCts >> 32); + break; + + case SK_PNMI_HTX_SYNC_OCTET: + LowVal = (SK_U32)pAC->Pnmi.Port[PhysPortIndex]. + StatSyncOctetsCts; + HighVal = (SK_U32) + (pAC->Pnmi.Port[PhysPortIndex].StatSyncOctetsCts >> + 32); + break; + + case SK_PNMI_HRX_FCS: + /* + * Broadcom filters fcs errors and counts it in + * Receive Error Counter register + */ + if (pAC->GIni.GP[PhysPortIndex].PhyType == SK_PHY_BCOM) { + /* do not read while not initialized (PHY_READ hangs!)*/ + if (pAC->GIni.GP[PhysPortIndex].PState) { + PHY_READ(IoC, &pAC->GIni.GP[PhysPortIndex], + PhysPortIndex, PHY_BCOM_RE_CTR, + &LowVal); + } + else { + LowVal = 0; + } + HighVal = pAC->Pnmi.Port[PhysPortIndex].CounterHigh[StatIndex]; + } + else { + XM_IN32(IoC, PhysPortIndex, + StatAddress[StatIndex].Param, &LowVal); + HighVal = pAC->Pnmi.Port[PhysPortIndex].CounterHigh[StatIndex]; + } + default: + XM_IN32(IoC, PhysPortIndex, StatAddress[StatIndex].Param, + &LowVal); + HighVal = pAC->Pnmi.Port[PhysPortIndex].CounterHigh[StatIndex]; + break; + } + + Val = (((SK_U64)HighVal << 32) | (SK_U64)LowVal); + + /* Correct value because of possible XMAC reset. XMAC Errata #2 */ + Val += pAC->Pnmi.Port[PhysPortIndex].CounterOffset[StatIndex]; + + return (Val); +} + +/***************************************************************************** + * + * ResetCounter - Set all counters and timestamps to zero + * + * Description: + * Notifies other common modules which store statistic data to + * reset their counters and finally reset our own counters. + * + * Returns: + * Nothing + */ + +static void ResetCounter( +SK_AC *pAC, /* Pointer to adapter context */ +SK_IOC IoC) /* IO context handle */ +{ + unsigned int PhysPortIndex; + SK_EVPARA EventParam; + + + SK_MEMSET((char *)&EventParam, 0, sizeof(EventParam)); + + /* Notify sensor module */ + SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_CLEAR, EventParam); + + /* Notify RLMT module */ + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STATS_CLEAR, EventParam); + + /* Notify SIRQ module */ + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_CLEAR_STAT, EventParam); + + /* Notify CSUM module */ +#ifdef SK_USE_CSUM + EventParam.Para64 = (SK_U64)(-1); + SkEventQueue(pAC, SKGE_CSUM, SK_CSUM_EVENT_CLEAR_PROTO_STATS, + EventParam); +#endif + + /* Clear XMAC statistic */ + for (PhysPortIndex = 0; PhysPortIndex < + (unsigned int)pAC->GIni.GIMacsFound; PhysPortIndex ++) { + + XM_OUT16(IoC, PhysPortIndex, XM_STAT_CMD, + XM_SC_CLR_RXC | XM_SC_CLR_TXC); + /* Clear two times according to Errata #3 */ + XM_OUT16(IoC, PhysPortIndex, XM_STAT_CMD, + XM_SC_CLR_RXC | XM_SC_CLR_TXC); + + SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex].CounterHigh, + 0, sizeof(pAC->Pnmi.Port[PhysPortIndex].CounterHigh)); + SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex]. + CounterOffset, 0, sizeof(pAC->Pnmi.Port[ + PhysPortIndex].CounterOffset)); + SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex].StatSyncCts, + 0, sizeof(pAC->Pnmi.Port[PhysPortIndex].StatSyncCts)); + SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex]. + StatSyncOctetsCts, 0, sizeof(pAC->Pnmi.Port[ + PhysPortIndex].StatSyncOctetsCts)); + } + + /* + * Clear local statistics + */ + pAC->Pnmi.RlmtChangeCts = 0; + pAC->Pnmi.RlmtChangeTime = 0; + SK_MEMSET((char *)&pAC->Pnmi.RlmtChangeEstimate.EstValue[0], 0, + sizeof(pAC->Pnmi.RlmtChangeEstimate.EstValue)); + pAC->Pnmi.RlmtChangeEstimate.EstValueIndex = 0; + pAC->Pnmi.RlmtChangeEstimate.Estimate = 0; + pAC->Pnmi.TxSwQueueMax = 0; + pAC->Pnmi.TxRetryCts = 0; + pAC->Pnmi.RxIntrCts = 0; + pAC->Pnmi.TxIntrCts = 0; + pAC->Pnmi.RxNoBufCts = 0; + pAC->Pnmi.TxNoBufCts = 0; + pAC->Pnmi.TxUsedDescrNo = 0; + pAC->Pnmi.RxDeliveredCts = 0; + pAC->Pnmi.RxOctetsDeliveredCts = 0; + pAC->Pnmi.ErrRecoveryCts = 0; +} + +/***************************************************************************** + * + * GetTrapEntry - Get an entry in the trap buffer + * + * Description: + * The trap buffer stores various events. A user application somehow + * gets notified that an event occured and retrieves the trap buffer + * contens (or simply polls the buffer). The buffer is organized as + * a ring which stores the newest traps at the beginning. The oldest + * traps are overwritten by the newest ones. Each trap entry has a + * unique number, so that applications may detect new trap entries. + * + * Returns: + * A pointer to the trap entry + */ + +static char* GetTrapEntry( +SK_AC *pAC, /* Pointer to adapter context */ +SK_U32 TrapId, /* SNMP ID of the trap */ +unsigned int Size) /* Space needed for trap entry */ +{ + unsigned int BufPad = pAC->Pnmi.TrapBufPad; + unsigned int BufFree = pAC->Pnmi.TrapBufFree; + unsigned int Beg = pAC->Pnmi.TrapQueueBeg; + unsigned int End = pAC->Pnmi.TrapQueueEnd; + char *pBuf = &pAC->Pnmi.TrapBuf[0]; + int Wrap; + unsigned int NeededSpace; + unsigned int EntrySize; + SK_U32 Val32; + SK_U64 Val64; + + + /* Last byte of entry will get a copy of the entry length */ + Size ++; + + /* + * Calculate needed buffer space */ + if (Beg >= Size) { + + NeededSpace = Size; + Wrap = FALSE; + } + else { + NeededSpace = Beg + Size; + Wrap = TRUE; + } + + /* + * Check if enough buffer space is provided. Otherwise + * free some entries. Leave one byte space between begin + * and end of buffer to make it possible to detect whether + * the buffer is full or empty + */ + while (BufFree < NeededSpace + 1) { + + if (End == 0) { + + End = SK_PNMI_TRAP_QUEUE_LEN; + } + + EntrySize = (unsigned int)*((unsigned char *)pBuf + End - 1); + BufFree += EntrySize; + End -= EntrySize; +#ifdef DEBUG + SK_MEMSET(pBuf + End, (char)(-1), EntrySize); +#endif + if (End == BufPad) { +#ifdef DEBUG + SK_MEMSET(pBuf, (char)(-1), End); +#endif + BufFree += End; + End = 0; + BufPad = 0; + } + } + + /* + * Insert new entry as first entry. Newest entries are + * stored at the beginning of the queue. + */ + if (Wrap) { + + BufPad = Beg; + Beg = SK_PNMI_TRAP_QUEUE_LEN - Size; + } + else { + Beg = Beg - Size; + } + BufFree -= NeededSpace; + + /* Save the current offsets */ + pAC->Pnmi.TrapQueueBeg = Beg; + pAC->Pnmi.TrapQueueEnd = End; + pAC->Pnmi.TrapBufPad = BufPad; + pAC->Pnmi.TrapBufFree = BufFree; + + /* Initialize the trap entry */ + *(pBuf + Beg + Size - 1) = (char)Size; + *(pBuf + Beg) = (char)Size; + Val32 = (pAC->Pnmi.TrapUnique) ++; + SK_PNMI_STORE_U32(pBuf + Beg + 1, Val32); + SK_PNMI_STORE_U32(pBuf + Beg + 1 + sizeof(SK_U32), TrapId); + Val64 = SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC)); + SK_PNMI_STORE_U64(pBuf + Beg + 1 + 2 * sizeof(SK_U32), Val64); + + return (pBuf + Beg); +} + +/***************************************************************************** + * + * CopyTrapQueue - Copies the trap buffer for the TRAP OID + * + * Description: + * On a query of the TRAP OID the trap buffer contents will be + * copied continuously to the request buffer, which must be large + * enough. No length check is performed. + * + * Returns: + * Nothing + */ + +static void CopyTrapQueue( +SK_AC *pAC, /* Pointer to adapter context */ +char *pDstBuf) /* Buffer to which the queued traps will be copied */ +{ + unsigned int BufPad = pAC->Pnmi.TrapBufPad; + unsigned int Trap = pAC->Pnmi.TrapQueueBeg; + unsigned int End = pAC->Pnmi.TrapQueueEnd; + char *pBuf = &pAC->Pnmi.TrapBuf[0]; + unsigned int Len; + unsigned int DstOff = 0; + + + while (Trap != End) { + + Len = (unsigned int)*(pBuf + Trap); + + /* + * Last byte containing a copy of the length will + * not be copied. + */ + *(pDstBuf + DstOff) = (char)(Len - 1); + SK_MEMCPY(pDstBuf + DstOff + 1, pBuf + Trap + 1, Len - 2); + DstOff += Len - 1; + + Trap += Len; + if (Trap == SK_PNMI_TRAP_QUEUE_LEN) { + + Trap = BufPad; + } + } +} + +/***************************************************************************** + * + * GetTrapQueueLen - Get the length of the trap buffer + * + * Description: + * Evaluates the number of currently stored traps and the needed + * buffer size to retrieve them. + * + * Returns: + * Nothing + */ + +static void GetTrapQueueLen( +SK_AC *pAC, /* Pointer to adapter context */ +unsigned int *pLen, /* Length in Bytes of all queued traps */ +unsigned int *pEntries) /* Returns number of trapes stored in queue */ +{ + unsigned int BufPad = pAC->Pnmi.TrapBufPad; + unsigned int Trap = pAC->Pnmi.TrapQueueBeg; + unsigned int End = pAC->Pnmi.TrapQueueEnd; + char *pBuf = &pAC->Pnmi.TrapBuf[0]; + unsigned int Len; + unsigned int Entries = 0; + unsigned int TotalLen = 0; + + + while (Trap != End) { + + Len = (unsigned int)*(pBuf + Trap); + TotalLen += Len - 1; + Entries ++; + + Trap += Len; + if (Trap == SK_PNMI_TRAP_QUEUE_LEN) { + + Trap = BufPad; + } + } + + *pEntries = Entries; + *pLen = TotalLen; +} + +/***************************************************************************** + * + * QueueSimpleTrap - Store a simple trap to the trap buffer + * + * Description: + * A simple trap is a trap with now additional data. It consists + * simply of a trap code. + * + * Returns: + * Nothing + */ + +static void QueueSimpleTrap( +SK_AC *pAC, /* Pointer to adapter context */ +SK_U32 TrapId) /* Type of sensor trap */ +{ + GetTrapEntry(pAC, TrapId, SK_PNMI_TRAP_SIMPLE_LEN); +} + +/***************************************************************************** + * + * QueueSensorTrap - Stores a sensor trap in the trap buffer + * + * Description: + * Gets an entry in the trap buffer and fills it with sensor related + * data. + * + * Returns: + * Nothing + */ + +static void QueueSensorTrap( +SK_AC *pAC, /* Pointer to adapter context */ +SK_U32 TrapId, /* Type of sensor trap */ +unsigned int SensorIndex) /* Index of sensor which caused the trap */ +{ + char *pBuf; + unsigned int Offset; + unsigned int DescrLen; + SK_U32 Val32; + + + /* Get trap buffer entry */ + DescrLen = SK_STRLEN(pAC->I2c.SenTable[SensorIndex].SenDesc); + pBuf = GetTrapEntry(pAC, TrapId, + SK_PNMI_TRAP_SENSOR_LEN_BASE + DescrLen); + Offset = SK_PNMI_TRAP_SIMPLE_LEN; + + /* Store additionally sensor trap related data */ + Val32 = OID_SKGE_SENSOR_INDEX; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + *(pBuf + Offset + 4) = 4; + Val32 = (SK_U32)SensorIndex; + SK_PNMI_STORE_U32(pBuf + Offset + 5, Val32); + Offset += 9; + + Val32 = (SK_U32)OID_SKGE_SENSOR_DESCR; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + *(pBuf + Offset + 4) = (char)DescrLen; + SK_MEMCPY(pBuf + Offset + 5, pAC->I2c.SenTable[SensorIndex].SenDesc, + DescrLen); + Offset += DescrLen + 5; + + Val32 = OID_SKGE_SENSOR_TYPE; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + *(pBuf + Offset + 4) = 1; + *(pBuf + Offset + 5) = (char)pAC->I2c.SenTable[SensorIndex].SenType; + Offset += 6; + + Val32 = OID_SKGE_SENSOR_VALUE; + SK_PNMI_STORE_U32(pBuf + Offset, Val32); + *(pBuf + Offset + 4) = 4; + Val32 = (SK_U32)pAC->I2c.SenTable[SensorIndex].SenValue; + SK_PNMI_STORE_U32(pBuf + Offset + 5, Val32); +} + +/***************************************************************************** + * + * QueueRlmtNewMacTrap - Store a port switch trap in the trap buffer + * + * Description: + * Nothing further to explain. + * + * Returns: + * Nothing + */ + +static void QueueRlmtNewMacTrap( +SK_AC *pAC, /* Pointer to adapter context */ +unsigned int ActiveMac) /* Index (0..n) of the currently active port */ +{ + char *pBuf; + SK_U32 Val32; + + + pBuf = GetTrapEntry(pAC, OID_SKGE_TRAP_RLMT_CHANGE_PORT, + SK_PNMI_TRAP_RLMT_CHANGE_LEN); + + Val32 = OID_SKGE_RLMT_PORT_ACTIVE; + SK_PNMI_STORE_U32(pBuf + SK_PNMI_TRAP_SIMPLE_LEN, Val32); + *(pBuf + SK_PNMI_TRAP_SIMPLE_LEN + 4) = 1; + *(pBuf + SK_PNMI_TRAP_SIMPLE_LEN + 5) = (char)ActiveMac; +} + +/***************************************************************************** + * + * QueueRlmtPortTrap - Store port related RLMT trap to trap buffer + * + * Description: + * Nothing further to explain. + * + * Returns: + * Nothing + */ + +static void QueueRlmtPortTrap( +SK_AC *pAC, /* Pointer to adapter context */ +SK_U32 TrapId, /* Type of RLMT port trap */ +unsigned int PortIndex) /* Index of the port, which changed its state */ +{ + char *pBuf; + SK_U32 Val32; + + + pBuf = GetTrapEntry(pAC, TrapId, SK_PNMI_TRAP_RLMT_PORT_LEN); + + Val32 = OID_SKGE_RLMT_PORT_INDEX; + SK_PNMI_STORE_U32(pBuf + SK_PNMI_TRAP_SIMPLE_LEN, Val32); + *(pBuf + SK_PNMI_TRAP_SIMPLE_LEN + 4) = 1; + *(pBuf + SK_PNMI_TRAP_SIMPLE_LEN + 5) = (char)PortIndex; +} + +/***************************************************************************** + * + * CopyMac - Copies a MAC address + * + * Description: + * Nothing further to explain. + * + * Returns: + * Nothing + */ + +static void CopyMac( +char *pDst, /* Pointer to destination buffer */ +SK_MAC_ADDR *pMac) /* Pointer of Source */ +{ + int i; + + + for (i = 0; i < sizeof(SK_MAC_ADDR); i ++) { + + *(pDst + i) = pMac->a[i]; + } +} diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skgesirq.c linux/drivers/net/sk98lin/skgesirq.c --- v2.3.28/linux/drivers/net/sk98lin/skgesirq.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skgesirq.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1921 @@ +/****************************************************************************** + * + * Name: skgesirq.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.46 $ + * Date: $Date: 1999/09/16 10:30:07 $ + * Purpose: Special IRQ module + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skgesirq.c,v $ + * Revision 1.46 1999/09/16 10:30:07 cgoos + * Removed debugging output statement from Linux. + * + * Revision 1.45 1999/09/16 07:32:55 cgoos + * Fixed dual-port copperfield bug (PHY_READ from resetted port). + * Removed some unused variables. + * + * Revision 1.44 1999/08/03 15:25:04 cgoos + * Removed workaround for disabled interrupts in half duplex mode. + * + * Revision 1.43 1999/08/03 14:27:58 cgoos + * Removed SENSE mode code from SkGePortCheckUpBcom. + * + * Revision 1.42 1999/07/26 09:16:54 cgoos + * Added some typecasts to avoid compiler warnings. + * + * Revision 1.41 1999/05/19 07:28:59 cgoos + * Changes for 1000Base-T. + * + * Revision 1.40 1999/04/08 13:59:39 gklug + * fix: problem with 3Com switches endless RESTARTs + * + * Revision 1.39 1999/03/08 10:10:52 gklug + * fix: AutoSensing did switch to next mode even if LiPa indicated offline + * + * Revision 1.38 1999/03/08 09:49:03 gklug + * fix: Bug using pAC instead of IoC, causing AIX problems + * fix: change compare for Linux compiler bug workaround + * + * Revision 1.37 1999/01/28 14:51:33 gklug + * fix: monitor for autosensing and extra RESETS the RX on wire counters + * + * Revision 1.36 1999/01/22 09:19:55 gklug + * fix: Init DupMode and InitPauseMd are now called in RxTxEnable + * + * Revision 1.35 1998/12/11 15:22:59 gklug + * chg: autosensing: check for receive if manual mode was guessed + * chg: simplified workaround for XMAC errata + * chg: wait additional 100 ms before link goes up. + * chg: autoneg timeout to 600 ms + * chg: restart autoneg even if configured to autonegotiation + * + * Revision 1.34 1998/12/10 10:33:14 gklug + * add: more debug messages + * fix: do a new InitPhy if link went down (AutoSensing problem) + * chg: Check for zero shorts if link is NOT up + * chg: reset Port if link goes down + * chg: wait additional 100 ms when link comes up to check shorts + * fix: dummy read extended autoneg status to prevent link going down immediately + * + * Revision 1.33 1998/12/07 12:18:29 gklug + * add: refinement of autosense mode: take into account the autoneg cap of LiPa + * + * Revision 1.32 1998/12/07 07:11:21 gklug + * fix: compiler warning + * + * Revision 1.31 1998/12/02 09:29:05 gklug + * fix: WA XMAC Errata: FCSCt check was not correct. + * fix: WA XMAC Errata: Prec Counter were NOT updated in case of short checks. + * fix: Clear Stat : now clears the Prev counters of all known Ports + * + * Revision 1.30 1998/12/01 10:54:15 gklug + * dd: workaround for XMAC errata changed. Check RX count and CRC err Count, too. + * + * Revision 1.29 1998/12/01 10:01:53 gklug + * fix: if MAC IRQ occurs during port down, this will be handled correctly + * + * Revision 1.28 1998/11/26 16:22:11 gklug + * fix: bug in autosense if manual modes are used + * + * Revision 1.27 1998/11/26 15:50:06 gklug + * fix: PNMI needs to set PLinkModeConf + * + * Revision 1.26 1998/11/26 14:51:58 gklug + * add: AutoSensing functionalty + * + * Revision 1.25 1998/11/26 07:34:37 gklug + * fix: Init PrevShorts when restarting port due to Link connection + * + * Revision 1.24 1998/11/25 10:57:32 gklug + * fix: remove unreferenced local vars + * + * Revision 1.23 1998/11/25 08:26:40 gklug + * fix: don't do a RESET on a starting or stopping port + * + * Revision 1.22 1998/11/24 13:29:44 gklug + * add: Workaround for MAC parity errata + * + * Revision 1.21 1998/11/18 15:31:06 gklug + * fix: lint bugs + * + * Revision 1.20 1998/11/18 12:58:54 gklug + * fix: use PNMI query instead of hardware access + * + * Revision 1.19 1998/11/18 12:54:55 gklug + * chg: add new workaround for XMAC Errata + * add: short event counter monitoring on active link too + * + * Revision 1.18 1998/11/13 14:27:41 malthoff + * Bug Fix: Packet Arbiter Timeout was not cleared correctly + * for timeout on TX1 and TX2. + * + * Revision 1.17 1998/11/04 07:01:59 cgoos + * Moved HW link poll sequence. + * Added call to SkXmRxTxEnable. + * + * Revision 1.16 1998/11/03 13:46:03 gklug + * add: functionality of SET_LMODE and SET_FLOW_MODE + * fix: send RLMT LinkDown event when Port stop is given with LinkUp + * + * Revision 1.15 1998/11/03 12:56:47 gklug + * fix: Needs more events + * + * Revision 1.14 1998/10/30 07:36:35 gklug + * rmv: unnecessary code + * + * Revision 1.13 1998/10/29 15:21:57 gklug + * add: Poll link feature for activating HW link + * fix: Deactivate HWLink when Port STOP is given + * + * Revision 1.12 1998/10/28 07:38:57 cgoos + * Checking link status at begin of SkHWLinkUp. + * + * Revision 1.11 1998/10/22 09:46:50 gklug + * fix SysKonnectFileId typo + * + * Revision 1.10 1998/10/14 13:57:47 gklug + * add: Port start/stop event + * + * Revision 1.9 1998/10/14 05:48:29 cgoos + * Added definition for Para. + * + * Revision 1.8 1998/10/14 05:40:09 gklug + * add: Hardware Linkup signal used + * + * Revision 1.7 1998/10/09 06:50:20 malthoff + * Remove ID_sccs by SysKonnectFileId. + * + * Revision 1.6 1998/10/08 09:11:49 gklug + * add: clear IRQ commands + * + * Revision 1.5 1998/10/02 14:27:35 cgoos + * Fixed some typos and wrong event names. + * + * Revision 1.4 1998/10/02 06:24:17 gklug + * add: HW error function + * fix: OUT macros + * + * Revision 1.3 1998/10/01 07:03:00 gklug + * add: ISR for the usual interrupt source register + * + * Revision 1.2 1998/09/03 13:50:33 gklug + * add: function prototypes + * + * Revision 1.1 1998/08/27 11:50:21 gklug + * initial revision + * + * + * + ******************************************************************************/ + + +/* + Special Interrupt handler + + The following abstract should show how this module is included + in the driver path: + + In the ISR of the driver the bits for frame transmission complete and + for receive complete are checked and handled by the driver itself. + The bits of the slow path mask are checked after this and then the + entry into the so-called "slow path" is prepared. It is an implemetors + decision whether this is executed directly or just scheduled by + disabling the mask. In the interrupt service routine events may be + generated, so it would be a good idea to call the EventDispatcher + right after this ISR. + + The Interrupt service register of the adapter is NOT read by this + module. SO if the drivers implemetor needs a while loop around the + slow data paths Interrupt bits, he needs to call the SkGeIsr() for + each loop entered. + + However, the XMAC Interrupt status registers are read in a while loop. + +*/ +static const char SysKonnectFileId[] = + "$Id: skgesirq.c,v 1.46 1999/09/16 10:30:07 cgoos Exp $" ; + +#include "h/skdrv1st.h" /* Driver Specific Definitions */ +#include "h/skgepnmi.h" /* PNMI Definitions */ +#include "h/skrlmt.h" /* RLMT Definitions */ +#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ + + +/* local function prototypes */ +static int SkGePortCheckUpXmac(SK_AC*, SK_IOC, int); +static int SkGePortCheckUpBcom(SK_AC*, SK_IOC, int); +static int SkGePortCheckUpLone(SK_AC*, SK_IOC, int); +static int SkGePortCheckUpNat(SK_AC*, SK_IOC, int); +static void SkPhyIsrBcom(SK_AC*, SK_IOC, int, SK_U16); +static void SkPhyIsrLone(SK_AC*, SK_IOC, int, SK_U16); + + +#ifdef __C2MAN__ +/* + Special IRQ function + + General Description: + + */ +intro() +{} +#endif + +/* + * Define return codes of SkGePortCheckUp and CheckShort + */ +#define SK_HW_PS_NONE 0 /* No action needed */ +#define SK_HW_PS_RESTART 1 /* Restart needed */ +#define SK_HW_PS_LINK 2 /* Link Up actions needed */ + +/****************************************************************************** + * + * SkHWInitDefSense() - Default Autosensing mode initialization + * + * Description: + * This function handles the Hardware link down signal + * + * Note: + * + */ +void SkHWInitDefSense( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port] ; + + pPrt->PAutoNegTimeOut = 0; + + if (pPrt->PLinkModeConf != SK_LMODE_AUTOSENSE) { + pPrt->PLinkMode = pPrt->PLinkModeConf; + return; + } + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("AutoSensing: First mode %d on Port %d\n", + (int) SK_LMODE_AUTOFULL, + Port)); + + pPrt->PLinkMode = SK_LMODE_AUTOFULL; + + return; +} + +/****************************************************************************** + * + * SkHWSenseGetNext() - GetNextAutosensing Mode + * + * Description: + * This function handles the AutoSensing + * + * Note: + * + */ +SK_U8 SkHWSenseGetNext( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port] ; + + pPrt->PAutoNegTimeOut = 0; + + if (pPrt->PLinkModeConf != SK_LMODE_AUTOSENSE) { + /* Leave all as configured */ + return(pPrt->PLinkModeConf); + } + + if (pPrt->PLinkMode == SK_LMODE_AUTOFULL) { + /* Return next mode AUTOBOTH */ + return(SK_LMODE_AUTOBOTH); + } + + /* Return default autofull */ + return(SK_LMODE_AUTOFULL); +} + +/****************************************************************************** + * + * SkHWSenseSetNext() - Autosensing Set next mode + * + * Description: + * This function sets the appropriate next mode. + * + * Note: + * + */ +void SkHWSenseSetNext( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U8 NewMode) /* New Mode to be written in sense mode */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port] ; + + pPrt->PAutoNegTimeOut = 0; + + if (pPrt->PLinkModeConf != SK_LMODE_AUTOSENSE) { + return; + } + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("AutoSensing: next mode %d on Port %d\n", (int) NewMode, + Port)); + pPrt->PLinkMode = NewMode; + + return; +} + +/****************************************************************************** + * + * SkHWLinkDown() - Link Down handling + * + * Description: + * This function handles the Hardware link down signal + * + * Note: + * + */ +void SkHWLinkDown( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 Word; + + pPrt = &pAC->GIni.GP[Port] ; + + /* Disable all XMAC interrupts */ + XM_OUT16(IoC, Port, XM_IMSK, 0xffff); + + /* Disable Receive and Transmitter */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Word); + XM_OUT16(IoC, Port, XM_MMU_CMD, Word & ~(XM_MMU_ENA_RX|XM_MMU_ENA_TX)); + + /* disable all PHY interrupts */ + switch (pAC->GIni.GP[Port].PhyType) { + case SK_PHY_BCOM: + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, + 0xffff); + break; + case SK_PHY_LONE: + PHY_WRITE(IoC, pPrt, Port, PHY_LONE_INT_ENAB, + 0x0); + break; + case SK_PHY_NAT: + /* todo: National + PHY_WRITE(IoC, pPrt, Port, PHY_NAT_INT_MASK, + 0xffff); */ + break; + } + + /* Init default sense mode */ + SkHWInitDefSense(pAC, IoC, Port); + + if (!pPrt->PHWLinkUp) { + return; + } + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("Link down Port %d\n", Port)); + + /* Set Link to DOWN */ + pPrt->PHWLinkUp = SK_FALSE; + + /* Reset Port stati */ + pPrt->PLinkModeStatus = SK_LMODE_STAT_UNKNOWN; + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE ; + + /* + * Reinit Phy especially when the AutoSense default is set now + */ + SkXmInitPhy(pAC, IoC, Port, SK_FALSE); + + /* + * GP0: used for workaround of Rev. C + * Errata 2 + */ + + /* Do NOT signal to RLMT */ + + /* Do NOT start the timer here */ +} + +/****************************************************************************** + * + * SkHWLinkUp() - Link Up handling + * + * Description: + * This function handles the Hardware link up signal + * + * Note: + * + */ +void SkHWLinkUp( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port] ; + + if (pPrt->PHWLinkUp) { + /* We do NOT need to proceed on active link */ + return; + } + + pPrt->PHWLinkUp = SK_TRUE ; + pPrt->PAutoNegFail = SK_FALSE ; + pPrt->PLinkModeStatus = SK_LMODE_STAT_UNKNOWN; + + if (pPrt->PLinkMode != SK_LMODE_AUTOHALF && + pPrt->PLinkMode != SK_LMODE_AUTOFULL && + pPrt->PLinkMode != SK_LMODE_AUTOBOTH) { + /* Link is up and no Autonegotiation should be done */ + + /* Configure Port */ + + /* Set Link Mode */ + if (pPrt->PLinkMode == SK_LMODE_FULL) { + pPrt->PLinkModeStatus = SK_LMODE_STAT_FULL; + } else { + pPrt->PLinkModeStatus = SK_LMODE_STAT_HALF; + } + + /* No flow control without autonegotiation */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE ; + + /* RX/TX enable */ + SkXmRxTxEnable(pAC, IoC, Port); + } +} + +/****************************************************************************** + * + * SkMacParity - does everything to handle MAC parity errors correctly + * + */ +static void SkMacParity( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index of the port failed */ +{ + SK_EVPARA Para; + SK_GEPORT *pPrt; /* GIni Port struct pointer */ + SK_U64 TxMax; /* TxMax Counter */ + unsigned int Len; + + pPrt = &pAC->GIni.GP[Port]; + + /* Clear IRQ */ + SK_OUT16(IoC, MR_ADDR(Port,TX_MFF_CTRL1), MFF_CLR_PERR) ; + + if (pPrt->PCheckPar) { + if (Port == MAC_1) { + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E016, + SKERR_SIRQ_E016MSG) ; + } else { + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E017, + SKERR_SIRQ_E017MSG) ; + } + Para.Para64 = Port; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = Port; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + + return; + } + + + /* Check whether frames with a size of 1k were sent */ + Len = sizeof(SK_U64); + SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_TX_MAX, (char *) &TxMax, + &Len, (SK_U32) SK_PNMI_PORT_PHYS2INST(Port)); + + if (TxMax > 0) { + /* From now on check the parity */ + pPrt->PCheckPar = SK_TRUE; + } +} + +/****************************************************************************** + * + * Hardware Error service routine + * + * Description: + * + * Notes: + */ +static void SkGeHwErr( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +SK_U32 HwStatus) /* Interrupt status word */ +{ + SK_EVPARA Para; + + if (HwStatus & IS_IRQ_STAT) { + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E013, + SKERR_SIRQ_E013MSG) ; + Para.Para64 = 0; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para); + } + + if (HwStatus & IS_IRQ_MST_ERR) { + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E012, + SKERR_SIRQ_E012MSG) ; + Para.Para64 = 0; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para); + } + + if (HwStatus & IS_NO_STAT_M1) { + /* Ignore it */ + /* This situation is also indicated in the descriptor */ + SK_OUT16(IoC, MR_ADDR(MAC_1,RX_MFF_CTRL1), MFF_CLR_INSTAT) ; + } + + if (HwStatus & IS_NO_STAT_M2) { + /* Ignore it */ + /* This situation is also indicated in the descriptor */ + SK_OUT16(IoC, MR_ADDR(MAC_2,RX_MFF_CTRL1), MFF_CLR_INSTAT) ; + } + + if (HwStatus & IS_NO_TIST_M1) { + /* Ignore it */ + /* This situation is also indicated in the descriptor */ + SK_OUT16(IoC, MR_ADDR(MAC_1,RX_MFF_CTRL1), MFF_CLR_INTIST) ; + } + + if (HwStatus & IS_NO_TIST_M2) { + /* Ignore it */ + /* This situation is also indicated in the descriptor */ + SK_OUT16(IoC, MR_ADDR(MAC_2,RX_MFF_CTRL1), MFF_CLR_INTIST) ; + } + + if (HwStatus & IS_RAM_RD_PAR) { + SK_OUT16(IoC, B3_RI_CTRL, RI_CLR_RD_PERR) ; + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E014, + SKERR_SIRQ_E014MSG) ; + Para.Para64 = 0; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para); + } + + if (HwStatus & IS_RAM_WR_PAR) { + SK_OUT16(IoC, B3_RI_CTRL, RI_CLR_WR_PERR) ; + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E015, + SKERR_SIRQ_E015MSG) ; + Para.Para64 = 0; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_ADAP_FAIL, Para); + } + + if (HwStatus & IS_M1_PAR_ERR) { + SkMacParity(pAC, IoC, MAC_1) ; + } + + if (HwStatus & IS_M2_PAR_ERR) { + SkMacParity(pAC, IoC, MAC_2) ; + } + + if (HwStatus & IS_R1_PAR_ERR) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_R1_CSR, CSR_IRQ_CL_P) ; + + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E018, + SKERR_SIRQ_E018MSG) ; + Para.Para64 = MAC_1; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_1; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + if (HwStatus & IS_R2_PAR_ERR) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_R2_CSR, CSR_IRQ_CL_P) ; + + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E019, + SKERR_SIRQ_E019MSG) ; + Para.Para64 = MAC_2; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_2; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + +} + +/****************************************************************************** + * + * Interrupt service routine + * + * Description: + * + * Notes: + */ +void SkGeSirqIsr( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +SK_U32 Istatus) /* Interrupt status word */ +{ + SK_U32 RegVal32; /* Read register Value */ + SK_EVPARA Para; + SK_U16 XmIsr; + + if (Istatus & IS_HW_ERR) { + SK_IN32(IoC, B0_HWE_ISRC, &RegVal32) ; + SkGeHwErr(pAC, IoC, RegVal32) ; + } + + /* + * Packet Timeout interrupts + */ + /* Check whether XMACs are correctly initialized */ + if ((Istatus & (IS_PA_TO_RX1 | IS_PA_TO_TX1)) && + !pAC->GIni.GP[MAC_1].PState) { + /* XMAC was not initialized but Packet timeout occured */ + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E004, + SKERR_SIRQ_E004MSG) ; + } + + if ((Istatus & (IS_PA_TO_RX2 | IS_PA_TO_TX2)) && + !pAC->GIni.GP[MAC_2].PState) { + /* XMAC was not initialized but Packet timeout occured */ + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E005, + SKERR_SIRQ_E005MSG) ; + } + + if (Istatus & IS_PA_TO_RX1) { + /* Means network is filling us up */ + SK_ERR_LOG(pAC, SK_ERRCL_HW | SK_ERRCL_INIT, SKERR_SIRQ_E002, + SKERR_SIRQ_E002MSG) ; + SK_OUT16(IoC, B3_PA_CTRL, PA_CLR_TO_RX1) ; + } + + if (Istatus & IS_PA_TO_RX2) { + /* Means network is filling us up */ + SK_ERR_LOG(pAC, SK_ERRCL_HW | SK_ERRCL_INIT, SKERR_SIRQ_E003, + SKERR_SIRQ_E003MSG) ; + SK_OUT16(IoC, B3_PA_CTRL, PA_CLR_TO_RX2) ; + } + + if (Istatus & IS_PA_TO_TX1) { + /* May be a normal situation in a server with a slow network */ + SK_OUT16(IoC, B3_PA_CTRL, PA_CLR_TO_TX1) ; + } + + if (Istatus & IS_PA_TO_TX2) { + /* May be a normal situation in a server with a slow network */ + SK_OUT16(IoC, B3_PA_CTRL, PA_CLR_TO_TX2) ; + } + + /* + * Check interrupts of the particular queues. + */ + if (Istatus & IS_R1_C) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_R1_CSR, CSR_IRQ_CL_C) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E006, + SKERR_SIRQ_E006MSG) ; + Para.Para64 = MAC_1; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_1; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + if (Istatus & IS_R2_C) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_R2_CSR, CSR_IRQ_CL_C) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E007, + SKERR_SIRQ_E007MSG) ; + Para.Para64 = MAC_2; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_2; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + if (Istatus & IS_XS1_C) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_XS1_CSR, CSR_IRQ_CL_C) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E008, + SKERR_SIRQ_E008MSG) ; + Para.Para64 = MAC_1; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_1; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + if (Istatus & IS_XA1_C) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_XA1_CSR, CSR_IRQ_CL_C) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E009, + SKERR_SIRQ_E009MSG) ; + Para.Para64 = MAC_1; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_1; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + if (Istatus & IS_XS2_C) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_XS2_CSR, CSR_IRQ_CL_C) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E010, + SKERR_SIRQ_E010MSG) ; + Para.Para64 = MAC_2; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_2; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + if (Istatus & IS_XA2_C) { + /* Clear IRQ */ + SK_OUT32(IoC, B0_XA2_CSR, CSR_IRQ_CL_C) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E011, + SKERR_SIRQ_E011MSG) ; + Para.Para64 = MAC_2; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); + Para.Para32[0] = MAC_2; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + } + + /* + * I2C Ready interrupt + */ + if (Istatus & IS_I2C_READY) { + SK_U16 PhyInt; + SK_U16 PhyIMsk; + SK_BOOL IsPhyInt = SK_FALSE; + int i; + /* test IRQs from PHY */ + for (i=0; iGIni.GIMacsFound; i++) { + switch (pAC->GIni.GP[i].PhyType) { + case SK_PHY_XMAC: + break; + case SK_PHY_BCOM: + if(pAC->GIni.GP[i].PState) { + PHY_READ(IoC, &pAC->GIni.GP[i], i, + PHY_BCOM_INT_STAT, &PhyInt); + PHY_READ(IoC, &pAC->GIni.GP[i], i, + PHY_BCOM_INT_MASK, &PhyIMsk); + + if (PhyInt & (~PhyIMsk)) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("Port %d Bcom Int: %x " + " Mask: %x\n", + i, PhyInt, PhyIMsk)); + SkPhyIsrBcom(pAC, IoC, i, + (SK_U16) + (PhyInt & (~PhyIMsk))); + IsPhyInt = SK_TRUE; + } + } + else { + } + break; + case SK_PHY_LONE: + PHY_READ(IoC, &pAC->GIni.GP[i], i, + PHY_LONE_INT_STAT, &PhyInt); + PHY_READ(IoC, &pAC->GIni.GP[i], i, + PHY_LONE_INT_ENAB, &PhyIMsk); + + if (PhyInt & PhyIMsk) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("Port %d Lone Int: %x " + " Mask: %x\n", + i, PhyInt, PhyIMsk)); + SkPhyIsrLone(pAC, IoC, i, + (SK_U16) (PhyInt & PhyIMsk)); + IsPhyInt = SK_TRUE; + } + break; + case SK_PHY_NAT: + /* todo: National */ + break; + } + } + if (!IsPhyInt) { + SkI2cIsr(pAC, IoC); + } + } + + if (Istatus & IS_LNK_SYNC_M1) { + /* + * We do NOT need the Link Sync interrupt, because it shows + * us only a link going down. + */ + /* clear interrupt */ + SK_OUT8(IoC, MR_ADDR(MAC_1,LNK_SYNC_CTRL), LED_CLR_IRQ); + } + + /* Check MAC after link sync counter */ + if (Istatus & IS_MAC1) { + XM_IN16(IoC, MAC_1, XM_ISRC, &XmIsr) ; + SkXmIrq(pAC, IoC, MAC_1, XmIsr); + } + + if (Istatus & IS_LNK_SYNC_M2) { + /* + * We do NOT need the Link Sync interrupt, because it shows + * us only a link going down. + */ + /* clear interrupt */ + SK_OUT8(IoC, MR_ADDR(MAC_2,LNK_SYNC_CTRL), LED_CLR_IRQ); + } + + /* Check MAC after link sync counter */ + if (Istatus & IS_MAC2) { + XM_IN16(IoC, MAC_2, XM_ISRC, &XmIsr) ; + SkXmIrq(pAC, IoC, MAC_2, XmIsr); + } + + /* + * Timer interrupt + * To be served last + */ + if (Istatus & IS_TIMINT) { + SkHwtIsr(pAC, IoC); + } +} + +/* + * Define an array of RX counter which are checked + * in AutoSense mode to check whether a link is not able to autonegotiate. + */ +static const SK_U32 SkGeRxOids[]= { + OID_SKGE_STAT_RX_64, + OID_SKGE_STAT_RX_127, + OID_SKGE_STAT_RX_255, + OID_SKGE_STAT_RX_511, + OID_SKGE_STAT_RX_1023, + OID_SKGE_STAT_RX_MAX, +} ; +/****************************************************************************** + * + * SkGePortCheckShorts - Implementing of the Workaround Errata # 2 + * + * return: + * 0 o.k. nothing needed + * 1 Restart needed on this port + */ +int SkGePortCheckShorts( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int Port) /* Which port should be checked */ +{ + SK_U64 Shorts; /* Short Event Counter */ + SK_U64 CheckShorts; /* Check value for Short Event Counter */ + SK_U64 RxCts; /* RX Counter (packets on network) */ + SK_U64 RxTmp; /* RX temp. Counter */ + SK_U64 FcsErrCts; /* FCS Error Counter */ + SK_GEPORT *pPrt; /* GIni Port struct pointer */ + unsigned int Len; + int Rtv; /* Return value */ + int i; + + pPrt = &pAC->GIni.GP[Port]; + + /* Default: no action */ + Rtv = SK_HW_PS_NONE; + + /* + * Extra precaution: check for short Event counter + */ + Len = sizeof(SK_U64); + SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_RX_SHORTS, (char *) &Shorts, + &Len, (SK_U32) SK_PNMI_PORT_PHYS2INST(Port)); + + /* + * Read RX counter (packets seen on the network and not neccesarily + * really received. + */ + Len = sizeof(SK_U64); + RxCts = 0; + + for (i = 0; i < sizeof(SkGeRxOids)/sizeof(SK_U32) ; i++) { + SkPnmiGetVar(pAC, IoC, SkGeRxOids[i], (char *) &RxTmp, + &Len, (SK_U32) SK_PNMI_PORT_PHYS2INST(Port)); + RxCts += RxTmp; + } + + /* On default: check shorts against zero */ + CheckShorts = 0; + + /* + * Extra extra precaution on active links: + */ + if (pPrt->PHWLinkUp) { + /* + * Reset Link Restart counter + */ + pPrt->PLinkResCt = 0; + + /* If link is up check for 2 */ + CheckShorts = 2; + + Len = sizeof(SK_U64); + SkPnmiGetVar(pAC, IoC, OID_SKGE_STAT_RX_FCS, + (char *) &FcsErrCts, &Len, + (SK_U32) SK_PNMI_PORT_PHYS2INST(Port)); + + if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE && + pPrt->PLipaAutoNeg == SK_LIPA_UNKNOWN && + (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL)) { + /* + * This is autosensing and we are in the fallback + * manual full/half duplex mode. + */ + if (RxCts == pPrt->PPrevRx) { + /* + * Nothing received + * restart link + */ + pPrt->PPrevFcs = FcsErrCts; + pPrt->PPrevShorts = Shorts; + return(SK_HW_PS_RESTART); + } else { + pPrt->PLipaAutoNeg = SK_LIPA_MANUAL; + } + } + + if (((RxCts - pPrt->PPrevRx) > pPrt->PRxLim) || + (!(FcsErrCts - pPrt->PPrevFcs))) { + /* + * Note: The compare with zero above has to be done + * the way shown, otherwise the Linux driver will + * have a problem. + */ + /* + * we received a bunch of frames or no + * CRC error occured on the network -> + * ok. + */ + pPrt->PPrevRx = RxCts; + pPrt->PPrevFcs = FcsErrCts; + pPrt->PPrevShorts = Shorts; + + return(SK_HW_PS_NONE) ; + } + + pPrt->PPrevFcs = FcsErrCts; + } + + + if ((Shorts - pPrt->PPrevShorts) > CheckShorts) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("Short Event Count Restart Port %d \n", Port)); + Rtv = SK_HW_PS_RESTART; + } + + pPrt->PPrevShorts = Shorts; + pPrt->PPrevRx = RxCts; + + return(Rtv); +} + + +/****************************************************************************** + * + * SkGePortCheckUp - Implementing of the Workaround Errata # 2 + * + * return: + * 0 o.k. nothing needed + * 1 Restart needed on this port + * 2 Link came up + */ +int SkGePortCheckUp( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int Port) /* Which port should be checked */ +{ + SK_GEPORT *pPrt; /* GIni Port struct pointer */ + + pPrt = &pAC->GIni.GP[Port]; + + switch (pPrt->PhyType) { + case SK_PHY_XMAC: + return (SkGePortCheckUpXmac(pAC, IoC, Port)); + case SK_PHY_BCOM: + return (SkGePortCheckUpBcom(pAC, IoC, Port)); + case SK_PHY_LONE: + return (SkGePortCheckUpLone(pAC, IoC, Port)); + case SK_PHY_NAT: + return (SkGePortCheckUpNat(pAC, IoC, Port)); + } + + return(SK_HW_PS_NONE) ; +} + + +/****************************************************************************** + * + * SkGePortCheckUpXmac - Implementing of the Workaround Errata # 2 + * + * return: + * 0 o.k. nothing needed + * 1 Restart needed on this port + * 2 Link came up + */ +static int SkGePortCheckUpXmac( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int Port) /* Which port should be checked */ +{ + SK_GEPORT *pPrt; /* GIni Port struct pointer */ + SK_BOOL AutoNeg; /* Is Autonegotiation used ? */ + SK_U16 Isrc; /* Interrupt source register */ + SK_U32 GpReg; /* General Purpose register value */ + SK_U16 IsrcSum; /* Interrupt source register sum */ + SK_U16 LpAb; /* Link Partner Ability */ + SK_U16 ResAb; /* Resolved Ability */ + SK_U64 Shorts; /* Short Event Counter */ + unsigned int Len; + SK_U8 NextMode; /* Next AutoSensing Mode */ + SK_U16 ExtStat; /* Extended Status Register */ + int Done; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PHWLinkUp) { + if (pPrt->PhyType != SK_PHY_XMAC) { + return(SK_HW_PS_NONE) ; + } + else { + return(SkGePortCheckShorts(pAC, IoC, Port)) ; + } + } + + IsrcSum = pPrt->PIsave; + pPrt->PIsave = 0; + + /* Now wait for each ports link */ + if (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL) { + AutoNeg = SK_FALSE; + } else { + AutoNeg = SK_TRUE; + } + + if (pPrt->PLinkBroken) { + /* Link was broken */ + XM_IN32(IoC,Port,XM_GP_PORT, &GpReg) ; + + if ((GpReg & XM_GP_INP_ASS) == 0) { + /* The Link is in sync */ + XM_IN16(IoC,Port,XM_ISRC, &Isrc) ; + IsrcSum |= Isrc; + SkXmAutoNegLipaXmac(pAC, IoC, Port, IsrcSum); + if ((Isrc & XM_IS_INP_ASS) == 0) { + /* It has been in sync since last Time */ + /* Restart the PORT */ + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("Link in sync Restart Port %d\n", + Port)); + + /* + * We now need to reinitialize the PrevSHorts + * counter. + */ + Len = sizeof(SK_U64); + SkPnmiGetVar(pAC, IoC, + OID_SKGE_STAT_RX_SHORTS, + (char *) &Shorts, + &Len, + (SK_U32) SK_PNMI_PORT_PHYS2INST(Port)); + pPrt->PPrevShorts = Shorts; + + pAC->GIni.GP[Port].PLinkBroken = SK_FALSE ; + + /* + * Link Restart Workaround: + * it may be possible that the other Link side + * restarts its link as well an we detect + * another LinkBroken. To prevent this + * happening we check for a maximum number + * of consecutive restart. If those happens, + * we do NOT restart the active link and + * check whether the lionk is now o.k. + */ + pAC->GIni.GP[Port].PLinkResCt ++; + pPrt->PAutoNegTimeOut = 0; + + if (pAC->GIni.GP[Port].PLinkResCt < + SK_MAX_LRESTART) { + return(SK_HW_PS_RESTART) ; + } + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Do NOT restart on Port %d %x %x\n", + Port, Isrc, IsrcSum)); + pAC->GIni.GP[Port].PLinkResCt = 0; + } else { + pPrt->PIsave = (SK_U16) (IsrcSum & (XM_IS_AND)); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Save Sync/nosync Port %d %x %x\n", + Port, Isrc, IsrcSum)); + /* Do nothing more if link is broken */ + return(SK_HW_PS_NONE) ; + } + } else { + /* Do nothing more if link is broken */ + return(SK_HW_PS_NONE) ; + } + + } else { + /* Link was not broken, check if it is */ + XM_IN16(IoC,Port,XM_ISRC, &Isrc) ; + IsrcSum |= Isrc; + if ((Isrc & XM_IS_INP_ASS) == XM_IS_INP_ASS) { + XM_IN16(IoC,Port,XM_ISRC, &Isrc) ; + IsrcSum |= Isrc; + if ((Isrc & XM_IS_INP_ASS) == XM_IS_INP_ASS) { + XM_IN16(IoC,Port,XM_ISRC, &Isrc) ; + IsrcSum |= Isrc; + if ((Isrc & XM_IS_INP_ASS) == XM_IS_INP_ASS) { + pPrt->PLinkBroken = SK_TRUE ; + /* + * Re-Init Link partner Autoneg flag + */ + pPrt->PLipaAutoNeg = SK_LIPA_UNKNOWN; + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("Link broken Port %d\n", + Port)); + + /* cable removed-> reinit Sensemode */ + /* Init default sense mode */ + SkHWInitDefSense(pAC, IoC, Port); + + return(SK_HW_PS_RESTART) ; + } + } + } else { + SkXmAutoNegLipaXmac(pAC, IoC, Port, Isrc); + if (SkGePortCheckShorts(pAC, IoC, Port) == + SK_HW_PS_RESTART) { + return(SK_HW_PS_RESTART) ; + } + } + } + + /* + * here we usually can check whether the link is in sync and + * autonegotiation is done. + */ + XM_IN32(IoC,Port,XM_GP_PORT, &GpReg) ; + XM_IN16(IoC,Port,XM_ISRC, &Isrc) ; + IsrcSum |= Isrc; + + SkXmAutoNegLipaXmac(pAC, IoC, Port, IsrcSum); + if ((GpReg & XM_GP_INP_ASS) != 0 || (IsrcSum & XM_IS_INP_ASS) != 0) { + if ((GpReg & XM_GP_INP_ASS) == 0) { + /* + * Save Autonegotiation Done interrupt only if link + * is in sync + */ + pPrt->PIsave = (SK_U16) (IsrcSum & (XM_IS_AND)); + } +#ifdef DEBUG + if (pPrt->PIsave & (XM_IS_AND)) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg done rescheduled Port %d\n", Port)); + } +#endif + return(SK_HW_PS_NONE) ; + } + + if (AutoNeg) { + if (IsrcSum & XM_IS_AND) { + SkHWLinkUp(pAC, IoC, Port) ; + Done = SkXmAutoNegDone(pAC,IoC,Port); + if (Done != SK_AND_OK) { + /* Get PHY parameters, for debuging only */ + PHY_READ(IoC, pPrt, Port, PHY_XMAC_AUNE_LP, + &LpAb); + PHY_READ(IoC, pPrt, Port, PHY_XMAC_RES_ABI, + &ResAb); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg FAIL Port %d (LpAb %x, ResAb %x)\n", + Port, LpAb, ResAb)); + + /* Try next possible mode */ + NextMode = SkHWSenseGetNext(pAC, IoC, Port); + SkHWLinkDown(pAC, IoC, Port) ; + if (Done == SK_AND_DUP_CAP) { + /* GoTo next mode */ + SkHWSenseSetNext(pAC, IoC, Port, + NextMode); + } + + return(SK_HW_PS_RESTART) ; + + } else { + /* + * Dummy Read extended status to prevent + * extra link down/ups + * (clear Page Received bit if set) + */ + PHY_READ(IoC, pPrt, Port, PHY_XMAC_AUNE_EXP, &ExtStat); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg done Port %d\n", Port)); + return(SK_HW_PS_LINK) ; + } + } + + /* + * AutoNeg not done, but HW link is up. Check for timeouts + */ + pPrt->PAutoNegTimeOut ++; + if (pPrt->PAutoNegTimeOut >= SK_AND_MAX_TO) { + /* + * Timeout occured. + * What do we need now? + */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("AutoNeg timeout Port %d\n", + Port)); + if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE && + pPrt->PLipaAutoNeg != SK_LIPA_AUTO) { + /* + * Timeout occured + * Set Link manually up. + */ + SkHWSenseSetNext(pAC, IoC, Port, + SK_LMODE_FULL); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("Set manual full duplex Port %d\n", + Port)); + } + + /* + * Do the restart + */ + return(SK_HW_PS_RESTART) ; + } + } else { + /* + * Link is up and we don't need more. + */ +#ifdef DEBUG + if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("ERROR: Lipa auto detected on port %d\n", + Port)); + } +#endif + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("Link sync(GP), Port %d\n", Port)); + SkHWLinkUp(pAC, IoC, Port) ; + return(SK_HW_PS_LINK) ; + } + + return(SK_HW_PS_NONE) ; +} + + +/****************************************************************************** + * + * SkGePortCheckUpBcom - Check, if the link is up + * + * return: + * 0 o.k. nothing needed + * 1 Restart needed on this port + * 2 Link came up + */ +static int SkGePortCheckUpBcom( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int Port) /* Which port should be checked */ +{ + SK_GEPORT *pPrt; /* GIni Port struct pointer */ + SK_BOOL AutoNeg; /* Is Autonegotiation used ? */ + SK_U16 Isrc; /* Interrupt source register */ + SK_U16 LpAb; /* Link Partner Ability */ + SK_U16 ExtStat; /* Extended Status Register */ + SK_U16 PhyStat; /* Phy Status Register */ + int Done; + SK_U16 ResAb; + + pPrt = &pAC->GIni.GP[Port]; + PHY_READ(IoC, pPrt, Port, PHY_BCOM_STAT, &PhyStat); + + if (pPrt->PHWLinkUp) { + return(SK_HW_PS_NONE) ; + } + + pPrt->PIsave = 0; + + /* Now wait for each ports link */ + if (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL) { + AutoNeg = SK_FALSE; + } else { + AutoNeg = SK_TRUE; + } + + /* + * here we usually can check whether the link is in sync and + * autonegotiation is done. + */ + XM_IN16(IoC, Port, XM_ISRC, &Isrc) ; + + PHY_READ(IoC, pPrt, Port, PHY_BCOM_STAT, &PhyStat); + + SkXmAutoNegLipaBcom(pAC, IoC, Port, PhyStat); + if ((PhyStat & PHY_ST_LSYNC) == 0){ + return(SK_HW_PS_NONE) ; + } + + if (AutoNeg) { + if (PhyStat & PHY_ST_AN_OVER) { + SkHWLinkUp(pAC, IoC, Port) ; + Done = SkXmAutoNegDone(pAC,IoC,Port); + if (Done != SK_AND_OK) { + /* Get PHY parameters, for debuging only */ + PHY_READ(IoC, pPrt, Port, + PHY_BCOM_AUNE_LP, + &LpAb); + PHY_READ(IoC, pPrt, Port, + PHY_BCOM_1000T_STAT, + &ExtStat); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg FAIL Port %d (LpAb %x, " + "1000TStat %x)\n", + Port, LpAb, ExtStat)); + return(SK_HW_PS_RESTART) ; + + } else { + /* + * Dummy Read interrupt status to prevent + * extra link down/ups + */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_INT_STAT, + &ExtStat); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg done Port %d\n", Port)); + return(SK_HW_PS_LINK) ; + } + } + } else { + /* + * Link is up and we don't need more. + */ +#ifdef DEBUG + if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("ERROR: Lipa auto detected on port %d\n", + Port)); + } +#endif + PHY_READ(IoC, pPrt, Port, PHY_BCOM_1000T_STAT, &ResAb); + if (ResAb & (PHY_B_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT; + return (SK_AND_OTHER); + } else if (ResAb & PHY_B_1000S_MSR) { + pPrt->PMSStatus = SK_MS_STAT_MASTER ; + } else { + pPrt->PMSStatus = SK_MS_STAT_SLAVE ; + } + + + /* + * Dummy Read interrupt status to prevent + * extra link down/ups + */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_INT_STAT, &ExtStat); + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("Link sync(GP), Port %d\n", Port)); + SkHWLinkUp(pAC, IoC, Port) ; + return(SK_HW_PS_LINK) ; + } + + return(SK_HW_PS_NONE) ; +} + +/****************************************************************************** + * + * SkGePortCheckUpLone - Check if the link is up + * + * return: + * 0 o.k. nothing needed + * 1 Restart needed on this port + * 2 Link came up + */ +static int SkGePortCheckUpLone( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int Port) /* Which port should be checked */ +{ + SK_GEPORT *pPrt; /* GIni Port struct pointer */ + SK_BOOL AutoNeg; /* Is Autonegotiation used ? */ + SK_U16 Isrc; /* Interrupt source register */ + SK_U16 LpAb; /* Link Partner Ability */ + SK_U8 NextMode; /* Next AutoSensing Mode */ + SK_U16 ExtStat; /* Extended Status Register */ + SK_U16 PhyStat; /* Phy Status Register */ + SK_U16 StatSum; + int Done; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PHWLinkUp) { + return(SK_HW_PS_NONE) ; + } + + StatSum = pPrt->PIsave; + pPrt->PIsave = 0; + + /* Now wait for each ports link */ + if (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL) { + AutoNeg = SK_FALSE; + } else { + AutoNeg = SK_TRUE; + } + + /* + * here we usually can check whether the link is in sync and + * autonegotiation is done. + */ + XM_IN16(IoC, Port, XM_ISRC, &Isrc) ; + PHY_READ(IoC, pPrt, Port, PHY_LONE_STAT, &PhyStat); + StatSum |= PhyStat; + + SkXmAutoNegLipaLone(pAC, IoC, Port, PhyStat); + if ((PhyStat & PHY_ST_LSYNC) == 0){ + /* + * Save Autonegotiation Done bit + */ + pPrt->PIsave = (SK_U16) (StatSum & PHY_ST_AN_OVER); +#ifdef DEBUG + if (pPrt->PIsave & PHY_ST_AN_OVER) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg done rescheduled Port %d\n", Port)); + } +#endif + return(SK_HW_PS_NONE) ; + } + + if (AutoNeg) { + if (StatSum & PHY_ST_AN_OVER) { + SkHWLinkUp(pAC, IoC, Port) ; + Done = SkXmAutoNegDone(pAC,IoC,Port); + if (Done != SK_AND_OK) { + /* Get PHY parameters, for debuging only */ + PHY_READ(IoC, pPrt, Port, + PHY_LONE_AUNE_LP, + &LpAb); + PHY_READ(IoC, pPrt, Port, + PHY_LONE_1000T_STAT, + &ExtStat); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg FAIL Port %d (LpAb %x, 1000TStat %x)\n", + Port, LpAb, ExtStat)); + + /* Try next possible mode */ + NextMode = SkHWSenseGetNext(pAC, IoC, Port); + SkHWLinkDown(pAC, IoC, Port) ; + if (Done == SK_AND_DUP_CAP) { + /* GoTo next mode */ + SkHWSenseSetNext(pAC, IoC, Port, + NextMode); + } + + return(SK_HW_PS_RESTART) ; + + } else { + /* + * Dummy Read interrupt status to prevent + * extra link down/ups + */ + PHY_READ(IoC, pPrt, Port, PHY_LONE_INT_STAT, + &ExtStat); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg done Port %d\n", Port)); + return(SK_HW_PS_LINK) ; + } + } + + /* + * AutoNeg not done, but HW link is up. Check for timeouts + */ + pPrt->PAutoNegTimeOut ++; + if (pPrt->PAutoNegTimeOut >= SK_AND_MAX_TO) { + /* + * Timeout occured. + * What do we need now? + */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("AutoNeg timeout Port %d\n", + Port)); + if (pPrt->PLinkModeConf == SK_LMODE_AUTOSENSE && + pPrt->PLipaAutoNeg != SK_LIPA_AUTO) { + /* + * Timeout occured + * Set Link manually up. + */ + SkHWSenseSetNext(pAC, IoC, Port, + SK_LMODE_FULL); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM, + SK_DBGCAT_IRQ, + ("Set manual full duplex Port %d\n", + Port)); + } + + /* + * Do the restart + */ + return(SK_HW_PS_RESTART) ; + } + } else { + /* + * Link is up and we don't need more. + */ +#ifdef DEBUG + if (pPrt->PLipaAutoNeg == SK_LIPA_AUTO) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("ERROR: Lipa auto detected on port %d\n", + Port)); + } +#endif + + /* + * Dummy Read interrupt status to prevent + * extra link down/ups + */ + PHY_READ(IoC, pPrt, Port, PHY_LONE_INT_STAT, &ExtStat); + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("Link sync(GP), Port %d\n", Port)); + SkHWLinkUp(pAC, IoC, Port) ; + return(SK_HW_PS_LINK) ; + } + + return(SK_HW_PS_NONE) ; +} + + +/****************************************************************************** + * + * SkGePortCheckUpNat - Check if the link is up + * + * return: + * 0 o.k. nothing needed + * 1 Restart needed on this port + * 2 Link came up + */ +static int SkGePortCheckUpNat( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int Port) /* Which port should be checked */ +{ + /* todo: National */ + return(SK_HW_PS_NONE) ; +} + + +/****************************************************************************** + * + * Event service routine + * + * Description: + * + * Notes: + */ +int SkGeSirqEvent( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* Io Context */ +SK_U32 Event, /* Module specific Event */ +SK_EVPARA Para) /* Event specific Parameter */ +{ + SK_U32 Port; + SK_U32 Time; + SK_U8 Val8 ; + int PortStat; + + Port = Para.Para32[0]; + + switch (Event) { + case SK_HWEV_WATIM: + /* Check whether port came up */ + PortStat = SkGePortCheckUp(pAC, IoC, Port); + + switch (PortStat) { + case SK_HW_PS_RESTART: + if (pAC->GIni.GP[Port].PHWLinkUp) { + /* + * Set Link to down. + */ + SkHWLinkDown(pAC, IoC, Port); + + /* + * Signal directly to RLMT to ensure correct + * sequence of SWITCH and RESET event. + */ + Para.Para32[0] = (SK_U32) Port; + SkRlmtEvent(pAC, IoC, SK_RLMT_LINK_DOWN, Para); + + /* Start workaround Errata #2 timer */ + SkTimerStart(pAC, IoC, + &pAC->GIni.GP[Port].PWaTimer, + SK_WA_INA_TIME, + SKGE_HWAC, + SK_HWEV_WATIM, + Para); + } + + /* Restart needed */ + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_RESET, Para); + break; + + case SK_HW_PS_LINK: + /* Signal to RLMT */ + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_UP, Para); + break; + + } + + /* Start again the check Timer */ + if (pAC->GIni.GP[Port].PHWLinkUp) { + Time = SK_WA_ACT_TIME; + } else { + Time = SK_WA_INA_TIME; + } + + /* todo: still needed for non-Xmac-PHYs ??? */ + /* Start workaround Errata #2 timer */ + SkTimerStart(pAC, IoC, &pAC->GIni.GP[Port].PWaTimer, Time, + SKGE_HWAC, SK_HWEV_WATIM, Para); + + break; + + case SK_HWEV_PORT_START: + if (pAC->GIni.GP[Port].PHWLinkUp) { + /* + * Signal directly to RLMT to ensure correct + * sequence of SWITCH and RESET event. + */ + Para.Para32[0] = (SK_U32) Port; + SkRlmtEvent(pAC, IoC, SK_RLMT_LINK_DOWN, Para); + } + + SkHWLinkDown(pAC, IoC, Port) ; + + /* Schedule Port RESET */ + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_RESET, Para); + + /* Start workaround Errata #2 timer */ + SkTimerStart(pAC, IoC, &pAC->GIni.GP[Port].PWaTimer, + SK_WA_INA_TIME,SKGE_HWAC,SK_HWEV_WATIM,Para); + break; + + case SK_HWEV_PORT_STOP: + if (pAC->GIni.GP[Port].PHWLinkUp) { + /* + * Signal directly to RLMT to ensure correct + * sequence of SWITCH and RESET event. + */ + Para.Para32[0] = (SK_U32) Port; + SkRlmtEvent(pAC, IoC, SK_RLMT_LINK_DOWN, Para); + } + /* Stop Workaround Timer */ + SkTimerStop(pAC, IoC, &pAC->GIni.GP[Port].PWaTimer) ; + + SkHWLinkDown(pAC, IoC, Port) ; + break; + + case SK_HWEV_UPDATE_STAT: + /* We do NOT need to update any statistics */ + break; + + case SK_HWEV_CLEAR_STAT: + /* We do NOT need to clear any statistics */ + for (Port = 0; Port < (SK_U32) pAC->GIni.GIMacsFound; Port++) { + pAC->GIni.GP[Port].PPrevRx = 0; + pAC->GIni.GP[Port].PPrevFcs = 0; + pAC->GIni.GP[Port].PPrevShorts = 0; + } + break; + + case SK_HWEV_SET_LMODE: + Val8 = (SK_U8) Para.Para32[1]; + if (pAC->GIni.GP[Port].PLinkModeConf != Val8) { + /* Set New link mode */ + pAC->GIni.GP[Port].PLinkModeConf = Val8; + + /* Restart Port */ + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para); + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para); + } + break; + + case SK_HWEV_SET_FLOWMODE: + Val8 = (SK_U8) Para.Para32[1]; + if (pAC->GIni.GP[Port].PFlowCtrlMode != Val8) { + /* Set New Flow Control mode */ + pAC->GIni.GP[Port].PFlowCtrlMode = Val8; + + /* Restart Port */ + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para); + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para); + } + break; + + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_SIRQ_E001, + SKERR_SIRQ_E001MSG); + break; + } + + return(0) ; +} + + +/****************************************************************************** + * + * SkPhyIsrBcom - PHY interrupt service routine + * + * Description: handle all interrupts from BCOM PHY + * + * Returns: N/A + */ +static void SkPhyIsrBcom( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* Io Context */ +int Port, /* Port Num = PHY Num */ +SK_U16 IStatus) /* Interrupts masked with PHY-Mask */ +{ + SK_EVPARA Para; + + if (IStatus & PHY_B_IS_PSE) { + /* incorrectable pair swap error */ + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, SKERR_SIRQ_E022, + SKERR_SIRQ_E022MSG) ; + } + + if (IStatus & PHY_B_IS_MDXI_SC) { + /* not used */ + } + + if (IStatus & PHY_B_IS_HCT) { + /* not used */ + } + + if (IStatus & PHY_B_IS_LCT) { + /* not used */ + } + + if (IStatus & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) { + SkHWLinkDown(pAC, IoC, Port); + + /* Signal to RLMT */ + Para.Para32[0] = (SK_U32) Port; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + + /* Start workaround Errata #2 timer */ + SkTimerStart(pAC, IoC, &pAC->GIni.GP[Port].PWaTimer, + SK_WA_INA_TIME,SKGE_HWAC,SK_HWEV_WATIM,Para); + } + + if (IStatus & PHY_B_IS_NO_HDCL) { + /* not used */ + } + + if (IStatus & PHY_B_IS_NO_HDC) { + /* not used */ + } + + if (IStatus & PHY_B_IS_NEG_USHDC) { + /* not used */ + } + + if (IStatus & PHY_B_IS_SCR_S_ER) { + /* not used */ + } + + if (IStatus & PHY_B_IS_RRS_CHANGE) { + /* not used */ + } + + if (IStatus & PHY_B_IS_LRS_CHANGE) { + /* not used */ + } + + if (IStatus & PHY_B_IS_DUP_CHANGE) { + /* not used */ + } + + if (IStatus & PHY_B_IS_LSP_CHANGE) { + /* not used */ + } + + if (IStatus & PHY_B_IS_CRC_ER) { + /* not used */ + } + +} + + +/****************************************************************************** + * + * SkPhyIsrLone - PHY interrupt service routine + * + * Description: handle all interrupts from LONE PHY + * + * Returns: N/A + */ +static void SkPhyIsrLone( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* Io Context */ +int Port, /* Port Num = PHY Num */ +SK_U16 IStatus) /* Interrupts masked with PHY-Mask */ +{ + SK_EVPARA Para; + + if (IStatus & PHY_L_IS_CROSS) { + /* not used */ + } + + if (IStatus & PHY_L_IS_POL) { + /* not used */ + } + + if (IStatus & PHY_L_IS_SS) { + /* not used */ + } + + if (IStatus & PHY_L_IS_CFULL) { + /* not used */ + } + + if (IStatus & PHY_L_IS_AN_C) { + /* not used */ + } + + if (IStatus & PHY_L_IS_SPEED) { + /* not used */ + } + + if (IStatus & PHY_L_IS_CFULL) { + /* not used */ + } + + if (IStatus & (PHY_L_IS_DUP | PHY_L_IS_ISOL)) { + SkHWLinkDown(pAC, IoC, Port); + + /* Signal to RLMT */ + Para.Para32[0] = (SK_U32) Port; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + + /* Start workaround Errata #2 timer */ + SkTimerStart(pAC, IoC, &pAC->GIni.GP[Port].PWaTimer, + SK_WA_INA_TIME,SKGE_HWAC,SK_HWEV_WATIM,Para); + } + + if (IStatus & PHY_L_IS_MDINT) { + /* not used */ + } + +} + + +/* End of File */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/ski2c.c linux/drivers/net/sk98lin/ski2c.c --- v2.3.28/linux/drivers/net/sk98lin/ski2c.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/ski2c.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1181 @@ +/****************************************************************************** + * + * Name: ski2c.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.41 $ + * Date: $Date: 1999/09/14 14:11:30 $ + * Purpose: Funktions to access Voltage and Temperature Sensor + * (taken from Monalisa (taken from Concentrator)) + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: ski2c.c,v $ + * Revision 1.41 1999/09/14 14:11:30 malthoff + * The 1000BT Dual Link adapter has got only one Fan. + * The second Fan has been removed. + * + * Revision 1.40 1999/05/27 13:37:27 malthoff + * Set divisor of 1 for fan count calculation. + * + * Revision 1.39 1999/05/20 14:54:43 malthoff + * I2c.DummyReads is not used in Diagnostics. + * + * Revision 1.38 1999/05/20 09:20:56 cgoos + * Changes for 1000Base-T (up to 9 sensors and fans). + * + * Revision 1.37 1999/03/25 15:11:36 gklug + * fix: reset error flag if sensor reads correct value + * + * Revision 1.36 1999/01/07 14:11:16 gklug + * fix: break added + * + * Revision 1.35 1999/01/05 15:31:49 gklug + * fix: CLEAR STAT command is now added correctly + * + * Revision 1.34 1998/12/01 13:45:16 gklug + * fix: introduced Init level, because we don't need reinits + * + * Revision 1.33 1998/11/09 14:54:25 malthoff + * Modify I2C Transfer Timeout handling for Diagnostics. + * + * Revision 1.32 1998/11/03 06:54:35 gklug + * fix: Need dummy reads at the beginning to init sensors + * + * Revision 1.31 1998/11/03 06:42:42 gklug + * fix: select correctVIO range only if between warning levels + * + * Revision 1.30 1998/11/02 07:36:53 gklug + * fix: Error should not include WARNING message + * + * Revision 1.29 1998/10/30 15:07:43 malthoff + * Disable 'I2C does not compelete' error log for diagnostics. + * + * Revision 1.28 1998/10/22 09:48:11 gklug + * fix: SysKonnectFileId typo + * + * Revision 1.27 1998/10/20 09:59:46 gklug + * add: parameter to SkOsGetTime + * + * Revision 1.26 1998/10/09 06:10:59 malthoff + * Remove ID_sccs by SysKonnectFileId. + * + * Revision 1.25 1998/09/08 12:40:26 gklug + * fix: syntax error in if clause + * + * Revision 1.24 1998/09/08 12:19:42 gklug + * chg: INIT Level checking + * + * Revision 1.23 1998/09/08 07:37:20 gklug + * fix: log error if PCI_IO voltage sensor could not be initialized + * + * Revision 1.22 1998/09/04 08:30:03 malthoff + * Bugfixes during SK_DIAG testing: + * - correct NS2BCLK() macro + * - correct SkI2cSndDev() + * - correct SkI2cWait() loop waiting for an event + * + * Revision 1.21 1998/08/27 14:46:01 gklug + * chg: if-then-else replaced by switch + * + * Revision 1.20 1998/08/27 14:40:07 gklug + * test: integral types + * + * Revision 1.19 1998/08/25 07:51:54 gklug + * fix: typos for compiling + * + * Revision 1.18 1998/08/25 06:12:24 gklug + * add: count errors and warnings + * fix: check not the sensor state but the ErrFlag! + * + * Revision 1.17 1998/08/25 05:56:48 gklug + * add: CheckSensor function + * + * Revision 1.16 1998/08/20 11:41:10 gklug + * chg: omit STRCPY macro by using char * as Sensor Description + * + * Revision 1.15 1998/08/20 11:37:35 gklug + * chg: change Ioc to IoC + * + * Revision 1.14 1998/08/20 11:32:52 gklug + * fix: Para compile error + * + * Revision 1.13 1998/08/20 11:27:41 gklug + * fix: Compile bugs with new awrning constants + * + * Revision 1.12 1998/08/20 08:53:05 gklug + * fix: compiler errors + * add: Threshold values + * + * Revision 1.11 1998/08/19 12:39:22 malthoff + * Compiler Fix: Some names have changed. + * + * Revision 1.10 1998/08/19 12:20:56 gklug + * fix: remove struct from C files (see CCC) + * + * Revision 1.9 1998/08/19 06:28:46 malthoff + * SkOsGetTime returns SK_U64 now. + * + * Revision 1.8 1998/08/17 13:53:33 gklug + * fix: Parameter of event function and its result + * + * Revision 1.7 1998/08/17 07:02:15 malthoff + * Modify the functions for accessing the I2C SW Registers. + * Modify SkI2cWait(). + * Put Lm80RcvReg into sklm80.c + * Remove Compiler Errors. + * + * Revision 1.6 1998/08/14 07:13:20 malthoff + * remove pAc with pAC + * remove smc with pAC + * change names to new convention + * + * Revision 1.5 1998/08/14 06:24:49 gklug + * add: init level 1 and 2 + * + * Revision 1.4 1998/08/12 14:31:12 gklug + * add: error log for unknown event + * + * Revision 1.3 1998/08/12 13:37:04 gklug + * add: Init 0 function + * + * Revision 1.2 1998/08/11 07:27:15 gklug + * add: functions of the interface + * adapt rest of source to C coding Conventions + * rmv: unneccessary code taken from Mona Lisa + * + * Revision 1.1 1998/06/19 14:28:43 malthoff + * Created. Sources taken from ML Projekt. + * Sources have to be reworked for GE. + * + * + ******************************************************************************/ + + +/* + i2C Protocol +*/ +static const char SysKonnectFileId[] = + "$Id: ski2c.c,v 1.41 1999/09/14 14:11:30 malthoff Exp $" ; + +#include "h/skdrv1st.h" /* Driver Specific Definitions */ +#include "h/lm80.h" +#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ + +#ifdef __C2MAN__ +/* + I2C protocol implemetation. + + General Description: + + The I2C protocol is used for the temperature sensors and for + the serial EEPROM which hold the configuration. + + This file covers functions that allow to read write and do + some bulk requests a specified I2C address. + + The Genesis has 2 I2C busses. One for the EEPROM which holds + the VPD Data and one for temperature and voltage sensor. + The following picture shows the I2C busses, I2C devices and + there control registers. + + Note: The VPD functions are in skvpd.c +. +. PCI Config I2C Bus for VPD Data: +. +. +------------+ +. | VPD EEPROM | +. +------------+ +. | +. | <-- I2C +. | +. +-----------+-----------+ +. | | +. +-----------------+ +-----------------+ +. | PCI_VPD_ADR_REG | | PCI_VPD_DAT_REG | +. +-----------------+ +-----------------+ +. +. +. I2C Bus for LM80 sensor: +. +. +-----------------+ +. | Temperature and | +. | Voltage Sensor | +. | LM80 | +. +-----------------+ +. | +. | +. I2C --> | +. | +. +----+ +. +-------------->| OR |<--+ +. | +----+ | +. +------+------+ | +. | | | +. +--------+ +--------+ +----------+ +. | B2_I2C | | B2_I2C | | B2_I2C | +. | _CTRL | | _DATA | | _SW | +. +--------+ +--------+ +----------+ +. + The I2C bus may be driven by the B2_I2C_SW or by the B2_I2C_CTRL + and B2_I2C_DATA registers. + For driver software it is recommended to use the I2C control and + data register, because I2C bus timing is done by the ASIC and + an interrupt may be received when the I2C request is completed. + + Clock Rate Timing: MIN MAX generated by + VPD EEPROM: 50 kHz 100 kHz HW + LM80 over I2C Ctrl/Data reg. 50 kHz 100 kHz HW + LM80 over B2_I2C_SW register 0 400 kHz SW + + Note: The clock generated by the hardware is dependend on the + PCI clock. If the PCI bus clock is 33 MHz, the I2C/VPD + clock is 50 kHz. + */ +intro() +{} +#endif + +#ifdef SK_DIAG +/* + * I2C Fast Mode timing values used by the LM80. + * If new devices are added to the I2C bus the timing values have to be checked. + */ +#ifndef I2C_SLOW_TIMING +#define T_CLK_LOW 1300L /* clock low time in ns */ +#define T_CLK_HIGH 600L /* clock high time in ns */ +#define T_DATA_IN_SETUP 100L /* data in Set-UP Time */ +#define T_START_HOLD 600L /* start condition hold time */ +#define T_START_SETUP 600L /* start condition Set-up time */ +#define T_STOP_SETUP 600L /* stop condition Set-up time */ +#define T_BUS_IDLE 1300L /* time the bus must free after tx */ +#define T_CLK_2_DATA_OUT 900L /* max. clock low to data output valid */ +#else /* I2C_SLOW_TIMING */ +/* I2C Standard Mode Timing */ +#define T_CLK_LOW 4700L /* clock low time in ns */ +#define T_CLK_HIGH 4000L /* clock high time in ns */ +#define T_DATA_IN_SETUP 250L /* data in Set-UP Time */ +#define T_START_HOLD 4000L /* start condition hold time */ +#define T_START_SETUP 4700L /* start condition Set_up time */ +#define T_STOP_SETUP 4000L /* stop condition Set-up time */ +#define T_BUS_IDLE 4700L /* time the bus must free after tx */ +#endif /* !I2C_SLOW_TIMING */ + +#define NS2BCLK(x) (((x)*125)/10000) + +/* + * I2C Wire Operations + * + * About I2C_CLK_LOW(): + * + * The Data Direction bit (I2C_DATA_DIR) has to be set to input when setting + * clock to low, to prevent the ASIC and the I2C data client from driving the + * serial data line simultaneously (ASIC: last bit of a byte = '1', I2C client + * send an 'ACK'). See also Concentrator Bugreport No. 10192. + */ +#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC,I2C_DATA) +#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC,I2C_DATA) +#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC,I2C_DATA_DIR) +#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC,I2C_DATA_DIR|I2C_DATA) +#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC,I2C_CLK) +#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC,I2C_CLK|I2C_DATA_DIR) +#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC,I2C_CLK) + +#define NS2CLKT(x) ((x*125L)/10000) + +/*--------------- I2C Interface Register Functions --------------- */ + +/* + * sending one bit + */ +void SkI2cSndBit( +SK_IOC IoC, /* IoContext */ +SK_U8 Bit) /* Bit to send */ +{ + I2C_DATA_OUT(IoC) ; + if (Bit) { + I2C_DATA_HIGH(IoC); + } else { + I2C_DATA_LOW(IoC); + } + SkDgWaitTime(IoC,NS2BCLK(T_DATA_IN_SETUP)); + I2C_CLK_HIGH(IoC); + SkDgWaitTime(IoC,NS2BCLK(T_CLK_HIGH)); + I2C_CLK_LOW(IoC); +} + + + +/* + * Signal a start to the i2C Bus. + * + * A start is signaled when data goes to low in a high clock cycle. + * + * Ends with Clock Low. + * + * Status: not tested + */ +void SkI2cStart(SK_IOC IoC) /* I/O Context */ +{ + /* Init data and Clock to output lines */ + /* Set Data high */ + I2C_DATA_OUT(IoC) ; + I2C_DATA_HIGH(IoC) ; + /* Set Clock high */ + I2C_CLK_HIGH(IoC) ; + + SkDgWaitTime(IoC,NS2BCLK(T_START_SETUP)) ; + + /* Set Data Low */ + I2C_DATA_LOW(IoC) ; + + SkDgWaitTime(IoC,NS2BCLK(T_START_HOLD)) ; + + /* Clock low without Data to Input */ + I2C_START_COND(IoC) ; + + SkDgWaitTime(IoC,NS2BCLK(T_CLK_LOW)) ; +} + + +void SkI2cStop(SK_IOC IoC) /* I/O Context */ +{ + /* Init data and Clock to output lines */ + /* Set Data low */ + I2C_DATA_OUT(IoC) ; + I2C_DATA_LOW(IoC) ; + + SkDgWaitTime(IoC,NS2BCLK(T_CLK_2_DATA_OUT)) ; + + /* Set Clock high */ + I2C_CLK_HIGH(IoC) ; + + SkDgWaitTime(IoC,NS2BCLK(T_STOP_SETUP)) ; + + /* + * Set Data High: Do it by setting the Data Line to Input. + * Because of a pull up resistor the Data Line + * floods to high. + */ + I2C_DATA_IN(IoC) ; + + /* + * When I2C activity is stopped + * o DATA should be set to input and + * o CLOCK should be set to high! + */ + SkDgWaitTime(IoC,NS2BCLK(T_BUS_IDLE)) ; +} + +/* + * Receive just one bit via the i2C bus. + * + * Note: Clock must be set to LOW before calling this function. + * + * Returns The received bit. + */ +int SkI2cRcvBit(SK_IOC IoC) /* I/O Context */ +{ + int Bit; + SK_U8 I2cSwCtrl; + + /* Init data as input line */ + I2C_DATA_IN(IoC); + + SkDgWaitTime(IoC,NS2BCLK(T_CLK_2_DATA_OUT)) ; + + I2C_CLK_HIGH(IoC); + + SkDgWaitTime(IoC,NS2BCLK(T_CLK_HIGH)) ; + + SK_I2C_GET_SW(IoC,&I2cSwCtrl) ; + if (I2cSwCtrl & I2C_DATA) { + Bit = 1; + } else { + Bit = 0; + } + + I2C_CLK_LOW(IoC); + SkDgWaitTime(IoC,NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT)) ; + + return(Bit); +} + +/* + * Receive an ACK. + * + * returns 0 If acknoledged + * 1 in case of an error + */ +int SkI2cRcvAck(SK_IOC IoC) /* I/O Context */ +{ + /* + * Received bit must be zero. + */ + return (SkI2cRcvBit(IoC) != 0) ; +} + +/* + * Send an NACK. + */ +void SkI2cSndNAck(SK_IOC IoC) /* I/O Context */ +{ + /* + * Received bit must be zero. + */ + SkI2cSndBit(IoC,1) ; +} + +/* + * Send an ACK. + */ +void SkI2cSndAck(SK_IOC IoC) /* I/O Context */ +{ + /* + * Received bit must be zero. + * + */ + SkI2cSndBit(IoC,0) ; +} + +/* + * Send one byte to the i2C device and wait for ACK. + * + * Return acknoleged status. + */ +int SkI2cSndByte( +SK_IOC IoC, /* I/O Context */ +int Byte) /* byte to send */ +{ + int i; + + for (i=0; i<8; i++) { + if (Byte & (1<<(7-i))) { + SkI2cSndBit(IoC,1) ; + } else { + SkI2cSndBit(IoC,0) ; + } + } + + return(SkI2cRcvAck(IoC)) ; +} + + +/* + * Receive one byte and ack it. + * + * Return byte. + */ +int SkI2cRcvByte( +SK_IOC IoC, /* I/O Context */ +int Last) /* Last Byte Flag */ +{ + int i; + int Byte = 0; + + for (i=0; i<8; i++) { + Byte <<= 1 ; + Byte |= SkI2cRcvBit(IoC) ; + } + + if (Last) { + SkI2cSndNAck(IoC) ; + } else { + SkI2cSndAck(IoC) ; + } + + return(Byte) ; +} + + +/* + * Start dialog and send device address + * + * Return 0 if acknoleged, 1 in case of an error + */ +int SkI2cSndDev( +SK_IOC IoC, /* I/O Context */ +int Addr, /* Device Address */ +int Rw) /* Read / Write Flag */ +{ + SkI2cStart(IoC) ; + Rw = ~Rw ; + Rw &= I2C_WRITE ; + return(SkI2cSndByte(IoC, (Addr<<1) | Rw)) ; +} + +#endif /* SK_DIAG */ + +/*----------------- I2C CTRL Register Functions ----------*/ + +/* + * waits for a completetion of a I2C transfer + * + * returns 0: success, transfer completes + * 1: error, transfer does not complete, I2C transfer + * killed, wait loop terminated. + */ +int SkI2cWait( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* IoContext */ +int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ +{ + SK_U64 StartTime ; + SK_U32 I2cCtrl ; + + StartTime = SkOsGetTime(pAC) ; + do { + if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC/16) { + SK_I2C_STOP(IoC) ; +#ifndef SK_DIAG + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, + SKERR_I2C_E002MSG) ; +#endif /* !SK_DIAG */ + return(1) ; + } + SK_I2C_GET_CTL(IoC,&I2cCtrl) ; + } while((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31) ; + + return(0) ; +} + +#ifdef SK_DIAG +/* + * writes a single byte or 4 bytes into the I2C device + * + * returns 0: success + * 1: error + */ +int SkI2cWrite( +SK_AC *pAC, /* Adapter Context */ +SK_U32 I2cData, /* I2C Data to write */ +int I2cDev, /* I2C Device Address */ +int I2cReg, /* I2C Device Register Address */ +int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ +{ + SK_OUT32(pAC,B2_I2C_DATA,I2cData) ; + SK_I2C_CTL(pAC,I2C_WRITE,I2cDev,I2cReg,I2cBurst); + return(SkI2cWait(pAC,pAC,I2C_WRITE)) ; +} + +/* + * reads a single byte or 4 bytes from the I2C device + * + * returns the word read + */ +SK_U32 SkI2cRead( +SK_AC *pAC, /* Adapter Context */ +int I2cDev, /* I2C Device Address */ +int I2cReg, /* I2C Device Register Address */ +int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ +{ + SK_U32 Data ; + + SK_OUT32(pAC,B2_I2C_DATA,0) ; + SK_I2C_CTL(pAC,I2C_READ,I2cDev,I2cReg,I2cBurst); + if (SkI2cWait(pAC,pAC,I2C_READ)) { + w_print("I2c Transfer Timeout!\n"); + } + SK_IN32(pAC,B2_I2C_DATA,&Data) ; + return(Data) ; +} +#endif /* SK_DIAG */ + +/* + * read a sensors value + * + * This function read a sensors value from the I2c sensor chip. The sensor + * is defined by its index into the sensors database in the struct pAC points + * to. + * Returns 1 if the read is completed + * 0 if the read must be continued (I2c Bus still allocated) + */ +int SkI2cReadSensor( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* IoContext */ +SK_SENSOR *pSen) /* Sensor to be read */ +{ + return((*pSen->SenRead)(pAC,IoC,pSen)) ; +} + +/* + * Do the Init state 0 initialization + */ +static int SkI2cInit0( +SK_AC *pAC) /* Adapter Context */ +{ + int i; + + /* Begin with first sensor */ + pAC->I2c.CurrSens = 0; + + /* Set to mimimum sensor number */ + pAC->I2c.MaxSens = SK_MIN_SENSORS; + +#ifndef SK_DIAG + /* Initialize Number of Dummy Reads */ + pAC->I2c.DummyReads = SK_MAX_SENSORS; +#endif + + for (i=0; i < SK_MAX_SENSORS; i ++) { + switch (i) { + case 0: + pAC->I2c.SenTable[i].SenDesc = "Temperature" ; + pAC->I2c.SenTable[i].SenType = SK_SEN_TEMP; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH0; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW0; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH0; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW0; + pAC->I2c.SenTable[i].SenReg = LM80_TEMP_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + case 1: + pAC->I2c.SenTable[i].SenDesc = "Voltage PCI"; + pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH1; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW1; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH1; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW1; + pAC->I2c.SenTable[i].SenReg = LM80_VT0_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + case 2: + pAC->I2c.SenTable[i].SenDesc = "Voltage PCI-IO"; + pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH2; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW2; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH2; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW2; + pAC->I2c.SenTable[i].SenReg = LM80_VT1_IN; + pAC->I2c.SenTable[i].SenInit = SK_FALSE; + break; + case 3: + pAC->I2c.SenTable[i].SenDesc = "Voltage ASIC"; + pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH3; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW3; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH3; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW3; + pAC->I2c.SenTable[i].SenReg = LM80_VT2_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + case 4: + pAC->I2c.SenTable[i].SenDesc = "Voltage PMA"; + pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH4; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW4; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH4; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW4; + pAC->I2c.SenTable[i].SenReg = LM80_VT3_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + case 5: + pAC->I2c.SenTable[i].SenDesc = "Voltage PHY 2V5"; + pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH5; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW5; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH5; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW5; + pAC->I2c.SenTable[i].SenReg = LM80_VT4_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + case 6: + pAC->I2c.SenTable[i].SenDesc = "Voltage PHY B PLL"; + pAC->I2c.SenTable[i].SenType = SK_SEN_VOLT; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH6; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW6; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH6; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW6; + pAC->I2c.SenTable[i].SenReg = LM80_VT5_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + case 7: + pAC->I2c.SenTable[i].SenDesc = "Speed Fan"; + pAC->I2c.SenTable[i].SenType = SK_SEN_FAN; + pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH; + pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW; + pAC->I2c.SenTable[i].SenThreWarnHigh = SK_SEN_WARNHIGH; + pAC->I2c.SenTable[i].SenThreWarnLow = SK_SEN_WARNLOW; + pAC->I2c.SenTable[i].SenReg = LM80_FAN2_IN; + pAC->I2c.SenTable[i].SenInit = SK_TRUE; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_INIT | SK_ERRCL_SW, + SKERR_I2C_E001, SKERR_I2C_E001MSG); + break; + } + + pAC->I2c.SenTable[i].SenValue = 0; + pAC->I2c.SenTable[i].SenErrFlag = SK_SEN_ERR_OK; + pAC->I2c.SenTable[i].SenErrCts = 0; + pAC->I2c.SenTable[i].SenBegErrTS = 0; + pAC->I2c.SenTable[i].SenState = SK_SEN_IDLE; + pAC->I2c.SenTable[i].SenRead = SkLm80ReadSensor; + pAC->I2c.SenTable[i].SenDev = LM80_ADDR; + } + + /* Now we are INIT dataed */ + pAC->I2c.InitLevel = SK_INIT_DATA; + return(0); +} + +/* + * Do the init state 1 initialization + * + * initialize the following register of the LM80: + * Configuration register: + * - START, noINT, activeLOW, noINT#Clear, noRESET, noCI, noGPO#, noINIT + * + * Interrupt Mask Register 1: + * - all interrupts are Disabled (0xff) + * + * Interrupt Mask Register 2: + * - all interrupts are Disabled (0xff) Interrupt modi doesn't matter. + * + * Fan Divisor/RST_OUT register: + * - Divisors set to 1 (bits 00), all others 0s. + * + * OS# Configuration/Temperature resolution Register: + * - all 0s + * + */ +static int SkI2cInit1( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC) /* IoContext needed in level 1 */ +{ + if (pAC->I2c.InitLevel != SK_INIT_DATA) { + /* ReInit not needed in I2C module */ + return(0); + } + + SK_OUT32(IoC, B2_I2C_DATA, 0); + SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_CFG, 0); + (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + + SK_OUT32(IoC, B2_I2C_DATA, 0xff); + SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_IMSK_1, 0); + (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + + SK_OUT32(IoC, B2_I2C_DATA, 0xff); + SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_IMSK_2, 0); + (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + + SK_OUT32(IoC, B2_I2C_DATA, 0x0); + SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_FAN_CTRL, 0); + (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + + SK_OUT32(IoC, B2_I2C_DATA, 0); + SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_TEMP_CTRL, 0); + (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + + SK_OUT32(IoC, B2_I2C_DATA, LM80_CFG_START); + SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_CFG, 0); + (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + + /* + * MaxSens has to be initialized here, because PhyType is not + * set when performing Init Level 1 + */ + switch (pAC->GIni.GP[0].PhyType) { + case SK_PHY_XMAC: + pAC->I2c.MaxSens = 5; + break; + case SK_PHY_BCOM: + pAC->I2c.SenTable[4].SenDesc = "Voltage PHY A PLL"; + if (pAC->GIni.GIMacsFound == 1) { + pAC->I2c.MaxSens = 6; + } + else { + pAC->I2c.MaxSens = 8; + } + break; + case SK_PHY_LONE: + pAC->I2c.MaxSens = 5; + break; + } + +#ifndef SK_DIAG + pAC->I2c.DummyReads = pAC->I2c.MaxSens; +#endif /* !SK_DIAG */ + + /* Now we are IO initialized */ + pAC->I2c.InitLevel = SK_INIT_IO; + return(0); +} + +/* + * Init level 2: Start first sensors read + */ +static int SkI2cInit2( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC) /* IoContext needed in level 1 */ +{ + int ReadComplete; + SK_SENSOR *pSen; + + if (pAC->I2c.InitLevel != SK_INIT_IO) { + /* ReInit not needed in I2C module */ + /* Init0 and Init2 not permitted */ + return(0); + } + + pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens]; + ReadComplete = SkI2cReadSensor(pAC,IoC,pSen); + + if (ReadComplete) { + SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, + SKERR_I2C_E008MSG); + } + + /* Now we are correctly initialized */ + pAC->I2c.InitLevel = SK_INIT_RUN; + + return(0); +} + +/* + * Initialize I2C devices + * + * Get the first voltage value and discard it. + * Go into temperature read mode. A default pointer is not set. + * + * The things to be done depend on the init level in the parameter list: + * Level 0: + * Initialize only the data structures. Do NOT access hardware. + * Level 1: + * Initialize hardware through SK_IN?OUT commands. Do NOT use interrupts. + * Level 2: + * Everything is possible. Interrupts may be used from now on. + * + * return: 0 = success + * other = error. + */ +int SkI2cInit( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* IoContext needed in level 1 */ +int Level) /* Init Level */ +{ + + switch (Level) { + case SK_INIT_DATA: + return(SkI2cInit0(pAC)) ; + case SK_INIT_IO: + return(SkI2cInit1(pAC, IoC)) ; + case SK_INIT_RUN: + return(SkI2cInit2(pAC, IoC)) ; + default: + break; + } + + return(0) ; +} + +#ifndef SK_DIAG +/* + * Interrupt service function for the I2c Interface + * + * Clears the Interrupt source + * + * Reads the register and check it for sending a trap. + * + * Starts the timer if necessary. + */ +void SkI2cIsr( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC) /* Io Context */ +{ + SK_EVPARA Para; + + /* Clear the interrupt source */ + SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ) ; + + Para.Para64 = 0; + SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_IRQ, Para); +} + +/* + * Check this sensors Value against the threshold and send events. + */ +static void SkI2cCheckSensor( +SK_AC *pAC, /* Adapters context */ +SK_SENSOR *pSen) +{ + SK_EVPARA ParaLocal; + SK_BOOL TooHigh; /* Is sensor too high? */ + SK_BOOL TooLow; /* Is sensor too low? */ + SK_U64 CurrTime; /* current Time */ + SK_BOOL DoTrapSend; /* We need to send a trap */ + SK_BOOL DoErrLog; /* We need to log the error */ + SK_BOOL IsError; /* We need to log the error */ + + /* Check Dummy Reads first */ + if (pAC->I2c.DummyReads > 0) { + pAC->I2c.DummyReads -- ; + return; + } + + /* Get the current time */ + CurrTime = SkOsGetTime(pAC) ; + + /* Set para to the most usefull setting: + * The current sensor. + */ + ParaLocal.Para64 = (SK_U64) pAC->I2c.CurrSens; + + /* Check the Value against the thresholds */ + /* First: Error Thresholds */ + TooHigh = (pSen->SenValue > pSen->SenThreErrHigh) ; + TooLow = (pSen->SenValue < pSen->SenThreErrLow) ; + + IsError = SK_FALSE ; + if (TooHigh || TooLow) { + /* Error condition is satiesfied */ + DoTrapSend = SK_TRUE; + DoErrLog = SK_TRUE; + + /* Now error condition is satisfied */ + IsError = SK_TRUE ; + + if (pSen->SenErrFlag == SK_SEN_ERR_ERR) { + /* This state is the former one */ + + /* So check first whether we have to send a trap */ + if (pSen->SenLastErrTrapTS + SK_SEN_ERR_TR_HOLD > + CurrTime) { + /* + * Do NOT send the Trap. The hold back time + * has to run out first. + */ + DoTrapSend = SK_FALSE; + } + + /* Check now whether we have to log an Error */ + if (pSen->SenLastErrLogTS + SK_SEN_ERR_LOG_HOLD > + CurrTime) { + /* + * Do NOT log the error. The hold back time + * has to run out first. + */ + DoErrLog = SK_FALSE; + } + } else { + /* We came from a different state */ + /* -> Set Begin Time Stamp */ + pSen->SenBegErrTS = CurrTime; + pSen->SenErrFlag = SK_SEN_ERR_ERR ; + } + + if (DoTrapSend) { + /* Set current Time */ + pSen->SenLastErrTrapTS = CurrTime; + pSen->SenErrCts ++; + + /* Queue PNMI Event */ + SkEventQueue(pAC, SKGE_PNMI, (TooHigh ? + SK_PNMI_EVT_SEN_ERR_UPP : + SK_PNMI_EVT_SEN_ERR_LOW), + ParaLocal) ; + } + + if (DoErrLog) { + /* Set current Time */ + pSen->SenLastErrLogTS = CurrTime; + + if (pSen->SenType == SK_SEN_TEMP) { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E011, + SKERR_I2C_E011MSG); + } else if (pSen->SenType == SK_SEN_VOLT) { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E012, + SKERR_I2C_E012MSG); + } else + { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E015, + SKERR_I2C_E015MSG); + } + } + } + + /* Check the Value against the thresholds */ + /* 2nd: Warning thresholds */ + TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh) ; + TooLow = (pSen->SenValue < pSen->SenThreWarnLow) ; + + + if (!IsError && (TooHigh || TooLow)) { + /* Error condition is satiesfied */ + DoTrapSend = SK_TRUE; + DoErrLog = SK_TRUE; + + if (pSen->SenErrFlag == SK_SEN_ERR_WARN) { + /* This state is the former one */ + + /* So check first whether we have to send a trap */ + if (pSen->SenLastWarnTrapTS + SK_SEN_WARN_TR_HOLD > + CurrTime) { + /* + * Do NOT send the Trap. The hold back time + * has to run out first. + */ + DoTrapSend = SK_FALSE; + } + + /* Check now whether we have to log an Error */ + if (pSen->SenLastWarnLogTS + SK_SEN_WARN_LOG_HOLD > + CurrTime) { + /* + * Do NOT log the error. The hold back time + * has to run out first. + */ + DoErrLog = SK_FALSE; + } + } else { + /* We came from a different state */ + /* -> Set Begin Time Stamp */ + pSen->SenBegWarnTS = CurrTime; + pSen->SenErrFlag = SK_SEN_ERR_WARN ; + } + + if (DoTrapSend) { + /* Set current Time */ + pSen->SenLastWarnTrapTS = CurrTime; + pSen->SenWarnCts ++; + + /* Queue PNMI Event */ + SkEventQueue(pAC, SKGE_PNMI, (TooHigh ? + SK_PNMI_EVT_SEN_WAR_UPP : + SK_PNMI_EVT_SEN_WAR_LOW), + ParaLocal) ; + } + + if (DoErrLog) { + /* Set current Time */ + pSen->SenLastWarnLogTS = CurrTime; + + if (pSen->SenType == SK_SEN_TEMP) { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, + SKERR_I2C_E009MSG); + } else if (pSen->SenType == SK_SEN_VOLT) { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, + SKERR_I2C_E009MSG); + } else + { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014, + SKERR_I2C_E014MSG); + } + } + } + + /* Check for NO error at all */ + if (!IsError && !TooHigh && !TooLow) { + /* Set o.k. Status if no error and no warning condition */ + pSen->SenErrFlag = SK_SEN_ERR_OK ; + } + + /* End of check against the thresholds */ + + /* + * Check initialization state: + * The VIO Thresholds need adaption + */ + if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN && + pSen->SenValue > SK_SEN_WARNLOW2C && + pSen->SenValue < SK_SEN_WARNHIGH2) { + pSen->SenThreErrLow = SK_SEN_ERRLOW2C; + pSen->SenThreWarnLow = SK_SEN_WARNLOW2C; + pSen->SenInit = SK_TRUE; + } + + if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN && + pSen->SenValue > SK_SEN_WARNLOW2 && + pSen->SenValue < SK_SEN_WARNHIGH2C) { + pSen->SenThreErrHigh = SK_SEN_ERRHIGH2C; + pSen->SenThreWarnHigh = SK_SEN_WARNHIGH2C; + pSen->SenInit = SK_TRUE; + } + + if (!pSen->SenInit) { + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG); + } +} + +/* + * The only Event to be served is the timeout event + * + */ +int SkI2cEvent( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* Io Context */ +SK_U32 Event, /* Module specific Event */ +SK_EVPARA Para) /* Event specific Parameter */ +{ + int ReadComplete; + SK_SENSOR *pSen; + SK_U32 Time; + SK_EVPARA ParaLocal; + int i; + + switch (Event) { + case SK_I2CEV_IRQ: + case SK_I2CEV_TIM: + pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens]; + ReadComplete = SkI2cReadSensor(pAC, IoC, pSen); + + if (ReadComplete) { + /* Check sensor against defined thresholds */ + SkI2cCheckSensor (pAC, pSen) ; + + /* Increment Current and set appropriate Timeout */ + Time = SK_I2C_TIM_SHORT; + + pAC->I2c.CurrSens ++; + if (pAC->I2c.CurrSens == pAC->I2c.MaxSens) { + pAC->I2c.CurrSens = 0; + Time = SK_I2C_TIM_LONG; + } + + /* Start Timer */ + ParaLocal.Para64 = (SK_U64) 0; + SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time, + SKGE_I2C, SK_I2CEV_TIM, ParaLocal) ; + } + break; + case SK_I2CEV_CLEAR: + for (i=0; i < SK_MAX_SENSORS; i ++) { + pAC->I2c.SenTable[i].SenErrFlag = SK_SEN_ERR_OK; + pAC->I2c.SenTable[i].SenErrCts = 0; + pAC->I2c.SenTable[i].SenWarnCts = 0; + pAC->I2c.SenTable[i].SenBegErrTS = 0; + pAC->I2c.SenTable[i].SenBegWarnTS = 0; + pAC->I2c.SenTable[i].SenLastErrTrapTS = (SK_U64) 0; + pAC->I2c.SenTable[i].SenLastErrLogTS = (SK_U64) 0; + pAC->I2c.SenTable[i].SenLastWarnTrapTS = (SK_U64) 0; + pAC->I2c.SenTable[i].SenLastWarnLogTS = (SK_U64) 0; + } + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E006, SKERR_I2C_E006MSG); + } + + return(0); +} +#endif /* !SK_DIAG */ +/* End of File */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/sklm80.c linux/drivers/net/sk98lin/sklm80.c --- v2.3.28/linux/drivers/net/sk98lin/sklm80.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/sklm80.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,270 @@ +/****************************************************************************** + * + * Name: sklm80.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.16 $ + * Date: $Date: 1999/05/27 14:05:47 $ + * Purpose: Funktions to access Voltage and Temperature Sensor (LM80) + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: sklm80.c,v $ + * Revision 1.16 1999/05/27 14:05:47 malthoff + * Fans: Set SenVal to 0 if the fan value is 0 or 0xff. Both values + * are outside the limits (0: div zero error, 0xff: value not in + * range, assume 0). + * + * Revision 1.15 1999/05/27 13:38:51 malthoff + * Pervent from Division by zero errors. + * + * Revision 1.14 1999/05/20 09:20:01 cgoos + * Changes for 1000Base-T (Fan sensors). + * + * Revision 1.13 1998/10/22 09:48:14 gklug + * fix: SysKonnectFileId typo + * + * Revision 1.12 1998/10/09 06:12:06 malthoff + * Remove ID_sccs by SysKonnectFileId. + * + * Revision 1.11 1998/09/04 08:33:48 malthoff + * bug fix: SenState = SK_SEN_IDLE when + * leaving SK_SEN_VALEXT state + * + * Revision 1.10 1998/08/20 12:02:10 gklug + * fix: compiler warnings type mismatch + * + * Revision 1.9 1998/08/20 11:37:38 gklug + * chg: change Ioc to IoC + * + * Revision 1.8 1998/08/19 12:20:58 gklug + * fix: remove struct from C files (see CCC) + * + * Revision 1.7 1998/08/17 07:04:57 malthoff + * Take SkLm80RcvReg() function from ski2c.c. + * Add IoC parameter to BREAK_OR_WAIT() macro. + * + * Revision 1.6 1998/08/14 07:11:28 malthoff + * remove pAc with pAC. + * + * Revision 1.5 1998/08/14 06:46:55 gklug + * fix: temperature can get negative + * + * Revision 1.4 1998/08/13 08:27:04 gklug + * add: temperature reading now o.k. + * fix: pSen declaration, SK_ERR_LOG call, ADDR macro + * + * Revision 1.3 1998/08/13 07:28:21 gklug + * fix: pSen was wrong initialized + * add: correct conversion for voltage readings + * + * Revision 1.2 1998/08/11 07:52:14 gklug + * add: Lm80 read sensor function + * + * Revision 1.1 1998/07/17 09:57:12 gklug + * initial version + * + * + * + ******************************************************************************/ + + +/* + LM80 functions +*/ +static const char SysKonnectFileId[] = + "$Id: sklm80.c,v 1.16 1999/05/27 14:05:47 malthoff Exp $" ; + +#include "h/skdrv1st.h" /* Driver Specific Definitions */ +#include "h/lm80.h" +#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ + +#ifdef SK_DIAG +#define BREAK_OR_WAIT(pAC,IoC,Event) SkI2cWait(pAC,IoC,Event) +#else /* nSK_DIAG */ +#define BREAK_OR_WAIT(pAC,IoC,Event) break +#endif /* nSK_DIAG */ + +#ifdef SK_DIAG +/* + * read the regeister 'reg' from the device 'device' + * + * return read error -1 + * success the read value + */ +int SkLm80RcvReg( +SK_IOC IoC, /* Adapter Context */ +int Dev, /* I2C device address */ +int Reg) /* register to read */ +{ + int Val = 0; + int TempExt; + + /* Signal device number */ + if (SkI2cSndDev(IoC, Dev, I2C_WRITE)) { + return(-1); + } + + if (SkI2cSndByte(IoC, Reg)) { + return(-1); + } + + /* repeat start */ + if (SkI2cSndDev(IoC, Dev, I2C_READ)) { + return(-1); + } + + switch(Reg) { + case LM80_TEMP_IN: + Val = (int)SkI2cRcvByte(IoC, 1) ; + + /* First: correct the value: it might be negative */ + if ((Val & 0x80) != 0) { + /* Value is negative */ + Val = Val - 256; + } + Val = Val * SK_LM80_TEMP_LSB; + SkI2cStop(IoC); + TempExt = (int) SkLm80RcvReg(IoC,LM80_ADDR,LM80_TEMP_CTRL); + if (Val > 0) { + Val += ((TempExt >> 7) * SK_LM80_TEMPEXT_LSB); + } + else { + Val -= ((TempExt >> 7) * SK_LM80_TEMPEXT_LSB); + } + return(Val); + break; + case LM80_VT0_IN: + case LM80_VT1_IN: + case LM80_VT2_IN: + case LM80_VT3_IN: + Val = (int) SkI2cRcvByte(IoC, 1) * SK_LM80_VT_LSB; + break; + default: + Val = (int) SkI2cRcvByte(IoC, 1); + break; + } + + SkI2cStop(IoC); + return(Val); +} +#endif /* SK_DIAG */ + +/* + * read a sensors value (LM80 specific) + * + * This function reads a sensors value from the I2c sensor chip LM80. The + * sensor is defined by its index into the sensors database in the struct + * pAC points to. + * + * Returns 1 if the read is completed + * 0 if the read must be continued (I2c Bus still allocated) + */ +int SkLm80ReadSensor( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* IoContext needed in level 1 and 2 */ +SK_SENSOR *pSen) /* Sensor to be read */ +{ + SK_I32 Value; + + switch(pSen->SenState) { + case SK_SEN_IDLE: + /* Send address to ADDR register */ + SK_I2C_CTL(IoC,I2C_READ,pSen->SenDev,pSen->SenReg,0); + + pSen->SenState = SK_SEN_VALUE ; + BREAK_OR_WAIT(pAC, IoC, I2C_READ) ; + case SK_SEN_VALUE: + /* Read value from data register */ + SK_IN32(IoC,B2_I2C_DATA, ((SK_U32 *)&Value)); + Value &= 0xff; /* only least significant byte is valid */ + + /* Do NOT check the Value against the thresholds */ + /* Checking is done in the calling instance */ + + if (pSen->SenType == SK_SEN_VOLT) { + /* Voltage sensor */ + pSen->SenValue = Value * SK_LM80_VT_LSB; + pSen->SenState = SK_SEN_IDLE ; + return(1); + } + + if (pSen->SenType == SK_SEN_FAN) { + if (Value != 0 && Value != 0xff) { + /* Fan speed counter */ + pSen->SenValue = SK_LM80_FAN_FAKTOR/Value; + } + else { + /* Indicate Fan error */ + pSen->SenValue = 0; + } + pSen->SenState = SK_SEN_IDLE ; + return(1); + } + + /* First: correct the value: it might be negative */ + if ((Value & 0x80) != 0) { + /* Value is negative */ + Value = Value - 256; + } + + /* We have a temperature sensor and need to get the signed + * extension. For now we get the extension from the last + * reading, so in the normal case we won't see flickering + * temperatures. + */ + pSen->SenValue = (Value * SK_LM80_TEMP_LSB) + + (pSen->SenValue % SK_LM80_TEMP_LSB); + + /* Send address to ADDR register */ + SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, LM80_TEMP_CTRL, 0); + + pSen->SenState = SK_SEN_VALEXT ; + BREAK_OR_WAIT(pAC, IoC, I2C_READ) ; + case SK_SEN_VALEXT: + /* Read value from data register */ + SK_IN32(IoC,B2_I2C_DATA,((SK_U32 *)&Value)); + Value &= LM80_TEMP_LSB_9; /* only bit 7 is valid */ + + /* cut the LSB bit */ + pSen->SenValue = ((pSen->SenValue / SK_LM80_TEMP_LSB) * + SK_LM80_TEMP_LSB) ; + + if (pSen->SenValue < 0) { + /* Value negative: The bit value must be subtracted */ + pSen->SenValue -= ((Value >> 7) * SK_LM80_TEMPEXT_LSB); + } else { + /* Value positive: The bit value must be added */ + pSen->SenValue += ((Value >> 7) * SK_LM80_TEMPEXT_LSB); + } + + pSen->SenState = SK_SEN_IDLE ; + return(1); + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E007, + SKERR_I2C_E007MSG) ; + return(1); + } + + /* Not completed */ + return(0) ; +} diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skqueue.c linux/drivers/net/sk98lin/skqueue.c --- v2.3.28/linux/drivers/net/sk98lin/skqueue.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skqueue.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,204 @@ +/****************************************************************************** + * + * Name: skqueue.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.14 $ + * Date: $Date: 1998/10/15 15:11:35 $ + * Purpose: Management of an event queue. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skqueue.c,v $ + * Revision 1.14 1998/10/15 15:11:35 gklug + * fix: ID_sccs to SysKonnectFileId + * + * Revision 1.13 1998/09/08 08:47:52 gklug + * add: init level handling + * + * Revision 1.12 1998/09/08 07:43:20 gklug + * fix: Sirq Event function name + * + * Revision 1.11 1998/09/08 05:54:34 gklug + * chg: define SK_CSUM is replaced by SK_USE_CSUM + * + * Revision 1.10 1998/09/03 14:14:49 gklug + * add: CSUM and HWAC Eventclass and function. + * + * Revision 1.9 1998/08/19 09:50:50 gklug + * fix: remove struct keyword from c-code (see CCC) add typedefs + * + * Revision 1.8 1998/08/17 13:43:11 gklug + * chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR + * + * Revision 1.7 1998/08/14 07:09:11 gklug + * fix: chg pAc -> pAC + * + * Revision 1.6 1998/08/11 12:13:14 gklug + * add: return code feature of Event service routines + * add: correct Error log calls + * + * Revision 1.5 1998/08/07 12:53:45 gklug + * fix: first compiled version + * + * Revision 1.4 1998/08/07 09:20:48 gklug + * adapt functions to C coding conventions. + * + * Revision 1.3 1998/08/05 11:29:32 gklug + * rmv: Timer event entry. Timer will queue event directly + * + * Revision 1.2 1998/07/31 11:22:40 gklug + * Initial version + * + * Revision 1.1 1998/07/30 15:14:01 gklug + * Initial version. Adapted from SMT + * + * + * + ******************************************************************************/ + + +/* + Event queue and dispatcher +*/ +static const char SysKonnectFileId[] = + "$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.14 1998/10/15 15:11:35 gklug Exp $" ; + +#include "h/skdrv1st.h" /* Driver Specific Definitions */ +#include "h/skqueue.h" /* Queue Definitions */ +#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ + +#ifdef __C2MAN__ +/* + Event queue management. + + General Description: + + */ +intro() +{} +#endif + +#define PRINTF(a,b,c) + +/* + * init event queue management + * + * Must be called during init level 0. + */ +void SkEventInit( +SK_AC *pAC, /* Adapter context */ +SK_IOC Ioc, /* IO context */ +int Level) /* Init level */ +{ + switch (Level) { + case SK_INIT_DATA: + pAC->Event.EvPut = pAC->Event.EvGet = pAC->Event.EvQueue ; + break; + default: + break; + } +} + +/* + * add event to queue + */ +void SkEventQueue( +SK_AC *pAC, /* Adapters context */ +SK_U32 Class, /* Event Class */ +SK_U32 Event, /* Event to be queued */ +SK_EVPARA Para) /* Event parameter */ +{ + pAC->Event.EvPut->Class = Class ; + pAC->Event.EvPut->Event = Event ; + pAC->Event.EvPut->Para = Para ; + if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT]) + pAC->Event.EvPut = pAC->Event.EvQueue ; + + if (pAC->Event.EvPut == pAC->Event.EvGet) { + SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG) ; + } +} + +/* + * event dispatcher + * while event queue is not empty + * get event from queue + * send command to state machine + * end + * return error reported by individual Event function + * 0 if no error occured. + */ +int SkEventDispatcher( +SK_AC *pAC, /* Adapters Context */ +SK_IOC Ioc) /* Io context */ +{ + SK_EVENTELEM *pEv ; /* pointer into queue */ + SK_U32 Class ; + int Rtv ; + + pEv = pAC->Event.EvGet ; + PRINTF("dispatch get %x put %x\n",pEv,pAC->Event.ev_put) ; + while (pEv != pAC->Event.EvPut) { + PRINTF("dispatch Class %d Event %d\n",pEv->Class,pEv->Event) ; + switch(Class = pEv->Class) { + case SKGE_DRV : /* Driver Event */ + Rtv = SkDrvEvent(pAC,Ioc,pEv->Event,pEv->Para); + break ; + case SKGE_RLMT : /* RLMT Event */ + Rtv = SkRlmtEvent(pAC,Ioc,pEv->Event,pEv->Para); + break ; + case SKGE_I2C : /* I2C Event */ + Rtv = SkI2cEvent(pAC,Ioc,pEv->Event,pEv->Para); + break ; + case SKGE_PNMI : + Rtv = SkPnmiEvent(pAC,Ioc,pEv->Event,pEv->Para); + break ; + case SKGE_HWAC : + Rtv = SkGeSirqEvent(pAC,Ioc,pEv->Event,pEv->Para); + break ; +#ifdef SK_USE_CSUM + case SKGE_CSUM : + Rtv = SkCsEvent(pAC,Ioc,pEv->Event,pEv->Para); + break ; +#endif /* SK_USE_CSUM */ + default : + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E002, + SKERR_Q_E002MSG) ; + Rtv = 0; + } + + if (Rtv != 0) { + return(Rtv) ; + } + + if (++pEv == &pAC->Event.EvQueue[SK_MAX_EVENT]) + pEv = pAC->Event.EvQueue ; + + /* Renew get: it is used in queue_events to detect overruns */ + pAC->Event.EvGet = pEv; + } + + return(0) ; +} + +/* End of file */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skrlmt.c linux/drivers/net/sk98lin/skrlmt.c --- v2.3.28/linux/drivers/net/sk98lin/skrlmt.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skrlmt.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,3423 @@ +/****************************************************************************** + * + * Name: skrlmt.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.48 $ + * Date: $Date: 1999/10/04 14:01:17 $ + * Purpose: Manage links on SK-NET Adapters, esp. redundant ones. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skrlmt.c,v $ + * Revision 1.48 1999/10/04 14:01:17 rassmann + * Corrected reaction to reception of BPDU frames. + * Added parameter descriptions to "For Readme" section skrlmt.txt. + * Clarified usage of lookahead result *pForRlmt. + * Requested driver to present RLMT packets as soon as poosible. + * + * Revision 1.47 1999/07/20 12:53:36 rassmann + * Fixed documentation errors for lookahead macros. + * + * Revision 1.46 1999/05/28 13:29:16 rassmann + * Replaced C++-style comment. + * + * Revision 1.45 1999/05/28 13:28:08 rassmann + * Corrected syntax error (xxx). + * + * Revision 1.44 1999/05/28 11:15:54 rassmann + * Changed behaviour to reflect Design Spec v1.2. + * Controlling Link LED(s). + * Introduced RLMT Packet Version field in RLMT Packet. + * Newstyle lookahead macros (checking meta-information before looking at + * the packet). + * + * Revision 1.43 1999/01/28 13:12:43 rassmann + * Corrected Lookahead (bug introduced in previous Rev.). + * + * Revision 1.42 1999/01/28 12:50:41 rassmann + * Not using broadcast time stamps in CheckLinkState mode. + * + * Revision 1.41 1999/01/27 14:13:02 rassmann + * Monitoring broadcast traffic. + * Switching more reliably and not too early if switch is + * configured for spanning tree. + * + * Revision 1.40 1999/01/22 13:17:30 rassmann + * Informing PNMI of NET_UP. + * Clearing RLMT multicast addresses before first setting them. + * Reporting segmentation earlier, setting a "quiet time" + * after a report. + * + * Revision 1.39 1998/12/10 15:29:53 rassmann + * Corrected SuspectStatus in SkRlmtBuildCheckChain(). + * Corrected CHECK_SEG mode. + * + * Revision 1.38 1998/12/08 13:11:23 rassmann + * Stopping SegTimer at RlmtStop. + * + * Revision 1.37 1998/12/07 16:51:42 rassmann + * Corrected comments. + * + * Revision 1.36 1998/12/04 10:58:56 rassmann + * Setting next pointer to NULL when receiving. + * + * Revision 1.35 1998/12/03 16:12:42 rassmann + * Ignoring/correcting illegal PrefPort values. + * + * Revision 1.34 1998/12/01 11:45:35 rassmann + * Code cleanup. + * + * Revision 1.33 1998/12/01 10:29:32 rassmann + * Starting standby ports before getting the net up. + * Checking if a port is started when the link comes up. + * + * Revision 1.32 1998/11/30 16:19:50 rassmann + * New default for PortNoRx. + * + * Revision 1.31 1998/11/27 19:17:13 rassmann + * Corrected handling of LINK_DOWN coming shortly after LINK_UP. + * + * Revision 1.30 1998/11/24 12:37:31 rassmann + * Implemented segmentation check. + * + * Revision 1.29 1998/11/18 13:04:32 rassmann + * Secured PortUpTimer event. + * Waiting longer before starting standby port(s). + * + * Revision 1.28 1998/11/17 13:43:04 rassmann + * Handling (logical) tx failure. + * Sending packet on logical address after PORT_SWITCH. + * + * Revision 1.27 1998/11/13 17:09:50 rassmann + * Secured some events against being called in wrong state. + * + * Revision 1.26 1998/11/13 16:56:54 rassmann + * Added macro version of SkRlmtLookaheadPacket. + * + * Revision 1.25 1998/11/06 18:06:04 rassmann + * Corrected timing when RLMT checks fail. + * Clearing tx counter earlier in periodical checks. + * + * Revision 1.24 1998/11/05 10:37:27 rassmann + * Checking destination address in Lookahead. + * + * Revision 1.23 1998/11/03 13:53:49 rassmann + * RLMT should switch now (at least in mode 3). + * + * Revision 1.22 1998/10/29 14:34:49 rassmann + * Clearing SK_RLMT struct at startup. + * Initializing PortsUp during SK_RLMT_START. + * + * Revision 1.21 1998/10/28 11:30:17 rassmann + * Default mode is now SK_RLMT_CHECK_LOC_LINK. + * + * Revision 1.20 1998/10/26 16:02:03 rassmann + * Ignoring LINK_DOWN for links that are down. + * + * Revision 1.19 1998/10/22 15:54:01 rassmann + * Corrected EtherLen. + * Starting Link Check when second port comes up. + * + * Revision 1.18 1998/10/22 11:39:50 rassmann + * Corrected signed/unsigned mismatches. + * Corrected receive list handling and address recognition. + * + * Revision 1.17 1998/10/19 17:01:20 rassmann + * More detailed checking of received packets. + * + * Revision 1.16 1998/10/15 15:16:34 rassmann + * Finished Spanning Tree checking. + * Checked with lint. + * + * Revision 1.15 1998/09/24 19:16:07 rassmann + * Code cleanup. + * Introduced Timer for PORT_DOWN due to no RX. + * + * Revision 1.14 1998/09/18 20:27:14 rassmann + * Added address override. + * + * Revision 1.13 1998/09/16 11:31:48 rassmann + * Including skdrv1st.h again. :( + * + * Revision 1.12 1998/09/16 11:09:50 rassmann + * Syntax corrections. + * + * Revision 1.11 1998/09/15 12:32:03 rassmann + * Syntax correction. + * + * Revision 1.10 1998/09/15 11:28:49 rassmann + * Syntax corrections. + * + * Revision 1.9 1998/09/14 17:07:37 rassmann + * Added code for port checking via LAN. + * Changed Mbuf definition. + * + * Revision 1.8 1998/09/07 11:14:14 rassmann + * Syntax corrections. + * + * Revision 1.7 1998/09/07 09:06:07 rassmann + * Syntax corrections. + * + * Revision 1.6 1998/09/04 19:41:33 rassmann + * Syntax corrections. + * Started entering code for checking local links. + * + * Revision 1.5 1998/09/04 12:14:27 rassmann + * Interface cleanup. + * + * Revision 1.4 1998/09/02 16:55:28 rassmann + * Updated to reflect new DRV/HWAC/RLMT interface. + * + * Revision 1.3 1998/08/27 14:29:03 rassmann + * Code cleanup. + * + * Revision 1.2 1998/08/27 14:26:24 rassmann + * Updated interface. + * + * Revision 1.1 1998/08/21 08:26:49 rassmann + * First public version. + * + ******************************************************************************/ + +/****************************************************************************** + * + * Description: + * + * This module contains code for Link ManagemenT (LMT) of SK-NET Adapters. + * It is mainly intended for adapters with more than one link. + * For such adapters, this module realizes Redundant Link ManagemenT (RLMT). + * + * Include File Hierarchy: + * + * "skdrv1st.h" + * "skdrv2nd.h" + * + ******************************************************************************/ + +#ifndef lint +static const char SysKonnectFileId[] = + "@(#) $Id: skrlmt.c,v 1.48 1999/10/04 14:01:17 rassmann Exp $ (C) SysKonnect."; +#endif /* !defined(lint) */ + +#define __SKRLMT_C + +#ifdef __cplusplus +xxxx /* not supported yet - force error */ +extern "C" { +#endif /* cplusplus */ + +#include "h/skdrv1st.h" +#include "h/skdrv2nd.h" + +/* defines ********************************************************************/ + +#ifndef SK_HWAC_LINK_LED +#define SK_HWAC_LINK_LED(a,b,c,d) +#endif /* !defined(SK_HWAC_LINK_LED) */ + +#ifndef DEBUG +#define RLMT_STATIC static +#else /* DEBUG */ +#define RLMT_STATIC + +#ifndef SK_LITTLE_ENDIAN +/* First 32 bits */ +#define OFFS_LO32 1 +/* Second 32 bits */ +#define OFFS_HI32 0 +#else /* SK_LITTLE_ENDIAN */ +/* First 32 bits */ +#define OFFS_LO32 0 +/* Second 32 bits */ +#define OFFS_HI32 1 +#endif /* SK_LITTLE_ENDIAN */ + +#endif /* DEBUG */ + +/* ----- Private timeout values ----- */ + +#define SK_RLMT_MIN_TO_VAL 125000 /* 1/8 sec. */ +#define SK_RLMT_DEF_TO_VAL 1000000 /* 1 sec. */ +#define SK_RLMT_PORTDOWN_TIM_VAL 900000 /* another 0.9 sec. */ +#define SK_RLMT_PORTSTART_TIM_VAL 100000 /* 0.1 sec. */ +#define SK_RLMT_PORTUP_TIM_VAL 2500000 /* 2.5 sec. */ +#define SK_RLMT_SEG_TO_VAL 900000000 /* 15 min. */ + +/* + * Amount that a time stamp must be later to be recognized as "substantially + * later". This is about 1/128 sec. + */ + +#define SK_RLMT_BC_DELTA ((SK_TICKS_PER_SEC >> 7) + 1) + +/* ----- Private RLMT defaults ----- */ + +#define SK_RLMT_DEF_PREF_PORT 0 /* "Lower" port. */ +#define SK_RLMT_DEF_MODE SK_RLMT_CHECK_LINK /* Default RLMT Mode. */ + +/* ----- Private RLMT checking states ----- */ + +#define SK_RLMT_RCS_SEG 1 /* RLMT Check State: check seg. */ +#define SK_RLMT_RCS_START_SEG 2 /* RLMT Check State: start check seg. */ +#define SK_RLMT_RCS_SEND_SEG 4 /* RLMT Check State: send BPDU packet */ +#define SK_RLMT_RCS_REPORT_SEG 8 /* RLMT Check State: report seg. */ + +/* ----- Private PORT checking states ----- */ + +#define SK_RLMT_PCS_TX 1 /* Port Check State: check tx. */ +#define SK_RLMT_PCS_RX 2 /* Port Check State: check rx. */ + +/* ----- Private PORT events ----- */ + +/* Note: Update simulation when changing these. */ + +#define SK_RLMT_PORTSTART_TIM 1100 /* Port start timeout. */ +#define SK_RLMT_PORTUP_TIM 1101 /* Port can now go up. */ +#define SK_RLMT_PORTDOWN_RX_TIM 1102 /* Port did not receive once ... */ +#define SK_RLMT_PORTDOWN 1103 /* Port went down. */ +#define SK_RLMT_PORTDOWN_TX_TIM 1104 /* Partner did not receive ... */ + +/* ----- Private RLMT events ----- */ + +/* Note: Update simulation when changing these. */ + +#define SK_RLMT_TIM 2100 /* RLMT timeout. */ +#define SK_RLMT_SEG_TIM 2101 /* RLMT segmentation check timeout. */ + +#define TO_SHORTEN(tim) ((tim) / 2) + +/* Error numbers and messages. */ + +#define SKERR_RLMT_E001 (SK_ERRBASE_RLMT + 0) +#define SKERR_RLMT_E001_MSG "No Packet." +#define SKERR_RLMT_E002 (SKERR_RLMT_E001 + 1) +#define SKERR_RLMT_E002_MSG "Short Packet." +#define SKERR_RLMT_E003 (SKERR_RLMT_E002 + 1) +#define SKERR_RLMT_E003_MSG "Unknown RLMT event." +#define SKERR_RLMT_E004 (SKERR_RLMT_E003 + 1) +#define SKERR_RLMT_E004_MSG "PortsUp incorrect." +#define SKERR_RLMT_E005 (SKERR_RLMT_E004 + 1) +#define SKERR_RLMT_E005_MSG \ + "Net seems to be segmented (different root bridges are reported on the ports)." +#define SKERR_RLMT_E006 (SKERR_RLMT_E005 + 1) +#define SKERR_RLMT_E006_MSG "Duplicate MAC Address detected." +#define SKERR_RLMT_E007 (SKERR_RLMT_E006 + 1) +#define SKERR_RLMT_E007_MSG "LinksUp incorrect." +#define SKERR_RLMT_E008 (SKERR_RLMT_E007 + 1) +#define SKERR_RLMT_E008_MSG "Port not started but link came up." +#define SKERR_RLMT_E009 (SKERR_RLMT_E008 + 1) +#define SKERR_RLMT_E009_MSG "Corrected illegal setting of Preferred Port." +#define SKERR_RLMT_E010 (SKERR_RLMT_E009 + 1) +#define SKERR_RLMT_E010_MSG "Ignored illegal Preferred Port." + +/* LLC field values. */ + +#define LLC_COMMAND_RESPONSE_BIT 1 +#define LLC_TEST_COMMAND 0xE3 +#define LLC_UI 0x03 + +/* RLMT Packet fields. */ + +#define SK_RLMT_DSAP 0 +#define SK_RLMT_SSAP 0 +#define SK_RLMT_CTRL (LLC_TEST_COMMAND) +#define SK_RLMT_INDICATOR0 0x53 /* S */ +#define SK_RLMT_INDICATOR1 0x4B /* K */ +#define SK_RLMT_INDICATOR2 0x2D /* - */ +#define SK_RLMT_INDICATOR3 0x52 /* R */ +#define SK_RLMT_INDICATOR4 0x4C /* L */ +#define SK_RLMT_INDICATOR5 0x4D /* M */ +#define SK_RLMT_INDICATOR6 0x54 /* T */ +#define SK_RLMT_PACKET_VERSION 0 + +/* RLMT SPT Flag values. */ + +#define SK_RLMT_SPT_FLAG_CHANGE 0x01 +#define SK_RLMT_SPT_FLAG_CHANGE_ACK 0x80 + +/* RLMT SPT Packet fields. */ + +#define SK_RLMT_SPT_DSAP 0x42 +#define SK_RLMT_SPT_SSAP 0x42 +#define SK_RLMT_SPT_CTRL (LLC_UI) +#define SK_RLMT_SPT_PROTOCOL_ID0 0x00 +#define SK_RLMT_SPT_PROTOCOL_ID1 0x00 +#define SK_RLMT_SPT_PROTOCOL_VERSION_ID 0x00 +#define SK_RLMT_SPT_BPDU_TYPE 0x00 +#define SK_RLMT_SPT_FLAGS 0x00 /* ?? */ +#define SK_RLMT_SPT_ROOT_ID0 0xFF /* Lowest possible priority. */ +#define SK_RLMT_SPT_ROOT_ID1 0xFF /* Lowest possible priority. */ + +/* Remaining 6 bytes will be the current port address. */ + +#define SK_RLMT_SPT_ROOT_PATH_COST0 0x00 +#define SK_RLMT_SPT_ROOT_PATH_COST1 0x00 +#define SK_RLMT_SPT_ROOT_PATH_COST2 0x00 +#define SK_RLMT_SPT_ROOT_PATH_COST3 0x00 +#define SK_RLMT_SPT_BRIDGE_ID0 0xFF /* Lowest possible priority. */ +#define SK_RLMT_SPT_BRIDGE_ID1 0xFF /* Lowest possible priority. */ + +/* Remaining 6 bytes will be the current port address. */ + +#define SK_RLMT_SPT_PORT_ID0 0xFF /* Lowest possible priority. */ +#define SK_RLMT_SPT_PORT_ID1 0xFF /* Lowest possible priority. */ +#define SK_RLMT_SPT_MSG_AGE0 0x00 +#define SK_RLMT_SPT_MSG_AGE1 0x00 +#define SK_RLMT_SPT_MAX_AGE0 0x00 +#define SK_RLMT_SPT_MAX_AGE1 0xFF +#define SK_RLMT_SPT_HELLO_TIME0 0x00 +#define SK_RLMT_SPT_HELLO_TIME1 0xFF +#define SK_RLMT_SPT_FWD_DELAY0 0x00 +#define SK_RLMT_SPT_FWD_DELAY1 0x40 + +/* Size defines. */ + +#define SK_RLMT_MIN_PACKET_SIZE 34 +#define SK_RLMT_MAX_PACKET_SIZE (SK_RLMT_MAX_TX_BUF_SIZE) +#define SK_PACKET_DATA_LEN (SK_RLMT_MAX_PACKET_SIZE - \ + SK_RLMT_MIN_PACKET_SIZE) + +/* ----- RLMT packet types ----- */ + +#define SK_PACKET_ANNOUNCE 1 /* Port announcement. */ +#define SK_PACKET_ALIVE 2 /* Alive packet to port. */ +#define SK_PACKET_ADDR_CHANGED 3 /* Port address changed. */ +#define SK_PACKET_CHECK_TX 4 /* Check your tx line. */ + +#ifdef SK_LITTLE_ENDIAN +#define SK_U16_TO_NETWORK_ORDER(Val,Addr) { \ + SK_U8 *_Addr = (SK_U8*)(Addr); \ + SK_U16 _Val = (SK_U16)(Val); \ + *_Addr++ = (SK_U8)(_Val >> 8); \ + *_Addr = (SK_U8)(_Val & 0xFF); \ +} +#endif /* SK_LITTLE_ENDIAN */ + +#ifdef SK_BIG_ENDIAN +#define SK_U16_TO_NETWORK_ORDER(Val,Addr) (*(SK_U16*)(Addr) = (SK_U16)(Val)) +#endif /* SK_BIG_ENDIAN */ + +#define AUTONEG_FAILED SK_FALSE +#define AUTONEG_SUCCESS SK_TRUE + + +/* typedefs *******************************************************************/ + +/* RLMT packet. Length: SK_RLMT_MAX_PACKET_SIZE (60) bytes. */ + +typedef struct s_RlmtPacket { + SK_U8 DstAddr[SK_MAC_ADDR_LEN]; + SK_U8 SrcAddr[SK_MAC_ADDR_LEN]; + SK_U8 TypeLen[2]; + SK_U8 DSap; + SK_U8 SSap; + SK_U8 Ctrl; + SK_U8 Indicator[7]; + SK_U8 RlmtPacketType[2]; + SK_U8 Align1[2]; + SK_U8 Random[4]; /* Random value of requesting(!) station. */ + SK_U8 RlmtPacketVersion[2]; /* RLMT Packet version */ + SK_U8 Data[SK_PACKET_DATA_LEN]; +} SK_RLMT_PACKET; + +typedef struct s_SpTreeRlmtPacket { + SK_U8 DstAddr[SK_MAC_ADDR_LEN]; + SK_U8 SrcAddr[SK_MAC_ADDR_LEN]; + SK_U8 TypeLen[2]; + SK_U8 DSap; + SK_U8 SSap; + SK_U8 Ctrl; + SK_U8 ProtocolId[2]; + SK_U8 ProtocolVersionId; + SK_U8 BpduType; + SK_U8 Flags; + SK_U8 RootId[8]; + SK_U8 RootPathCost[4]; + SK_U8 BridgeId[8]; + SK_U8 PortId[2]; + SK_U8 MessageAge[2]; + SK_U8 MaxAge[2]; + SK_U8 HelloTime[2]; + SK_U8 ForwardDelay[2]; +} SK_SPTREE_PACKET; + +/* global variables ***********************************************************/ + +SK_MAC_ADDR SkRlmtMcAddr = {{0x01, 0x00, 0x5A, 0x52, 0x4C, 0x4D}}; +SK_MAC_ADDR BridgeMcAddr = {{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}}; +SK_MAC_ADDR BcAddr = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; + +/* local variables ************************************************************/ + +/* None. */ + +/* functions ******************************************************************/ + +RLMT_STATIC void SkRlmtCheckSwitch( + SK_AC *pAC, + SK_IOC IoC); +RLMT_STATIC void SkRlmtCheckSeg( + SK_AC *pAC, + SK_IOC IoC); + +/****************************************************************************** + * + * SkRlmtInit - initialize data, set state to init + * + * Description: + * + * SK_INIT_DATA + * ============ + * + * This routine initializes all RLMT-related variables to a known state. + * The initial state is SK_RLMT_RS_INIT. + * All ports are initialized to SK_RLMT_PS_INIT. + * + * + * SK_INIT_IO + * ========== + * + * Nothing. + * + * + * SK_INIT_RUN + * =========== + * + * Determine the adapter's random value. + * Set the hw registers, the "logical adapter address", the + * RLMT multicast address, and eventually the BPDU multicast address. + * + * Context: + * init, pageable + * + * Returns: + * Nothing. + */ +void SkRlmtInit( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +int Level) /* initialization level */ +{ + SK_U32 i, j; + SK_U64 Random; + SK_EVPARA Para; + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_INIT, + ("RLMT Init level %d.\n", Level)) + + switch (Level) { + case SK_INIT_DATA: /* Initialize data structures. */ + SK_MEMSET((char *)&pAC->Rlmt, 0, sizeof(SK_RLMT)); + + for (i = 0; i < SK_MAX_MACS; i++) { + pAC->Rlmt.Port[i].PortState = SK_RLMT_PS_INIT; + pAC->Rlmt.Port[i].LinkDown = SK_TRUE; + pAC->Rlmt.Port[i].PortDown = SK_TRUE; + pAC->Rlmt.Port[i].PortStarted = SK_FALSE; + pAC->Rlmt.Port[i].PortNoRx = SK_FALSE; + pAC->Rlmt.Port[i].RootIdSet = SK_FALSE; + } + + pAC->Rlmt.RlmtState = SK_RLMT_RS_INIT; + pAC->Rlmt.RootIdSet = SK_FALSE; + pAC->Rlmt.MacPreferred = 0xFFFFFFFF; /* Automatic. */ + pAC->Rlmt.PrefPort = SK_RLMT_DEF_PREF_PORT; + pAC->Rlmt.MacActive = pAC->Rlmt.PrefPort; /* Just assuming. */ + pAC->Rlmt.RlmtMode = SK_RLMT_DEF_MODE; + pAC->Rlmt.TimeoutValue = SK_RLMT_DEF_TO_VAL; + break; + + case SK_INIT_IO: /* GIMacsFound first available here. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_INIT, + ("RLMT: %d MACs were detected.\n", + pAC->GIni.GIMacsFound)) + + /* Initialize HW registers? */ + + if (pAC->GIni.GIMacsFound < 2) { + Para.Para32[0] = SK_RLMT_CHECK_LINK; + (void)SkRlmtEvent(pAC, IoC, SK_RLMT_MODE_CHANGE, Para); + } + break; + + case SK_INIT_RUN: + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + Random = SkOsGetTime(pAC); + *(SK_U32*)&pAC->Rlmt.Port[i].Random = *(SK_U32*)&Random; + + for (j = 0; j < 4; j++) { + pAC->Rlmt.Port[i].Random[j] ^= pAC->Addr.Port[i + ].CurrentMacAddress.a[SK_MAC_ADDR_LEN - + 1 - j]; + } + + (void)SkAddrMcClear( + pAC, + IoC, + i, + SK_ADDR_PERMANENT | SK_MC_SW_ONLY); + + /* Add RLMT MC address. */ + + (void)SkAddrMcAdd( + pAC, + IoC, + i, + &SkRlmtMcAddr, + SK_ADDR_PERMANENT); + + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) { + /* Add BPDU MC address. */ + + (void)SkAddrMcAdd( + pAC, + IoC, + i, + &BridgeMcAddr, + SK_ADDR_PERMANENT); + } + + (void)SkAddrMcUpdate(pAC, IoC, i); + } + break; + + default: /* error */ + break; + } + + return; + +} /* SkRlmtInit */ + + +/****************************************************************************** + * + * SkRlmtBuildCheckChain - build the check chain + * + * Description: + * This routine builds the local check chain: + * - Each port that is up checks the next port. + * - The last port that is up checks the first port that is up. + * + * Notes: + * - Currently only local ports are considered when building the chain. + * - Currently the SuspectState is just reset; + * it would be better to save it ... + * + * Context: + * runtime, pageable? + * + * Returns: + * Nothing + */ +RLMT_STATIC void SkRlmtBuildCheckChain( +SK_AC *pAC) /* adapter context */ +{ + SK_U32 i; + SK_U32 NumMacsUp; + SK_U32 FirstMacUp=0; + SK_U32 PrevMacUp=0; + + if (!(pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK)) { + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pAC->Rlmt.Port[i].PortsChecked = 0; + } + return; /* Nothing to build. */ + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SkRlmtBuildCheckChain.\n")) + + NumMacsUp = 0; + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pAC->Rlmt.Port[i].PortsChecked = 0; + pAC->Rlmt.Port[i].PortsSuspect = 0; + pAC->Rlmt.Port[i].CheckingState &= + ~(SK_RLMT_PCS_RX | SK_RLMT_PCS_TX); + + /* + * If more than two links are detected we should consider + * checking at least two other ports: + * 1. the next port that is not LinkDown and + * 2. the next port that is not PortDown. + */ + + if (!pAC->Rlmt.Port[i].LinkDown) { + if (NumMacsUp == 0) { + FirstMacUp = i; + } + else { + pAC->Rlmt.Port[PrevMacUp].PortCheck[ + pAC->Rlmt.Port[ + PrevMacUp].PortsChecked].CheckAddr = + pAC->Addr.Port[i].CurrentMacAddress; + pAC->Rlmt.Port[PrevMacUp].PortCheck[ + pAC->Rlmt.Port[ + PrevMacUp].PortsChecked].SuspectTx = + SK_FALSE; + pAC->Rlmt.Port[PrevMacUp].PortsChecked++; + } + PrevMacUp = i; + NumMacsUp++; + } + } + + if (NumMacsUp > 1) { + pAC->Rlmt.Port[PrevMacUp].PortCheck[pAC->Rlmt.Port[ + PrevMacUp].PortsChecked].CheckAddr = + pAC->Addr.Port[FirstMacUp].CurrentMacAddress; + pAC->Rlmt.Port[PrevMacUp].PortCheck[pAC->Rlmt.Port[ + PrevMacUp].PortsChecked].SuspectTx = SK_FALSE; + pAC->Rlmt.Port[PrevMacUp].PortsChecked++; + } + +#ifdef DEBUG + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("Port %d checks %d other ports: %2X.\n", + i, + pAC->Rlmt.Port[i].PortsChecked, + pAC->Rlmt.Port[i].PortCheck[0].CheckAddr.a[5])) + } +#endif /* DEBUG */ + + return; +} /* SkRlmtBuildCheckChain */ + +#ifdef SK_RLMT_SLOW_LOOKAHEAD + +/****************************************************************************** + * + * SkRlmtLookaheadPacket - examine received packet shortly, count s-th + * + * Description: + * This routine examines each received packet fast and short and + * increments some counters. + * The received packet has to be stored virtually contiguous. + * This function does the following: + * - Increment some counters. + * - Ensure length is sufficient. + * - Ensure that destination address is physical port address, + * RLMT multicast, or BPDU multicast address. + * + * Notes: + * This function is fully reentrant while the fast path is not blocked. + * + * Context: + * isr/dpr, not pageable + * + * Returns: + * SK_FALSE packet for upper layers + * SK_TRUE packet for RLMT + */ +SK_BOOL SkRlmtLookaheadPacket( +SK_AC *pAC, /* adapter context */ +SK_U32 PortIdx, /* receiving port */ +SK_U8 *pLaPacket, /* received packet's data */ +unsigned PacketLength, /* received packet's length */ /* Necessary? */ +unsigned LaLength) /* lookahead length */ +{ + int i; + SK_BOOL IsBc; /* Broadcast address? */ + int RxDest; /* Receive destination? */ + int Offset; /* Offset of data to present to LOOKAHEAD. */ + int NumBytes; /* #Bytes to present to LOOKAHEAD. */ + SK_RLMT_PACKET *pRPacket; + SK_ADDR_PORT *pAPort; + +#ifdef DEBUG + PacketLength = PacketLength; +#endif /* DEBUG */ + + pRPacket = (SK_RLMT_PACKET*)pLaPacket; + pAPort = &pAC->Addr.Port[PortIdx]; + +#ifdef DEBUG + if (pLaPacket == NULL) { + + /* Create error log entry. */ + + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E001, + SKERR_RLMT_E001_MSG); + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtLookaheadPacket: NULL pointer.\n")) + + return (SK_FALSE); + } +#endif /* DEBUG */ + + /* Drivers should get IsBc from the descriptor. */ + + IsBc = SK_TRUE; + for (i = 0; IsBc && i < SK_MAC_ADDR_LEN; i++) { + IsBc = IsBc && (pLaPacket[i] == 0xFF); + } + + SK_RLMT_PRE_LOOKAHEAD( + pAC, + PortIdx, + PacketLength, + IsBc, + &Offset, + &NumBytes) + + if (NumBytes == 0) { + return (SK_FALSE); + } + + SK_RLMT_LOOKAHEAD( + pAC, + PortIdx, + &pLaPacket[Offset], + IsBc, + pLaPacket[0] & 1, /* Drivers: Get info from descriptor. */ + &RxDest) + + if (RxDest & SK_RLMT_RX_RLMT) { + return (SK_TRUE); + } + + return (SK_FALSE); +} /* SkRlmtLookaheadPacket */ + +#endif /* SK_RLMT_SLOW_LOOKAHEAD */ + +/****************************************************************************** + * + * SkRlmtBuildPacket - build an RLMT packet + * + * Description: + * This routine sets up an RLMT packet. + * + * Context: + * runtime, pageable? + * + * Returns: + * NULL or pointer to RLMT mbuf + */ +RLMT_STATIC SK_MBUF *SkRlmtBuildPacket( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* sending port */ +SK_U16 PacketType, /* RLMT packet type */ +SK_MAC_ADDR *SrcAddr, /* source address */ +SK_MAC_ADDR *DestAddr) /* destination address */ +{ + int i; + SK_U16 Length; + SK_MBUF *pMb; + SK_RLMT_PACKET *pPacket; + + if ((pMb = SkDrvAllocRlmtMbuf(pAC, IoC, SK_RLMT_MAX_PACKET_SIZE)) != + NULL) { + pPacket = (SK_RLMT_PACKET*)pMb->pData; + for (i = 0; i < SK_MAC_ADDR_LEN; i++) { + pPacket->DstAddr[i] = DestAddr->a[i]; + pPacket->SrcAddr[i] = SrcAddr->a[i]; + } + pPacket->DSap = SK_RLMT_DSAP; + pPacket->SSap = SK_RLMT_SSAP; + pPacket->Ctrl = SK_RLMT_CTRL; + pPacket->Indicator[0] = SK_RLMT_INDICATOR0; + pPacket->Indicator[1] = SK_RLMT_INDICATOR1; + pPacket->Indicator[2] = SK_RLMT_INDICATOR2; + pPacket->Indicator[3] = SK_RLMT_INDICATOR3; + pPacket->Indicator[4] = SK_RLMT_INDICATOR4; + pPacket->Indicator[5] = SK_RLMT_INDICATOR5; + pPacket->Indicator[6] = SK_RLMT_INDICATOR6; + + SK_U16_TO_NETWORK_ORDER( + PacketType, + &pPacket->RlmtPacketType[0]); + + for (i = 0; i < 4; i++) { + pPacket->Random[i] = pAC->Rlmt.Port[PortIdx].Random[i]; + } + + SK_U16_TO_NETWORK_ORDER( + SK_RLMT_PACKET_VERSION, + &pPacket->RlmtPacketVersion[0]); + + for (i = 0; i < SK_PACKET_DATA_LEN; i++) { + pPacket->Data[i] = 0x00; + } + + Length = SK_RLMT_MAX_PACKET_SIZE; /* Or smaller. */ + pMb->Length = Length; + pMb->PortIdx = PortIdx; + Length -= 14; + SK_U16_TO_NETWORK_ORDER(Length, &pPacket->TypeLen[0]); + + if (PacketType == SK_PACKET_ALIVE) { + pAC->Rlmt.Port[PortIdx].TxHelloCts++; + } + } + + return (pMb); +} /* SkRlmtBuildPacket */ + + +/****************************************************************************** + * + * SkRlmtBuildSpanningTreePacket - build spanning tree check packet + * + * Description: + * This routine sets up a BPDU packet for spanning tree check. + * + * Context: + * runtime, pageable? + * + * Returns: + * NULL or pointer to RLMT mbuf + */ +RLMT_STATIC SK_MBUF *SkRlmtBuildSpanningTreePacket( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx) /* sending port */ +{ + unsigned i; + SK_U16 Length; + SK_MBUF *pMb; + SK_SPTREE_PACKET *pSPacket; + + if ((pMb = SkDrvAllocRlmtMbuf(pAC, IoC, SK_RLMT_MAX_PACKET_SIZE)) != + NULL) { + pSPacket = (SK_SPTREE_PACKET*)pMb->pData; + for (i = 0; i < SK_MAC_ADDR_LEN; i++) { + pSPacket->DstAddr[i] = BridgeMcAddr.a[i]; + pSPacket->SrcAddr[i] = + pAC->Addr.Port[PortIdx].CurrentMacAddress.a[i]; + } + pSPacket->DSap = SK_RLMT_SPT_DSAP; + pSPacket->SSap = SK_RLMT_SPT_SSAP; + pSPacket->Ctrl = SK_RLMT_SPT_CTRL; + + pSPacket->ProtocolId[0] = SK_RLMT_SPT_PROTOCOL_ID0; + pSPacket->ProtocolId[1] = SK_RLMT_SPT_PROTOCOL_ID1; + pSPacket->ProtocolVersionId = SK_RLMT_SPT_PROTOCOL_VERSION_ID; + pSPacket->BpduType = SK_RLMT_SPT_BPDU_TYPE; + pSPacket->Flags = SK_RLMT_SPT_FLAGS; + pSPacket->RootId[0] = SK_RLMT_SPT_ROOT_ID0; + pSPacket->RootId[1] = SK_RLMT_SPT_ROOT_ID1; + pSPacket->RootPathCost[0] = SK_RLMT_SPT_ROOT_PATH_COST0; + pSPacket->RootPathCost[1] = SK_RLMT_SPT_ROOT_PATH_COST1; + pSPacket->RootPathCost[2] = SK_RLMT_SPT_ROOT_PATH_COST2; + pSPacket->RootPathCost[3] = SK_RLMT_SPT_ROOT_PATH_COST3; + pSPacket->BridgeId[0] = SK_RLMT_SPT_BRIDGE_ID0; + pSPacket->BridgeId[1] = SK_RLMT_SPT_BRIDGE_ID1; + + /* + * Use virtual address as bridge ID and filter these packets + * on receive. + */ + + for (i = 0; i < SK_MAC_ADDR_LEN; i++) { + pSPacket->BridgeId[i + 2] = pSPacket->RootId[i + 2] = + pAC->Addr.CurrentMacAddress.a[i]; + } + pSPacket->PortId[0] = SK_RLMT_SPT_PORT_ID0; + pSPacket->PortId[1] = SK_RLMT_SPT_PORT_ID1; + pSPacket->MessageAge[0] = SK_RLMT_SPT_MSG_AGE0; + pSPacket->MessageAge[1] = SK_RLMT_SPT_MSG_AGE1; + pSPacket->MaxAge[0] = SK_RLMT_SPT_MAX_AGE0; + pSPacket->MaxAge[1] = SK_RLMT_SPT_MAX_AGE1; + pSPacket->HelloTime[0] = SK_RLMT_SPT_HELLO_TIME0; + pSPacket->HelloTime[1] = SK_RLMT_SPT_HELLO_TIME1; + pSPacket->ForwardDelay[0] = SK_RLMT_SPT_FWD_DELAY0; + pSPacket->ForwardDelay[1] = SK_RLMT_SPT_FWD_DELAY1; + + Length = SK_RLMT_MAX_PACKET_SIZE; /* Or smaller. */ + pMb->Length = Length; + pMb->PortIdx = PortIdx; + Length -= 14; + SK_U16_TO_NETWORK_ORDER(Length, &pSPacket->TypeLen[0]); + + pAC->Rlmt.Port[PortIdx].TxSpHelloReqCts++; + } + + return (pMb); +} /* SkRlmtBuildSpanningTreePacket */ + + +/****************************************************************************** + * + * SkRlmtSend - build and send check packets + * + * Description: + * Depending on the RLMT state and the checking state, several packets + * are sent through the indicated port. + * + * Context: + * runtime, pageable? + * + * Returns: + * Nothing. + */ +RLMT_STATIC void SkRlmtSend( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx) +{ + unsigned j; + SK_EVPARA Para; + SK_RLMT_PORT *pRPort; + + pRPort = &pAC->Rlmt.Port[PortIdx]; + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK) { + if (pRPort->CheckingState & + (SK_RLMT_PCS_TX | SK_RLMT_PCS_RX)) { + + /* + * Port is suspicious. Send the RLMT packet to the + * RLMT multicast address. + */ + + if ((Para.pParaPtr = SkRlmtBuildPacket( + pAC, + IoC, + PortIdx, + SK_PACKET_ALIVE, + &pAC->Addr.Port[PortIdx].CurrentMacAddress, + &SkRlmtMcAddr)) != NULL) { + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + } + else { + /* + * Send a directed RLMT packet to all ports that are + * checked by the indicated port. + */ + + for (j = 0; j < pRPort->PortsChecked; j++) { + if ((Para.pParaPtr = + SkRlmtBuildPacket( + pAC, + IoC, + PortIdx, + SK_PACKET_ALIVE, + &pAC->Addr.Port[PortIdx].CurrentMacAddress, + &pRPort->PortCheck[j].CheckAddr) + ) != NULL) { + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + } + } + } + + if ((pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) && + (pAC->Rlmt.CheckingState & SK_RLMT_RCS_SEND_SEG)) { + + /* + * Send a BPDU packet to make a connected switch tell us + * the correct root bridge. + */ + + if ((Para.pParaPtr = + SkRlmtBuildSpanningTreePacket( + pAC, + IoC, + PortIdx) + ) != NULL) { + + pAC->Rlmt.CheckingState &= ~SK_RLMT_RCS_SEND_SEG; + pRPort->RootIdSet = SK_FALSE; + + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_TX, + ("SkRlmtSend: BPDU Packet on Port %u.\n", + PortIdx)) + } + } + + return; + +} /* SkRlmtSend */ + + +/****************************************************************************** + * + * SkRlmtPortReceives - check if port is (going) down and bring it up + * + * Description: + * This routine checks if a port who received a non-BPDU packet + * needs to go up or needs to be stopped going down. + * +* Context: + * runtime, pageable? + * + * Returns: + * Nothing. + */ +RLMT_STATIC void SkRlmtPortReceives( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx) /* port to check */ +{ + SK_RLMT_PORT *pRPort; + SK_EVPARA Para; + + pRPort = &pAC->Rlmt.Port[PortIdx]; + pRPort->PortNoRx = SK_FALSE; + + if ((pRPort->PortState == SK_RLMT_PS_DOWN) && + !(pRPort->CheckingState & SK_RLMT_PCS_TX)) { + + /* + * Port is marked down (rx), but received a non-BPDU packet. + * Bring it up. + */ + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Received on PortDown.\n")) + + pRPort->PortState = SK_RLMT_PS_GOING_UP; + pRPort->GuTimeStamp = SkOsGetTime(pAC); + Para.Para32[0] = PortIdx; + SkTimerStart( + pAC, + IoC, + &pRPort->UpTimer, + SK_RLMT_PORTUP_TIM_VAL, + SKGE_RLMT, + SK_RLMT_PORTUP_TIM, + Para); + SkRlmtCheckSwitch(pAC, IoC); + } + else if (pRPort->CheckingState & SK_RLMT_PCS_RX) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Stop bringing port down.\n")) + SkTimerStop(pAC, IoC, &pRPort->DownRxTimer); + SkRlmtCheckSwitch(pAC, IoC); + } + + pRPort->CheckingState &= ~SK_RLMT_PCS_RX; + return; +} /* SkRlmtPortReceives */ + + +/****************************************************************************** + * + * SkRlmtPacketReceive - receive a packet for closer examination + * + * Description: + * This routine examines a packet more closely than SkRlmtLookahead*(). + * + * Context: + * runtime, pageable? + * + * Returns: + * Nothing. + */ +RLMT_STATIC void SkRlmtPacketReceive( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_MBUF *pMb) /* received packet */ +{ +#ifdef xDEBUG + extern void DumpData(char *p, int size); +#endif /* DEBUG */ + int i; + unsigned j; + SK_U16 PacketType; + SK_U32 PortIdx; + SK_ADDR_PORT *pAPort; + SK_RLMT_PORT *pRPort; + SK_RLMT_PACKET *pRPacket; + SK_SPTREE_PACKET *pSPacket; + SK_EVPARA Para; + + PortIdx = pMb->PortIdx; + pAPort = &pAC->Addr.Port[PortIdx]; + pRPort = &pAC->Rlmt.Port[PortIdx]; + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: PortIdx == %d.\n", PortIdx)) + + pRPacket = (SK_RLMT_PACKET*)pMb->pData; + pSPacket = (SK_SPTREE_PACKET*)pRPacket; + +#ifdef xDEBUG + DumpData((char *)pRPacket, 32); +#endif /* DEBUG */ + + if ((pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot) != 0) { + SkRlmtPortReceives(pAC, IoC, PortIdx); + } + + /* Check destination address. */ + + if (!SK_ADDR_EQUAL(pAPort->CurrentMacAddress.a, pRPacket->DstAddr) && + !SK_ADDR_EQUAL(SkRlmtMcAddr.a, pRPacket->DstAddr) && + !SK_ADDR_EQUAL(BridgeMcAddr.a, pRPacket->DstAddr)) { + + /* + * Not sent to current MAC or registered MC address + * => Trash it. + */ + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Not for me.\n")) + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + return; + } + else if (SK_ADDR_EQUAL(pAPort->CurrentMacAddress.a, pRPacket->SrcAddr)) { + + /* + * Was sent by same port (may happen during port switching + * or in case of duplicate MAC addresses). + */ + + /* + * Check for duplicate address here: + * If Packet.Random != My.Random => DupAddr. + */ + + for (i = 3; i >= 0; i--) { + if (pRPort->Random[i] != + pRPacket->Random[i]) { + break; + } + } + + /* + * CAUTION: Do not check for duplicate MAC + * address in RLMT Alive Reply packets. + */ + + if (i >= 0 && pRPacket->DSap == SK_RLMT_DSAP && + pRPacket->Ctrl == SK_RLMT_CTRL && + pRPacket->SSap == SK_RLMT_SSAP && + pRPacket->Indicator[0] == SK_RLMT_INDICATOR0 && + pRPacket->Indicator[1] == SK_RLMT_INDICATOR1 && + pRPacket->Indicator[2] == SK_RLMT_INDICATOR2 && + pRPacket->Indicator[3] == SK_RLMT_INDICATOR3 && + pRPacket->Indicator[4] == SK_RLMT_INDICATOR4 && + pRPacket->Indicator[5] == SK_RLMT_INDICATOR5 && + pRPacket->Indicator[6] == SK_RLMT_INDICATOR6) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Duplicate MAC Address.\n")) + + /* Error Log entry. */ + + SK_ERR_LOG( + pAC, + SK_ERRCL_COMM, + SKERR_RLMT_E006, + SKERR_RLMT_E006_MSG); + } + else { + /* Simply trash it. */ + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Sent by me.\n")) + } + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + + return; + } + + /* Check SuspectTx entries. */ + + if (pRPort->PortsSuspect > 0) { + for (j = 0; j < pRPort->PortsChecked; j++) { + if (pRPort->PortCheck[j].SuspectTx && + SK_ADDR_EQUAL( + pRPacket->SrcAddr, + pRPort->PortCheck[j].CheckAddr.a)) { + pRPort->PortCheck[j].SuspectTx = SK_FALSE; + pRPort->PortsSuspect--; + break; + } + } + } + + /* Determine type of packet. */ + + if (pRPacket->DSap == SK_RLMT_DSAP && + pRPacket->Ctrl == SK_RLMT_CTRL && + (pRPacket->SSap & ~LLC_COMMAND_RESPONSE_BIT) == SK_RLMT_SSAP && + pRPacket->Indicator[0] == SK_RLMT_INDICATOR0 && + pRPacket->Indicator[1] == SK_RLMT_INDICATOR1 && + pRPacket->Indicator[2] == SK_RLMT_INDICATOR2 && + pRPacket->Indicator[3] == SK_RLMT_INDICATOR3 && + pRPacket->Indicator[4] == SK_RLMT_INDICATOR4 && + pRPacket->Indicator[5] == SK_RLMT_INDICATOR5 && + pRPacket->Indicator[6] == SK_RLMT_INDICATOR6) { + + /* It's an RLMT packet. */ + + PacketType = (SK_U16)((pRPacket->RlmtPacketType[0] << 8) | + pRPacket->RlmtPacketType[1]); + + switch (PacketType) { + case SK_PACKET_ANNOUNCE: /* Not yet used. */ +#if 0 + /* Build the check chain. */ + + SkRlmtBuildCheckChain(pAC); +#endif /* 0 */ + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Announce.\n")) + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + break; + + case SK_PACKET_ALIVE: + if (pRPacket->SSap & LLC_COMMAND_RESPONSE_BIT) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Alive Reply.\n")) + + /* Alive Reply Packet. */ + +#if 0 + pRPort->RlmtAcksPerTimeSlot++; +#endif /* 0 */ + + if (!(pAC->Addr.Port[PortIdx].PromMode & + SK_PROM_MODE_LLC) || + SK_ADDR_EQUAL( + pRPacket->DstAddr, + pAPort->CurrentMacAddress.a)) { + + /* Obviously we could send something. */ + + if (pRPort->CheckingState & + SK_RLMT_PCS_TX) { + pRPort->CheckingState &= + ~SK_RLMT_PCS_TX; + SkTimerStop( + pAC, + IoC, + &pRPort->DownTxTimer); + } + + if ((pRPort->PortState == + SK_RLMT_PS_DOWN) && + !(pRPort->CheckingState & + SK_RLMT_PCS_RX)) { + pRPort->PortState = + SK_RLMT_PS_GOING_UP; + pRPort->GuTimeStamp = + SkOsGetTime(pAC); + + SkTimerStop( + pAC, + IoC, + &pRPort->DownTxTimer); + + Para.Para32[0] = PortIdx; + SkTimerStart( + pAC, + IoC, + &pRPort->UpTimer, + SK_RLMT_PORTUP_TIM_VAL, + SKGE_RLMT, + SK_RLMT_PORTUP_TIM, + Para); + } + } + + /* Mark sending port as alive? */ + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + } + else { /* Alive Request Packet. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Alive Request.\n")) + + pRPort->RxHelloCts++; +#if 0 + pRPort->RlmtChksPerTimeSlot++; +#endif /* 0 */ + + /* Answer. */ + + for (i = 0; i < SK_MAC_ADDR_LEN; i++) { + pRPacket->DstAddr[i] = + pRPacket->SrcAddr[i]; + pRPacket->SrcAddr[i] = pAC->Addr.Port[ + PortIdx].CurrentMacAddress.a[i]; + } + pRPacket->SSap |= LLC_COMMAND_RESPONSE_BIT; + + Para.pParaPtr = pMb; + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + break; + + case SK_PACKET_CHECK_TX: + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Check your tx line.\n")) + + /* + * A port checking us requests us to check our tx line. + */ + + pRPort->CheckingState |= SK_RLMT_PCS_TX; + + /* Start PortDownTx timer. */ + + Para.Para32[0] = PortIdx; + SkTimerStart( + pAC, + IoC, + &pRPort->DownTxTimer, + SK_RLMT_PORTDOWN_TIM_VAL, + SKGE_RLMT, + SK_RLMT_PORTDOWN_TX_TIM, + Para); + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + + if ((Para.pParaPtr = SkRlmtBuildPacket( + pAC, + IoC, + PortIdx, + SK_PACKET_ALIVE, + &pAC->Addr.Port[PortIdx].CurrentMacAddress, + &SkRlmtMcAddr)) != NULL) { + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + break; + + case SK_PACKET_ADDR_CHANGED: + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Address Change.\n")) + + /* Build the check chain. */ + + SkRlmtBuildCheckChain(pAC); + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + break; + + default: + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Unknown RLMT packet.\n")) + + /* RA;:;: ??? */ + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + } + } + else if (pSPacket->DSap == SK_RLMT_SPT_DSAP && + pSPacket->Ctrl == SK_RLMT_SPT_CTRL && + (pSPacket->SSap & ~LLC_COMMAND_RESPONSE_BIT) == + SK_RLMT_SPT_SSAP) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: BPDU Packet.\n")) + + /* Spanning Tree packet. */ + + pRPort->RxSpHelloCts++; + + if (!SK_ADDR_EQUAL( + &pSPacket->RootId[2], + &pAC->Addr.CurrentMacAddress.a[0])) { + + /* + * Check segmentation if a new root bridge is set and + * the segmentation check is not currently running. + */ + + if (!SK_ADDR_EQUAL( + &pSPacket->RootId[2], + &pRPort->Root.Id[2]) && + (pAC->Rlmt.LinksUp > 1) && + (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) && + !(pAC->Rlmt.CheckingState & SK_RLMT_RCS_SEG)) { + pAC->Rlmt.CheckingState |= + SK_RLMT_RCS_START_SEG | + SK_RLMT_RCS_SEND_SEG; + } + + /* Store tree view of this port. */ + + for (i = 0; i < 8; i++) { + pRPort->Root.Id[i] = pSPacket->RootId[i]; + } + pRPort->RootIdSet = SK_TRUE; + } + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + + if (pAC->Rlmt.CheckingState & SK_RLMT_RCS_REPORT_SEG) { + SkRlmtCheckSeg(pAC, IoC); + } + } + else { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_RX, + ("SkRlmtPacketReceive: Unknown Packet Type.\n")) + + /* Unknown packet. */ + + SkDrvFreeRlmtMbuf(pAC, IoC, pMb); + } + return; +} /* SkRlmtPacketReceive */ + + +/****************************************************************************** + * + * SkRlmtCheckPort - check if a port works + * + * Description: + * This routine checks if a port whose link is up received something + * and if it seems to transmit successfully. + * + * # PortState: PsInit, PsLinkDown, PsDown, PsGoingUp, PsUp + * # PortCheckingState (Bitfield): ChkTx, ChkRx, ChkSeg + * # RlmtCheckingState (Bitfield): ChkSeg, StartChkSeg, ReportSeg + * + * if (Rx - RxBpdu == 0) { # No rx. + * if (state == PsUp) { + * PortCheckingState |= ChkRx + * } + * if (ModeCheckSeg && (Timeout == + * TO_SHORTEN(RLMT_DEFAULT_TIMEOUT))) { + * RlmtCheckingState |= ChkSeg) + * PortCheckingState |= ChkSeg + * } + * NewTimeout = TO_SHORTEN(Timeout) + * if (NewTimeout < RLMT_MIN_TIMEOUT) { + * NewTimeout = RLMT_MIN_TIMEOUT + * PortState = PsDown + * ... + * } + * } + * else { # something was received + * # Set counter to 0 at LinkDown? + * # No - rx may be reported after LinkDown ??? + * PortCheckingState &= ~ChkRx + * NewTimeout = RLMT_DEFAULT_TIMEOUT + * if (RxAck == 0) { + * possible reasons: + * is my tx line bad? -- + * send RLMT multicast and report + * back internally? (only possible + * between ports on same adapter) + * } + * if (RxChk == 0) { + * possible reasons: + * - tx line of port set to check me + * maybe bad + * - no other port/adapter available or set + * to check me + * - adapter checking me has a longer + * timeout + * ??? anything that can be done here? + * } + * } + * + * Context: + * runtime, pageable? + * + * Returns: + * New timeout value. + */ +RLMT_STATIC SK_U32 SkRlmtCheckPort( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx) /* port to check */ +{ + unsigned i; + SK_U32 NewTimeout; + SK_RLMT_PORT *pRPort; + SK_EVPARA Para; + + pRPort = &pAC->Rlmt.Port[PortIdx]; + + if ((pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot) == 0) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SkRlmtCheckPort %d: No (%d) receives in last time slot.\n", + PortIdx, + pRPort->PacketsPerTimeSlot)) + + /* + * Check segmentation if there was no receive at least twice + * in a row (PortNoRx is already set) and the segmentation + * check is not currently running. + */ + + if (pRPort->PortNoRx && (pAC->Rlmt.LinksUp > 1) && + (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) && + !(pAC->Rlmt.CheckingState & SK_RLMT_RCS_SEG)) { + pAC->Rlmt.CheckingState |= + SK_RLMT_RCS_START_SEG | SK_RLMT_RCS_SEND_SEG; + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SkRlmtCheckPort: PortsSuspect %d, PcsRx %d.\n", + pRPort->PortsSuspect, + pRPort->CheckingState & SK_RLMT_PCS_RX)) + + if (pRPort->PortState != SK_RLMT_PS_DOWN) { + NewTimeout = TO_SHORTEN(pAC->Rlmt.TimeoutValue); + if (NewTimeout < SK_RLMT_MIN_TO_VAL) { + NewTimeout = SK_RLMT_MIN_TO_VAL; + } + + if (!(pRPort->CheckingState & SK_RLMT_PCS_RX)) { + Para.Para32[0] = PortIdx; + pRPort->CheckingState |= SK_RLMT_PCS_RX; + + /* + * What shall we do if the port checked + * by this one receives our request + * frames? What's bad - our rx line + * or his tx line? + */ + + SkTimerStart( + pAC, + IoC, + &pRPort->DownRxTimer, + SK_RLMT_PORTDOWN_TIM_VAL, + SKGE_RLMT, + SK_RLMT_PORTDOWN_RX_TIM, + Para); + + for (i = 0; i < pRPort->PortsChecked; i++) { + if (pRPort->PortCheck[i].SuspectTx) { + continue; + } + pRPort->PortCheck[i].SuspectTx = SK_TRUE; + pRPort->PortsSuspect++; + if ((Para.pParaPtr = + SkRlmtBuildPacket( + pAC, + IoC, + PortIdx, + SK_PACKET_CHECK_TX, + &pAC->Addr.Port[PortIdx].CurrentMacAddress, + &pRPort->PortCheck[i].CheckAddr) + ) != NULL) { + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + } + } + } + else { /* PortDown -- or all partners suspect. */ + NewTimeout = SK_RLMT_DEF_TO_VAL; + } + pRPort->PortNoRx = SK_TRUE; + } + else { /* A non-BPDU packet was received. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SkRlmtCheckPort %d: %d (%d) receives in last time slot.\n", + PortIdx, + pRPort->PacketsPerTimeSlot - + pRPort->BpduPacketsPerTimeSlot, + pRPort->PacketsPerTimeSlot)) + + SkRlmtPortReceives(pAC, IoC, PortIdx); + NewTimeout = SK_RLMT_DEF_TO_VAL; + } + + return (NewTimeout); +} /* SkRlmtCheckPort */ + + +/****************************************************************************** + * + * SkRlmtSelectBcRx - select new active port, criteria 1 (CLP) + * + * Description: + * This routine selects the port that received a broadcast frame + * substantially later than all other ports. + * + * Context: + * runtime, pageable? + * + * Returns: + * SK_BOOL + */ +RLMT_STATIC SK_BOOL SkRlmtSelectBcRx( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 A, /* active port */ +SK_U32 P, /* preferred port */ +SK_U32 *N) /* new active port */ +{ + SK_U64 BcTimeStamp; + SK_U32 i; + SK_BOOL PortFound; + + BcTimeStamp = 0; /* Not totally necessary, but feeling better. */ + PortFound = SK_FALSE; + + /* Select port with the latest TimeStamp. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("TimeStamp Port %d: %.08x%.08x.\n", + i, + *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_HI32), + *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_LO32))) + if (!pAC->Rlmt.Port[i].PortDown && + !pAC->Rlmt.Port[i].PortNoRx) { + if (!PortFound || + pAC->Rlmt.Port[i].BcTimeStamp > BcTimeStamp) { + BcTimeStamp = pAC->Rlmt.Port[i].BcTimeStamp; + *N = i; + PortFound = SK_TRUE; + } + } + } + + if (PortFound) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("Port %d received the last broadcast.\n", *N)) + + /* Look if another port's time stamp is similar. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (i == *N) { + continue; + } + if (!pAC->Rlmt.Port[i].PortDown && + !pAC->Rlmt.Port[i].PortNoRx && + (pAC->Rlmt.Port[i].BcTimeStamp > + BcTimeStamp - SK_RLMT_BC_DELTA || + pAC->Rlmt.Port[i].BcTimeStamp + + SK_RLMT_BC_DELTA > BcTimeStamp)) { + PortFound = SK_FALSE; + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("Port %d received a broadcast %s.\n", + i, + "at a similar time")) + break; + } + } + } + +#ifdef DEBUG + if (PortFound) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_CHECK_SWITCH found Port %d receiving %s.\n", + *N, + "the substantially latest broadcast")) + } +#endif /* DEBUG */ + + return (PortFound); +} /* SkRlmtSelectBcRx */ + + +/****************************************************************************** + * + * SkRlmtSelectNotSuspect - select new active port, criteria 2 (CLP) + * + * Description: + * This routine selects a good port (it is PortUp && !SuspectRx). + * + * Context: + * runtime, pageable? + * + * Returns: + * SK_BOOL + */ +RLMT_STATIC SK_BOOL SkRlmtSelectNotSuspect( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 A, /* active port */ +SK_U32 P, /* preferred port */ +SK_U32 *N) /* new active port */ +{ + SK_U32 i; + SK_BOOL PortFound; + + PortFound = SK_FALSE; + + /* Select first port that is PortUp && !SuspectRx. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (!pAC->Rlmt.Port[i].PortDown && + !(pAC->Rlmt.Port[i].CheckingState & SK_RLMT_PCS_RX)) { + *N = i; + if (!pAC->Rlmt.Port[A].PortDown && + !(pAC->Rlmt.Port[A].CheckingState & + SK_RLMT_PCS_RX)) { + *N = A; + } + if (!pAC->Rlmt.Port[P].PortDown && + !(pAC->Rlmt.Port[P].CheckingState & + SK_RLMT_PCS_RX)) { + *N = P; + } + PortFound = SK_TRUE; + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_CHECK_SWITCH found Port %d up and not check RX.\n", + *N)) + break; + } + } + + return (PortFound); +} /* SkRlmtSelectNotSuspect */ + + +/****************************************************************************** + * + * SkRlmtSelectUp - select new active port, criteria 3, 4 (CLP) + * + * Description: + * This routine selects a port that is up. + * + * Context: + * runtime, pageable? + * + * Returns: + * SK_BOOL + */ +RLMT_STATIC SK_BOOL SkRlmtSelectUp( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 A, /* active port */ +SK_U32 P, /* preferred port */ +SK_U32 *N, /* new active port */ +SK_BOOL AutoNegDone) /* successfully auto-negotiated? */ +{ + SK_U32 i; + SK_BOOL PortFound; + + PortFound = SK_FALSE; + + /* Select first port that is PortUp. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_UP && + pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) { + *N = i; + if (pAC->Rlmt.Port[A].PortState == SK_RLMT_PS_UP && + pAC->GIni.GP[A].PAutoNegFail != AutoNegDone) { + *N = A; + } + if (pAC->Rlmt.Port[P].PortState == SK_RLMT_PS_UP && + pAC->GIni.GP[P].PAutoNegFail != AutoNegDone) { + *N = P; + } + PortFound = SK_TRUE; + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_CHECK_SWITCH found Port %d up.\n", + *N)) + break; + } + } + + return (PortFound); +} /* SkRlmtSelectUp */ + + +/****************************************************************************** + * + * SkRlmtSelectGoingUp - select new active port, criteria 5, 6 (CLP) + * + * Description: + * This routine selects the port that is going up for the longest time. + * + * Context: + * runtime, pageable? + * + * Returns: + * SK_BOOL + */ +RLMT_STATIC SK_BOOL SkRlmtSelectGoingUp( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 A, /* active port */ +SK_U32 P, /* preferred port */ +SK_U32 *N, /* new active port */ +SK_BOOL AutoNegDone) /* successfully auto-negotiated? */ +{ + SK_U64 GuTimeStamp=0; + SK_U32 i; + SK_BOOL PortFound; + + PortFound = SK_FALSE; + + /* Select port that is PortGoingUp for the longest time. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_GOING_UP && + pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) { + GuTimeStamp = pAC->Rlmt.Port[i].GuTimeStamp; + *N = i; + PortFound = SK_TRUE; + break; + } + } + + if (!PortFound) { + return (SK_FALSE); + } + + for (i = *N + 1; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_GOING_UP && + pAC->Rlmt.Port[i].GuTimeStamp < GuTimeStamp && + pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) { + + GuTimeStamp = pAC->Rlmt.Port[i].GuTimeStamp; + *N = i; + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_CHECK_SWITCH found Port %d going up.\n", *N)) + + return (SK_TRUE); +} /* SkRlmtSelectGoingUp */ + + +/****************************************************************************** + * + * SkRlmtSelectDown - select new active port, criteria 7, 8 (CLP) + * + * Description: + * This routine selects a port that is down. + * + * Context: + * runtime, pageable? + * + * Returns: + * SK_BOOL + */ +RLMT_STATIC SK_BOOL SkRlmtSelectDown( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 A, /* active port */ +SK_U32 P, /* preferred port */ +SK_U32 *N, /* new active port */ +SK_BOOL AutoNegDone) /* successfully auto-negotiated? */ +{ + SK_U32 i; + SK_BOOL PortFound; + + PortFound = SK_FALSE; + + /* Select first port that is PortDown. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_DOWN && + pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) { + *N = i; + if (pAC->Rlmt.Port[A].PortState == SK_RLMT_PS_DOWN && + pAC->GIni.GP[A].PAutoNegFail != AutoNegDone) { + *N = A; + } + if (pAC->Rlmt.Port[P].PortState == SK_RLMT_PS_DOWN && + pAC->GIni.GP[P].PAutoNegFail != AutoNegDone) { + *N = P; + } + PortFound = SK_TRUE; + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_CHECK_SWITCH found Port %d down.\n", + *N)) + break; + } + } + + return (PortFound); +} /* SkRlmtSelectDown */ + + +/****************************************************************************** + * + * SkRlmtCheckSwitch - select new active port and switch to it + * + * Description: + * This routine decides which port should be the active one and queues + * port switching if necessary. + * + * Context: + * runtime, pageable? + * + * Returns: + * Nothing. + */ +RLMT_STATIC void SkRlmtCheckSwitch( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* I/O context */ +{ + SK_EVPARA Para; + SK_U32 A; + SK_U32 P; + SK_U32 i; + SK_BOOL PortFound; + + if (pAC->Rlmt.RlmtState == SK_RLMT_RS_INIT) { + return; + } + + A = pAC->Rlmt.MacActive; /* Index of active port. */ + P = pAC->Rlmt.PrefPort; /* Index of preferred port. */ + PortFound = SK_FALSE; + + if (pAC->Rlmt.LinksUp == 0) { + + /* + * Last link went down - shut down the net. + */ + + pAC->Rlmt.RlmtState = SK_RLMT_RS_NET_DOWN; + Para.Para32[0] = SK_RLMT_NET_DOWN_TEMP; + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_NET_DOWN, + Para); + + return; + } + else if (pAC->Rlmt.LinksUp == 1 && + pAC->Rlmt.RlmtState == SK_RLMT_RS_NET_DOWN) { + + /* First link came up - get the net up. */ + + pAC->Rlmt.RlmtState = SK_RLMT_RS_NET_UP; + + /* + * If pAC->Rlmt.MacActive != Para.Para32[0], + * the DRV switches to the port that came up. + */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (!pAC->Rlmt.Port[i].LinkDown) { + if (!pAC->Rlmt.Port[A].LinkDown) { + i = A; + } + if (!pAC->Rlmt.Port[P].LinkDown) { + i = P; + } + PortFound = SK_TRUE; + break; + } + } + + if (PortFound) { + Para.Para32[0] = pAC->Rlmt.MacActive; + Para.Para32[1] = i; + SkEventQueue( + pAC, + SKGE_PNMI, + SK_PNMI_EVT_RLMT_PORT_SWITCH, + Para); + + pAC->Rlmt.MacActive = i; + Para.Para32[0] = i; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_NET_UP, Para); + + if ((Para.pParaPtr = SkRlmtBuildPacket( + pAC, + IoC, + i, + SK_PACKET_ANNOUNCE, + &pAC->Addr.CurrentMacAddress, + &SkRlmtMcAddr) + ) != NULL) { + + /* + * Send packet to RLMT multicast address + * to force switches to learn the new + * location of the address. + */ + + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + } + else { + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E007, + SKERR_RLMT_E007_MSG); + } + + return; + } + else { + Para.Para32[0] = A; + + /* + * Preselection: + * If RLMT Mode != CheckLinkState + * select port that received a broadcast frame + * substantially later than all other ports + * else select first port that is not SuspectRx + * else select first port that is PortUp + * else select port that is PortGoingUp for the longest time + * else select first port that is PortDown + * else stop. + * + * For the preselected port: + * If ActivePort is equal in quality, select ActivePort. + * + * If PrefPort is equal in quality, select PrefPort. + * + * If MacActive != SelectedPort, + * If old ActivePort is LinkDown, + * SwitchHard + * else + * SwitchSoft + */ + + if (pAC->Rlmt.RlmtMode != SK_RLMT_CHECK_LINK) { + if (!PortFound) { + PortFound = SkRlmtSelectBcRx(pAC, IoC, + A, P, &Para.Para32[1]); + } + + if (!PortFound) { + PortFound = SkRlmtSelectNotSuspect(pAC, IoC, + A, P, &Para.Para32[1]); + } + } + + if (!PortFound) { + PortFound = SkRlmtSelectUp(pAC, IoC, + A, P, &Para.Para32[1], AUTONEG_SUCCESS); + } + + if (!PortFound) { + PortFound = SkRlmtSelectUp(pAC, IoC, + A, P, &Para.Para32[1], AUTONEG_FAILED); + } + + if (!PortFound) { + PortFound = SkRlmtSelectGoingUp(pAC, IoC, + A, P, &Para.Para32[1], AUTONEG_SUCCESS); + } + + if (!PortFound) { + PortFound = SkRlmtSelectGoingUp(pAC, IoC, + A, P,&Para.Para32[1], AUTONEG_FAILED); + } + + if (pAC->Rlmt.RlmtMode != SK_RLMT_CHECK_LINK) { + if (!PortFound) { + PortFound = SkRlmtSelectDown(pAC, IoC, + A, P,&Para.Para32[1], AUTONEG_SUCCESS); + } + + if (!PortFound) { + PortFound = SkRlmtSelectDown(pAC, IoC, + A, P,&Para.Para32[1], AUTONEG_FAILED); + } + } + + if (PortFound) { + if (Para.Para32[1] != A) { + pAC->Rlmt.MacActive = Para.Para32[1]; + SK_HWAC_LINK_LED( + pAC, + IoC, + Para.Para32[1], + SK_LED_ACTIVE); + if (pAC->Rlmt.Port[A].LinkDown) { + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_SWITCH_HARD, + Para); + } + else { + SK_HWAC_LINK_LED( + pAC, + IoC, + Para.Para32[0], + SK_LED_STANDBY); + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_SWITCH_SOFT, + Para); + } + SkEventQueue( + pAC, + SKGE_PNMI, + SK_PNMI_EVT_RLMT_PORT_SWITCH, + Para); + if ((Para.pParaPtr = SkRlmtBuildPacket( + pAC, + IoC, + Para.Para32[1], + SK_PACKET_ANNOUNCE, + &pAC->Addr.CurrentMacAddress, + &SkRlmtMcAddr) + ) != NULL) { + + /* + * Send "new" packet to RLMT multicast + * address to force switches to learn + * the new location of the MAC address. + */ + + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para); + } + } + } + else { + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E004, + SKERR_RLMT_E004_MSG); + } + } + + return; +} /* SkRlmtCheckSwitch */ + + +/****************************************************************************** + * + * SkRlmtCheckSeg - Report if segmentation is detected + * + * Description: + * This routine checks if the ports see different root bridges and reports + * segmentation in such a case. + * + * Context: + * runtime, pageable? + * + * Returns: + * Nothing. + */ +RLMT_STATIC void SkRlmtCheckSeg( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* I/O context */ +{ + SK_BOOL Equal; + SK_U32 i, j; + + pAC->Rlmt.RootIdSet = SK_FALSE; + Equal = SK_TRUE; + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (pAC->Rlmt.Port[i].LinkDown || + !pAC->Rlmt.Port[i].RootIdSet) { + continue; + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("Root ID %d: %02x %02x %02x %02x %02x %02x %02x %02x.\n", + i, + pAC->Rlmt.Port[i].Root.Id[0], + pAC->Rlmt.Port[i].Root.Id[1], + pAC->Rlmt.Port[i].Root.Id[2], + pAC->Rlmt.Port[i].Root.Id[3], + pAC->Rlmt.Port[i].Root.Id[4], + pAC->Rlmt.Port[i].Root.Id[5], + pAC->Rlmt.Port[i].Root.Id[6], + pAC->Rlmt.Port[i].Root.Id[7])) + + if (!pAC->Rlmt.RootIdSet) { + pAC->Rlmt.Root = pAC->Rlmt.Port[i].Root; + pAC->Rlmt.RootIdSet = SK_TRUE; + continue; + } + + for (j = 0; j < 8; j ++) { + Equal &= pAC->Rlmt.Port[i].Root.Id[j] == + pAC->Rlmt.Root.Id[j]; + if (!Equal) { + break; + } + } + + if (!Equal) { + SK_ERR_LOG( + pAC, + SK_ERRCL_COMM, + SKERR_RLMT_E005, + SKERR_RLMT_E005_MSG); +#ifdef SK_PNMI_EVT_SEGMENTATION + SkEventQueue( + pAC, + SKGE_PNMI, + SK_PNMI_EVT_SEGMENTATION, + Para); +#endif /* SK_PNMI_EVT_SEGMENTATION */ + pAC->Rlmt.CheckingState &= ~SK_RLMT_RCS_REPORT_SEG; + break; + } + } +} /* SkRlmtCheckSeg */ + + +/****************************************************************************** + * + * SkRlmtPortStart - initialize port variables and start port + * + * Description: + * This routine initializes a port's variables and issues a PORT_START + * to the HWAC module. This handles retries if the start fails or the + * link eventually goes down. + * + * Context: + * runtime, pageable? + * + * Returns: + * Nothing + */ +RLMT_STATIC void SkRlmtPortStart( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx) /* event code */ +{ + SK_EVPARA Para; + + pAC->Rlmt.Port[PortIdx].PortState = SK_RLMT_PS_LINK_DOWN; + pAC->Rlmt.Port[PortIdx].PortStarted = SK_TRUE; + pAC->Rlmt.Port[PortIdx].LinkDown = SK_TRUE; + pAC->Rlmt.Port[PortIdx].PortDown = SK_TRUE; + pAC->Rlmt.Port[PortIdx].CheckingState = 0; + pAC->Rlmt.Port[PortIdx].RootIdSet = SK_FALSE; + Para.Para32[0] = PortIdx; + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para); +} /* SkRlmtPortStart */ + + +/****************************************************************************** + * + * SkRlmtEvent - a PORT- or an RLMT-specific event happened + * + * Description: + * This routine handles PORT- and RLMT-specific events. + * + * Context: + * runtime, pageable? + * may be called after SK_INIT_IO + * + * Returns: + * 0 + */ +int SkRlmtEvent( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 Event, /* event code */ +SK_EVPARA Para) /* event-specific parameter */ +{ + SK_U32 i, j; + SK_RLMT_PORT *pRPort; + SK_EVPARA Para2; + SK_MBUF *pMb; + SK_MBUF *pNextMb; + SK_MAC_ADDR *pOldMacAddr; + SK_MAC_ADDR *pNewMacAddr; + SK_U32 Timeout; + SK_U32 NewTimeout; + SK_U32 PrevRlmtMode; + + switch (Event) { + case SK_RLMT_PORTSTART_TIM: /* From RLMT via TIME. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTSTART_TIMEOUT Port %d Event (%d) BEGIN.\n", Para.Para32[0], Event)) + + /* + * Used to start non-preferred ports if the preferred one + * does not come up. + * This timeout needs only be set when starting the first + * (preferred) port. + */ + + if (pAC->Rlmt.Port[Para.Para32[0]].LinkDown) { + + /* PORT_START failed. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (!pAC->Rlmt.Port[i].PortStarted) { + SkRlmtPortStart(pAC, IoC, i); + } + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTSTART_TIMEOUT Event (%d) END.\n", Event)) + break; + + case SK_RLMT_LINK_UP: /* From SIRQ. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_LINK_UP Port %d Event (%d) BEGIN.\n", + Para.Para32[0], Event)) + + pRPort = &pAC->Rlmt.Port[Para.Para32[0]]; + + if (!pRPort->PortStarted) { + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E008, + SKERR_RLMT_E008_MSG); + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_LINK_UP Event (%d) EMPTY.\n", Event)) + break; + } + + if (!pRPort->LinkDown) { + /* RA;:;: Any better solution? */ + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_LINK_UP Event (%d) EMPTY.\n", Event)) + break; + } + + SkTimerStop(pAC, IoC, &pRPort->UpTimer); + SkTimerStop(pAC, IoC, &pRPort->DownRxTimer); + SkTimerStop(pAC, IoC, &pRPort->DownTxTimer); + + /* Do something if timer already fired? */ + + pRPort->LinkDown = SK_FALSE; + pRPort->PortState = SK_RLMT_PS_GOING_UP; + pRPort->GuTimeStamp = SkOsGetTime(pAC); + pRPort->BcTimeStamp = 0; + if (pAC->Rlmt.LinksUp == 0) { + SK_HWAC_LINK_LED( + pAC, + IoC, + Para.Para32[0], + SK_LED_ACTIVE); + } + else { + SK_HWAC_LINK_LED( + pAC, + IoC, + Para.Para32[0], + SK_LED_STANDBY); + } + pAC->Rlmt.LinksUp++; + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (!pAC->Rlmt.Port[i].PortStarted) { + SkRlmtPortStart(pAC, IoC, i); + } + } + + SkRlmtCheckSwitch(pAC, IoC); + + if (pAC->Rlmt.LinksUp >= 2) { + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK) { + + /* Build the check chain. */ + + SkRlmtBuildCheckChain(pAC); + } + } + + /* + * If the first link comes up, start the periodical + * RLMT timeout. + */ + + if (pAC->GIni.GIMacsFound > 1 && pAC->Rlmt.LinksUp == 1 && + (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_OTHERS)) { + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.LocTimer, + pAC->Rlmt.TimeoutValue, + SKGE_RLMT, + SK_RLMT_TIM, + Para); + } + + SkTimerStart( + pAC, + IoC, + &pRPort->UpTimer, + SK_RLMT_PORTUP_TIM_VAL, + SKGE_RLMT, + SK_RLMT_PORTUP_TIM, + Para); + + /* + * Later: + * if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK) && + */ + + if ((pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LINK) && + (Para2.pParaPtr = SkRlmtBuildPacket( + pAC, + IoC, + Para.Para32[0], + SK_PACKET_ANNOUNCE, + &pAC->Addr.Port[Para.Para32[0]].CurrentMacAddress, + &SkRlmtMcAddr) + ) != NULL) { + + /* Send "new" packet to RLMT multicast address. */ + + SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para2); + } + + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) { + if ((Para2.pParaPtr = + SkRlmtBuildSpanningTreePacket( + pAC, + IoC, + Para.Para32[0]) + ) != NULL) { + + pAC->Rlmt.Port[Para.Para32[0]].RootIdSet = + SK_FALSE; + pAC->Rlmt.CheckingState |= + SK_RLMT_RCS_SEG | + SK_RLMT_RCS_REPORT_SEG; + + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para2); + + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.SegTimer, + SK_RLMT_SEG_TO_VAL, + SKGE_RLMT, + SK_RLMT_SEG_TIM, + Para); + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_LINK_UP Event (%d) END.\n", Event)) + break; + + case SK_RLMT_PORTUP_TIM: /* From RLMT via TIME. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTUP_TIM Port %d Event (%d) BEGIN.\n", Para.Para32[0], Event)) + + pRPort = &pAC->Rlmt.Port[Para.Para32[0]]; + + if (pRPort->LinkDown || (pRPort->PortState == SK_RLMT_PS_UP)) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTUP_TIM Port %d Event (%d) EMPTY.\n", + Para.Para32[0], + Event)) + break; + } + + pRPort->PortDown = SK_FALSE; + pRPort->PortState = SK_RLMT_PS_UP; + pAC->Rlmt.PortsUp++; + + if (pAC->Rlmt.RlmtState != SK_RLMT_RS_INIT) { + SkRlmtCheckSwitch(pAC, IoC); + + SkEventQueue( + pAC, + SKGE_PNMI, + SK_PNMI_EVT_RLMT_PORT_UP, + Para); + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTUP_TIM Event (%d) END.\n", Event)) + break; + + case SK_RLMT_PORTDOWN: /* From RLMT. */ + case SK_RLMT_PORTDOWN_RX_TIM: /* From RLMT via TIME. */ + case SK_RLMT_PORTDOWN_TX_TIM: /* From RLMT via TIME. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTDOWN* Port %d Event (%d) BEGIN.\n", Para.Para32[0], Event)) + + pRPort = &pAC->Rlmt.Port[Para.Para32[0]]; + + if (!pRPort->PortStarted || + (Event == SK_RLMT_PORTDOWN_TX_TIM && + !(pRPort->CheckingState & SK_RLMT_PCS_TX))) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTDOWN* Event (%d) EMPTY.\n", Event)) + break; + } + /* Stop port's timers. */ + + SkTimerStop(pAC, IoC, &pRPort->UpTimer); + SkTimerStop(pAC, IoC, &pRPort->DownRxTimer); + SkTimerStop(pAC, IoC, &pRPort->DownTxTimer); + + if (pRPort->PortState != SK_RLMT_PS_LINK_DOWN) { + pRPort->PortState = SK_RLMT_PS_DOWN; + } + + if (!pRPort->PortDown) { + pAC->Rlmt.PortsUp--; + pRPort->PortDown = SK_TRUE; + + SkEventQueue( + pAC, + SKGE_PNMI, + SK_PNMI_EVT_RLMT_PORT_DOWN, + Para); + } + + pRPort->PacketsPerTimeSlot = 0; + pRPort->DataPacketsPerTimeSlot = 0; + pRPort->BpduPacketsPerTimeSlot = 0; +#if 0 + pRPort->RlmtChksPerTimeSlot = 0; + pRPort->RlmtAcksPerTimeSlot = 0; +#endif /* 0 */ + + /* + * RA;:;: To be checked: + * - actions at RLMT_STOP: We should not switch anymore. + */ + + if (pAC->Rlmt.RlmtState != SK_RLMT_RS_INIT) { + if (Para.Para32[0] == pAC->Rlmt.MacActive) { + + /* Active Port went down. */ + + SkRlmtCheckSwitch(pAC, IoC); + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORTDOWN* Event (%d) END.\n", Event)) + break; + + case SK_RLMT_LINK_DOWN: /* From SIRQ. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_LINK_DOWN Port %d Event (%d) BEGIN.\n", + Para.Para32[0], Event)) + + if (!pAC->Rlmt.Port[Para.Para32[0]].LinkDown) { + pAC->Rlmt.LinksUp--; + pAC->Rlmt.Port[Para.Para32[0]].LinkDown = SK_TRUE; + pAC->Rlmt.Port[Para.Para32[0]].PortState = + SK_RLMT_PS_LINK_DOWN; + SK_HWAC_LINK_LED( + pAC, + IoC, + Para.Para32[0], + SK_LED_OFF); + + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK) { + + /* Build the check chain. */ + + SkRlmtBuildCheckChain(pAC); + } + + /* Ensure that port is marked down. */ + + (void)SkRlmtEvent( + pAC, + IoC, + SK_RLMT_PORTDOWN, + Para); + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_LINK_DOWN Event (%d) END.\n", Event)) + break; + + case SK_RLMT_PORT_ADDR: /* From ADDR. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORT_ADDR Port %d Event (%d) BEGIN.\n", Para.Para32[0], Event)) + + /* Port's physical MAC address changed. */ + + pOldMacAddr = + &pAC->Addr.Port[Para.Para32[0]].PreviousMacAddress; + pNewMacAddr = + &pAC->Addr.Port[Para.Para32[0]].CurrentMacAddress; + + /* + * NOTE: This is not scalable for solutions where ports are + * checked remotely. There, we need to send an RLMT + * address change packet - and how do we ensure delivery? + */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pRPort = &pAC->Rlmt.Port[i]; + for (j = 0; j < pRPort->PortsChecked; j++) { + if (SK_ADDR_EQUAL( + pRPort->PortCheck[j].CheckAddr.a, + pOldMacAddr->a)) { + pRPort->PortCheck[j].CheckAddr = + *pNewMacAddr; + } + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PORT_ADDR Event (%d) END.\n", Event)) + break; + + /* ----- RLMT events ----- */ + + case SK_RLMT_START: /* From DRV. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_START Event (%d) BEGIN.\n", Event)) + + if (pAC->Rlmt.RlmtState != SK_RLMT_RS_INIT) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_START Event (%d) EMPTY.\n", Event)) + break; + } + + if (pAC->Rlmt.PrefPort >= (SK_U32)pAC->GIni.GIMacsFound) { + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E009, + SKERR_RLMT_E009_MSG); + + /* Change PrefPort to internal default. */ + + Para.Para32[0] = 0xFFFFFFFF; + (void)SkRlmtEvent( + pAC, + IoC, + SK_RLMT_PREFPORT_CHANGE, + Para); + } +#if 0 + if (pAC->GIni.GIMacsFound == 1 && + pAC->Rlmt.RlmtMode != SK_RLMT_CHECK_LINK) { + Para.Para32[0] = SK_RLMT_CHECK_LINK; + (void)SkRlmtEvent( + pAC, + IoC, + SK_RLMT_MODE_CHANGE, + Para); + } +#endif /* 0 */ + pAC->Rlmt.LinksUp = 0; + pAC->Rlmt.PortsUp = 0; + pAC->Rlmt.CheckingState = 0; + pAC->Rlmt.RlmtState = SK_RLMT_RS_NET_DOWN; + + SkRlmtPortStart(pAC, IoC, pAC->Rlmt.PrefPort); + + /* Start Timer (for first port only). */ + + Para2.Para32[0] = pAC->Rlmt.PrefPort; + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.Port[pAC->Rlmt.PrefPort].UpTimer, + SK_RLMT_PORTSTART_TIM_VAL, + SKGE_RLMT, + SK_RLMT_PORTSTART_TIM, + Para2); + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_START Event (%d) END.\n", Event)) + break; + + case SK_RLMT_STOP: /* From DRV. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STOP Event (%d) BEGIN.\n", Event)) + + if (pAC->Rlmt.RlmtState == SK_RLMT_RS_INIT) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STOP Event (%d) EMPTY.\n", Event)) + break; + } + + /* Stop RLMT timers. */ + + SkTimerStop(pAC, IoC, &pAC->Rlmt.LocTimer); + SkTimerStop(pAC, IoC, &pAC->Rlmt.SegTimer); + + /* Stop Net. */ + + pAC->Rlmt.RlmtState = SK_RLMT_RS_INIT; + pAC->Rlmt.RootIdSet = SK_FALSE; + Para2.Para32[0] = SK_RLMT_NET_DOWN_FINAL; + SkEventQueue(pAC, SKGE_DRV, SK_DRV_NET_DOWN, Para2); + + /* Stop ports. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + if (pAC->Rlmt.Port[i].PortState != SK_RLMT_PS_INIT) { + SkTimerStop( + pAC, + IoC, + &pAC->Rlmt.Port[i].UpTimer); + SkTimerStop( + pAC, + IoC, + &pAC->Rlmt.Port[i].DownRxTimer); + SkTimerStop( + pAC, + IoC, + &pAC->Rlmt.Port[i].DownTxTimer); + + pAC->Rlmt.Port[i].PortState = SK_RLMT_PS_INIT; + pAC->Rlmt.Port[i].RootIdSet = SK_FALSE; + pAC->Rlmt.Port[i].PortStarted = SK_FALSE; + Para2.Para32[0] = i; + SkEventQueue( + pAC, + SKGE_HWAC, + SK_HWEV_PORT_STOP, + Para2); + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STOP Event (%d) END.\n", Event)) + break; + + case SK_RLMT_TIM: /* From RLMT via TIME. */ +#if 0 + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_TIM Event (%d) BEGIN.\n", Event)) +#endif /* 0 */ + + if (!(pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_OTHERS) || + pAC->Rlmt.LinksUp == 0) { + + /* + * Mode changed or all links down: + * No more link checking. + */ + + break; + } + +#if 0 + pAC->Rlmt.SwitchCheckCounter--; + if (pAC->Rlmt.SwitchCheckCounter == 0) { + pAC->Rlmt.SwitchCheckCounter; + } +#endif /* 0 */ + + NewTimeout = SK_RLMT_DEF_TO_VAL; + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pRPort = &pAC->Rlmt.Port[i]; + if (!pRPort->LinkDown) { + Timeout = SkRlmtCheckPort(pAC, IoC, i); + if (Timeout < NewTimeout) { + NewTimeout = Timeout; + } + + /* + * This counter should be set to 0 for all + * ports before the first frame is sent in the + * next loop. + */ + + pRPort->PacketsPerTimeSlot = 0; + pRPort->DataPacketsPerTimeSlot = 0; + pRPort->BpduPacketsPerTimeSlot = 0; +#if 0 + pRPort->RlmtChksPerTimeSlot = 0; + pRPort->RlmtAcksPerTimeSlot = 0; +#endif /* 0 */ + } + } + pAC->Rlmt.TimeoutValue = NewTimeout; + + if (pAC->Rlmt.LinksUp > 1) { + /* + * If checking remote ports, also send packets if + * (LinksUp == 1) && + * this port checks at least one (remote) port. + */ + + /* + * Must be new loop, as SkRlmtCheckPort can request to + * check segmentation when e.g. checking the last port. + */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pRPort = &pAC->Rlmt.Port[i]; + if (!pRPort->LinkDown) { /* !PortDown? */ + SkRlmtSend(pAC, IoC, i); + } + } + } + + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.LocTimer, + pAC->Rlmt.TimeoutValue, + SKGE_RLMT, + SK_RLMT_TIM, + Para); + + if (pAC->Rlmt.LinksUp > 1 && + (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) && + (pAC->Rlmt.CheckingState & SK_RLMT_RCS_START_SEG)) { + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.SegTimer, + SK_RLMT_SEG_TO_VAL, + SKGE_RLMT, + SK_RLMT_SEG_TIM, + Para); + pAC->Rlmt.CheckingState &= + ~SK_RLMT_RCS_START_SEG; + pAC->Rlmt.CheckingState |= + SK_RLMT_RCS_SEG | SK_RLMT_RCS_REPORT_SEG; + } + +#if 0 + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_TIM Event (%d) END.\n", Event)) +#endif /* 0 */ + break; + + case SK_RLMT_SEG_TIM: + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_SEG_TIM Event (%d) BEGIN.\n", Event)) + +#ifdef DEBUG + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + SK_U8 InAddr8[6]; + SK_U16 *InAddr; + SK_ADDR_PORT *pAPort; + + InAddr = (SK_U16 *)&InAddr8[0]; + pAPort = &pAC->Addr.Port[i]; + for (j = 0; + j < pAPort->NextExactMatchRlmt; + j++) { + + /* Get exact match address j from port i. */ + + XM_INADDR(IoC, i, XM_EXM(j), InAddr); + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("MC address %d on Port %u: %02x %02x %02x %02x %02x %02x -- %02x %02x %02x %02x %02x %02x.\n", + j, + i, + InAddr8[0], + InAddr8[1], + InAddr8[2], + InAddr8[3], + InAddr8[4], + InAddr8[5], + pAPort->Exact[j].a[0], + pAPort->Exact[j].a[1], + pAPort->Exact[j].a[2], + pAPort->Exact[j].a[3], + pAPort->Exact[j].a[4], + pAPort->Exact[j].a[5])) + } + } +#endif /* DEBUG */ + + pAC->Rlmt.CheckingState &= ~SK_RLMT_RCS_SEG; + + SkRlmtCheckSeg(pAC, IoC); + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_SEG_TIM Event (%d) END.\n", Event)) + break; + + case SK_RLMT_PACKET_RECEIVED: /* From DRV. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PACKET_RECEIVED Event (%d) BEGIN.\n", Event)) + + /* Should we ignore frames during port switching? */ + +#ifdef DEBUG + pMb = Para.pParaPtr; + if (pMb == NULL) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("No mbuf.\n")) + } + else if (pMb->pNext != NULL) { + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("More than one mbuf or pMb->pNext not set.\n")) + } +#endif /* DEBUG */ + + for (pMb = Para.pParaPtr; pMb != NULL; pMb = pNextMb) { + pNextMb = pMb->pNext; + pMb->pNext = NULL; + SkRlmtPacketReceive(pAC, IoC, pMb); + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PACKET_RECEIVED Event (%d) END.\n", Event)) + break; + + case SK_RLMT_STATS_CLEAR: /* From PNMI. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STATS_CLEAR Event (%d) BEGIN.\n", Event)) + + /* Clear statistics for virtual and physical ports. */ + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + pAC->Rlmt.Port[i].TxHelloCts = 0; + pAC->Rlmt.Port[i].RxHelloCts = 0; + pAC->Rlmt.Port[i].TxSpHelloReqCts = 0; + pAC->Rlmt.Port[i].RxSpHelloCts = 0; + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STATS_CLEAR Event (%d) END.\n", Event)) + break; + + case SK_RLMT_STATS_UPDATE: /* From PNMI. */ +#if 0 + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STATS_UPDATE Event (%d) BEGIN.\n", Event)) + + /* Update statistics. */ + + /* Currently always up-to-date. */ + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_STATS_UPDATE Event (%d) END.\n", Event)) +#endif /* 0 */ + break; + + case SK_RLMT_PREFPORT_CHANGE: /* From PNMI. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PREFPORT_CHANGE to Port %d Event (%d) BEGIN.\n", Para.Para32[0], Event)) + + /* 0xFFFFFFFF == auto-mode. */ + + if (Para.Para32[0] == 0xFFFFFFFF) { + pAC->Rlmt.PrefPort = SK_RLMT_DEF_PREF_PORT; + } + else { + if (Para.Para32[0] >= (SK_U32)pAC->GIni.GIMacsFound) { + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E010, + SKERR_RLMT_E010_MSG); + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PREFPORT_CHANGE Event (%d) EMPTY.\n", Event)) + break; + } + + pAC->Rlmt.PrefPort = Para.Para32[0]; + } + + pAC->Rlmt.MacPreferred = Para.Para32[0]; + + SkRlmtCheckSwitch(pAC, IoC); + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_PREFPORT_CHANGE Event (%d) END.\n", Event)) + break; + + case SK_RLMT_MODE_CHANGE: /* From PNMI. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_MODE_CHANGE Event (%d) BEGIN.\n", Event)) + + if (pAC->GIni.GIMacsFound < 2) { + pAC->Rlmt.RlmtMode = SK_RLMT_CHECK_LINK; + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("Forced RLMT mode to CLS on single link adapter.\n")) + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_MODE_CHANGE Event (%d) EMPTY.\n", + Event)) + break; + } + + /* Update RLMT mode. */ + + PrevRlmtMode = pAC->Rlmt.RlmtMode; + pAC->Rlmt.RlmtMode = Para.Para32[0] | SK_RLMT_CHECK_LINK; + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("RLMT: Changed Mode to %X.\n", pAC->Rlmt.RlmtMode)) + + if ((PrevRlmtMode & SK_RLMT_CHECK_LOC_LINK) != + (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK)) { + if (!(PrevRlmtMode & SK_RLMT_CHECK_OTHERS) && + pAC->GIni.GIMacsFound > 1 && + pAC->Rlmt.PortsUp == 1) { + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.LocTimer, + pAC->Rlmt.TimeoutValue, + SKGE_RLMT, + SK_RLMT_TIM, + Para); + } + } + + if ((PrevRlmtMode & SK_RLMT_CHECK_SEG) != + (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG)) { + + for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) { + (void)SkAddrMcClear( + pAC, + IoC, + i, + SK_ADDR_PERMANENT | SK_MC_SW_ONLY); + + /* Add RLMT MC address. */ + + (void)SkAddrMcAdd( + pAC, + IoC, + i, + &SkRlmtMcAddr, + SK_ADDR_PERMANENT); + + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) { + /* Add BPDU MC address. */ + + (void)SkAddrMcAdd( + pAC, + IoC, + i, + &BridgeMcAddr, + SK_ADDR_PERMANENT); + + if (pAC->Rlmt.RlmtState != + SK_RLMT_RS_INIT) { + if (!pAC->Rlmt.Port[i].LinkDown && + (Para2.pParaPtr = + SkRlmtBuildSpanningTreePacket( + pAC, + IoC, + i) + ) != NULL) { + + pAC->Rlmt.Port[i + ].RootIdSet = + SK_FALSE; + + SkEventQueue( + pAC, + SKGE_DRV, + SK_DRV_RLMT_SEND, + Para2); + } + } + } + + (void)SkAddrMcUpdate(pAC, IoC, i); + } + + if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_SEG) { + SkTimerStart( + pAC, + IoC, + &pAC->Rlmt.SegTimer, + SK_RLMT_SEG_TO_VAL, + SKGE_RLMT, + SK_RLMT_SEG_TIM, + Para); + } + } + + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("SK_RLMT_MODE_CHANGE Event (%d) END.\n", Event)) + break; + + default: /* Create error log entry. */ + SK_DBG_MSG( + pAC, + SK_DBGMOD_RLMT, + SK_DBGCAT_CTRL, + ("Unknown RLMT Event %d.\n", Event)) + + SK_ERR_LOG( + pAC, + SK_ERRCL_SW, + SKERR_RLMT_E003, + SKERR_RLMT_E003_MSG); + break; + } + + return (0); +} /* SkRlmtEvent */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/sktimer.c linux/drivers/net/sk98lin/sktimer.c --- v2.3.28/linux/drivers/net/sk98lin/sktimer.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/sktimer.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,290 @@ +/****************************************************************************** + * + * Name: sktimer.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.11 $ + * Date: $Date: 1998/12/17 13:24:13 $ + * Purpose: High level timer functions. + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: sktimer.c,v $ + * Revision 1.11 1998/12/17 13:24:13 gklug + * fix: restart problem: do NOT destroy timer queue if init 1 is done + * + * Revision 1.10 1998/10/15 15:11:36 gklug + * fix: ID_sccs to SysKonnectFileId + * + * Revision 1.9 1998/09/15 15:15:04 cgoos + * Changed TRUE/FALSE to SK_TRUE/SK_FALSE + * + * Revision 1.8 1998/09/08 08:47:55 gklug + * add: init level handling + * + * Revision 1.7 1998/08/19 09:50:53 gklug + * fix: remove struct keyword from c-code (see CCC) add typedefs + * + * Revision 1.6 1998/08/17 13:43:13 gklug + * chg: Parameter will be union of 64bit para, 2 times SK_U32 or SK_PTR + * + * Revision 1.5 1998/08/14 07:09:14 gklug + * fix: chg pAc -> pAC + * + * Revision 1.4 1998/08/07 12:53:46 gklug + * fix: first compiled version + * + * Revision 1.3 1998/08/07 09:31:53 gklug + * fix: delta spelling + * + * Revision 1.2 1998/08/07 09:31:02 gklug + * adapt functions to new c coding conventions + * rmv: "fast" handling + * chg: inserting of new timer in queue. + * chg: event queue generation when timer runs out + * + * Revision 1.1 1998/08/05 11:27:55 gklug + * first version: adapted from SMT + * + * + * + * + ******************************************************************************/ + + +/* + Event queue and dispatcher +*/ +static const char SysKonnectFileId[] = + "$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.11 1998/12/17 13:24:13 gklug Exp $" ; + +#include "h/skdrv1st.h" /* Driver Specific Definitions */ +#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ + +#ifdef __C2MAN__ +/* + Event queue management. + + General Description: + + */ +intro() +{} +#endif + + +/* Forward declaration */ +static void timer_done(SK_AC *pAC,SK_IOC Ioc,int Restart); + + +/* + * Inits the software timer + * + * needs to be called during Init level 1. + */ +void SkTimerInit( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc, /* IoContext */ +int Level) /* Init Level */ +{ + switch (Level) { + case SK_INIT_DATA: + pAC->Tim.StQueue = 0 ; + break; + case SK_INIT_IO: + SkHwtInit(pAC,Ioc) ; + SkTimerDone(pAC, Ioc); + break; + default: + break; + } +} + +/* + * Stops a high level timer + * - If a timer is not in the queue the function returns normally, too. + */ +void SkTimerStop( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc, /* IoContext */ +SK_TIMER *pTimer) /* Timer Pointer to be started */ +{ + SK_TIMER **ppTimPrev ; + SK_TIMER *pTm ; + + /* + * remove timer from queue + */ + pTimer->TmActive = SK_FALSE ; + if (pAC->Tim.StQueue == pTimer && !pTimer->TmNext) { + SkHwtStop(pAC,Ioc) ; + } + for (ppTimPrev = &pAC->Tim.StQueue ; (pTm = *ppTimPrev) ; + ppTimPrev = &pTm->TmNext ) { + if (pTm == pTimer) { + /* + * Timer found in queue + * - dequeue it and + * - correct delta of the next timer + */ + *ppTimPrev = pTm->TmNext ; + + if (pTm->TmNext) { + /* correct delta of next timer in queue */ + pTm->TmNext->TmDelta += pTm->TmDelta ; + } + return ; + } + } +} + +/* + * Start a high level software timer + */ +void SkTimerStart( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc, /* IoContext */ +SK_TIMER *pTimer, /* Timer Pointer to be started */ +SK_U32 Time, /* Time value */ +SK_U32 Class, /* Event Class for this timer */ +SK_U32 Event, /* Event Value for this timer */ +SK_EVPARA Para) /* Event Parameter for this timer */ +{ + SK_TIMER **ppTimPrev ; + SK_TIMER *pTm ; + SK_U32 Delta ; + + Time /= 16 ; /* input is uS, clock ticks are 16uS */ + if (!Time) + Time = 1 ; + + SkTimerStop(pAC,Ioc,pTimer) ; + + pTimer->TmClass = Class ; + pTimer->TmEvent = Event ; + pTimer->TmPara = Para ; + pTimer->TmActive = SK_TRUE ; + + if (!pAC->Tim.StQueue) { + /* First Timer to be started */ + pAC->Tim.StQueue = pTimer ; + pTimer->TmNext = 0 ; + pTimer->TmDelta = Time ; + SkHwtStart(pAC,Ioc,Time) ; + return ; + } + + /* + * timer correction + */ + timer_done(pAC,Ioc,0) ; + + /* + * find position in queue + */ + Delta = 0 ; + for (ppTimPrev = &pAC->Tim.StQueue ; (pTm = *ppTimPrev) ; + ppTimPrev = &pTm->TmNext ) { + if (Delta + pTm->TmDelta > Time) { + /* Position found */ + /* Here the timer needs to be inserted. */ + break ; + } + Delta += pTm->TmDelta ; + } + + /* insert in queue */ + *ppTimPrev = pTimer ; + pTimer->TmNext = pTm ; + pTimer->TmDelta = Time - Delta ; + + if (pTm) { + /* There is a next timer + * -> correct its Delta value. + */ + pTm->TmDelta -= pTimer->TmDelta ; + } + + /* + * start new with first + */ + SkHwtStart(pAC,Ioc,pAC->Tim.StQueue->TmDelta) ; +} + + +void SkTimerDone( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc) /* IoContext */ +{ + timer_done(pAC,Ioc,1) ; +} + + +static void timer_done( +SK_AC *pAC, /* Adapters context */ +SK_IOC Ioc, /* IoContext */ +int Restart) /* Do we need to restart the Hardware timer ? */ +{ + SK_U32 Delta ; + SK_TIMER *pTm ; + SK_TIMER *pTComp ; /* Timer completed now now */ + SK_TIMER **ppLast ; /* Next field of Last timer to be deq */ + int Done = 0 ; + + Delta = SkHwtRead(pAC,Ioc) ; + ppLast = &pAC->Tim.StQueue ; + pTm = pAC->Tim.StQueue ; + while (pTm && !Done) { + if (Delta >= pTm->TmDelta) { + /* Timer ran out */ + pTm->TmActive = SK_FALSE ; + Delta -= pTm->TmDelta ; + ppLast = &pTm->TmNext ; + pTm = pTm->TmNext ; + } else { + /* We found the first timer that did not run out */ + pTm->TmDelta -= Delta ; + Delta = 0 ; + Done = 1 ; + } + } + *ppLast = 0 ; + /* + * pTm points to the first Timer that did not run out. + * StQueue points to the first Timer that run out. + */ + + for ( pTComp = pAC->Tim.StQueue ; pTComp ; pTComp = pTComp->TmNext) { + SkEventQueue(pAC,pTComp->TmClass, pTComp->TmEvent, + pTComp->TmPara) ; + } + + /* Set head of timer queue to the first timer that did not run out */ + pAC->Tim.StQueue = pTm ; + + if (Restart && pAC->Tim.StQueue) { + /* Restart HW timer */ + SkHwtStart(pAC,Ioc,pAC->Tim.StQueue->TmDelta) ; + } +} + +/* End of file */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skvpd.c linux/drivers/net/sk98lin/skvpd.c --- v2.3.28/linux/drivers/net/sk98lin/skvpd.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skvpd.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,1198 @@ +/****************************************************************************** + * + * Name: skvpd.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.24 $ + * Date: $Date: 1999/03/11 14:25:49 $ + * Purpose: Shared software to read and write VPD data + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skvpd.c,v $ + * Revision 1.24 1999/03/11 14:25:49 malthoff + * Replace __STDC__ with SK_KR_PROTO. + * + * Revision 1.23 1999/01/11 15:13:11 gklug + * fix: syntax error + * + * Revision 1.22 1998/10/30 06:41:15 gklug + * rmv: WARNING + * + * Revision 1.21 1998/10/29 07:15:14 gklug + * fix: Write Stream function needs verify. + * + * Revision 1.20 1998/10/28 18:05:08 gklug + * chg: no DEBUG in VpdMayWrite + * + * Revision 1.19 1998/10/28 15:56:11 gklug + * fix: Return len at end of ReadStream + * fix: Write even less than 4 bytes correctly + * + * Revision 1.18 1998/10/28 09:00:47 gklug + * fix: unreferenced local vars + * + * Revision 1.17 1998/10/28 08:25:45 gklug + * fix: WARNING + * + * Revision 1.16 1998/10/28 08:17:30 gklug + * fix: typo + * + * Revision 1.15 1998/10/28 07:50:32 gklug + * fix: typo + * + * Revision 1.14 1998/10/28 07:20:38 gklug + * chg: Interface functions to use IoC as parameter as well + * fix: VpdRead/WriteDWord now return SK_U32 + * chg: VPD_IN/OUT names conform to SK_IN/OUT + * add: usage of VPD_IN/OUT8 macros + * add: VpdRead/Write Stream functions to r/w a stream of data + * fix: VpdTransferBlock swapped illeagal + * add: VpdMayWrite + * + * Revision 1.13 1998/10/22 10:02:37 gklug + * fix: SysKonnectFileId typo + * + * Revision 1.12 1998/10/20 10:01:01 gklug + * fix: parameter to SkOsGetTime + * + * Revision 1.11 1998/10/15 12:51:48 malthoff + * Remove unrequired parameter p in vpd_setup_para(). + * + * Revision 1.10 1998/10/08 14:52:43 malthoff + * Remove CvsId by SysKonnectFileId. + * + * Revision 1.9 1998/09/16 07:33:52 malthoff + * remove memcmp() by SK_MEMCMP and + * memcpy() by SK_MEMCPY() to be + * independant from the 'C' Standard Library. + * + * Revision 1.8 1998/08/19 12:52:35 malthoff + * compiler fix: use SK_VPD_KEY instead of S_VPD. + * + * Revision 1.7 1998/08/19 08:14:01 gklug + * fix: remove struct keyword as much as possible from the c-code (see CCC) + * + * Revision 1.6 1998/08/18 13:03:58 gklug + * SkOsGetTime now returns SK_U64 + * + * Revision 1.5 1998/08/18 08:17:29 malthoff + * Ensure we issue a VPD read in vpd_read_dword(). + * Discard all VPD keywords other than Vx or Yx, where + * x is '0..9' or 'A..Z'. + * + * Revision 1.4 1998/07/03 14:52:19 malthoff + * Add category SK_DBGCAT_FATAL to some debug macros. + * bug fix: correct the keyword name check in vpd_write(). + * + * Revision 1.3 1998/06/26 11:16:53 malthoff + * Correct the modified File Identifier. + * + * Revision 1.2 1998/06/26 11:13:43 malthoff + * Modify the File Identifier. + * + * Revision 1.1 1998/06/19 14:11:08 malthoff + * Created, Tests with AIX were performed successfully + * + * + ******************************************************************************/ + +/* + Please refer skvpd.txt for infomation how to include this module + */ +static const char SysKonnectFileId[] = + "@(#)$Id: skvpd.c,v 1.24 1999/03/11 14:25:49 malthoff Exp $ (C) SK" ; + +#include "h/skdrv1st.h" +#include "h/sktypes.h" +#include "h/skdebug.h" +#include "h/skdrv2nd.h" + +/* + * Static functions + */ +#ifndef SK_KR_PROTO +static SK_VPD_PARA *vpd_find_para( + SK_AC *pAC, + char *key, + SK_VPD_PARA *p) ; +#else /* SK_KR_PROTO */ +static SK_VPD_PARA *vpd_find_para() ; +#endif /* SK_KR_PROTO */ + +/* + * waits for a completetion of a VPD transfer + * The VPD transfer must complete within SK_TICKS_PER_SEC/16 + * + * returns 0: success, transfer completes + * error exit(9) with a error message + */ +static int VpdWait( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int event) /* event to wait for (VPD_READ / VPD_write) completion*/ +{ + SK_U64 start_time ; + SK_U16 state ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd wait for %s\n",event?"Write":"Read")) ; + start_time = SkOsGetTime(pAC) ; + do { + if (SkOsGetTime(pAC) - start_time > SK_TICKS_PER_SEC/16) { + VPD_STOP(pAC,IoC) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD, + SK_DBGCAT_FATAL|SK_DBGCAT_ERR, + ("ERROR:vpd wait timeout\n")) ; + return(1) ; + } + VPD_IN16(pAC,IoC,PCI_VPD_ADR_REG,&state) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("state = %x, event %x\n",state,event)) ; + } while((int)(state & PCI_VPD_FLAG) == event) ; + + return(0) ; +} + + +/* + * Read the dword at address 'addr' from the VPD EEPROM. + * + * Needed Time: MIN 1,3 ms MAX 2,6 ms + * + * Note: The DWord is returned in the endianess of the machine the routine + * is running on. + * + * Returns the data read. + */ +SK_U32 VpdReadDWord( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +int addr) /* VPD address */ +{ + SK_U32 Rtv ; + + /* start VPD read */ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd read dword at 0x%x\n",addr)) ; + addr &= ~VPD_WRITE ; /* ensure the R/W bit is set to read */ + + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16) addr) ; + + /* ignore return code here */ + (void)VpdWait(pAC,IoC,VPD_READ) ; + + /* Don't swap here, it's a data stream of bytes */ + Rtv = 0 ; + + VPD_IN32(pAC,IoC,PCI_VPD_DAT_REG,&Rtv) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd read dword data = 0x%x\n",Rtv)) ; + return (Rtv) ; +} + +/* + Write the dword 'data' at address 'addr' into the VPD EEPROM, and + verify that the data is written. + + Needed Time: + +. MIN MAX +. ------------------------------------------------------------------- +. write 1.8 ms 3.6 ms +. internal write cyles 0.7 ms 7.0 ms +. ------------------------------------------------------------------- +. over all program time 2.5 ms 10.6 ms +. read 1.3 ms 2.6 ms +. ------------------------------------------------------------------- +. over all 3.8 ms 13.2 ms +. + + + Returns 0: success + 1: error, I2C transfer does not terminate + 2: error, data verify error + + */ +static int VpdWriteDWord( +SK_AC *pAC, /* pAC pointer */ +SK_IOC IoC, /* IO Context */ +int addr, /* VPD address */ +SK_U32 data) /* VPD data to write */ +{ + /* start VPD write */ + /* Don't swap here, it's a data stream of bytes */ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd write dword at addr 0x%x, data = 0x%x\n",addr,data)) ; + VPD_OUT32(pAC,IoC,PCI_VPD_DAT_REG, (SK_U32)data) ; + /* But do it here */ + addr |= VPD_WRITE ; + + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)) ; + + /* this may take up to 10,6 ms */ + if (VpdWait(pAC,IoC,VPD_WRITE)) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("Write Timed Out\n")) ; + return(1) ; + } ; + + /* verify data */ + if (VpdReadDWord(pAC,IoC,addr) != data) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR|SK_DBGCAT_FATAL, + ("Data Verify Error\n")) ; + return(2) ; + } + return(0) ; +} + +/* + * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from + * or to the I2C EEPROM. + * + * Returns number of bytes read / written. + */ +static int VpdWriteStream( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +char *buf, /* data buffer */ +int Addr, /* VPD start address */ +int Len) /* number of bytes to read / to write */ +{ + int i ; + int j ; + SK_U16 AdrReg ; + int Rtv ; + SK_U8 * pComp; /* Compare pointer */ + SK_U8 Data ; /* Input Data for Compare */ + + /* Init Compare Pointer */ + pComp = (SK_U8 *) buf; + + for (i=0; i < Len; i ++, buf++) { + if ((i%sizeof(SK_U32)) == 0) { + /* + * At the begin of each cycle read the Data Reg + * So it is initialized even if only a few bytes + * are written. + */ + AdrReg = (SK_U16) Addr ; + AdrReg &= ~VPD_WRITE ; /* READ operation */ + + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + + /* ignore return code here */ + Rtv = VpdWait(pAC,IoC,VPD_READ) ; + if (Rtv != 0) { + return(i) ; + } + } + + /* Write current Byte */ + VPD_OUT8(pAC,IoC,PCI_VPD_DAT_REG+(i%sizeof(SK_U32)), + *(SK_U8*)buf) ; + + if (((i%sizeof(SK_U32)) == 3) || (i == (Len - 1))) { + /* New Address needs to be written to VPD_ADDR reg */ + AdrReg = (SK_U16) Addr ; + Addr += sizeof(SK_U32); + AdrReg |= VPD_WRITE ; /* WRITE operation */ + + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + + /* Wait for termination */ + Rtv = VpdWait(pAC,IoC,VPD_WRITE) ; + if (Rtv != 0) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("Write Timed Out\n")) ; + return(i - (i%sizeof(SK_U32))) ; + } + + /* + * Now re-read to verify + */ + AdrReg &= ~VPD_WRITE ; /* READ operation */ + + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + + /* Wait for termination */ + Rtv = VpdWait(pAC,IoC,VPD_READ) ; + if (Rtv != 0) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("Verify Timed Out\n")) ; + return(i - (i%sizeof(SK_U32))) ; + } + + for (j = 0; j <= (int) (i%sizeof(SK_U32)); + j ++, pComp ++ ) { + VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+j, &Data) ; + if (Data != *pComp) { + /* Verify Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD, + SK_DBGCAT_ERR, + ("WriteStream Verify Error\n")); + return(i - (i%sizeof(SK_U32)) + j); + } + } + + } + } + + return(Len); +} + + +/* + * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from + * or to the I2C EEPROM. + * + * Returns number of bytes read / written. + */ +static int VpdReadStream( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +char *buf, /* data buffer */ +int Addr, /* VPD start address */ +int Len) /* number of bytes to read / to write */ +{ + int i ; + SK_U16 AdrReg ; + int Rtv ; + + for (i=0; i < Len; i ++, buf++) { + if ((i%sizeof(SK_U32)) == 0) { + /* New Address needs to be written to VPD_ADDR reg */ + AdrReg = (SK_U16) Addr ; + Addr += sizeof(SK_U32); + AdrReg &= ~VPD_WRITE ; /* READ operation */ + + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + + /* ignore return code here */ + Rtv = VpdWait(pAC,IoC,VPD_READ) ; + if (Rtv != 0) { + return(i) ; + } + + } + VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+(i%sizeof(SK_U32)), + (SK_U8 *)buf) ; + } + + return(Len) ; +} + +/* + * Read ore wirtes 'len' bytes of VPD data, starting at 'addr' from + * or to the I2C EEPROM. + * + * Returns number of bytes read / written. + */ +static int VpdTransferBlock( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC, /* IO Context */ +char *buf, /* data buffer */ +int addr, /* VPD start address */ +int len, /* number of bytes to read / to write */ +int dir) /* transfer direction may be VPD_READ or VPD_WRITE */ +{ + int Rtv ; /* Return value */ + int vpd_rom_size ; + SK_U32 our_reg2 ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd %s block, addr = 0x%x, len = %d\n", + dir?"write":"read",addr,len)) ; + + if (len == 0) + return (0) ; + + VPD_IN32(pAC,IoC,PCI_OUR_REG_2,&our_reg2) ; + vpd_rom_size = 256 << ((our_reg2 & PCI_VPD_ROM_SZ) >> 14); + if (addr > vpd_rom_size - 4) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR|SK_DBGCAT_FATAL, + ("Address error: 0x%x, exp. < 0x%x\n", + addr, vpd_rom_size - 4)) ; + return (0) ; + } + if (addr + len > vpd_rom_size) { + len = vpd_rom_size - addr ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("Warning: len was cut to %d\n",len)) ; + } + + if (dir == VPD_READ) { + Rtv = VpdReadStream(pAC, IoC, buf, addr, len); + } else { + Rtv = VpdWriteStream(pAC, IoC, buf, addr, len); + } + + return (Rtv) ; +} + +#ifdef SKDIAG + +/* + * Read 'len' bytes of VPD data, starting at 'addr'. + * + * Returns number of bytes read. + */ +int VpdReadBlock( +SK_AC *pAC, /* pAC pointer */ +SK_IOC IoC, /* IO Context */ +char *buf, /* buffer were the data should be stored */ +int addr, /* start reading at the VPD address */ +int len) /* number of bytes to read */ +{ + return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_READ)) ; +} + +/* + * Write 'len' bytes of *but to the VPD EEPROM, starting at 'addr'. + * + * Returns number of bytes writes. + */ +int VpdWriteBlock( +SK_AC *pAC, /* pAC pointer */ +SK_IOC IoC, /* IO Context */ +char *buf, /* buffer, holds the data to write */ +int addr, /* start writing at the VPD address */ +int len) /* number of bytes to write */ +{ + return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_WRITE)) ; +} +#endif /* SKDIAG */ + +/* + * (re)initialize the VPD buffer + * + * Reads the VPD data from the EEPROM into the VPD buffer. + * Get the remaining read only and read / write space. + * + * return 0: success + * 1: fatal VPD error + */ +static int VpdInit( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC) /* IO Context */ +{ + SK_VPD_PARA *r, rp ; /* RW or RV */ + int i ; + unsigned char x ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT,("VpdInit .. ")) ; + /* read the VPD data into the VPD buffer */ + if (VpdTransferBlock(pAC,IoC,pAC->vpd.vpd_buf,0,VPD_SIZE,VPD_READ) + != VPD_SIZE) { + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("Block Read Error\n")) ; + return(1) ; + } + + /* find the end tag of the RO area */ + if (!(r = vpd_find_para(pAC,VPD_RV,&rp))) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Encoding Error: RV Tag not found\n")) ; + return (1) ; + } + if (r->p_val + r->p_len > pAC->vpd.vpd_buf + VPD_SIZE/2) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Encoding Error: Invalid VPD struct size\n")) ; + return (1) ; + } + pAC->vpd.v.vpd_free_ro = r->p_len - 1 ; + + /* test the checksum */ + for (i = 0, x = 0; (unsigned)i<=(unsigned)VPD_SIZE/2 - r->p_len; i++) { + x += pAC->vpd.vpd_buf[i] ; + } + if (x != 0) { + /* checksum error */ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("VPD Checksum Error\n")) ; + return (1) ; + } + + /* find and check the end tag of the RW area */ + if (!(r = vpd_find_para(pAC,VPD_RW,&rp))) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Encoding Error: RV Tag not found\n")) ; + return (1) ; + } + if (r->p_val < pAC->vpd.vpd_buf + VPD_SIZE/2) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Encoding Error: Invalid VPD struct size\n")) ; + return (1) ; + } + pAC->vpd.v.vpd_free_rw = r->p_len ; + + /* everything seems to be ok */ + pAC->vpd.v.vpd_status |= VPD_VALID ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT, + ("done. Free RO = %d, Free RW = %d\n", + pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)) ; + + return(0) ; +} + +/* + * find the Keyword 'key' in the VPD buffer and fills the + * parameter sturct 'p' with it's values + * + * returns *p success + * 0: parameter was not found or VPD encoding error + */ +static SK_VPD_PARA *vpd_find_para( +SK_AC *pAC, /* common data base */ +char *key, /* keyword to find (e.g. "MN") */ +SK_VPD_PARA *p) /* parameter description struct */ +{ + char *v ; /* points to vpd buffer */ + int max ; /* Maximum Number of Iterations */ + + v = pAC->vpd.vpd_buf ; + max = 128 ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd find para %s .. ",key)) ; + + /* check mandatory resource type ID string (Product Name) */ + if (*v != (char) RES_ID) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Error: 0x%x missing\n",RES_ID)) ; + return (0) ; + } + + if (strcmp(key,VPD_NAME) == 0) { + p->p_len = VPD_GET_RES_LEN(v) ; + p->p_val = VPD_GET_VAL(v) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("found, len = %d\n",p->p_len)) ; + return(p) ; + } + + v += 3 + VPD_GET_RES_LEN(v) + 3 ; + for ( ; ; ) { + if (SK_MEMCMP(key,v,2) == 0) { + p->p_len = VPD_GET_VPD_LEN(v) ; + p->p_val = VPD_GET_VAL(v) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("found, len = %d\n",p->p_len)) ; + return (p) ; + } + + /* exit when reaching the "RW" Tag or the maximum of itera. */ + max-- ; + if (SK_MEMCMP(VPD_RW,v,2) == 0 || max == 0) { + break ; + } + + if (SK_MEMCMP(VPD_RV,v,2) == 0) { + v += 3 + VPD_GET_VPD_LEN(v) + 3 ; /* skip VPD-W */ + } else { + v += 3 + VPD_GET_VPD_LEN(v) ; + } + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("scanning '%c%c' len = %d\n",v[0],v[1],v[2])) ; + } + +#ifdef DEBUG + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL,("not found\n")) ; + if (max == 0) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Key/Len Encoding error\n")) ; + } +#endif + return (0) ; +} + +/* + * Move 'n' bytes. Begin with the last byte if 'n' is > 0, + * Start with the last byte if n is < 0. + * + * returns nothing + */ +static void vpd_move_para( +char *start, /* start of memory block */ +char *end, /* end of memory block to move */ +int n) /* number of bytes the memory block has to be moved */ +{ + char *p ; + int i ; /* number of byte copied */ + + if (n == 0) + return ; + + i = end - start + 1 ; + if (n < 0) { + p = start + n ; + while (i != 0) { + *p++ = *start++ ; + i-- ; + } + } else { + p = end + n ; + while (i != 0) { + *p-- = *end-- ; + i-- ; + } + } +} + +/* + * setup the VPD keyword 'key' at 'ip'. + * + * returns nothing + */ +static void vpd_insert_key( +char *key, /* keyword to insert */ +char *buf, /* buffer with the keyword value */ +int len, /* length of the value string */ +char *ip) /* inseration point */ +{ + SK_VPD_KEY *p ; + + p = (SK_VPD_KEY *) ip ; + p->p_key[0] = key[0] ; + p->p_key[1] = key[1] ; + p->p_len = (unsigned char) len ; + SK_MEMCPY(&p->p_val,buf,len) ; +} + +/* + * Setup the VPD end tag "RV" / "RW". + * Also correct the remaining space variables vpd_free_ro / vpd_free_rw. + * + * returns 0: success + * 1: encoding error + */ +static int vpd_mod_endtag( +SK_AC *pAC, /* common data base */ +char *etp) /* end pointer input position */ +{ + SK_VPD_KEY *p ; + unsigned char x ; + int i ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd modify endtag at 0x%x = '%c%c'\n",etp,etp[0],etp[1])) ; + + p = (SK_VPD_KEY *) etp ; + + if (p->p_key[0] != 'R' || (p->p_key[1] != 'V' && p->p_key[1] != 'W')) { + /* something wrong here, encoding error */ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, + ("Encoding Error: invalid end tag\n")) ; + return(1) ; + } + if (etp > pAC->vpd.vpd_buf + VPD_SIZE/2) { + /* create "RW" tag */ + p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE-etp-3-1) ; + pAC->vpd.v.vpd_free_rw = (int) p->p_len ; + i = pAC->vpd.v.vpd_free_rw ; + etp += 3 ; + } else { + /* create "RV" tag */ + p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE/2-etp-3) ; + pAC->vpd.v.vpd_free_ro = (int) p->p_len - 1 ; + + /* setup checksum */ + for (i = 0, x = 0; i < VPD_SIZE/2 - p->p_len; i++) { + x += pAC->vpd.vpd_buf[i] ; + } + p->p_val = (char) 0 - x ; + i = pAC->vpd.v.vpd_free_ro ; + etp += 4 ; + } + while (i) { + *etp++ = 0x00 ; + i-- ; + } + + return (0) ; +} + +/* + * Insert a VPD keyword into the VPD buffer. + * + * The keyword 'key' is inserted at the position 'ip' in the + * VPD buffer. + * The keywords behind the input position will + * be moved. The VPD end tag "RV" or "RW" is generated again. + * + * returns 0: success + * 2: value string was cut + * 4: VPD full, keyword was not written + * 6: fatal VPD error + * + */ +int VpdSetupPara( +SK_AC *pAC, /* common data base */ +char *key, /* keyword to insert */ +char *buf, /* buffer with the keyword value */ +int len, /* length of the keyword value */ +int type, /* VPD_RO_KEY or VPD_RW_KEY */ +int op) /* operation to do: ADD_KEY or OWR_KEY */ +{ + SK_VPD_PARA vp ; + char *etp ; /* end tag position */ + int free ; /* remaining space in selected area */ + char *ip ; /* input position inside the VPD buffer */ + int rtv ; /* return code */ + int head ; /* additional haeder bytes to move */ + int found ; /* additinoal bytes if the keyword was found */ + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("vpd setup para key = %s, val = %s\n",key,buf)) ; + + rtv = 0 ; + ip = 0 ; + if (type == VPD_RW_KEY) { + /* end tag is "RW" */ + free = pAC->vpd.v.vpd_free_rw ; + etp = pAC->vpd.vpd_buf + (VPD_SIZE - free - 1 - 3) ; + } else { + /* end tag is "RV" */ + free = pAC->vpd.v.vpd_free_ro ; + etp = pAC->vpd.vpd_buf + (VPD_SIZE/2 - free - 4) ; + } + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("Free RO = %d, Free RW = %d\n", + pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)) ; + + head = 0 ; + found = 0 ; + if (op == OWR_KEY) { + if (vpd_find_para(pAC,key,&vp)) { + found = 3 ; + ip = vp.p_val - 3 ; + free += vp.p_len + 3 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("Overwrite Key\n")) ; + } else { + op = ADD_KEY ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, + ("Add Key\n")) ; + } + } + if (op == ADD_KEY) { + ip = etp ; + vp.p_len = 0 ; + head = 3 ; + } + + if (len + 3 > free) { + if (free < 7) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("VPD Buffer Overflow, keyword not written\n")); + return (4) ; + } + /* cut it again */ + len = free - 3 ; + rtv = 2 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("VPD Buffer Full, Keyword was cut\n")) ; + } + + vpd_move_para(ip + vp.p_len + found, etp+2, len-vp.p_len+head) ; + vpd_insert_key(key, buf, len, ip) ; + if (vpd_mod_endtag(pAC, etp + len - vp.p_len + head)) { + pAC->vpd.v.vpd_status &= ~VPD_VALID ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("VPD Encoding Error\n")) ; + return(6) ; + } + + return (rtv) ; +} + + +/* + * Read the contents of the VPD EEPROM and copy it to the + * VPD buffer if not already done. + * + * return: A pointer to the vpd_status structure. The structure contain + * this fields. + */ +SK_VPD_STATUS *VpdStat( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC) /* IO Context */ +{ + if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { + (void)VpdInit(pAC,IoC) ; + } + return(&pAC->vpd.v) ; +} + + +/* + * Read the contents of the VPD EEPROM and copy it to the VPD + * buffer if not already done. + * Scan the VPD buffer for VPD keywords and create the VPD + * keyword list by copying the keywords to 'buf', all after + * each other and terminated with a '\0'. + * + * Exceptions: o The Resource Type ID String (product name) is called "Name" + * o The VPD end tags 'RV' and 'RW' are not listed + * + * The number of copied keywords is counted in 'elements'. + * + * returns 0: success + * 2: buffer overfull, one or more keywords are missing + * 6: fatal VPD error + * + * example values after returning: + * + * buf = "Name\0PN\0EC\0MN\0SN\0CP\0VF\0VL\0YA\0" + * *len = 30 + * *elements = 9 + */ +int VpdKeys( +SK_AC *pAC, /* common data base */ +SK_IOC IoC, /* IO Context */ +char *buf, /* buffer where to copy the keywords */ +int *len, /* buffer length */ +int *elements) /* number of keywords returned */ +{ + char *v ; + int n ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("list vpd keys .. ")) ; + *elements = 0 ; + if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { + if (VpdInit(pAC,IoC) != 0 ) { + *len = 0 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("VPD Init Error, terminated\n")) ; + return(6) ; + } + } + + if ((signed)strlen(VPD_NAME) + 1 <= *len) { + v = pAC->vpd.vpd_buf ; + strcpy(buf,VPD_NAME) ; + n = strlen(VPD_NAME) + 1 ; + buf += n ; + *elements = 1 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, + ("'%c%c' ",v[0],v[1])) ; + } else { + *len = 0 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("buffer overflow\n")) ; + return(2) ; + } + + v += 3 + VPD_GET_RES_LEN(v) + 3 ; + for ( ; ; ) { + /* exit when reaching the "RW" Tag */ + if (SK_MEMCMP(VPD_RW,v,2) == 0) { + break ; + } + + if (SK_MEMCMP(VPD_RV,v,2) == 0) { + v += 3 + VPD_GET_VPD_LEN(v) + 3 ; /* skip VPD-W */ + continue ; + } + + if (n+3 <= *len) { + SK_MEMCPY(buf,v,2) ; + buf += 2 ; + *buf++ = '\0' ; + n += 3 ; + v += 3 + VPD_GET_VPD_LEN(v) ; + *elements += 1 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, + ("'%c%c' ",v[0],v[1])) ; + } else { + *len = n ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("buffer overflow\n")) ; + return (2) ; + } + } + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("\n")) ; + *len = n ; + return(0) ; +} + + +/* + * Read the contents of the VPD EEPROM and copy it to the + * VPD buffer if not already done. Search for the VPD keyword + * 'key' and copy its value to 'buf'. Add a terminating '\0'. + * If the value does not fit into the buffer cut it after + * 'len' - 1 bytes. + * + * returns 0: success + * 1: keyword not found + * 2: value string was cut + * 3: VPD transfer timeout + * 6: fatal VPD error + */ +int VpdRead( +SK_AC *pAC, /* common data base */ +SK_IOC IoC, /* IO Context */ +char *key, /* keyword to read (e.g. "MN") */ +char *buf, /* buffer where to copy the keyword value */ +int *len) /* buffer length */ +{ + SK_VPD_PARA *p, vp ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("vpd read %s .. ",key)) ; + if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { + if (VpdInit(pAC,IoC) != 0 ) { + *len = 0 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("vpd init error\n")) ; + return(6) ; + } + } + + if ((p = vpd_find_para(pAC,key,&vp))) { + if (p->p_len > (*(unsigned *)len)-1) { + p->p_len = *len - 1 ; + } + SK_MEMCPY(buf,p->p_val,p->p_len) ; + buf[p->p_len] = '\0' ; + *len = p->p_len ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, + ("%c%c%c%c.., len = %d\n", + buf[0],buf[1],buf[2],buf[3],*len)) ; + } else { + *len = 0 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR,("not found\n")) ; + return (1) ; + } + return (0) ; +} + + +/* + * Check whether a given key may be written + * + * returns + * SK_TRUE Yes it may be written + * SK_FALSE No it may be written + */ +SK_BOOL VpdMayWrite( +char *key) /* keyword to write (allowed values "Yx", "Vx") */ +{ + if ((*key != 'Y' && *key != 'V') || + key[1] < '0' || key[1] > 'Z' || + (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) { + + return (SK_FALSE) ; + } + return (SK_TRUE) ; +} + +/* + * Read the contents of the VPD EEPROM and copy it to the VPD + * buffer if not already done. Insert/overwrite the keyword 'key' + * in the VPD buffer. Cut the keyword value if it does not fit + * into the VPD read / write area. + * + * returns 0: success + * 2: value string was cut + * 3: VPD transfer timeout + * 4: VPD full, keyword was not written + * 5: keyword cannot be written + * 6: fatal VPD error + */ +int VpdWrite( +SK_AC *pAC, /* common data base */ +SK_IOC IoC, /* IO Context */ +char *key, /* keyword to write (allowed values "Yx", "Vx") */ +char *buf) /* buffer where the keyword value can be read from */ +{ + int len ; /* lenght of the keyword to write */ + int rtv ; /* return code */ + int rtv2 ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX, + ("vpd write %s = %s\n",key,buf)) ; + + if ((*key != 'Y' && *key != 'V') || + key[1] < '0' || key[1] > 'Z' || + (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) { + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("illegal key tag, keyword not written\n")) ; + return (5) ; + } + + if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { + if (VpdInit(pAC,IoC) != 0 ) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("vpd init error\n")) ; + return(6) ; + } + } + + rtv = 0 ; + len = strlen(buf) ; + if (len > VPD_MAX_LEN) { + /* cut it */ + len = VPD_MAX_LEN ; + rtv = 2 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("keyword to long, cut after %d bytes\n",VPD_MAX_LEN)) ; + } + if ((rtv2 = VpdSetupPara(pAC,key,buf,len,VPD_RW_KEY,OWR_KEY)) != 0) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("vpd write error\n")) ; + return(rtv2) ; + } + + return (rtv) ; +} + +/* + * Read the contents of the VPD EEPROM and copy it to the + * VPD buffer if not already done. Remove the VPD keyword + * 'key' from the VPD buffer. + * Only the keywords in the read/write area can be deleted. + * Keywords in the read only area cannot be deleted. + * + * returns 0: success, keyword was removed + * 1: keyword not found + * 5: keyword cannot be deleted + * 6: fatal VPD error + */ +int VpdDelete( +SK_AC *pAC, /* common data base */ +SK_IOC IoC, /* IO Context */ +char *key) /* keyword to read (e.g. "MN") */ +{ + SK_VPD_PARA *p, vp ; + char *etp ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd delete key %s\n",key)) ; + if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { + if (VpdInit(pAC,IoC) != 0 ) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("vpd init error\n")) ; + return(6) ; + } + } + + if ((p = vpd_find_para(pAC,key,&vp))) { + if (p->p_val < pAC->vpd.vpd_buf + VPD_SIZE/2) { + /* try to delete read only keyword */ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("cannot delete RO keyword\n")) ; + return (5) ; + } + + etp = pAC->vpd.vpd_buf + (VPD_SIZE-pAC->vpd.v.vpd_free_rw-1-3) ; + + vpd_move_para(vp.p_val+vp.p_len, etp+2, + - ((int)(vp.p_len + 3))) ; + if (vpd_mod_endtag(pAC, etp - vp.p_len - 3)) { + pAC->vpd.v.vpd_status &= ~VPD_VALID ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("vpd encoding error\n")) ; + return(6) ; + } + } else { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("keyword not found\n")) ; + return (1) ; + } + + return (0) ; +} + +/* + * If the VPD buffer contains valid data write the VPD + * read/write area back to the VPD EEPROM. + * + * returns 0: success + * 3: VPD transfer timeout + */ +int VpdUpdate( +SK_AC *pAC, /* Adapters context */ +SK_IOC IoC) /* IO Context */ +{ + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd update .. ")) ; + if (pAC->vpd.v.vpd_status & VPD_VALID) { + if (VpdTransferBlock(pAC,IoC,pAC->vpd.vpd_buf + VPD_SIZE/2, + VPD_SIZE/2, VPD_SIZE/2, VPD_WRITE) != VPD_SIZE/2) { + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("transfer timed out\n")) ; + return(3) ; + } + } + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("done\n")) ; + return (0) ; +} + + + +/* + * Read the contents of the VPD EEPROM and copy it to the VPD buffer + * if not already done. If the keyword "VF" is not present it will be + * created and the error log message will be stored to this keyword. + * If "VF" is not present the error log message will be stored to the + * keyword "VL". "VL" will created or overwritten if "VF" is present. + * The VPD read/write area is saved to the VPD EEPROM. + * + * returns nothing, errors will be ignored. + */ +void VpdErrLog( +SK_AC *pAC, /* common data base */ +SK_IOC IoC, /* IO Context */ +char *msg) /* error log message */ +{ + SK_VPD_PARA *v, vf ; /* VF */ + int len ; + + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX, + ("vpd error log msg %s\n",msg)) ; + if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { + if (VpdInit(pAC,IoC) != 0 ) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, + ("vpd init error\n")) ; + return ; + } + } + + len = strlen(msg) ; + if (len > VPD_MAX_LEN) { + /* cut it */ + len = VPD_MAX_LEN ; + } + if ((v = vpd_find_para(pAC,VPD_VF,&vf))) { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("overwrite VL\n")) ; + (void)VpdSetupPara(pAC,VPD_VL,msg,len,VPD_RW_KEY,OWR_KEY) ; + } else { + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("write VF\n")) ; + (void)VpdSetupPara(pAC,VPD_VF,msg,len,VPD_RW_KEY,ADD_KEY) ; + } + + (void)VpdUpdate(pAC,IoC) ; +} + diff -u --recursive --new-file v2.3.28/linux/drivers/net/sk98lin/skxmac2.c linux/drivers/net/sk98lin/skxmac2.c --- v2.3.28/linux/drivers/net/sk98lin/skxmac2.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sk98lin/skxmac2.c Tue Nov 23 10:15:42 1999 @@ -0,0 +1,2047 @@ +/****************************************************************************** + * + * Name: skxmac2.c + * Project: GEnesis, PCI Gigabit Ethernet Adapter + * Version: $Revision: 1.49 $ + * Date: $Date: 1999/11/22 08:12:13 $ + * Purpose: Contains functions to initialize the XMAC II + * + ******************************************************************************/ + +/****************************************************************************** + * + * (C)Copyright 1998,1999 SysKonnect, + * a business unit of Schneider & Koch & Co. Datensysteme GmbH. + * + * See the file "skge.c" for further information. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The information in this file is provided "AS IS" without warranty. + * + ******************************************************************************/ + +/****************************************************************************** + * + * History: + * + * $Log: skxmac2.c,v $ + * Revision 1.49 1999/11/22 08:12:13 malthoff + * Add workaround for power consumption feature of Bcom C0 chip. + * + * Revision 1.48 1999/11/16 08:39:01 malthoff + * Fix: MDIO preamble suppression is port dependend. + * + * Revision 1.47 1999/08/27 08:55:35 malthoff + * 1000BT: Optimizing MDIO transfer by oppressing MDIO preamble. + * + * Revision 1.46 1999/08/13 11:01:12 malthoff + * Fix for 1000BT: pFlowCtrlMode was not set correctly. + * + * Revision 1.45 1999/08/12 19:18:28 malthoff + * 1000BT Fixes: Do not owerwrite XM_MMU_CMD. + * Do not execute BCOM A1 workaround for B1 chips. + * Fix pause frame setting. + * Always set PHY_B_AC_TX_TST in PHY_BCOM_AUX_CTRL. + * + * Revision 1.44 1999/08/03 15:23:48 cgoos + * Fixed setting of PHY interrupt mask in half duplex mode. + * + * Revision 1.43 1999/08/03 15:22:17 cgoos + * Added some debug output. + * Disabled XMac GP0 interrupt for external PHYs. + * + * Revision 1.42 1999/08/02 08:39:23 malthoff + * BCOM PHY: TX LED: To get the mono flop behaviour it is required + * to set the LED Traffic Mode bit in PHY_BCOM_P_EXT_CTRL. + * + * Revision 1.41 1999/07/30 06:54:31 malthoff + * Add temp. workarounds for the BCOM Phy revision A1. + * + * Revision 1.40 1999/06/01 07:43:26 cgoos + * Changed Link Mode Status in SkXmAutoNegDone... from FULL/HALF to + * AUTOFULL/AUTOHALF. + * + * Revision 1.39 1999/05/19 07:29:51 cgoos + * Changes for 1000Base-T. + * + * Revision 1.38 1999/04/08 14:35:10 malthoff + * Add code for enabling signal detect. Enabling signal + * detect is disabled. + * + * Revision 1.37 1999/03/12 13:42:54 malthoff + * Add: Jumbo Frame Support. + * Add: Receive modes SK_LENERR_OK_ON/OFF and + * SK_BIG_PK_OK_ON/OFF in SkXmSetRxCmd(). + * + * Revision 1.36 1999/03/08 10:10:55 gklug + * fix: AutoSensing did switch to next mode even if LiPa indicated offline + * + * Revision 1.35 1999/02/22 15:16:41 malthoff + * Remove some compiler warnings. + * + * Revision 1.34 1999/01/22 09:19:59 gklug + * fix: Init DupMode and InitPauseMd are now called in RxTxEnable + * + * Revision 1.33 1998/12/11 15:19:11 gklug + * chg: lipa autoneg stati + * chg: debug messages + * chg: do NOT use spurious XmIrq + * + * Revision 1.32 1998/12/10 11:08:44 malthoff + * bug fix: pAC has been used for IOs in SkXmHardRst(). + * SkXmInitPhy() is also called for the Diag in SkXmInitMac(). + * + * Revision 1.31 1998/12/10 10:39:11 gklug + * fix: do 4 RESETS of the XMAC at the beginning + * fix: dummy read interrupt source register BEFORE initializing the Phy + * add: debug messages + * fix: Linkpartners autoneg capability cannot be shown by TX_PAGE interrupt + * + * Revision 1.30 1998/12/07 12:18:32 gklug + * add: refinement of autosense mode: take into account the autoneg cap of LiPa + * + * Revision 1.29 1998/12/07 07:12:29 gklug + * fix: if page is received the link is down. + * + * Revision 1.28 1998/12/01 10:12:47 gklug + * chg: if spurious IRQ from XMAC encountered, save it + * + * Revision 1.27 1998/11/26 07:33:38 gklug + * add: InitPhy call is now in XmInit function + * + * Revision 1.26 1998/11/18 13:38:24 malthoff + * 'Imsk' is also unused in SkXmAutoNegDone. + * + * Revision 1.25 1998/11/18 13:28:01 malthoff + * Remove unused variable 'Reg' in SkXmAutoNegDone(). + * + * Revision 1.24 1998/11/18 13:18:45 gklug + * add: workaround for xmac errata #1 + * add: detect Link Down also when Link partner requested config + * chg: XMIrq is only used when link is up + * + * Revision 1.23 1998/11/04 07:07:04 cgoos + * Added function SkXmRxTxEnable. + * + * Revision 1.22 1998/10/30 07:35:54 gklug + * fix: serve LinkDown interrupt when link is already down + * + * Revision 1.21 1998/10/29 15:32:03 gklug + * fix: Link Down signaling + * + * Revision 1.20 1998/10/29 11:17:27 gklug + * fix: AutoNegDone bug + * + * Revision 1.19 1998/10/29 10:14:43 malthoff + * Add endainesss comment for reading/writing MAC addresses. + * + * Revision 1.18 1998/10/28 07:48:55 cgoos + * Fix: ASS somtimes signaled although link is up. + * + * Revision 1.17 1998/10/26 07:55:39 malthoff + * Fix in SkXmInitPauseMd(): Pause Mode + * was disabled and not enabled. + * Fix in SkXmAutoNegDone(): Checking Mode bits + * always failed, becaues of some missing braces. + * + * Revision 1.16 1998/10/22 09:46:52 gklug + * fix SysKonnectFileId typo + * + * Revision 1.15 1998/10/21 05:51:37 gklug + * add: para DoLoop to InitPhy function for loopback set-up + * + * Revision 1.14 1998/10/16 10:59:23 malthoff + * Remove Lint warning for dummy reads. + * + * Revision 1.13 1998/10/15 14:01:20 malthoff + * Fix: SkXmAutoNegDone() is (int) but does not return a value. + * + * Revision 1.12 1998/10/14 14:45:04 malthoff + * Remove SKERR_SIRQ_E0xx and SKERR_SIRQ_E0xxMSG by + * SKERR_HWI_Exx and SKERR_HWI_E0xxMSG to be independant + * from the Sirq module. + * + * Revision 1.11 1998/10/14 13:59:01 gklug + * add: InitPhy function + * + * Revision 1.10 1998/10/14 11:20:57 malthoff + * Make SkXmAutoNegDone() public, because it's + * used in diagnostics, too. + * The Link Up event to the RLMT is issued in + * SkXmIrq(). SkXmIrq() is not available in + * diagnostics. Use PHY_READ when reading + * PHY registers. + * + * Revision 1.9 1998/10/14 05:50:10 cgoos + * Added definition for Para. + * + * Revision 1.8 1998/10/14 05:41:28 gklug + * add: Xmac IRQ + * add: auto negotiation done function + * + * Revision 1.7 1998/10/09 06:55:20 malthoff + * The configuration of the XMACs Tx Request Threshold + * depends from the drivers port usage now. The port + * usage is configured in GIPortUsage. + * + * Revision 1.6 1998/10/05 07:48:00 malthoff + * minor changes + * + * Revision 1.5 1998/10/01 07:03:54 gklug + * add: dummy function for XMAC ISR + * + * Revision 1.4 1998/09/30 12:37:44 malthoff + * Add SkXmSetRxCmd() and related code. + * + * Revision 1.3 1998/09/28 13:26:40 malthoff + * Add SkXmInitMac(), SkXmInitDupMd(), and SkXmInitPauseMd() + * + * Revision 1.2 1998/09/16 14:34:21 malthoff + * Add SkXmClrExactAddr(), SkXmClrSrcCheck(), + * SkXmClrHashAddr(), SkXmFlushTxFifo(), + * SkXmFlushRxFifo(), and SkXmHardRst(). + * Finish Coding of SkXmSoftRst(). + * The sources may be compiled now. + * + * Revision 1.1 1998/09/04 10:05:56 malthoff + * Created. + * + * + ******************************************************************************/ + +#include "h/skdrv1st.h" +#include "h/xmac_ii.h" +#include "h/skdrv2nd.h" + +/* defines ********************************************************************/ +/* typedefs *******************************************************************/ +/* global variables ***********************************************************/ + +/* local variables ************************************************************/ + +static const char SysKonnectFileId[] = + "@(#)$Id: skxmac2.c,v 1.49 1999/11/22 08:12:13 malthoff Exp $ (C) SK "; + +/* BCOM PHY magic pattern list */ +typedef struct s_PhyHack { + int PhyReg; /* Phy register */ + SK_U16 PhyVal; /* Value to write */ +} BCOM_HACK; + +BCOM_HACK BcomRegA1Hack[] = { + { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 }, { 0x17, 0x0013 }, + { 0x15, 0x0404 }, { 0x17, 0x8006 }, { 0x15, 0x0132 }, { 0x17, 0x8006 }, + { 0x15, 0x0232 }, { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 }, + { 0, 0 } +}; +BCOM_HACK BcomRegC0Hack[] = { + { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1204 }, { 0x17, 0x0013 }, + { 0x15, 0x0A04 }, { 0x18, 0x0420 }, + { 0, 0 } +}; + +/* function prototypes ********************************************************/ +static void SkXmInitPhyXmac(SK_AC*, SK_IOC, int, SK_BOOL); +static void SkXmInitPhyBcom(SK_AC*, SK_IOC, int, SK_BOOL); +static void SkXmInitPhyLone(SK_AC*, SK_IOC, int, SK_BOOL); +static void SkXmInitPhyNat (SK_AC*, SK_IOC, int, SK_BOOL); +static int SkXmAutoNegDoneXmac(SK_AC*, SK_IOC, int); +static int SkXmAutoNegDoneBcom(SK_AC*, SK_IOC, int); +static int SkXmAutoNegDoneLone(SK_AC*, SK_IOC, int); +static int SkXmAutoNegDoneNat (SK_AC*, SK_IOC, int); + +/****************************************************************************** + * + * SkXmSetRxCmd() - Modify the value of the XMACs Rx Command Register + * + * Description: + * The features + * o FCS stripping, SK_STRIP_FCS_ON/OFF + * o pad byte stripping, SK_STRIP_PAD_ON/OFF + * o don't set XMR_FS_ERR in frame SK_LENERR_OK_ON/OFF + * status for inrange length error + * frames, and + * o don't set XMR_FS_ERR in frame SK_BIG_PK_OK_ON/OFF + * status for frames > 1514 bytes + * + * for incomming packets may be enabled/disabled by this function. + * Additional modes may be added later. + * Multiple modes can be enabled/disabled at the same time. + * The new configuration is stored into the HWAC port configuration + * and is written to the Receive Command register immediatlely. + * The new configuration is saved over any SkGePortStop() and + * SkGeInitPort() calls. The configured value will be overwritten + * when SkGeInit(Level 0) is executed. + * + * Returns: + * nothing + */ +void SkXmSetRxCmd( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* The XMAC to handle with belongs to this Port */ +int Mode) /* Mode is SK_STRIP_FCS_ON/OFF, SK_STRIP_PAD_ON/OFF, + SK_LENERR_OK_ON/OFF, or SK_BIG_PK_OK_ON/OFF */ +{ + SK_GEPORT *pPrt; + SK_U16 OldRxMode; + + pPrt = &pAC->GIni.GP[Port]; + OldRxMode = pPrt->PRxCmd; + + switch(Mode & (SK_STRIP_FCS_ON | SK_STRIP_FCS_OFF)) { + case SK_STRIP_FCS_ON: + pPrt->PRxCmd |= XM_RX_STRIP_FCS; + break; + case SK_STRIP_FCS_OFF: + pPrt->PRxCmd &= ~XM_RX_STRIP_FCS; + break; + } + + switch(Mode & (SK_STRIP_PAD_ON | SK_STRIP_PAD_OFF)) { + case SK_STRIP_PAD_ON: + pPrt->PRxCmd |= XM_RX_STRIP_PAD; + break; + case SK_STRIP_PAD_OFF: + pPrt->PRxCmd &= ~XM_RX_STRIP_PAD; + break; + } + + switch(Mode & (SK_LENERR_OK_ON | SK_LENERR_OK_OFF)) { + case SK_LENERR_OK_ON: + pPrt->PRxCmd |= XM_RX_LENERR_OK; + break; + case SK_LENERR_OK_OFF: + pPrt->PRxCmd &= ~XM_RX_LENERR_OK; + break; + } + + switch(Mode & (SK_BIG_PK_OK_ON | SK_BIG_PK_OK_OFF)) { + case SK_BIG_PK_OK_ON: + pPrt->PRxCmd |= XM_RX_BIG_PK_OK; + break; + case SK_BIG_PK_OK_OFF: + pPrt->PRxCmd &= ~XM_RX_BIG_PK_OK; + break; + } + + /* Write the new mode to the receive command register if required */ + if (OldRxMode != pPrt->PRxCmd) { + XM_OUT16(IoC, Port, XM_RX_CMD, pPrt->PRxCmd); + } +} + +/****************************************************************************** + * + * SkXmClrExactAddr() - Clear Exact Match Address Registers + * + * Description: + * All Exact Match Address registers of the XMAC 'Port' will be + * cleared starting with 'StartNum' up to (and including) the + * Exact Match address number of 'StopNum'. + * + * Returns: + * nothing + */ +void SkXmClrExactAddr( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* The XMAC to handle with belongs to this Port */ +int StartNum, /* Begin with this Address Register Index (0..15) */ +int StopNum) /* Stop after finished with this Register Idx (0..15) */ +{ + int i; + SK_U16 ZeroAddr[3] = { 0x0000, 0x0000, 0x0000 }; + + if ((unsigned)StartNum > 15 || (unsigned)StopNum > 15 || + StartNum > StopNum) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E001, SKERR_HWI_E001MSG); + return; + } + + for (i = StartNum; i <= StopNum; i++) { + XM_OUTADDR(IoC, Port, XM_EXM(i), &ZeroAddr[0]); + } +} + +/****************************************************************************** + * + * SkXmClrSrcCheck() - Clear Source Check Address Register + * + * Description: + * The Source Check Address Register of the XMAC 'Port' number + * will be cleared. + * + * Returns: + * nothing + */ +static void SkXmClrSrcCheck( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* The XMAC to handle with belongs to this Port (MAC_1 + n) */ +{ + SK_U16 ZeroAddr[3] = { 0x0000, 0x0000, 0x0000 }; + + XM_OUTHASH(IoC, Port, XM_SRC_CHK, &ZeroAddr); +} + +/****************************************************************************** + * + * SkXmClrHashAddr() - Clear Hash Address Registers + * + * Description: + * The Hash Address Register of the XMAC 'Port' will be cleared. + * + * Returns: + * nothing + */ +static void SkXmClrHashAddr( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* The XMAC to handle with belongs to this Port (MAC_1 + n) */ +{ + SK_U16 ZeroAddr[4] = { 0x0000, 0x0000, 0x0000, 0x0000 }; + + XM_OUTHASH(IoC, Port, XM_HSM, &ZeroAddr); +} + +/****************************************************************************** + * + * SkXmFlushTxFifo() - Flush the XMACs transmit FIFO + * + * Description: + * Flush the transmit FIFO of the XMAC specified by the index 'Port' + * + * Returns: + * nothing + */ +void SkXmFlushTxFifo( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* The XMAC to handle with belongs to this Port (MAC_1 + n) */ +{ + SK_U32 MdReg; + + XM_IN32(IoC, Port, XM_MODE, &MdReg); + MdReg |= XM_MD_FTF; + XM_OUT32(IoC, Port, XM_MODE, MdReg); +} + +/****************************************************************************** + * + * SkXmFlushRxFifo() - Flush the XMACs receive FIFO + * + * Description: + * Flush the receive FIFO of the XMAC specified by the index 'Port' + * + * Returns: + * nothing + */ +void SkXmFlushRxFifo( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* The XMAC to handle with belongs to this Port (MAC_1 + n) */ +{ + SK_U32 MdReg; + + XM_IN32(IoC, Port, XM_MODE, &MdReg); + MdReg |= XM_MD_FRF; + XM_OUT32(IoC, Port, XM_MODE, MdReg); +} + +/****************************************************************************** + * + * SkXmSoftRst() - Do a XMAC software reset + * + * Description: + * The PHY registers should not be destroyed during this + * kind of software reset. Therefore the XMAC Software Reset + * (XM_GP_RES_MAC bit in XM_GP_PORT) must not be used! + * + * The software reset is done by + * - disabling the Rx and Tx state maschine, + * - reseting the statistics module, + * - clear all other significant XMAC Mode, + * Command, and Control Registers + * - clearing the Hash Register and the + * Exact Match Address registers, and + * - flushing the XMAC's Rx and Tx FIFOs. + * + * Note: + * Another requirement when stopping the XMAC is to + * avoid sending corrupted frames on the network. + * Disabling the Tx state maschine will NOT interrupt + * the currently transmitted frame. But we must take care + * that the tx FIFO is cleared AFTER the current frame + * is complete sent to the network. + * + * It takes about 12ns to send a frame with 1538 bytes. + * One PCI clock goes at least 15ns (66MHz). Therefore + * after reading XM_GP_PORT back, we are sure that the + * transmitter is disabled AND idle. And this means + * we may flush the transmit FIFO now. + * + * Returns: + * nothing + */ +void SkXmSoftRst( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* port to stop (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 Word; + + pPrt = &pAC->GIni.GP[Port]; + + /* disable the receiver and transmitter */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Word); + XM_OUT16(IoC, Port, XM_MMU_CMD, Word & ~(XM_MMU_ENA_RX|XM_MMU_ENA_TX)); + + /* reset the statistics module */ + XM_OUT32(IoC, Port, XM_GP_PORT, XM_GP_RES_STAT); + + /* + * clear all other significant XMAC Mode, + * Command, and Control Registers + */ + XM_OUT16(IoC, Port, XM_IMSK, 0xffff); /* disable all IRQs */ + XM_OUT32(IoC, Port, XM_MODE, 0x00000000); /* clear Mode Reg */ + XM_OUT16(IoC, Port, XM_TX_CMD, 0x0000); /* reset TX CMD Reg */ + XM_OUT16(IoC, Port, XM_RX_CMD, 0x0000); /* reset RX CMD Reg */ + + /* disable all PHY IRQs */ + switch (pAC->GIni.GP[Port].PhyType) { + case SK_PHY_BCOM: + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, + 0xffff); + break; + case SK_PHY_LONE: + PHY_WRITE(IoC, pPrt, Port, PHY_LONE_INT_ENAB, + 0x0); + break; + case SK_PHY_NAT: + /* todo: National + PHY_WRITE(IoC, pPrt, Port, PHY_NAT_INT_MASK, + 0xffff); */ + break; + } + + /* clear the Hash Register */ + SkXmClrHashAddr(pAC, IoC, Port); + + /* clear the Exact Match Address registers */ + SkXmClrExactAddr(pAC, IoC, Port, 0, 15); + SkXmClrSrcCheck(pAC, IoC, Port); + + /* flush the XMAC's Rx and Tx FIFOs */ + SkXmFlushTxFifo(pAC, IoC, Port); + SkXmFlushRxFifo(pAC, IoC, Port); + + pAC->GIni.GP[Port].PState = SK_PRT_STOP; +} + +/****************************************************************************** + * + * SkXmHardRst() - Do a XMAC hardware reset + * + * Description: + * The XMAC of the specified 'Port' and all connected devices + * (PHY and SERDES) will receive a reset signal on its *Reset + * pins. + * External PHYs must be reset be clearing a bit in the GPIO + * register (Timing requirements: Broadcom: 400ns, Level One: + * none, National: 80ns). + * + * Returns: + * nothing + */ +void SkXmHardRst( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* port to stop (MAC_1 + n) */ +{ + SK_U16 Word; + int i; + SK_U32 Reg; + + for (i=0; i<4; i++) { + /* TX_MFF_CTRL1 is a 32 bit register but only the lowest 16 */ + /* bit contains buttoms to press */ + SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), + (SK_U16) MFF_CLR_MAC_RST); + SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), + (SK_U16) MFF_SET_MAC_RST); + do { + SK_IN16(IoC,MR_ADDR(Port,TX_MFF_CTRL1), &Word); + } while ((Word & MFF_SET_MAC_RST) == 0); + } + if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) { + + /* reset external PHY */ + SK_IN32(IoC, B2_GP_IO, &Reg); + if (Port == 0) { + Reg |= GP_DIR_0; /* set to output */ + Reg &= ~GP_IO_0; + } + else { + Reg |= GP_DIR_2; /* set to output */ + Reg &= ~GP_IO_2; + } + SK_OUT32(IoC, B2_GP_IO, Reg); + + /* short delay */ + SK_IN32(IoC, B2_GP_IO, &Reg); + } + + pAC->GIni.GP[Port].PState = SK_PRT_RESET; +} + +/****************************************************************************** + * + * SkXmInitMac() - Initialize the XMAC II + * + * Description: + * Initialize all the XMAC of the specified port. + * The XMAC must be reset or stopped before calling this function. + * + * Note: + * The XMACs Rx and Tx state machine is still disabled when + * returning. + * + * Returns: + * nothing + */ +void SkXmInitMac( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 SWord; + int i; + SK_U32 Reg; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PState == SK_PRT_STOP) { + /* Port State: SK_PRT_STOP */ + /* Verify that the reset bit is cleared */ + SK_IN16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), &SWord); + if (SWord & (SK_U16) MFF_SET_MAC_RST) { + /* PState does not match HW state */ + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E006, + SKERR_HWI_E006MSG); + /* correct it */ + pPrt->PState = SK_PRT_RESET; + } + } + if (pPrt->PState == SK_PRT_RESET) { + /* + * clear HW reset + * Note: The SW reset is self clearing, therefore there is + * nothing to do here. + */ + SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), + (SK_U16) MFF_CLR_MAC_RST); + + /* + * clear PHY reset + */ + if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) { + + SK_IN32(IoC, B2_GP_IO, &Reg); + if (Port == 0) { + Reg |= GP_DIR_0; /* set to output */ + Reg |= GP_IO_0; + } + else { + Reg |= GP_DIR_2; /* set to output */ + Reg |= GP_IO_2; + } + SK_OUT32(IoC, B2_GP_IO, Reg); + + /* enable GMII interface */ + XM_OUT16(IoC, Port, XM_HW_CFG, XM_HW_GMII_MD); + + /* optimize MDIO transfer by oppressing preamble */ + XM_IN16(IoC, Port, XM_MMU_CMD, &SWord); + XM_OUT16(IoC, Port, XM_MMU_CMD, SWord | XM_MMU_NO_PRE); + + /* Workaround BCOM Errata for the A1 type */ + /* Write magic patterns to reserved registers */ + PHY_READ(IoC, pPrt, Port, PHY_XMAC_ID1, &SWord); + if (SWord == 0x6041) { + i = 0; + while (BcomRegA1Hack[i].PhyReg != 0) { + PHY_WRITE(IoC, pPrt, Port, + BcomRegA1Hack[i].PhyReg, + BcomRegA1Hack[i].PhyVal); + i++; + } + } + /* Workaround BCOM Errata for the C0 type */ + /* Write magic patterns to reserved registers */ + if (SWord == 0x6044) { + i = 0; + while (BcomRegC0Hack[i].PhyReg != 0) { + PHY_WRITE(IoC, pPrt, Port, + BcomRegC0Hack[i].PhyReg, + BcomRegC0Hack[i].PhyVal); + i++; + } + } + + /* + * PHY LED initialization is performed in + * SkGeXmitLED() (but not here). + */ + } + + /* Dummy read the Interrupt source register */ + XM_IN16(IoC, Port, XM_ISRC, &SWord); + + /* + * The autonegotiation process starts immediately after + * clearing the reset. Autonegotiation process should be + * started by the SIRQ, therefore stop it here immediately. + */ + SkXmInitPhy(pAC, IoC, Port, SK_FALSE); + +#if 0 + /* temp. code: enable signal detect */ + /* WARNING: do not override GMII setting above */ + XM_OUT16(pAC, Port, XM_HW_CFG, XM_HW_COM4SIG); +#endif + } + + /* + * configure the XMACs Station Address + * B2_MAC_2 = xx xx xx xx xx x1 is programed to XMAC A + * B2_MAC_3 = xx xx xx xx xx x2 is programed to XMAC B + */ + for (i = 0; i < 3; i++) { + /* + * The following 2 statements are together endianess + * independant. Remember this when changing. + */ + SK_IN16(IoC, (B2_MAC_2 + Port * 8 + i * 2), &SWord); + XM_OUT16(IoC, Port, (XM_SA + i * 2), SWord); + } + + /* Tx Inter Packet Gap (XM_TX_IPG): use default */ + /* Tx High Water Mark (XM_TX_HI_WM): use default */ + /* Tx Low Water Mark (XM_TX_LO_WM): use default */ + /* Host Request Threshold (XM_HT_THR): use default */ + /* Rx Request Threshold (XM_RX_THR): use default */ + /* Rx Low Water Mark (XM_RX_LO_WM): use default */ + + /* configure Rx High Water Mark (XM_RX_HI_WM) */ + XM_OUT16(IoC, Port, XM_RX_HI_WM, 0x05aa); + + if (pAC->GIni.GIMacsFound > 1) { + switch (pAC->GIni.GIPortUsage) { + case SK_RED_LINK: + /* Configure Tx Request Threshold for red. link */ + XM_OUT16(IoC, Port, XM_TX_THR, SK_XM_THR_REDL); + break; + case SK_MUL_LINK: + /* Configure Tx Request Threshold for load bal. */ + XM_OUT16(IoC, Port, XM_TX_THR, SK_XM_THR_MULL); + break; + case SK_JUMBO_LINK: + /* Configure Tx Request Threshold for jumbo frames */ + XM_OUT16(IoC, Port, XM_TX_THR, SK_XM_THR_JUMBO); + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E014, + SKERR_HWI_E014MSG); + break; + } + } + else { + /* Configure Tx Request Threshold for single port */ + XM_OUT16(IoC, Port, XM_TX_THR, SK_XM_THR_SL); + } + + /* + * setup register defaults for the Rx Command Register + * - Enable Automatic Frame Padding on Tx side + */ + XM_OUT16(IoC, Port, XM_TX_CMD, XM_TX_AUTO_PAD); + + /* + * setup register defaults for the Rx Command Register, + * program value of PRxCmd + */ + XM_OUT16(IoC, Port, XM_RX_CMD, pPrt->PRxCmd); + + /* + * setup register defaults for the Mode Register + * - Don't strip error frames to avoid Store & Forward + * on the rx side. + * - Enable 'Check Station Address' bit + * - Enable 'Check Address Array' bit + */ + XM_OUT32(IoC, Port, XM_MODE, XM_DEF_MODE); + + /* + * Initialize the Receive Counter Event Mask (XM_RX_EV_MSK) + * - Enable all bits excepting 'Octets Rx OK Low CntOv' + * and 'Octets Rx OK Hi Cnt Ov'. + */ + XM_OUT32(IoC, Port, XM_RX_EV_MSK, XMR_DEF_MSK); + + /* + * Initialize the Transmit Counter Event Mask (XM_TX_EV_MSK) + * - Enable all bits excepting 'Octets Tx OK Low CntOv' + * and 'Octets Tx OK Hi Cnt Ov'. + */ + XM_OUT32(IoC, Port, XM_TX_EV_MSK, XMT_DEF_MSK); + + /* + * Do NOT init XMAC interrupt mask here. + * All interrupts remain disable until link comes up! + */ + pPrt->PState = SK_PRT_INIT; + + /* + * Any additional configuration changes may be done now. + * The last action is to enable the rx and tx state machine. + * This should be done after the autonegotiation process + * has been completed successfully. + */ +} + +/****************************************************************************** + * + * SkXmInitDupMd() - Initialize the XMACs Duplex Mode + * + * Description: + * This function initilaizes the XMACs Duplex Mode. + * It should be called after successfully finishing + * the Autonegotiation Process + * + * Returns: + * nothing + */ +void SkXmInitDupMd( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + switch (pAC->GIni.GP[Port].PLinkModeStatus) { + case SK_LMODE_STAT_AUTOHALF: + case SK_LMODE_STAT_HALF: + /* Configuration Actions for Half Duplex Mode */ + /* + * XM_BURST = default value. We are propable not quick + * enough at the 'XMAC' bus to burst 8kB. + * The XMAC stopps bursting if no transmit frames + * are available or the burst limit is exceeded. + */ + /* XM_TX_RT_LIM = default value (15) */ + /* XM_TX_STIME = default value (0xff = 4096 bit times) */ + break; + case SK_LMODE_STAT_AUTOFULL: + case SK_LMODE_STAT_FULL: + /* Configuration Actions for Full Duplex Mode */ + /* + * The duplex mode is configured by the PHY, + * therefore it seems to be that there is nothing + * to do here. + */ + break; + case SK_LMODE_STAT_UNKNOWN: + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E007, SKERR_HWI_E007MSG); + break; + } +} + +/****************************************************************************** + * + * SkXmInitPauseMd() - initialize the Pause Mode to be used for this port + * + * Description: + * This function initilaizes the Pause Mode which should + * be used for this port. + * It should be called after successfully finishing + * the Autonegotiation Process + * + * Returns: + * nothing + */ +void SkXmInitPauseMd( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 Word; + SK_U32 DWord; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PFlowCtrlStatus == SK_FLOW_STAT_NONE || + pPrt->PFlowCtrlStatus == SK_FLOW_STAT_LOC_SEND) { + + /* Disable Pause Frame Reception */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Word); + XM_OUT16(IoC, Port, XM_MMU_CMD, Word | XM_MMU_IGN_PF); + } + else { + /* + * enabling pause frame reception is required for 1000BT + * because the XMAC is not reset if the link is going down + */ + /* Enable Pause Frame Reception */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Word); + XM_OUT16(IoC, Port, XM_MMU_CMD, Word & ~XM_MMU_IGN_PF); + } + + if (pPrt->PFlowCtrlStatus == SK_FLOW_STAT_SYMMETRIC || + pPrt->PFlowCtrlStatus == SK_FLOW_STAT_LOC_SEND) { + + /* + * Configure Pause Frame Generation + * Use internal and external Pause Frame Generation. + * Sending pause frames is edge triggert. Send a + * Pause frame with the maximum pause time if + * internal oder external FIFO full condition + * occurs. Send a zero pause time frame to + * start transmission again. + */ + + /* XM_PAUSE_DA = '010000C28001' (default) */ + + /* XM_MAC_PTIME = 0xffff (maximum) */ + /* remember this value is defined in big endian (!) */ + XM_OUT16(IoC, Port, XM_MAC_PTIME, 0xffff); + + /* Set Pause Mode in Mode Register */ + XM_IN32(IoC, Port, XM_MODE, &DWord); + XM_OUT32(IoC, Port, XM_MODE, DWord | XM_PAUSE_MODE); + + /* Set Pause Mode in MAC Rx FIFO */ + SK_OUT16(IoC, MR_ADDR(Port,RX_MFF_CTRL1), MFF_ENA_PAUSE); + } + else { + /* + * disable pause frame generation is required for 1000BT + * because the XMAC is not reset if the link is going down + */ + /* Disable Pause Mode in Mode Register */ + XM_IN32(IoC, Port, XM_MODE, &DWord); + XM_OUT32(IoC, Port, XM_MODE, DWord & ~XM_PAUSE_MODE); + + /* Disable Pause Mode in MAC Rx FIFO */ + SK_OUT16(IoC, MR_ADDR(Port,RX_MFF_CTRL1), MFF_DIS_PAUSE); + } + +} + + +/****************************************************************************** + * + * SkXmInitPhy() - Initialize the XMAC II Phy registers + * + * Description: + * Initialize all the XMACs Phy registers + * + * Note: + * + * Returns: + * nothing + */ +void SkXmInitPhy( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL DoLoop) /* Should a Phy LOOback be set-up? */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + switch (pPrt->PhyType) { + case SK_PHY_XMAC: + SkXmInitPhyXmac(pAC, IoC, Port, DoLoop); + break; + case SK_PHY_BCOM: + SkXmInitPhyBcom(pAC, IoC, Port, DoLoop); + break; + case SK_PHY_LONE: + SkXmInitPhyLone(pAC, IoC, Port, DoLoop); + break; + case SK_PHY_NAT: + SkXmInitPhyNat(pAC, IoC, Port, DoLoop); + break; + } +} + +/****************************************************************************** + * + * SkXmInitPhyXmac() - Initialize the XMAC II Phy registers + * + * Description: + * Initialize all the XMACs Phy registers + * + * Note: + * + * Returns: + * nothing + */ +static void SkXmInitPhyXmac( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL DoLoop) /* Should a Phy LOOback be set-up? */ +{ + SK_GEPORT *pPrt; + SK_U16 Crtl; + + pPrt = &pAC->GIni.GP[Port]; + + /* Autonegotiation ? */ + if (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("InitPhyXmac: no autonegotiation Port %d\n", Port)); + /* No Autonegiotiation */ + /* Set DuplexMode in Config register */ + Crtl = (pPrt->PLinkMode == SK_LMODE_FULL ? PHY_CT_DUP_MD : 0); + + /* + * Do NOT enable Autonegotiation here. This would hold + * the link down because no IDLES are transmitted + */ + } else { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("InitPhyXmac: with autonegotiation Port %d\n", Port)); + /* Set Autonegotiation advertisement */ + Crtl = 0; + + /* Set Full/half duplex capabilities */ + switch (pPrt->PLinkMode) { + case SK_LMODE_AUTOHALF: + Crtl |= PHY_X_AN_HD; + break; + case SK_LMODE_AUTOFULL: + Crtl |= PHY_X_AN_FD; + break; + case SK_LMODE_AUTOBOTH: + Crtl |= PHY_X_AN_FD | PHY_X_AN_HD; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E015, SKERR_HWI_E015MSG) ; + } + + switch (pPrt->PFlowCtrlMode) { + case SK_FLOW_MODE_NONE: + Crtl |= PHY_X_P_NO_PAUSE; + break; + case SK_FLOW_MODE_LOC_SEND: + Crtl |= PHY_X_P_ASYM_MD; + break; + case SK_FLOW_MODE_SYMMETRIC: + Crtl |= PHY_X_P_SYM_MD; + break; + case SK_FLOW_MODE_SYM_OR_REM: + Crtl |= PHY_X_P_BOTH_MD; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E016, SKERR_HWI_E016MSG) ; + } + + /* Write AutoNeg Advertisement Register */ + PHY_WRITE(IoC, pPrt, Port, PHY_XMAC_AUNE_ADV, Crtl) ; + + /* Restart Autonegotiation */ + Crtl = PHY_CT_ANE | PHY_CT_RE_CFG; + } + + if (DoLoop) { + /* Set the Phy Loopback bit, too */ + Crtl |= PHY_CT_LOOP; + } + + /* Write to the Phy control register */ + PHY_WRITE(IoC, pPrt, Port, PHY_XMAC_CTRL, Crtl) ; +} + +/****************************************************************************** + * + * SkXmInitPhyBcom() - Initialize the Broadcom Phy registers + * + * Description: + * Initialize all the Broadcom Phy registers + * + * Note: + * + * Returns: + * nothing + */ +static void SkXmInitPhyBcom( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL DoLoop) /* Should a Phy LOOback be set-up? */ +{ + SK_GEPORT *pPrt; + SK_U16 Crtl1 = PHY_B_CT_SP1000; + SK_U16 Crtl2 = 0; + SK_U16 Crtl3 = PHY_SEL_TYPE; + SK_U16 Crtl4 = PHY_B_PEC_EN_LTR; + SK_U16 Crtl5 = PHY_B_AC_TX_TST; + + pPrt = &pAC->GIni.GP[Port]; + + /* manuell Master/Slave ? */ + if (pPrt->PMSMode != SK_MS_MODE_AUTO) { + Crtl2 |= PHY_B_1000C_MSE; + if (pPrt->PMSMode == SK_MS_MODE_MASTER) { + Crtl2 |= PHY_B_1000C_MSC; + } + } + /* Autonegotiation ? */ + if (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("InitPhyBcom: no autonegotiation Port %d\n", Port)); + /* No Autonegiotiation */ + /* Set DuplexMode in Config register */ + Crtl1 |= (pPrt->PLinkMode == SK_LMODE_FULL ? PHY_CT_DUP_MD : 0); + + /* Determine Master/Slave manuell if not already done */ + if (pPrt->PMSMode == SK_MS_MODE_AUTO) { + Crtl2 |= PHY_B_1000C_MSE; /* set it to Slave */ + } + + /* + * Do NOT enable Autonegotiation here. This would hold + * the link down because no IDLES are transmitted + */ + } else { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("InitPhyBcom: with autonegotiation Port %d\n", Port)); + /* Set Autonegotiation advertisement */ + + /* Set Full/half duplex capabilities */ + switch (pPrt->PLinkMode) { + case SK_LMODE_AUTOHALF: + Crtl2 |= PHY_B_1000C_AHD; + break; + case SK_LMODE_AUTOFULL: + Crtl2 |= PHY_B_1000C_AFD; + break; + case SK_LMODE_AUTOBOTH: + Crtl2 |= PHY_B_1000C_AFD | PHY_B_1000C_AHD; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E015, SKERR_HWI_E015MSG) ; + } + + switch (pPrt->PFlowCtrlMode) { + case SK_FLOW_MODE_NONE: + Crtl3 |= PHY_B_P_NO_PAUSE; + break; + case SK_FLOW_MODE_LOC_SEND: + Crtl3 |= PHY_B_P_ASYM_MD; + break; + case SK_FLOW_MODE_SYMMETRIC: + Crtl3 |= PHY_B_P_SYM_MD; + break; + case SK_FLOW_MODE_SYM_OR_REM: + Crtl3 |= PHY_B_P_BOTH_MD; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E016, SKERR_HWI_E016MSG); + } + + /* Restart Autonegotiation */ + Crtl1 |= PHY_CT_ANE | PHY_CT_RE_CFG; + + } + + /* Initialize LED register here? */ + /* No. Please do it in SkDgXmitLed() (if required) and swap + init order of LEDs and XMAC. (MAl) */ + + /* Write 1000Base-T Control Register */ + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_1000T_CTRL, Crtl2); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("1000Base-T Control Reg = %x\n", Crtl2)); + + /* Write AutoNeg Advertisement Register */ + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUNE_ADV, Crtl3); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg Advertisment Reg = %x\n", Crtl3)); + + + if (DoLoop) { + /* Set the Phy Loopback bit, too */ + Crtl1 |= PHY_CT_LOOP; + } + + if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { + /* configure fifo to high latency for xmission of ext. packets*/ + Crtl4 |= PHY_B_PEC_HIGH_LA; + + /* configure reception of extended packets */ + Crtl5 |= PHY_B_AC_LONG_PACK; + + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, Crtl5); + } + + /* Configure LED Traffic Mode and Jumbo Frame usage if specified */ + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_P_EXT_CTRL, Crtl4); + + /* Write to the Phy control register */ + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_CTRL, Crtl1); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("PHY Control Reg = %x\n", Crtl1)); +} + +/****************************************************************************** + * + * SkXmInitPhyLone() - Initialize the Level One Phy registers + * + * Description: + * Initialize all the Level One Phy registers + * + * Note: + * + * Returns: + * nothing + */ +static void SkXmInitPhyLone( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL DoLoop) /* Should a Phy LOOback be set-up? */ +{ + SK_GEPORT *pPrt; + SK_U16 Crtl1 = PHY_L_CT_SP1000; + SK_U16 Crtl2 = 0; + SK_U16 Crtl3 = PHY_SEL_TYPE; + + pPrt = &pAC->GIni.GP[Port]; + + /* manuell Master/Slave ? */ + if (pPrt->PMSMode != SK_MS_MODE_AUTO) { + Crtl2 |= PHY_L_1000C_MSE; + if (pPrt->PMSMode == SK_MS_MODE_MASTER) { + Crtl2 |= PHY_L_1000C_MSC; + } + } + /* Autonegotiation ? */ + if (pPrt->PLinkMode == SK_LMODE_HALF || + pPrt->PLinkMode == SK_LMODE_FULL) { + /* + * level one spec say: "1000Mbps: manual mode not allowed" + * but lets see what happens... + */ + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + 0, "Level One PHY only works with Autoneg"); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("InitPhyLone: no autonegotiation Port %d\n", Port)); + /* No Autonegiotiation */ + /* Set DuplexMode in Config register */ + Crtl1 = (pPrt->PLinkMode == SK_LMODE_FULL ? PHY_CT_DUP_MD : 0); + + /* Determine Master/Slave manuell if not already done */ + if (pPrt->PMSMode == SK_MS_MODE_AUTO) { + Crtl2 |= PHY_L_1000C_MSE; /* set it to Slave */ + } + + /* + * Do NOT enable Autonegotiation here. This would hold + * the link down because no IDLES are transmitted + */ + } else { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("InitPhyLone: with autonegotiation Port %d\n", Port)); + /* Set Autonegotiation advertisement */ + + /* Set Full/half duplex capabilities */ + switch (pPrt->PLinkMode) { + case SK_LMODE_AUTOHALF: + Crtl2 |= PHY_L_1000C_AHD; + break; + case SK_LMODE_AUTOFULL: + Crtl2 |= PHY_L_1000C_AFD; + break; + case SK_LMODE_AUTOBOTH: + Crtl2 |= PHY_L_1000C_AFD | PHY_L_1000C_AHD; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E015, SKERR_HWI_E015MSG) ; + } + + switch (pPrt->PFlowCtrlMode) { + case SK_FLOW_MODE_NONE: + Crtl3 |= PHY_L_P_NO_PAUSE; + break; + case SK_FLOW_MODE_LOC_SEND: + Crtl3 |= PHY_L_P_ASYM_MD; + break; + case SK_FLOW_MODE_SYMMETRIC: + Crtl3 |= PHY_L_P_SYM_MD; + break; + case SK_FLOW_MODE_SYM_OR_REM: + Crtl3 |= PHY_L_P_BOTH_MD; + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E016, SKERR_HWI_E016MSG); + } + + /* Restart Autonegotiation */ + Crtl1 = PHY_CT_ANE | PHY_CT_RE_CFG; + + } + + /* Initialize LED register here ? */ + /* No. Please do it in SkDgXmitLed() (if required) and swap + init order of LEDs and XMAC. (MAl) */ + + /* Write 1000Base-T Control Register */ + PHY_WRITE(IoC, pPrt, Port, PHY_LONE_1000T_CTRL, Crtl2); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("1000Base-T Control Reg = %x\n", Crtl2)); + + /* Write AutoNeg Advertisement Register */ + PHY_WRITE(IoC, pPrt, Port, PHY_LONE_AUNE_ADV, Crtl3); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNeg Advertisment Reg = %x\n", Crtl3)); + + + if (DoLoop) { + /* Set the Phy Loopback bit, too */ + Crtl1 |= PHY_CT_LOOP; + } + + if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { + /* + * nothing to do for Level one. + * PHY supports frames up to 10k. + */ + } + + /* Write to the Phy control register */ + PHY_WRITE(IoC, pPrt, Port, PHY_LONE_CTRL, Crtl1); + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("PHY Control Reg = %x\n", Crtl1)); +} + +/****************************************************************************** + * + * SkXmInitPhyNat() - Initialize the National Phy registers + * + * Description: + * Initialize all the National Phy registers + * + * Note: + * + * Returns: + * nothing + */ +static void SkXmInitPhyNat( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_BOOL DoLoop) /* Should a Phy LOOback be set-up? */ +{ +/* todo: National */ +} + +/****************************************************************************** + * + * SkXmAutoNegLipaXmac() - Decides whether Link Partner could do autoneg + * + * This function analyses the Interrupt status word. If any of the + * Autonegotiating interrupt bits are set, the PLipaAutoNeg variable + * is set true. + */ +void SkXmAutoNegLipaXmac( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U16 IStatus) /* Interrupt Status word to analyse */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PLipaAutoNeg != SK_LIPA_AUTO && + (IStatus & (XM_IS_LIPA_RC|XM_IS_RX_PAGE|XM_IS_AND))) { + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegLipa: AutoNeg detected on port %d %x\n", Port, IStatus)); + pPrt->PLipaAutoNeg = SK_LIPA_AUTO; + } +} + +/****************************************************************************** + * + * SkXmAutoNegLipaBcom() - Decides whether Link Partner could do autoneg + * + * This function analyses the PHY status word. If any of the + * Autonegotiating bits are set, The PLipaAutoNeg variable + * is set true. + */ +void SkXmAutoNegLipaBcom( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U16 PhyStat) /* PHY Status word to analyse */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PLipaAutoNeg != SK_LIPA_AUTO && + (PhyStat & (PHY_ST_AN_OVER))) { + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegLipa: AutoNeg detected on port %d %x\n", Port, PhyStat)); + pPrt->PLipaAutoNeg = SK_LIPA_AUTO; + } +} + +/****************************************************************************** + * + * SkXmAutoNegLipaLone() - Decides whether Link Partner could do autoneg + * + * This function analyses the PHY status word. If any of the + * Autonegotiating bits are set, The PLipaAutoNeg variable + * is set true. + */ +void SkXmAutoNegLipaLone( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U16 PhyStat) /* PHY Status word to analyse */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PLipaAutoNeg != SK_LIPA_AUTO && + (PhyStat & (PHY_ST_AN_OVER))) { + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegLipa: AutoNeg detected on port %d %x\n", Port, PhyStat)); + pPrt->PLipaAutoNeg = SK_LIPA_AUTO; + } +} + +/****************************************************************************** + * + * SkXmAutoNegLipaNat() - Decides whether Link Partner could do autoneg + * + * This function analyses the PHY status word. If any of the + * Autonegotiating bits are set, The PLipaAutoNeg variable + * is set true. + */ +void SkXmAutoNegLipaNat( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U16 PhyStat) /* PHY Status word to analyse */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PLipaAutoNeg != SK_LIPA_AUTO && + (PhyStat & (PHY_ST_AN_OVER))) { + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegLipa: AutoNeg detected on port %d %x\n", Port, PhyStat)); + pPrt->PLipaAutoNeg = SK_LIPA_AUTO; + } +} +/****************************************************************************** + * + * SkXmAutoNegDone() - Auto negotiation handling + * + * Description: + * This function handles the autonegotiation if the Done bit is set. + * + * Note: + * o The XMACs interrupt source register is NOT read here. + * o This function is public because it is used in the diagnostics + * tool, too. + * + * Returns: + * SK_AND_OK o.k. + * SK_AND_DUP_CAP Duplex capability error happened + * SK_AND_OTHER Other error happened + */ +int SkXmAutoNegDone( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + + pPrt = &pAC->GIni.GP[Port]; + + switch (pPrt->PhyType) { + case SK_PHY_XMAC: + return (SkXmAutoNegDoneXmac(pAC, IoC, Port)); + case SK_PHY_BCOM: + return (SkXmAutoNegDoneBcom(pAC, IoC, Port)); + case SK_PHY_LONE: + return (SkXmAutoNegDoneLone(pAC, IoC, Port)); + case SK_PHY_NAT: + return (SkXmAutoNegDoneNat(pAC, IoC, Port)); + } + return(SK_AND_OTHER); +} + +/****************************************************************************** + * + * SkXmAutoNegDoneXmac() - Auto negotiation handling + * + * Description: + * This function handles the autonegotiation if the Done bit is set. + * + * Note: + * o The XMACs interrupt source register is NOT read here. + * + * Returns: + * SK_AND_OK o.k. + * SK_AND_DUP_CAP Duplex capability error happened + * SK_AND_OTHER Other error happened + */ +static int SkXmAutoNegDoneXmac( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 ResAb ; /* Resolved Ability */ + SK_U16 LPAb ; /* Link Partner Ability */ + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, ("AutoNegDoneXmac" + "Port %d\n",Port)); + + pPrt = &pAC->GIni.GP[Port]; + + /* Get PHY parameters */ + PHY_READ(IoC, pPrt, Port, PHY_XMAC_AUNE_LP, &LPAb); + PHY_READ(IoC, pPrt, Port, PHY_XMAC_RES_ABI, &ResAb); + + if (LPAb & PHY_X_AN_RFB) { + /* At least one of the remote fault bit is set */ + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegFail: Remote fault bit set Port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE ; + return (SK_AND_OTHER) ; + } + + /* Check Duplex mismatch */ + if ((ResAb & (PHY_X_RS_HD | PHY_X_RS_FD)) == PHY_X_RS_FD) { + pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL ; + } else if ((ResAb & (PHY_X_RS_HD | PHY_X_RS_FD)) == PHY_X_RS_HD) { + pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF ; + } else { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegFail: Duplex mode mismatch port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE ; + return (SK_AND_DUP_CAP) ; + } + + /* Check PAUSE mismatch */ + /* We are NOT using chapter 4.23 of the Xaqti manual */ + /* We are using IEEE 802.3z/D5.0 Table 37-4 */ + if ((pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYMMETRIC || + pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM) && + (LPAb & PHY_X_P_SYM_MD)) { + /* Symmetric PAUSE */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC; + } else if (pPrt->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM && + (LPAb & PHY_X_RS_PAUSE) == PHY_X_P_ASYM_MD) { + /* Enable PAUSE receive, disable PAUSE transmit */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND; + } else if (pPrt->PFlowCtrlMode == SK_FLOW_MODE_LOC_SEND && + (LPAb & PHY_X_RS_PAUSE) == PHY_X_P_BOTH_MD) { + /* Disable PAUSE receive, enable PAUSE transmit */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND; + } else { + /* PAUSE mismatch -> no PAUSE */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; + } + + /* We checked everything and may now enable the link */ + pPrt->PAutoNegFail = SK_FALSE ; + + SkXmRxTxEnable(pAC, IoC, Port); + return(SK_AND_OK) ; +} + +/****************************************************************************** + * + * SkXmAutoNegDoneBcom() - Auto negotiation handling + * + * Description: + * This function handles the autonegotiation if the Done bit is set. + * + * Note: + * o The XMACs interrupt source register is NOT read here. + * + * Returns: + * SK_AND_OK o.k. + * SK_AND_DUP_CAP Duplex capability error happened + * SK_AND_OTHER Other error happened + */ +static int SkXmAutoNegDoneBcom( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 ResAb ; /* Resolved Ability */ + SK_U16 LPAb ; /* Link Partner Ability */ + SK_U16 AuxStat; /* Auxiliary Status */ + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, ("AutoNegDoneBcom," + " Port %d\n",Port)); + pPrt = &pAC->GIni.GP[Port]; + + /* Get PHY parameters */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUNE_LP, &LPAb); + PHY_READ(IoC, pPrt, Port, PHY_BCOM_1000T_STAT, &ResAb); + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_STAT, &AuxStat); + + if (LPAb & PHY_B_AN_RF) { + /* Remote fault bit is set */ + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegFail: Remote fault bit set Port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE ; + return (SK_AND_OTHER) ; + } + + /* Check Duplex mismatch */ + if ((AuxStat & PHY_B_AS_AN_RES) == PHY_B_RES_1000FD) { + pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL ; + } else if ((AuxStat & PHY_B_AS_AN_RES) == PHY_B_RES_1000HD) { + pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF ; + } else { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegFail: Duplex mode mismatch port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE ; + return (SK_AND_DUP_CAP) ; + } + + /* Check Master/Slave resolution */ + if (ResAb & (PHY_B_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT; + return (SK_AND_OTHER); + } else if (ResAb & PHY_B_1000S_MSR) { + pPrt->PMSStatus = SK_MS_STAT_MASTER ; + } else { + pPrt->PMSStatus = SK_MS_STAT_SLAVE ; + } + + /* Check PAUSE mismatch */ + /* We are NOT using chapter 4.23 of the Xaqti manual */ + /* We are using IEEE 802.3z/D5.0 Table 37-4 */ + if ((AuxStat & (PHY_B_AS_PRR | PHY_B_AS_PRT)) == + (PHY_B_AS_PRR | PHY_B_AS_PRT)) { + /* Symmetric PAUSE */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC; + } else if ((AuxStat & (PHY_B_AS_PRR | PHY_B_AS_PRT)) == PHY_B_AS_PRR) { + /* Enable PAUSE receive, disable PAUSE transmit */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND; + } else if ((AuxStat & (PHY_B_AS_PRR | PHY_B_AS_PRT)) == PHY_B_AS_PRT) { + /* Disable PAUSE receive, enable PAUSE transmit */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND; + } else { + /* PAUSE mismatch -> no PAUSE */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; + } + + /* We checked everything and may now enable the link */ + pPrt->PAutoNegFail = SK_FALSE ; + + SkXmRxTxEnable(pAC, IoC, Port); + return(SK_AND_OK) ; +} + +/****************************************************************************** + * + * SkXmAutoNegDoneLone() - Auto negotiation handling + * + * Description: + * This function handles the autonegotiation if the Done bit is set. + * + * Note: + * o The XMACs interrupt source register is NOT read here. + * + * Returns: + * SK_AND_OK o.k. + * SK_AND_DUP_CAP Duplex capability error happened + * SK_AND_OTHER Other error happened + */ +static int SkXmAutoNegDoneLone( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 ResAb ; /* Resolved Ability */ + SK_U16 LPAb ; /* Link Partner Ability */ + SK_U16 QuickStat; /* Auxiliary Status */ + + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, ("AutoNegDoneLone" + "Port %d\n",Port)); + pPrt = &pAC->GIni.GP[Port]; + + /* Get PHY parameters */ + PHY_READ(IoC, pPrt, Port, PHY_LONE_AUNE_LP, &LPAb); + PHY_READ(IoC, pPrt, Port, PHY_LONE_1000T_STAT, &ResAb); + PHY_READ(IoC, pPrt, Port, PHY_LONE_Q_STAT, &QuickStat); + + if (LPAb & PHY_L_AN_RF) { + /* Remote fault bit is set */ + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("AutoNegFail: Remote fault bit set Port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE ; + return (SK_AND_OTHER) ; + } + + /* Check Duplex mismatch */ + if (QuickStat & PHY_L_QS_DUP_MOD) { + pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOFULL ; + } else { + pPrt->PLinkModeStatus = SK_LMODE_STAT_AUTOHALF ; + } + + /* Check Master/Slave resolution */ + if (ResAb & (PHY_L_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT ; + return (SK_AND_OTHER); + } else if (ResAb & PHY_L_1000S_MSR) { + pPrt->PMSStatus = SK_MS_STAT_MASTER ; + } else { + pPrt->PMSStatus = SK_MS_STAT_SLAVE ; + } + + /* Check PAUSE mismatch */ + /* We are NOT using chapter 4.23 of the Xaqti manual */ + /* We are using IEEE 802.3z/D5.0 Table 37-4 */ + /* we must manually resolve the abilities here */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_NONE; + switch (pPrt->PFlowCtrlMode) { + case SK_FLOW_MODE_NONE: + /* default */ + break; + case SK_FLOW_MODE_LOC_SEND: + if ((QuickStat & (PHY_L_QS_PAUSE | PHY_L_QS_AS_PAUSE)) == + (PHY_L_QS_PAUSE | PHY_L_QS_AS_PAUSE)) { + /* Disable PAUSE receive, enable PAUSE transmit */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_LOC_SEND; + } + break; + case SK_FLOW_MODE_SYMMETRIC: + if ((QuickStat & PHY_L_QS_PAUSE) == PHY_L_QS_PAUSE) { + /* Symmetric PAUSE */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC; + } + break; + case SK_FLOW_MODE_SYM_OR_REM: + if ((QuickStat & (PHY_L_QS_PAUSE | PHY_L_QS_AS_PAUSE)) == + PHY_L_QS_AS_PAUSE) { + /* Enable PAUSE receive, disable PAUSE transmit */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_REM_SEND; + } + else if ((QuickStat & PHY_L_QS_PAUSE) == PHY_L_QS_PAUSE) { + /* Symmetric PAUSE */ + pPrt->PFlowCtrlStatus = SK_FLOW_STAT_SYMMETRIC; + } + break; + default: + SK_ERR_LOG(pAC, SK_ERRCL_SW | SK_ERRCL_INIT, + SKERR_HWI_E016, SKERR_HWI_E016MSG); + } + + /* We checked everything and may now enable the link */ + pPrt->PAutoNegFail = SK_FALSE ; + + SkXmRxTxEnable(pAC, IoC, Port); + return(SK_AND_OK); +} + +/****************************************************************************** + * + * SkXmAutoNegDoneNat() - Auto negotiation handling + * + * Description: + * This function handles the autonegotiation if the Done bit is set. + * + * Note: + * o The XMACs interrupt source register is NOT read here. + * o This function is public because it is used in the diagnostics + * tool, too. + * + * Returns: + * SK_AND_OK o.k. + * SK_AND_DUP_CAP Duplex capability error happened + * SK_AND_OTHER Other error happened + */ +static int SkXmAutoNegDoneNat( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ +/* todo: National */ + return(SK_AND_OK); +} + +/****************************************************************************** + * + * SkXmRxTxEnable() - Enable RxTx activity if port is up + * + * Description: + * + * Note: + * o The XMACs interrupt source register is NOT read here. + * + * Returns: + * 0 o.k. + * != 0 Error happened + */ +int SkXmRxTxEnable( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port) /* Port Index (MAC_1 + n) */ +{ + SK_GEPORT *pPrt; + SK_U16 Reg ; /* 16bit register value */ + SK_U16 IntMask; /* XMac interrupt mask */ + + pPrt = &pAC->GIni.GP[Port]; + + if (!pPrt->PHWLinkUp) { + /* The Hardware link is NOT up */ + return(0) ; + } + + if ((pPrt->PLinkMode == SK_LMODE_AUTOHALF || + pPrt->PLinkMode == SK_LMODE_AUTOFULL || + pPrt->PLinkMode == SK_LMODE_AUTOBOTH) && + pPrt->PAutoNegFail) { + /* Autonegotiation is not done or failed */ + return(0) ; + } + + /* Set Dup Mode and Pause Mode */ + SkXmInitDupMd (pAC, IoC, Port); + SkXmInitPauseMd (pAC, IoC, Port); + + /* + * Initialize the Interrupt Mask Register. Default IRQs are... + * - Link Asynchronous Event + * - Link Partner requests config + * - Auto Negotiation Done + * - Rx Counter Event Overflow + * - Tx Counter Event Overflow + * - Transmit FIFO Underrun + */ + if (pPrt->PhyType == SK_PHY_XMAC) { + IntMask = XM_DEF_MSK; + } + else { + /* disable GP0 interrupt bit */ + IntMask = XM_DEF_MSK | XM_IS_INP_ASS; + } + XM_OUT16(IoC, Port, XM_IMSK, IntMask); + + /* RX/TX enable */ + XM_IN16(IoC, Port, XM_MMU_CMD, &Reg); + if (pPrt->PhyType != SK_PHY_XMAC && + (pPrt->PLinkModeStatus == SK_LMODE_STAT_FULL || + pPrt->PLinkModeStatus == SK_LMODE_STAT_AUTOFULL)) { + Reg |= XM_MMU_GMII_FD; + } + switch (pPrt->PhyType) { + case SK_PHY_BCOM: + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, + PHY_B_DEF_MSK); + break; + case SK_PHY_LONE: + PHY_WRITE(IoC, pPrt, Port, PHY_LONE_INT_ENAB, + PHY_L_DEF_MSK); + break; + case SK_PHY_NAT: + /* todo National: + PHY_WRITE(IoC, pPrt, Port, PHY_NAT_INT_MASK, + PHY_N_DEF_MSK); */ + /* no interrupts possible from National ??? */ + break; + } + XM_OUT16(IoC, Port, XM_MMU_CMD, Reg | XM_MMU_ENA_RX | XM_MMU_ENA_TX); + + return (0); +} + +#ifndef SK_DIAG +/****************************************************************************** + * + * SkXmIrq() - Interrupt service routine + * + * Description: + * Services an Interrupt of the XMAC II + * + * Note: + * The XMACs interrupt source register is NOT read here. + * With an external PHY, some interrupt bits are not meaningfull + * any more: + * - LinkAsyncEvent (bit #14) XM_IS_LNK_AE + * - LinkPartnerReqConfig (bit #10) XM_IS_LIPA_RC + * - Page Received (bit #9) XM_IS_RX_PAGE + * - NextPageLoadedForXmt (bit #8) XM_IS_TX_PAGE + * - AutoNegDone (bit #7) XM_IS_AND + * Also probably not valid any more is the GP0 input bit: + * - GPRegisterBit0set XM_IS_INP_ASS + * + * Returns: + * nothing + */ +void SkXmIrq( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int Port, /* Port Index (MAC_1 + n) */ +SK_U16 IStatus) /* Interrupt status read from the XMAC */ +{ + SK_GEPORT *pPrt; + SK_EVPARA Para; + + pPrt = &pAC->GIni.GP[Port]; + + if (pPrt->PhyType != SK_PHY_XMAC) { + /* mask bits that are not used with ext. PHY */ + IStatus &= ~(XM_IS_LNK_AE | XM_IS_LIPA_RC | + XM_IS_RX_PAGE | XM_IS_TX_PAGE | + XM_IS_AND | XM_IS_INP_ASS); + } + + /* + * LinkPartner Autonegable ? + */ + if (pPrt->PhyType == SK_PHY_XMAC) { + SkXmAutoNegLipaXmac(pAC, IoC, Port, IStatus); + } + + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ, + ("XmacIrq Port %d Isr %x\n", Port, IStatus)); + + if (!pPrt->PHWLinkUp) { + /* Spurious XMAC interrupt */ + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_IRQ, + ("SkXmIrq: spurious interrupt on port %d\n", + Port)); + return; + } + + if (IStatus & XM_IS_LNK_AE) { + /* not used GP0 is used instead */ + } + + if (IStatus & XM_IS_TX_ABORT) { + /* not used */ + } + + if (IStatus & XM_IS_FRC_INT) { + /* not used. use ASIC IRQ instead if needed */ + } + + if (IStatus & (XM_IS_INP_ASS | XM_IS_LIPA_RC | XM_IS_RX_PAGE)) { + SkHWLinkDown(pAC, IoC, Port); + + /* Signal to RLMT */ + Para.Para32[0] = (SK_U32) Port; + SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_LINK_DOWN, Para); + + /* Start workaround Errata #2 timer */ + SkTimerStart(pAC, IoC, &pAC->GIni.GP[Port].PWaTimer, + SK_WA_INA_TIME,SKGE_HWAC,SK_HWEV_WATIM,Para); + } + + if (IStatus & XM_IS_RX_PAGE) { + /* not used */ + } + + if (IStatus & XM_IS_TX_PAGE) { + /* not used */ + } + + if (IStatus & XM_IS_AND) { + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_IRQ, + ("SkXmIrq: AND on link that is up port %d\n", Port)); + } + + if (IStatus & XM_IS_TSC_OV) { + /* not used */ + } + + if (IStatus & XM_IS_RXC_OV) { + Para.Para32[0] = (SK_U32) Port; + Para.Para32[1] = (SK_U32) IStatus; + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_SIRQ_OVERFLOW, Para); + } + + if (IStatus & XM_IS_TXC_OV) { + Para.Para32[0] = (SK_U32) Port; + Para.Para32[1] = (SK_U32) IStatus; + SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_SIRQ_OVERFLOW, Para); + } + + if (IStatus & XM_IS_RXF_OV) { + /* normal situation -> no effect */ + } + + if (IStatus & XM_IS_TXF_UR) { + /* may NOT happen -> error log */ + SK_ERR_LOG(pAC, SK_ERRCL_HW , SKERR_SIRQ_E020, + SKERR_SIRQ_E020MSG) ; + } + + if (IStatus & XM_IS_TX_COMP) { + /* not served here */ + } + + if (IStatus & XM_IS_RX_COMP) { + /* not served here */ + } + +} +#endif /* !SK_DIAG */ + +/* End of file */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/slhc.c linux/drivers/net/slhc.c --- v2.3.28/linux/drivers/net/slhc.c Thu Nov 11 20:11:42 1999 +++ linux/drivers/net/slhc.c Thu Nov 18 19:25:28 1999 @@ -752,8 +752,9 @@ } #else /* MODULE */ -void __init slhc_install(void) +int __init slhc_install(void) { + return 0; } #endif /* MODULE */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/strip.c linux/drivers/net/strip.c --- v2.3.28/linux/drivers/net/strip.c Thu Nov 11 20:11:42 1999 +++ linux/drivers/net/strip.c Fri Nov 19 11:33:29 1999 @@ -1251,7 +1251,7 @@ * the /proc file system. */ -static int get_status_info(char *buffer, char **start, off_t req_offset, int req_len, int dummy) +static int get_status_info(char *buffer, char **start, off_t req_offset, int req_len) { int total = 0, slop = 0; struct strip *strip_info = struct_strip_list; diff -u --recursive --new-file v2.3.28/linux/drivers/net/tlan.c linux/drivers/net/tlan.c --- v2.3.28/linux/drivers/net/tlan.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/net/tlan.c Fri Nov 19 21:15:06 1999 @@ -1130,8 +1130,8 @@ printk( "TLAN: Received interrupt for uncompleted TX frame.\n" ); } -#if LINUX_KERNEL_VERSION > 0x20100 - priv->stats->tx_bytes += head_list->frameSize; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0) + priv->stats.tx_bytes += head_list->frameSize; #endif head_list->cStat = TLAN_CSTAT_UNUSED; @@ -1250,8 +1250,8 @@ skb_reserve( skb, 2 ); t = (void *) skb_put( skb, head_list->frameSize ); -#if LINUX_KERNEL_VERSION > 0x20100 - priv->stats->rx_bytes += head_list->frameSize; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0) + priv->stats.rx_bytes += head_list->frameSize; #endif memcpy( t, head_buffer, head_list->frameSize ); @@ -1274,8 +1274,8 @@ skb = (struct sk_buff *) head_list->buffer[9].address; head_list->buffer[9].address = 0; skb_trim( skb, head_list->frameSize ); -#if LINUX_KERNEL_VERSION > 0x20100 - priv->stats->rx_bytes += head_list->frameSize; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0) + priv->stats.rx_bytes += head_list->frameSize; #endif skb->protocol = eth_type_trans( skb, dev ); diff -u --recursive --new-file v2.3.28/linux/drivers/net/tokenring/tms380tr.c linux/drivers/net/tokenring/tms380tr.c --- v2.3.28/linux/drivers/net/tokenring/tms380tr.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/net/tokenring/tms380tr.c Thu Nov 18 20:11:31 1999 @@ -31,9 +31,9 @@ * - David Hein at Texas Instruments * * Maintainer(s): - * JS Jay Schulist jschlst@samba.anu.edu.au + * JS Jay Schulist jschlst@samba.anu.edu.au * CG Christoph Goos cgoos@syskonnect.de - * AF Adam Fritzler mid@auk.cx + * AF Adam Fritzler mid@auk.cx * * Modification History: * 29-Aug-97 CG Created @@ -42,10 +42,10 @@ * 27-May-98 JS Formated to Linux Kernel Format * 31-May-98 JS Hacked in PCI support * 16-Jun-98 JS Modulized for multiple cards with one driver - * Sep-99 AF Renamed to tms380tr (supports more than SK's) - * 23-Sep-99 AF Added Compaq and Thomas-Conrad PCI support - * Fixed a bug causing double copies on PCI - * Fixed for new multicast stuff (2.2/2.3) + * Sep-99 AF Renamed to tms380tr (supports more than SK's) + * 23-Sep-99 AF Added Compaq and Thomas-Conrad PCI support + * Fixed a bug causing double copies on PCI + * Fixed for new multicast stuff (2.2/2.3) * 25-Sep-99 AF Uped TPL_NUM from 3 to 9 * Removed extraneous 'No free TPL' * @@ -226,18 +226,22 @@ else if(base_addr != 0) /* Don't probe at all. */ return (-ENXIO); + /* + * Let's check for pci adapters first + */ + if (tms380tr_probe1(dev,0) == 0) /* Success */ + return 0 ; + + /* + * No pci cards found, let's check for isa + */ + for(i = 0; tms380tr_portlist[i]; i++) { int ioaddr = tms380tr_portlist[i]; - if(check_region(ioaddr, TMS380TR_IO_EXTENT)) + if(check_region(ioaddr, TMS380TR_IO_EXTENT)) /* Region already used */ continue; - if(tms380tr_probe1(dev, ioaddr)) - { -#ifndef MODULE - tr_freedev(dev); -#endif - } - else + if(!tms380tr_probe1(dev, ioaddr)) return (0); } @@ -248,7 +252,6 @@ unsigned short device) { int cur; - for (cur = 1; cardinfo[cur].name != NULL; cur++) { if (cardinfo[cur].type == 2) /* PCI */ { @@ -266,65 +269,39 @@ static int __init tms380tr_pci_chk_card(struct net_device *dev, struct cardinfo_table **outcard) { - static int pci_index = 0; - unsigned char pci_bus, pci_device_fn; + struct pci_dev *pci_device = NULL ; struct cardinfo_table *card; int i; if(!pci_present()) return (-1); /* No PCI present. */ + + while ( (pci_device=pci_find_class(PCI_CLASS_NETWORK_TOKEN_RING<<8, pci_device))) { - for(; pci_index < 0xff; pci_index++) - { unsigned int pci_irq_line; - struct pci_dev *pdev; - unsigned short pci_command, new_command, vendor, device; unsigned int pci_ioaddr; - if(pcibios_find_class(PCI_CLASS_NETWORK_TOKEN_RING << 8, - pci_index, &pci_bus, &pci_device_fn) - != PCIBIOS_SUCCESSFUL) - { - break; - } - - pcibios_read_config_word(pci_bus, pci_device_fn, - PCI_VENDOR_ID, &vendor); - pcibios_read_config_word(pci_bus, pci_device_fn, - PCI_DEVICE_ID, &device); - - pdev = pci_find_slot(pci_bus, pci_device_fn); - pci_irq_line = pdev->irq; - pci_ioaddr = pdev->resource[0].start; - - pcibios_read_config_word(pci_bus, pci_device_fn, - PCI_COMMAND, &pci_command); - /* Remove I/O space marker in bit 0. */ - pci_ioaddr &= ~3; + pci_irq_line = pci_device->irq ; + pci_ioaddr = pci_device->resource[0].start ; +/* pci_ioaddr &= ~3; */ + + /* Don't return from here, just continue on the card discovery loop - MLP */ + if (!(card = tms380tr_pci_getcardinfo(pci_device->vendor, pci_device->device))) + continue ; - if (!(card = tms380tr_pci_getcardinfo(vendor, device))) - return -ENODEV; - if(check_region(pci_ioaddr, TMS380TR_IO_EXTENT)) continue; + request_region(pci_ioaddr, TMS380TR_IO_EXTENT, card->name); - if(request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ, - card->name, dev)) + if(request_irq(pci_device->irq, tms380tr_interrupt, SA_SHIRQ, + card->name, dev)) { + release_region(pci_ioaddr, TMS380TR_IO_EXTENT) ; return (-ENODEV); /* continue; ?? */ - - new_command = (pci_command|PCI_COMMAND_MASTER|PCI_COMMAND_IO); - - if(pci_command != new_command) - { - printk("The PCI BIOS has not enabled this" - "device! Updating PCI command %4.4x->%4.4x.\n", - pci_command, new_command); - pcibios_write_config_word(pci_bus, pci_device_fn, - PCI_COMMAND, new_command); } + /* At this point we have found a valid tms380tr PCI TR card. */ - /* At this point we have found a valid PCI TR card. */ + pci_ioaddr &= ~3 ; dev->base_addr = pci_ioaddr; dev->irq = pci_irq_line; dev->dma = 0; @@ -342,10 +319,10 @@ if (outcard) *outcard = card; - return (0); + return 0 ; } - return (-1); + return (-1); } /* @@ -362,85 +339,85 @@ if(err < 0) return (-ENODEV); - if(virt_to_bus((void*)((unsigned long)dev->priv+sizeof(struct net_local))) + if(virt_to_bus((void*)((unsigned long)dev->priv+sizeof(struct net_local))) > ISA_MAX_ADDRESS) - { - printk("%s: Memory not accessible for DMA\n", dev->name); - kfree(dev->priv); - return (-EAGAIN); - } + { + printk("%s: Memory not accessible for DMA\n", dev->name); + kfree(dev->priv); + return (-EAGAIN); + } /* FIXME */ card = &cardinfo[1]; - /* Grab the region so that no one else tries to probe our ioports. */ - request_region(ioaddr, TMS380TR_IO_EXTENT, card->name); - dev->base_addr = ioaddr; - - /* Autoselect IRQ and DMA if dev->irq == 0 */ - if(dev->irq == 0) - { - for(i = 0; tms380tr_irqlist[i] != 0; i++) - { - dev->irq = tms380tr_irqlist[i]; - err = request_irq(dev->irq, &tms380tr_interrupt, 0, card->name, dev); - if(!err) + /* Grab the region so that no one else tries to probe our ioports. */ + request_region(ioaddr, TMS380TR_IO_EXTENT, card->name); + dev->base_addr = ioaddr; + + /* Autoselect IRQ and DMA if dev->irq == 0 */ + if(dev->irq == 0) + { + for(i = 0; tms380tr_irqlist[i] != 0; i++) + { + dev->irq = tms380tr_irqlist[i]; + err = request_irq(dev->irq, &tms380tr_interrupt, 0, card->name, dev); + if(!err) break; - } + } - if(tms380tr_irqlist[i] == 0) - { - printk("%s: AutoSelect no IRQ available\n", dev->name); - return (-EAGAIN); - } - } - else - { - err = request_irq(dev->irq, &tms380tr_interrupt, 0, card->name, dev); + if(tms380tr_irqlist[i] == 0) + { + printk("%s: AutoSelect no IRQ available\n", dev->name); + return (-EAGAIN); + } + } + else + { + err = request_irq(dev->irq, &tms380tr_interrupt, 0, card->name, dev); if(err) - { - printk("%s: Selected IRQ not available\n", dev->name); - return (-EAGAIN); - } - } - - /* Always allocate the DMA channel after IRQ and clean up on failure */ - if(dev->dma == 0) - { - for(i = 0; tms380tr_dmalist[i] != 0; i++) - { + { + printk("%s: Selected IRQ not available\n", dev->name); + return (-EAGAIN); + } + } + + /* Always allocate the DMA channel after IRQ and clean up on failure */ + if(dev->dma == 0) + { + for(i = 0; tms380tr_dmalist[i] != 0; i++) + { dev->dma = tms380tr_dmalist[i]; - err = request_dma(dev->dma, card->name); - if(!err) - break; - } - - if(dev->dma == 0) - { - printk("%s: AutoSelect no DMA available\n", dev->name); - free_irq(dev->irq, NULL); - return (-EAGAIN); - } - } - else - { - err = request_dma(dev->dma, card->name); - if(err) - { - printk("%s: Selected DMA not available\n", dev->name); - free_irq(dev->irq, NULL); - return (-EAGAIN); - } - } + err = request_dma(dev->dma, card->name); + if(!err) + break; + } + + if(dev->dma == 0) + { + printk("%s: AutoSelect no DMA available\n", dev->name); + free_irq(dev->irq, NULL); + return (-EAGAIN); + } + } + else + { + err = request_dma(dev->dma, card->name); + if(err) + { + printk("%s: Selected DMA not available\n", dev->name); + free_irq(dev->irq, NULL); + return (-EAGAIN); + } + } flags=claim_dma_lock(); disable_dma(dev->dma); - set_dma_mode(dev->dma, DMA_MODE_CASCADE); - enable_dma(dev->dma); - release_dma_lock(flags); + set_dma_mode(dev->dma, DMA_MODE_CASCADE); + enable_dma(dev->dma); + release_dma_lock(flags); printk("%s: %s found at %#4x, using IRQ %d and DMA %d.\n", - dev->name, card->name, ioaddr, dev->irq, dev->dma); + dev->name, card->name, ioaddr, dev->irq, dev->dma); if (outcard) *outcard = card; @@ -448,6 +425,10 @@ return (0); } +/* + * Passing an ioaddr of 0 tells us to do a pci card search + */ + static int __init tms380tr_probe1(struct net_device *dev, int ioaddr) { static unsigned version_printed = 0; @@ -463,14 +444,13 @@ if(dev == NULL) return (-ENOMEM); #endif - - err = tms380tr_pci_chk_card(dev, &card); - if(err < 0) - { + if (ioaddr == 0) { + err = tms380tr_pci_chk_card(dev, &card); + } else { err = tms380tr_isa_chk_card(dev, ioaddr, &card); - if(err < 0) - return (-ENODEV); } + if(err < 0) + return (-ENODEV); /* Setup this devices private information structure */ tp = (struct net_local *)kmalloc(sizeof(struct net_local), GFP_KERNEL | GFP_DMA); @@ -481,14 +461,14 @@ tp->CardType = card; dev->priv = tp; - dev->init = tms380tr_init_card; - dev->open = tms380tr_open; - dev->stop = tms380tr_close; - dev->hard_start_xmit = tms380tr_send_packet; - dev->get_stats = tms380tr_get_stats; - dev->set_multicast_list = &tms380tr_set_multicast_list; - - return (0); + dev->init = tms380tr_init_card; + dev->open = tms380tr_open; + dev->stop = tms380tr_close; + dev->do_ioctl = NULL ; + dev->hard_start_xmit = tms380tr_send_packet; + dev->get_stats = tms380tr_get_stats; + dev->set_multicast_list = &tms380tr_set_multicast_list; + return (0); } /* Dummy function */ @@ -568,6 +548,7 @@ printk(KERN_INFO "%s: Adapter RAM size: %dK\n", dev->name, tms380tr_read_ptr(dev)); + tms380tr_enable_interrupts(dev); tms380tr_open_adapter(dev); @@ -664,15 +645,12 @@ if((Tmp & ~CYCLE_TIME) != (PosReg & ~CYCLE_TIME)) printk(KERN_INFO "%s: POSREG error\n", dev->name); } - err = tms380tr_reset_adapter(dev); if(err < 0) return (-1); - err = tms380tr_bringup_diags(dev); if(err < 0) return (-1); - err = tms380tr_init_adapter(dev); if(err < 0) return (-1); @@ -1461,7 +1439,6 @@ static int tms380tr_close(struct net_device *dev) { struct net_local *tp = (struct net_local *)dev->priv; - dev->tbusy = 1; dev->start = 0; @@ -1522,52 +1499,51 @@ static void tms380tr_set_multicast_list(struct net_device *dev) { struct net_local *tp = (struct net_local *)dev->priv; - unsigned int OpenOptions; + unsigned int OpenOptions; - OpenOptions = tp->ocpl.OPENOptions & - ~(PASS_ADAPTER_MAC_FRAMES + OpenOptions = tp->ocpl.OPENOptions & + ~(PASS_ADAPTER_MAC_FRAMES | PASS_ATTENTION_FRAMES | PASS_BEACON_MAC_FRAMES | COPY_ALL_MAC_FRAMES | COPY_ALL_NON_MAC_FRAMES); - tp->ocpl.FunctAddr = 0; + tp->ocpl.FunctAddr = 0; - if(dev->flags & IFF_PROMISC) - /* Enable promiscuous mode */ - OpenOptions |= COPY_ALL_NON_MAC_FRAMES | + if(dev->flags & IFF_PROMISC) + /* Enable promiscuous mode */ + OpenOptions |= COPY_ALL_NON_MAC_FRAMES | COPY_ALL_MAC_FRAMES; - else - { - if(dev->flags & IFF_ALLMULTI) - { - /* Disable promiscuous mode, use normal mode. */ - tp->ocpl.FunctAddr = 0xFFFFFFFF; - - } - else - { - int i; - struct dev_mc_list *mclist = dev->mc_list; - for (i=0; i< dev->mc_count; i++) - { - ((char *)(&tp->ocpl.FunctAddr))[0] |= + else + { + if(dev->flags & IFF_ALLMULTI) + { + /* Disable promiscuous mode, use normal mode. */ + tp->ocpl.FunctAddr = 0xFFFFFFFF; + } + else + { + int i; + struct dev_mc_list *mclist = dev->mc_list; + for (i=0; i< dev->mc_count; i++) + { + ((char *)(&tp->ocpl.FunctAddr))[0] |= mclist->dmi_addr[2]; - ((char *)(&tp->ocpl.FunctAddr))[1] |= + ((char *)(&tp->ocpl.FunctAddr))[1] |= mclist->dmi_addr[3]; - ((char *)(&tp->ocpl.FunctAddr))[2] |= + ((char *)(&tp->ocpl.FunctAddr))[2] |= mclist->dmi_addr[4]; - ((char *)(&tp->ocpl.FunctAddr))[3] |= + ((char *)(&tp->ocpl.FunctAddr))[3] |= mclist->dmi_addr[5]; - mclist = mclist->next; - } - } - tms380tr_exec_cmd(dev, OC_SET_FUNCT_ADDR); - } + mclist = mclist->next; + } + } + tms380tr_exec_cmd(dev, OC_SET_FUNCT_ADDR); + } - tp->ocpl.OPENOptions = OpenOptions; - tms380tr_exec_cmd(dev, OC_MODIFY_OPEN_PARMS); - return; + tp->ocpl.OPENOptions = OpenOptions; + tms380tr_exec_cmd(dev, OC_MODIFY_OPEN_PARMS); + return; } /* @@ -2259,8 +2235,7 @@ ADAPTER_INT_PTRS, 16); tms380tr_read_ram(dev, (unsigned char *)&adapterram, (unsigned short)SWAPB(tp->intptrs.AdapterRAMPtr), 2); - - return SWAPB(adapterram); + return SWAPB(adapterram); } /* @@ -2428,7 +2403,7 @@ } } - tp->MacStat.tx_packets++; + tp->MacStat.tx_packets++; dev_kfree_skb(tpl->Skb); tpl->BusyFlag = 0; /* "free" TPL */ } @@ -2669,16 +2644,16 @@ */ static void tms380tr_dump(unsigned char *Data, int length) { - int i, j; + int i, j; - for (i = 0, j = 0; i < length / 8; i++, j += 8) - { + for (i = 0, j = 0; i < length / 8; i++, j += 8) + { printk(KERN_DEBUG "%02x %02x %02x %02x %02x %02x %02x %02x\n", Data[j+0],Data[j+1],Data[j+2],Data[j+3], - Data[j+4],Data[j+5],Data[j+6],Data[j+7]); - } + Data[j+4],Data[j+5],Data[j+6],Data[j+7]); + } - return; + return; } #endif @@ -2699,40 +2674,41 @@ for(i = 0; i < TMS380TR_MAX_ADAPTERS; i++) { - irq[i] = 0; - mem[i] = 0; - dev_tms380tr[i] = NULL; - dev_tms380tr[i] = init_trdev(dev_tms380tr[i], 0); - if(dev_tms380tr[i] == NULL) - return (-ENOMEM); + irq[i] = 0; + mem[i] = 0; + dev_tms380tr[i] = NULL; + dev_tms380tr[i] = init_trdev(dev_tms380tr[i], 0); + if(dev_tms380tr[i] == NULL) + return (-ENOMEM); dev_tms380tr[i]->base_addr = io[i]; - dev_tms380tr[i]->irq = irq[i]; - dev_tms380tr[i]->mem_start = mem[i]; - dev_tms380tr[i]->init = &tms380tr_probe; - - if(register_trdev(dev_tms380tr[i]) != 0) - { - kfree_s(dev_tms380tr[i], sizeof(struct net_device)); - dev_tms380tr[i] = NULL; - if(i == 0) - { - printk("tms380tr: register_trdev() returned non-zero.\n"); - return (-EIO); - } + dev_tms380tr[i]->irq = irq[i]; + dev_tms380tr[i]->mem_start = mem[i]; + dev_tms380tr[i]->init = &tms380tr_probe; + + if(register_trdev(dev_tms380tr[i]) != 0) + { + kfree_s(dev_tms380tr[i], sizeof(struct net_device)); + dev_tms380tr[i] = NULL; + if(i == 0) + { + printk("tms380tr: register_trdev() returned non-zero.\n"); + return (-EIO); + } else - return (0); - } - } + return (0); + } - return (0); + } + + return (0); } void cleanup_module(void) { int i; - for(i = 0; i < TMS380TR_MAX_ADAPTERS; i++) + for(i = 0; i < TMS380TR_MAX_ADAPTERS; i++) { if(dev_tms380tr[i]) { @@ -2746,7 +2722,7 @@ kfree_s(dev_tms380tr[i]->priv, sizeof(struct net_local)); kfree_s(dev_tms380tr[i], sizeof(struct net_device)); dev_tms380tr[i] = NULL; - } + } } } #endif /* MODULE */ diff -u --recursive --new-file v2.3.28/linux/drivers/net/tulip.c linux/drivers/net/tulip.c --- v2.3.28/linux/drivers/net/tulip.c Thu Nov 11 20:11:42 1999 +++ linux/drivers/net/tulip.c Tue Nov 23 10:29:15 1999 @@ -89,21 +89,12 @@ This is only in the support-all-kernels source code. */ #include /* Evil, but neccessary */ -#if defined (LINUX_VERSION_CODE) && LINUX_VERSION_CODE < 0x10300 -#define RUN_AT(x) (x) /* What to put in timer->expires. */ -#define DEV_ALLOC_SKB(len) alloc_skb(len, GFP_ATOMIC) -#define virt_to_bus(addr) ((unsigned long)addr) -#define bus_to_virt(addr) ((void*)addr) - -#else /* 1.3.0 and later */ #define RUN_AT(x) (jiffies + (x)) #define DEV_ALLOC_SKB(len) dev_alloc_skb(len + 2) -#endif -#if (LINUX_VERSION_CODE >= 0x10344) #define NEW_MULTICAST #include -#endif + #ifdef SA_SHIRQ #define IRQ(irq, dev_id, pt_regs) (irq, dev_id, pt_regs) #else @@ -2076,11 +2067,7 @@ if (skb == NULL) break; /* Bad news! */ skb->dev = dev; /* Mark as being used by this device. */ -#if LINUX_VERSION_CODE > 0x10300 tp->rx_ring[i].buffer1 = virt_to_bus(skb->tail); -#else - tp->rx_ring[i].buffer1 = virt_to_bus(skb->data); -#endif } tp->rx_ring[i].buffer2 = virt_to_bus(&tp->rx_ring[i+1]); } @@ -2381,9 +2368,7 @@ && (skb = DEV_ALLOC_SKB(pkt_len+2)) != NULL) { skb->dev = dev; skb_reserve(skb, 2); /* 16 byte align the IP header */ -#if LINUX_VERSION_CODE < 0x10300 - memcpy(skb->data, tp->rx_ring[entry].buffer1, pkt_len); -#elif LINUX_VERSION_CODE < 0x20200 || defined(__alpha__) +#if LINUX_VERSION_CODE < 0x20200 || defined(__alpha__) memcpy(skb_put(skb, pkt_len), bus_to_virt(tp->rx_ring[entry].buffer1), pkt_len); #else @@ -2409,11 +2394,7 @@ skb_put(skb, pkt_len); #endif } -#if LINUX_VERSION_CODE > 0x10300 skb->protocol = eth_type_trans(skb, dev); -#else - skb->len = pkt_len; -#endif netif_rx(skb); dev->last_rx = jiffies; tp->stats.rx_packets++; @@ -2433,11 +2414,7 @@ if (skb == NULL) break; skb->dev = dev; /* Mark as being used by this device. */ -#if LINUX_VERSION_CODE > 0x10300 tp->rx_ring[entry].buffer1 = virt_to_bus(skb->tail); -#else - tp->rx_ring[entry].buffer1 = virt_to_bus(skb->data); -#endif work_done++; } tp->rx_ring[entry].status = 0x80000000; diff -u --recursive --new-file v2.3.28/linux/drivers/nubus/proc.c linux/drivers/nubus/proc.c --- v2.3.28/linux/drivers/nubus/proc.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/nubus/proc.c Fri Nov 19 11:33:29 1999 @@ -26,8 +26,8 @@ #include #include -int -get_nubus_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int +get_nubus_dev_info(char *buf, char **start, off_t pos, int count) { struct nubus_dev *dev = nubus_devices; off_t at = 0; diff -u --recursive --new-file v2.3.28/linux/drivers/parport/Config.in linux/drivers/parport/Config.in --- v2.3.28/linux/drivers/parport/Config.in Sun Nov 7 16:37:34 1999 +++ linux/drivers/parport/Config.in Sat Nov 20 10:11:27 1999 @@ -35,7 +35,7 @@ else define_tristate CONFIG_PARPORT_ATARI n fi - if [ "$CONFIG_SBUS" = "y" ]; then + if [ "$CONFIG_SBUS" = "y" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then dep_tristate ' Sparc hardware (EXPERIMENTAL)' CONFIG_PARPORT_SUNBPP $CONFIG_PARPORT else define_tristate CONFIG_PARPORT_SUNBPP n diff -u --recursive --new-file v2.3.28/linux/drivers/parport/ieee1284_ops.c linux/drivers/parport/ieee1284_ops.c --- v2.3.28/linux/drivers/parport/ieee1284_ops.c Thu Nov 11 20:11:42 1999 +++ linux/drivers/parport/ieee1284_ops.c Mon Nov 22 11:02:36 1999 @@ -95,7 +95,7 @@ our interrupt handler called. */ if (count && no_irq) { parport_release (dev); - set_current_state (TASK_INTERRUPTIBLE); + __set_current_state (TASK_INTERRUPTIBLE); schedule_timeout (wait); parport_claim_or_block (dev); } @@ -525,7 +525,7 @@ /* Yield the port for a while. */ if (count && dev->port->irq != PARPORT_IRQ_NONE) { parport_release (dev); - set_current_state (TASK_INTERRUPTIBLE); + __set_current_state (TASK_INTERRUPTIBLE); schedule_timeout ((HZ + 24) / 25); parport_claim_or_block (dev); } diff -u --recursive --new-file v2.3.28/linux/drivers/pci/pci.c linux/drivers/pci/pci.c --- v2.3.28/linux/drivers/pci/pci.c Fri Oct 22 13:21:49 1999 +++ linux/drivers/pci/pci.c Tue Nov 23 10:10:38 1999 @@ -437,6 +437,7 @@ dev = dev_cache; memset(dev, 0, sizeof(*dev)); dev->bus = bus; + dev->sysdata = bus->sysdata; dev->devfn = devfn; if (pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type)) @@ -556,6 +557,7 @@ child->self = dev; child->parent = bus; child->ops = bus->ops; + child->sysdata = bus->sysdata; /* * Set up the primary, secondary and subordinate diff -u --recursive --new-file v2.3.28/linux/drivers/pci/pci.ids linux/drivers/pci/pci.ids --- v2.3.28/linux/drivers/pci/pci.ids Thu Nov 18 20:25:37 1999 +++ linux/drivers/pci/pci.ids Tue Nov 23 10:15:42 1999 @@ -1563,7 +1563,13 @@ 1148 5843 FDDI SK-5843 (SK-NET FDDI-LP64) 1148 5844 FDDI SK-5844 (SK-NET FDDI-LP64 DAS) 4200 Token ring adaptor - 4300 GE + 4300 Gigabit Ethernet + 1148 9821 SK-9821 (1000Base-T single link) + 1148 9822 SK-9822 (1000Base-T dual link) + 1148 9841 SK-9841 (1000Base-LX single link) + 1148 9842 SK-9842 (1000Base-LX dual link) + 1148 9843 SK-9843 (1000Base-SX single link) + 1148 9844 SK-9844 (1000Base-SX dual link) 1149 Win System Corporation 114a VMIC 7587 VMIVME-7587 diff -u --recursive --new-file v2.3.28/linux/drivers/pci/proc.c linux/drivers/pci/proc.c --- v2.3.28/linux/drivers/pci/proc.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/pci/proc.c Fri Nov 19 11:33:29 1999 @@ -234,8 +234,8 @@ #define LONG_FORMAT "\t%16lx" #endif -int -get_pci_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int +get_pci_dev_info(char *buf, char **start, off_t pos, int count) { struct pci_dev *dev = pci_devices; off_t at = 0; diff -u --recursive --new-file v2.3.28/linux/drivers/pci/setup.c linux/drivers/pci/setup.c --- v2.3.28/linux/drivers/pci/setup.c Fri Oct 22 13:21:49 1999 +++ linux/drivers/pci/setup.c Tue Nov 23 10:10:38 1999 @@ -9,6 +9,8 @@ * Support routines for initializing a PCI subsystem. */ +/* fixed for multiple pci buses, 1999 Andrea Arcangeli */ + #include #include #include @@ -33,15 +35,8 @@ int err; err = -EINVAL; - if (root != NULL) { - /* If `dev' is on a secondary pci bus, `root' may not be - at the origin. In that case, adjust the resource into - range. */ - res->start += root->start; - res->end += root->start; - + if (root != NULL) err = request_resource(root, res); - } if (err) { printk(KERN_ERR "PCI: Address space collision on region %d " "of device %s\n", resource, dev->name); @@ -89,7 +84,7 @@ DBGC((" for root[%lx:%lx] min[%lx] size[%lx]\n", root->start, root->end, min, size)); - if (allocate_resource(root, res, size, min, -1, size) < 0) { + if (allocate_resource(root, res, size, min, -1, size, dev) < 0) { printk(KERN_ERR "PCI: Failed to allocate resource %d for %s\n", i, dev->name); @@ -148,13 +143,6 @@ pdev_assign_unassigned_resources(dev, min_io, min_mem); } -struct pbus_set_ranges_data -{ - int found_vga; - unsigned int io_start, io_end; - unsigned int mem_start, mem_end; -}; - #define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) #define ROUND_DOWN(x, a) ((x) & ~((a) - 1)) @@ -166,7 +154,7 @@ struct pci_dev *dev; inner.found_vga = 0; - inner.mem_start = inner.io_start = ~0; + inner.mem_start = inner.io_start = ~0UL; inner.mem_end = inner.io_end = 0; /* Collect information about how our direct children are layed out. */ @@ -200,6 +188,8 @@ inner.mem_start = ROUND_DOWN(inner.mem_start, 1*1024*1024); inner.mem_end = ROUND_UP(inner.mem_end, 1*1024*1024); + + pcibios_fixup_pbus_ranges(bus, &inner); /* Configure the bridge, if possible. */ if (bus->self) { diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/53c7,8xx.c linux/drivers/scsi/53c7,8xx.c --- v2.3.28/linux/drivers/scsi/53c7,8xx.c Thu Nov 11 20:11:43 1999 +++ linux/drivers/scsi/53c7,8xx.c Tue Nov 23 10:29:15 1999 @@ -213,24 +213,7 @@ * without warnings. */ -#if !defined(LINUX_1_2) && !defined(LINUX_1_3) #include -#if LINUX_VERSION_CODE > 65536 + 3 * 256 -#define LINUX_1_3 -#else -#define LINUX_1_2 -#endif -#endif - -#ifdef LINUX_1_2 -#define u32 bogus_u32 -#define s32 bogus_s32 -#include -#undef u32 -#undef s32 -typedef __signed__ int s32; -typedef unsigned int u32; -#endif /* def LINUX_1_2 */ #ifdef MODULE #include @@ -716,13 +699,11 @@ printk (KERN_ALERT "target %d is host ID\n", target); return -1; } -#ifndef LINUX_1_2 else if (target > h->max_id) { printk (KERN_ALERT "target %d exceeds maximum of %d\n", target, h->max_id); return -1; } -#endif hostdata = (struct NCR53c7x0_hostdata *)h->hostdata; save_flags(flags); @@ -1312,7 +1293,7 @@ */ if (base) { - instance->base = (unsigned char *) (unsigned long) base; + instance->base = (unsigned long) base; /* Check for forced I/O mapping */ if (!(options & OPTION_IO_MAPPED)) { options |= OPTION_MEMORY_MAPPED; @@ -1408,12 +1389,7 @@ ncr_pci_init (Scsi_Host_Template *tpnt, int board, int chip, unsigned char bus, unsigned char device_fn, long long options){ unsigned short command; -#ifdef LINUX_1_2 - unsigned long -#else - unsigned int -#endif - base, io_port; + unsigned int base, io_port; unsigned char revision; int error, expected_chip; int expected_id = -1, max_revision = -1, min_revision = -1; @@ -1689,7 +1665,7 @@ memory_to_ncr = tmp|DMODE_800_DIOM; ncr_to_memory = tmp|DMODE_800_SIOM; } else { - base = virt_to_bus(host->base); + base = virt_to_bus((void *)host->base); memory_to_ncr = ncr_to_memory = tmp; } @@ -3480,11 +3456,7 @@ * 1.2.x), do so now. */ if (!(hostdata->cmd_allocated[cmd->target] & (1 << cmd->lun)) && -#ifdef LINUX_1_2 - !in_scan_scsis -#else cmd->device && cmd->device->has_cmdblocks -#endif ) { if ((hostdata->extra_allocate + hostdata->num_cmds) < host->can_queue) hostdata->extra_allocate += host->cmd_per_lun; @@ -3507,11 +3479,7 @@ tmp = ROUNDUP(real, void *); tmp->real = real; tmp->size = size; -#ifdef LINUX_1_2 - tmp->free = ((void (*)(void *, int)) kfree_s); -#else tmp->free = ((void (*)(void *, int)) kfree); -#endif save_flags (flags); cli(); tmp->next = hostdata->free; @@ -3931,11 +3899,7 @@ if ((hostdata->options & (OPTION_DEBUG_INIT_ONLY|OPTION_DEBUG_PROBE_ONLY)) || ((hostdata->options & OPTION_DEBUG_TARGET_LIMIT) && !(hostdata->debug_lun_limit[cmd->target] & (1 << cmd->lun))) -#ifdef LINUX_1_2 - || cmd->target > 7 -#else || cmd->target > host->max_id -#endif || cmd->target == host->this_id || hostdata->state == STATE_DISABLED) { printk("scsi%d : disabled or bad target %d lun %d\n", host->host_no, diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/53c7,8xx.h linux/drivers/scsi/53c7,8xx.h --- v2.3.28/linux/drivers/scsi/53c7,8xx.h Wed Aug 18 16:44:21 1999 +++ linux/drivers/scsi/53c7,8xx.h Tue Nov 23 12:57:31 1999 @@ -38,14 +38,7 @@ #ifndef NCR53c7x0_H #define NCR53c7x0_H -#if !defined(LINUX_1_2) && !defined(LINUX_1_3) #include -#if LINUX_VERSION_CODE > 65536 + 3 * 256 -#define LINUX_1_3 -#else -#define LINUX_1_2 -#endif -#endif /* * Prevent name space pollution in hosts.c, and only provide the diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/53c7xx.h linux/drivers/scsi/53c7xx.h --- v2.3.28/linux/drivers/scsi/53c7xx.h Thu Jul 30 11:17:10 1998 +++ linux/drivers/scsi/53c7xx.h Tue Nov 23 10:29:15 1999 @@ -51,14 +51,7 @@ #ifndef NCR53c710_H #define NCR53c710_H -#if !defined(LINUX_1_2) && !defined(LINUX_1_3) #include -#if LINUX_VERSION_CODE > 65536 + 3 * 256 -#define LINUX_1_3 -#else -#define LINUX_1_2 -#endif -#endif /* * Prevent name space pollution in hosts.c, and only provide the @@ -79,14 +72,6 @@ #define NCR53c7xx_release NULL #endif -#ifdef LINUX_1_2 -#define NCR53c7xx {NULL, NULL, "NCR53c{7,8}xx (rel 17)", NCR53c7xx_detect,\ - NULL, /* info */ NULL, /* command, deprecated */ NULL, \ - NCR53c7xx_queue_command, NCR53c7xx_abort, NCR53c7xx_reset, \ - NULL /* slave attach */, scsicam_bios_param, /* can queue */ 24, \ - /* id */ 7, 127 /* old SG_ALL */, /* cmd per lun */ 3, \ - /* present */ 0, /* unchecked isa dma */ 0, DISABLE_CLUSTERING} -#else #define NCR53c7xx {NULL, NULL, NULL, NULL, \ "NCR53c{7,8}xx (rel 17)", NCR53c7xx_detect,\ NULL, /* info */ NULL, /* command, deprecated */ NULL, \ @@ -94,51 +79,10 @@ NULL /* slave attach */, scsicam_bios_param, /* can queue */ 24, \ /* id */ 7, 127 /* old SG_ALL */, /* cmd per lun */ 3, \ /* present */ 0, /* unchecked isa dma */ 0, DISABLE_CLUSTERING} -#endif #endif /* defined(HOSTS_C) || defined(MODULE) */ #ifndef HOSTS_C -#ifdef LINUX_1_2 -/* - * Change virtual addresses to physical addresses and vv. - * These are trivial on the 1:1 Linux/i386 mapping (but if we ever - * make the kernel segment mapped at 0, we need to do translation - * on the i386 as well) - */ -extern inline unsigned long virt_to_phys(volatile void * address) -{ - return (unsigned long) address; -} - -extern inline void * phys_to_virt(unsigned long address) -{ - return (void *) address; -} - -/* - * IO bus memory addresses are also 1:1 with the physical address - */ -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt - -/* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the x86 architecture, we just read/write the - * memory location directly. - */ -#define readb(addr) (*(volatile unsigned char *) (addr)) -#define readw(addr) (*(volatile unsigned short *) (addr)) -#define readl(addr) (*(volatile unsigned int *) (addr)) - -#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b)) -#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b)) -#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) - -#define mb() - -#endif /* def LINUX_1_2 */ /* SCSI control 0 rw, default = 0xc0 */ #define SCNTL0_REG 0x00 diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/AM53C974.c linux/drivers/scsi/AM53C974.c --- v2.3.28/linux/drivers/scsi/AM53C974.c Thu Nov 11 20:11:43 1999 +++ linux/drivers/scsi/AM53C974.c Fri Nov 19 11:30:54 1999 @@ -695,7 +695,7 @@ instance = scsi_register(tpnt, sizeof(struct AM53C974_hostdata)); hostdata = (struct AM53C974_hostdata *) instance->hostdata; - instance->base = NULL; + instance->base = 0; instance->io_port = pdev->resource[0].start; instance->irq = pdev->irq; instance->dma_channel = -1; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/BusLogic.h linux/drivers/scsi/BusLogic.h --- v2.3.28/linux/drivers/scsi/BusLogic.h Thu Nov 11 20:11:43 1999 +++ linux/drivers/scsi/BusLogic.h Tue Nov 23 12:57:30 1999 @@ -35,7 +35,6 @@ */ typedef kdev_t KernelDevice_T; -typedef struct proc_dir_entry PROC_DirectoryEntry_T; typedef unsigned long ProcessorFlags_T; typedef struct pt_regs Registers_T; typedef struct partition PartitionTable_T; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/NCR53C9x.c linux/drivers/scsi/NCR53C9x.c --- v2.3.28/linux/drivers/scsi/NCR53C9x.c Thu Nov 11 20:11:43 1999 +++ linux/drivers/scsi/NCR53C9x.c Fri Nov 19 11:30:54 1999 @@ -668,7 +668,7 @@ ccf, (int) esp->neg_defp); /* Fill in ehost data */ - esp->ehost->base = (unsigned char *) eregs; + esp->ehost->base = (unsigned long)eregs; esp->ehost->this_id = esp->scsi_id; esp->ehost->irq = esp->irq; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/advansys.c linux/drivers/scsi/advansys.c --- v2.3.28/linux/drivers/scsi/advansys.c Thu Nov 11 20:11:43 1999 +++ linux/drivers/scsi/advansys.c Sun Nov 21 11:13:57 1999 @@ -1,5 +1,5 @@ -/* $Id: advansys.c,v 1.59 1999/09/08 18:50:51 bobf Exp bobf $ */ -#define ASC_VERSION "3.2G" /* AdvanSys Driver Version */ +/* $Id: advansys.c,v 1.67 1999/11/18 20:13:15 bobf Exp bobf $ */ +#define ASC_VERSION "3.2K" /* AdvanSys Driver Version */ /* * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters @@ -19,7 +19,7 @@ * ftp://ftp.advansys.com/pub/linux/linux.tgz * * Please send questions, comments, bug reports to: - * bobf@advansys.com (Bob Frey) + * linux@advansys.com */ /* @@ -42,13 +42,13 @@ A. Linux Kernel Testing This driver has been tested in the following Linux kernels: v1.2.13, - v1.3.57, v2.0.38, v2.2.12, and v2.3.16. These kernel versions are major + v1.3.57, v2.0.38, v2.2.13, and v2.3.28. These kernel versions are major releases of Linux or the latest Linux kernel versions available when this version of the driver was released. The driver should also work in earlier versions of the Linux kernel. Beginning with v1.3.58 the AdvanSys driver is included with all Linux kernels. Please refer to sections C, D, and E for instructions on adding or upgrading the - AdvanSys driver. + AdvanSys driver. The driver is supported for x86 and alpha systems. B. Adapters Supported by this Driver @@ -103,6 +103,7 @@ ABP980 - Four Channel Bus-Master PCI (240 CDB Per Channel) ABP980U - Four Channel Bus-Master PCI Ultra (240 CDB Per Channel) ABP980UA/3980UA - Four Channel Bus-Master PCI Ultra (16 CDB Per Chan.) + ABP3950U2W - Bus-Master PCI LVD/Ultra2-Wide and Ultra-Wide (253 CDB) C. Linux v1.2.X - Directions for Adding the AdvanSys Driver @@ -639,6 +640,34 @@ 1. Fix PCI board detection in v2.3.13 and greater kernels. 2. Fix comiple errors in v2.3.X with debugging enabled. + 3.2H (9/13/99): + 1. Add 64-bit address, long support for Alpha and UltraSPARC. + The driver has been verified to work on an Alpha system. + 2. Add partial byte order handling support for Power PC and + other big-endian platforms. This support has not yet been + completed or verified. + 3. For wide boards replace block zeroing of request and + scatter-gather structures with individual field initialization + to improve performance. + 4. Correct and clarify ROM BIOS version detection. + + 3.2I (10/8/99): + 1. Update to Adv Library 5.4. + 2. Add v2.3.19 underrun reporting to asc_isr_callback() and + adv_isr_callback(). Remove DID_UNDERRUN constant and other + no longer needed code that previously documented the lack + of underrun handling. + + 3.2J (10/14/99): + 1. Eliminate compile errors for v2.0 and earlier kernels. + + 3.2K (11/15/99): + 1. Correct debug compile error in asc_prt_adv_scsi_req_q(). + 2. Update Adv Library to 5.5. + 3. Add ifdef handling for /proc changes added in v2.3.28. + 4. Increase Wide board scatter-gather list maximum length to + 255 when the driver is compiled into the kernel. + J. Known Problems/Fix List (XXX) 1. Need to add memory mapping workaround. Test the memory mapping. @@ -653,7 +682,6 @@ 6. Need to fix sti/cli code in Asc Library. 7. Need to fix abort code in Adv Library. 8. Reduce io_request_lock hold time. - 9. Add big-endian support for Alpha. K. Credits @@ -677,6 +705,9 @@ Doug Gilbert has made changes and suggestions to improve the driver and done testing. + Ken Mort reported a DEBUG compile bug fixed + in 3.2K. + L. AdvanSys Contact Information Mail: Advanced System Products, Inc. @@ -740,8 +771,10 @@ #include #include #endif /* version >= v1.3.0 */ -#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,1,95) +#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,3,18) #include +#elif LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,1,95) +#include #endif /* version >= 2.1.95 */ #include "scsi.h" #include "hosts.h" @@ -760,12 +793,12 @@ #define ASC_CONFIG_PCI #endif /* version < v2.1.93 */ -/* - * If Linux eventually defines a DID_UNDERRUN, the constant here can be - * removed. The current value of zero for DID_UNDERRUN results in underrun - * conditions being ignored. - */ -#define DID_UNDERRUN 0 +#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,1,0) +#define cpu_to_le16(word) (word) +#define le16_to_cpu(word) (word) +#define cpu_to_le32(dword) (dword) +#define le32_to_cpu(dword) (dword) +#endif /* version < v2.1.0 */ /* @@ -808,6 +841,31 @@ #define ASC_LIB_VERSION_MINOR 24 #define ASC_LIB_SERIAL_NUMBER 121 +/* + * Portable Data Types + * + * Any instance where a 32-bit long or pointer type is assumed + * for precision or HW defined structures, the following define + * types must be used. In Linux the char, short, and int types + * are all consistent at 8, 16, and 32 bits respectively. Pointers + * and long types are 64 bits on Alpha and UltraSPARC. + */ +#define ASC_PADDR __u32 /* Physical/Bus address data type. */ +#define ASC_VADDR __u32 /* Virtual address data type. */ +#define ASC_DCNT __u32 /* Unsigned Data count type. */ +#define ASC_SDCNT __s32 /* Signed Data count type. */ + +/* + * These macros are used to convert a virtual address to a + * 32-bit value. This currently can be used on Linux Alpha + * which uses 64-bit virtual address but a 32-bit bus address. + * This is likely to break in the future, but doing this now + * will give us time to change the HW and FW to handle 64-bit + * addresses. + */ +#define ASC_VADDR_TO_U32 virt_to_bus +#define ASC_U32_TO_VADDR bus_to_virt + typedef unsigned char uchar; #ifndef NULL @@ -819,55 +877,11 @@ #ifndef FALSE #define FALSE (0) #endif -#define REG register -#define rchar REG __s8 -#define rshort REG __s16 -#define rint REG __s32 -#define rlong REG __s32 -#define ruchar REG __u8 -#define rushort REG __u16 -#define ruint REG __u32 -#define rulong REG __u32 -#define NULLPTR (void *)0 -#define FNULLPTR (void *)0UL + #define EOF (-1) -#define EOS '\0' #define ERR (-1) -#define UB_ERR (uchar)(0xFF) #define UW_ERR (uint)(0xFFFF) -#define UL_ERR (ulong)(0xFFFFFFFFUL) -#define iseven_word(val) ((((uint)val) & (uint)0x0001) == 0) #define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0) -#define toeven_word(val) (((uint)val) & (uint)0xFFFE) -#define biton(val, bits) (((uint)(val >> bits) & (uint)0x0001) != 0) -#define bitoff(val, bits) (((uint)(val >> bits) & (uint)0x0001) == 0) -#define lbiton(val, bits) (((ulong)(val >> bits) & (ulong)0x00000001UL) != 0) -#define lbitoff(val, bits) (((ulong)(val >> bits) & (ulong)0x00000001UL) == 0) -#define absh(val) ((val) < 0 ? -(val) : (val)) -#define swapbyte(ch) ((((ch) << 4) | ((ch) >> 4))) -#ifndef GBYTE -#define GBYTE (0x40000000UL) -#endif -#ifndef MBYTE -#define MBYTE (0x100000UL) -#endif -#ifndef KBYTE -#define KBYTE (0x400) -#endif -#define HI_BYTE(x) (*((__u8 *)(&x)+1)) -#define LO_BYTE(x) (*((__u8 *)&x)) -#define HI_WORD(x) (*((__u16 *)(&x)+1)) -#define LO_WORD(x) (*((__u16 *)&x)) -#ifndef MAKEWORD -#define MAKEWORD(lo, hi) ((__u16) (((__u16) lo) | ((__u16) hi << 8))) -#endif -#ifndef MAKELONG -#define MAKELONG(lo, hi) ((__u32) (((__u32) lo) | ((__u32) hi << 16))) -#endif -#define SwapWords(dWord) ((__u32) ((dWord >> 16) | (dWord << 16))) -#define SwapBytes(word) ((__u16) ((word >> 8) | (word << 8))) -#define BigToLittle(dWord) ((__u32) (SwapWords(MAKELONG(SwapBytes(LO_WORD(dWord)), SwapBytes(HI_WORD(dWord)))))) -#define LittleToBig(dWord) BigToLittle(dWord) #define AscPCIConfigVendorIDRegister 0x0000 #define AscPCIConfigDeviceIDRegister 0x0002 #define AscPCIConfigCommandRegister 0x0004 @@ -902,25 +916,17 @@ #define ASC_SRB2SCSIQ(srb_ptr) (srb_ptr) #define PortAddr unsigned short /* port address size */ -#define Ptr2Func ulong #define inp(port) inb(port) #define inpw(port) inw(port) #define inpl(port) inl(port) #define outp(port, byte) outb((byte), (port)) #define outpw(port, word) outw((word), (port)) -#define outpl(port, long) outl((long), (port)) +#define outpl(port, dword) outl((dword), (port)) #define ASC_MAX_SG_QUEUE 7 -#define ASC_MAX_SG_LIST SG_ALL +#define ASC_MAX_SG_LIST 255 #define ASC_CS_TYPE unsigned short -#ifndef asc_ptr_type -#define asc_ptr_type -#endif -#ifndef ASC_GET_PTR2FUNC -#define ASC_GET_PTR2FUNC(fun) (Ptr2Func)(fun) -#endif -#define FLIP_BYTE_NIBBLE(x) (((x<<4)& 0xFF) | (x>>4)) #define ASC_IS_ISA (0x0001) #define ASC_IS_ISAPNP (0x0081) #define ASC_IS_EISA (0x0002) @@ -971,34 +977,10 @@ #define ASC_SCSI_ID_BITS 3 #define ASC_SCSI_TIX_TYPE uchar #define ASC_ALL_DEVICE_BIT_SET 0xFF -#ifdef ASC_WIDESCSI_16 -#undef ASC_SCSI_ID_BITS -#define ASC_SCSI_ID_BITS 4 -#define ASC_ALL_DEVICE_BIT_SET 0xFFFF -#endif -#ifdef ASC_WIDESCSI_32 -#undef ASC_SCSI_ID_BITS -#define ASC_SCSI_ID_BITS 5 -#define ASC_ALL_DEVICE_BIT_SET 0xFFFFFFFFL -#endif -#if ASC_SCSI_ID_BITS == 3 #define ASC_SCSI_BIT_ID_TYPE uchar #define ASC_MAX_TID 7 #define ASC_MAX_LUN 7 #define ASC_SCSI_WIDTH_BIT_SET 0xFF -#elif ASC_SCSI_ID_BITS == 4 -#define ASC_SCSI_BIT_ID_TYPE ushort -#define ASC_MAX_TID 15 -#define ASC_MAX_LUN 7 -#define ASC_SCSI_WIDTH_BIT_SET 0xFFFF -#elif ASC_SCSI_ID_BITS == 5 -#define ASC_SCSI_BIT_ID_TYPE ulong -#define ASC_MAX_TID 31 -#define ASC_MAX_LUN 7 -#define ASC_SCSI_WIDTH_BIT_SET 0xFFFFFFFF -#else -#error ASC_SCSI_ID_BITS definition is wrong -#endif #define ASC_MAX_SENSE_LEN 32 #define ASC_MIN_SENSE_LEN 14 #define ASC_MAX_CDB_LEN 12 @@ -1302,15 +1284,15 @@ uchar sg_queue_cnt; uchar target_id; uchar target_lun; - ulong data_addr; - ulong data_cnt; - ulong sense_addr; + ASC_PADDR data_addr; + ASC_DCNT data_cnt; + ASC_PADDR sense_addr; uchar sense_len; uchar extra_bytes; } ASC_SCSIQ_1; typedef struct asc_scisq_2 { - ulong srb_ptr; + ASC_VADDR srb_ptr; uchar target_ix; uchar flag; uchar cdb_len; @@ -1333,8 +1315,8 @@ uchar y_res; ushort x_req_count; ushort x_reconnect_rtn; - ulong x_saved_data_addr; - ulong x_saved_data_cnt; + ASC_PADDR x_saved_data_addr; + ASC_DCNT x_saved_data_cnt; } ASC_SCSIQ_4; typedef struct asc_q_done_info { @@ -1346,12 +1328,12 @@ uchar sense_len; uchar extra_bytes; uchar res; - ulong remain_bytes; + ASC_DCNT remain_bytes; } ASC_QDONE_INFO; typedef struct asc_sg_list { - ulong addr; - ulong bytes; + ASC_PADDR addr; + ASC_DCNT bytes; } ASC_SG_LIST; typedef struct asc_sg_head { @@ -1625,14 +1607,19 @@ #define ASC_MIN_TAGGED_CMD 7 #define ASC_MAX_SCSI_RESET_WAIT 30 +struct asc_dvc_var; /* Forward Declaration. */ + +typedef void (* ASC_ISR_CALLBACK)(struct asc_dvc_var *, ASC_QDONE_INFO *); +typedef int (* ASC_EXE_CALLBACK)(struct asc_dvc_var *, ASC_SCSI_Q *); + typedef struct asc_dvc_var { PortAddr iop_base; ushort err_code; ushort dvc_cntl; ushort bug_fix_cntl; ushort bus_type; - Ptr2Func isr_callback; - Ptr2Func exe_callback; + ASC_ISR_CALLBACK isr_callback; + ASC_EXE_CALLBACK exe_callback; ASC_SCSI_BIT_ID_TYPE init_sdtr; ASC_SCSI_BIT_ID_TYPE sdtr_done; ASC_SCSI_BIT_ID_TYPE use_tagged_qng; @@ -1654,32 +1641,26 @@ ASC_SCSI_Q *scsiq_busy_tail[ASC_MAX_TID + 1]; uchar sdtr_period_tbl[ASC_MAX_SYN_XFER_NO]; ASC_DVC_CFG *cfg; - Ptr2Func saved_ptr2func; ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer_always; char redo_scam; ushort res2; uchar dos_int13_table[ASC_MAX_TID + 1]; - ulong max_dma_count; + ASC_DCNT max_dma_count; ASC_SCSI_BIT_ID_TYPE no_scam; ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer; uchar max_sdtr_index; uchar host_init_sdtr_index; - ulong drv_ptr; - ulong uc_break; - ulong res7; - ulong res8; + struct asc_board *drv_ptr; + ASC_DCNT uc_break; } ASC_DVC_VAR; -typedef int (* ASC_ISR_CALLBACK) (ASC_DVC_VAR asc_ptr_type *, ASC_QDONE_INFO *); -typedef int (* ASC_EXE_CALLBACK) (ASC_DVC_VAR asc_ptr_type *, ASC_SCSI_Q *); - typedef struct asc_dvc_inq_info { uchar type[ASC_MAX_TID + 1][ASC_MAX_LUN + 1]; } ASC_DVC_INQ_INFO; typedef struct asc_cap_info { - ulong lba; - ulong blk_size; + ASC_DCNT lba; + ASC_DCNT blk_size; } ASC_CAP_INFO; typedef struct asc_cap_info_array { @@ -2037,29 +2018,29 @@ STATIC uchar AscGetIsaDmaSpeed(PortAddr); STATIC uchar AscReadLramByte(PortAddr, ushort); STATIC ushort AscReadLramWord(PortAddr, ushort); -STATIC ulong AscReadLramDWord(PortAddr, ushort); +STATIC ASC_DCNT AscReadLramDWord(PortAddr, ushort); STATIC void AscWriteLramWord(PortAddr, ushort, ushort); -STATIC void AscWriteLramDWord(PortAddr, ushort, ulong); +STATIC void AscWriteLramDWord(PortAddr, ushort, ASC_DCNT); STATIC void AscWriteLramByte(PortAddr, ushort, uchar); -STATIC ulong AscMemSumLramWord(PortAddr, ushort, rint); -STATIC void AscMemWordSetLram(PortAddr, ushort, ushort, rint); +STATIC ASC_DCNT AscMemSumLramWord(PortAddr, ushort, int); +STATIC void AscMemWordSetLram(PortAddr, ushort, ushort, int); STATIC void AscMemWordCopyToLram(PortAddr, ushort, ushort *, int); -STATIC void AscMemDWordCopyToLram(PortAddr, ushort, ulong *, int); +STATIC void AscMemDWordCopyToLram(PortAddr, ushort, ASC_DCNT *, int); STATIC void AscMemWordCopyFromLram(PortAddr, ushort, ushort *, int); -STATIC ushort AscInitAscDvcVar(ASC_DVC_VAR asc_ptr_type *); -STATIC ushort AscInitFromEEP(ASC_DVC_VAR asc_ptr_type *); -STATIC ushort AscInitFromAscDvcVar(ASC_DVC_VAR asc_ptr_type *); -STATIC ushort AscInitMicroCodeVar(ASC_DVC_VAR asc_ptr_type * asc_dvc); -STATIC int AscTestExternalLram(ASC_DVC_VAR asc_ptr_type *); -STATIC uchar AscMsgOutSDTR(ASC_DVC_VAR asc_ptr_type *, uchar, uchar); -STATIC uchar AscCalSDTRData(ASC_DVC_VAR asc_ptr_type *, uchar, uchar); +STATIC ushort AscInitAscDvcVar(ASC_DVC_VAR *); +STATIC ushort AscInitFromEEP(ASC_DVC_VAR *); +STATIC ushort AscInitFromAscDvcVar(ASC_DVC_VAR *); +STATIC ushort AscInitMicroCodeVar(ASC_DVC_VAR *); +STATIC int AscTestExternalLram(ASC_DVC_VAR *); +STATIC uchar AscMsgOutSDTR(ASC_DVC_VAR *, uchar, uchar); +STATIC uchar AscCalSDTRData(ASC_DVC_VAR *, uchar, uchar); STATIC void AscSetChipSDTR(PortAddr, uchar, uchar); -STATIC uchar AscGetSynPeriodIndex(ASC_DVC_VAR asc_ptr_type *, ruchar); +STATIC uchar AscGetSynPeriodIndex(ASC_DVC_VAR *, uchar); STATIC uchar AscAllocFreeQueue(PortAddr, uchar); STATIC uchar AscAllocMultipleFreeQueue(PortAddr, uchar, uchar); -STATIC int AscRiscHaltedAbortSRB(ASC_DVC_VAR asc_ptr_type *, ulong); +STATIC int AscRiscHaltedAbortSRB(ASC_DVC_VAR *, ASC_DCNT); #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) -STATIC int AscRiscHaltedAbortTIX(ASC_DVC_VAR asc_ptr_type *, uchar); +STATIC int AscRiscHaltedAbortTIX(ASC_DVC_VAR *, uchar); #endif /* version >= v1.3.89 */ STATIC int AscHostReqRiscHalt(PortAddr); STATIC int AscStopQueueExe(PortAddr); @@ -2068,39 +2049,39 @@ STATIC int AscCleanUpDiscQueue(PortAddr); #endif /* version >= v1.3.89 */ STATIC int AscCleanUpBusyQueue(PortAddr); -STATIC int AscWaitTixISRDone(ASC_DVC_VAR asc_ptr_type *, uchar); -STATIC int AscWaitISRDone(ASC_DVC_VAR asc_ptr_type *); -STATIC ulong AscGetOnePhyAddr(ASC_DVC_VAR asc_ptr_type *, uchar *, - ulong); -STATIC int AscSendScsiQueue(ASC_DVC_VAR asc_ptr_type * asc_dvc, +STATIC int AscWaitTixISRDone(ASC_DVC_VAR *, uchar); +STATIC int AscWaitISRDone(ASC_DVC_VAR *); +STATIC ASC_PADDR AscGetOnePhyAddr(ASC_DVC_VAR *, uchar *, + ASC_DCNT); +STATIC int AscSendScsiQueue(ASC_DVC_VAR *, ASC_SCSI_Q * scsiq, uchar n_q_required); -STATIC int AscPutReadyQueue(ASC_DVC_VAR asc_ptr_type *, +STATIC int AscPutReadyQueue(ASC_DVC_VAR *, ASC_SCSI_Q *, uchar); -STATIC int AscPutReadySgListQueue(ASC_DVC_VAR asc_ptr_type *, +STATIC int AscPutReadySgListQueue(ASC_DVC_VAR *, ASC_SCSI_Q *, uchar); STATIC int AscSetChipSynRegAtID(PortAddr, uchar, uchar); STATIC int AscSetRunChipSynRegAtID(PortAddr, uchar, uchar); -STATIC ushort AscInitLram(ASC_DVC_VAR asc_ptr_type *); -STATIC int AscReInitLram(ASC_DVC_VAR asc_ptr_type *); -STATIC ushort AscInitQLinkVar(ASC_DVC_VAR asc_ptr_type *); -STATIC int AscSetLibErrorCode(ASC_DVC_VAR asc_ptr_type *, ushort); +STATIC ushort AscInitLram(ASC_DVC_VAR *); +STATIC int AscReInitLram(ASC_DVC_VAR *); +STATIC ushort AscInitQLinkVar(ASC_DVC_VAR *); +STATIC int AscSetLibErrorCode(ASC_DVC_VAR *, ushort); #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) STATIC int _AscWaitQDone(PortAddr, ASC_SCSI_Q *); #endif /* version >= v1.3.89 */ -STATIC int AscIsrChipHalted(ASC_DVC_VAR asc_ptr_type *); +STATIC int AscIsrChipHalted(ASC_DVC_VAR *); STATIC uchar _AscCopyLramScsiDoneQ(PortAddr, ushort, - ASC_QDONE_INFO *, ulong); -STATIC int AscIsrQDone(ASC_DVC_VAR asc_ptr_type *); + ASC_QDONE_INFO *, ASC_DCNT); +STATIC int AscIsrQDone(ASC_DVC_VAR *); STATIC int AscCompareString(uchar *, uchar *, int); STATIC ushort AscGetEisaChipCfg(PortAddr); -STATIC ulong AscGetEisaProductID(PortAddr); +STATIC ASC_DCNT AscGetEisaProductID(PortAddr); STATIC PortAddr AscSearchIOPortAddrEISA(PortAddr); STATIC uchar AscGetChipScsiCtrl(PortAddr); STATIC uchar AscSetChipScsiID(PortAddr, uchar); STATIC uchar AscGetChipVersion(PortAddr, ushort); STATIC ushort AscGetChipBusType(PortAddr); -STATIC ulong AscLoadMicroCode(PortAddr, ushort, ushort *, ushort); +STATIC ASC_DCNT AscLoadMicroCode(PortAddr, ushort, ushort *, ushort); STATIC int AscFindSignature(PortAddr); STATIC PortAddr AscSearchIOPortAddr11(PortAddr); STATIC void AscToggleIRQAct(PortAddr); @@ -2112,38 +2093,38 @@ STATIC void DvcLeaveCritical(int); STATIC void DvcInPortWords(PortAddr, ushort *, int); STATIC void DvcOutPortWords(PortAddr, ushort *, int); -STATIC void DvcOutPortDWords(PortAddr, ulong *, int); -STATIC uchar DvcReadPCIConfigByte(ASC_DVC_VAR asc_ptr_type *, ushort); -STATIC void DvcWritePCIConfigByte(ASC_DVC_VAR asc_ptr_type *, +STATIC void DvcOutPortDWords(PortAddr, ASC_DCNT *, int); +STATIC uchar DvcReadPCIConfigByte(ASC_DVC_VAR *, ushort); +STATIC void DvcWritePCIConfigByte(ASC_DVC_VAR *, ushort, uchar); STATIC ushort AscGetChipBiosAddress(PortAddr, ushort); -STATIC void DvcSleepMilliSecond(ulong); -STATIC void DvcDelayNanoSecond(ASC_DVC_VAR asc_ptr_type *, ulong); -STATIC ulong DvcGetSGList(ASC_DVC_VAR asc_ptr_type *, uchar *, - ulong, ASC_SG_HEAD *); +STATIC void DvcSleepMilliSecond(ASC_DCNT); +STATIC void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT); +STATIC ASC_DCNT DvcGetSGList(ASC_DVC_VAR *, uchar *, + ASC_DCNT, ASC_SG_HEAD *); STATIC void DvcPutScsiQ(PortAddr, ushort, ushort *, int); STATIC void DvcGetQinfo(PortAddr, ushort, ushort *, int); STATIC PortAddr AscSearchIOPortAddr(PortAddr, ushort); -STATIC ushort AscInitGetConfig(ASC_DVC_VAR asc_ptr_type *); -STATIC ushort AscInitSetConfig(ASC_DVC_VAR asc_ptr_type *); -STATIC ushort AscInitAsc1000Driver(ASC_DVC_VAR asc_ptr_type *); -STATIC void AscAsyncFix(ASC_DVC_VAR asc_ptr_type *, uchar, +STATIC ushort AscInitGetConfig(ASC_DVC_VAR *); +STATIC ushort AscInitSetConfig(ASC_DVC_VAR *); +STATIC ushort AscInitAsc1000Driver(ASC_DVC_VAR *); +STATIC void AscAsyncFix(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *); STATIC int AscTagQueuingSafe(ASC_SCSI_INQUIRY *); -STATIC void AscInquiryHandling(ASC_DVC_VAR asc_ptr_type *, +STATIC void AscInquiryHandling(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *); -STATIC int AscExeScsiQueue(ASC_DVC_VAR asc_ptr_type *, ASC_SCSI_Q *); -STATIC int AscISR(ASC_DVC_VAR asc_ptr_type *); -STATIC uint AscGetNumOfFreeQueue(ASC_DVC_VAR asc_ptr_type *, uchar, +STATIC int AscExeScsiQueue(ASC_DVC_VAR *, ASC_SCSI_Q *); +STATIC int AscISR(ASC_DVC_VAR *); +STATIC uint AscGetNumOfFreeQueue(ASC_DVC_VAR *, uchar, uchar); STATIC int AscSgListToQueue(int); -STATIC int AscAbortSRB(ASC_DVC_VAR asc_ptr_type *, ulong); +STATIC int AscAbortSRB(ASC_DVC_VAR *, ASC_VADDR); #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) -STATIC int AscResetDevice(ASC_DVC_VAR asc_ptr_type *, uchar); +STATIC int AscResetDevice(ASC_DVC_VAR *, uchar); #endif /* version >= v1.3.89 */ -STATIC int AscResetSB(ASC_DVC_VAR asc_ptr_type *); +STATIC int AscResetSB(ASC_DVC_VAR *); STATIC void AscEnableIsaDma(uchar); -STATIC ulong AscGetMaxDmaCount(ushort); +STATIC ASC_DCNT AscGetMaxDmaCount(ushort); /* @@ -2151,7 +2132,7 @@ */ #define ADV_LIB_VERSION_MAJOR 5 -#define ADV_LIB_VERSION_MINOR 2 +#define ADV_LIB_VERSION_MINOR 5 /* d_os_dep.h */ #define ADV_OS_LINUX @@ -2159,10 +2140,36 @@ /* * Define Adv Library required special types. */ + +/* + * Portable Data Types + * + * Any instance where a 32-bit long or pointer type is assumed + * for precision or HW defined structures, the following define + * types must be used. In Linux the char, short, and int types + * are all consistent at 8, 16, and 32 bits respectively. Pointers + * and long types are 64 bits on Alpha and UltraSPARC. + */ +#define ADV_PADDR __u32 /* Physical address data type. */ +#define ADV_VADDR __u32 /* Virtual address data type. */ +#define ADV_DCNT __u32 /* Unsigned Data count type. */ +#define ADV_SDCNT __s32 /* Signed Data count type. */ + +/* + * These macros are used to convert a virtual address to a + * 32-bit value. This currently can be used on Linux Alpha + * which uses 64-bit virtual address but a 32-bit bus address. + * This is likely to break in the future, but doing this now + * will give us time to change the HW and FW to handle 64-bit + * addresses. + */ +#define ADV_VADDR_TO_U32 virt_to_bus +#define ADV_U32_TO_VADDR bus_to_virt + #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(1,3,0) #define AdvPortAddr unsigned short /* I/O Port address size */ #else /* version >= v1,3,0 */ -#define AdvPortAddr unsigned long /* Virtual memory address size */ +#define AdvPortAddr ulong /* Virtual memory address size */ #endif /* version >= v1,3,0 */ /* @@ -2185,15 +2192,21 @@ /* * Define total number of simultaneous maximum element scatter-gather - * requests, i.e. ADV_TOT_SG_LIST * ADV_MAX_SG_LIST is the total number - * of simultaneous scatter-gather elements supported per wide adapter. + * request blocks per wide adapter. ASC_DEF_MAX_HOST_QNG (253) is the + * maximum number of outstanding commands per wide host adapter. Each + * command uses one or more ADV_SG_BLOCK each with 15 scatter-gather + * elements. Allow each command to have at least one ADV_SG_BLOCK structure. + * This allows about 15 commands to have the maximum 17 ADV_SG_BLOCK + * structures or 255 scatter-gather elements. + * */ -#define ADV_TOT_SG_LIST 64 +#define ADV_TOT_SG_BLOCK ASC_DEF_MAX_HOST_QNG /* - * Define Adv Library required per request scatter-gather element limit. + * Define Adv Library required maximum number of scatter-gather + * elements per request. */ -#define ADV_MAX_SG_LIST 64 +#define ADV_MAX_SG_LIST 255 /* Number of SG blocks needed. */ #define ADV_NUM_SG_BLOCK \ @@ -2208,8 +2221,6 @@ #define ADV_NUM_PAGE_CROSSING \ ((ADV_SG_TOTAL_MEM_SIZE + (ASC_PAGE_SIZE - 1))/ASC_PAGE_SIZE) -#define ADV_ASSERT(a) ASC_ASSERT(a) - /* a_condor.h */ #define ADV_PCI_VENDOR_ID 0x10CD #define ADV_PCI_DEVICE_ID_REV_A 0x2300 @@ -2225,8 +2236,13 @@ #define ADV_EEPROM_BIG_ENDIAN 0x8000 /* EEPROM Bit 15 */ #define ADV_EEPROM_BIOS_ENABLE 0x4000 /* EEPROM Bit 14 */ +/* + * For the ASC3550 Bit 13 is Termination Polarity control bit. + * For later ICs Bit 13 controls whether the CIS (Card Information + * Service Section) is loaded from EEPROM. + */ #define ADV_EEPROM_TERM_POL 0x2000 /* EEPROM Bit 13 */ -#define ADV_EEPROM_CIS_LD 0x1000 /* EEPROM Bit 12 */ +#define ADV_EEPROM_CIS_LD 0x2000 /* EEPROM Bit 13 */ typedef struct adveep_3550_config { @@ -2303,8 +2319,7 @@ /* Word Offset, Description */ ushort cfg_lsw; /* 00 power up initialization */ - /* bit 12 set - CIS Load */ - /* bit 13 set - Term Polarity Control */ + /* bit 13 set - Load CIS */ /* bit 14 set - BIOS Enable */ /* bit 15 set - Big Endian Mode */ ushort cfg_msw; /* 01 unused */ @@ -2452,12 +2467,12 @@ #define IOPB_SOFT_OVER_WR 0x0E #define IOPB_RES_ADDR_F 0x0F #define IOPB_MEM_CFG 0x10 -#define IOPB_GPIO_CNTL 0x11 +#define IOPB_RES_ADDR_11 0x11 #define IOPB_GPIO_DATA 0x12 #define IOPB_RES_ADDR_13 0x13 #define IOPB_FLASH_PAGE 0x14 #define IOPB_RES_ADDR_15 0x15 -#define IOPB_RES_ADDR_16 0x16 +#define IOPB_GPIO_CNTL 0x16 #define IOPB_RES_ADDR_17 0x17 #define IOPB_FLASH_DATA 0x18 #define IOPB_RES_ADDR_19 0x19 @@ -2493,7 +2508,7 @@ #define IOPB_RES_ADDR_37 0x37 #define IOPB_RAM_BIST 0x38 #define IOPB_PLL_TEST 0x39 -#define IOPB_RES_ADDR_3A 0x3A +#define IOPB_PCI_INT_CFG 0x3A #define IOPB_RES_ADDR_3B 0x3B #define IOPB_RFIFO_CNT 0x3C #define IOPB_RES_ADDR_3D 0x3D @@ -2854,16 +2869,16 @@ typedef struct adv_carr_t { - ulong carr_va; /* Carrier Virtual Address */ - ulong carr_pa; /* Carrier Physical Address */ - ulong areq_vpa; /* ASC_SCSI_REQ_Q Virtual or Physical Address */ + ADV_VADDR carr_va; /* Carrier Virtual Address */ + ADV_PADDR carr_pa; /* Carrier Physical Address */ + ADV_VADDR areq_vpa; /* ASC_SCSI_REQ_Q Virtual or Physical Address */ /* * next_vpa [31:4] Carrier Virtual or Physical Next Pointer * * next_vpa [3:1] Reserved Bits * next_vpa [0] Done Flag set in Response Queue. */ - ulong next_vpa; + ADV_VADDR next_vpa; } ADV_CARR_T; /* @@ -2874,7 +2889,7 @@ #define ASC_RQ_DONE 0x00000001 #define ASC_CQ_STOPPER 0x00000000 -#define ASC_GET_CARRP(carrp) ((ADV_CARR_T *) ((carrp) & ASC_NEXT_VPA_MASK)) +#define ASC_GET_CARRP(carrp) ((carrp) & ASC_NEXT_VPA_MASK) #define ADV_PAGE_SIZE 4096 /* Assume 4KB page size. */ @@ -2969,7 +2984,7 @@ uchar max_host_qng; /* maximum number of Q'ed command allowed */ uchar irq_no; /* IRQ number */ ushort no_scam; /* scam_tolerant of EEPROM */ - ulong drv_ptr; /* driver pointer to private structure */ + struct asc_board *drv_ptr; /* driver pointer to private structure */ uchar chip_scsi_id; /* chip SCSI target ID */ uchar chip_type; uchar bist_err_code; @@ -2992,10 +3007,10 @@ uchar reserved2; uchar reserved3; uchar sg_cnt; /* Valid entries in block. */ - struct asc_sg_block *sg_ptr; /* links to the next sg block */ + ADV_PADDR sg_ptr; /* Pointer to next sg block. */ struct { - ulong sg_addr; /* SG element address. */ - ulong sg_count; /* SG element count. */ + ADV_PADDR sg_addr; /* SG element address. */ + ADV_DCNT sg_count; /* SG element count. */ } sg_list[NO_OF_SG_PER_BLOCK]; } ADV_SG_BLOCK; @@ -3009,13 +3024,13 @@ */ typedef struct adv_scsi_req_q { uchar cntl; /* Ucode flags and state (ASC_MC_QC_*). */ - uchar reserved; + uchar target_cmd; uchar target_id; /* Device target identifier. */ uchar target_lun; /* Device target logical unit number. */ - ulong data_addr; /* Data buffer physical address. */ - ulong data_cnt; /* Data count. Ucode sets to residual. */ - ulong sense_addr; - ulong carr_pa; + ADV_PADDR data_addr; /* Data buffer physical address. */ + ADV_DCNT data_cnt; /* Data count. Ucode sets to residual. */ + ADV_PADDR sense_addr; + ADV_PADDR carr_pa; uchar mflag; uchar sense_len; uchar cdb_len; /* SCSI CDB length. */ @@ -3025,18 +3040,18 @@ uchar host_status; /* Ucode host status. */ uchar sg_working_ix; uchar cdb[12]; /* SCSI command block. */ - ulong sg_real_addr; /* SG list physical address. */ - ulong scsiq_rptr; - ulong sg_working_data_cnt; - struct adv_scsi_req_q *scsiq_ptr; - ulong carr_va; + ADV_PADDR sg_real_addr; /* SG list physical address. */ + ADV_PADDR scsiq_rptr; + ADV_DCNT sg_working_data_cnt; + ADV_VADDR scsiq_ptr; + ADV_VADDR carr_va; /* * End of microcode structure - 60 bytes. The rest of the structure * is used by the Adv Library and ignored by the microcode. */ - ulong srb_ptr; + ADV_VADDR srb_ptr; ADV_SG_BLOCK *sg_list_ptr; /* SG list virtual address. */ - ulong vdata_addr; /* Data buffer virtual address. */ + char *vdata_addr; /* Data buffer virtual address. */ uchar a_flag; } ADV_SCSI_REQ_Q; @@ -3081,18 +3096,17 @@ */ STATIC int DvcEnterCritical(void); STATIC void DvcLeaveCritical(int); -STATIC void DvcSleepMilliSecond(ulong); +STATIC void DvcSleepMilliSecond(ADV_DCNT); STATIC uchar DvcAdvReadPCIConfigByte(ADV_DVC_VAR *, ushort); STATIC void DvcAdvWritePCIConfigByte(ADV_DVC_VAR *, ushort, uchar); -STATIC ulong DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *, - uchar *, long *, int); +STATIC ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *, + uchar *, ASC_SDCNT *, int); STATIC void DvcDelayMicroSecond(ADV_DVC_VAR *, ushort); /* * Adv Library functions available to drivers. */ -STATIC int AdvExeScsiQueue(ADV_DVC_VAR *, - ADV_SCSI_REQ_Q *); +STATIC int AdvExeScsiQueue(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); STATIC int AdvISR(ADV_DVC_VAR *); STATIC int AdvInitGetConfig(ADV_DVC_VAR *); STATIC int AdvInitAsc3550Driver(ADV_DVC_VAR *); @@ -3103,7 +3117,7 @@ /* * Internal Adv Library functions. */ -STATIC int AdvSendIdleCmd(ADV_DVC_VAR *, ushort, ulong); +STATIC int AdvSendIdleCmd(ADV_DVC_VAR *, ushort, ADV_DCNT); STATIC void AdvInquiryHandling(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); STATIC int AdvInitFrom3550EEP(ADV_DVC_VAR *); STATIC int AdvInitFrom38C0800EEP(ADV_DVC_VAR *); @@ -3123,16 +3137,20 @@ #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(1,3,0) /* Read byte from a register. */ -#define AdvReadByteRegister(iop_base, reg_off) (inp((iop_base) + (reg_off))) +#define AdvReadByteRegister(iop_base, reg_off) \ + (inp((iop_base) + (reg_off))) /* Write byte to a register. */ -#define AdvWriteByteRegister(iop_base, reg_off, byte) (outp((iop_base) + (reg_off), (byte))) +#define AdvWriteByteRegister(iop_base, reg_off, byte) \ + (outp((iop_base) + (reg_off), (byte))) /* Read word (2 bytes) from a register. */ -#define AdvReadWordRegister(iop_base, reg_off) (inpw((iop_base) + (reg_off))) +#define AdvReadWordRegister(iop_base, reg_off) \ + (le16_to_cpu(inpw((iop_base) + (reg_off)))) /* Write word (2 bytes) to a register. */ -#define AdvWriteWordRegister(iop_base, reg_off, word) (outpw((iop_base) + (reg_off), (word))) +#define AdvWriteWordRegister(iop_base, reg_off, word) \ + (outpw((iop_base) + (reg_off), cpu_to_le16(word))) /* Read byte from LRAM. */ #define AdvReadByteLram(iop_base, addr, byte) \ @@ -3150,29 +3168,31 @@ #define AdvReadWordLram(iop_base, addr, word) \ do { \ outpw((iop_base) + IOPW_RAM_ADDR, (addr)); \ - (word) = inpw((iop_base) + IOPW_RAM_DATA); \ + (word) = le16_to_cpu(inpw((iop_base) + IOPW_RAM_DATA)); \ } while (0) /* Write word (2 bytes) to LRAM. */ #define AdvWriteWordLram(iop_base, addr, word) \ (outpw((iop_base) + IOPW_RAM_ADDR, (addr)), \ - outpw((iop_base) + IOPW_RAM_DATA, (word))) + outpw((iop_base) + IOPW_RAM_DATA, cpu_to_le16(word))) /* Write double word (4 bytes) to LRAM */ /* Because of unspecified C language ordering don't use auto-increment. */ #define AdvWriteDWordLram(iop_base, addr, dword) \ ((outpw((iop_base) + IOPW_RAM_ADDR, (addr)), \ - outpw((iop_base) + IOPW_RAM_DATA, (ushort) ((dword) & 0xFFFF))), \ + outpw((iop_base) + IOPW_RAM_DATA, \ + cpu_to_le16((ushort) ((dword) & 0xFFFF)))), \ (outpw((iop_base) + IOPW_RAM_ADDR, (addr) + 2), \ - outpw((iop_base) + IOPW_RAM_DATA, (ushort) ((dword >> 16) & 0xFFFF)))) + outpw((iop_base) + IOPW_RAM_DATA, \ + cpu_to_le16((ushort) ((dword >> 16) & 0xFFFF))))) /* Read word (2 bytes) from LRAM assuming that the address is already set. */ #define AdvReadWordAutoIncLram(iop_base) \ - (inpw((iop_base) + IOPW_RAM_DATA)) + (le16_to_cpu(inpw((iop_base) + IOPW_RAM_DATA))) /* Write word (2 bytes) to LRAM assuming that the address is already set. */ #define AdvWriteWordAutoIncLram(iop_base, word) \ - (outpw((iop_base) + IOPW_RAM_DATA, (word))) + (outpw((iop_base) + IOPW_RAM_DATA, cpu_to_le16(word))) #else /* version >= v1,3,0 */ @@ -3186,11 +3206,11 @@ /* Read word (2 bytes) from a register. */ #define AdvReadWordRegister(iop_base, reg_off) \ - (ADV_MEM_READW((iop_base) + (reg_off))) + le16_to_cpu(ADV_MEM_READW((iop_base) + (reg_off))) /* Write word (2 bytes) to a register. */ #define AdvWriteWordRegister(iop_base, reg_off, word) \ - (ADV_MEM_WRITEW((iop_base) + (reg_off), (word))) + (ADV_MEM_WRITEW((iop_base) + (reg_off), cpu_to_le16(word))) /* Read byte from LRAM. */ #define AdvReadByteLram(iop_base, addr, byte) \ @@ -3208,31 +3228,31 @@ #define AdvReadWordLram(iop_base, addr, word) \ do { \ ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)); \ - (word) = ADV_MEM_READW((iop_base) + IOPW_RAM_DATA); \ + (word) = le16_to_cpu(ADV_MEM_READW((iop_base) + IOPW_RAM_DATA)); \ } while (0) /* Write word (2 bytes) to LRAM. */ #define AdvWriteWordLram(iop_base, addr, word) \ (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \ - ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word))) + ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, cpu_to_le16(word))) /* Write double word (4 bytes) to LRAM */ /* Because of unspecified C language ordering don't use auto-increment. */ #define AdvWriteDWordLram(iop_base, addr, dword) \ ((ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr)), \ ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, \ - (ushort) ((dword) & 0xFFFF))), \ + cpu_to_le16((ushort) ((dword) & 0xFFFF)))), \ (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_ADDR, (addr) + 2), \ ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, \ - (ushort) ((dword >> 16) & 0xFFFF)))) + cpu_to_le16((ushort) ((dword >> 16) & 0xFFFF))))) /* Read word (2 bytes) from LRAM assuming that the address is already set. */ #define AdvReadWordAutoIncLram(iop_base) \ - (ADV_MEM_READW((iop_base) + IOPW_RAM_DATA)) + le16_to_cpu(ADV_MEM_READW((iop_base) + IOPW_RAM_DATA)) /* Write word (2 bytes) to LRAM assuming that the address is already set. */ #define AdvWriteWordAutoIncLram(iop_base, word) \ - (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word))) + (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, cpu_to_le16(word))) #endif /* version >= v1,3,0 */ @@ -3270,7 +3290,7 @@ */ #define AdvAbortQueue(asc_dvc, scsiq) \ AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_ABORT, \ - (ulong) (scsiq)) + (ADV_DCNT) (scsiq)) /* * Send a Bus Device Reset Message to the specified target ID. @@ -3285,7 +3305,7 @@ */ #define AdvResetDevice(asc_dvc, target_id) \ AdvSendIdleCmd((asc_dvc), (ushort) IDLE_CMD_DEVICE_RESET, \ - (ulong) (target_id)) + (ADV_DCNT) (target_id)) /* * SCSI Wide Type definition. @@ -3378,15 +3398,6 @@ (sizeof(ADV_SG_BLOCK) * \ ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)) -/* - * A driver may optionally define the assertion macro ADV_ASSERT() in - * its d_os_dep.h file. If the macro has not already been defined, - * then define the macro to a no-op. - */ -#ifndef ADV_ASSERT -#define ADV_ASSERT(a) -#endif /* ADV_ASSERT */ - typedef struct { uchar peri_dvc_type : 5; /* peripheral device type */ uchar peri_qualifier : 3; /* peripheral qualifier */ @@ -3823,28 +3834,28 @@ /* Per board statistics structure */ struct asc_stats { /* Driver Entrypoint Statistics */ - ulong command; /* # calls to advansys_command() */ - ulong queuecommand; /* # calls to advansys_queuecommand() */ - ulong abort; /* # calls to advansys_abort() */ - ulong reset; /* # calls to advansys_reset() */ - ulong biosparam; /* # calls to advansys_biosparam() */ - ulong interrupt; /* # advansys_interrupt() calls */ - ulong callback; /* # calls to asc/adv_isr_callback() */ - ulong done; /* # calls to request's scsi_done function */ - ulong build_error; /* # asc/adv_build_req() ASC_ERROR returns. */ - ulong adv_build_noreq; /* # adv_build_req() adv_req_t alloc. fail. */ - ulong adv_build_nosg; /* # adv_build_req() adv_sgblk_t alloc. fail. */ + ADV_DCNT command; /* # calls to advansys_command() */ + ADV_DCNT queuecommand; /* # calls to advansys_queuecommand() */ + ADV_DCNT abort; /* # calls to advansys_abort() */ + ADV_DCNT reset; /* # calls to advansys_reset() */ + ADV_DCNT biosparam; /* # calls to advansys_biosparam() */ + ADV_DCNT interrupt; /* # advansys_interrupt() calls */ + ADV_DCNT callback; /* # calls to asc/adv_isr_callback() */ + ADV_DCNT done; /* # calls to request's scsi_done function */ + ADV_DCNT build_error; /* # asc/adv_build_req() ASC_ERROR returns. */ + ADV_DCNT adv_build_noreq; /* # adv_build_req() adv_req_t alloc. fail. */ + ADV_DCNT adv_build_nosg; /* # adv_build_req() adv_sgblk_t alloc. fail. */ /* AscExeScsiQueue()/AdvExeScsiQueue() Statistics */ - ulong exe_noerror; /* # ASC_NOERROR returns. */ - ulong exe_busy; /* # ASC_BUSY returns. */ - ulong exe_error; /* # ASC_ERROR returns. */ - ulong exe_unknown; /* # unknown returns. */ + ADV_DCNT exe_noerror; /* # ASC_NOERROR returns. */ + ADV_DCNT exe_busy; /* # ASC_BUSY returns. */ + ADV_DCNT exe_error; /* # ASC_ERROR returns. */ + ADV_DCNT exe_unknown; /* # unknown returns. */ /* Data Transfer Statistics */ - ulong cont_cnt; /* # non-scatter-gather I/O requests received */ - ulong cont_xfer; /* # contiguous transfer 512-bytes */ - ulong sg_cnt; /* # scatter-gather I/O requests received */ - ulong sg_elem; /* # scatter-gather elements */ - ulong sg_xfer; /* # scatter-gather transfer 512-bytes */ + ADV_DCNT cont_cnt; /* # non-scatter-gather I/O requests received */ + ADV_DCNT cont_xfer; /* # contiguous transfer 512-bytes */ + ADV_DCNT sg_cnt; /* # scatter-gather I/O requests received */ + ADV_DCNT sg_elem; /* # scatter-gather elements */ + ADV_DCNT sg_xfer; /* # scatter-gather transfer 512-bytes */ }; #endif /* ADVANSYS_STATS */ @@ -3858,8 +3869,8 @@ #ifdef ADVANSYS_STATS short q_cur_cnt[ADV_MAX_TID+1]; /* current queue count */ short q_max_cnt[ADV_MAX_TID+1]; /* maximum queue count */ - ulong q_tot_cnt[ADV_MAX_TID+1]; /* total enqueue count */ - ulong q_tot_tim[ADV_MAX_TID+1]; /* total time queued */ + ADV_DCNT q_tot_cnt[ADV_MAX_TID+1]; /* total enqueue count */ + ADV_DCNT q_tot_tim[ADV_MAX_TID+1]; /* total time queued */ ushort q_max_tim[ADV_MAX_TID+1]; /* maximum time queued */ ushort q_min_tim[ADV_MAX_TID+1]; /* minimum time queued */ #endif /* ADVANSYS_STATS */ @@ -3868,20 +3879,20 @@ /* * Adv Library Request Structures * - * The following two se structures are used to process Wide Board requests. - * One structure is needed for each command received from the Mid-Level SCSI - * driver. + * The following two structures are used to process Wide Board requests. * * The ADV_SCSI_REQ_Q structure in adv_req_t is passed to the Adv Library * and microcode with the ADV_SCSI_REQ_Q field 'srb_ptr' pointing to the * adv_req_t. The adv_req_t structure 'cmndp' field in turn points to the * Mid-Level SCSI request structure. * - * The adv_sgblk_t structure is used to handle requests that include - * scatter-gather elements. + * Zero or more ADV_SG_BLOCK are used with each ADV_SCSI_REQ_Q. Each + * ADV_SG_BLOCK structure holds 15 scatter-gather elements. Under Linux + * up to 255 scatter-gather elements may be used per request or + * ADV_SCSI_REQ_Q. */ typedef struct adv_sgblk { - ADV_SG_BLOCK sg_block[ADV_NUM_SG_BLOCK + ADV_NUM_PAGE_CROSSING]; + ADV_SG_BLOCK sg_block; /* Sgblock structure. */ uchar align2[4]; /* Sgblock structure padding. */ struct adv_sgblk *next_sgblkp; /* Next scatter-gather structure. */ } adv_sgblk_t; @@ -3949,7 +3960,6 @@ ADV_CARR_T *orig_carrp; /* ADV_CARR_T memory block. */ adv_req_t *orig_reqp; /* adv_req_t memory block. */ adv_req_t *adv_reqp; /* Request structures. */ - adv_sgblk_t *orig_sgblkp; /* adv_sgblk_t memory block. */ adv_sgblk_t *adv_sgblkp; /* Scatter-gather structures. */ ushort bios_signature; /* BIOS Signature. */ ushort bios_version; /* BIOS Version. */ @@ -3996,9 +4006,9 @@ uchar latencyTimer; uchar headerType; uchar bist; - ulong baseAddress[6]; + ADV_PADDR baseAddress[6]; ushort reserved[4]; - ulong optionRomAddr; + ADV_PADDR optionRomAddr; ushort reserved2[4]; uchar irqLine; uchar irqPin; @@ -4011,6 +4021,20 @@ * --- Driver Data */ +/* Note: All driver global data should be initialized. */ + +#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,3,28) && \ + LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,0) +struct proc_dir_entry proc_scsi_advansys = +{ + PROC_SCSI_ADVANSYS, /* unsigned short low_ino */ + 8, /* unsigned short namelen */ + "advansys", /* const char *name */ + S_IFDIR | S_IRUGO | S_IXUGO, /* mode_t mode */ + 2 /* nlink_t nlink */ +}; +#endif /* v2.3.28 > version >= v1.3.0 */ + /* Number of boards detected in system. */ STATIC int asc_board_count = 0; STATIC struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { 0 }; @@ -4054,7 +4078,8 @@ */ uchar adv_carr_buf[20 * sizeof(ADV_CARR_T)] = { 0 }; uchar adv_req_buf[16 * sizeof(adv_req_t)] = { 0 }; -uchar adv_sgblk_buf[16 * sizeof(adv_sgblk_t)] = { 0 }; +#define ADV_SGBLK_BUF_CNT 32 +uchar adv_sgblk_buf[ADV_SGBLK_BUF_CNT * sizeof(adv_sgblk_t)] = { 0 }; #endif /* version >= v1,3,0 */ #ifdef ADVANSYS_DEBUG @@ -4066,7 +4091,7 @@ "ASC_IS_PCI", }; -STATIC int asc_dbglvl = 0; +STATIC int asc_dbglvl = 2; #endif /* ADVANSYS_DEBUG */ /* Declaration for Asc Library internal data referenced by driver. */ @@ -4096,7 +4121,7 @@ STATIC int asc_execute_scsi_cmnd(Scsi_Cmnd *); STATIC int asc_build_req(asc_board_t *, Scsi_Cmnd *); STATIC int adv_build_req(asc_board_t *, Scsi_Cmnd *, ADV_SCSI_REQ_Q **); -STATIC int adv_get_sglist(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *, Scsi_Cmnd *); +STATIC int adv_get_sglist(asc_board_t *, adv_req_t *, Scsi_Cmnd *); STATIC void asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *); STATIC void adv_isr_callback(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); STATIC void adv_async_callback(ADV_DVC_VAR *, uchar); @@ -4423,6 +4448,7 @@ asc_board_t *boardp = NULL; ASC_DVC_VAR *asc_dvc_varp = NULL; ADV_DVC_VAR *adv_dvc_varp = NULL; + adv_sgblk_t *sgp = NULL; int ioport = 0; int share_irq = FALSE; int iolen = 0; @@ -4435,7 +4461,7 @@ PCI_DEVICE pciDevice; PCI_CONFIG_SPACE pciConfig; #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,0) - unsigned long pci_memory_address; + ADV_PADDR pci_memory_address; #endif /* version >= v1,3,0 */ #endif /* ASC_CONFIG_PCI */ #else /* version >= v2.1.93 */ @@ -4453,7 +4479,7 @@ ASC_PCI_DEVICE_ID_2300, ASC_PCI_DEVICE_ID_2500 }; - unsigned long pci_memory_address; + ADV_PADDR pci_memory_address; #endif /* CONFIG_PCI */ #endif /* version >= v2.1.93 */ int warn_code, err_code; @@ -4468,7 +4494,11 @@ ASC_DBG(1, "advansys_detect: begin\n"); +#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,3,28) tpnt->proc_name = "advansys"; +#elif LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,0) + tpnt->proc_dir = &proc_scsi_advansys; +#endif /* version >= v1.3.0 */ asc_board_count = 0; @@ -4774,15 +4804,15 @@ ASC_DBG(1, "advansys_detect: narrow board\n"); asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; asc_dvc_varp->bus_type = asc_bus[bus]; - asc_dvc_varp->drv_ptr = (ulong) boardp; + asc_dvc_varp->drv_ptr = boardp; asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg; asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0]; asc_dvc_varp->iop_base = iop; - asc_dvc_varp->isr_callback = (Ptr2Func) asc_isr_callback; + asc_dvc_varp->isr_callback = asc_isr_callback; } else { ASC_DBG(1, "advansys_detect: wide board\n"); adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; - adv_dvc_varp->drv_ptr = (ulong) boardp; + adv_dvc_varp->drv_ptr = boardp; adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg; adv_dvc_varp->isr_callback = adv_isr_callback; adv_dvc_varp->async_callback = adv_async_callback; @@ -4837,13 +4867,13 @@ #ifdef ASC_CONFIG_PCI pci_memory_address = pciConfig.baseAddress[1]; ASC_DBG1(1, "advansys_detect: pci_memory_address: %lu\n", - pci_memory_address); + (ulong) pci_memory_address); if ((boardp->ioremap_addr = ioremap(pci_memory_address & PAGE_MASK, PAGE_SIZE)) == 0) { ASC_PRINT3( -"advansys_detect: board %d: ioremap(%lx, %d) returned NULL\n", - boardp->id, pci_memory_address, iolen); +"advansys_detect: board %d: ioremap(%lu, %x) returned NULL\n", + boardp->id, (ulong) pci_memory_address, iolen); scsi_unregister(shp); asc_board_count--; continue; @@ -4863,13 +4893,13 @@ #else /* version >= v2.3.13 */ pci_memory_address = pci_devp->resource[1].start; #endif /* version >= v2.3.13 */ - ASC_DBG1(1, "advansys_detect: pci_memory_address: %lu\n", + ASC_DBG1(1, "advansys_detect: pci_memory_address: %x\n", pci_memory_address); if ((boardp->ioremap_addr = ioremap(pci_memory_address & PAGE_MASK, PAGE_SIZE)) == 0) { ASC_PRINT3( -"advansys_detect: board %d: ioremap(%lx, %d) returned NULL\n", +"advansys_detect: board %d: ioremap(%x, %d) returned NULL\n", boardp->id, pci_memory_address, iolen); scsi_unregister(shp); asc_board_count--; @@ -4894,7 +4924,8 @@ */ boardp->ioport = iop; - ASC_DBG2(1, "iopb_chip_id_1 %x, iopw_chip_id_0 %x\n", + ASC_DBG2(1, + "advansys_detect: iopb_chip_id_1 %x, iopw_chip_id_0 %x\n", (ushort) inp(iop + 1), (ushort) inpw(iop)); } @@ -5324,6 +5355,7 @@ shp->sg_tablesize = ADV_MAX_SG_LIST; } +#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) #ifdef MODULE /* * If the driver is compiled as a module, set a limit on the @@ -5335,6 +5367,7 @@ shp->sg_tablesize = 64; } #endif /* MODULE */ +#endif /* version < v2.0.0 */ /* * The value of 'sg_tablesize' can not exceed the SCSI @@ -5351,7 +5384,7 @@ /* BIOS start address. */ if (ASC_NARROW_BOARD(boardp)) { - shp->base = (char *) ((ulong) AscGetChipBiosAddress( + shp->base = ((ulong) AscGetChipBiosAddress( asc_dvc_varp->iop_base, asc_dvc_varp->bus_type)); } else { @@ -5385,7 +5418,7 @@ * Convert x86 realmode code segment to a linear * address by shifting left 4. */ - shp->base = (uchar *) (boardp->bios_codeseg << 4); + shp->base = (boardp->bios_codeseg << 4); } else { shp->base = 0; } @@ -5492,21 +5525,26 @@ int req_cnt; adv_req_t *reqp = NULL; int sg_cnt = 0; - adv_sgblk_t *sgp = NULL; #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(1,3,0) carrp = (ADV_CARR_T *) &adv_carr_buf[0]; req_cnt = sizeof(adv_req_buf)/sizeof(adv_req_t); sg_cnt = sizeof(adv_sgblk_buf)/sizeof(adv_sgblk_t); reqp = (adv_req_t *) &adv_req_buf[0]; - sgp = (adv_sgblk_t *) &adv_sgblk_buf[0]; + boardp->adv_sgblkp = NULL; + for (sg_cnt = 0; sg_cnt < ADV_SGBLK_BUF_CNT; sg_cnt++) { + sgp = (adv_sgblk_t *) &adv_sgblk_buf[sg_cnt]; + sgp->next_sgblkp = boardp->adv_sgblkp; + boardp->adv_sgblkp = sgp; + } #else /* version >= v1.3.0 */ /* - * Allocate buffer carrier structures. + * Allocate buffer carrier structures. The total size + * is about 4 KB, so allocate all at once. */ carrp = (ADV_CARR_T *) kmalloc(ADV_CARRIER_BUFSIZE, GFP_ATOMIC); - ASC_DBG1(1, "advansys_detect: carrp %x\n", (unsigned) carrp); + ASC_DBG1(1, "advansys_detect: carrp %lx\n", (ulong) carrp); if (carrp == NULL) { goto kmalloc_error; @@ -5514,7 +5552,9 @@ /* * Allocate up to 'max_host_qng' request structures for - * the Wide board. + * the Wide board. The total size is about 16 KB, so + * allocate all at once. If the allocation fails decrement + * and try again. */ for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) { @@ -5523,8 +5563,9 @@ kmalloc(sizeof(adv_req_t) * req_cnt, GFP_ATOMIC); ASC_DBG3(1, - "advansys_detect: reqp %x, req_cnt %d, bytes %d\n", - (unsigned) reqp, req_cnt, sizeof(adv_req_t) * req_cnt); + "advansys_detect: reqp %lx, req_cnt %d, bytes %lu\n", + (ulong) reqp, req_cnt, + (ulong) sizeof(adv_req_t) * req_cnt); if (reqp != NULL) { break; @@ -5536,22 +5577,27 @@ } /* - * Allocate up to ADV_TOT_SG_LIST request structures for - * the Wide board. + * Allocate up to ADV_TOT_SG_BLOCK request structures for + * the Wide board. Each structure is about 136 bytes. */ - for (sg_cnt = ADV_TOT_SG_LIST; sg_cnt > 0; sg_cnt--) { + boardp->adv_sgblkp = NULL; + for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) { sgp = (adv_sgblk_t *) - kmalloc(sizeof(adv_sgblk_t) * sg_cnt, GFP_ATOMIC); + kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC); - ASC_DBG3(1, - "advansys_detect: sgp %x, sg_cnt %d, bytes %d\n", - (unsigned) sgp, sg_cnt, sizeof(adv_sgblk_t) * sg_cnt); - - if (sgp != NULL) { + if (sgp == NULL) { break; } + + sgp->next_sgblkp = boardp->adv_sgblkp; + boardp->adv_sgblkp = sgp; + } + ASC_DBG3(1, + "advansys_detect: sg_cnt %d * %u = %u bytes\n", + sg_cnt, sizeof(adv_sgblk_t), + (unsigned) (sizeof(adv_sgblk_t) * sg_cnt)); /* * If no request structures or scatter-gather structures could @@ -5571,11 +5617,11 @@ "advansys_detect: board %d: error: failed to kmalloc() adv_req_t buffer.\n", boardp->id); err_code = ADV_ERROR; - } else if (sgp == NULL) { + } else if (boardp->adv_sgblkp == NULL) { kfree(carrp); kfree(reqp); ASC_PRINT1( -"advansys_detect: board %d: error: failed to kmalloc() adv_sgblk_t buffer.\n", +"advansys_detect: board %d: error: failed to kmalloc() adv_sgblk_t buffers.\n", boardp->id); err_code = ADV_ERROR; } else { @@ -5588,12 +5634,6 @@ * driver is built as a module and can be unloaded. */ boardp->orig_reqp = reqp; - - /* - * Save original pointer for kfree() in case the - * driver is built as a module and can be unloaded. - */ - boardp->orig_sgblkp = sgp; #endif /* version >= v1.3.0 */ adv_dvc_varp->carrier_buf = carrp; @@ -5609,17 +5649,6 @@ } boardp->adv_reqp = &reqp[0]; - /* - * Point 'adv_sgblkp' to the request structures and - * link them together. - */ - sg_cnt--; - sgp[sg_cnt].next_sgblkp = NULL; - for (; sg_cnt > 0; sg_cnt--) { - sgp[sg_cnt - 1].next_sgblkp = &sgp[sg_cnt]; - } - boardp->adv_sgblkp = &sgp[0]; - if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { ASC_DBG(2, @@ -5635,7 +5664,7 @@ if (warn_code || err_code) { ASC_PRINT3( "AdvInitAsc3550/38C0800Driver: board %d: error: warn %x, error %x\n", - boardp->id, warn_code, adv_dvc_varp->err_code); + boardp->id, warn_code, err_code); } #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,0) } @@ -5655,9 +5684,10 @@ kfree(boardp->orig_reqp); boardp->orig_reqp = boardp->adv_reqp = NULL; } - if (boardp->orig_sgblkp) { - kfree(boardp->orig_sgblkp); - boardp->orig_sgblkp = boardp->adv_sgblkp = NULL; + while ((sgp = boardp->adv_sgblkp) != NULL) + { + boardp->adv_sgblkp = sgp->next_sgblkp; + kfree(sgp); } } #endif /* version >= v1,3,0 */ @@ -5707,6 +5737,8 @@ release_region(shp->io_port, shp->n_io_port); #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,0) if (ASC_WIDE_BOARD(boardp)) { + adv_sgblk_t *sgp = NULL; + iounmap(boardp->ioremap_addr); if (boardp->orig_carrp) { kfree(boardp->orig_carrp); @@ -5716,9 +5748,10 @@ kfree(boardp->orig_reqp); boardp->orig_reqp = boardp->adv_reqp = NULL; } - if (boardp->orig_sgblkp) { - kfree(boardp->orig_sgblkp); - boardp->orig_sgblkp = boardp->adv_sgblkp = NULL; + while ((sgp = boardp->adv_sgblkp) != NULL) + { + boardp->adv_sgblkp = sgp->next_sgblkp; + kfree(sgp); } } ASC_ASSERT(boardp->prtbuf != NULL); @@ -5761,13 +5794,13 @@ } sprintf(info, #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,1,92) -"AdvanSys SCSI %s: %s %u CDB: BIOS %X, IO %X/%X, IRQ %u, DMA %u", +"AdvanSys SCSI %s: %s %u CDB: BIOS %lX, IO %lX/%X, IRQ %u, DMA %u", #else /* version >= v2.1.92 */ -"AdvanSys SCSI %s: %s %u CDB: BIOS %X, IO %lX/%X, IRQ %u, DMA %u", +"AdvanSys SCSI %s: %s %u CDB: BIOS %lX, IO %lX/%X, IRQ %u, DMA %u", #endif /* version >= v2.1.92 */ ASC_VERSION, busname, asc_dvc_varp->max_total_qng, - (unsigned) shp->base, - shp->io_port, shp->n_io_port - 1, + (ulong) shp->base, + (ulong) shp->io_port, shp->n_io_port - 1, shp->irq, shp->dma_channel); } else if (asc_dvc_varp->bus_type & ASC_IS_PCI) { if ((asc_dvc_varp->bus_type & ASC_IS_PCI_ULTRA) @@ -5797,12 +5830,12 @@ } sprintf(info, #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,1,92) - "AdvanSys SCSI %s: %s %u CDB: BIOS %X, IO %X/%X, IRQ %u", + "AdvanSys SCSI %s: %s %u CDB: BIOS %lX, IO %X/%X, IRQ %u", #else /* version >= v2.1.92 */ - "AdvanSys SCSI %s: %s %u CDB: BIOS %X, IO %lX/%X, IRQ %u", + "AdvanSys SCSI %s: %s %u CDB: BIOS %lX, IO %lX/%X, IRQ %u", #endif /* version >= v2.1.92 */ ASC_VERSION, busname, asc_dvc_varp->max_total_qng, - (unsigned) shp->base, shp->io_port - 1, + (ulong) shp->base, shp->io_port - 1, shp->n_io_port, shp->irq); } } else { @@ -5860,7 +5893,7 @@ int advansys_command(Scsi_Cmnd *scp) { - ASC_DBG1(1, "advansys_command: scp %x\n", (unsigned) scp); + ASC_DBG1(1, "advansys_command: scp %lx\n", (ulong) scp); ASC_STATS(scp->host, command); scp->SCp.Status = 0; /* Set to a known state */ advansys_queuecommand(scp, advansys_command_done); @@ -5903,13 +5936,13 @@ if (boardp->flags & (ASC_HOST_IN_RESET | ASC_HOST_IN_ABORT)) { if (boardp->flags & ASC_HOST_IN_RESET) { ASC_DBG1(1, - "advansys_queuecommand: scp %x blocked for reset request\n", - (unsigned) scp); + "advansys_queuecommand: scp %lx blocked for reset request\n", + (ulong) scp); scp->result = HOST_BYTE(DID_RESET); } else { ASC_DBG1(1, - "advansys_queuecommand: scp %x blocked for abort request\n", - (unsigned) scp); + "advansys_queuecommand: scp %lx blocked for abort request\n", + (ulong) scp); scp->result = HOST_BYTE(DID_ABORT); } @@ -5987,7 +6020,7 @@ save_flags(flags); cli(); - ASC_DBG1(1, "advansys_abort: scp %x\n", (unsigned) scp); + ASC_DBG1(1, "advansys_abort: scp %lx\n", (ulong) scp); #ifdef ADVANSYS_STATS if (scp->host != NULL) { @@ -6004,8 +6037,8 @@ #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) if (scp->serial_number != scp->serial_number_at_timeout) { ASC_PRINT1( -"advansys_abort: timeout serial number changed for request %x\n", - (unsigned) scp); +"advansys_abort: timeout serial number changed for request %lx\n", + (ulong) scp); do_scsi_done = ASC_FALSE; scp_found = ASC_FALSE; ret = SCSI_ABORT_NOT_RUNNING; @@ -6041,8 +6074,8 @@ * queue, it had not been sent to the device. After * the queue is removed, no other handling is required. */ - ASC_DBG1(1, "advansys_abort: scp %x found on waiting queue\n", - (unsigned) scp); + ASC_DBG1(1, "advansys_abort: scp %lx found on waiting queue\n", + (ulong) scp); scp_found = ASC_TRUE; scp->result = HOST_BYTE(DID_ABORT); ret = SCSI_ABORT_SUCCESS; @@ -6062,9 +6095,10 @@ scp->result = HOST_BYTE(DID_ABORT); /* sti(); XXX */ /* Enable interrupts for AscAbortSRB(). */ - ASC_DBG1(1, "advansys_abort: before AscAbortSRB(), scp %x\n", - (unsigned) scp); - switch (AscAbortSRB(asc_dvc_varp, (ulong) scp)) { + ASC_DBG1(1, "advansys_abort: before AscAbortSRB(), scp %lx\n", + (ulong) scp); + /* XXX */ + switch (AscAbortSRB(asc_dvc_varp, ASC_VADDR_TO_U32(scp))) { case ASC_TRUE: /* asc_isr_callback() will be called */ ASC_DBG(1, "advansys_abort: AscAbortSRB() TRUE\n"); @@ -6089,10 +6123,11 @@ adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; scp->result = HOST_BYTE(DID_ABORT); - ASC_DBG1(1, "advansys_abort: before AdvAbortQueue(), scp %x\n", - (unsigned) scp); + ASC_DBG1(1, + "advansys_abort: before AdvAbortQueue(), scp %lx\n", + (ulong) scp); #if 0 /* XXX */ - switch (AdvAbortQueue(adv_dvc_varp, (ulong) XXX)) { + switch (AdvAbortQueue(adv_dvc_varp, (ADV_VADDR) XXX)) { case ASC_TRUE: /* asc_isr_callback() will be called */ ASC_DBG(1, "advansys_abort: AdvAbortQueue() TRUE\n"); @@ -6173,13 +6208,13 @@ if (do_scsi_done == ASC_TRUE) { if (scp->scsi_done == NULL) { ASC_PRINT1( -"advansys_abort: aborted request scsi_done() is NULL, %x\n", - (unsigned) scp); +"advansys_abort: aborted request scsi_done() is NULL, %lx\n", + (ulong) scp); } else { if (scp_found == ASC_FALSE) { ASC_PRINT1( -"advansys_abort: abort request not active or waiting, completing anyway %x\n", - (unsigned) scp); +"advansys_abort: abort request not active or waiting, completing anyway %lx\n", + (ulong) scp); } ASC_STATS(scp->host, done); scp->scsi_done(scp); @@ -6234,7 +6269,7 @@ save_flags(flags); cli(); - ASC_DBG1(1, "advansys_reset: %x\n", (unsigned) scp); + ASC_DBG1(1, "advansys_reset: %lx\n", (ulong) scp); #ifdef ADVANSYS_STATS if (scp->host != NULL) { @@ -6246,8 +6281,8 @@ if ((reset_flags & SCSI_RESET_ASYNCHRONOUS) && (scp->serial_number != scp->serial_number_at_timeout)) { ASC_PRINT1( -"advansys_reset: timeout serial number changed for request %x\n", - (unsigned) scp); +"advansys_reset: timeout serial number changed for request %lx\n", + (ulong) scp); do_scsi_done = ASC_FALSE; scp_found = ASC_FALSE; ret = SCSI_RESET_NOT_RUNNING; @@ -6570,13 +6605,13 @@ if (do_scsi_done == ASC_TRUE) { if (scp->scsi_done == NULL) { ASC_PRINT1( -"advansys_reset: reset request scsi_done() is NULL, %x\n", - (unsigned) scp); +"advansys_reset: reset request scsi_done() is NULL, %lx\n", + (ulong) scp); } else { if (scp_found == ASC_FALSE) { ASC_PRINT1( -"advansys_reset: reset request not active or waiting, completing anyway %x\n", - (unsigned) scp); +"advansys_reset: reset request not active or waiting, completing anyway %lx\n", + (ulong) scp); } ASC_STATS(scp->host, done); scp->scsi_done(scp); @@ -6904,8 +6939,8 @@ device->queue_depth = boardp->dvc_var.adv_dvc_var.max_dvc_qng; } - ASC_DBG3(1, "advansys_select_queue_depths: shp %x, id %d, depth %d\n", - (unsigned) shp, device->id, device->queue_depth); + ASC_DBG3(1, "advansys_select_queue_depths: shp %lx, id %d, depth %d\n", + (ulong) shp, device->id, device->queue_depth); } } #endif /* version >= v1.3.89 */ @@ -6917,7 +6952,7 @@ STATIC void advansys_command_done(Scsi_Cmnd *scp) { - ASC_DBG1(1, "advansys_command_done: scp %x\n", (unsigned) scp); + ASC_DBG1(1, "advansys_command_done: scp %lx\n", (ulong) scp); scp->SCp.Status = 1; } @@ -6934,7 +6969,7 @@ ASC_DBG(2, "asc_scsi_done_list: begin\n"); while (scp != NULL) { - ASC_DBG1(3, "asc_scsi_done_list: scp %x\n", (unsigned) scp); + ASC_DBG1(3, "asc_scsi_done_list: scp %lx\n", (ulong) scp); tscp = REQPNEXT(scp); REQPNEXT(scp) = NULL; ASC_STATS(scp->host, done); @@ -7000,8 +7035,8 @@ int ret; ASC_ASSERT(interrupts_enabled() == ASC_FALSE); - ASC_DBG2(1, "asc_execute_scsi_cmnd: scp %x, done %x\n", - (unsigned) scp, (unsigned) scp->scsi_done); + ASC_DBG2(1, "asc_execute_scsi_cmnd: scp %lx, done %lx\n", + (ulong) scp, (ulong) scp->scsi_done); boardp = ASC_BOARDP(scp->host); device = boardp->device[scp->target]; @@ -7152,7 +7187,7 @@ /* * Point the ASC_SCSI_Q to the 'Scsi_Cmnd'. */ - asc_scsi_q.q2.srb_ptr = (ulong) scp; + asc_scsi_q.q2.srb_ptr = ASC_VADDR_TO_U32(scp); /* * Build the ASC_SCSI_Q request. @@ -7167,9 +7202,9 @@ asc_scsi_q.q1.target_lun = scp->lun; asc_scsi_q.q2.target_ix = ASC_TIDLUN_TO_IX(scp->target, scp->lun); #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - asc_scsi_q.q1.sense_addr = (ulong) &scp->sense_buffer[0]; + asc_scsi_q.q1.sense_addr = (ADV_PADDR) &scp->sense_buffer[0]; #else /* version >= v2.0.0 */ - asc_scsi_q.q1.sense_addr = virt_to_bus(&scp->sense_buffer[0]); + asc_scsi_q.q1.sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0])); #endif /* version >= v2.0.0 */ asc_scsi_q.q1.sense_len = sizeof(scp->sense_buffer); @@ -7201,9 +7236,10 @@ */ ASC_STATS(scp->host, cont_cnt); #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - asc_scsi_q.q1.data_addr = (ulong) scp->request_buffer; + asc_scsi_q.q1.data_addr = (ADV_PADDR) scp->request_buffer; #else /* version >= v2.0.0 */ - asc_scsi_q.q1.data_addr = virt_to_bus(scp->request_buffer); + asc_scsi_q.q1.data_addr = + cpu_to_le32(virt_to_bus(scp->request_buffer)); #endif /* version >= v2.0.0 */ asc_scsi_q.q1.data_cnt = scp->request_bufflen; ASC_STATS_ADD(scp->host, cont_xfer, @@ -7247,11 +7283,12 @@ slp = (struct scatterlist *) scp->request_buffer; for (sgcnt = 0; sgcnt < scp->use_sg; sgcnt++, slp++) { #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - asc_sg_head.sg_list[sgcnt].addr = (ulong) slp->address; + asc_sg_head.sg_list[sgcnt].addr = (ADV_PADDR) slp->address; #else /* version >= v2.0.0 */ - asc_sg_head.sg_list[sgcnt].addr = virt_to_bus(slp->address); + asc_sg_head.sg_list[sgcnt].addr = + cpu_to_le32(virt_to_bus(slp->address)); #endif /* version >= v2.0.0 */ - asc_sg_head.sg_list[sgcnt].bytes = slp->length; + asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(slp->length); ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512)); } } @@ -7267,6 +7304,10 @@ * * If an adv_req_t can not be allocated to issue the request, * then return ASC_BUSY. If an error occurs, then return ASC_ERROR. + * + * Multi-byte fields in the ASC_SCSI_REQ_Q that are used by the + * microcode for DMA addresses or math operations are byte swapped + * to little-endian order. */ STATIC int adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, @@ -7275,6 +7316,7 @@ adv_req_t *reqp; ADV_SCSI_REQ_Q *scsiqp; int i; + int ret; /* * Allocate an adv_req_t structure from the board to execute @@ -7294,12 +7336,16 @@ * Get 4-byte aligned ADV_SCSI_REQ_Q and ADV_SG_BLOCK pointers. */ scsiqp = (ADV_SCSI_REQ_Q *) ADV_DWALIGN(&reqp->scsi_req_q); - memset(scsiqp, 0, sizeof(ADV_SCSI_REQ_Q)); + + /* + * Initialize the structure. + */ + scsiqp->cntl = scsiqp->scsi_cntl = scsiqp->done_status = 0; /* * Set the ADV_SCSI_REQ_Q 'srb_ptr' to point to the adv_req_t structure. */ - scsiqp->srb_ptr = (ulong) reqp; + scsiqp->srb_ptr = ASC_VADDR_TO_U32(reqp); /* * Set the adv_req_t 'cmndp' to point to the Scsi_Cmnd structure. @@ -7326,9 +7372,9 @@ scsiqp->target_lun = scp->lun; #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - scsiqp->sense_addr = (ulong) &scp->sense_buffer[0]; + scsiqp->sense_addr = (ADV_PADDR) &scp->sense_buffer[0]; #else /* version >= v2.0.0 */ - scsiqp->sense_addr = virt_to_bus(&scp->sense_buffer[0]); + scsiqp->sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0])); #endif /* version >= v2.0.0 */ scsiqp->sense_len = sizeof(scp->sense_buffer); @@ -7336,12 +7382,12 @@ * Build ADV_SCSI_REQ_Q for a contiguous buffer or a scatter-gather * buffer command. */ - scsiqp->data_cnt = scp->request_bufflen; - scsiqp->vdata_addr = (ulong) scp->request_buffer; + scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen); + scsiqp->vdata_addr = scp->request_buffer; #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - scsiqp->data_addr = (ulong) scp->request_buffer; + scsiqp->data_addr = (ADV_PADDR) scp->request_buffer; #else /* version >= v2.0.0 */ - scsiqp->data_addr = virt_to_bus(scp->request_buffer); + scsiqp->data_addr = cpu_to_le32(virt_to_bus(scp->request_buffer)); #endif /* version >= v2.0.0 */ if (scp->use_sg == 0) { @@ -7350,6 +7396,7 @@ */ reqp->sgblkp = NULL; scsiqp->sg_list_ptr = NULL; + scsiqp->sg_real_addr = 0; ASC_STATS(scp->host, cont_cnt); ASC_STATS_ADD(scp->host, cont_xfer, ASC_CEILING(scp->request_bufflen, 512)); @@ -7374,46 +7421,7 @@ return ASC_ERROR; } - /* - * Allocate an 'adv_sgblk_t' structure from the board to - * execute the command. - */ - if (boardp->adv_sgblkp == NULL) { - ASC_DBG(1, "adv_build_req: no free adv_sgblk_t\n"); - ASC_STATS(scp->host, adv_build_nosg); - /* - * Free the 'adv_req_t' structure by adding it back to the - * board free list. - */ - reqp->next_reqp = boardp->adv_reqp; - boardp->adv_reqp = reqp; - return ASC_BUSY; - } else { - reqp->sgblkp = boardp->adv_sgblkp; - boardp->adv_sgblkp = reqp->sgblkp->next_sgblkp; - reqp->sgblkp->next_sgblkp = NULL; - } - - /* - * Build scatter-gather list. - */ - scsiqp->sg_list_ptr = (ADV_SG_BLOCK *) - ADV_DWALIGN(&reqp->sgblkp->sg_block[0]); - - memset(scsiqp->sg_list_ptr, 0, sizeof(ADV_SG_BLOCK) * - (ADV_NUM_SG_BLOCK + ADV_NUM_PAGE_CROSSING)); - - if (adv_get_sglist(&boardp->dvc_var.adv_dvc_var, scsiqp, scp) == - ADV_ERROR) { - - /* - * Free the adv_sgblk_t structure, if any, by adding it back - * to the board free list. - */ - ASC_ASSERT(reqp->sgblkp != NULL); - reqp->sgblkp->next_sgblkp = boardp->adv_sgblkp; - boardp->adv_sgblkp = reqp->sgblkp; - + if ((ret = adv_get_sglist(boardp, reqp, scp)) != ADV_SUCCESS) { /* * Free the adv_req_t structure by adding it back to the * board free list. @@ -7421,7 +7429,7 @@ reqp->next_reqp = boardp->adv_reqp; boardp->adv_reqp = reqp; - return ADV_ERROR; + return ret; } ASC_STATS(scp->host, sg_cnt); @@ -7439,65 +7447,124 @@ /* * Build scatter-gather list for Adv Library (Wide Board). * + * Additional ADV_SG_BLOCK structures will need to be allocated + * if the total number of scatter-gather elements exceeds + * NO_OF_SG_PER_BLOCK (15). The ADV_SG_BLOCK structures are + * assumed to be physically contiguous. + * * Return: * ADV_SUCCESS(1) - SG List successfully created * ADV_ERROR(-1) - SG List creation failed */ STATIC int -adv_get_sglist(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp, - Scsi_Cmnd *scp) +adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp) { - ADV_SG_BLOCK *sg_block; /* virtual address of a SG */ - ulong sg_block_next_addr; /* block and its next */ - ulong sg_block_physical_addr; - int i; + adv_sgblk_t *sgblkp; + ADV_SCSI_REQ_Q *scsiqp; struct scatterlist *slp; int sg_elem_cnt; + ADV_SG_BLOCK *sg_block, *prev_sg_block; + ADV_PADDR sg_block_paddr; + int i; + scsiqp = (ADV_SCSI_REQ_Q *) ADV_DWALIGN(&reqp->scsi_req_q); slp = (struct scatterlist *) scp->request_buffer; sg_elem_cnt = scp->use_sg; + prev_sg_block = NULL; + + ASC_ASSERT(reqp->sgblkp == NULL); + do + { + /* + * Allocate a 'adv_sgblk_t' structure from the board free + * list. One 'adv_sgblk_t' structure holds NO_OF_SG_PER_BLOCK + * (15) scatter-gather elements. + */ + if ((sgblkp = boardp->adv_sgblkp) == NULL) { + ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n"); + ASC_STATS(scp->host, adv_build_nosg); + + /* + * Allocation failed. Free 'adv_sgblk_t' structures already + * allocated for the request. + */ + while ((sgblkp = reqp->sgblkp) != NULL) + { + /* Remove 'sgblkp' from the request list. */ + reqp->sgblkp = sgblkp->next_sgblkp; + + /* Add 'sgblkp' to the board free list. */ + sgblkp->next_sgblkp = boardp->adv_sgblkp; + boardp->adv_sgblkp = sgblkp; + } + return ASC_BUSY; + } else { + /* Complete 'adv_sgblk_t' board allocation. */ + boardp->adv_sgblkp = sgblkp->next_sgblkp; + sgblkp->next_sgblkp = NULL; - sg_block = scsiqp->sg_list_ptr; - sg_block_next_addr = (ulong) sg_block; /* allow math operation */ - sg_block_physical_addr = + /* + * Get 4 byte aligned virtual and physical addresses for + * the allocated ADV_SG_BLOCK structure. + */ + sg_block = (ADV_SG_BLOCK *) ADV_DWALIGN(&sgblkp->sg_block); + sg_block_paddr = #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - (ulong) scsiqp->sg_list_ptr; + (ADV_PADDR) sg_block; #else /* version >= v2.0.0 */ - virt_to_bus(scsiqp->sg_list_ptr); + virt_to_bus(sg_block); #endif /* version >= v2.0.0 */ - ADV_ASSERT(ADV_DWALIGN(sg_block_physical_addr) == - sg_block_physical_addr); - scsiqp->sg_real_addr = sg_block_physical_addr; - do - { + /* + * Check if this is the first 'adv_sgblk_t' for the request. + */ + if (reqp->sgblkp == NULL) + { + /* Request's first scatter-gather block. */ + reqp->sgblkp = sgblkp; + + /* + * Set ADV_SCSI_REQ_T ADV_SG_BLOCK virtual and physical + * address pointers. + */ + scsiqp->sg_list_ptr = sg_block; + scsiqp->sg_real_addr = cpu_to_le32(sg_block_paddr); + } else + { + /* Request's second or later scatter-gather block. */ + sgblkp->next_sgblkp = reqp->sgblkp; + reqp->sgblkp = sgblkp; + + /* + * Point the previous ADV_SG_BLOCK structure to + * the newly allocated ADV_SG_BLOCK structure. + */ + ASC_ASSERT(prev_sg_block != NULL); + prev_sg_block->sg_ptr = cpu_to_le32(sg_block_paddr); + } + } + for (i = 0; i < NO_OF_SG_PER_BLOCK; i++) { sg_block->sg_list[i].sg_addr = #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - (ulong) slp->address; + (ADV_PADDR) slp->address; #else /* version >= v2.0.0 */ - virt_to_bus(slp->address); + cpu_to_le32(virt_to_bus(slp->address)); #endif /* version >= v2.0.0 */ - sg_block->sg_list[i].sg_count = slp->length; + sg_block->sg_list[i].sg_count = cpu_to_le32(slp->length); ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512)); if (--sg_elem_cnt == 0) - { /* last entry, get out */ + { /* Last ADV_SG_BLOCK and scatter-gather entry. */ sg_block->sg_cnt = i + 1; - sg_block->sg_ptr = 0L; /* next link = NULL */ + sg_block->sg_ptr = 0L; /* Last ADV_SG_BLOCK in list. */ return ADV_SUCCESS; } slp++; - } + } sg_block->sg_cnt = NO_OF_SG_PER_BLOCK; - sg_block_next_addr += sizeof(ADV_SG_BLOCK); - sg_block_physical_addr += sizeof(ADV_SG_BLOCK); - ADV_ASSERT(ADV_DWALIGN(sg_block_physical_addr) == - sg_block_physical_addr); - - sg_block->sg_ptr = (ADV_SG_BLOCK *) sg_block_physical_addr; - sg_block = (ADV_SG_BLOCK *) sg_block_next_addr; /* virtual addr */ + prev_sg_block = sg_block; } while (1); /* NOTREACHED */ @@ -7514,20 +7581,19 @@ asc_board_t *boardp; Scsi_Cmnd *scp; struct Scsi_Host *shp; - int underrun = ASC_FALSE; int i; ASC_ASSERT(interrupts_enabled() == ASC_FALSE); - ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp %x, qdonep %x\n", - (unsigned) asc_dvc_varp, (unsigned) qdonep); + ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp %lx, qdonep %lx\n", + (ulong) asc_dvc_varp, (ulong) qdonep); ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep); /* * Get the Scsi_Cmnd structure and Scsi_Host structure for the * command that has been completed. */ - scp = (Scsi_Cmnd *) qdonep->d2.srb_ptr; - ASC_DBG1(1, "asc_isr_callback: scp %x\n", (unsigned) scp); + scp = (Scsi_Cmnd *) ASC_U32_TO_VADDR(qdonep->d2.srb_ptr); + ASC_DBG1(1, "asc_isr_callback: scp %lx\n", (ulong) scp); if (scp == NULL) { ASC_PRINT("asc_isr_callback: scp is NULL\n"); @@ -7546,13 +7612,14 @@ } } if (i == asc_board_count) { - ASC_PRINT2("asc_isr_callback: scp %x has bad host pointer, host %x\n", - (unsigned) scp, (unsigned) shp); + ASC_PRINT2( + "asc_isr_callback: scp %lx has bad host pointer, host %lx\n", + (ulong) scp, (ulong) shp); return; } ASC_STATS(shp, callback); - ASC_DBG1(1, "asc_isr_callback: shp %x\n", (unsigned) shp); + ASC_DBG1(1, "asc_isr_callback: shp %lx\n", (ulong) shp); /* * If the request isn't found on the active queue, it may @@ -7562,36 +7629,19 @@ boardp = ASC_BOARDP(shp); ASC_ASSERT(asc_dvc_varp == &boardp->dvc_var.asc_dvc_var); if (asc_rmqueue(&boardp->active, scp) == ASC_FALSE) { - ASC_PRINT2("asc_isr_callback: board %d: scp %x not on active queue\n", - boardp->id, (unsigned) scp); + ASC_PRINT2( + "asc_isr_callback: board %d: scp %lx not on active queue\n", + boardp->id, (ulong) scp); return; } /* - * Check for an underrun condition. - */ - if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 && - qdonep->remain_bytes <= scp->request_bufflen != 0) { - ASC_DBG1(1, "asc_isr_callback: underrun condition %u bytes\n", - (unsigned) qdonep->remain_bytes); - underrun = ASC_TRUE; - } - - /* * 'qdonep' contains the command's ending status. */ switch (qdonep->d3.done_stat) { case QD_NO_ERROR: ASC_DBG(2, "asc_isr_callback: QD_NO_ERROR\n"); - switch (qdonep->d3.host_stat) { - case QHSTA_NO_ERROR: - scp->result = 0; - break; - default: - /* QHSTA error occurred */ - scp->result = HOST_BYTE(DID_ERROR); - break; - } + scp->result = 0; /* * If an INQUIRY command completed successfully, then call @@ -7604,16 +7654,20 @@ (ASC_SCSI_INQUIRY *) scp->request_buffer); } +#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,3,19) /* - * If there was an underrun without any other error, - * set DID_ERROR to indicate the underrun error. + * Check for an underrun condition. * - * Note: There is no way yet to indicate the number - * of underrun bytes. + * If there was no error and an underrun condition, then + * then return the number of underrun bytes. */ - if (scp->result == 0 && underrun == ASC_TRUE) { - scp->result = HOST_BYTE(DID_UNDERRUN); + if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 && + qdonep->remain_bytes <= scp->request_bufflen != 0) { + ASC_DBG1(1, "asc_isr_callback: underrun condition %u bytes\n", + (unsigned) qdonep->remain_bytes); + scp->resid = qdonep->remain_bytes; } +#endif /* version >= v2.3.19 */ break; case QD_WITH_ERROR: @@ -7695,14 +7749,14 @@ { asc_board_t *boardp; adv_req_t *reqp; + adv_sgblk_t *sgblkp; Scsi_Cmnd *scp; struct Scsi_Host *shp; - int underrun = ASC_FALSE; int i; ASC_ASSERT(interrupts_enabled() == ASC_FALSE); - ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp %x, scsiqp %x\n", - (unsigned) adv_dvc_varp, (unsigned) scsiqp); + ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp %lx, scsiqp %lx\n", + (ulong) adv_dvc_varp, (ulong) scsiqp); ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp); /* @@ -7710,8 +7764,8 @@ * completed. The adv_req_t structure actually contains the * completed ADV_SCSI_REQ_Q structure. */ - reqp = (adv_req_t *) scsiqp->srb_ptr; - ASC_DBG1(1, "adv_isr_callback: reqp %x\n", (unsigned) reqp); + reqp = (adv_req_t *) ADV_U32_TO_VADDR(scsiqp->srb_ptr); + ASC_DBG1(1, "adv_isr_callback: reqp %lx\n", (ulong) reqp); if (reqp == NULL) { ASC_PRINT("adv_isr_callback: reqp is NULL\n"); return; @@ -7726,7 +7780,7 @@ * determined. */ scp = reqp->cmndp; - ASC_DBG1(1, "adv_isr_callback: scp %x\n", (unsigned) scp); + ASC_DBG1(1, "adv_isr_callback: scp %lx\n", (ulong) scp); if (scp == NULL) { ASC_PRINT("adv_isr_callback: scp is NULL; adv_req_t dropped.\n"); return; @@ -7748,13 +7802,14 @@ * structure and adv_sgblk_t structure, if any, is dropped. */ if (i == asc_board_count) { - ASC_PRINT2("adv_isr_callback: scp %x has bad host pointer, host %x\n", - (unsigned) scp, (unsigned) shp); + ASC_PRINT2( + "adv_isr_callback: scp %lx has bad host pointer, host %lx\n", + (ulong) scp, (ulong) shp); return; } ASC_STATS(shp, callback); - ASC_DBG1(1, "adv_isr_callback: shp %x\n", (unsigned) shp); + ASC_DBG1(1, "adv_isr_callback: shp %lx\n", (ulong) shp); /* * If the request isn't found on the active queue, it may have been @@ -7767,47 +7822,34 @@ boardp = ASC_BOARDP(shp); ASC_ASSERT(adv_dvc_varp == &boardp->dvc_var.adv_dvc_var); if (asc_rmqueue(&boardp->active, scp) == ASC_FALSE) { - ASC_PRINT2("adv_isr_callback: board %d: scp %x not on active queue\n", - boardp->id, (unsigned) scp); + ASC_PRINT2( + "adv_isr_callback: board %d: scp %lx not on active queue\n", + boardp->id, (ulong) scp); return; } /* - * Check for an underrun condition. - */ - if (scp->request_bufflen != 0 && scsiqp->data_cnt != 0) { - ASC_DBG1(1, "adv_isr_callback: underrun condition %lu bytes\n", - scsiqp->data_cnt); - underrun = ASC_TRUE; - } - - /* * 'done_status' contains the command's ending status. */ switch (scsiqp->done_status) { case QD_NO_ERROR: ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n"); - switch (scsiqp->host_status) { - case QHSTA_NO_ERROR: - scp->result = 0; - break; - default: - /* QHSTA error occurred. */ - ASC_DBG1(2, "adv_isr_callback: host_status %x\n", - scsiqp->host_status); - scp->result = HOST_BYTE(DID_ERROR); - break; - } + scp->result = 0; + +#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,3,19) /* - * If there was an underrun without any other error, - * set DID_ERROR to indicate the underrun error. + * Check for an underrun condition. * - * Note: There is no way yet to indicate the number - * of underrun bytes. + * If there was no error and an underrun condition, then + * then return the number of underrun bytes. */ - if (scp->result == 0 && underrun == ASC_TRUE) { - scp->result = HOST_BYTE(DID_UNDERRUN); + if (scp->request_bufflen != 0 && scsiqp->data_cnt != 0 && + scsiqp->data_cnt <= scp->request_bufflen) { + ASC_DBG1(1, "adv_isr_callback: underrun condition %lu bytes\n", + (ulong) scsiqp->data_cnt); + scp->resid = scsiqp->data_cnt; } +#endif /* version >= v2.3.19 */ break; case QD_WITH_ERROR: @@ -7875,12 +7917,16 @@ asc_enqueue(&boardp->done, scp, ASC_BACK); /* - * Free the adv_sgblk_t structure, if any, by adding it back - * to the board free list. + * Free all 'adv_sgblk_t' structures allocated for the request. */ - if (reqp->sgblkp != NULL) { - reqp->sgblkp->next_sgblkp = boardp->adv_sgblkp; - boardp->adv_sgblkp = reqp->sgblkp; + while ((sgblkp = reqp->sgblkp) != NULL) + { + /* Remove 'sgblkp' from the request list. */ + reqp->sgblkp = sgblkp->next_sgblkp; + + /* Add 'sgblkp' to the board free list. */ + sgblkp->next_sgblkp = boardp->adv_sgblkp; + boardp->adv_sgblkp = sgblkp; } /* @@ -8101,15 +8147,15 @@ ) { ushort tmp; - ulong address; - ulong lbus = pciData->bus; - ulong lslot = pciData->slot; - ulong lfunc = pciData->func; + ADV_DCNT address; + ADV_DCNT lbus = pciData->bus; + ADV_DCNT lslot = pciData->slot; + ADV_DCNT lfunc = pciData->func; uchar t2CFA, t2CF8; - ulong t1CF8, t1CFC; + ADV_DCNT t1CF8, t1CFC; - ASC_DBG4(4, "asc_get_cfg_word: type %d, bus %lu, slot %lu, func %lu\n", - pciData->type, lbus, lslot, lfunc); + ASC_DBG4(4, "asc_get_cfg_word: type %d, bus %u, slot %u, func %u\n", + pciData->type, (unsigned) lbus, (unsigned) lslot, (unsigned) lfunc); /* * Check type of configuration mechanism. @@ -8149,7 +8195,7 @@ * enable <31>, bus = <23:16>, slot = <15:11>, * func = <10:8>, reg = <7:2> */ - address = (ulong) ((lbus << 16) | (lslot << 11) | + address = (ADV_DCNT) ((lbus << 16) | (lslot << 11) | (lfunc << 8) | (pciData->offset & 0xFC) | 0x80000000L); /* @@ -8183,11 +8229,11 @@ asc_get_cfg_byte(PCI_DATA *pciData) ) { - uchar tmp; - ulong address; - ulong lbus = pciData->bus, lslot = pciData->slot, lfunc = pciData->func; - uchar t2CFA, t2CF8; - ulong t1CF8, t1CFC; + uchar tmp; + ADV_DCNT address; + ADV_DCNT lbus = pciData->bus, lslot = pciData->slot, lfunc = pciData->func; + ADV_DCNT t2CFA, t2CF8; + ADV_DCNT t1CF8, t1CFC; ASC_DBG1(4, "asc_get_cfg_byte: type: %d\n", pciData->type); @@ -8232,7 +8278,7 @@ * enable <31>, bus = <23:16>, slot = <15:11>, func = <10:8>, * reg = <7:2> */ - address = (ulong) ((lbus << 16) | (lslot << 11) | + address = (ADV_DCNT) ((lbus << 16) | (lslot << 11) | (lfunc << 8) | (pciData->offset & 0xFC) | 0x80000000L); /* @@ -8263,11 +8309,11 @@ asc_put_cfg_byte(PCI_DATA *pciData, uchar byte_data) ) { - ulong tmpl; - ulong address; - ulong lbus = pciData->bus, lslot = pciData->slot, lfunc = pciData->func; - uchar t2CFA, t2CF8; - ulong t1CF8, t1CFC; + ADV_DCNT tmpl; + ADV_DCNT address; + ADV_DCNT lbus = pciData->bus, lslot = pciData->slot, lfunc = pciData->func; + uchar t2CFA, t2CF8; + ADV_DCNT t1CF8, t1CFC; ASC_DBG2(4, "asc_put_cfg_byte: type: %d, byte_data %x\n", pciData->type, byte_data); @@ -8317,7 +8363,7 @@ * enable <31>, bus = <23:16>, slot = <15:11>, func = <10:8>, * reg = <7:2> */ - address = (ulong) ((lbus << 16) | (lslot << 11) | (lfunc << 8) | + address = (ADV_DCNT) ((lbus << 16) | (lslot << 11) | (lfunc << 8) | (pciData->offset & 0xFC) | 0x80000000L); /* * Write out address to CONFIG_ADDRESS. @@ -8355,8 +8401,8 @@ { int tid; - ASC_DBG3(3, "asc_enqueue: ascq %x, reqp %x, flag %d\n", - (unsigned) ascq, (unsigned) reqp, flag); + ASC_DBG3(3, "asc_enqueue: ascq %lx, reqp %lx, flag %d\n", + (ulong) ascq, (ulong) reqp, flag); ASC_ASSERT(interrupts_enabled() == ASC_FALSE); ASC_ASSERT(reqp != NULL); ASC_ASSERT(flag == ASC_FRONT || flag == ASC_BACK); @@ -8393,7 +8439,7 @@ } REQPTIME(reqp) = REQTIMESTAMP(); #endif /* ADVANSYS_STATS */ - ASC_DBG1(3, "asc_enqueue: reqp %x\n", (unsigned) reqp); + ASC_DBG1(3, "asc_enqueue: reqp %lx\n", (ulong) reqp); return; } @@ -8409,7 +8455,7 @@ { REQP reqp; - ASC_DBG2(3, "asc_dequeue: ascq %x, tid %d\n", (unsigned) ascq, tid); + ASC_DBG2(3, "asc_dequeue: ascq %lx, tid %d\n", (ulong) ascq, tid); ASC_ASSERT(interrupts_enabled() == ASC_FALSE); ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID); if ((reqp = ascq->q_first[tid]) != NULL) { @@ -8428,7 +8474,7 @@ REQTIMESTAT("asc_dequeue", ascq, reqp, tid); #endif /* ADVANSYS_STATS */ } - ASC_DBG1(3, "asc_dequeue: reqp %x\n", (unsigned) reqp); + ASC_DBG1(3, "asc_dequeue: reqp %lx\n", (ulong) reqp); return reqp; } @@ -8458,7 +8504,7 @@ REQP firstp, lastp; int i; - ASC_DBG2(3, "asc_dequeue_list: ascq %x, tid %d\n", (unsigned) ascq, tid); + ASC_DBG2(3, "asc_dequeue_list: ascq %lx, tid %d\n", (ulong) ascq, tid); ASC_ASSERT(interrupts_enabled() == ASC_FALSE); ASC_ASSERT((tid == ASC_TID_ALL) || (tid >= 0 && tid <= ADV_MAX_TID)); @@ -8519,7 +8565,7 @@ if (lastpp) { *lastpp = lastp; } - ASC_DBG1(3, "asc_dequeue_list: firstp %x\n", (unsigned) firstp); + ASC_DBG1(3, "asc_dequeue_list: firstp %lx\n", (ulong) firstp); return firstp; } @@ -8540,8 +8586,8 @@ int tid; int ret = ASC_FALSE; - ASC_DBG2(3, "asc_rmqueue: ascq %x, reqp %x\n", - (unsigned) ascq, (unsigned) reqp); + ASC_DBG2(3, "asc_rmqueue: ascq %lx, reqp %lx\n", + (ulong) ascq, (ulong) reqp); ASC_ASSERT(interrupts_enabled() == ASC_FALSE); ASC_ASSERT(reqp != NULL); @@ -8593,7 +8639,7 @@ } ASC_ASSERT(ascq->q_cur_cnt[tid] >= 0); #endif /* ADVANSYS_STATS */ - ASC_DBG2(3, "asc_rmqueue: reqp %x, ret %d\n", (unsigned) reqp, ret); + ASC_DBG2(3, "asc_rmqueue: reqp %lx, ret %d\n", (ulong) reqp, ret); return ret; } @@ -8608,8 +8654,8 @@ int tid; int ret = ASC_FALSE; - ASC_DBG2(3, "asc_isqueued: ascq %x, reqp %x\n", - (unsigned) ascq, (unsigned) reqp); + ASC_DBG2(3, "asc_isqueued: ascq %lx, reqp %lx\n", + (ulong) ascq, (ulong) reqp); ASC_ASSERT(interrupts_enabled() == ASC_FALSE); ASC_ASSERT(reqp != NULL); @@ -8639,7 +8685,7 @@ REQP reqp; int i; - ASC_DBG1(1, "asc_execute_queue: ascq %x\n", (unsigned) ascq); + ASC_DBG1(1, "asc_execute_queue: ascq %lx\n", (ulong) ascq); ASC_ASSERT(interrupts_enabled() == ASC_FALSE); /* * Execute queued commands for devices attached to @@ -8723,7 +8769,6 @@ int leftlen; int totlen; int len; - int upgrade = ASC_FALSE; ushort major, minor, letter; boardp = ASC_BOARDP(shp); @@ -8738,9 +8783,14 @@ * the BIOS code segment base address. */ if (boardp->bios_signature != 0x55AA) { - len = asc_prt_line(cp, leftlen, "Pre-3.1\n"); + len = asc_prt_line(cp, leftlen, "Disabled or Pre-3.1\n"); + ASC_PRT_NEXT(); + len = asc_prt_line(cp, leftlen, +"BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"); + ASC_PRT_NEXT(); + len = asc_prt_line(cp, leftlen, +"can be found at the AdvanSys FTP site: ftp://ftp.advansys.com/pub\n"); ASC_PRT_NEXT(); - upgrade = ASC_TRUE; } else { major = (boardp->bios_version >> 12) & 0xF; minor = (boardp->bios_version >> 8) & 0xF; @@ -8750,16 +8800,20 @@ major, minor, letter >= 26 ? '?' : letter + 'A'); ASC_PRT_NEXT(); - /* Current available ROM BIOS release is 3.1C. */ + /* + * Current available ROM BIOS release is 3.1I for UW + * and 3.2I for U2W. This code doesn't differentiate + * UW and U2W boards. + */ if (major < 3 || (major <= 3 && minor < 1) || - (major <= 3 && minor <= 1 && letter < ('C'- 'A'))) { - upgrade = ASC_TRUE; - } - } - if (upgrade == ASC_TRUE) { - len = asc_prt_line(cp, leftlen, -"Newer version of ROM BIOS available: ftp://ftp.advansys.com/pub\n"); + (major <= 3 && minor <= 1 && letter < ('I'- 'A'))) { + len = asc_prt_line(cp, leftlen, +"Newer version of ROM BIOS is available at the AdvanSys FTP site:\n"); + ASC_PRT_NEXT(); + len = asc_prt_line(cp, leftlen, +"ftp://ftp.advansys.com/pub\n"); ASC_PRT_NEXT(); + } } return totlen; @@ -9803,16 +9857,16 @@ if (offset <= advoffset) { /* Read offset below current offset, copy everything. */ cnt = ASC_MIN(cplen, leftlen); - ASC_DBG3(2, "asc_proc_copy: curbuf %x, cp %x, cnt %d\n", - (unsigned) curbuf, (unsigned) cp, cnt); + ASC_DBG3(2, "asc_proc_copy: curbuf %lx, cp %lx, cnt %d\n", + (ulong) curbuf, (ulong) cp, cnt); memcpy(curbuf, cp, cnt); } else if (offset < advoffset + cplen) { /* Read offset within current range, partial copy. */ cnt = (advoffset + cplen) - offset; cp = (cp + cplen) - cnt; cnt = ASC_MIN(cnt, leftlen); - ASC_DBG3(2, "asc_proc_copy: curbuf %x, cp %x, cnt %d\n", - (unsigned) curbuf, (unsigned) cp, cnt); + ASC_DBG3(2, "asc_proc_copy: curbuf %lx, cp %lx, cnt %d\n", + (ulong) curbuf, (ulong) cp, cnt); memcpy(curbuf, cp, cnt); } return cnt; @@ -9863,13 +9917,13 @@ * called when interrupts are disabled. */ STATIC void -DvcSleepMilliSecond(ulong n) +DvcSleepMilliSecond(ADV_DCNT n) { #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,1,0) - ulong i; + ADV_DCNT i; #endif /* version < v2.1.0 */ - ASC_DBG1(4, "DvcSleepMilliSecond: %lu\n", n); + ASC_DBG1(4, "DvcSleepMilliSecond: %lu\n", (ulong) n); #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,1,0) mdelay(n); #else /* version < v2.1.0 */ @@ -9895,16 +9949,16 @@ restore_flags(flags); } -STATIC ulong -DvcGetSGList(ASC_DVC_VAR *asc_dvc_sg, uchar *buf_addr, ulong buf_len, +STATIC ADV_DCNT +DvcGetSGList(ASC_DVC_VAR *asc_dvc_sg, uchar *buf_addr, ADV_DCNT buf_len, ASC_SG_HEAD *asc_sg_head_ptr) { - ulong buf_size; + ADV_DCNT buf_size; buf_size = buf_len; asc_sg_head_ptr->entry_cnt = 1; #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - asc_sg_head_ptr->sg_list[0].addr = (ulong) buf_addr; + asc_sg_head_ptr->sg_list[0].addr = (ADV_PADDR) buf_addr; #else /* version >= v2.0.0 */ asc_sg_head_ptr->sg_list[0].addr = virt_to_bus(buf_addr); #endif /* version >= v2.0.0 */ @@ -9999,7 +10053,7 @@ } /* - * void DvcOutPortDWords(PortAddr port, ulong *pdw, int dwords) + * void DvcOutPortDWords(PortAddr port, ADV_DCNT *pdw, int dwords) * * Calling/Exit State: * none @@ -10009,10 +10063,10 @@ * 16 bit integer units */ STATIC void -DvcOutPortDWords(PortAddr port, ulong *pdw, int dwords) +DvcOutPortDWords(PortAddr port, ADV_DCNT *pdw, int dwords) { - int i; - int words; + int i; + int words; ushort *pw; pw = (ushort *) pdw; @@ -10029,7 +10083,7 @@ ASC_INITFUNC( STATIC uchar, DvcReadPCIConfigByte( - ASC_DVC_VAR asc_ptr_type *asc_dvc, + ASC_DVC_VAR *asc_dvc, ushort offset) ) { @@ -10066,7 +10120,7 @@ ASC_INITFUNC( STATIC void, DvcWritePCIConfigByte( - ASC_DVC_VAR asc_ptr_type *asc_dvc, + ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) ) @@ -10157,21 +10211,21 @@ * Note: Because Linux currently doesn't page the kernel and all * kernel buffers are physically contiguous, leave '*lenp' unchanged. */ -ulong +ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq, - uchar *vaddr, long *lenp, int flag) + uchar *vaddr, ADV_SDCNT *lenp, int flag) { - ulong paddr; + ADV_PADDR paddr; #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0) - paddr = (ulong) vaddr; + paddr = (ADV_PADDR) vaddr; #else /* version >= v2.0.0 */ paddr = virt_to_bus(vaddr); #endif /* version >= v2.0.0 */ ASC_DBG4(4, "DvcGetPhyAddr: vaddr 0x%lx, lenp 0x%lx *lenp %lu, paddr 0x%lx\n", - (ulong) vaddr, (ulong) lenp, (ulong) *((ulong *) lenp), paddr); + (ulong) vaddr, (ulong) lenp, (ulong) *((ulong *) lenp), (ulong) paddr); return paddr; } @@ -10421,15 +10475,15 @@ boardp = ASC_BOARDP(s); - printk("Scsi_Host at addr %x\n", (unsigned) s); + printk("Scsi_Host at addr %lx\n", (ulong) s); printk( -" next %x, extra_bytes %u, host_busy %u, host_no %d, last_reset %d,\n", - (unsigned) s->next, s->extra_bytes, s->host_busy, s->host_no, +" next %lx, extra_bytes %u, host_busy %u, host_no %d, last_reset %d,\n", + (ulong) s->next, s->extra_bytes, s->host_busy, s->host_no, (unsigned) s->last_reset); printk( -" host_queue %x, hostt %x, block %x,\n", - (unsigned) s->host_queue, (unsigned) s->hostt, (unsigned) s->block); +" host_queue %lx, hostt %lx, block %lx,\n", + (ulong) s->host_queue, (ulong) s->hostt, (ulong) s->block); printk( " wish_block %d, base %lu, io_port %lu, n_io_port %u, irq %d,\n", @@ -10460,7 +10514,7 @@ STATIC void asc_prt_scsi_cmnd(Scsi_Cmnd *s) { - printk("Scsi_Cmnd at addr %x\n", (unsigned) s); + printk("Scsi_Cmnd at addr %lx\n", (ulong) s); #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(1,3,0) printk( @@ -10468,8 +10522,8 @@ (unsigned) s->host, (unsigned) s->device, s->target, s->lun); #else /* version >= v1.3.0 */ printk( -" host %x, device %x, target %u, lun %u, channel %u,\n", - (unsigned) s->host, (unsigned) s->device, s->target, s->lun, +" host %lx, device %lx, target %u, lun %u, channel %u,\n", + (ulong) s->host, (ulong) s->device, s->target, s->lun, s->channel); #endif /* version >= v1.3.0 */ @@ -10499,9 +10553,9 @@ s->internal_timeout, s->flags, s->this_count); printk( -" scsi_done %x, done %x, host_scribble %x, result %x\n", - (unsigned) s->scsi_done, (unsigned) s->done, - (unsigned) s->host_scribble, s->result); +" scsi_done %lx, done %lx, host_scribble %lx, result %x\n", + (ulong) s->scsi_done, (ulong) s->done, + (ulong) s->host_scribble, s->result); printk( " tag %u, pid %u\n", @@ -10514,15 +10568,15 @@ STATIC void asc_prt_asc_dvc_var(ASC_DVC_VAR *h) { - printk("ASC_DVC_VAR at addr %x\n", (unsigned) h); + printk("ASC_DVC_VAR at addr %lx\n", (ulong) h); printk( " iop_base %x, err_code %x, dvc_cntl %x, bug_fix_cntl %d,\n", h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl); printk( -" bus_type %d, isr_callback %x, exe_callback %x, init_sdtr %x,\n", - h->bus_type, (unsigned) h->isr_callback, (unsigned) h->exe_callback, +" bus_type %d, isr_callback %lx, exe_callback %lx, init_sdtr %x,\n", + h->bus_type, (ulong) h->isr_callback, (ulong) h->exe_callback, (unsigned) h->init_sdtr); printk( @@ -10546,8 +10600,8 @@ (unsigned) h->no_scam, (unsigned) h->pci_fix_asyn_xfer); printk( -" cfg %x, saved_ptr2func %x\n", - (unsigned) h->cfg, (unsigned) h->saved_ptr2func); +" cfg %lx\n", + (ulong) h->cfg); } /* @@ -10556,7 +10610,7 @@ STATIC void asc_prt_asc_dvc_cfg(ASC_DVC_CFG *h) { - printk("ASC_DVC_CFG at addr %x\n", (unsigned) h); + printk("ASC_DVC_CFG at addr %lx\n", (ulong) h); printk( " can_tagged_qng %x, cmd_qng_enabled %x, disc_enable %x, sdtr_enable %x,\n", @@ -10573,8 +10627,8 @@ h->pci_device_id, h->lib_serial_no, h->lib_version, h->mcode_date); printk( -" mcode_version %d, overrun_buf %x\n", - h->mcode_version, (unsigned) h->overrun_buf); +" mcode_version %d, overrun_buf %lx\n", + h->mcode_version, (ulong) h->overrun_buf); } /* @@ -10586,7 +10640,7 @@ ASC_SG_HEAD *sgp; int i; - printk("ASC_SCSI_Q at addr %x\n", (unsigned) q); + printk("ASC_SCSI_Q at addr %lx\n", (ulong) q); printk( " target_ix %u, target_lun %u, srb_ptr %x, tag_code %u,\n", @@ -10594,22 +10648,23 @@ (unsigned) q->q2.srb_ptr, q->q2.tag_code); printk( -" data_addr %x, data_cnt %lu, sense_addr %x, sense_len %u,\n", - (unsigned) q->q1.data_addr, q->q1.data_cnt, - (unsigned) q->q1.sense_addr, q->q1.sense_len); +" data_addr %lx, data_cnt %lu, sense_addr %lx, sense_len %u,\n", + (ulong) q->q1.data_addr, (ulong) q->q1.data_cnt, + (ulong) q->q1.sense_addr, q->q1.sense_len); printk( -" cdbptr %x, cdb_len %u, sg_head %x, sg_queue_cnt %u\n", - (unsigned) q->cdbptr, q->q2.cdb_len, - (unsigned) q->sg_head, q->q1.sg_queue_cnt); +" cdbptr %lx, cdb_len %u, sg_head %lx, sg_queue_cnt %u\n", + (ulong) q->cdbptr, q->q2.cdb_len, + (ulong) q->sg_head, q->q1.sg_queue_cnt); if (q->sg_head) { sgp = q->sg_head; - printk("ASC_SG_HEAD at addr %x\n", (unsigned) sgp); + printk("ASC_SG_HEAD at addr %lx\n", (ulong) sgp); printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt, sgp->queue_cnt); for (i = 0; i < sgp->entry_cnt; i++) { - printk(" [%u]: addr %x, bytes %lu\n", - i, (unsigned) sgp->sg_list[i].addr, sgp->sg_list[i].bytes); + printk(" [%u]: addr %lx, bytes %lu\n", + i, (ulong) sgp->sg_list[i].addr, + (ulong) sgp->sg_list[i].bytes); } } @@ -10621,7 +10676,7 @@ STATIC void asc_prt_asc_qdone_info(ASC_QDONE_INFO *q) { - printk("ASC_QDONE_INFO at addr %x\n", (unsigned) q); + printk("ASC_QDONE_INFO at addr %lx\n", (ulong) q); printk( " srb_ptr %x, target_ix %u, cdb_len %u, tag_code %u, done_stat %x\n", (unsigned) q->d2.srb_ptr, q->d2.target_ix, q->d2.cdb_len, @@ -10646,8 +10701,8 @@ (ulong) h->iop_base, h->err_code, (unsigned) h->ultra_able); printk( -" isr_callback 0x%x, sdtr_able 0x%x, wdtr_able 0x%x\n", - (unsigned) h->isr_callback, (unsigned) h->wdtr_able, +" isr_callback 0x%lx, sdtr_able 0x%x, wdtr_able 0x%x\n", + (ulong) h->isr_callback, (unsigned) h->wdtr_able, (unsigned) h->sdtr_able); printk( @@ -10660,11 +10715,9 @@ (unsigned) h->max_host_qng, (unsigned) h->max_dvc_qng, (ulong) h->carr_freelist); - printk( " icq_sp %lx, irq_sp %lx\n", - (ulong) h->icq_sp, - (ulong) h->irq_sp); + (ulong) h->icq_sp, (ulong) h->irq_sp); printk( " no_scam 0x%x, tagqng_able 0x%x\n", @@ -10713,34 +10766,31 @@ int sg_blk_cnt; struct asc_sg_block *sg_ptr; - printk("ADV_SCSI_REQ_Q at addr %x\n", (unsigned) q); + printk("ADV_SCSI_REQ_Q at addr %lx\n", (ulong) q); printk( " target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n", - q->target_id, q->target_lun, q->srb_ptr, q->a_flag); + q->target_id, q->target_lun, (ulong) q->srb_ptr, q->a_flag); printk(" cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n", - q->cntl, q->data_addr, q->vdata_addr); - - printk( -" cntl 0x%x, data_addr %lx, vdata_addr %lx\n", - q->cntl, q->data_addr, q->vdata_addr); + q->cntl, (ulong) q->data_addr, (ulong) q->vdata_addr); printk( " data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n", - q->data_cnt, q->sense_addr, q->sense_len); + (ulong) q->data_cnt, (ulong) q->sense_addr, q->sense_len); printk( " cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n", q->cdb_len, q->done_status, q->host_status, q->scsi_status); printk( -" sg_working_ix %x, sg_working_data_cnt %lx, reserved %u\n", - q->sg_working_ix, q->sg_working_data_cnt, q->reserved); +" sg_working_ix %x, sg_working_data_cnt %lx, target_cmd %u\n", + q->sg_working_ix, (ulong) q->sg_working_data_cnt, q->target_cmd); printk( " scsiq_rptr %lx, sg_real_addr %lx, sg_list_ptr %lx\n", - q->scsiq_rptr, q->sg_real_addr, (ulong) q->sg_list_ptr); + (ulong) q->scsiq_rptr, (ulong) q->sg_real_addr, + (ulong) q->sg_list_ptr); /* Display the request's ADV_SG_BLOCK structures. */ if (q->sg_list_ptr != NULL) @@ -10756,7 +10806,7 @@ */ sg_ptr = &(((ADV_SG_BLOCK *) (q->sg_list_ptr))[sg_blk_cnt]); asc_prt_adv_sgblock(sg_blk_cnt, sg_ptr); - if (sg_ptr->sg_ptr == NULL) + if (sg_ptr->sg_ptr == 0) { break; } @@ -10780,13 +10830,13 @@ printk(" sg_cnt %u, sg_ptr %lx\n", b->sg_cnt, (ulong) b->sg_ptr); ASC_ASSERT(b->sg_cnt <= NO_OF_SG_PER_BLOCK); - if (b->sg_ptr != NULL) + if (b->sg_ptr != 0) { ASC_ASSERT(b->sg_cnt == NO_OF_SG_PER_BLOCK); } for (i = 0; i < b->sg_cnt; i++) { printk(" [%u]: sg_addr %lx, sg_count %lx\n", - i, b->sg_list[i].sg_addr, b->sg_list[i].sg_count); + i, (ulong) b->sg_list[i].sg_addr, (ulong) b->sg_list[i].sg_count); } } @@ -10977,7 +11027,7 @@ } ASC_INITFUNC( -STATIC ulong, +STATIC ASC_DCNT, AscLoadMicroCode( PortAddr iop_base, ushort s_addr, @@ -10986,7 +11036,7 @@ ) ) { - ulong chksum; + ASC_DCNT chksum; ushort mcode_word_size; ushort mcode_chksum; @@ -11215,7 +11265,7 @@ STATIC int AscIsrChipHalted( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { EXT_MSG ext_msg; @@ -11235,10 +11285,10 @@ uchar cur_dvc_qng; uchar asyn_sdtr; uchar scsi_status; - asc_board_t *boardp; + asc_board_t *boardp; - ASC_ASSERT(asc_dvc->drv_ptr != 0); - boardp = (asc_board_t *) asc_dvc->drv_ptr; + ASC_ASSERT(asc_dvc->drv_ptr != NULL); + boardp = asc_dvc->drv_ptr; iop_base = asc_dvc->iop_base; int_halt_code = AscReadLramWord(iop_base, ASCV_HALTCODE_W); @@ -11485,162 +11535,162 @@ return (0); } else if (int_halt_code == ASC_HALT_HOST_COPY_SG_LIST_TO_RISC) { - uchar q_no; - ushort q_addr; - ulong srb_ptr; - uchar sg_wk_q_no; - uchar first_sg_wk_q_no; - ASC_SCSI_Q *scsiq; /* Ptr to driver request. */ - ASC_SG_HEAD *sg_head; /* Ptr to driver SG request. */ - ASC_SG_LIST_Q scsi_sg_q; /* Structure written to queue. */ - ushort sg_list_dwords; - ushort sg_entry_cnt; - uchar next_qp; - int i; - - q_no = AscReadLramByte(iop_base, (ushort) ASCV_REQ_SG_LIST_QP); - if (q_no == ASC_QLINK_END) - { - return(0); - } - - q_addr = ASC_QNO_TO_QADDR(q_no); - - /* Read request's SRB pointer. */ - srb_ptr = AscReadLramDWord(iop_base, - (ushort) (q_addr + ASC_SCSIQ_D_SRBPTR)); + uchar q_no; + ushort q_addr; + uchar sg_wk_q_no; + uchar first_sg_wk_q_no; + ASC_SCSI_Q *scsiq; /* Ptr to driver request. */ + ASC_SG_HEAD *sg_head; /* Ptr to driver SG request. */ + ASC_SG_LIST_Q scsi_sg_q; /* Structure written to queue. */ + ushort sg_list_dwords; + ushort sg_entry_cnt; + uchar next_qp; + int i; - /* - * Get request's first and working SG queue. - */ - sg_wk_q_no = AscReadLramByte(iop_base, - (ushort) (q_addr + ASC_SCSIQ_B_SG_WK_QP)); + q_no = AscReadLramByte(iop_base, (ushort) ASCV_REQ_SG_LIST_QP); + if (q_no == ASC_QLINK_END) + { + return(0); + } - first_sg_wk_q_no = AscReadLramByte(iop_base, - (ushort) (q_addr + ASC_SCSIQ_B_FIRST_SG_WK_QP)); + q_addr = ASC_QNO_TO_QADDR(q_no); - /* - * Reset request's working SG queue back to the - * first SG queue. - */ - AscWriteLramByte(iop_base, - (ushort) (q_addr + (ushort) ASC_SCSIQ_B_SG_WK_QP), - first_sg_wk_q_no); + /* + * Convert the request's SRB pointer to a host ASC_SCSI_REQ + * structure pointer using a macro provided by the driver. + * The ASC_SCSI_REQ pointer provides a pointer to the + * host ASC_SG_HEAD structure. + */ + /* Read request's SRB pointer. */ + scsiq = (ASC_SCSI_Q *) + ASC_SRB2SCSIQ( + ASC_U32_TO_VADDR(AscReadLramDWord(iop_base, + (ushort) (q_addr + ASC_SCSIQ_D_SRBPTR)))); - /* - * Convert the request's SRB pointer to a host ASC_SCSI_REQ - * structure pointer using a macro provided by the driver. - * The ASC_SCSI_REQ pointer provides a pointer to the - * host ASC_SG_HEAD structure. - */ - scsiq = (ASC_SCSI_Q *) ASC_SRB2SCSIQ(srb_ptr); + /* + * Get request's first and working SG queue. + */ + sg_wk_q_no = AscReadLramByte(iop_base, + (ushort) (q_addr + ASC_SCSIQ_B_SG_WK_QP)); - sg_head = scsiq->sg_head; + first_sg_wk_q_no = AscReadLramByte(iop_base, + (ushort) (q_addr + ASC_SCSIQ_B_FIRST_SG_WK_QP)); - /* - * Set sg_entry_cnt to the number of SG elements - * that will be completed on this interrupt. - * - * Note: The allocated SG queues contain ASC_MAX_SG_LIST - 1 - * SG elements. The data_cnt and data_addr fields which - * add 1 to the SG element capacity are not used when - * restarting SG handling after a halt. - */ - if (scsiq->remain_sg_entry_cnt > (ASC_MAX_SG_LIST - 1)) - { - sg_entry_cnt = ASC_MAX_SG_LIST - 1; - - /* - * Keep track of remaining number of SG elements that will - * need to be handled on the next interrupt. - */ - scsiq->remain_sg_entry_cnt -= (ASC_MAX_SG_LIST - 1); - } else - { - sg_entry_cnt = scsiq->remain_sg_entry_cnt; - scsiq->remain_sg_entry_cnt = 0; - } + /* + * Reset request's working SG queue back to the + * first SG queue. + */ + AscWriteLramByte(iop_base, + (ushort) (q_addr + (ushort) ASC_SCSIQ_B_SG_WK_QP), + first_sg_wk_q_no); - /* - * Copy SG elements into the list of allocated SG queues. - * - * Last index completed is saved in scsiq->next_sg_index. - */ - next_qp = first_sg_wk_q_no; - q_addr = ASC_QNO_TO_QADDR(next_qp); - scsi_sg_q.sg_head_qp = q_no; - scsi_sg_q.cntl = QCSG_SG_XFER_LIST; - for( i = 0; i < sg_head->queue_cnt; i++) - { - scsi_sg_q.seq_no = i + 1; - if (sg_entry_cnt > ASC_SG_LIST_PER_Q) - { - sg_list_dwords = (uchar) (ASC_SG_LIST_PER_Q * 2); - sg_entry_cnt -= ASC_SG_LIST_PER_Q; - /* - * After very first SG queue RISC FW uses next - * SG queue first element then checks sg_list_cnt - * against zero and then decrements, so set - * sg_list_cnt 1 less than number of SG elements - * in each SG queue. - */ - scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q - 1; - scsi_sg_q.sg_cur_list_cnt = ASC_SG_LIST_PER_Q - 1; - } else { - /* - * This is the last SG queue in the list of - * allocated SG queues. If there are more - * SG elements than will fit in the allocated - * queues, then set the QCSG_SG_XFER_MORE flag. - */ - if (scsiq->remain_sg_entry_cnt != 0) - { - scsi_sg_q.cntl |= QCSG_SG_XFER_MORE; - } else - { - scsi_sg_q.cntl |= QCSG_SG_XFER_END; - } - /* equals sg_entry_cnt * 2 */ - sg_list_dwords = sg_entry_cnt << 1; - scsi_sg_q.sg_list_cnt = sg_entry_cnt - 1; - scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt - 1; - sg_entry_cnt = 0; - } - - scsi_sg_q.q_no = next_qp; - AscMemWordCopyToLram(iop_base, - (ushort) (q_addr+ASC_SCSIQ_SGHD_CPY_BEG), - (ushort *) &scsi_sg_q, - (ushort) (sizeof(ASC_SG_LIST_Q) >> 1)); - - AscMemDWordCopyToLram( iop_base, - (ushort) (q_addr+ASC_SGQ_LIST_BEG ), - (ulong *) &sg_head->sg_list[scsiq->next_sg_index], - (ushort) sg_list_dwords); - - scsiq->next_sg_index += ASC_SG_LIST_PER_Q; - - /* - * If the just completed SG queue contained the - * last SG element, then no more SG queues need - * to be written. - */ - if (scsi_sg_q.cntl & QCSG_SG_XFER_END) - { - break; - } - - next_qp = AscReadLramByte( iop_base, - ( ushort )( q_addr+ASC_SCSIQ_B_FWD ) ); - q_addr = ASC_QNO_TO_QADDR( next_qp ); - } + sg_head = scsiq->sg_head; - /* - * Clear the halt condition so the RISC will be restarted - * after the return. - */ - AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); - return(0); + /* + * Set sg_entry_cnt to the number of SG elements + * that will be completed on this interrupt. + * + * Note: The allocated SG queues contain ASC_MAX_SG_LIST - 1 + * SG elements. The data_cnt and data_addr fields which + * add 1 to the SG element capacity are not used when + * restarting SG handling after a halt. + */ + if (scsiq->remain_sg_entry_cnt > (ASC_MAX_SG_LIST - 1)) + { + sg_entry_cnt = ASC_MAX_SG_LIST - 1; + + /* + * Keep track of remaining number of SG elements that will + * need to be handled on the next interrupt. + */ + scsiq->remain_sg_entry_cnt -= (ASC_MAX_SG_LIST - 1); + } else + { + sg_entry_cnt = scsiq->remain_sg_entry_cnt; + scsiq->remain_sg_entry_cnt = 0; + } + + /* + * Copy SG elements into the list of allocated SG queues. + * + * Last index completed is saved in scsiq->next_sg_index. + */ + next_qp = first_sg_wk_q_no; + q_addr = ASC_QNO_TO_QADDR(next_qp); + scsi_sg_q.sg_head_qp = q_no; + scsi_sg_q.cntl = QCSG_SG_XFER_LIST; + for( i = 0; i < sg_head->queue_cnt; i++) + { + scsi_sg_q.seq_no = i + 1; + if (sg_entry_cnt > ASC_SG_LIST_PER_Q) + { + sg_list_dwords = (uchar) (ASC_SG_LIST_PER_Q * 2); + sg_entry_cnt -= ASC_SG_LIST_PER_Q; + /* + * After very first SG queue RISC FW uses next + * SG queue first element then checks sg_list_cnt + * against zero and then decrements, so set + * sg_list_cnt 1 less than number of SG elements + * in each SG queue. + */ + scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q - 1; + scsi_sg_q.sg_cur_list_cnt = ASC_SG_LIST_PER_Q - 1; + } else { + /* + * This is the last SG queue in the list of + * allocated SG queues. If there are more + * SG elements than will fit in the allocated + * queues, then set the QCSG_SG_XFER_MORE flag. + */ + if (scsiq->remain_sg_entry_cnt != 0) + { + scsi_sg_q.cntl |= QCSG_SG_XFER_MORE; + } else + { + scsi_sg_q.cntl |= QCSG_SG_XFER_END; + } + /* equals sg_entry_cnt * 2 */ + sg_list_dwords = sg_entry_cnt << 1; + scsi_sg_q.sg_list_cnt = sg_entry_cnt - 1; + scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt - 1; + sg_entry_cnt = 0; + } + + scsi_sg_q.q_no = next_qp; + AscMemWordCopyToLram(iop_base, + (ushort) (q_addr+ASC_SCSIQ_SGHD_CPY_BEG), + (ushort *) &scsi_sg_q, + (ushort) (sizeof(ASC_SG_LIST_Q) >> 1)); + + AscMemDWordCopyToLram( iop_base, + (ushort) (q_addr+ASC_SGQ_LIST_BEG ), + (ADV_PADDR *) + &sg_head->sg_list[scsiq->next_sg_index], + (ushort) sg_list_dwords); + + scsiq->next_sg_index += ASC_SG_LIST_PER_Q; + + /* + * If the just completed SG queue contained the + * last SG element, then no more SG queues need + * to be written. + */ + if (scsi_sg_q.cntl & QCSG_SG_XFER_END) + { + break; + } + + next_qp = AscReadLramByte( iop_base, + ( ushort )( q_addr+ASC_SCSIQ_B_FWD ) ); + q_addr = ASC_QNO_TO_QADDR( next_qp ); + } + + /* + * Clear the halt condition so the RISC will be restarted + * after the return. + */ + AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0); + return(0); } return (0); } @@ -11649,8 +11699,8 @@ _AscCopyLramScsiDoneQ( PortAddr iop_base, ushort q_addr, - REG ASC_QDONE_INFO * scsiq, - ulong max_dma_count + ASC_QDONE_INFO * scsiq, + ASC_DCNT max_dma_count ) { ushort _val; @@ -11676,7 +11726,7 @@ /* * Read high word of remain bytes from alternate location. */ - scsiq->remain_bytes = (((ulong) AscReadLramWord( iop_base, + scsiq->remain_bytes = (((ADV_DCNT) AscReadLramWord( iop_base, (ushort) (q_addr+ (ushort) ASC_SCSIQ_W_ALT_DC1))) << 16); /* * Read low word of remain bytes from original location. @@ -11690,7 +11740,7 @@ STATIC int AscIsrQDone( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { uchar next_qp; @@ -11707,12 +11757,12 @@ ushort sg_q_addr; uchar cur_target_qng; ASC_QDONE_INFO scsiq_buf; - REG ASC_QDONE_INFO *scsiq; + ASC_QDONE_INFO *scsiq; int false_overrun; ASC_ISR_CALLBACK asc_isr_callback; iop_base = asc_dvc->iop_base; - asc_isr_callback = (ASC_ISR_CALLBACK) asc_dvc->isr_callback; + asc_isr_callback = asc_dvc->isr_callback; n_q_used = 1; scsiq = (ASC_QDONE_INFO *) & scsiq_buf; done_q_tail = (uchar) AscGetVarDoneQTail(iop_base); @@ -11777,7 +11827,7 @@ } else if (scsiq->q_status == QS_DONE) { false_overrun = FALSE; if (scsiq->extra_bytes != 0) { - scsiq->remain_bytes += (ulong) scsiq->extra_bytes; + scsiq->remain_bytes += (ADV_DCNT) scsiq->extra_bytes; } if (scsiq->d3.done_stat == QD_WITH_ERROR) { if (scsiq->d3.host_stat == QHSTA_M_DATA_OVER_RUN) { @@ -11827,7 +11877,7 @@ STATIC int AscISR( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { ASC_CS_TYPE chipstat; @@ -12072,7 +12122,7 @@ }; STATIC ushort _asc_mcode_size ASC_INITDATA = sizeof(_asc_mcode_buf); -STATIC ulong _asc_mcode_chksum ASC_INITDATA = 0x012C453FUL; +STATIC ADV_DCNT _asc_mcode_chksum ASC_INITDATA = 0x012C453FUL; #define ASC_SYN_OFFSET_ONE_DISABLE_LIST 16 STATIC uchar _syn_offset_one_disable_cmd[ASC_SYN_OFFSET_ONE_DISABLE_LIST] = @@ -12097,8 +12147,8 @@ STATIC int AscExeScsiQueue( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, - REG ASC_SCSI_Q * scsiq + ASC_DVC_VAR *asc_dvc, + ASC_SCSI_Q *scsiq ) { PortAddr iop_base; @@ -12107,7 +12157,7 @@ int n_q_required; int disable_syn_offset_one_fix; int i; - ulong addr; + ASC_PADDR addr; ASC_EXE_CALLBACK asc_exe_callback; ushort sg_entry_cnt = 0; ushort sg_entry_cnt_minus_one = 0; @@ -12117,12 +12167,12 @@ uchar extra_bytes; uchar scsi_cmd; uchar disable_cmd; - ASC_SG_HEAD *sg_head; - ulong data_cnt; + ASC_SG_HEAD *sg_head; + ASC_DCNT data_cnt; iop_base = asc_dvc->iop_base; sg_head = scsiq->sg_head; - asc_exe_callback = (ASC_EXE_CALLBACK) asc_dvc->exe_callback; + asc_exe_callback = asc_dvc->exe_callback; if (asc_dvc->err_code != 0) return (ERR); if (scsiq == (ASC_SCSI_Q *) 0L) { @@ -12168,8 +12218,8 @@ } #endif /* !CC_VERY_LONG_SG_LIST */ if (sg_entry_cnt == 1) { - scsiq->q1.data_addr = (ulong) sg_head->sg_list[0].addr; - scsiq->q1.data_cnt = (ulong) sg_head->sg_list[0].bytes; + scsiq->q1.data_addr = (ADV_PADDR) sg_head->sg_list[0].addr; + scsiq->q1.data_cnt = (ADV_DCNT) sg_head->sg_list[0].bytes; scsiq->q1.cntl &= ~(QC_SG_HEAD | QC_SG_SWAP_QUEUE); } sg_entry_cnt_minus_one = sg_entry_cnt - 1; @@ -12181,7 +12231,7 @@ if (scsiq->q1.cntl & QC_SG_HEAD) { data_cnt = 0; for (i = 0; i < sg_entry_cnt; i++) { - data_cnt += (ulong) sg_head->sg_list[i].bytes; + data_cnt += (ADV_DCNT) sg_head->sg_list[i].bytes; } } else { data_cnt = scsiq->q1.data_cnt; @@ -12216,8 +12266,10 @@ if ((scsi_cmd == SCSICMD_Read6) || (scsi_cmd == SCSICMD_Read10)) { addr = - (ulong) sg_head->sg_list[sg_entry_cnt_minus_one].addr + - (ulong) sg_head->sg_list[sg_entry_cnt_minus_one].bytes; + (ADV_PADDR) + sg_head->sg_list[sg_entry_cnt_minus_one].addr + + (ADV_DCNT) + sg_head->sg_list[sg_entry_cnt_minus_one].bytes; extra_bytes = (uchar) ((ushort) addr & 0x0003); if ((extra_bytes != 0) && ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES) @@ -12225,7 +12277,7 @@ scsiq->q2.tag_code |= ASC_TAG_FLAG_EXTRA_BYTES; scsiq->q1.extra_bytes = extra_bytes; sg_head->sg_list[sg_entry_cnt_minus_one].bytes -= - (ulong) extra_bytes; + (ASC_DCNT) extra_bytes; } } } @@ -12265,7 +12317,7 @@ == 0)) { if (((ushort) scsiq->q1.data_cnt & 0x01FF) == 0) { scsiq->q2.tag_code |= ASC_TAG_FLAG_EXTRA_BYTES; - scsiq->q1.data_cnt -= (ulong) extra_bytes; + scsiq->q1.data_cnt -= (ASC_DCNT) extra_bytes; scsiq->q1.extra_bytes = extra_bytes; } } @@ -12293,8 +12345,8 @@ STATIC int AscSendScsiQueue( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, - REG ASC_SCSI_Q * scsiq, + ASC_DVC_VAR *asc_dvc, + ASC_SCSI_Q *scsiq, uchar n_q_required ) { @@ -12357,7 +12409,7 @@ STATIC uint AscGetNumOfFreeQueue( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar target_ix, uchar n_qs ) @@ -12399,8 +12451,8 @@ STATIC int AscPutReadyQueue( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, - REG ASC_SCSI_Q * scsiq, + ASC_DVC_VAR *asc_dvc, + ASC_SCSI_Q *scsiq, uchar q_no ) { @@ -12444,8 +12496,8 @@ STATIC int AscPutReadySgListQueue( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, - REG ASC_SCSI_Q * scsiq, + ASC_DVC_VAR *asc_dvc, + ASC_SCSI_Q *scsiq, uchar q_no ) { @@ -12453,8 +12505,8 @@ int i; ASC_SG_HEAD *sg_head; ASC_SG_LIST_Q scsi_sg_q; - ulong saved_data_addr; - ulong saved_data_cnt; + ASC_DCNT saved_data_addr; + ASC_DCNT saved_data_cnt; PortAddr iop_base; ushort sg_list_dwords; ushort sg_index; @@ -12466,8 +12518,8 @@ sg_head = scsiq->sg_head; saved_data_addr = scsiq->q1.data_addr; saved_data_cnt = scsiq->q1.data_cnt; - scsiq->q1.data_addr = (ulong) sg_head->sg_list[0].addr; - scsiq->q1.data_cnt = (ulong) sg_head->sg_list[0].bytes; + scsiq->q1.data_addr = (ASC_PADDR) sg_head->sg_list[0].addr; + scsiq->q1.data_cnt = (ASC_DCNT) sg_head->sg_list[0].bytes; /* * If sg_head->entry_cnt is greater than ASC_MAX_SG_LIST * then not all SG elements will fit in the allocated queues. @@ -12552,7 +12604,7 @@ (ushort) (sizeof (ASC_SG_LIST_Q) >> 1)); AscMemDWordCopyToLram(iop_base, (ushort) (q_addr + ASC_SGQ_LIST_BEG), - (ulong *) & sg_head->sg_list[sg_index], + (ADV_PADDR *) &sg_head->sg_list[sg_index], (ushort) sg_list_dwords); sg_index += ASC_SG_LIST_PER_Q; scsiq->next_sg_index = sg_index; @@ -12568,8 +12620,8 @@ STATIC int AscAbortSRB( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, - ulong srb_ptr + ASC_DVC_VAR *asc_dvc, + ADV_VADDR srb_ptr ) { int sta; @@ -12598,7 +12650,7 @@ #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) STATIC int AscResetDevice( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar target_ix ) { @@ -12671,7 +12723,7 @@ STATIC int AscResetSB( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { int sta; @@ -12685,7 +12737,7 @@ AscStopQueueExe(iop_base); asc_dvc->sdtr_done = 0; AscResetChipAndScsiBus(asc_dvc); - DvcSleepMilliSecond((ulong) ((ushort) asc_dvc->scsi_reset_wait * 1000)); + DvcSleepMilliSecond((ASC_DCNT) ((ushort) asc_dvc->scsi_reset_wait * 1000)); AscReInitLram(asc_dvc); for (i = 0; i <= ASC_MAX_TID; i++) { asc_dvc->cur_dvc_qng[i] = 0; @@ -12760,7 +12812,7 @@ STATIC int AscReInitLram( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { AscInitLram(asc_dvc); @@ -12770,7 +12822,7 @@ STATIC ushort AscInitLram( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { uchar i; @@ -12823,7 +12875,7 @@ STATIC ushort AscInitQLinkVar( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { PortAddr iop_base; @@ -12856,7 +12908,7 @@ STATIC int AscSetLibErrorCode( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, ushort err_code ) { @@ -12873,7 +12925,7 @@ STATIC int _AscWaitQDone( PortAddr iop_base, - REG ASC_SCSI_Q * scsiq + ASC_SCSI_Q * scsiq ) { ushort q_addr; @@ -12895,7 +12947,7 @@ STATIC uchar AscMsgOutSDTR( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset ) @@ -12932,7 +12984,7 @@ STATIC uchar AscCalSDTRData( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar syn_offset ) @@ -12964,11 +13016,11 @@ STATIC uchar AscGetSynPeriodIndex( - ASC_DVC_VAR asc_ptr_type * asc_dvc, - ruchar syn_time + ASC_DVC_VAR *asc_dvc, + uchar syn_time ) { - ruchar *period_table; + uchar *period_table; int max_index; int min_index; int i; @@ -13029,8 +13081,8 @@ STATIC int AscRiscHaltedAbortSRB( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, - ulong srb_ptr + ASC_DVC_VAR *asc_dvc, + ASC_VADDR srb_ptr ) { PortAddr iop_base; @@ -13042,7 +13094,7 @@ int last_int_level; iop_base = asc_dvc->iop_base; - asc_isr_callback = (ASC_ISR_CALLBACK) asc_dvc->isr_callback; + asc_isr_callback = asc_dvc->isr_callback; last_int_level = DvcEnterCritical(); scsiq = (ASC_QDONE_INFO *) & scsiq_buf; for (q_no = ASC_MIN_ACTIVE_QNO; q_no <= asc_dvc->max_total_qng; @@ -13075,7 +13127,7 @@ #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) STATIC int AscRiscHaltedAbortTIX( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar target_ix ) { @@ -13088,7 +13140,7 @@ int last_int_level; iop_base = asc_dvc->iop_base; - asc_isr_callback = (ASC_ISR_CALLBACK) asc_dvc->isr_callback; + asc_isr_callback = asc_dvc->isr_callback; last_int_level = DvcEnterCritical(); scsiq = (ASC_QDONE_INFO *) & scsiq_buf; for (q_no = ASC_MIN_ACTIVE_QNO; q_no <= asc_dvc->max_total_qng; @@ -13223,7 +13275,7 @@ STATIC int AscWaitTixISRDone( - ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar target_ix ) { @@ -13246,7 +13298,7 @@ STATIC int AscWaitISRDone( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) { int tid; @@ -13257,24 +13309,24 @@ return (1); } -STATIC ulong +STATIC ASC_PADDR AscGetOnePhyAddr( - REG ASC_DVC_VAR asc_ptr_type * asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar * buf_addr, - ulong buf_size + ASC_DCNT buf_size ) { ASC_MIN_SG_HEAD sg_head; sg_head.entry_cnt = ASC_MIN_SG_LIST; if (DvcGetSGList(asc_dvc, (uchar *) buf_addr, - buf_size, (ASC_SG_HEAD *) & sg_head) != buf_size) { + buf_size, (ASC_SG_HEAD *) &sg_head) != buf_size) { return (0L); } if (sg_head.entry_cnt > 1) { return (0L); } - return ((ulong) sg_head.sg_list[0].addr); + return ((ASC_PADDR) sg_head.sg_list[0].addr); } STATIC void @@ -13284,13 +13336,13 @@ } STATIC void -DvcDelayNanoSecond(ASC_DVC_VAR asc_ptr_type * asc_dvc, ulong nano_sec) +DvcDelayNanoSecond(ASC_DVC_VAR *asc_dvc, ASC_DCNT nano_sec) { udelay((nano_sec + 999)/1000); } ASC_INITFUNC( -STATIC ulong, +STATIC ASC_DCNT, AscGetEisaProductID( PortAddr iop_base ) @@ -13298,12 +13350,13 @@ { PortAddr eisa_iop; ushort product_id_high, product_id_low; - ulong product_id; + ASC_DCNT product_id; eisa_iop = ASC_GET_EISA_SLOT(iop_base) | ASC_EISA_PID_IOP_MASK; product_id_low = inpw(eisa_iop); product_id_high = inpw(eisa_iop + 2); - product_id = ((ulong) product_id_high << 16) | (ulong) product_id_low; + product_id = ((ASC_DCNT) product_id_high << 16) | + (ASC_DCNT) product_id_low; return (product_id); } @@ -13314,7 +13367,7 @@ ) ) { - ulong eisa_product_id; + ASC_DCNT eisa_product_id; if (iop_base == 0) { iop_base = ASC_EISA_MIN_IOP_ADDR; @@ -13506,7 +13559,7 @@ } ASC_INITFUNC( -STATIC ulong, +STATIC ASC_DCNT, AscGetMaxDmaCount( ushort bus_type ) @@ -13594,7 +13647,7 @@ ASC_INITFUNC( STATIC ushort, AscReadPCIConfigWord( - ASC_DVC_VAR asc_ptr_type *asc_dvc, + ASC_DVC_VAR *asc_dvc, ushort pci_config_offset) ) { @@ -13608,7 +13661,7 @@ ASC_INITFUNC( STATIC ushort, AscInitGetConfig( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -13693,7 +13746,7 @@ ASC_INITFUNC( STATIC ushort, AscInitSetConfig( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -13714,7 +13767,7 @@ ASC_INITFUNC( STATIC ushort, AscInitFromAscDvcVar( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -13777,7 +13830,7 @@ ASC_INITFUNC( STATIC ushort, AscInitAsc1000Driver( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -13789,7 +13842,8 @@ if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) && !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) { AscResetChipAndScsiBus(asc_dvc); - DvcSleepMilliSecond((ulong) ((ushort) asc_dvc->scsi_reset_wait * 1000)); + DvcSleepMilliSecond((ASC_DCNT) + ((ushort) asc_dvc->scsi_reset_wait * 1000)); } asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC; if (asc_dvc->err_code != 0) @@ -13816,7 +13870,7 @@ ASC_INITFUNC( STATIC ushort, AscInitAscDvcVar( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -13850,8 +13904,6 @@ asc_dvc->redo_scam = 0; asc_dvc->res2 = 0; asc_dvc->host_init_sdtr_index = 0; - asc_dvc->res7 = 0; - asc_dvc->res8 = 0; asc_dvc->cfg->can_tagged_qng = 0; asc_dvc->cfg->cmd_qng_enabled = 0; asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL; @@ -13931,7 +13983,7 @@ ASC_INITFUNC( STATIC ushort, AscInitFromEEP( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -13952,7 +14004,8 @@ (AscGetChipScsiCtrl(iop_base) != 0)) { asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE; AscResetChipAndScsiBus(asc_dvc); - DvcSleepMilliSecond((ulong) ((ushort) asc_dvc->scsi_reset_wait * 1000)); + DvcSleepMilliSecond((ASC_DCNT) + ((ushort) asc_dvc->scsi_reset_wait * 1000)); } if (AscIsChipHalted(iop_base) == FALSE) { asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; @@ -14086,14 +14139,14 @@ ASC_INITFUNC( STATIC ushort, AscInitMicroCodeVar( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { int i; ushort warn_code; PortAddr iop_base; - ulong phy_addr; + ASC_PADDR phy_addr; iop_base = asc_dvc->iop_base; warn_code = 0; @@ -14112,7 +14165,8 @@ ASC_OVERRUN_BSIZE)) == 0L) { asc_dvc->err_code |= ASC_IERR_GET_PHY_ADDR; } else { - phy_addr = (phy_addr & 0xFFFFFFF8UL) + 8; + /* Align on an 8 byte boundary. */ + phy_addr = cpu_to_le32((phy_addr + 7) & ~0x7); AscWriteLramDWord(iop_base, ASCV_OVERRUN_PADDR_D, phy_addr); AscWriteLramDWord(iop_base, ASCV_OVERRUN_BSIZE_D, ASC_OVERRUN_BSIZE - 8); @@ -14136,7 +14190,7 @@ ASC_INITFUNC( STATIC int, AscTestExternalLram( - ASC_DVC_VAR asc_ptr_type * asc_dvc + ASC_DVC_VAR *asc_dvc ) ) { @@ -14290,7 +14344,7 @@ { ushort wval; ushort sum; - ushort *wbuf; + ushort *wbuf; int cfg_beg; int cfg_end; int s_addr; @@ -14404,7 +14458,7 @@ STATIC void AscAsyncFix( - ASC_DVC_VAR asc_ptr_type *asc_dvc, + ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq) { @@ -14458,7 +14512,7 @@ } STATIC void -AscInquiryHandling(ASC_DVC_VAR asc_ptr_type *asc_dvc, +AscInquiryHandling(ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq) { ASC_SCSI_BIT_ID_TYPE tid_bit = ASC_TIX_TO_TARGET_ID(tid_no); @@ -14504,8 +14558,8 @@ STATIC int AscCompareString( - ruchar * str1, - ruchar * str2, + uchar *str1, + uchar *str2, int len ) { @@ -14554,19 +14608,19 @@ return (word_data); } -STATIC ulong +STATIC ASC_DCNT AscReadLramDWord( PortAddr iop_base, ushort addr ) { ushort val_low, val_high; - ulong dword_data; + ASC_DCNT dword_data; AscSetChipLramAddr(iop_base, addr); val_low = AscGetChipLramData(iop_base); val_high = AscGetChipLramData(iop_base); - dword_data = ((ulong) val_high << 16) | (ulong) val_low; + dword_data = ((ASC_DCNT) val_high << 16) | (ASC_DCNT) val_low; return (dword_data); } @@ -14586,7 +14640,7 @@ AscWriteLramDWord( PortAddr iop_base, ushort addr, - ulong dword_val + ASC_DCNT dword_val ) { ushort word_val; @@ -14639,7 +14693,7 @@ AscMemDWordCopyToLram( PortAddr iop_base, ushort s_addr, - ulong * s_buffer, + ASC_DCNT *s_buffer, int dwords ) { @@ -14661,15 +14715,15 @@ return; } -STATIC ulong +STATIC ASC_DCNT AscMemSumLramWord( PortAddr iop_base, ushort s_addr, - rint words + int words ) { - ulong sum; - int i; + ASC_DCNT sum; + int i; sum = 0L; for (i = 0; i < words; i++, s_addr += 2) { @@ -14683,10 +14737,10 @@ PortAddr iop_base, ushort s_addr, ushort set_wval, - rint words + int words ) { - rint i; + int i; AscSetChipLramAddr(iop_base, s_addr); for (i = 0; i < words; i++) { @@ -14702,664 +14756,675 @@ /* a_mcode.h */ STATIC unsigned char _adv_asc3550_buf[] = { - 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x00, 0xfc, 0x48, 0xe4, 0x01, 0x00, 0x01, 0xf6, - 0x00, 0xf6, 0x18, 0xe4, 0x0a, 0x19, 0x18, 0x80, 0x02, 0x00, 0xff, 0xff, 0x03, 0xf6, 0x00, 0xfa, - 0xff, 0x00, 0x82, 0xe7, 0x9e, 0xe7, 0x01, 0xfa, 0x06, 0x0e, 0x09, 0xe7, 0x00, 0xea, 0x01, 0xe6, - 0x03, 0x00, 0x08, 0x00, 0x18, 0xf4, 0x55, 0xf0, 0x3e, 0x01, 0x3e, 0x57, 0x04, 0x00, 0x1e, 0xf0, - 0x85, 0xf0, 0x00, 0xe6, 0x00, 0xec, 0x32, 0xf0, 0x86, 0xf0, 0xa4, 0x0c, 0xd0, 0x01, 0xd5, 0xf0, - 0xf6, 0x18, 0x38, 0x54, 0x98, 0x57, 0xbc, 0x00, 0xb1, 0xf0, 0xb4, 0x00, 0x01, 0xfc, 0x02, 0x13, - 0x03, 0xfc, 0x9e, 0x0c, 0x00, 0x57, 0x01, 0xf0, 0x03, 0xe6, 0x0c, 0x1c, 0x10, 0x00, 0x18, 0x40, - 0x30, 0x12, 0x3e, 0x1c, 0xbd, 0x00, 0xe0, 0x00, 0x02, 0x48, 0x02, 0x80, 0x3c, 0x00, 0x4e, 0x01, - 0x66, 0x15, 0x6c, 0x01, 0x6e, 0x01, 0xbb, 0x00, 0xda, 0x12, 0x00, 0x4e, 0x01, 0x01, 0x01, 0xea, - 0x08, 0x12, 0x30, 0xe4, 0x6a, 0x0f, 0xa8, 0x0c, 0xae, 0x0f, 0xb6, 0x00, 0xb9, 0x54, 0x00, 0x80, - 0x04, 0x12, 0x06, 0xf7, 0x24, 0x01, 0x28, 0x01, 0x32, 0x00, 0x3c, 0x01, 0x3c, 0x56, 0x3e, 0x00, - 0x4b, 0xe4, 0x4c, 0x1c, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, 0x74, 0x01, 0x76, 0x01, - 0x78, 0x01, 0x00, 0x01, 0x02, 0xee, 0x02, 0xfc, 0x03, 0x58, 0x03, 0xf7, 0x04, 0x80, 0x05, 0xfc, - 0x08, 0x44, 0x09, 0xf0, 0x0a, 0x15, 0x10, 0x44, 0x1b, 0x80, 0x20, 0x01, 0x38, 0x1c, 0x40, 0x00, - 0x4b, 0xf4, 0x4e, 0x1c, 0x5b, 0xf0, 0x5d, 0xf0, 0x80, 0x00, 0xaa, 0x00, 0xaa, 0x14, 0xb6, 0x08, - 0xb8, 0x0f, 0xbb, 0x55, 0xbd, 0x56, 0xbe, 0x00, 0xc0, 0x00, 0x00, 0x4c, 0x00, 0xdc, 0x02, 0x4a, - 0x05, 0xf0, 0x05, 0xf8, 0x06, 0x13, 0x08, 0x13, 0x0c, 0x00, 0x0e, 0x47, 0x0e, 0xf7, 0x0f, 0x00, - 0x19, 0x00, 0x20, 0x00, 0x2a, 0x01, 0x32, 0x1c, 0x36, 0x00, 0x38, 0x12, 0x3c, 0x0b, 0x45, 0x5a, - 0x56, 0x14, 0x59, 0xf0, 0x62, 0x0a, 0x69, 0x08, 0x83, 0x59, 0xae, 0x17, 0xb8, 0xf0, 0xba, 0x0f, - 0xba, 0x17, 0xf0, 0x00, 0xf6, 0x0d, 0x02, 0xfa, 0x03, 0xfa, 0x04, 0x10, 0x04, 0xea, 0x04, 0xf6, - 0x04, 0xfc, 0x05, 0x00, 0x06, 0x00, 0x06, 0x12, 0x0a, 0x10, 0x0b, 0xf0, 0x0c, 0xf0, 0x12, 0x10, - 0x30, 0x1c, 0x33, 0x00, 0x34, 0x00, 0x38, 0x44, 0x40, 0x5c, 0x4a, 0xe4, 0x5a, 0x14, 0x62, 0x1a, - 0x64, 0x0a, 0x68, 0x08, 0x68, 0x54, 0x83, 0x55, 0x83, 0x5a, 0x91, 0x44, 0x98, 0x12, 0x9a, 0x16, - 0xa4, 0x00, 0xb0, 0x57, 0xb5, 0x00, 0xba, 0x00, 0xce, 0x45, 0xd0, 0x00, 0xe1, 0x00, 0xe7, 0x00, - 0xec, 0x0d, 0x00, 0x54, 0x01, 0x48, 0x01, 0x58, 0x02, 0x10, 0x02, 0xe6, 0x03, 0xa1, 0x04, 0x13, - 0x05, 0xe6, 0x06, 0x0b, 0x06, 0x83, 0x06, 0xf0, 0x07, 0x00, 0x0a, 0x00, 0x0a, 0x12, 0x0a, 0xf0, - 0x0c, 0x04, 0x0c, 0x10, 0x0c, 0x12, 0x0e, 0x13, 0x10, 0x10, 0x12, 0x1c, 0x17, 0x00, 0x18, 0x0e, - 0x19, 0xe4, 0x1a, 0x10, 0x1c, 0x00, 0x1c, 0x12, 0x1c, 0x14, 0x1d, 0xf7, 0x1e, 0x13, 0x20, 0x1c, - 0x20, 0xe7, 0x22, 0x01, 0x26, 0x01, 0x2a, 0x12, 0x30, 0xe7, 0x41, 0x58, 0x43, 0x48, 0x44, 0x55, - 0x46, 0x1c, 0x4e, 0xe4, 0x5c, 0xf0, 0x72, 0x02, 0x74, 0x03, 0x77, 0x57, 0x88, 0x12, 0x89, 0x48, - 0x92, 0x13, 0x99, 0x00, 0x9b, 0x00, 0x9c, 0x32, 0x9e, 0x00, 0xa8, 0x00, 0xaa, 0x12, 0xb9, 0x00, - 0xba, 0x06, 0xbf, 0x57, 0xc0, 0x01, 0xc0, 0x08, 0xc2, 0x01, 0xfe, 0x9c, 0xf0, 0x26, 0x02, 0xfe, - 0xc6, 0x0c, 0xff, 0x10, 0x00, 0x00, 0xfc, 0xfe, 0x18, 0x19, 0x00, 0xfa, 0xfe, 0x80, 0x01, 0xff, - 0x03, 0x00, 0x00, 0x2f, 0xfe, 0x01, 0x05, 0xff, 0x40, 0x00, 0x00, 0x0d, 0xff, 0x09, 0x00, 0x00, - 0xff, 0x08, 0x01, 0x01, 0xff, 0x10, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x10, 0xff, 0xff, - 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00, 0xfe, 0x04, - 0xf7, 0xfa, 0x35, 0x51, 0x0c, 0x01, 0xfe, 0xb6, 0x0e, 0xfe, 0x04, 0xf7, 0xfa, 0x51, 0x0c, 0x1d, - 0x35, 0xfe, 0x3d, 0xf0, 0xfe, 0xf8, 0x01, 0xfe, 0x20, 0xf0, 0xd0, 0x04, 0x55, 0x50, 0x02, 0xfe, - 0xe2, 0x0c, 0x01, 0xfe, 0x42, 0x0d, 0xfe, 0xe9, 0x12, 0x02, 0xfe, 0x04, 0x03, 0xfe, 0x28, 0x1c, - 0x04, 0xfe, 0xa6, 0x00, 0xfe, 0xdd, 0x12, 0x4e, 0x13, 0xfe, 0xa6, 0x00, 0xc3, 0xfe, 0x48, 0xf0, - 0xfe, 0x7c, 0x02, 0xfe, 0x49, 0xf0, 0xfe, 0x96, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xb4, 0x02, 0xfe, - 0x46, 0xf0, 0xfe, 0x46, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x4c, 0x02, 0xfe, 0x43, 0xf0, 0xfe, 0x3a, - 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x3e, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x42, 0x02, 0x07, 0x0c, 0x9d, - 0x07, 0x06, 0x13, 0xb8, 0x02, 0x26, 0xfe, 0x00, 0x1c, 0xfe, 0xf1, 0x10, 0xfe, 0x02, 0x1c, 0xfe, - 0xed, 0x10, 0xfe, 0x1e, 0x1c, 0xfe, 0xe9, 0x10, 0x01, 0xfe, 0x0e, 0x17, 0xfe, 0xe7, 0x10, 0xfe, - 0x06, 0xfc, 0xf5, 0x0e, 0x7b, 0x01, 0xc0, 0x02, 0x26, 0x17, 0x54, 0x47, 0xba, 0x01, 0xfe, 0x2c, - 0x0f, 0x0e, 0x7b, 0x01, 0x9a, 0xfe, 0xbd, 0x10, 0x0e, 0x7b, 0x01, 0x9a, 0xfe, 0xad, 0x10, 0xfe, - 0x16, 0x1c, 0xfe, 0x58, 0x1c, 0x07, 0x06, 0x13, 0xb8, 0x35, 0x1f, 0x26, 0xfe, 0x3d, 0xf0, 0xfe, - 0xf8, 0x01, 0x27, 0xfe, 0x8a, 0x02, 0xfe, 0x5a, 0x1c, 0xd5, 0xfe, 0x14, 0x1c, 0x17, 0xfe, 0x30, - 0x00, 0x47, 0xba, 0x01, 0xfe, 0x1c, 0x0f, 0x07, 0x06, 0x13, 0xb8, 0x02, 0xfc, 0x22, 0x2b, 0x05, - 0x10, 0x2f, 0xfe, 0x69, 0x10, 0x07, 0x06, 0x13, 0xb8, 0xfe, 0x04, 0xec, 0x2b, 0x08, 0x2b, 0x07, - 0x3a, 0x1d, 0x01, 0x40, 0x7f, 0xfe, 0x05, 0xf6, 0xf5, 0x01, 0xfe, 0x40, 0x16, 0x0b, 0x49, 0x89, - 0x37, 0x11, 0x43, 0x1d, 0xca, 0x08, 0x1c, 0x07, 0x3f, 0x01, 0x6a, 0x02, 0x26, 0x0e, 0x3b, 0x01, - 0x14, 0x05, 0x10, 0xd3, 0x08, 0x1c, 0x07, 0x3f, 0x01, 0x76, 0xfe, 0x28, 0x10, 0x0e, 0xbd, 0x01, - 0x14, 0xe5, 0x0e, 0x7c, 0x01, 0x14, 0xfe, 0x49, 0x54, 0x72, 0xfe, 0x12, 0x03, 0x08, 0x1c, 0x07, - 0x3f, 0x01, 0x6a, 0x02, 0x26, 0x35, 0x7f, 0xfe, 0x02, 0xe8, 0x2d, 0xf9, 0xfe, 0x9e, 0x43, 0xed, - 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xd0, 0xfe, 0x40, 0x1c, 0x1f, 0xec, 0xfe, 0x26, 0xf0, 0xfe, - 0x70, 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x5e, 0x03, 0xfe, 0x11, 0xf0, 0xd0, 0xfe, 0x0e, 0x10, 0xfe, - 0x9f, 0xf0, 0xfe, 0x7e, 0x03, 0xe8, 0x12, 0xfe, 0x11, 0x00, 0x02, 0x4b, 0x35, 0xfe, 0x48, 0x1c, - 0xe8, 0x1f, 0xec, 0x33, 0xec, 0xfe, 0x82, 0xf0, 0xfe, 0x84, 0x03, 0x29, 0x22, 0xbb, 0x68, 0x16, - 0xbb, 0x0e, 0x7c, 0x01, 0x14, 0x68, 0x7d, 0x08, 0x1c, 0x07, 0x3f, 0x01, 0x40, 0x11, 0x3b, 0x08, - 0x3b, 0x07, 0x99, 0x01, 0x6a, 0xf3, 0x11, 0xfe, 0xe4, 0x00, 0x2c, 0xfe, 0xca, 0x03, 0x1f, 0x31, - 0x20, 0xfe, 0xda, 0x03, 0x01, 0x4a, 0xcb, 0xfe, 0xea, 0x03, 0x69, 0x8e, 0xcf, 0xfe, 0xaa, 0x06, - 0x02, 0x25, 0x04, 0x7b, 0x2a, 0x1b, 0xfe, 0x1c, 0x05, 0x17, 0x84, 0x01, 0x38, 0x01, 0x95, 0x01, - 0x98, 0x33, 0xfe, 0x5c, 0x02, 0x02, 0xeb, 0xe8, 0x35, 0x51, 0x18, 0xfe, 0x67, 0x1b, 0xf9, 0xed, - 0xfe, 0x48, 0x1c, 0x8b, 0x01, 0xee, 0xa8, 0xfe, 0x96, 0xf0, 0xfe, 0x24, 0x04, 0x2c, 0xfe, 0x28, - 0x04, 0x33, 0x26, 0x0e, 0x3b, 0x01, 0x14, 0x05, 0x10, 0x1b, 0xfe, 0x08, 0x05, 0x3c, 0x92, 0x9e, - 0x2d, 0x81, 0x6d, 0x1f, 0x31, 0x20, 0x25, 0x04, 0x7b, 0x2a, 0xfe, 0x10, 0x12, 0x17, 0x84, 0x01, - 0x38, 0x33, 0xfe, 0x5c, 0x02, 0x02, 0xeb, 0x30, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x5e, - 0x12, 0x0b, 0x09, 0x06, 0xfe, 0x56, 0x12, 0x23, 0x28, 0x93, 0x01, 0x0a, 0x81, 0x6d, 0x20, 0xfe, - 0xd8, 0x04, 0x23, 0x28, 0x93, 0x01, 0x0a, 0x20, 0x25, 0x23, 0x28, 0xb1, 0xfe, 0x4c, 0x44, 0xfe, - 0x32, 0x12, 0x56, 0xfe, 0x44, 0x48, 0x08, 0xd6, 0xfe, 0x4c, 0x54, 0x72, 0xfe, 0x08, 0x05, 0x7f, - 0x9e, 0x2d, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x48, 0x13, 0x3d, 0x05, 0xfe, 0xcc, 0x00, - 0xfe, 0x40, 0x13, 0x0b, 0x09, 0x06, 0x8d, 0xfe, 0x06, 0x10, 0x23, 0x28, 0xb1, 0x0b, 0x09, 0x36, - 0xdb, 0x17, 0xa2, 0x0b, 0x09, 0x06, 0x50, 0x17, 0xfe, 0x0d, 0x00, 0x01, 0x38, 0x33, 0xfe, 0x86, - 0x0c, 0x02, 0x25, 0x39, 0x11, 0xfe, 0xe6, 0x00, 0xfe, 0x1c, 0x90, 0xac, 0x03, 0x17, 0xa2, 0x01, - 0x38, 0x33, 0x26, 0x1f, 0x26, 0x02, 0xfe, 0x10, 0x05, 0xfe, 0x42, 0x5b, 0x51, 0x18, 0xfe, 0x46, - 0x59, 0xf9, 0xed, 0x17, 0x74, 0xfe, 0x07, 0x80, 0xfe, 0x31, 0x44, 0x0b, 0x09, 0x0c, 0xfe, 0x78, - 0x13, 0xfe, 0x20, 0x80, 0x05, 0x18, 0xfe, 0x70, 0x12, 0x6c, 0x09, 0x06, 0xfe, 0x60, 0x13, 0x04, - 0xfe, 0xa2, 0x00, 0x2a, 0x1b, 0xfe, 0xa8, 0x05, 0xfe, 0x31, 0xe4, 0x6f, 0x6c, 0x09, 0x0c, 0xfe, - 0x4a, 0x13, 0x04, 0xfe, 0xa0, 0x00, 0x2a, 0xfe, 0x42, 0x12, 0x59, 0x2c, 0xfe, 0x68, 0x05, 0x1f, - 0x31, 0xef, 0x01, 0x0a, 0x24, 0xfe, 0xc0, 0x05, 0x11, 0xfe, 0xe3, 0x00, 0x29, 0x6c, 0xfe, 0x4a, - 0xf0, 0xfe, 0x92, 0x05, 0xfe, 0x49, 0xf0, 0xfe, 0x8c, 0x05, 0xd1, 0x21, 0xfe, 0x21, 0x00, 0xa4, - 0x21, 0xfe, 0x22, 0x00, 0x9d, 0x21, 0x89, 0xfe, 0x09, 0x48, 0x01, 0x0a, 0x24, 0xfe, 0xc0, 0x05, - 0xfe, 0xe2, 0x08, 0x6c, 0x09, 0xda, 0x50, 0x01, 0xb6, 0x21, 0x06, 0x16, 0xe2, 0x47, 0xfe, 0x27, - 0x01, 0x0b, 0x09, 0x36, 0xe3, 0x4e, 0x01, 0xae, 0x17, 0xa2, 0x0b, 0x09, 0x06, 0x50, 0x17, 0xfe, - 0x0d, 0x00, 0x01, 0x38, 0x01, 0x95, 0x01, 0x98, 0x33, 0xfe, 0x86, 0x0c, 0x02, 0x25, 0x04, 0xfe, - 0x9c, 0x00, 0x2a, 0xfe, 0x3e, 0x12, 0x04, 0x52, 0x2a, 0xfe, 0x36, 0x13, 0x4e, 0x01, 0xae, 0x24, - 0xfe, 0x38, 0x06, 0x0e, 0x06, 0x6c, 0x09, 0x19, 0xfe, 0x02, 0x12, 0x79, 0x01, 0xfe, 0xf0, 0x13, - 0x20, 0xfe, 0x2e, 0x06, 0x11, 0xbe, 0x01, 0x4a, 0x11, 0xfe, 0xe5, 0x00, 0x04, 0x52, 0xb9, 0x0f, - 0x52, 0x04, 0xf4, 0x2a, 0xfe, 0x62, 0x12, 0x04, 0x4d, 0x2a, 0xfe, 0x5a, 0x13, 0x01, 0xfe, 0x60, - 0x18, 0x01, 0xfe, 0xb2, 0x18, 0xe6, 0xc8, 0x19, 0x08, 0x61, 0xff, 0x02, 0x00, 0x57, 0x64, 0x7e, - 0x1a, 0x4f, 0xc7, 0xc8, 0x87, 0x4e, 0x01, 0xae, 0x24, 0xfe, 0xa2, 0x06, 0x6c, 0x09, 0x1e, 0xa3, - 0x7a, 0x0e, 0x54, 0x01, 0xfe, 0x1e, 0x14, 0x20, 0xfe, 0x98, 0x06, 0x11, 0xbe, 0x01, 0x4a, 0x11, - 0xfe, 0xe5, 0x00, 0x04, 0x4d, 0xb9, 0x0f, 0x4d, 0x07, 0x06, 0x01, 0xae, 0xf3, 0x71, 0x8b, 0x01, - 0xee, 0xa8, 0x11, 0xfe, 0xe2, 0x00, 0x2c, 0xf8, 0x1f, 0x31, 0xcf, 0xfe, 0xd6, 0x06, 0x80, 0xfe, - 0x74, 0x07, 0xcb, 0xfe, 0x7c, 0x07, 0x69, 0x8e, 0x02, 0x25, 0x0b, 0x09, 0x0c, 0xfe, 0x2e, 0x12, - 0x15, 0x18, 0x01, 0x0a, 0x15, 0x00, 0x01, 0x0a, 0x15, 0x00, 0x01, 0x0a, 0x15, 0x00, 0x01, 0x0a, - 0xfe, 0x99, 0xa4, 0x01, 0x0a, 0x15, 0x00, 0x02, 0xfe, 0x3a, 0x08, 0x66, 0x09, 0x1e, 0x8d, 0x0b, - 0x09, 0x1e, 0xfe, 0x30, 0x13, 0x15, 0xfe, 0x1b, 0x00, 0x01, 0x0a, 0x15, 0x00, 0x01, 0x0a, 0x15, - 0x00, 0x01, 0x0a, 0x15, 0x00, 0x01, 0x0a, 0x15, 0x06, 0x01, 0x0a, 0x15, 0x00, 0x02, 0xc9, 0x79, - 0xfe, 0x9a, 0x81, 0x65, 0x89, 0xfe, 0x09, 0x6f, 0xfe, 0x93, 0x45, 0x1b, 0xfe, 0x84, 0x07, 0x2c, - 0xfe, 0x5c, 0x07, 0x1f, 0x31, 0xcf, 0xfe, 0x54, 0x07, 0x69, 0x8e, 0x80, 0xfe, 0x74, 0x07, 0x02, - 0x25, 0x01, 0x4a, 0x02, 0xf8, 0x15, 0x19, 0x02, 0xf8, 0xfe, 0x9c, 0xf7, 0xfe, 0xf0, 0x07, 0xfe, - 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x73, 0xfe, 0xd2, 0x07, 0x0f, 0x5c, 0x13, 0x5d, 0x0b, 0x49, 0x6f, - 0x37, 0x01, 0xfe, 0xf6, 0x17, 0x05, 0x10, 0x82, 0xfe, 0x83, 0xe7, 0x88, 0xa4, 0xfe, 0x03, 0x40, - 0x0b, 0x49, 0x74, 0x37, 0x01, 0xb7, 0xab, 0xfe, 0x1f, 0x40, 0x16, 0x60, 0x01, 0xf6, 0xfe, 0x08, - 0x50, 0xfe, 0x8a, 0x50, 0xfe, 0x34, 0x51, 0xfe, 0xb6, 0x51, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, - 0x0f, 0x5a, 0x13, 0x5b, 0xfe, 0x0c, 0x90, 0xfe, 0x8e, 0x90, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, - 0x0f, 0x41, 0x13, 0x42, 0xfe, 0x4a, 0x10, 0x0b, 0x09, 0x6f, 0xe3, 0xfe, 0x2c, 0x90, 0xfe, 0xae, - 0x90, 0x0f, 0x5c, 0x13, 0x5d, 0x0b, 0x09, 0x74, 0xc7, 0x01, 0xb7, 0xfe, 0x1f, 0x80, 0x16, 0x60, - 0xfe, 0x34, 0x90, 0xfe, 0xb6, 0x90, 0x0f, 0x5e, 0x13, 0x5f, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, - 0x0f, 0x5a, 0x13, 0x5b, 0xfe, 0x28, 0x90, 0xfe, 0xaa, 0x90, 0x0f, 0x41, 0x13, 0x42, 0x0f, 0x3e, - 0x13, 0x57, 0x0b, 0x49, 0x19, 0x37, 0x35, 0x08, 0xa1, 0x2c, 0xfe, 0x50, 0x08, 0xfe, 0x9e, 0xf0, - 0xfe, 0x64, 0x08, 0xc2, 0x1b, 0x31, 0x35, 0x6b, 0xfe, 0xed, 0x10, 0xa5, 0xfe, 0x88, 0x08, 0xa6, - 0xfe, 0xa4, 0x08, 0x80, 0xfe, 0x7c, 0x08, 0xcb, 0xfe, 0x82, 0x08, 0x69, 0x8e, 0x02, 0x25, 0x01, - 0x4a, 0xfe, 0xc9, 0x10, 0x15, 0x19, 0xfe, 0xc9, 0x10, 0x66, 0x09, 0x06, 0xfe, 0x10, 0x12, 0x66, - 0x09, 0x0c, 0x48, 0x0b, 0x09, 0x0c, 0xfe, 0x66, 0x12, 0xfe, 0x2e, 0x1c, 0xa7, 0x66, 0x09, 0x06, - 0x48, 0x66, 0x09, 0x0c, 0xfe, 0x52, 0x12, 0xfe, 0x2c, 0x1c, 0xfe, 0xaa, 0xf0, 0xfe, 0x24, 0x09, - 0xfe, 0xac, 0xf0, 0xfe, 0xc4, 0x08, 0xfe, 0x92, 0x10, 0xfe, 0x34, 0x1c, 0xfe, 0xf3, 0x10, 0xfe, - 0xad, 0xf0, 0xfe, 0xd0, 0x08, 0x02, 0xfe, 0x32, 0x0a, 0xfe, 0x36, 0x1c, 0xfe, 0xe7, 0x10, 0xfe, - 0x2b, 0xf0, 0xb0, 0xfe, 0x6b, 0x18, 0x1a, 0xfe, 0x00, 0xfe, 0xdb, 0xc3, 0xfe, 0xd2, 0xf0, 0xb0, - 0xfe, 0x76, 0x18, 0x1a, 0x18, 0x1b, 0xb0, 0x04, 0xe1, 0x1a, 0x06, 0x1b, 0xb0, 0xa5, 0x77, 0xa6, - 0x77, 0xfe, 0x34, 0x1c, 0xfe, 0x36, 0x1c, 0xfe, 0xb1, 0x10, 0x8b, 0x59, 0x39, 0x17, 0xa2, 0x01, - 0x38, 0x12, 0xfe, 0x35, 0x00, 0x33, 0x4b, 0x12, 0x8c, 0x02, 0x4b, 0xfe, 0x74, 0x18, 0x1a, 0xfe, - 0x00, 0xf8, 0x1b, 0x77, 0x51, 0x1e, 0x01, 0xfe, 0x42, 0x0d, 0xd2, 0x08, 0x1c, 0x07, 0x3f, 0x01, - 0x6a, 0x22, 0x2d, 0x3c, 0x51, 0x18, 0x02, 0x77, 0xfe, 0x98, 0x80, 0xd8, 0x0c, 0x27, 0xfe, 0x14, - 0x0a, 0x0b, 0x09, 0x6f, 0xfe, 0x82, 0x12, 0x0b, 0x09, 0x19, 0xfe, 0x66, 0x13, 0x22, 0x60, 0x68, - 0xc6, 0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91, 0xfe, 0x86, 0x91, - 0x62, 0x2d, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x73, 0xfb, 0x04, 0x5c, 0x2e, 0x5d, 0x0f, 0xaa, - 0x13, 0x8c, 0x9b, 0x5c, 0x9c, 0x5d, 0x01, 0xb7, 0xab, 0x62, 0x2d, 0x16, 0x60, 0xa0, 0x3e, 0x67, - 0x57, 0x63, 0x5e, 0x30, 0x5f, 0xe7, 0xfe, 0xe5, 0x55, 0xfe, 0x04, 0xfa, 0x3e, 0xfe, 0x05, 0xfa, - 0x57, 0x01, 0xf6, 0xfe, 0x36, 0x10, 0x29, 0x0f, 0xaa, 0x0f, 0x8c, 0x63, 0x5e, 0x30, 0x5f, 0xa7, - 0x0b, 0x09, 0x19, 0x1b, 0xfb, 0x63, 0x41, 0x30, 0x42, 0x0b, 0x09, 0xfe, 0xf7, 0x00, 0x37, 0x04, - 0x5a, 0x2e, 0x5b, 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x02, - 0x77, 0x0b, 0x09, 0x19, 0x1b, 0xfb, 0x0b, 0x09, 0xfe, 0xf7, 0x00, 0x37, 0xfe, 0x3a, 0x55, 0xfe, - 0x19, 0x81, 0x79, 0xfe, 0x10, 0x90, 0xfe, 0x92, 0x90, 0xfe, 0xd7, 0x10, 0x3d, 0x05, 0xbf, 0x1b, - 0xfe, 0xcc, 0x08, 0x11, 0xbf, 0xfe, 0x98, 0x80, 0xd8, 0x0c, 0xfe, 0x14, 0x13, 0x04, 0x41, 0x2e, - 0x42, 0x73, 0xfe, 0xcc, 0x08, 0xfe, 0x0c, 0x58, 0xfe, 0x8d, 0x58, 0x02, 0x77, 0x29, 0x4e, 0xfe, - 0x19, 0x80, 0xfe, 0xf1, 0x10, 0x0b, 0x09, 0x0c, 0xa3, 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xfe, - 0x94, 0x10, 0xfe, 0x6c, 0x19, 0x9b, 0x41, 0xfe, 0xed, 0x19, 0x9c, 0x42, 0xfe, 0x0c, 0x51, 0xfe, - 0x8e, 0x51, 0xfe, 0x6b, 0x18, 0x1a, 0xfe, 0x00, 0xff, 0x2f, 0xfe, 0x7a, 0x10, 0xc3, 0xfe, 0xd2, - 0xf0, 0xfe, 0xac, 0x0a, 0xfe, 0x76, 0x18, 0x1a, 0x18, 0xce, 0x04, 0xe1, 0x1a, 0x06, 0x83, 0x12, - 0xfe, 0x16, 0x00, 0x02, 0x4b, 0xfe, 0xd1, 0xf0, 0xfe, 0xe2, 0x0a, 0x17, 0xa1, 0x01, 0x38, 0x12, - 0xd6, 0xfe, 0x48, 0x10, 0xfe, 0xce, 0xf0, 0xfe, 0xca, 0x0a, 0x12, 0xfe, 0x21, 0x00, 0x02, 0x4b, - 0xfe, 0xcd, 0xf0, 0xfe, 0xd6, 0x0a, 0x12, 0xfe, 0x22, 0x00, 0x02, 0x4b, 0xfe, 0xcb, 0xf0, 0xfe, - 0xe2, 0x0a, 0x12, 0xfe, 0x24, 0x00, 0x02, 0x4b, 0xfe, 0xd0, 0xf0, 0xfe, 0xec, 0x0a, 0x12, 0x88, - 0xd9, 0xfe, 0xcf, 0xf0, 0xfe, 0xf6, 0x0a, 0x12, 0x89, 0xd4, 0xfe, 0xcc, 0xf0, 0xc9, 0xfe, 0x84, - 0x80, 0xd8, 0x19, 0xfe, 0xd5, 0x12, 0x12, 0xfe, 0x12, 0x00, 0x2c, 0xc9, 0x1f, 0x31, 0xa5, 0x25, - 0xa6, 0x25, 0x35, 0xf3, 0x2c, 0xfe, 0x1a, 0x0b, 0x1f, 0x31, 0x80, 0xfe, 0x36, 0x0b, 0x69, 0x8e, - 0xa5, 0xfe, 0xf0, 0x07, 0xa6, 0xfe, 0xf0, 0x07, 0x02, 0x25, 0x01, 0x4a, 0xfe, 0xdb, 0x10, 0x11, - 0xfe, 0xe8, 0x00, 0x8b, 0x81, 0x6d, 0xfe, 0x89, 0xf0, 0x25, 0x23, 0x28, 0xfe, 0xe9, 0x09, 0x01, - 0x0a, 0x81, 0x6d, 0x20, 0x25, 0x23, 0x28, 0x93, 0x33, 0xfe, 0x6e, 0x0b, 0x1f, 0x31, 0x02, 0xfe, - 0x62, 0x0b, 0xc2, 0x48, 0x12, 0xfe, 0x42, 0x00, 0x02, 0x4b, 0x9f, 0x06, 0xfe, 0x81, 0x49, 0xfe, - 0xcc, 0x12, 0x0b, 0x09, 0x0c, 0xfe, 0x5a, 0x13, 0x12, 0x00, 0x58, 0x0c, 0xfe, 0x6a, 0x12, 0x58, - 0xfe, 0x28, 0x00, 0x27, 0xfe, 0xb4, 0x0c, 0x0e, 0x7c, 0x01, 0x14, 0x05, 0x00, 0x83, 0x34, 0xfe, - 0x28, 0x00, 0x02, 0xfe, 0xb4, 0x0c, 0x01, 0x95, 0x01, 0x98, 0x0e, 0xbd, 0x01, 0xfe, 0x10, 0x0e, - 0xaf, 0x08, 0x3b, 0x07, 0x99, 0x01, 0x40, 0x11, 0x43, 0x08, 0x1c, 0x07, 0x3f, 0x01, 0x76, 0x02, - 0x26, 0x12, 0xfe, 0x44, 0x00, 0x58, 0x0c, 0xa3, 0x34, 0x0c, 0xfe, 0xc0, 0x10, 0x01, 0xb6, 0x34, - 0x0c, 0xfe, 0xb6, 0x10, 0x01, 0xb6, 0xfe, 0x19, 0x82, 0xfe, 0x34, 0x46, 0xfe, 0x0a, 0x13, 0x34, - 0x0c, 0x12, 0xfe, 0x43, 0x00, 0xfe, 0xa2, 0x10, 0x0b, 0x49, 0x0c, 0x37, 0x01, 0x95, 0x01, 0x98, - 0xaf, 0x08, 0x3b, 0x07, 0x99, 0x01, 0x40, 0x11, 0x43, 0x08, 0x1c, 0x07, 0x3f, 0x01, 0x76, 0x51, - 0x0c, 0xaf, 0x1d, 0xca, 0x02, 0xfe, 0x48, 0x03, 0x0b, 0x09, 0x0c, 0xce, 0x34, 0x0c, 0x12, 0x00, - 0xfe, 0x54, 0x10, 0x66, 0x09, 0x1e, 0xfe, 0x50, 0x12, 0x0b, 0x09, 0x1e, 0xfe, 0x48, 0x13, 0xfe, - 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x72, 0x0c, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x78, - 0x0c, 0x0b, 0x49, 0x1e, 0x37, 0xfe, 0x95, 0x10, 0x12, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0c, - 0x79, 0xfe, 0x26, 0x10, 0x12, 0xfe, 0x13, 0x00, 0xd4, 0x12, 0xfe, 0x47, 0x00, 0xa4, 0x12, 0xfe, - 0x41, 0x00, 0x9d, 0x12, 0xfe, 0x24, 0x00, 0x04, 0x7b, 0x2a, 0x27, 0xeb, 0x79, 0xfe, 0x04, 0xe6, - 0x1e, 0xfe, 0x9d, 0x41, 0xfe, 0x1c, 0x42, 0xaf, 0x01, 0xd7, 0x02, 0x26, 0xd5, 0x17, 0x0c, 0x47, - 0xf2, 0xdf, 0x17, 0xfe, 0x31, 0x00, 0x47, 0xba, 0x01, 0xfe, 0x1c, 0x0f, 0x02, 0xfc, 0x1d, 0xfe, - 0x06, 0xec, 0xf7, 0x85, 0x34, 0x36, 0xbc, 0x2f, 0x1d, 0xfe, 0x06, 0xea, 0xf7, 0xfe, 0x47, 0x4b, - 0x7a, 0xfe, 0x75, 0x57, 0x04, 0x55, 0xfe, 0x98, 0x56, 0xfe, 0x28, 0x12, 0x0e, 0x7c, 0xfe, 0xfa, - 0x14, 0x4e, 0xe5, 0x0e, 0xbd, 0xfe, 0xf0, 0x14, 0xfe, 0x49, 0x54, 0x91, 0xfe, 0x28, 0x0d, 0x0e, - 0x1c, 0xfe, 0xe4, 0x14, 0xfe, 0x44, 0x48, 0x02, 0xfe, 0x48, 0x03, 0x0e, 0x55, 0xfe, 0xc8, 0x14, - 0x85, 0x34, 0x36, 0xbc, 0x2f, 0x1d, 0xfe, 0xce, 0x47, 0xfe, 0xbd, 0x13, 0x02, 0x26, 0x22, 0x2b, - 0x05, 0x10, 0xfe, 0x78, 0x12, 0x29, 0x16, 0x54, 0x16, 0xa9, 0x22, 0x43, 0x4e, 0x47, 0x43, 0xc2, - 0xfe, 0x0c, 0x13, 0xfe, 0xbc, 0xf0, 0xfe, 0xc4, 0x0d, 0x08, 0x06, 0x16, 0x54, 0x01, 0xfe, 0xd0, - 0x15, 0x04, 0xfe, 0x38, 0x01, 0x2e, 0xfe, 0x3a, 0x01, 0x73, 0xfe, 0xc8, 0x0d, 0x04, 0xfe, 0x38, - 0x01, 0x1a, 0xfe, 0xf0, 0xff, 0x0f, 0xfe, 0x60, 0x01, 0x04, 0xfe, 0x3a, 0x01, 0x0f, 0xfe, 0x62, - 0x01, 0x21, 0x06, 0x16, 0x43, 0xfe, 0x04, 0xec, 0x2b, 0x08, 0x2b, 0x07, 0x3a, 0x1d, 0x01, 0x40, - 0x7f, 0xfe, 0x05, 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x40, 0x16, 0x11, 0x43, 0xca, 0x08, 0x06, - 0x03, 0x29, 0x03, 0x22, 0x54, 0xfe, 0xf7, 0x12, 0x22, 0xa9, 0x68, 0x16, 0xa9, 0x05, 0xa1, 0xfe, - 0x93, 0x13, 0xfe, 0x24, 0x1c, 0x17, 0x18, 0x47, 0xf2, 0xdf, 0xfe, 0xd9, 0x10, 0x94, 0xfe, 0x03, - 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x03, 0x94, 0xfe, 0x03, 0xdc, 0x29, 0xfe, 0x70, 0x57, - 0xfe, 0x33, 0x54, 0xfe, 0x3b, 0x54, 0xfe, 0x80, 0x5d, 0x03, 0xfe, 0x03, 0x57, 0x94, 0x29, 0xfe, - 0x00, 0xcc, 0x03, 0xfe, 0x03, 0x57, 0x94, 0x7d, 0x03, 0x01, 0xfe, 0x70, 0x16, 0x3d, 0x05, 0x43, - 0xfe, 0x0a, 0x13, 0x08, 0x1c, 0x07, 0x3f, 0xd4, 0x01, 0x95, 0x01, 0x98, 0x08, 0x3b, 0x07, 0x99, - 0x01, 0x40, 0x11, 0xfe, 0xe9, 0x00, 0x0b, 0x09, 0x89, 0xfe, 0x52, 0x13, 0x01, 0xfe, 0x02, 0x16, - 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, 0x0f, 0xfe, 0x64, 0x01, 0xfe, 0x16, 0x90, 0x0f, 0xfe, 0x66, - 0x01, 0x0b, 0x09, 0x74, 0x8d, 0xfe, 0x03, 0x80, 0x6b, 0x3c, 0x11, 0x75, 0x08, 0x2b, 0x07, 0x3a, - 0x1d, 0x92, 0x01, 0x6a, 0xfe, 0x62, 0x08, 0x68, 0x3c, 0x11, 0x75, 0x08, 0x2b, 0x07, 0x3a, 0x1d, - 0x92, 0x01, 0x6a, 0x62, 0x2d, 0x11, 0x75, 0x08, 0x2b, 0x07, 0x3a, 0x1d, 0x92, 0x01, 0x76, 0x03, - 0xfe, 0x08, 0x1c, 0x04, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58, 0x04, 0xfe, 0xae, 0x00, 0xfe, 0x07, - 0x58, 0x04, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58, 0x04, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, - 0x0a, 0x1c, 0x21, 0x87, 0x16, 0xf7, 0x29, 0x0f, 0x52, 0x0f, 0x4d, 0x21, 0x10, 0x16, 0x2b, 0x16, - 0x3a, 0x56, 0x9f, 0xd6, 0x08, 0x2b, 0x07, 0x3a, 0x1d, 0x01, 0x76, 0x7f, 0x11, 0x75, 0xfe, 0x14, - 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0xf6, 0x0e, 0xd5, 0x8b, 0xfe, 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, - 0x18, 0x1c, 0x03, 0x1d, 0xfe, 0x0c, 0x14, 0x85, 0xfe, 0x07, 0xe6, 0x36, 0xfe, 0xce, 0x47, 0xfe, - 0xf5, 0x13, 0x03, 0x01, 0xb6, 0x0e, 0x3b, 0x01, 0x14, 0x05, 0x10, 0xd3, 0x0e, 0x1c, 0x01, 0x14, - 0x05, 0x10, 0xdb, 0xfe, 0x44, 0x58, 0x3c, 0xfe, 0x01, 0xec, 0xba, 0xfe, 0x9e, 0x40, 0xfe, 0x9d, - 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1e, 0x9e, 0x2d, 0x01, 0xd7, 0xfe, 0xc9, 0x10, 0x03, 0x35, 0x81, - 0x6d, 0x23, 0x28, 0xb1, 0x05, 0x1e, 0xfe, 0x48, 0x12, 0x05, 0x0c, 0xfe, 0x4c, 0x12, 0x05, 0x18, - 0x38, 0x05, 0xcc, 0x1b, 0xfe, 0xc0, 0x10, 0x05, 0xfe, 0x23, 0x00, 0x1b, 0xfe, 0xcc, 0x10, 0x05, - 0x06, 0x1b, 0xfe, 0x2a, 0x11, 0x05, 0x19, 0xfe, 0x12, 0x12, 0x05, 0x00, 0x1b, 0x25, 0x17, 0xcc, - 0x01, 0x38, 0xc4, 0x39, 0x01, 0x0a, 0x80, 0x4a, 0x03, 0x39, 0x11, 0xfe, 0xcc, 0x00, 0x02, 0x26, - 0x39, 0x3d, 0x05, 0xbf, 0xfe, 0xe3, 0x13, 0x63, 0x41, 0x30, 0x42, 0x73, 0xfe, 0x7e, 0x10, 0x0b, - 0x09, 0x6f, 0xfe, 0x72, 0x12, 0xa0, 0x3e, 0x67, 0x57, 0xe7, 0xfe, 0xe5, 0x55, 0x91, 0xfe, 0x48, - 0x10, 0x22, 0x60, 0xfe, 0x26, 0x13, 0x04, 0xaa, 0x2e, 0x8c, 0x73, 0xfe, 0x98, 0x0c, 0x0f, 0x5c, - 0x13, 0x5d, 0x29, 0x0f, 0xaa, 0x0f, 0x8c, 0x01, 0xb7, 0x21, 0x87, 0x6b, 0x16, 0x60, 0x01, 0xf6, - 0xa0, 0x3e, 0x67, 0x57, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x3e, 0xfe, 0x05, - 0xfa, 0x57, 0xfe, 0x91, 0x10, 0x04, 0x5e, 0x2e, 0x5f, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56, 0x0f, - 0x5e, 0x13, 0x5f, 0xd1, 0xa0, 0x3e, 0x67, 0x57, 0xe7, 0xfe, 0xe5, 0x55, 0x04, 0x5a, 0x2e, 0x5b, - 0xfe, 0x00, 0x56, 0xfe, 0xa1, 0x56, 0x0f, 0x5a, 0x13, 0x5b, 0x0b, 0x09, 0x6f, 0xfe, 0x1e, 0x12, - 0x22, 0x60, 0xfe, 0x1f, 0x40, 0x04, 0x5c, 0x2e, 0x5d, 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x04, - 0x5e, 0x2e, 0x5f, 0xfe, 0x34, 0x50, 0xfe, 0xb6, 0x50, 0x04, 0x5a, 0x2e, 0x5b, 0xfe, 0x08, 0x50, - 0xfe, 0x8a, 0x50, 0x04, 0x41, 0x2e, 0x42, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, 0x02, 0x97, 0x21, - 0x06, 0x16, 0xf1, 0x02, 0x78, 0x39, 0x01, 0x0a, 0x20, 0x4c, 0x23, 0x28, 0xb1, 0x05, 0x06, 0x27, - 0x4c, 0x3d, 0x05, 0xbf, 0x27, 0x78, 0x01, 0xee, 0x1a, 0x4f, 0x1b, 0x4c, 0x0b, 0x09, 0x0c, 0xde, - 0x63, 0x41, 0x30, 0x42, 0xfe, 0x0a, 0x55, 0x2f, 0xfe, 0x8b, 0x55, 0x9b, 0x41, 0x9c, 0x42, 0xfe, - 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0x02, 0x78, 0xfe, 0x19, 0x81, 0xfe, 0x0a, 0x45, 0xfe, 0x19, 0x41, - 0x02, 0x78, 0x39, 0x01, 0x0a, 0x20, 0xfe, 0xc2, 0x0f, 0x23, 0x28, 0xfe, 0xe9, 0x09, 0x58, 0x18, - 0xfe, 0x94, 0x12, 0x58, 0x0c, 0x50, 0x02, 0x4c, 0x2c, 0xfe, 0x4a, 0x11, 0x1f, 0x31, 0x20, 0xfe, - 0xc2, 0x0f, 0x23, 0x28, 0x93, 0x05, 0x18, 0x27, 0x4c, 0x01, 0x0a, 0x20, 0xfe, 0xc2, 0x0f, 0x23, - 0x28, 0xfe, 0xe8, 0x09, 0x56, 0x04, 0xfe, 0x9c, 0x00, 0x2a, 0x2f, 0xfe, 0xbb, 0x45, 0x58, 0x00, - 0x48, 0x34, 0x06, 0x9f, 0x4f, 0xfe, 0xc0, 0x14, 0xfe, 0xf8, 0x14, 0xa8, 0x3d, 0x05, 0xbe, 0xfe, - 0x16, 0x13, 0x04, 0xf4, 0x2a, 0xce, 0x04, 0x4d, 0x2a, 0x2f, 0x59, 0x02, 0x78, 0xfe, 0xc0, 0x5d, - 0xfe, 0xe4, 0x14, 0xfe, 0x03, 0x17, 0x04, 0x52, 0xb9, 0x0f, 0x52, 0x59, 0x39, 0x01, 0x0a, 0x24, - 0x97, 0x01, 0xfe, 0xf0, 0x13, 0x02, 0x97, 0x2c, 0xfe, 0xd4, 0x11, 0x1f, 0x31, 0x20, 0x4c, 0x23, - 0x28, 0x93, 0x05, 0x06, 0x27, 0x4c, 0xfe, 0xf6, 0x14, 0xfe, 0x42, 0x58, 0xfe, 0x70, 0x14, 0xfe, - 0x92, 0x14, 0xa8, 0xfe, 0x4a, 0xf4, 0x0c, 0x1b, 0x4c, 0xfe, 0x4a, 0xf4, 0x06, 0xd2, 0x3d, 0x05, - 0xbe, 0xc7, 0x02, 0x78, 0x04, 0x4d, 0xb9, 0x0f, 0x4d, 0x59, 0x39, 0x01, 0x0a, 0x24, 0x97, 0x01, - 0xfe, 0x1e, 0x14, 0x02, 0x97, 0x24, 0xfe, 0x3c, 0x12, 0x71, 0xef, 0x71, 0x03, 0x33, 0x8d, 0x69, - 0x8d, 0x59, 0x39, 0x01, 0x0a, 0xfe, 0xe3, 0x10, 0x08, 0x61, 0xff, 0x02, 0x00, 0x57, 0x64, 0x7e, - 0x1a, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x08, 0x61, 0xff, 0x02, 0x00, - 0x57, 0x64, 0x7e, 0x1a, 0x4f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x08, 0x61, 0xff, 0x02, - 0x00, 0x57, 0x64, 0x7e, 0x03, 0x08, 0x61, 0xff, 0x02, 0x00, 0x57, 0x64, 0x7e, 0xfe, 0x0b, 0x58, - 0x03, 0x0e, 0x52, 0x01, 0x9a, 0x0e, 0x4d, 0x01, 0x9a, 0x03, 0xc6, 0x1a, 0x10, 0xff, 0x03, 0x00, - 0x54, 0xfe, 0x00, 0xf4, 0x19, 0x64, 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, - 0x03, 0x7c, 0x62, 0x2d, 0x0f, 0x5a, 0x13, 0x5b, 0x9b, 0x5e, 0x9c, 0x5f, 0x03, 0xfe, 0x62, 0x18, - 0xfe, 0x82, 0x5a, 0xfe, 0xe1, 0x1a, 0xb4, 0xfe, 0x02, 0x58, 0x03, 0x01, 0xfe, 0x60, 0x18, 0xfe, - 0x42, 0x48, 0x79, 0x56, 0x7a, 0x01, 0x0a, 0x20, 0xfe, 0xe8, 0x13, 0x23, 0x28, 0xfe, 0xe9, 0x09, - 0xfe, 0xc1, 0x59, 0x01, 0x0a, 0x20, 0xfe, 0xe8, 0x13, 0x23, 0x28, 0xfe, 0xe8, 0x0a, 0x04, 0xf4, - 0x2a, 0xfe, 0xc2, 0x12, 0x29, 0xad, 0x1e, 0xde, 0x58, 0xcd, 0x72, 0xfe, 0x38, 0x13, 0x50, 0x08, - 0x06, 0x07, 0xcd, 0x9f, 0xfe, 0x00, 0x10, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xa4, 0xff, - 0x02, 0x83, 0x55, 0xad, 0x18, 0xfe, 0x12, 0x13, 0x70, 0xfe, 0x30, 0x00, 0x91, 0xf0, 0x07, 0x84, - 0x08, 0x06, 0xfe, 0x56, 0x10, 0xad, 0x0c, 0xfe, 0x16, 0x13, 0x70, 0xfe, 0x64, 0x00, 0x91, 0xf0, - 0x0e, 0xfe, 0x64, 0x00, 0x07, 0x88, 0x08, 0x06, 0xfe, 0x28, 0x10, 0xad, 0x06, 0xfe, 0x5e, 0x13, - 0x70, 0xfe, 0xc8, 0x00, 0x91, 0xf0, 0x0e, 0xfe, 0xc8, 0x00, 0x07, 0x54, 0x08, 0x06, 0xd1, 0x70, - 0xfe, 0x90, 0x01, 0xea, 0xfe, 0x9e, 0x13, 0x7a, 0xa7, 0xfe, 0x43, 0xf4, 0xa9, 0xfe, 0x56, 0xf0, - 0xfe, 0xb0, 0x13, 0xfe, 0x04, 0xf4, 0x61, 0xfe, 0x43, 0xf4, 0x88, 0xfe, 0xf3, 0x10, 0xac, 0x01, - 0xfe, 0x7a, 0x12, 0x1a, 0x4f, 0xd3, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x87, 0xea, 0xfe, 0xe2, - 0x13, 0x7a, 0xfe, 0x14, 0x10, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x19, 0xea, 0xfe, 0xe2, 0x13, - 0xc8, 0x19, 0x9d, 0x56, 0x7a, 0x08, 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, 0x03, 0x56, 0x08, - 0x0c, 0x03, 0x15, 0x06, 0x01, 0x0a, 0x24, 0xdc, 0x15, 0x0c, 0x01, 0x0a, 0x24, 0xdc, 0x15, 0x18, - 0x01, 0x0a, 0x24, 0xdc, 0x71, 0xfe, 0x89, 0x49, 0x01, 0x0a, 0x03, 0x15, 0x06, 0x01, 0x0a, 0x24, - 0x90, 0x15, 0x18, 0x01, 0x0a, 0x24, 0x90, 0x15, 0x06, 0x01, 0x0a, 0x24, 0x90, 0xfe, 0x89, 0x49, - 0x01, 0x0a, 0x24, 0x90, 0x71, 0xfe, 0x89, 0x4a, 0x01, 0x0a, 0x03, 0x56, 0x03, 0x22, 0xe2, 0x05, - 0x06, 0xfe, 0x44, 0x13, 0xab, 0x16, 0xe2, 0xfe, 0x49, 0xf4, 0x00, 0x50, 0x71, 0xc4, 0x59, 0xfe, - 0x01, 0xec, 0xfe, 0x27, 0x01, 0xef, 0x01, 0x0a, 0x3d, 0x05, 0xfe, 0xe3, 0x00, 0xfe, 0x20, 0x13, - 0x20, 0xfe, 0xa0, 0x14, 0x29, 0x16, 0xf1, 0x01, 0x4a, 0x22, 0xf1, 0x05, 0x06, 0x48, 0x0b, 0x49, - 0x06, 0x37, 0x03, 0x0f, 0x53, 0x13, 0x8a, 0xfe, 0x43, 0x58, 0x01, 0x14, 0x05, 0x10, 0xfe, 0x1e, - 0x12, 0x45, 0xe6, 0x8f, 0x01, 0x44, 0xfe, 0x90, 0x4d, 0xe0, 0x10, 0xfe, 0xc5, 0x59, 0x01, 0x44, - 0xfe, 0x8d, 0x56, 0xb4, 0x45, 0x03, 0x45, 0x30, 0x8a, 0x01, 0x14, 0x45, 0x8f, 0x01, 0x44, 0xe4, - 0x10, 0xe0, 0x10, 0x30, 0x53, 0x70, 0x1c, 0x83, 0x0e, 0x55, 0x01, 0xc0, 0x03, 0x0f, 0x53, 0x13, - 0x8a, 0xfe, 0xc3, 0x58, 0x01, 0x14, 0x05, 0x10, 0xfe, 0x1a, 0x12, 0x45, 0xe6, 0x8f, 0x01, 0x44, - 0xe4, 0x10, 0xfe, 0x80, 0x4d, 0xfe, 0xc5, 0x59, 0x01, 0x44, 0x45, 0x03, 0x45, 0x30, 0x53, 0x01, - 0x14, 0x45, 0x8f, 0x01, 0x44, 0xe4, 0x10, 0xe0, 0x10, 0x30, 0x53, 0x70, 0x1c, 0x83, 0x0e, 0x55, - 0x01, 0xc0, 0x03, 0x0f, 0x53, 0x13, 0x8a, 0xfe, 0x43, 0x58, 0x01, 0x14, 0xfe, 0x42, 0x48, 0x8f, - 0x01, 0x44, 0xfe, 0xc0, 0x5a, 0xac, 0xfe, 0x00, 0xcd, 0xfe, 0x01, 0xcc, 0xfe, 0x4a, 0x46, 0xde, - 0x94, 0x7d, 0x05, 0x10, 0xfe, 0x2e, 0x13, 0x67, 0x53, 0xfe, 0x4d, 0xf4, 0x1c, 0xfe, 0x1c, 0x13, - 0x0e, 0x55, 0x01, 0x9a, 0xa7, 0xfe, 0x40, 0x4c, 0xfe, 0xc5, 0x58, 0x01, 0x44, 0xfe, 0x00, 0x07, - 0x7d, 0x05, 0x10, 0x83, 0x67, 0x8a, 0xfe, 0x05, 0x57, 0xfe, 0x08, 0x10, 0xfe, 0x45, 0x58, 0x01, - 0x44, 0xfe, 0x8d, 0x56, 0xb4, 0xfe, 0x80, 0x4c, 0xfe, 0x05, 0x17, 0x03, 0x07, 0x10, 0x6e, 0x65, - 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x24, 0x1c, 0xdd, 0x36, 0x96, 0xfe, - 0xe4, 0x15, 0x01, 0xfe, 0xea, 0x16, 0xfe, 0x0c, 0x13, 0x86, 0x36, 0x65, 0xfe, 0x2c, 0x01, 0xfe, - 0x2f, 0x19, 0x03, 0xb5, 0x27, 0xfe, 0xd4, 0x15, 0xfe, 0xda, 0x10, 0x07, 0x10, 0x6e, 0x04, 0xfe, - 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x19, 0xfe, 0x18, 0x58, 0x04, 0xfe, 0x66, 0x01, 0xfe, 0x19, 0x58, - 0x86, 0x19, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, 0x06, 0xfe, 0x3c, 0x50, 0x65, 0xfe, 0x38, 0x00, - 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x19, 0x96, 0xfe, 0x2e, 0x16, 0xfe, 0xb6, 0x14, 0x2f, 0x03, - 0xb5, 0x27, 0xfe, 0x06, 0x16, 0xfe, 0x9c, 0x10, 0x07, 0x10, 0x6e, 0xb4, 0xfe, 0x18, 0xdf, 0xfe, - 0x19, 0xdf, 0xdd, 0x3e, 0x96, 0xfe, 0x50, 0x16, 0xfe, 0x94, 0x14, 0xfe, 0x10, 0x13, 0x86, 0x3e, - 0x65, 0x1e, 0xfe, 0xaf, 0x19, 0xfe, 0x98, 0xe7, 0x00, 0x03, 0xb5, 0x27, 0xfe, 0x44, 0x16, 0xfe, - 0x6c, 0x10, 0x07, 0x10, 0x6e, 0xfe, 0x30, 0xbc, 0xfe, 0xb2, 0xbc, 0x86, 0xda, 0x65, 0x1e, 0xfe, - 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0xda, 0x96, 0xfe, 0x88, 0x16, 0xfe, 0x5c, 0x14, 0x2f, 0x03, 0xb5, - 0x27, 0xfe, 0x74, 0x16, 0xfe, 0x42, 0x10, 0xfe, 0x02, 0xf6, 0x10, 0x6e, 0xfe, 0x18, 0xfe, 0x5c, - 0xfe, 0x19, 0xfe, 0x5d, 0xc6, 0xdd, 0x74, 0x96, 0xfe, 0xae, 0x16, 0xfe, 0x36, 0x14, 0xfe, 0x1c, - 0x13, 0x86, 0x74, 0x4e, 0xfe, 0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x10, 0xfe, 0x81, - 0xe7, 0x10, 0x11, 0xfe, 0xdd, 0x00, 0x62, 0x2d, 0x03, 0x62, 0x2d, 0xfe, 0x12, 0x45, 0x27, 0xfe, - 0x9e, 0x16, 0x17, 0x06, 0x47, 0xf2, 0xdf, 0x02, 0x26, 0xfe, 0x39, 0xf0, 0xfe, 0xf2, 0x16, 0x29, - 0x03, 0xfe, 0x7e, 0x18, 0x1a, 0x18, 0x82, 0x08, 0x0d, 0x03, 0x6e, 0x04, 0xe1, 0x1a, 0x06, 0xfe, - 0xef, 0x12, 0xfe, 0xe1, 0x10, 0x1d, 0x0e, 0x1c, 0x01, 0x14, 0x05, 0x10, 0x48, 0x3c, 0xfe, 0x78, - 0x14, 0xfe, 0x34, 0x12, 0x4f, 0x85, 0x34, 0x36, 0xbc, 0xfe, 0xe9, 0x13, 0x1d, 0x0e, 0x3b, 0x01, - 0x14, 0x05, 0x10, 0x48, 0x3c, 0x90, 0xe3, 0x4f, 0x85, 0x34, 0x36, 0xbc, 0xfe, 0xe9, 0x13, 0x07, - 0x0c, 0x03, 0xfe, 0x9c, 0xe7, 0x0c, 0x12, 0xfe, 0x15, 0x00, 0x92, 0x9e, 0x2d, 0x01, 0xd7, 0x07, - 0x06, 0x03, 0x0b, 0x49, 0x36, 0x37, 0x08, 0x3b, 0x07, 0x99, 0x01, 0x40, 0x11, 0x43, 0x08, 0x1c, - 0x07, 0x3f, 0x01, 0x76, 0x07, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x63, 0xf5, 0x30, - 0x75, 0xfe, 0x48, 0x55, 0x2f, 0xfe, 0xc9, 0x55, 0x03, 0x22, 0xbb, 0x6b, 0x16, 0xbb, 0x03, 0x0e, - 0xbd, 0x01, 0x14, 0xe5, 0x0e, 0x7c, 0x01, 0x14, 0xfe, 0x49, 0x44, 0x27, 0xfe, 0xe8, 0x17, 0x0e, - 0x1c, 0x01, 0x14, 0x05, 0x10, 0x48, 0x0e, 0x55, 0x01, 0xc0, 0x0e, 0x7c, 0x01, 0x14, 0x6b, 0x7d, - 0x03, 0xfe, 0x40, 0x5e, 0xfe, 0xe2, 0x08, 0xfe, 0xc0, 0x4c, 0x22, 0x3a, 0x05, 0x10, 0xfe, 0x52, - 0x12, 0x3c, 0x05, 0x00, 0xfe, 0x18, 0x12, 0xfe, 0xe1, 0x18, 0xfe, 0x19, 0xf4, 0xfe, 0x7f, 0x00, - 0xfe, 0x10, 0x13, 0xfe, 0xe2, 0x08, 0x6b, 0x3c, 0x3d, 0x05, 0x75, 0xa3, 0xfe, 0x82, 0x48, 0xfe, - 0x01, 0x80, 0xfe, 0xd7, 0x10, 0xfe, 0xc4, 0x48, 0x08, 0x2b, 0x07, 0x3a, 0xfe, 0x40, 0x5f, 0x1d, - 0x01, 0x40, 0x11, 0xfe, 0xdd, 0x00, 0xfe, 0x14, 0x46, 0x08, 0x2b, 0x07, 0x3a, 0x01, 0x40, 0x11, - 0xfe, 0xdd, 0x00, 0xfe, 0x40, 0x4a, 0x68, 0xfe, 0x06, 0x17, 0xfe, 0x01, 0x07, 0xfe, 0x82, 0x48, - 0xfe, 0x04, 0x17, 0x03, 0xe9, 0x18, 0x72, 0xfe, 0x70, 0x18, 0x04, 0xfe, 0x90, 0x00, 0xfe, 0x3a, - 0x45, 0xfe, 0x2c, 0x10, 0xe9, 0xcc, 0x72, 0xfe, 0x82, 0x18, 0x04, 0xfe, 0x92, 0x00, 0xc5, 0x1e, - 0xd9, 0xe9, 0xfe, 0x0b, 0x00, 0x72, 0xfe, 0x94, 0x18, 0x04, 0xfe, 0x94, 0x00, 0xc5, 0x19, 0xfe, - 0x08, 0x10, 0x04, 0xfe, 0x96, 0x00, 0xc5, 0x84, 0xfe, 0x4e, 0x45, 0xd2, 0xfe, 0x0a, 0x45, 0xff, - 0x04, 0x68, 0x54, 0xfe, 0xf1, 0x10, 0x1a, 0x87, 0x03, 0x05, 0xa1, 0xfe, 0x5a, 0xf0, 0xfe, 0xc0, - 0x18, 0x21, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10, 0x05, 0x1e, 0xfe, 0x5a, 0xf0, 0xfe, 0xce, 0x18, - 0x21, 0xcd, 0xfe, 0x26, 0x10, 0x05, 0x18, 0x82, 0x21, 0x84, 0xd9, 0x05, 0x0c, 0x82, 0x21, 0x88, - 0xfe, 0x0e, 0x10, 0x05, 0x06, 0x82, 0x21, 0x54, 0xc4, 0xab, 0x03, 0x17, 0xfe, 0x09, 0x00, 0x01, - 0x38, 0x2c, 0xfe, 0xfe, 0x18, 0x04, 0x6d, 0xac, 0x03, 0x1f, 0xfe, 0x16, 0x19, 0xfe, 0x14, 0xf0, - 0x0a, 0x2c, 0xfe, 0x12, 0x19, 0x03, 0xff, 0x34, 0x00, 0x00,}; + 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x00, 0xfc, 0x48, 0xe4, 0x01, 0x00, 0x18, 0xe4, + 0x00, 0xf6, 0x01, 0xf6, 0x18, 0x80, 0x48, 0x19, 0x02, 0x00, 0xff, 0xff, 0x03, 0xf6, 0x00, 0xfa, + 0xff, 0x00, 0x82, 0xe7, 0x01, 0xfa, 0x9e, 0xe7, 0x09, 0xe7, 0x3a, 0x0e, 0x00, 0xea, 0x01, 0xe6, + 0x55, 0xf0, 0x03, 0x00, 0x08, 0x00, 0x18, 0xf4, 0x3e, 0x01, 0x3e, 0x57, 0x04, 0x00, 0x85, 0xf0, + 0x00, 0xe6, 0x00, 0xec, 0x1e, 0xf0, 0x32, 0xf0, 0x34, 0x19, 0x86, 0xf0, 0xd0, 0x01, 0xd5, 0xf0, + 0xde, 0x0c, 0x98, 0x57, 0xbc, 0x00, 0x0c, 0x1c, 0x0e, 0x13, 0x38, 0x54, 0xb1, 0xf0, 0xb4, 0x00, + 0x01, 0xfc, 0x03, 0xfc, 0xd8, 0x0c, 0x00, 0x57, 0x01, 0xf0, 0x02, 0x13, 0x03, 0xe6, 0x10, 0x00, + 0x18, 0x40, 0x3e, 0x1c, 0x6c, 0x01, 0x6e, 0x01, 0xbd, 0x00, 0xe0, 0x00, 0x02, 0x48, 0x02, 0x80, + 0x08, 0x12, 0x30, 0xe4, 0x3c, 0x00, 0x4e, 0x01, 0x64, 0x12, 0x80, 0x00, 0x9c, 0x15, 0xbb, 0x00, + 0x00, 0x4e, 0x01, 0x01, 0x01, 0xea, 0x04, 0x12, 0x9e, 0x0f, 0xb6, 0x00, 0xb9, 0x54, 0xe2, 0x0f, + 0x00, 0x80, 0x06, 0xf7, 0x10, 0x44, 0x24, 0x01, 0x28, 0x01, 0x32, 0x00, 0x3c, 0x01, 0x3c, 0x56, + 0x3e, 0x00, 0x4b, 0xe4, 0x4c, 0x1c, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, 0x74, 0x01, + 0x76, 0x01, 0x78, 0x01, 0xe2, 0x0c, 0x00, 0x01, 0x02, 0xee, 0x02, 0xfc, 0x03, 0x58, 0x03, 0xf7, + 0x04, 0x80, 0x05, 0xfc, 0x08, 0x44, 0x09, 0xf0, 0x0f, 0x00, 0x1b, 0x80, 0x20, 0x01, 0x38, 0x1c, + 0x40, 0x00, 0x40, 0x15, 0x4b, 0xf4, 0x4e, 0x1c, 0x5b, 0xf0, 0x5d, 0xf0, 0xaa, 0x00, 0xbb, 0x55, + 0xbe, 0x00, 0xc0, 0x00, 0xe0, 0x08, 0xe0, 0x14, 0xec, 0x0f, 0x00, 0x4c, 0x00, 0xdc, 0x02, 0x4a, + 0x05, 0x00, 0x05, 0xf0, 0x05, 0xf8, 0x06, 0x13, 0x08, 0x13, 0x0c, 0x00, 0x0e, 0x47, 0x0e, 0xf7, + 0x19, 0x00, 0x20, 0x00, 0x2a, 0x01, 0x30, 0x0e, 0x32, 0x1c, 0x36, 0x00, 0x45, 0x5a, 0x59, 0xf0, + 0x62, 0x0a, 0x69, 0x08, 0x72, 0x0b, 0x83, 0x59, 0xb8, 0xf0, 0xbd, 0x56, 0xcc, 0x12, 0xec, 0x17, + 0xee, 0x0f, 0xf0, 0x00, 0xf8, 0x17, 0x01, 0x48, 0x02, 0xfa, 0x03, 0xfa, 0x04, 0x10, 0x04, 0xea, + 0x04, 0xf6, 0x04, 0xfc, 0x05, 0x80, 0x05, 0xe6, 0x06, 0x00, 0x06, 0x12, 0x0a, 0x10, 0x0b, 0xf0, + 0x0c, 0x10, 0x0c, 0xf0, 0x12, 0x10, 0x26, 0x0e, 0x30, 0x1c, 0x33, 0x00, 0x34, 0x00, 0x38, 0x44, + 0x40, 0x5c, 0x4a, 0xe4, 0x62, 0x1a, 0x68, 0x08, 0x68, 0x54, 0x83, 0x55, 0x83, 0x5a, 0x8c, 0x14, + 0x8e, 0x0a, 0x90, 0x14, 0x91, 0x44, 0xa4, 0x00, 0xb0, 0x57, 0xb5, 0x00, 0xba, 0x00, 0xce, 0x45, + 0xd0, 0x00, 0xd8, 0x16, 0xe1, 0x00, 0xe7, 0x00, 0x00, 0x54, 0x01, 0x58, 0x02, 0x10, 0x02, 0xe6, + 0x03, 0xa1, 0x04, 0x13, 0x06, 0x83, 0x06, 0xf0, 0x07, 0x00, 0x0a, 0x00, 0x0a, 0x12, 0x0a, 0xf0, + 0x0c, 0x04, 0x0c, 0x12, 0x0c, 0x90, 0x10, 0x10, 0x10, 0x13, 0x12, 0x1c, 0x17, 0x00, 0x19, 0xe4, + 0x1a, 0x10, 0x1c, 0x00, 0x1c, 0x12, 0x1d, 0xf7, 0x1e, 0x13, 0x20, 0x1c, 0x20, 0xe7, 0x22, 0x01, + 0x26, 0x01, 0x2a, 0x12, 0x30, 0xe7, 0x34, 0x1c, 0x36, 0x1c, 0x38, 0x12, 0x41, 0x58, 0x43, 0x48, + 0x44, 0x55, 0x46, 0x1c, 0x4c, 0x0e, 0x4e, 0xe4, 0x52, 0x14, 0x5c, 0xf0, 0x72, 0x02, 0x74, 0x03, + 0x77, 0x57, 0x89, 0x48, 0x8e, 0x90, 0x99, 0x00, 0x9b, 0x00, 0x9c, 0x32, 0x9e, 0x00, 0xa8, 0x00, + 0xb9, 0x00, 0xba, 0x06, 0xbc, 0x12, 0xbf, 0x57, 0xc0, 0x01, 0xfe, 0x9c, 0xf0, 0x26, 0x02, 0xfe, + 0x00, 0x0d, 0xff, 0x10, 0x00, 0x00, 0xfe, 0xc2, 0x01, 0xfe, 0x56, 0x19, 0x00, 0xfc, 0xfe, 0x80, + 0x01, 0xff, 0x03, 0x00, 0x00, 0xfe, 0x6a, 0x13, 0xfe, 0x05, 0x05, 0xff, 0x40, 0x00, 0x00, 0x0d, + 0xff, 0x09, 0x00, 0x00, 0xff, 0x08, 0x01, 0x01, 0xff, 0x10, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, + 0xff, 0x10, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, + 0x00, 0x00, 0xfe, 0x04, 0xf7, 0xfc, 0x2b, 0x51, 0x0c, 0x01, 0xfe, 0xea, 0x0e, 0xfe, 0x04, 0xf7, + 0xfc, 0x51, 0x0c, 0x1d, 0x2b, 0xfe, 0x3d, 0xf0, 0xfe, 0xf8, 0x01, 0xfe, 0x20, 0xf0, 0xd0, 0x04, + 0x56, 0x4b, 0x02, 0xfe, 0x1c, 0x0d, 0x01, 0xfe, 0x7c, 0x0d, 0xfe, 0xe9, 0x12, 0x02, 0xfe, 0x04, + 0x03, 0xfe, 0x28, 0x1c, 0x04, 0xfe, 0xa6, 0x00, 0xfe, 0xdd, 0x12, 0x4e, 0x12, 0xfe, 0xa6, 0x00, + 0xc5, 0xfe, 0x48, 0xf0, 0xfe, 0x7c, 0x02, 0xfe, 0x49, 0xf0, 0xfe, 0x96, 0x02, 0xfe, 0x4a, 0xf0, + 0xfe, 0xb4, 0x02, 0xfe, 0x46, 0xf0, 0xfe, 0x46, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x4c, 0x02, 0xfe, + 0x43, 0xf0, 0xfe, 0x3a, 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x3e, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x42, + 0x02, 0x09, 0x0c, 0x9e, 0x09, 0x06, 0x12, 0xbb, 0x02, 0x26, 0xfe, 0x00, 0x1c, 0xfe, 0xf1, 0x10, + 0xfe, 0x02, 0x1c, 0xfe, 0xed, 0x10, 0xfe, 0x1e, 0x1c, 0xfe, 0xe9, 0x10, 0x01, 0xfe, 0x4c, 0x17, + 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xf7, 0x0e, 0x78, 0x01, 0xab, 0x02, 0x26, 0x17, 0x55, 0x4a, + 0xbd, 0x01, 0xfe, 0x60, 0x0f, 0x0e, 0x78, 0x01, 0x8b, 0xfe, 0xbd, 0x10, 0x0e, 0x78, 0x01, 0x8b, + 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe, 0x58, 0x1c, 0x09, 0x06, 0x12, 0xbb, 0x2b, 0x22, 0x26, + 0xfe, 0x3d, 0xf0, 0xfe, 0xf8, 0x01, 0x27, 0xfe, 0x8a, 0x02, 0xfe, 0x5a, 0x1c, 0xd5, 0xfe, 0x14, + 0x1c, 0x17, 0xfe, 0x30, 0x00, 0x4a, 0xbd, 0x01, 0xfe, 0x50, 0x0f, 0x09, 0x06, 0x12, 0xbb, 0x02, + 0xfe, 0xc2, 0x01, 0x21, 0x2a, 0x05, 0x10, 0x35, 0xfe, 0x69, 0x10, 0x09, 0x06, 0x12, 0xbb, 0xfe, + 0x04, 0xec, 0x2a, 0x08, 0x2a, 0x09, 0x3c, 0x1d, 0x01, 0x46, 0x7f, 0xfe, 0x05, 0xf6, 0xf7, 0x01, + 0xfe, 0x76, 0x16, 0x0a, 0x41, 0x89, 0x38, 0x11, 0x47, 0x1d, 0xca, 0x08, 0x1c, 0x09, 0x43, 0x01, + 0x71, 0x02, 0x26, 0x0e, 0x3d, 0x01, 0x15, 0x05, 0x10, 0x2c, 0x08, 0x1c, 0x09, 0x43, 0x01, 0x7b, + 0xfe, 0x28, 0x10, 0x0e, 0xc0, 0x01, 0x15, 0xe6, 0x0e, 0x79, 0x01, 0x15, 0xfe, 0x49, 0x54, 0x74, + 0xfe, 0x12, 0x03, 0x08, 0x1c, 0x09, 0x43, 0x01, 0x71, 0x02, 0x26, 0x2b, 0x7f, 0xfe, 0x02, 0xe8, + 0x2f, 0xfb, 0xfe, 0x9e, 0x43, 0xf0, 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xd0, 0xfe, 0x40, 0x1c, + 0x22, 0xef, 0xfe, 0x26, 0xf0, 0xfe, 0x70, 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x5e, 0x03, 0xfe, 0x11, + 0xf0, 0xd0, 0xfe, 0x0e, 0x10, 0xfe, 0x9f, 0xf0, 0xfe, 0x7e, 0x03, 0xe9, 0x13, 0xfe, 0x11, 0x00, + 0x02, 0x62, 0x2b, 0xfe, 0x48, 0x1c, 0xe9, 0x22, 0xef, 0x34, 0xef, 0xfe, 0x82, 0xf0, 0xfe, 0x84, + 0x03, 0x2d, 0x21, 0xbe, 0x6a, 0x16, 0xbe, 0x0e, 0x79, 0x01, 0x15, 0x6a, 0x7d, 0x08, 0x1c, 0x09, + 0x43, 0x01, 0x46, 0x11, 0x3d, 0x08, 0x3d, 0x09, 0x99, 0x01, 0x71, 0xf5, 0x11, 0xfe, 0xe4, 0x00, + 0x2e, 0xfe, 0xca, 0x03, 0x22, 0x32, 0x1f, 0xfe, 0xda, 0x03, 0x01, 0x4c, 0xcb, 0xfe, 0xea, 0x03, + 0x6b, 0x92, 0xcf, 0xfe, 0xaa, 0x06, 0x02, 0x28, 0x04, 0x78, 0x29, 0x18, 0xfe, 0x1c, 0x05, 0x17, + 0x85, 0x01, 0x44, 0x01, 0x97, 0x01, 0x9a, 0x34, 0xfe, 0x5c, 0x02, 0x02, 0xee, 0xe9, 0x2b, 0x51, + 0x19, 0xfe, 0x67, 0x1b, 0xfb, 0xf0, 0xfe, 0x48, 0x1c, 0x8c, 0x01, 0xfa, 0xac, 0xfe, 0x96, 0xf0, + 0xfe, 0x24, 0x04, 0x2e, 0xfe, 0x28, 0x04, 0x34, 0x26, 0x0e, 0x3d, 0x01, 0x15, 0x05, 0x10, 0x18, + 0xfe, 0x08, 0x05, 0x3e, 0x90, 0x9f, 0x2f, 0x82, 0x6e, 0x22, 0x32, 0x1f, 0x28, 0x04, 0x78, 0x29, + 0xfe, 0x10, 0x12, 0x17, 0x85, 0x01, 0x44, 0x34, 0xfe, 0x5c, 0x02, 0x02, 0xee, 0x31, 0xfe, 0xa0, + 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x5e, 0x12, 0x0a, 0x07, 0x06, 0xfe, 0x56, 0x12, 0x23, 0x24, 0x91, + 0x01, 0x0b, 0x82, 0x6e, 0x1f, 0xfe, 0xd8, 0x04, 0x23, 0x24, 0x91, 0x01, 0x0b, 0x1f, 0x28, 0x23, + 0x24, 0xb3, 0xfe, 0x4c, 0x44, 0xfe, 0x32, 0x12, 0x57, 0xfe, 0x44, 0x48, 0x08, 0xd6, 0xfe, 0x4c, + 0x54, 0x74, 0xfe, 0x08, 0x05, 0x7f, 0x9f, 0x2f, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x48, + 0x13, 0x3f, 0x05, 0xfe, 0xcc, 0x00, 0xfe, 0x40, 0x13, 0x0a, 0x07, 0x06, 0xe5, 0xfe, 0x06, 0x10, + 0x23, 0x24, 0xb3, 0x0a, 0x07, 0x37, 0xda, 0x17, 0xa4, 0x0a, 0x07, 0x06, 0x4b, 0x17, 0xfe, 0x0d, + 0x00, 0x01, 0x44, 0x34, 0xfe, 0xc0, 0x0c, 0x02, 0x28, 0x39, 0x11, 0xfe, 0xe6, 0x00, 0xfe, 0x1c, + 0x90, 0xb0, 0x03, 0x17, 0xa4, 0x01, 0x44, 0x34, 0x26, 0x22, 0x26, 0x02, 0xfe, 0x10, 0x05, 0xfe, + 0x42, 0x5b, 0x51, 0x19, 0xfe, 0x46, 0x59, 0xfb, 0xf0, 0x17, 0x45, 0xfe, 0x07, 0x80, 0xfe, 0x31, + 0x44, 0x0a, 0x07, 0x0c, 0xfe, 0x78, 0x13, 0xfe, 0x20, 0x80, 0x05, 0x19, 0xfe, 0x70, 0x12, 0x6d, + 0x07, 0x06, 0xfe, 0x60, 0x13, 0x04, 0xfe, 0xa2, 0x00, 0x29, 0x18, 0xfe, 0xa8, 0x05, 0xfe, 0x31, + 0xe4, 0x70, 0x6d, 0x07, 0x0c, 0xfe, 0x4a, 0x13, 0x04, 0xfe, 0xa0, 0x00, 0x29, 0xfe, 0x42, 0x12, + 0x5a, 0x2e, 0xfe, 0x68, 0x05, 0x22, 0x32, 0xf1, 0x01, 0x0b, 0x25, 0xfe, 0xc0, 0x05, 0x11, 0xfe, + 0xe3, 0x00, 0x2d, 0x6d, 0xfe, 0x4a, 0xf0, 0xfe, 0x92, 0x05, 0xfe, 0x49, 0xf0, 0xfe, 0x8c, 0x05, + 0xa8, 0x20, 0xfe, 0x21, 0x00, 0xa6, 0x20, 0xfe, 0x22, 0x00, 0x9e, 0x20, 0x89, 0xfe, 0x09, 0x48, + 0x01, 0x0b, 0x25, 0xfe, 0xc0, 0x05, 0xfe, 0xe2, 0x08, 0x6d, 0x07, 0xd9, 0x4b, 0x01, 0x96, 0x20, + 0x06, 0x16, 0xe0, 0x4a, 0xfe, 0x27, 0x01, 0x0a, 0x07, 0x37, 0xe1, 0x4e, 0x01, 0xb9, 0x17, 0xa4, + 0x0a, 0x07, 0x06, 0x4b, 0x17, 0xfe, 0x0d, 0x00, 0x01, 0x44, 0x01, 0x97, 0x01, 0x9a, 0x34, 0xfe, + 0xc0, 0x0c, 0x02, 0x28, 0x04, 0xfe, 0x9c, 0x00, 0x29, 0xfe, 0x3e, 0x12, 0x04, 0x53, 0x29, 0xfe, + 0x36, 0x13, 0x4e, 0x01, 0xb9, 0x25, 0xfe, 0x38, 0x06, 0x0e, 0x06, 0x6d, 0x07, 0x1a, 0xfe, 0x02, + 0x12, 0x77, 0x01, 0xfe, 0x26, 0x14, 0x1f, 0xfe, 0x2e, 0x06, 0x11, 0xc2, 0x01, 0x4c, 0x11, 0xfe, + 0xe5, 0x00, 0x04, 0x53, 0xbc, 0x0f, 0x53, 0x04, 0xf6, 0x29, 0xfe, 0x62, 0x12, 0x04, 0x4d, 0x29, + 0xfe, 0x5a, 0x13, 0x01, 0xfe, 0x9e, 0x18, 0x01, 0xfe, 0xf0, 0x18, 0xe7, 0xa3, 0x1a, 0x08, 0x63, + 0xff, 0x02, 0x00, 0x57, 0x66, 0x7e, 0x1b, 0x50, 0xc9, 0xa3, 0x6c, 0x4e, 0x01, 0xb9, 0x25, 0xfe, + 0xa2, 0x06, 0x6d, 0x07, 0x1e, 0xa5, 0x95, 0x0e, 0x55, 0x01, 0xfe, 0x54, 0x14, 0x1f, 0xfe, 0x98, + 0x06, 0x11, 0xc2, 0x01, 0x4c, 0x11, 0xfe, 0xe5, 0x00, 0x04, 0x4d, 0xbc, 0x0f, 0x4d, 0x09, 0x06, + 0x01, 0xb9, 0xf5, 0x73, 0x8c, 0x01, 0xfa, 0xac, 0x11, 0xfe, 0xe2, 0x00, 0x2e, 0xf9, 0x22, 0x32, + 0xcf, 0xfe, 0xd6, 0x06, 0x81, 0xfe, 0x74, 0x07, 0xcb, 0xfe, 0x7c, 0x07, 0x6b, 0x92, 0x02, 0x28, + 0x0a, 0x07, 0x0c, 0xfe, 0x2e, 0x12, 0x14, 0x19, 0x01, 0x0b, 0x14, 0x00, 0x01, 0x0b, 0x14, 0x00, + 0x01, 0x0b, 0x14, 0x00, 0x01, 0x0b, 0xfe, 0x99, 0xa4, 0x01, 0x0b, 0x14, 0x00, 0x02, 0xfe, 0x4c, + 0x08, 0x68, 0x07, 0x1e, 0xe5, 0x0a, 0x07, 0x1e, 0xfe, 0x30, 0x13, 0x14, 0xfe, 0x1b, 0x00, 0x01, + 0x0b, 0x14, 0x00, 0x01, 0x0b, 0x14, 0x00, 0x01, 0x0b, 0x14, 0x00, 0x01, 0x0b, 0x14, 0x06, 0x01, + 0x0b, 0x14, 0x00, 0x02, 0xfe, 0x2a, 0x0b, 0x77, 0xfe, 0x9a, 0x81, 0x67, 0x89, 0xfe, 0x09, 0x6f, + 0xfe, 0x93, 0x45, 0x18, 0xfe, 0x84, 0x07, 0x2e, 0xfe, 0x5c, 0x07, 0x22, 0x32, 0xcf, 0xfe, 0x54, + 0x07, 0x6b, 0x92, 0x81, 0xfe, 0x74, 0x07, 0x02, 0x28, 0x01, 0x4c, 0x02, 0xf9, 0x14, 0x1a, 0x02, + 0xf9, 0xfe, 0x9c, 0xf7, 0xfe, 0xec, 0x07, 0xfe, 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x75, 0xfe, 0xd2, + 0x07, 0x0f, 0x5d, 0x12, 0x5e, 0x0a, 0x41, 0x70, 0x38, 0x01, 0xfe, 0x34, 0x18, 0x05, 0x10, 0x83, + 0xfe, 0x83, 0xe7, 0x88, 0xa6, 0xfe, 0x03, 0x40, 0x0a, 0x41, 0x45, 0x38, 0x01, 0xc1, 0xaf, 0xfe, + 0x1f, 0x40, 0x16, 0x61, 0x01, 0xfe, 0xde, 0x12, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0xfe, 0x34, + 0x51, 0xfe, 0xb6, 0x51, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0f, 0x5b, 0x12, 0x5c, 0xd2, 0xf2, + 0x0f, 0x3a, 0x12, 0x3b, 0xfe, 0x60, 0x10, 0x0a, 0x07, 0x70, 0xe1, 0xfe, 0x2c, 0x90, 0xfe, 0xae, + 0x90, 0x0f, 0x5d, 0x12, 0x5e, 0x0a, 0x07, 0x45, 0xc9, 0x01, 0xc1, 0xfe, 0x1f, 0x80, 0x16, 0x61, + 0xfe, 0x34, 0x90, 0xfe, 0xb6, 0x90, 0x0f, 0x5f, 0x12, 0x60, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, + 0x0f, 0x5b, 0x12, 0x5c, 0xa2, 0x07, 0x45, 0x2c, 0xd2, 0xf2, 0x0f, 0x3a, 0x12, 0x3b, 0xa8, 0xfe, + 0x28, 0x90, 0xfe, 0xaa, 0x90, 0x0f, 0x3a, 0x12, 0x3b, 0x0f, 0x42, 0x12, 0x58, 0x0a, 0x41, 0x1a, + 0x38, 0x2b, 0x08, 0x80, 0x2e, 0xfe, 0x62, 0x08, 0xfe, 0x9e, 0xf0, 0xfe, 0x76, 0x08, 0x9b, 0x18, + 0x32, 0x2b, 0x52, 0xfe, 0xed, 0x10, 0xa7, 0xfe, 0x9a, 0x08, 0xa9, 0xfe, 0xb6, 0x08, 0x81, 0xfe, + 0x8e, 0x08, 0xcb, 0xfe, 0x94, 0x08, 0x6b, 0x92, 0x02, 0x28, 0x01, 0x4c, 0xfe, 0xc9, 0x10, 0x14, + 0x1a, 0xfe, 0xc9, 0x10, 0x68, 0x07, 0x06, 0xfe, 0x10, 0x12, 0x68, 0x07, 0x0c, 0x40, 0x0a, 0x07, + 0x0c, 0xfe, 0x7e, 0x12, 0xfe, 0x2e, 0x1c, 0xaa, 0x68, 0x07, 0x06, 0x40, 0x68, 0x07, 0x0c, 0xfe, + 0x6a, 0x12, 0xfe, 0x2c, 0x1c, 0xa2, 0x07, 0x45, 0xd4, 0xa2, 0x41, 0x45, 0xfe, 0x05, 0x40, 0xd2, + 0xf2, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, 0xfe, 0xaa, 0xf0, 0xfe, 0x4e, 0x09, 0xfe, 0xac, 0xf0, + 0xfe, 0xee, 0x08, 0xfe, 0x92, 0x10, 0xe3, 0xfe, 0xf3, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0xfa, 0x08, + 0x02, 0xfe, 0x5c, 0x0a, 0xe4, 0xfe, 0xe7, 0x10, 0xfe, 0x2b, 0xf0, 0xb8, 0xfe, 0x6b, 0x18, 0x1b, + 0xfe, 0x00, 0xfe, 0xda, 0xc5, 0xfe, 0xd2, 0xf0, 0xb8, 0xfe, 0x76, 0x18, 0x1b, 0x19, 0x18, 0xb8, + 0x04, 0xdf, 0x1b, 0x06, 0x18, 0xb8, 0xa7, 0x7a, 0xa9, 0x7a, 0xe3, 0xe4, 0xfe, 0xb1, 0x10, 0x8c, + 0x5a, 0x39, 0x17, 0xa4, 0x01, 0x44, 0x13, 0xfe, 0x35, 0x00, 0x34, 0x62, 0x13, 0x8d, 0x02, 0x62, + 0xfe, 0x74, 0x18, 0x1b, 0xfe, 0x00, 0xf8, 0x18, 0x7a, 0x51, 0x1e, 0x01, 0xfe, 0x7c, 0x0d, 0xd1, + 0x08, 0x1c, 0x09, 0x43, 0x01, 0x71, 0x21, 0x2f, 0x3e, 0x51, 0x19, 0x02, 0x7a, 0xfe, 0x98, 0x80, + 0xd7, 0x0c, 0x27, 0xfe, 0x3e, 0x0a, 0x0a, 0x07, 0x70, 0xfe, 0x82, 0x12, 0x0a, 0x07, 0x1a, 0xfe, + 0x66, 0x13, 0x21, 0x61, 0x6a, 0xc8, 0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, + 0x04, 0x91, 0xfe, 0x86, 0x91, 0x64, 0x2f, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x75, 0xfe, 0xea, + 0x08, 0x04, 0x5d, 0x30, 0x5e, 0x0f, 0xae, 0x12, 0x8d, 0x9c, 0x5d, 0x9d, 0x5e, 0x01, 0xc1, 0xaf, + 0x64, 0x2f, 0x16, 0x61, 0xa1, 0x42, 0x69, 0x58, 0x65, 0x5f, 0x31, 0x60, 0xe8, 0xfe, 0xe5, 0x55, + 0xfe, 0x04, 0xfa, 0x42, 0xfe, 0x05, 0xfa, 0x58, 0x01, 0xfe, 0xde, 0x12, 0xfe, 0x36, 0x10, 0x2d, + 0x0f, 0xae, 0x0f, 0x8d, 0x65, 0x5f, 0x31, 0x60, 0xaa, 0x0a, 0x07, 0x1a, 0x18, 0xfe, 0xea, 0x08, + 0x65, 0x3a, 0x31, 0x3b, 0x0a, 0x07, 0xfe, 0xf7, 0x00, 0x38, 0x04, 0x5b, 0x30, 0x5c, 0xfe, 0x10, + 0x58, 0xfe, 0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x02, 0x7a, 0x0a, 0x07, 0x1a, 0x18, + 0xfe, 0xea, 0x08, 0x0a, 0x07, 0xfe, 0xf7, 0x00, 0x38, 0xfe, 0x3a, 0x55, 0xfe, 0x19, 0x81, 0x77, + 0xfe, 0x10, 0x90, 0xfe, 0x92, 0x90, 0xfe, 0xd7, 0x10, 0x3f, 0x05, 0xc3, 0x18, 0xfe, 0xf6, 0x08, + 0x11, 0xc3, 0xfe, 0x98, 0x80, 0xd7, 0x0c, 0xfe, 0x14, 0x13, 0x04, 0x3a, 0x30, 0x3b, 0x75, 0xfe, + 0xf6, 0x08, 0xfe, 0x0c, 0x58, 0xfe, 0x8d, 0x58, 0x02, 0x7a, 0x2d, 0x4e, 0xfe, 0x19, 0x80, 0xfe, + 0xf1, 0x10, 0x0a, 0x07, 0x0c, 0xa5, 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xfe, 0x8e, 0x10, 0xfe, + 0x6c, 0x19, 0x9c, 0x3a, 0xfe, 0xed, 0x19, 0x9d, 0x3b, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xfe, + 0x6b, 0x18, 0x1b, 0xfe, 0x00, 0xff, 0x35, 0xfe, 0x74, 0x10, 0xc5, 0xfe, 0xd2, 0xf0, 0xfe, 0xd6, + 0x0a, 0xfe, 0x76, 0x18, 0x1b, 0x19, 0xce, 0x04, 0xdf, 0x1b, 0x06, 0x84, 0x13, 0xfe, 0x16, 0x00, + 0x02, 0x62, 0xfe, 0xd1, 0xf0, 0xfe, 0xe8, 0x0a, 0x17, 0x80, 0x01, 0x44, 0x13, 0xd6, 0xfe, 0x42, + 0x10, 0xfe, 0xce, 0xf0, 0xfe, 0xee, 0x0a, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xfa, 0x0a, + 0x13, 0xfe, 0x22, 0x00, 0x02, 0x62, 0xfe, 0xcb, 0xf0, 0xfe, 0x06, 0x0b, 0x13, 0xfe, 0x24, 0x00, + 0x02, 0x62, 0xfe, 0xd0, 0xf0, 0xfe, 0x10, 0x0b, 0x13, 0x88, 0xd8, 0xfe, 0xcf, 0xf0, 0xfe, 0x1a, + 0x0b, 0x13, 0x89, 0xd3, 0xfe, 0xcc, 0xf0, 0xfe, 0x2a, 0x0b, 0xfe, 0x84, 0x80, 0xd7, 0x1a, 0x4b, + 0x13, 0xfe, 0x12, 0x00, 0x2b, 0x08, 0x80, 0x2e, 0xfe, 0x30, 0x0b, 0xfe, 0x9e, 0xf0, 0xfe, 0x44, + 0x0b, 0x9b, 0x18, 0x32, 0x2b, 0x52, 0xfe, 0xed, 0x10, 0xa7, 0x28, 0xa9, 0x28, 0x2b, 0xf5, 0x2e, + 0xfe, 0x50, 0x0b, 0x22, 0x32, 0x81, 0xfe, 0x6c, 0x0b, 0x6b, 0x92, 0xa7, 0xfe, 0xec, 0x07, 0xa9, + 0xfe, 0xec, 0x07, 0x02, 0x28, 0x01, 0x4c, 0xfe, 0xdb, 0x10, 0x11, 0xfe, 0xe8, 0x00, 0xe3, 0xe4, + 0x8c, 0x82, 0x6e, 0xfe, 0x89, 0xf0, 0x28, 0x23, 0x24, 0xfe, 0xe9, 0x09, 0x01, 0x0b, 0x82, 0x6e, + 0x1f, 0x28, 0x23, 0x24, 0x91, 0x34, 0xfe, 0xa8, 0x0b, 0x22, 0x32, 0x02, 0xfe, 0x9c, 0x0b, 0x9b, + 0x40, 0x13, 0xfe, 0x42, 0x00, 0x02, 0x62, 0xa0, 0x06, 0xfe, 0x81, 0x49, 0x96, 0x0a, 0x07, 0x0c, + 0xfe, 0x5a, 0x13, 0x13, 0x00, 0x59, 0x0c, 0xfe, 0x6a, 0x12, 0x59, 0xfe, 0x28, 0x00, 0x27, 0xfe, + 0xee, 0x0c, 0x0e, 0x79, 0x01, 0x15, 0x05, 0x00, 0x84, 0x36, 0xfe, 0x28, 0x00, 0x02, 0xfe, 0xee, + 0x0c, 0x01, 0x97, 0x01, 0x9a, 0x0e, 0xc0, 0x01, 0xfe, 0x44, 0x0e, 0xb2, 0x08, 0x3d, 0x09, 0x99, + 0x01, 0x46, 0x11, 0x47, 0x08, 0x1c, 0x09, 0x43, 0x01, 0x7b, 0x02, 0x26, 0x13, 0xfe, 0x44, 0x00, + 0x59, 0x0c, 0xa5, 0x36, 0x0c, 0xfe, 0xc0, 0x10, 0x01, 0x96, 0x36, 0x0c, 0xfe, 0xb6, 0x10, 0x01, + 0x96, 0xfe, 0x19, 0x82, 0xfe, 0x34, 0x46, 0xfe, 0x0a, 0x13, 0x36, 0x0c, 0x13, 0xfe, 0x43, 0x00, + 0xfe, 0xa2, 0x10, 0x0a, 0x41, 0x0c, 0x38, 0x01, 0x97, 0x01, 0x9a, 0xb2, 0x08, 0x3d, 0x09, 0x99, + 0x01, 0x46, 0x11, 0x47, 0x08, 0x1c, 0x09, 0x43, 0x01, 0x7b, 0x51, 0x0c, 0xb2, 0x1d, 0xca, 0x02, + 0xfe, 0x48, 0x03, 0x0a, 0x07, 0x0c, 0xce, 0x36, 0x0c, 0x13, 0x00, 0xfe, 0x54, 0x10, 0x68, 0x07, + 0x1e, 0xfe, 0x50, 0x12, 0x0a, 0x07, 0x1e, 0xfe, 0x48, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, + 0xfe, 0xac, 0x0c, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0xb2, 0x0c, 0x0a, 0x41, 0x1e, 0x38, + 0xfe, 0x95, 0x10, 0x13, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0c, 0x77, 0xfe, 0x26, 0x10, 0x13, + 0xfe, 0x13, 0x00, 0xd3, 0x13, 0xfe, 0x47, 0x00, 0xa6, 0x13, 0xfe, 0x41, 0x00, 0x9e, 0x13, 0xfe, + 0x24, 0x00, 0x04, 0x78, 0x29, 0x27, 0xee, 0x77, 0xfe, 0x04, 0xe6, 0x1e, 0xfe, 0x9d, 0x41, 0xfe, + 0x1c, 0x42, 0xb2, 0x01, 0xea, 0x02, 0x26, 0xd5, 0x17, 0x0c, 0x4a, 0xf4, 0xdd, 0x17, 0xfe, 0x31, + 0x00, 0x4a, 0xbd, 0x01, 0xfe, 0x50, 0x0f, 0x02, 0xfe, 0xc2, 0x01, 0x1d, 0xfe, 0x06, 0xec, 0xf8, + 0x86, 0x36, 0x37, 0xbf, 0x35, 0x1d, 0xfe, 0x06, 0xea, 0xf8, 0xfe, 0x47, 0x4b, 0x95, 0xfe, 0x75, + 0x57, 0x04, 0x56, 0xfe, 0x98, 0x56, 0xfe, 0x28, 0x12, 0x0e, 0x79, 0xfe, 0xf4, 0x14, 0x4e, 0xe6, + 0x0e, 0xc0, 0xfe, 0xea, 0x14, 0xfe, 0x49, 0x54, 0x8f, 0xfe, 0x62, 0x0d, 0x0e, 0x1c, 0xfe, 0xde, + 0x14, 0xfe, 0x44, 0x48, 0x02, 0xfe, 0x48, 0x03, 0x0e, 0x56, 0xfe, 0xc8, 0x14, 0x86, 0x36, 0x37, + 0xbf, 0x35, 0x1d, 0xfe, 0xce, 0x47, 0xfe, 0xbd, 0x13, 0x02, 0x26, 0x21, 0x2a, 0x05, 0x10, 0xfe, + 0x78, 0x12, 0x2d, 0x16, 0x55, 0x16, 0xad, 0x21, 0x47, 0x4e, 0x4a, 0x47, 0x9b, 0xfe, 0x0c, 0x13, + 0xfe, 0xbc, 0xf0, 0xfe, 0xfe, 0x0d, 0x08, 0x06, 0x16, 0x55, 0x01, 0xfe, 0x06, 0x16, 0x04, 0xfe, + 0x38, 0x01, 0x30, 0xfe, 0x3a, 0x01, 0x75, 0xfe, 0x02, 0x0e, 0x04, 0xfe, 0x38, 0x01, 0x1b, 0xfe, + 0xf0, 0xff, 0x0f, 0xfe, 0x60, 0x01, 0x04, 0xfe, 0x3a, 0x01, 0x0f, 0xfe, 0x62, 0x01, 0x20, 0x06, + 0x16, 0x47, 0xfe, 0x04, 0xec, 0x2a, 0x08, 0x2a, 0x09, 0x3c, 0x1d, 0x01, 0x46, 0x7f, 0xfe, 0x05, + 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x76, 0x16, 0x11, 0x47, 0xca, 0x08, 0x06, 0x03, 0x2d, 0x03, + 0x21, 0x55, 0xfe, 0xf7, 0x12, 0x21, 0xad, 0x6a, 0x16, 0xad, 0x05, 0x80, 0xfe, 0x93, 0x13, 0xfe, + 0x24, 0x1c, 0x17, 0x19, 0x4a, 0xf4, 0xdd, 0xfe, 0xd9, 0x10, 0x93, 0xfe, 0x03, 0xdc, 0xfe, 0x73, + 0x57, 0xfe, 0x80, 0x5d, 0x03, 0x93, 0xfe, 0x03, 0xdc, 0xfe, 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x03, + 0xfe, 0x03, 0x57, 0x93, 0x2d, 0xfe, 0x00, 0xcc, 0x03, 0xfe, 0x03, 0x57, 0x93, 0x7d, 0x03, 0x01, + 0xfe, 0xae, 0x16, 0x3f, 0x05, 0x47, 0xfe, 0x0a, 0x13, 0x08, 0x1c, 0x09, 0x43, 0xd3, 0x01, 0x97, + 0x01, 0x9a, 0x08, 0x3d, 0x09, 0x99, 0x01, 0x46, 0x11, 0xfe, 0xe9, 0x00, 0x0a, 0x07, 0x89, 0xfe, + 0x52, 0x13, 0x01, 0xfe, 0x38, 0x16, 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, 0x0f, 0xfe, 0x64, 0x01, + 0xfe, 0x16, 0x90, 0x0f, 0xfe, 0x66, 0x01, 0x0a, 0x07, 0x45, 0xe5, 0xfe, 0x03, 0x80, 0x52, 0x3e, + 0x11, 0x76, 0x08, 0x2a, 0x09, 0x3c, 0x1d, 0x90, 0x01, 0x71, 0xfe, 0x62, 0x08, 0x6a, 0x3e, 0x11, + 0x76, 0x08, 0x2a, 0x09, 0x3c, 0x1d, 0x90, 0x01, 0x71, 0x64, 0x2f, 0x11, 0x76, 0x08, 0x2a, 0x09, + 0x3c, 0x1d, 0x90, 0x01, 0x7b, 0x03, 0xfe, 0x08, 0x1c, 0x04, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58, + 0x04, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x04, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58, 0x04, 0xfe, + 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, 0x20, 0x6c, 0x16, 0xf8, 0x2d, 0x0f, 0x53, 0x0f, + 0x4d, 0x20, 0x10, 0x16, 0x2a, 0x16, 0x3c, 0x57, 0xa0, 0xd6, 0x08, 0x2a, 0x09, 0x3c, 0x1d, 0x01, + 0x7b, 0x7f, 0x11, 0x76, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x2a, 0x0f, 0xd5, 0x8c, 0xfe, + 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, 0x18, 0x1c, 0x03, 0x1d, 0xfe, 0x0c, 0x14, 0x86, 0xfe, 0x07, + 0xe6, 0x37, 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x03, 0x01, 0x96, 0x0e, 0x3d, 0x01, 0x15, 0x05, + 0x10, 0x2c, 0x0e, 0x1c, 0x01, 0x15, 0x05, 0x10, 0xda, 0xfe, 0x44, 0x58, 0x3e, 0xfe, 0x01, 0xec, + 0xbd, 0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1e, 0x9f, 0x2f, 0x01, 0xea, + 0xfe, 0xc9, 0x10, 0x03, 0x2b, 0x82, 0x6e, 0x23, 0x24, 0xb3, 0x05, 0x1e, 0xfe, 0x48, 0x12, 0x05, + 0x0c, 0xfe, 0x4c, 0x12, 0x05, 0x19, 0xfe, 0x30, 0x12, 0x05, 0xcc, 0x18, 0xfe, 0xf4, 0x10, 0x05, + 0xfe, 0x23, 0x00, 0x18, 0xfe, 0x00, 0x11, 0x05, 0x06, 0x18, 0xfe, 0x5e, 0x11, 0x05, 0x1a, 0xfe, + 0x12, 0x12, 0x05, 0x00, 0x18, 0x28, 0x17, 0xcc, 0x01, 0x44, 0xc6, 0x39, 0x01, 0x0b, 0x81, 0x4c, + 0x03, 0x39, 0x11, 0xfe, 0xcc, 0x00, 0x02, 0x26, 0x39, 0x3f, 0x05, 0xc3, 0xfe, 0xe3, 0x13, 0x65, + 0x3a, 0x31, 0x3b, 0x75, 0xfe, 0xb2, 0x10, 0x0a, 0x07, 0x70, 0xfe, 0x72, 0x12, 0xa1, 0x42, 0x69, + 0x58, 0xe8, 0xfe, 0xe5, 0x55, 0x8f, 0xfe, 0x7c, 0x10, 0x21, 0x61, 0xfe, 0x26, 0x13, 0x04, 0xae, + 0x30, 0x8d, 0x75, 0xfe, 0xd2, 0x0c, 0x0f, 0x5d, 0x12, 0x5e, 0x2d, 0x0f, 0xae, 0x0f, 0x8d, 0x01, + 0xc1, 0x20, 0x6c, 0x52, 0x16, 0x61, 0x01, 0xfe, 0xde, 0x12, 0xa1, 0x42, 0x69, 0x58, 0xfe, 0x04, + 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x42, 0xfe, 0x05, 0xfa, 0x58, 0xfe, 0x91, 0x10, 0x04, + 0x5f, 0x30, 0x60, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56, 0x0f, 0x5f, 0x12, 0x60, 0xa8, 0xa1, 0x42, + 0x69, 0x58, 0xe8, 0xfe, 0xe5, 0x55, 0x04, 0x5b, 0x30, 0x5c, 0xfe, 0x00, 0x56, 0xfe, 0xa1, 0x56, + 0x0f, 0x5b, 0x12, 0x5c, 0x0a, 0x07, 0x70, 0xfe, 0x1e, 0x12, 0x21, 0x61, 0xfe, 0x1f, 0x40, 0x04, + 0x5d, 0x30, 0x5e, 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x04, 0x5f, 0x30, 0x60, 0xfe, 0x34, 0x50, + 0xfe, 0xb6, 0x50, 0x04, 0x5b, 0x30, 0x5c, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x04, 0x3a, 0x30, + 0x3b, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, 0x02, 0x98, 0x20, 0x06, 0x16, 0xf3, 0x02, 0x7c, 0x39, + 0x01, 0x0b, 0x1f, 0x4f, 0x23, 0x24, 0xb3, 0x05, 0x06, 0x27, 0x4f, 0x3f, 0x05, 0xc3, 0x27, 0x7c, + 0x01, 0xfa, 0x1b, 0x50, 0x18, 0x4f, 0x0a, 0x07, 0x0c, 0xdc, 0x65, 0x3a, 0x31, 0x3b, 0xfe, 0x0a, + 0x55, 0x35, 0xfe, 0x8b, 0x55, 0x9c, 0x3a, 0x9d, 0x3b, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0x02, + 0x7c, 0xfe, 0x19, 0x81, 0xfe, 0x0a, 0x45, 0xfe, 0x19, 0x41, 0x02, 0x7c, 0x39, 0x01, 0x0b, 0x1f, + 0xfe, 0xf6, 0x0f, 0x23, 0x24, 0xfe, 0xe9, 0x09, 0x59, 0x19, 0xfe, 0x94, 0x12, 0x59, 0x0c, 0x4b, + 0x02, 0x4f, 0x2e, 0xfe, 0x7e, 0x11, 0x22, 0x32, 0x1f, 0xfe, 0xf6, 0x0f, 0x23, 0x24, 0x91, 0x05, + 0x19, 0x27, 0x4f, 0x01, 0x0b, 0x1f, 0xfe, 0xf6, 0x0f, 0x23, 0x24, 0xfe, 0xe8, 0x09, 0x57, 0x04, + 0xfe, 0x9c, 0x00, 0x29, 0x35, 0xfe, 0xbb, 0x45, 0x59, 0x00, 0x40, 0x36, 0x06, 0xa0, 0x50, 0xfe, + 0xc0, 0x14, 0xfe, 0xf8, 0x14, 0xac, 0x3f, 0x05, 0xc2, 0xfe, 0x16, 0x13, 0x04, 0xf6, 0x29, 0xce, + 0x04, 0x4d, 0x29, 0x35, 0x5a, 0x02, 0x7c, 0xfe, 0xc0, 0x5d, 0xfe, 0xe4, 0x14, 0xfe, 0x03, 0x17, + 0x04, 0x53, 0xbc, 0x0f, 0x53, 0x5a, 0x39, 0x01, 0x0b, 0x25, 0x98, 0x01, 0xfe, 0x26, 0x14, 0x02, + 0x98, 0x2e, 0x40, 0x22, 0x32, 0x1f, 0x4f, 0x23, 0x24, 0x91, 0x05, 0x06, 0x27, 0x4f, 0xfe, 0xf6, + 0x14, 0xfe, 0x42, 0x58, 0xfe, 0x70, 0x14, 0xfe, 0x92, 0x14, 0xac, 0xfe, 0x4a, 0xf4, 0x0c, 0x18, + 0x4f, 0xfe, 0x4a, 0xf4, 0x06, 0xd1, 0x3f, 0x05, 0xc2, 0xc9, 0x02, 0x7c, 0x04, 0x4d, 0xbc, 0x0f, + 0x4d, 0x5a, 0x39, 0x01, 0x0b, 0x25, 0x98, 0x01, 0xfe, 0x54, 0x14, 0x02, 0x98, 0x25, 0xfe, 0x70, + 0x12, 0x73, 0xf1, 0x73, 0x03, 0x34, 0xfe, 0x6c, 0x12, 0x6b, 0xfe, 0x6c, 0x12, 0x5a, 0x39, 0x01, + 0x0b, 0xfe, 0xe3, 0x10, 0x08, 0x63, 0xff, 0x02, 0x00, 0x57, 0x66, 0x7e, 0x1b, 0xfe, 0xff, 0x7f, + 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x08, 0x63, 0xff, 0x02, 0x00, 0x57, 0x66, 0x7e, 0x1b, + 0x50, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x08, 0x63, 0xff, 0x02, 0x00, 0x57, 0x66, 0x7e, + 0x03, 0x08, 0x63, 0xff, 0x02, 0x00, 0x57, 0x66, 0x7e, 0xfe, 0x0b, 0x58, 0x03, 0x0e, 0x53, 0x01, + 0x8b, 0x0e, 0x4d, 0x01, 0x8b, 0x03, 0xc8, 0x1b, 0x10, 0xff, 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, + 0x1a, 0x66, 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, 0x03, 0x7c, 0x64, 0x2f, + 0x0f, 0x5b, 0x12, 0x5c, 0x9c, 0x5f, 0x9d, 0x60, 0x03, 0xfe, 0x62, 0x18, 0xfe, 0x82, 0x5a, 0xfe, + 0xe1, 0x1a, 0xb6, 0xfe, 0x02, 0x58, 0x03, 0x01, 0xfe, 0x9e, 0x18, 0xfe, 0x42, 0x48, 0x77, 0x57, + 0x95, 0x01, 0x0b, 0x1f, 0xfe, 0x1e, 0x14, 0x23, 0x24, 0xfe, 0xe9, 0x09, 0xfe, 0xc1, 0x59, 0x01, + 0x0b, 0x1f, 0xfe, 0x1e, 0x14, 0x23, 0x24, 0xfe, 0xe8, 0x0a, 0x04, 0xf6, 0x29, 0xfe, 0xc4, 0x12, + 0x2d, 0xb1, 0x1e, 0xdc, 0x59, 0xcd, 0x74, 0xfe, 0x6c, 0x13, 0x4b, 0x08, 0x06, 0x09, 0xcd, 0xa0, + 0xfe, 0x00, 0x10, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xa6, 0xff, 0x02, 0x83, 0x55, 0xb1, + 0x19, 0xfe, 0x12, 0x13, 0x72, 0xfe, 0x30, 0x00, 0x8f, 0xfe, 0xc6, 0x13, 0x09, 0x85, 0x08, 0x06, + 0xfe, 0x56, 0x10, 0xb1, 0x0c, 0xfe, 0x16, 0x13, 0x72, 0xfe, 0x64, 0x00, 0x8f, 0xfe, 0xc6, 0x13, + 0x0e, 0xfe, 0x64, 0x00, 0x09, 0x88, 0x08, 0x06, 0xfe, 0x28, 0x10, 0xb1, 0x06, 0xfe, 0x60, 0x13, + 0x72, 0xfe, 0xc8, 0x00, 0x8f, 0xfe, 0xc6, 0x13, 0x0e, 0xfe, 0xc8, 0x00, 0x09, 0x55, 0x08, 0x06, + 0xa8, 0x72, 0xfe, 0x90, 0x01, 0xed, 0xfe, 0xd2, 0x13, 0x95, 0xaa, 0xfe, 0x43, 0xf4, 0xad, 0xfe, + 0x56, 0xf0, 0xfe, 0xe4, 0x13, 0xfe, 0x04, 0xf4, 0x63, 0xfe, 0x43, 0xf4, 0x88, 0xfe, 0xf3, 0x10, + 0xb0, 0x01, 0xfe, 0xae, 0x12, 0x1b, 0x50, 0xd4, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x6c, 0xed, + 0xfe, 0x18, 0x14, 0xa3, 0x6c, 0xfe, 0x14, 0x10, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x1a, 0xed, + 0xfe, 0x18, 0x14, 0xa3, 0x1a, 0x9e, 0x57, 0x95, 0x08, 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, + 0x03, 0x57, 0x08, 0x0c, 0x03, 0x14, 0x06, 0x01, 0x0b, 0x25, 0xec, 0x14, 0x0c, 0x01, 0x0b, 0x25, + 0xec, 0x14, 0x19, 0x01, 0x0b, 0x25, 0xec, 0x73, 0xfe, 0x89, 0x49, 0x01, 0x0b, 0x03, 0x14, 0x06, + 0x01, 0x0b, 0x25, 0xb7, 0x14, 0x19, 0x01, 0x0b, 0x25, 0xb7, 0x14, 0x06, 0x01, 0x0b, 0x25, 0xb7, + 0xfe, 0x89, 0x49, 0x01, 0x0b, 0x25, 0xb7, 0x73, 0xfe, 0x89, 0x4a, 0x01, 0x0b, 0x03, 0x57, 0x03, + 0x21, 0xe0, 0x05, 0x06, 0xfe, 0x44, 0x13, 0xaf, 0x16, 0xe0, 0xfe, 0x49, 0xf4, 0x00, 0x4b, 0x73, + 0xc6, 0x5a, 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xf1, 0x01, 0x0b, 0x3f, 0x05, 0xfe, 0xe3, 0x00, + 0xfe, 0x20, 0x13, 0x1f, 0xfe, 0xd6, 0x14, 0x2d, 0x16, 0xf3, 0x01, 0x4c, 0x21, 0xf3, 0x05, 0x06, + 0x40, 0x0a, 0x41, 0x06, 0x38, 0x03, 0x0f, 0x54, 0x12, 0x8a, 0xfe, 0x43, 0x58, 0x01, 0x15, 0x05, + 0x10, 0xfe, 0x1e, 0x12, 0x48, 0xe7, 0x8e, 0x01, 0x2c, 0xfe, 0x90, 0x4d, 0xde, 0x10, 0xfe, 0xc5, + 0x59, 0x01, 0x2c, 0xfe, 0x8d, 0x56, 0xb6, 0x48, 0x03, 0x48, 0x31, 0x8a, 0x01, 0x15, 0x48, 0x8e, + 0x01, 0x2c, 0xe2, 0x10, 0xde, 0x10, 0x31, 0x54, 0x72, 0x1c, 0x84, 0x0e, 0x56, 0x01, 0xab, 0x03, + 0x0f, 0x54, 0x12, 0x8a, 0xfe, 0xc3, 0x58, 0x01, 0x15, 0x05, 0x10, 0xfe, 0x1a, 0x12, 0x48, 0xe7, + 0x8e, 0x01, 0x2c, 0xe2, 0x10, 0xfe, 0x80, 0x4d, 0xfe, 0xc5, 0x59, 0x01, 0x2c, 0x48, 0x03, 0x48, + 0x31, 0x54, 0x01, 0x15, 0x48, 0x8e, 0x01, 0x2c, 0xe2, 0x10, 0xde, 0x10, 0x31, 0x54, 0x72, 0x1c, + 0x84, 0x0e, 0x56, 0x01, 0xab, 0x03, 0x0f, 0x54, 0x12, 0x8a, 0xfe, 0x43, 0x58, 0x01, 0x15, 0xfe, + 0x42, 0x48, 0x8e, 0x01, 0x2c, 0xfe, 0xc0, 0x5a, 0xb0, 0xfe, 0x00, 0xcd, 0xfe, 0x01, 0xcc, 0xfe, + 0x4a, 0x46, 0xdc, 0x93, 0x7d, 0x05, 0x10, 0xfe, 0x2e, 0x13, 0x69, 0x54, 0xfe, 0x4d, 0xf4, 0x1c, + 0xfe, 0x1c, 0x13, 0x0e, 0x56, 0x01, 0x8b, 0xaa, 0xfe, 0x40, 0x4c, 0xfe, 0xc5, 0x58, 0x01, 0x2c, + 0xfe, 0x00, 0x07, 0x7d, 0x05, 0x10, 0x84, 0x69, 0x8a, 0xfe, 0x05, 0x57, 0xfe, 0x08, 0x10, 0xfe, + 0x45, 0x58, 0x01, 0x2c, 0xfe, 0x8d, 0x56, 0xb6, 0xfe, 0x80, 0x4c, 0xfe, 0x05, 0x17, 0x03, 0x09, + 0x10, 0x6f, 0x67, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x24, 0x1c, 0xdb, + 0x37, 0x94, 0xfe, 0x1a, 0x16, 0x01, 0xfe, 0x28, 0x17, 0xfe, 0x0c, 0x13, 0x87, 0x37, 0x67, 0xfe, + 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x03, 0xba, 0x27, 0xfe, 0x0a, 0x16, 0xfe, 0xe2, 0x10, 0x09, 0x10, + 0x6f, 0x04, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x1a, 0xfe, 0x18, 0x58, 0x04, 0xfe, 0x66, 0x01, + 0xfe, 0x19, 0x58, 0x87, 0x1a, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, 0x06, 0xfe, 0x3c, 0x50, 0x67, + 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x1a, 0x94, 0xfe, 0x64, 0x16, 0xfe, 0xbe, + 0x14, 0x35, 0x03, 0xba, 0x27, 0xfe, 0x3c, 0x16, 0xfe, 0xa4, 0x10, 0x09, 0x10, 0x6f, 0xb6, 0xfe, + 0x18, 0xdf, 0xfe, 0x19, 0xdf, 0xdb, 0x42, 0x94, 0xfe, 0x86, 0x16, 0xfe, 0x9c, 0x14, 0xfe, 0x18, + 0x13, 0x87, 0x42, 0x67, 0x1e, 0xfe, 0xaf, 0x19, 0xfe, 0x98, 0xe7, 0x00, 0xa2, 0x07, 0xfe, 0x7f, + 0x00, 0xfe, 0x05, 0x40, 0x03, 0xba, 0x27, 0xfe, 0x7a, 0x16, 0xfe, 0x6c, 0x10, 0x09, 0x10, 0x6f, + 0xfe, 0x30, 0xbc, 0xfe, 0xb2, 0xbc, 0x87, 0xd9, 0x67, 0x1e, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, + 0xd9, 0x94, 0xfe, 0xc6, 0x16, 0xfe, 0x5c, 0x14, 0x35, 0x03, 0xba, 0x27, 0xfe, 0xb2, 0x16, 0xfe, + 0x42, 0x10, 0xfe, 0x02, 0xf6, 0x10, 0x6f, 0xfe, 0x18, 0xfe, 0x5d, 0xfe, 0x19, 0xfe, 0x5e, 0xc8, + 0xdb, 0x45, 0x94, 0xfe, 0xec, 0x16, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13, 0x87, 0x45, 0x4e, 0xfe, + 0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x10, 0xfe, 0x81, 0xe7, 0x10, 0x11, 0xfe, 0xdd, + 0x00, 0x64, 0x2f, 0x03, 0x64, 0x2f, 0xfe, 0x12, 0x45, 0x27, 0xfe, 0xdc, 0x16, 0x17, 0x06, 0x4a, + 0xf4, 0xdd, 0x02, 0x26, 0xfe, 0x39, 0xf0, 0xfe, 0x30, 0x17, 0x2d, 0x03, 0xfe, 0x7e, 0x18, 0x1b, + 0x19, 0x83, 0x08, 0x0d, 0x03, 0x6f, 0x04, 0xdf, 0x1b, 0x06, 0xfe, 0xef, 0x12, 0xfe, 0xe1, 0x10, + 0x1d, 0x0e, 0x1c, 0x01, 0x15, 0x05, 0x10, 0x40, 0x3e, 0xfe, 0x78, 0x14, 0xfe, 0x34, 0x12, 0x50, + 0x86, 0x36, 0x37, 0xbf, 0xfe, 0xe9, 0x13, 0x1d, 0x0e, 0x3d, 0x01, 0x15, 0x05, 0x10, 0x40, 0x3e, + 0xfe, 0x56, 0x14, 0xe1, 0x50, 0x86, 0x36, 0x37, 0xbf, 0xfe, 0xe9, 0x13, 0x09, 0x0c, 0x03, 0xfe, + 0x9c, 0xe7, 0x0c, 0x13, 0xfe, 0x15, 0x00, 0x90, 0x9f, 0x2f, 0x01, 0xea, 0x09, 0x06, 0x03, 0x0a, + 0x41, 0x37, 0x38, 0x08, 0x3d, 0x09, 0x99, 0x01, 0x46, 0x11, 0x47, 0x08, 0x1c, 0x09, 0x43, 0x01, + 0x7b, 0x09, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x65, 0xf7, 0x31, 0x76, 0xfe, 0x48, + 0x55, 0x35, 0xfe, 0xc9, 0x55, 0x03, 0x21, 0xbe, 0x52, 0x16, 0xbe, 0x03, 0x0e, 0xc0, 0x01, 0x15, + 0xe6, 0x0e, 0x79, 0x01, 0x15, 0xfe, 0x49, 0x44, 0x27, 0xfe, 0x26, 0x18, 0x0e, 0x1c, 0x01, 0x15, + 0x05, 0x10, 0x40, 0x0e, 0x56, 0x01, 0xab, 0x0e, 0x79, 0x01, 0x15, 0x52, 0x7d, 0x03, 0xfe, 0x40, + 0x5e, 0xfe, 0xe2, 0x08, 0xfe, 0xc0, 0x4c, 0x21, 0x3c, 0x05, 0x10, 0xfe, 0x52, 0x12, 0x3e, 0x05, + 0x00, 0xfe, 0x18, 0x12, 0xfe, 0xe1, 0x18, 0xfe, 0x19, 0xf4, 0xfe, 0x7f, 0x00, 0xd4, 0xfe, 0xe2, + 0x08, 0x52, 0x3e, 0x3f, 0x05, 0x76, 0xa5, 0xfe, 0x82, 0x48, 0xfe, 0x01, 0x80, 0xfe, 0xd7, 0x10, + 0xfe, 0xc4, 0x48, 0x08, 0x2a, 0x09, 0x3c, 0xfe, 0x40, 0x5f, 0x1d, 0x01, 0x46, 0x11, 0xfe, 0xdd, + 0x00, 0xfe, 0x14, 0x46, 0x08, 0x2a, 0x09, 0x3c, 0x01, 0x46, 0x11, 0xfe, 0xdd, 0x00, 0xfe, 0x40, + 0x4a, 0x6a, 0xfe, 0x06, 0x17, 0xfe, 0x01, 0x07, 0xfe, 0x82, 0x48, 0xfe, 0x04, 0x17, 0x03, 0xeb, + 0x19, 0x74, 0xfe, 0xae, 0x18, 0x04, 0xfe, 0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xeb, + 0xcc, 0x74, 0xfe, 0xc0, 0x18, 0x04, 0xfe, 0x92, 0x00, 0xc7, 0x1e, 0xd8, 0xeb, 0xfe, 0x0b, 0x00, + 0x74, 0xfe, 0xd2, 0x18, 0x04, 0xfe, 0x94, 0x00, 0xc7, 0x1a, 0xfe, 0x08, 0x10, 0x04, 0xfe, 0x96, + 0x00, 0xc7, 0x85, 0xfe, 0x4e, 0x45, 0xd1, 0xfe, 0x0a, 0x45, 0xff, 0x04, 0x68, 0x54, 0xfe, 0xf1, + 0x10, 0x1b, 0x6c, 0x03, 0x05, 0x80, 0xfe, 0x5a, 0xf0, 0xfe, 0xfe, 0x18, 0x20, 0xfe, 0x09, 0x00, + 0xfe, 0x34, 0x10, 0x05, 0x1e, 0xfe, 0x5a, 0xf0, 0xfe, 0x0c, 0x19, 0x20, 0xcd, 0xfe, 0x26, 0x10, + 0x05, 0x19, 0x83, 0x20, 0x85, 0xd8, 0x05, 0x0c, 0x83, 0x20, 0x88, 0xfe, 0x0e, 0x10, 0x05, 0x06, + 0x83, 0x20, 0x55, 0xc6, 0xaf, 0x03, 0x17, 0xfe, 0x09, 0x00, 0x01, 0x44, 0x2e, 0xfe, 0x3c, 0x19, + 0x04, 0x6e, 0xb0, 0x03, 0x22, 0xfe, 0x54, 0x19, 0xfe, 0x14, 0xf0, 0x0b, 0x2e, 0xfe, 0x50, 0x19, + 0x03, 0xff, 0x15, 0x00, 0x00, +}; STATIC unsigned short _adv_asc3550_size = - sizeof(_adv_asc3550_buf); /* 0x13AA */ -STATIC unsigned long _adv_asc3550_chksum = - 0x04F4788EUL; /* Expanded checksum. */ + sizeof(_adv_asc3550_buf); /* 0x13E5 */ +STATIC ADV_DCNT _adv_asc3550_chksum = + 0x04FFFF0E; /* Expanded checksum. */ STATIC unsigned char _adv_asc38C0800_buf[] = { - 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x00, 0xfc, 0x48, 0xe4, 0x01, 0x00, 0x00, 0xf6, - 0x18, 0xe4, 0x01, 0xf6, 0x18, 0x80, 0x02, 0x00, 0x02, 0x1a, 0xff, 0xff, 0x00, 0xfa, 0x03, 0xf6, - 0xff, 0x00, 0x82, 0xe7, 0x01, 0xfa, 0x9e, 0xe7, 0x09, 0xe7, 0xe6, 0x0e, 0x00, 0xea, 0x01, 0xe6, - 0x03, 0x00, 0x1e, 0xf0, 0x55, 0xf0, 0x18, 0xf4, 0x3e, 0x57, 0x04, 0x00, 0x3e, 0x01, 0x85, 0xf0, - 0x00, 0xe6, 0x03, 0xfc, 0x08, 0x00, 0x32, 0xf0, 0x38, 0x54, 0x84, 0x0d, 0x86, 0xf0, 0xd4, 0x01, - 0xd5, 0xf0, 0xee, 0x19, 0x00, 0xec, 0x01, 0xfc, 0x98, 0x57, 0xbc, 0x00, 0x10, 0x13, 0xb1, 0xf0, - 0x02, 0x13, 0x3c, 0x00, 0x7e, 0x0d, 0xb4, 0x00, 0x00, 0x57, 0x01, 0xf0, 0x02, 0xfc, 0x03, 0xe6, - 0x0c, 0x1c, 0x10, 0x00, 0x18, 0x40, 0x3e, 0x1c, 0xbd, 0x00, 0xe0, 0x00, 0x02, 0x80, 0x3e, 0x00, - 0x46, 0x16, 0x4a, 0x10, 0x6c, 0x01, 0x6e, 0x01, 0x74, 0x01, 0x76, 0x01, 0xb9, 0x54, 0xba, 0x13, - 0xbb, 0x00, 0x00, 0x4e, 0x01, 0x01, 0x01, 0xea, 0x02, 0x48, 0x02, 0xfa, 0x08, 0x12, 0x30, 0xe4, - 0x3c, 0x56, 0x4e, 0x01, 0x5d, 0xf0, 0x7a, 0x01, 0x88, 0x0d, 0x8e, 0x10, 0xb6, 0x00, 0xc4, 0x08, - 0x00, 0x80, 0x04, 0x12, 0x05, 0xfc, 0x24, 0x01, 0x28, 0x01, 0x32, 0x00, 0x3c, 0x01, 0x40, 0x00, - 0x4b, 0xe4, 0x4b, 0xf4, 0x4c, 0x1c, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, 0x78, 0x01, - 0x7c, 0x01, 0xbb, 0x55, 0x00, 0x01, 0x02, 0xee, 0x03, 0x58, 0x03, 0xf7, 0x03, 0xfa, 0x04, 0x80, - 0x08, 0x44, 0x09, 0xf0, 0x10, 0x44, 0x1b, 0x80, 0x20, 0x01, 0x38, 0x1c, 0x4e, 0x1c, 0x5b, 0xf0, - 0x80, 0x00, 0x8a, 0x15, 0x98, 0x10, 0xaa, 0x00, 0xbd, 0x56, 0xbe, 0x00, 0xc0, 0x00, 0x00, 0x4c, - 0x00, 0xdc, 0x02, 0x4a, 0x04, 0xfc, 0x05, 0xf0, 0x05, 0xf8, 0x06, 0x13, 0x06, 0xf7, 0x08, 0x13, - 0x0c, 0x00, 0x0e, 0x47, 0x0e, 0xf7, 0x0f, 0x00, 0x1c, 0x0c, 0x20, 0x00, 0x2a, 0x01, 0x32, 0x1c, - 0x36, 0x00, 0x42, 0x54, 0x44, 0x0b, 0x44, 0x55, 0x45, 0x5a, 0x59, 0xf0, 0x5c, 0xf0, 0x62, 0x0a, - 0x69, 0x08, 0x78, 0x13, 0x83, 0x59, 0x8e, 0x18, 0x9a, 0x10, 0x9a, 0x18, 0xb8, 0xf0, 0xd6, 0x0e, - 0xea, 0x15, 0xf0, 0x00, 0x04, 0x10, 0x04, 0xea, 0x04, 0xf6, 0x05, 0x00, 0x06, 0x00, 0x06, 0x12, - 0x0a, 0x10, 0x0a, 0x12, 0x0b, 0xf0, 0x0c, 0x10, 0x0c, 0xf0, 0x12, 0x10, 0x19, 0x00, 0x19, 0xe4, - 0x2a, 0x12, 0x30, 0x1c, 0x33, 0x00, 0x34, 0x00, 0x36, 0x15, 0x38, 0x44, 0x3a, 0x15, 0x40, 0x5c, - 0x4a, 0xe4, 0x62, 0x1a, 0x68, 0x08, 0x68, 0x54, 0x7a, 0x17, 0x83, 0x55, 0x83, 0x5a, 0x91, 0x44, - 0xa2, 0x10, 0xa4, 0x00, 0xb0, 0x57, 0xb5, 0x00, 0xba, 0x00, 0xcc, 0x0e, 0xce, 0x45, 0xd0, 0x00, - 0xe1, 0x00, 0xe5, 0x55, 0xe7, 0x00, 0x00, 0x54, 0x01, 0x48, 0x01, 0x58, 0x02, 0x10, 0x02, 0xe6, - 0x03, 0xa1, 0x04, 0x13, 0x05, 0xe6, 0x06, 0x83, 0x06, 0xf0, 0x07, 0x00, 0x0a, 0x00, 0x0a, 0xf0, - 0x0c, 0x12, 0x0c, 0x13, 0x0e, 0x13, 0x10, 0x04, 0x10, 0x10, 0x12, 0x1c, 0x19, 0x81, 0x1a, 0x10, - 0x1c, 0x00, 0x1c, 0x12, 0x1c, 0x13, 0x1d, 0xf7, 0x1e, 0x13, 0x20, 0x1c, 0x20, 0xe7, 0x22, 0x01, - 0x26, 0x01, 0x30, 0xe7, 0x38, 0x12, 0x3a, 0x55, 0x3f, 0x00, 0x41, 0x58, 0x43, 0x48, 0x46, 0x1c, - 0x4e, 0xe4, 0x5a, 0x13, 0x68, 0x13, 0x72, 0x14, 0x76, 0x02, 0x77, 0x57, 0x78, 0x03, 0x89, 0x48, - 0x8a, 0x13, 0x98, 0x80, 0x99, 0x00, 0x9b, 0x00, 0x9c, 0x32, 0xfe, 0x9c, 0xf0, 0x27, 0x02, 0xfe, - 0xa6, 0x0d, 0xff, 0x10, 0x00, 0x00, 0xfe, 0xc6, 0x01, 0xfe, 0x18, 0x1a, 0x00, 0xfe, 0xc4, 0x01, - 0xfe, 0x84, 0x01, 0xff, 0x03, 0x00, 0x00, 0x30, 0xfe, 0x01, 0x05, 0xff, 0x40, 0x00, 0x00, 0x0d, - 0xff, 0x09, 0x00, 0x00, 0xff, 0x08, 0x01, 0x01, 0xff, 0x10, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, - 0xff, 0x10, 0xff, 0xff, 0xff, 0x11, 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, - 0x00, 0x00, 0xfe, 0x04, 0xf7, 0xfe, 0xc4, 0x01, 0x38, 0x86, 0x0b, 0x01, 0xfe, 0x96, 0x0f, 0xfe, - 0x04, 0xf7, 0xfe, 0xc4, 0x01, 0x86, 0x0b, 0x1c, 0x38, 0xfe, 0x3d, 0xf0, 0xfe, 0xfc, 0x01, 0xfe, - 0x20, 0xf0, 0xdb, 0x04, 0x5e, 0x59, 0x02, 0xfe, 0xc2, 0x0d, 0x01, 0xfe, 0x22, 0x0e, 0xfe, 0xe9, - 0x12, 0x02, 0xfe, 0x08, 0x03, 0xfe, 0x28, 0x1c, 0x04, 0xfe, 0xa6, 0x00, 0xfe, 0xdd, 0x12, 0x46, - 0x12, 0xfe, 0xa6, 0x00, 0xcd, 0xfe, 0x48, 0xf0, 0xfe, 0x80, 0x02, 0xfe, 0x49, 0xf0, 0xfe, 0x9a, - 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xb8, 0x02, 0xfe, 0x46, 0xf0, 0xfe, 0x4a, 0x02, 0xfe, 0x47, 0xf0, - 0xfe, 0x50, 0x02, 0xfe, 0x43, 0xf0, 0xfe, 0x3e, 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x42, 0x02, 0xfe, - 0x45, 0xf0, 0xfe, 0x46, 0x02, 0x09, 0x0b, 0xa2, 0x09, 0x06, 0x12, 0xc1, 0x02, 0x27, 0xfe, 0x00, - 0x1c, 0xfe, 0xf1, 0x10, 0xfe, 0x02, 0x1c, 0xfe, 0xed, 0x10, 0xfe, 0x1e, 0x1c, 0xfe, 0xe9, 0x10, - 0x01, 0xfe, 0xee, 0x17, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xfe, 0xa8, 0x00, 0x0f, 0x7d, 0x01, - 0xc5, 0x02, 0x27, 0x17, 0x5d, 0x4b, 0xc3, 0x01, 0xab, 0x0f, 0x7d, 0x01, 0x9f, 0xfe, 0xbd, 0x10, - 0x0f, 0x7d, 0x01, 0x9f, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe, 0x58, 0x1c, 0x09, 0x06, 0x12, - 0xc1, 0x38, 0x19, 0x27, 0xfe, 0x3d, 0xf0, 0xfe, 0xfc, 0x01, 0x28, 0xfe, 0x8e, 0x02, 0xfe, 0x5a, - 0x1c, 0xdd, 0xfe, 0x14, 0x1c, 0x17, 0xfe, 0x30, 0x00, 0x4b, 0xc3, 0x01, 0xfe, 0xfc, 0x0f, 0x09, - 0x06, 0x12, 0xc1, 0x02, 0xfe, 0xc6, 0x01, 0x2a, 0x2d, 0x05, 0x10, 0x30, 0xfe, 0x69, 0x10, 0x09, - 0x06, 0x12, 0xc1, 0xfe, 0x04, 0xec, 0x2d, 0x07, 0x2d, 0x09, 0x3c, 0x1c, 0x01, 0x40, 0x81, 0xfe, - 0x05, 0xf6, 0xfe, 0xa8, 0x00, 0x01, 0xfe, 0x20, 0x17, 0x0a, 0x4f, 0x8d, 0x3a, 0x11, 0x48, 0x1c, - 0xd3, 0x07, 0x1e, 0x09, 0x51, 0x01, 0xa0, 0x02, 0x27, 0x0f, 0x3d, 0x01, 0x15, 0x05, 0x10, 0xda, - 0x07, 0x1e, 0x09, 0x51, 0x01, 0x79, 0xfe, 0x28, 0x10, 0x0f, 0xc7, 0x01, 0x15, 0xed, 0x0f, 0x7e, - 0x01, 0x15, 0xfe, 0x49, 0x54, 0x77, 0xfe, 0x16, 0x03, 0x07, 0x1e, 0x09, 0x51, 0x01, 0xa0, 0x02, - 0x27, 0x38, 0x81, 0xfe, 0x02, 0xe8, 0x33, 0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43, 0xf5, 0xfe, 0x07, - 0x4b, 0xfe, 0x20, 0xf0, 0xdb, 0xfe, 0x40, 0x1c, 0x19, 0xf6, 0xfe, 0x26, 0xf0, 0xfe, 0x74, 0x03, - 0xfe, 0xa0, 0xf0, 0xfe, 0x62, 0x03, 0xfe, 0x11, 0xf0, 0xdb, 0xfe, 0x0e, 0x10, 0xfe, 0x9f, 0xf0, - 0xfe, 0x82, 0x03, 0xef, 0x13, 0xfe, 0x11, 0x00, 0x02, 0x54, 0x38, 0xfe, 0x48, 0x1c, 0xef, 0x19, - 0xf6, 0x35, 0xf6, 0xfe, 0x82, 0xf0, 0xfe, 0x88, 0x03, 0x24, 0x2a, 0xc4, 0x70, 0x16, 0xc4, 0x0f, - 0x7e, 0x01, 0x15, 0x70, 0x7f, 0x07, 0x1e, 0x09, 0x51, 0x01, 0x40, 0x11, 0x3d, 0x07, 0x3d, 0x09, - 0xa1, 0x01, 0xa0, 0xfc, 0x11, 0xfe, 0xe4, 0x00, 0x2f, 0xfe, 0xce, 0x03, 0x19, 0x32, 0x1f, 0xfe, - 0xde, 0x03, 0x01, 0x41, 0xd4, 0xfe, 0xee, 0x03, 0x71, 0x8c, 0xd7, 0xfe, 0xae, 0x06, 0x02, 0x25, - 0x04, 0x7d, 0x2c, 0x1a, 0xfe, 0x20, 0x05, 0x17, 0x88, 0x01, 0x2e, 0x01, 0x9b, 0x01, 0x9d, 0x35, - 0xfe, 0x60, 0x02, 0x02, 0xf4, 0xef, 0x38, 0x86, 0x18, 0xfe, 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xf5, - 0xfe, 0x48, 0x1c, 0x8f, 0x01, 0xf2, 0xb1, 0xfe, 0x96, 0xf0, 0xfe, 0x28, 0x04, 0x2f, 0xfe, 0x2c, - 0x04, 0x35, 0x27, 0x0f, 0x3d, 0x01, 0x15, 0x05, 0x10, 0x1a, 0xfe, 0x0c, 0x05, 0x4c, 0x97, 0xa3, - 0x33, 0x84, 0x74, 0x19, 0x32, 0x1f, 0x25, 0x04, 0x7d, 0x2c, 0xfe, 0x10, 0x12, 0x17, 0x88, 0x01, - 0x2e, 0x35, 0xfe, 0x60, 0x02, 0x02, 0xf4, 0x21, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x5e, - 0x12, 0x0a, 0x08, 0x06, 0xfe, 0x56, 0x12, 0x23, 0x29, 0x98, 0x01, 0x0c, 0x84, 0x74, 0x1f, 0xfe, - 0xdc, 0x04, 0x23, 0x29, 0x98, 0x01, 0x0c, 0x1f, 0x25, 0x23, 0x29, 0xba, 0xfe, 0x4c, 0x44, 0xfe, - 0x32, 0x12, 0x50, 0xfe, 0x44, 0x48, 0x07, 0xfe, 0x93, 0x00, 0xfe, 0x4c, 0x54, 0x77, 0xfe, 0x0c, - 0x05, 0x81, 0xa3, 0x33, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x48, 0x13, 0x3e, 0x05, 0xfe, - 0xcc, 0x00, 0xfe, 0x40, 0x13, 0x0a, 0x08, 0x06, 0xea, 0xfe, 0x06, 0x10, 0x23, 0x29, 0xba, 0x0a, - 0x08, 0x39, 0xe1, 0x17, 0xa6, 0x0a, 0x08, 0x06, 0x59, 0x17, 0xfe, 0x0d, 0x00, 0x01, 0x2e, 0x35, - 0xfe, 0x66, 0x0d, 0x02, 0x25, 0x3b, 0x11, 0xfe, 0xe6, 0x00, 0xfe, 0x1c, 0x90, 0xb7, 0x03, 0x17, - 0xa6, 0x01, 0x2e, 0x35, 0x27, 0x19, 0x27, 0x02, 0xfe, 0x14, 0x05, 0xfe, 0x42, 0x5b, 0x86, 0x18, - 0xfe, 0x46, 0x59, 0xfe, 0xbf, 0x57, 0xf5, 0x17, 0x78, 0xfe, 0x07, 0x80, 0xfe, 0x31, 0x44, 0x0a, - 0x08, 0x0b, 0x99, 0xfe, 0x20, 0x80, 0x05, 0x18, 0xfe, 0x70, 0x12, 0x73, 0x08, 0x06, 0xfe, 0x60, - 0x13, 0x04, 0xfe, 0xa2, 0x00, 0x2c, 0x1a, 0xfe, 0xac, 0x05, 0xfe, 0x31, 0xe4, 0x5f, 0x73, 0x08, - 0x0b, 0xfe, 0x4a, 0x13, 0x04, 0xfe, 0xa0, 0x00, 0x2c, 0xfe, 0x42, 0x12, 0x62, 0x2f, 0xfe, 0x6c, - 0x05, 0x19, 0x32, 0xf7, 0x01, 0x0c, 0x26, 0xfe, 0xc4, 0x05, 0x11, 0xfe, 0xe3, 0x00, 0x24, 0x73, - 0xfe, 0x4a, 0xf0, 0xfe, 0x96, 0x05, 0xfe, 0x49, 0xf0, 0xfe, 0x90, 0x05, 0xab, 0x20, 0xfe, 0x21, - 0x00, 0xa8, 0x20, 0xfe, 0x22, 0x00, 0xa2, 0x20, 0x8d, 0xfe, 0x09, 0x48, 0x01, 0x0c, 0x26, 0xfe, - 0xc4, 0x05, 0xfe, 0xe2, 0x08, 0x73, 0x08, 0xe0, 0x59, 0x01, 0x99, 0x20, 0x06, 0x16, 0xe8, 0x4b, - 0xfe, 0x27, 0x01, 0x0a, 0x08, 0x39, 0xb0, 0x46, 0x01, 0xb6, 0x17, 0xa6, 0x0a, 0x08, 0x06, 0x59, - 0x17, 0xfe, 0x0d, 0x00, 0x01, 0x2e, 0x01, 0x9b, 0x01, 0x9d, 0x35, 0xfe, 0x66, 0x0d, 0x02, 0x25, - 0x04, 0xfe, 0x9c, 0x00, 0x2c, 0xfe, 0x3e, 0x12, 0x04, 0x5b, 0x2c, 0xfe, 0x36, 0x13, 0x46, 0x01, - 0xb6, 0x26, 0xfe, 0x3c, 0x06, 0x0f, 0x06, 0x73, 0x08, 0x22, 0xfe, 0x02, 0x12, 0x69, 0x01, 0xfe, - 0xd0, 0x14, 0x1f, 0xfe, 0x32, 0x06, 0x11, 0xc8, 0x01, 0x41, 0x11, 0xfe, 0xe5, 0x00, 0x04, 0x5b, - 0xc2, 0x0e, 0x5b, 0x04, 0xfe, 0x9e, 0x00, 0x2c, 0xfe, 0x62, 0x12, 0x04, 0x56, 0x2c, 0xf1, 0x01, - 0xfe, 0x40, 0x19, 0x01, 0xfe, 0xaa, 0x19, 0xee, 0xd2, 0xec, 0x07, 0x6a, 0xff, 0x02, 0x00, 0x57, - 0x6c, 0x80, 0x1b, 0x58, 0xd1, 0xd2, 0x8b, 0x46, 0x01, 0xb6, 0x26, 0xfe, 0xa6, 0x06, 0x73, 0x08, - 0x1d, 0xa7, 0x7c, 0x0f, 0x5d, 0x01, 0xfe, 0xfe, 0x14, 0x1f, 0xfe, 0x9c, 0x06, 0x11, 0xc8, 0x01, - 0x41, 0x11, 0xfe, 0xe5, 0x00, 0x04, 0x56, 0xc2, 0x0e, 0x56, 0x09, 0x06, 0x01, 0xb6, 0xfc, 0x76, - 0x8f, 0x01, 0xf2, 0xb1, 0x11, 0xfe, 0xe2, 0x00, 0x2f, 0xfe, 0xbe, 0x06, 0x19, 0x32, 0xd7, 0xfe, - 0xda, 0x06, 0x83, 0xfe, 0x78, 0x07, 0xd4, 0xfe, 0x80, 0x07, 0x71, 0x8c, 0x02, 0x25, 0x0a, 0x08, + 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x00, 0xfc, 0x48, 0xe4, 0x01, 0x00, 0x18, 0xe4, + 0x00, 0xf6, 0x01, 0xf6, 0x18, 0x80, 0x02, 0x00, 0x40, 0x1a, 0x00, 0xfa, 0xff, 0xff, 0x03, 0xf6, + 0xff, 0x00, 0x82, 0xe7, 0x01, 0xfa, 0x9e, 0xe7, 0x09, 0xe7, 0x1a, 0x0f, 0x00, 0xea, 0x01, 0xe6, + 0x03, 0x00, 0x55, 0xf0, 0x18, 0xf4, 0x1e, 0xf0, 0x3e, 0x57, 0x04, 0x00, 0x3e, 0x01, 0x85, 0xf0, + 0x00, 0xe6, 0x03, 0xfc, 0x08, 0x00, 0x2c, 0x1a, 0x32, 0xf0, 0x86, 0xf0, 0xbe, 0x0d, 0xd4, 0x01, + 0xd5, 0xf0, 0x00, 0xec, 0x01, 0xfc, 0x38, 0x54, 0x98, 0x57, 0xbc, 0x00, 0x0c, 0x1c, 0xb1, 0xf0, + 0x3c, 0x00, 0xb4, 0x00, 0xb8, 0x0d, 0x00, 0x57, 0x01, 0xf0, 0x02, 0x13, 0x02, 0xfc, 0x03, 0xe6, + 0x10, 0x00, 0x18, 0x40, 0x3e, 0x1c, 0x44, 0x13, 0x6c, 0x01, 0x6e, 0x01, 0xbd, 0x00, 0xe0, 0x00, + 0x02, 0x80, 0x30, 0xe4, 0x3e, 0x00, 0x74, 0x01, 0x76, 0x01, 0x7c, 0x16, 0x80, 0x00, 0xb9, 0x54, + 0xbb, 0x00, 0xee, 0x13, 0x00, 0x4e, 0x01, 0x01, 0x01, 0xea, 0x02, 0x48, 0x02, 0xfa, 0x04, 0x12, + 0x08, 0x12, 0x3c, 0x56, 0x4e, 0x01, 0x5d, 0xf0, 0x7a, 0x01, 0x7e, 0x10, 0xb6, 0x00, 0xc2, 0x10, + 0xee, 0x08, 0x00, 0x80, 0x05, 0xfc, 0x10, 0x44, 0x24, 0x01, 0x28, 0x01, 0x32, 0x00, 0x3c, 0x01, + 0x40, 0x00, 0x4b, 0xe4, 0x4b, 0xf4, 0x4c, 0x1c, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, + 0x78, 0x01, 0x7c, 0x01, 0xbb, 0x55, 0xc2, 0x0d, 0x00, 0x01, 0x02, 0xee, 0x03, 0x58, 0x03, 0xf7, + 0x03, 0xfa, 0x04, 0x80, 0x08, 0x44, 0x09, 0xf0, 0x0f, 0x00, 0x1b, 0x80, 0x20, 0x01, 0x38, 0x1c, + 0x4e, 0x1c, 0x5b, 0xf0, 0x62, 0x0a, 0xaa, 0x00, 0xbe, 0x00, 0xc0, 0x00, 0xc0, 0x15, 0xcc, 0x10, + 0x00, 0x4c, 0x00, 0xdc, 0x02, 0x4a, 0x04, 0xfc, 0x05, 0x00, 0x05, 0xf0, 0x05, 0xf8, 0x06, 0x13, + 0x06, 0xf7, 0x08, 0x13, 0x0a, 0x10, 0x0c, 0x00, 0x0e, 0x47, 0x0e, 0xf7, 0x10, 0x0f, 0x20, 0x00, + 0x20, 0x16, 0x2a, 0x01, 0x32, 0x1c, 0x36, 0x00, 0x42, 0x54, 0x44, 0x55, 0x45, 0x5a, 0x52, 0x0c, + 0x59, 0xf0, 0x5c, 0xf0, 0x69, 0x08, 0x6e, 0x0b, 0x83, 0x59, 0xb8, 0xf0, 0xbd, 0x56, 0xcc, 0x18, + 0xce, 0x10, 0xd8, 0x18, 0xf0, 0x00, 0x01, 0x48, 0x04, 0x10, 0x04, 0xea, 0x04, 0xf6, 0x05, 0x80, + 0x05, 0xe6, 0x06, 0x00, 0x06, 0x0f, 0x06, 0x12, 0x0b, 0xf0, 0x0c, 0x10, 0x0c, 0xf0, 0x10, 0x13, + 0x12, 0x10, 0x19, 0x00, 0x19, 0xe4, 0x30, 0x1c, 0x33, 0x00, 0x34, 0x00, 0x38, 0x44, 0x40, 0x5c, + 0x4a, 0xe4, 0x62, 0x1a, 0x68, 0x08, 0x68, 0x54, 0x6c, 0x15, 0x70, 0x15, 0x83, 0x55, 0x83, 0x5a, + 0x91, 0x44, 0xa4, 0x00, 0xac, 0x13, 0xb0, 0x57, 0xb5, 0x00, 0xb8, 0x17, 0xba, 0x00, 0xce, 0x45, + 0xd0, 0x00, 0xe1, 0x00, 0xe5, 0x55, 0xe7, 0x00, 0x00, 0x54, 0x01, 0x58, 0x02, 0x10, 0x02, 0xe6, + 0x03, 0xa1, 0x04, 0x13, 0x06, 0x83, 0x06, 0xf0, 0x07, 0x00, 0x0a, 0x00, 0x0a, 0x12, 0x0a, 0xf0, + 0x0c, 0x12, 0x0c, 0x13, 0x0c, 0x90, 0x0e, 0x13, 0x10, 0x04, 0x10, 0x10, 0x12, 0x1c, 0x19, 0x81, + 0x1a, 0x10, 0x1c, 0x00, 0x1c, 0x12, 0x1d, 0xf7, 0x1e, 0x13, 0x20, 0x1c, 0x20, 0xe7, 0x22, 0x01, + 0x26, 0x01, 0x2a, 0x12, 0x2c, 0x0f, 0x30, 0xe7, 0x32, 0x15, 0x34, 0x1c, 0x36, 0x1c, 0x38, 0x12, + 0x3a, 0x55, 0x3f, 0x00, 0x41, 0x58, 0x43, 0x48, 0x46, 0x1c, 0x4e, 0xe4, 0x76, 0x02, 0x77, 0x57, + 0x78, 0x03, 0x89, 0x48, 0x8e, 0x90, 0x98, 0x80, 0x99, 0x00, 0xfe, 0x9c, 0xf0, 0x27, 0x02, 0xfe, + 0xe0, 0x0d, 0xff, 0x10, 0x00, 0x00, 0xfe, 0xc6, 0x01, 0xfe, 0x56, 0x1a, 0x00, 0xfe, 0xc4, 0x01, + 0xfe, 0x84, 0x01, 0xff, 0x03, 0x00, 0x00, 0xfe, 0x6a, 0x13, 0xfe, 0x05, 0x05, 0xff, 0x40, 0x00, + 0x00, 0x0e, 0xff, 0x09, 0x00, 0x00, 0xff, 0x08, 0x01, 0x01, 0xff, 0x10, 0xff, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0xff, 0x10, 0xff, 0xff, 0xff, 0x11, 0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, + 0xff, 0x21, 0x00, 0x00, 0xfe, 0x04, 0xf7, 0xfe, 0xc4, 0x01, 0x2e, 0x88, 0x0b, 0x01, 0xfe, 0xca, + 0x0f, 0xfe, 0x04, 0xf7, 0xfe, 0xc4, 0x01, 0x88, 0x0b, 0x1c, 0x2e, 0xfe, 0x3d, 0xf0, 0xfe, 0xfc, + 0x01, 0xfe, 0x20, 0xf0, 0xdc, 0x04, 0x5f, 0x4f, 0x02, 0xfe, 0xfc, 0x0d, 0x01, 0xfe, 0x5c, 0x0e, + 0xfe, 0xe9, 0x12, 0x02, 0xfe, 0x08, 0x03, 0xfe, 0x28, 0x1c, 0x04, 0xfe, 0xa6, 0x00, 0xfe, 0xdd, + 0x12, 0x47, 0x12, 0xfe, 0xa6, 0x00, 0xcd, 0xfe, 0x48, 0xf0, 0xfe, 0x80, 0x02, 0xfe, 0x49, 0xf0, + 0xfe, 0x9a, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xb8, 0x02, 0xfe, 0x46, 0xf0, 0xfe, 0x4a, 0x02, 0xfe, + 0x47, 0xf0, 0xfe, 0x50, 0x02, 0xfe, 0x43, 0xf0, 0xfe, 0x3e, 0x02, 0xfe, 0x44, 0xf0, 0xfe, 0x42, + 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x46, 0x02, 0x09, 0x0b, 0xa4, 0x09, 0x06, 0x12, 0xc1, 0x02, 0x27, + 0xfe, 0x00, 0x1c, 0xfe, 0xf1, 0x10, 0xfe, 0x02, 0x1c, 0xfe, 0xed, 0x10, 0xfe, 0x1e, 0x1c, 0xfe, + 0xe9, 0x10, 0x01, 0xfe, 0x2c, 0x18, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xfe, 0xa8, 0x00, 0x0f, + 0x7c, 0x01, 0xaa, 0x02, 0x27, 0x17, 0x5e, 0x4c, 0xc4, 0x01, 0xfe, 0x40, 0x10, 0x0f, 0x7c, 0x01, + 0x8e, 0xfe, 0xbd, 0x10, 0x0f, 0x7c, 0x01, 0x8e, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe, 0x58, + 0x1c, 0x09, 0x06, 0x12, 0xc1, 0x2e, 0x1b, 0x27, 0xfe, 0x3d, 0xf0, 0xfe, 0xfc, 0x01, 0x28, 0xfe, + 0x8e, 0x02, 0xfe, 0x5a, 0x1c, 0xde, 0xfe, 0x14, 0x1c, 0x17, 0xfe, 0x30, 0x00, 0x4c, 0xc4, 0x01, + 0xfe, 0x30, 0x10, 0x09, 0x06, 0x12, 0xc1, 0x02, 0xfe, 0xc6, 0x01, 0x29, 0x2d, 0x05, 0x10, 0x35, + 0xfe, 0x69, 0x10, 0x09, 0x06, 0x12, 0xc1, 0xfe, 0x04, 0xec, 0x2d, 0x08, 0x2d, 0x09, 0x3e, 0x1c, + 0x01, 0x45, 0x82, 0xfe, 0x05, 0xf6, 0xfe, 0xa8, 0x00, 0x01, 0xfe, 0x56, 0x17, 0x0a, 0x41, 0x8f, + 0x39, 0x11, 0x48, 0x1c, 0xd2, 0x08, 0x1e, 0x09, 0x52, 0x01, 0x90, 0x02, 0x27, 0x0f, 0x3f, 0x01, + 0x15, 0x05, 0x10, 0xdb, 0x08, 0x1e, 0x09, 0x52, 0x01, 0x7e, 0xfe, 0x28, 0x10, 0x0f, 0xc8, 0x01, + 0x15, 0xf2, 0x0f, 0x7d, 0x01, 0x15, 0xfe, 0x49, 0x54, 0x79, 0xfe, 0x16, 0x03, 0x08, 0x1e, 0x09, + 0x52, 0x01, 0x90, 0x02, 0x27, 0x2e, 0x82, 0xfe, 0x02, 0xe8, 0x31, 0xfe, 0xbf, 0x57, 0xfe, 0x9e, + 0x43, 0xf7, 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xdc, 0xfe, 0x40, 0x1c, 0x1b, 0xf8, 0xfe, 0x26, + 0xf0, 0xfe, 0x74, 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x62, 0x03, 0xfe, 0x11, 0xf0, 0xdc, 0xfe, 0x0e, + 0x10, 0xfe, 0x9f, 0xf0, 0xfe, 0x82, 0x03, 0xf4, 0x13, 0xfe, 0x11, 0x00, 0x02, 0x6b, 0x2e, 0xfe, + 0x48, 0x1c, 0xf4, 0x1b, 0xf8, 0x34, 0xf8, 0xfe, 0x82, 0xf0, 0xfe, 0x88, 0x03, 0x2b, 0x29, 0xc6, + 0x72, 0x16, 0xc6, 0x0f, 0x7d, 0x01, 0x15, 0x72, 0x80, 0x08, 0x1e, 0x09, 0x52, 0x01, 0x45, 0x11, + 0x3f, 0x08, 0x3f, 0x09, 0xa2, 0x01, 0x90, 0xfe, 0x9c, 0x32, 0x11, 0xfe, 0xe4, 0x00, 0x2f, 0xfe, + 0xce, 0x03, 0x1b, 0x32, 0x1f, 0xfe, 0xde, 0x03, 0x01, 0x55, 0xd3, 0xfe, 0xee, 0x03, 0x73, 0x97, + 0xd7, 0xfe, 0xae, 0x06, 0x02, 0x26, 0x04, 0x7c, 0x2c, 0x19, 0xfe, 0x20, 0x05, 0x17, 0x8b, 0x01, + 0x3b, 0x01, 0x9f, 0x01, 0xa1, 0x34, 0xfe, 0x60, 0x02, 0x02, 0xf6, 0xf4, 0x2e, 0x88, 0x18, 0xfe, + 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xf7, 0xfe, 0x48, 0x1c, 0x92, 0x01, 0xfe, 0x9c, 0x13, 0xb3, 0xfe, + 0x96, 0xf0, 0xfe, 0x28, 0x04, 0x2f, 0xfe, 0x2c, 0x04, 0x34, 0x27, 0x0f, 0x3f, 0x01, 0x15, 0x05, + 0x10, 0x19, 0xfe, 0x0c, 0x05, 0x4d, 0x7a, 0xa5, 0x31, 0x86, 0x76, 0x1b, 0x32, 0x1f, 0x26, 0x04, + 0x7c, 0x2c, 0xfe, 0x10, 0x12, 0x17, 0x8b, 0x01, 0x3b, 0x34, 0xfe, 0x60, 0x02, 0x02, 0xf6, 0x21, + 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x5e, 0x12, 0x0a, 0x07, 0x06, 0xfe, 0x56, 0x12, 0x24, + 0x23, 0x9a, 0x01, 0x0c, 0x86, 0x76, 0x1f, 0xfe, 0xdc, 0x04, 0x24, 0x23, 0x9a, 0x01, 0x0c, 0x1f, + 0x26, 0x24, 0x23, 0xba, 0xfe, 0x4c, 0x44, 0xfe, 0x32, 0x12, 0x51, 0xfe, 0x44, 0x48, 0x08, 0xfe, + 0x93, 0x00, 0xfe, 0x4c, 0x54, 0x79, 0xfe, 0x0c, 0x05, 0x82, 0xa5, 0x31, 0xfe, 0x06, 0x80, 0xfe, + 0x48, 0x47, 0xfe, 0x48, 0x13, 0x40, 0x05, 0xfe, 0xcc, 0x00, 0xfe, 0x40, 0x13, 0x0a, 0x07, 0x06, + 0xef, 0xfe, 0x06, 0x10, 0x24, 0x23, 0xba, 0x0a, 0x07, 0x38, 0xe2, 0x17, 0xa9, 0x0a, 0x07, 0x06, + 0x4f, 0x17, 0xfe, 0x0d, 0x00, 0x01, 0x3b, 0x34, 0xfe, 0xa0, 0x0d, 0x02, 0x26, 0x3a, 0x11, 0xfe, + 0xe6, 0x00, 0xfe, 0x1c, 0x90, 0xb7, 0x03, 0x17, 0xa9, 0x01, 0x3b, 0x34, 0x27, 0x1b, 0x27, 0x02, + 0xfe, 0x14, 0x05, 0xfe, 0x42, 0x5b, 0x88, 0x18, 0xfe, 0x46, 0x59, 0xfe, 0xbf, 0x57, 0xf7, 0x17, + 0x46, 0xfe, 0x07, 0x80, 0xfe, 0x31, 0x44, 0x0a, 0x07, 0x0b, 0xfe, 0x78, 0x13, 0xfe, 0x20, 0x80, + 0x05, 0x18, 0xfe, 0x70, 0x12, 0x75, 0x07, 0x06, 0xfe, 0x60, 0x13, 0x04, 0xfe, 0xa2, 0x00, 0x2c, + 0x19, 0xfe, 0xac, 0x05, 0xfe, 0x31, 0xe4, 0x60, 0x75, 0x07, 0x0b, 0xfe, 0x4a, 0x13, 0x04, 0xfe, + 0xa0, 0x00, 0x2c, 0xfe, 0x42, 0x12, 0x63, 0x2f, 0xfe, 0x6c, 0x05, 0x1b, 0x32, 0xf9, 0x01, 0x0c, + 0x25, 0xfe, 0xc4, 0x05, 0x11, 0xfe, 0xe3, 0x00, 0x2b, 0x75, 0xfe, 0x4a, 0xf0, 0xfe, 0x96, 0x05, + 0xfe, 0x49, 0xf0, 0xfe, 0x90, 0x05, 0xad, 0x20, 0xfe, 0x21, 0x00, 0x8a, 0x20, 0xfe, 0x22, 0x00, + 0xa4, 0x20, 0x8f, 0xfe, 0x09, 0x48, 0x01, 0x0c, 0x25, 0xfe, 0xc4, 0x05, 0xfe, 0xe2, 0x08, 0x75, + 0x07, 0xe1, 0x4f, 0x01, 0xc2, 0x20, 0x06, 0x16, 0xe8, 0x4c, 0xfe, 0x27, 0x01, 0x0a, 0x07, 0x38, + 0xe9, 0x47, 0x01, 0xbd, 0x17, 0xa9, 0x0a, 0x07, 0x06, 0x4f, 0x17, 0xfe, 0x0d, 0x00, 0x01, 0x3b, + 0x01, 0x9f, 0x01, 0xa1, 0x34, 0xfe, 0xa0, 0x0d, 0x02, 0x26, 0x04, 0xfe, 0x9c, 0x00, 0x2c, 0xfe, + 0x3e, 0x12, 0x04, 0x5c, 0x2c, 0xfe, 0x36, 0x13, 0x47, 0x01, 0xbd, 0x25, 0xfe, 0x3c, 0x06, 0x0f, + 0x06, 0x75, 0x07, 0x22, 0xfe, 0x02, 0x12, 0x6a, 0x01, 0xfe, 0x06, 0x15, 0x1f, 0xfe, 0x32, 0x06, + 0x11, 0xc9, 0x01, 0x55, 0x11, 0xfe, 0xe5, 0x00, 0x04, 0x5c, 0xc3, 0x0d, 0x5c, 0x04, 0xfe, 0x9e, + 0x00, 0x2c, 0xfe, 0x62, 0x12, 0x04, 0x56, 0x2c, 0xfe, 0x5a, 0x13, 0x01, 0xfe, 0x7e, 0x19, 0x01, + 0xfe, 0xe8, 0x19, 0xf3, 0xa8, 0xf1, 0x08, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x6e, 0x81, 0x1a, 0x59, + 0xd1, 0xa8, 0x74, 0x47, 0x01, 0xbd, 0x25, 0xfe, 0xa6, 0x06, 0x75, 0x07, 0x1d, 0xab, 0x9e, 0x0f, + 0x5e, 0x01, 0xfe, 0x34, 0x15, 0x1f, 0xfe, 0x9c, 0x06, 0x11, 0xc9, 0x01, 0x55, 0x11, 0xfe, 0xe5, + 0x00, 0x04, 0x56, 0xc3, 0x0d, 0x56, 0x09, 0x06, 0x01, 0xbd, 0xfe, 0x9c, 0x32, 0x78, 0x92, 0x01, + 0xfe, 0x9c, 0x13, 0xb3, 0x11, 0xfe, 0xe2, 0x00, 0x2f, 0xfe, 0xbe, 0x06, 0x1b, 0x32, 0xd7, 0xfe, + 0xda, 0x06, 0x85, 0xfe, 0x78, 0x07, 0xd3, 0xfe, 0x80, 0x07, 0x73, 0x97, 0x02, 0x26, 0x0a, 0x07, 0x0b, 0xfe, 0x2e, 0x12, 0x14, 0x18, 0x01, 0x0c, 0x14, 0x00, 0x01, 0x0c, 0x14, 0x00, 0x01, 0x0c, - 0x14, 0x00, 0x01, 0x0c, 0xfe, 0x99, 0xa4, 0x01, 0x0c, 0x14, 0x00, 0x02, 0xfe, 0x3e, 0x08, 0x6f, - 0x08, 0x1d, 0xea, 0x0a, 0x08, 0x1d, 0xfe, 0x30, 0x13, 0x14, 0xfe, 0x1b, 0x00, 0x01, 0x0c, 0x14, + 0x14, 0x00, 0x01, 0x0c, 0xfe, 0x99, 0xa4, 0x01, 0x0c, 0x14, 0x00, 0x02, 0xfe, 0x50, 0x08, 0x71, + 0x07, 0x1d, 0xef, 0x0a, 0x07, 0x1d, 0xfe, 0x30, 0x13, 0x14, 0xfe, 0x1b, 0x00, 0x01, 0x0c, 0x14, 0x00, 0x01, 0x0c, 0x14, 0x00, 0x01, 0x0c, 0x14, 0x00, 0x01, 0x0c, 0x14, 0x06, 0x01, 0x0c, 0x14, - 0x00, 0x02, 0xfe, 0xe6, 0x0b, 0x69, 0xfe, 0x9a, 0x81, 0x6d, 0x8d, 0xfe, 0x09, 0x6f, 0xfe, 0x93, - 0x45, 0x1a, 0xfe, 0x88, 0x07, 0x2f, 0xfe, 0x60, 0x07, 0x19, 0x32, 0xd7, 0xfe, 0x58, 0x07, 0x71, - 0x8c, 0x83, 0xfe, 0x78, 0x07, 0x02, 0x25, 0x01, 0x41, 0x02, 0xfe, 0xbe, 0x06, 0x14, 0x22, 0x02, - 0xfe, 0xbe, 0x06, 0xfe, 0x9c, 0xf7, 0xfe, 0xf4, 0x07, 0xfe, 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x52, - 0xfe, 0xd6, 0x07, 0x0e, 0x65, 0x12, 0x66, 0x0a, 0x4f, 0x5f, 0x3a, 0x01, 0xfe, 0xd6, 0x18, 0x05, - 0x10, 0x85, 0xfe, 0x83, 0xe7, 0xfe, 0x95, 0x00, 0xa8, 0xfe, 0x03, 0x40, 0x0a, 0x4f, 0x78, 0x3a, - 0x01, 0xbc, 0xb5, 0xfe, 0x1f, 0x40, 0x16, 0x67, 0x01, 0xf8, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, - 0xfe, 0x34, 0x51, 0xfe, 0xb6, 0x51, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0e, 0x63, 0x12, 0x64, - 0xfe, 0x0c, 0x90, 0xfe, 0x8e, 0x90, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, 0x0e, 0x42, 0x12, 0x43, - 0x41, 0x0a, 0x08, 0x5f, 0xb0, 0xfe, 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x0e, 0x65, 0x12, 0x66, 0x0a, - 0x08, 0x78, 0xd1, 0x01, 0xbc, 0xfe, 0x1f, 0x80, 0x16, 0x67, 0xfe, 0x34, 0x90, 0xfe, 0xb6, 0x90, - 0x0e, 0x44, 0x12, 0x45, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0e, 0x63, 0x12, 0x64, 0xfe, 0x28, - 0x90, 0xfe, 0xaa, 0x90, 0x0e, 0x42, 0x12, 0x43, 0x0e, 0x31, 0x12, 0x3f, 0x24, 0x0e, 0x53, 0x0e, - 0x68, 0x0a, 0x4f, 0x22, 0x3a, 0x38, 0x07, 0xa5, 0x2f, 0xfe, 0x5e, 0x08, 0xfe, 0x9e, 0xf0, 0xfe, - 0x72, 0x08, 0xcc, 0x1a, 0x32, 0x38, 0x72, 0xfe, 0xed, 0x10, 0xaa, 0xfe, 0x96, 0x08, 0xac, 0xfe, - 0xb2, 0x08, 0x83, 0xfe, 0x8a, 0x08, 0xd4, 0xfe, 0x90, 0x08, 0x71, 0x8c, 0x02, 0x25, 0x01, 0x41, - 0xfe, 0xc9, 0x10, 0x14, 0x22, 0xfe, 0xc9, 0x10, 0x6f, 0x08, 0x06, 0xfe, 0x10, 0x12, 0x6f, 0x08, - 0x0b, 0x4e, 0x0a, 0x08, 0x0b, 0xfe, 0x8e, 0x12, 0xfe, 0x2e, 0x1c, 0xad, 0x6f, 0x08, 0x06, 0x4e, - 0x6f, 0x08, 0x0b, 0xfe, 0x7a, 0x12, 0xfe, 0x2c, 0x1c, 0xfe, 0xaa, 0xf0, 0xfe, 0xcc, 0x09, 0xfe, - 0xac, 0xf0, 0xfe, 0xfa, 0x08, 0x02, 0xfe, 0xd8, 0x09, 0xfe, 0xb7, 0xf0, 0xfe, 0xf6, 0x08, 0xfe, - 0x02, 0xf6, 0x1d, 0x69, 0xfe, 0x70, 0x18, 0xfe, 0xf1, 0x18, 0xfe, 0x40, 0x55, 0xfe, 0xe1, 0x55, - 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x19, 0x92, 0xfe, 0x8c, - 0xf0, 0xfe, 0xf6, 0x08, 0xfe, 0xac, 0xf0, 0xfe, 0xea, 0x08, 0xfe, 0x34, 0x1c, 0xfe, 0xcb, 0x10, - 0xfe, 0xad, 0xf0, 0xfe, 0x06, 0x09, 0x02, 0xfe, 0x12, 0x0b, 0xfe, 0x36, 0x1c, 0xfe, 0xbf, 0x10, - 0xfe, 0x2b, 0xf0, 0x92, 0xfe, 0x6b, 0x18, 0x1b, 0xfe, 0x00, 0xfe, 0xe1, 0xcd, 0xfe, 0xd2, 0xf0, - 0x92, 0xfe, 0x76, 0x18, 0x1b, 0x18, 0x1a, 0x92, 0x04, 0xe7, 0x1b, 0x06, 0x1a, 0x92, 0xaa, 0x57, - 0xac, 0x57, 0xfe, 0x34, 0x1c, 0xfe, 0x36, 0x1c, 0xfe, 0x89, 0x10, 0x8f, 0x62, 0x3b, 0x17, 0xa6, - 0x01, 0x2e, 0x13, 0xfe, 0x35, 0x00, 0x35, 0x54, 0x13, 0x90, 0x02, 0x54, 0xf9, 0xaf, 0x0b, 0xfe, - 0x1a, 0x12, 0x50, 0xfe, 0x19, 0x82, 0xfe, 0x6c, 0x18, 0xfe, 0x44, 0x54, 0xeb, 0xde, 0xfe, 0x74, - 0x18, 0x91, 0x93, 0x1a, 0xfe, 0xc8, 0x08, 0x02, 0x57, 0x0a, 0x08, 0x5f, 0x2e, 0x04, 0x31, 0x2b, - 0x3f, 0x0e, 0x44, 0x12, 0x45, 0x82, 0x31, 0x5a, 0x3f, 0xfe, 0x6c, 0x18, 0xfe, 0xed, 0x18, 0xfe, - 0x44, 0x54, 0xfe, 0xe5, 0x54, 0x36, 0x44, 0x21, 0x45, 0x04, 0x53, 0x2b, 0x68, 0x91, 0xfe, 0xe3, - 0x54, 0xfe, 0x74, 0x18, 0xfe, 0xf5, 0x18, 0x91, 0xfe, 0xe3, 0x54, 0x93, 0xc9, 0x52, 0xfe, 0xc8, - 0x08, 0x02, 0x57, 0xfe, 0x37, 0xf0, 0xfe, 0xd4, 0x09, 0xfe, 0x8b, 0xf0, 0xfe, 0x5a, 0x09, 0x02, - 0x57, 0xf9, 0xaf, 0x0b, 0x28, 0xfe, 0xf4, 0x0a, 0x36, 0x53, 0x21, 0x68, 0x52, 0xfe, 0x38, 0x0a, - 0x07, 0xfe, 0xc0, 0x07, 0x46, 0x61, 0x00, 0xd9, 0xfe, 0x01, 0x59, 0xfe, 0x52, 0xf0, 0xfe, 0x06, - 0x0a, 0x91, 0x96, 0xfe, 0x1e, 0x0a, 0x36, 0x53, 0x91, 0xfe, 0xe3, 0x54, 0x4d, 0x53, 0x6e, 0x68, - 0xfe, 0x14, 0x58, 0xfe, 0x95, 0x58, 0x02, 0x57, 0x36, 0x53, 0x21, 0x68, 0xfe, 0x14, 0x59, 0xfe, - 0x95, 0x59, 0xeb, 0x4d, 0x53, 0x4d, 0x68, 0x02, 0x57, 0x0a, 0x08, 0x5f, 0xfe, 0x82, 0x12, 0x0a, - 0x08, 0x22, 0xfe, 0x66, 0x13, 0x2a, 0x67, 0x70, 0xd0, 0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, - 0x2e, 0x13, 0xfe, 0x04, 0x91, 0xfe, 0x86, 0x91, 0x6b, 0x33, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, - 0x52, 0xfe, 0xd0, 0x08, 0x04, 0x65, 0x2b, 0x66, 0x0e, 0xb3, 0x12, 0x90, 0x4d, 0x65, 0x6e, 0x66, - 0x01, 0xbc, 0xb5, 0x6b, 0x33, 0x16, 0x67, 0x82, 0x31, 0x5a, 0x3f, 0x36, 0x44, 0x21, 0x45, 0x93, - 0xc9, 0xfe, 0x04, 0xfa, 0x31, 0xfe, 0x05, 0xfa, 0x3f, 0x01, 0xf8, 0xfe, 0x36, 0x10, 0x24, 0x0e, - 0xb3, 0x0e, 0x90, 0x36, 0x44, 0x21, 0x45, 0xad, 0x0a, 0x08, 0x22, 0x1a, 0xfe, 0xd0, 0x08, 0x36, - 0x42, 0x21, 0x43, 0x0a, 0x08, 0xfe, 0xf7, 0x00, 0x3a, 0x04, 0x63, 0x2b, 0x64, 0xfe, 0x10, 0x58, - 0xfe, 0x91, 0x58, 0x4d, 0x53, 0x6e, 0x68, 0x02, 0xfe, 0xee, 0x09, 0x0a, 0x08, 0x22, 0x1a, 0xfe, - 0xd0, 0x08, 0x0a, 0x08, 0xfe, 0xf7, 0x00, 0x3a, 0xeb, 0xde, 0x69, 0xfe, 0x10, 0x90, 0xfe, 0x92, - 0x90, 0xfe, 0xd3, 0x10, 0x3e, 0x05, 0xca, 0x1a, 0xfe, 0x02, 0x09, 0x11, 0xca, 0xf9, 0xaf, 0x0b, - 0xfe, 0x14, 0x13, 0x04, 0x42, 0x2b, 0x43, 0x52, 0xfe, 0x02, 0x09, 0xfe, 0x0c, 0x58, 0xfe, 0x8d, - 0x58, 0x02, 0x57, 0x24, 0x46, 0xfe, 0x19, 0x80, 0xfe, 0xf1, 0x10, 0x0a, 0x08, 0x0b, 0xa7, 0xfe, - 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xfe, 0x94, 0x10, 0xfe, 0x6c, 0x19, 0x4d, 0x42, 0xfe, 0xed, 0x19, - 0x6e, 0x43, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xfe, 0x6b, 0x18, 0x1b, 0xfe, 0x00, 0xff, 0x30, - 0xfe, 0x7a, 0x10, 0xcd, 0xfe, 0xd2, 0xf0, 0xfe, 0x8c, 0x0b, 0xfe, 0x76, 0x18, 0x1b, 0x18, 0xa9, - 0x04, 0xe7, 0x1b, 0x06, 0x87, 0x13, 0xfe, 0x16, 0x00, 0x02, 0x54, 0xfe, 0xd1, 0xf0, 0xfe, 0xc2, - 0x0b, 0x17, 0xa5, 0x01, 0x2e, 0x13, 0xfe, 0x17, 0x00, 0xfe, 0x48, 0x10, 0xfe, 0xce, 0xf0, 0xfe, - 0xaa, 0x0b, 0x13, 0xfe, 0x21, 0x00, 0x02, 0x54, 0xfe, 0xcd, 0xf0, 0xfe, 0xb6, 0x0b, 0x13, 0xfe, - 0x22, 0x00, 0x02, 0x54, 0xfe, 0xcb, 0xf0, 0xfe, 0xc2, 0x0b, 0x13, 0xfe, 0x24, 0x00, 0x02, 0x54, - 0xfe, 0xd0, 0xf0, 0xfe, 0xcc, 0x0b, 0x13, 0xae, 0xdf, 0xfe, 0xcf, 0xf0, 0xfe, 0xd6, 0x0b, 0x13, - 0x8d, 0xdc, 0xfe, 0xcc, 0xf0, 0xfe, 0xe6, 0x0b, 0xfe, 0x84, 0x80, 0xaf, 0x22, 0xfe, 0xd5, 0x12, - 0x13, 0xfe, 0x12, 0x00, 0x2f, 0xfe, 0xe6, 0x0b, 0x19, 0x32, 0xaa, 0x25, 0xac, 0x25, 0x38, 0xfc, - 0x2f, 0xfe, 0xfa, 0x0b, 0x19, 0x32, 0x83, 0xfe, 0x16, 0x0c, 0x71, 0x8c, 0xaa, 0xfe, 0xf4, 0x07, - 0xac, 0xfe, 0xf4, 0x07, 0x02, 0x25, 0x01, 0x41, 0xfe, 0xdb, 0x10, 0x11, 0xfe, 0xe8, 0x00, 0x8f, - 0x84, 0x74, 0xfe, 0x89, 0xf0, 0x25, 0x23, 0x29, 0xfe, 0xe9, 0x09, 0x01, 0x0c, 0x84, 0x74, 0x1f, - 0x25, 0x23, 0x29, 0x98, 0x35, 0xfe, 0x4e, 0x0c, 0x19, 0x32, 0x02, 0xfe, 0x42, 0x0c, 0xcc, 0x4e, - 0x13, 0xfe, 0x42, 0x00, 0x02, 0x54, 0xa4, 0x06, 0xfe, 0x81, 0x49, 0xfe, 0xcc, 0x12, 0x0a, 0x08, - 0x0b, 0xf1, 0x13, 0x00, 0x60, 0x0b, 0xfe, 0x6a, 0x12, 0x60, 0xfe, 0x28, 0x00, 0x28, 0xfe, 0x94, - 0x0d, 0x0f, 0x7e, 0x01, 0x15, 0x05, 0x00, 0x87, 0x37, 0xfe, 0x28, 0x00, 0x02, 0xfe, 0x94, 0x0d, - 0x01, 0x9b, 0x01, 0x9d, 0x0f, 0xc7, 0x01, 0xfe, 0xf0, 0x0e, 0xb9, 0x07, 0x3d, 0x09, 0xa1, 0x01, - 0x40, 0x11, 0x48, 0x07, 0x1e, 0x09, 0x51, 0x01, 0x79, 0x02, 0x27, 0x13, 0xfe, 0x44, 0x00, 0x60, - 0x0b, 0xa7, 0x37, 0x0b, 0xfe, 0xc0, 0x10, 0x01, 0x99, 0x37, 0x0b, 0xfe, 0xb6, 0x10, 0x01, 0x99, - 0xfe, 0x19, 0x82, 0xfe, 0x34, 0x46, 0xfe, 0x0a, 0x13, 0x37, 0x0b, 0x13, 0xfe, 0x43, 0x00, 0xc0, - 0x0a, 0x4f, 0x0b, 0x3a, 0x01, 0x9b, 0x01, 0x9d, 0xb9, 0x07, 0x3d, 0x09, 0xa1, 0x01, 0x40, 0x11, - 0x48, 0x07, 0x1e, 0x09, 0x51, 0x01, 0x79, 0x86, 0x0b, 0xb9, 0x1c, 0xd3, 0x02, 0xfe, 0x4c, 0x03, - 0x0a, 0x08, 0x0b, 0xa9, 0x37, 0x0b, 0x13, 0x00, 0xfe, 0x54, 0x10, 0x6f, 0x08, 0x1d, 0xfe, 0x50, - 0x12, 0x0a, 0x08, 0x1d, 0xfe, 0x48, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x52, 0x0d, - 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x58, 0x0d, 0x0a, 0x4f, 0x1d, 0x3a, 0xfe, 0x95, 0x10, - 0x13, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0b, 0x69, 0xfe, 0x26, 0x10, 0x13, 0xfe, 0x13, 0x00, - 0xdc, 0x13, 0xfe, 0x47, 0x00, 0xa8, 0x13, 0xfe, 0x41, 0x00, 0xa2, 0x13, 0xfe, 0x24, 0x00, 0x04, - 0x7d, 0x2c, 0x28, 0xf4, 0x69, 0xfe, 0x04, 0xe6, 0x1d, 0xfe, 0x9d, 0x41, 0xfe, 0x1c, 0x42, 0xb9, - 0x01, 0xfe, 0xf8, 0x0e, 0x02, 0x27, 0xdd, 0x17, 0x0b, 0x4b, 0xfb, 0xe5, 0x17, 0xfe, 0x31, 0x00, - 0x4b, 0xc3, 0x01, 0xfe, 0xfc, 0x0f, 0x02, 0xfe, 0xc6, 0x01, 0x1c, 0xfe, 0x06, 0xec, 0xfe, 0xb9, - 0x00, 0x89, 0x37, 0x39, 0xc6, 0x30, 0x1c, 0xfe, 0x06, 0xea, 0xfe, 0xb9, 0x00, 0xfe, 0x47, 0x4b, - 0x7c, 0xfe, 0x75, 0x57, 0x04, 0x5e, 0xfe, 0x98, 0x56, 0xfe, 0x28, 0x12, 0x0f, 0x7e, 0xfe, 0xfa, - 0x14, 0x46, 0xed, 0x0f, 0xc7, 0xfe, 0xf0, 0x14, 0xfe, 0x49, 0x54, 0x95, 0xfe, 0x08, 0x0e, 0x0f, - 0x1e, 0xfe, 0xe4, 0x14, 0xfe, 0x44, 0x48, 0x02, 0xfe, 0x4c, 0x03, 0x0f, 0x5e, 0xfe, 0xc8, 0x14, - 0x89, 0x37, 0x39, 0xc6, 0x30, 0x1c, 0xfe, 0xce, 0x47, 0xfe, 0xbd, 0x13, 0x02, 0x27, 0x2a, 0x2d, - 0x05, 0x10, 0xfe, 0x78, 0x12, 0x24, 0x16, 0x5d, 0x16, 0xb2, 0x2a, 0x48, 0x46, 0x4b, 0x48, 0xcc, - 0xd9, 0xfe, 0xbc, 0xf0, 0xfe, 0xa4, 0x0e, 0x07, 0x06, 0x16, 0x5d, 0x01, 0xfe, 0xb0, 0x16, 0x04, - 0xfe, 0x38, 0x01, 0x2b, 0xfe, 0x3a, 0x01, 0x52, 0xfe, 0xa8, 0x0e, 0x04, 0xfe, 0x38, 0x01, 0x1b, - 0xfe, 0xf0, 0xff, 0x0e, 0xfe, 0x60, 0x01, 0x04, 0xfe, 0x3a, 0x01, 0x0e, 0xfe, 0x62, 0x01, 0x20, - 0x06, 0x16, 0x48, 0xfe, 0x04, 0xec, 0x2d, 0x07, 0x2d, 0x09, 0x3c, 0x1c, 0x01, 0x40, 0x81, 0xfe, - 0x05, 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x20, 0x17, 0x11, 0x48, 0xd3, 0x07, 0x06, 0x03, 0x24, - 0x03, 0x2a, 0x5d, 0xfe, 0xf7, 0x12, 0x2a, 0xb2, 0x70, 0x16, 0xb2, 0x05, 0xa5, 0xfe, 0x93, 0x13, - 0xfe, 0x24, 0x1c, 0x17, 0x18, 0x4b, 0xfb, 0xe5, 0xfe, 0xd9, 0x10, 0x9a, 0xfe, 0x03, 0xdc, 0xfe, - 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x03, 0x9a, 0xfe, 0x03, 0xdc, 0x24, 0xfe, 0x70, 0x57, 0xfe, 0x33, - 0x54, 0xfe, 0x3b, 0x54, 0xfe, 0x80, 0x5d, 0x03, 0xfe, 0x03, 0x57, 0x9a, 0x24, 0xfe, 0x00, 0xcc, - 0x03, 0xfe, 0x03, 0x57, 0x9a, 0x7f, 0x03, 0x01, 0xfe, 0x50, 0x17, 0x3e, 0x05, 0x48, 0xfe, 0x0a, - 0x13, 0x07, 0x1e, 0x09, 0x51, 0xdc, 0x01, 0x9b, 0x01, 0x9d, 0x07, 0x3d, 0x09, 0xa1, 0x01, 0x40, - 0x11, 0xfe, 0xe9, 0x00, 0x0a, 0x08, 0x8d, 0xfe, 0x52, 0x13, 0x01, 0xfe, 0xe2, 0x16, 0xfe, 0x1e, - 0x1c, 0xfe, 0x14, 0x90, 0x0e, 0xfe, 0x64, 0x01, 0xfe, 0x16, 0x90, 0x0e, 0xfe, 0x66, 0x01, 0x0a, - 0x08, 0x78, 0xea, 0xfe, 0x03, 0x80, 0x72, 0x4c, 0x11, 0x7b, 0x07, 0x2d, 0x09, 0x3c, 0x1c, 0x97, - 0x01, 0xa0, 0xfe, 0x62, 0x08, 0x70, 0x4c, 0x11, 0x7b, 0x07, 0x2d, 0x09, 0x3c, 0x1c, 0x97, 0x01, - 0xa0, 0x6b, 0x33, 0x11, 0x7b, 0x07, 0x2d, 0x09, 0x3c, 0x1c, 0x97, 0x01, 0x79, 0x03, 0xfe, 0x08, - 0x1c, 0x04, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58, 0x04, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x04, - 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58, 0x04, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, - 0x20, 0x8b, 0x16, 0xfe, 0xb9, 0x00, 0x24, 0x0e, 0x5b, 0x0e, 0x56, 0x20, 0x10, 0x16, 0x2d, 0x16, - 0x3c, 0x50, 0xa4, 0xfe, 0x93, 0x00, 0x07, 0x2d, 0x09, 0x3c, 0x1c, 0x01, 0x79, 0x81, 0x11, 0x7b, - 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0xd6, 0x0f, 0xdd, 0x8f, 0xfe, 0x14, 0x1c, 0xfe, 0x10, - 0x1c, 0xfe, 0x18, 0x1c, 0x03, 0x1c, 0xfe, 0x0c, 0x14, 0x89, 0xfe, 0x07, 0xe6, 0x39, 0xfe, 0xce, - 0x47, 0xfe, 0xf5, 0x13, 0x03, 0x01, 0x99, 0x0f, 0x3d, 0x01, 0x15, 0x05, 0x10, 0xda, 0x0f, 0x1e, - 0x01, 0x15, 0x05, 0x10, 0xe1, 0xfe, 0x44, 0x58, 0x4c, 0xfe, 0x01, 0xec, 0xc3, 0xfe, 0x9e, 0x40, - 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1d, 0xa3, 0x33, 0x01, 0xfe, 0xf8, 0x0e, 0xfe, 0xc9, - 0x10, 0x03, 0x38, 0x84, 0x74, 0x23, 0x29, 0xba, 0x05, 0x1d, 0xfe, 0x48, 0x12, 0x05, 0x0b, 0xfe, - 0x4c, 0x12, 0x05, 0x18, 0xfe, 0x30, 0x12, 0x05, 0xd5, 0x1a, 0xfe, 0xa0, 0x11, 0x05, 0xfe, 0x23, - 0x00, 0x1a, 0xfe, 0xac, 0x11, 0x05, 0x06, 0x1a, 0xa9, 0x05, 0x22, 0xfe, 0x12, 0x12, 0x05, 0x00, - 0x1a, 0x25, 0x17, 0xd5, 0x01, 0x2e, 0xce, 0x3b, 0x01, 0x0c, 0x83, 0x41, 0x03, 0x3b, 0x11, 0xfe, - 0xcc, 0x00, 0x02, 0x27, 0x3b, 0x3e, 0x05, 0xca, 0xfe, 0xe3, 0x13, 0x36, 0x42, 0x21, 0x43, 0x52, - 0xfe, 0x5e, 0x11, 0x0a, 0x08, 0x5f, 0xfe, 0x72, 0x12, 0x82, 0x31, 0x5a, 0x3f, 0x93, 0xc9, 0x95, - 0xfe, 0x28, 0x11, 0x2a, 0x67, 0xfe, 0x26, 0x13, 0x04, 0xb3, 0x2b, 0x90, 0x52, 0xfe, 0x78, 0x0d, - 0x0e, 0x65, 0x12, 0x66, 0x24, 0x0e, 0xb3, 0x0e, 0x90, 0x01, 0xbc, 0x20, 0x8b, 0x72, 0x16, 0x67, - 0x01, 0xf8, 0x82, 0x31, 0x5a, 0x3f, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x31, - 0xfe, 0x05, 0xfa, 0x3f, 0xfe, 0x91, 0x10, 0x04, 0x44, 0x2b, 0x45, 0xfe, 0x40, 0x56, 0xfe, 0xe1, - 0x56, 0x0e, 0x44, 0x12, 0x45, 0xab, 0x82, 0x31, 0x5a, 0x3f, 0x93, 0xc9, 0x04, 0x63, 0x2b, 0x64, - 0xfe, 0x00, 0x56, 0xfe, 0xa1, 0x56, 0x0e, 0x63, 0x12, 0x64, 0x0a, 0x08, 0x5f, 0xfe, 0x1e, 0x12, - 0x2a, 0x67, 0xfe, 0x1f, 0x40, 0x04, 0x65, 0x2b, 0x66, 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x04, - 0x44, 0x2b, 0x45, 0xfe, 0x34, 0x50, 0xfe, 0xb6, 0x50, 0x04, 0x63, 0x2b, 0x64, 0xfe, 0x08, 0x50, - 0xfe, 0x8a, 0x50, 0x04, 0x42, 0x2b, 0x43, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, 0x02, 0x9c, 0x20, - 0x06, 0x16, 0xfa, 0x02, 0x7a, 0x3b, 0x01, 0x0c, 0x1f, 0x55, 0x23, 0x29, 0xba, 0x05, 0x06, 0x28, - 0x55, 0x3e, 0x05, 0xca, 0x28, 0x7a, 0x01, 0xf2, 0x1b, 0x58, 0x1a, 0x55, 0x0a, 0x08, 0x0b, 0xe4, - 0x36, 0x42, 0x21, 0x43, 0xfe, 0x0a, 0x55, 0x30, 0xfe, 0x8b, 0x55, 0x4d, 0x42, 0x6e, 0x43, 0xfe, - 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0x02, 0x7a, 0xde, 0xfe, 0x0a, 0x45, 0xfe, 0x19, 0x41, 0x02, 0x7a, - 0x3b, 0x01, 0x0c, 0x1f, 0xc0, 0x23, 0x29, 0xfe, 0xe9, 0x09, 0x60, 0x18, 0xfe, 0x94, 0x12, 0x60, - 0x0b, 0x59, 0x02, 0x55, 0x2f, 0xb0, 0x19, 0x32, 0x1f, 0xc0, 0x23, 0x29, 0x98, 0x05, 0x18, 0x28, - 0x55, 0x01, 0x0c, 0x1f, 0xc0, 0x23, 0x29, 0xfe, 0xe8, 0x09, 0x50, 0x04, 0xfe, 0x9c, 0x00, 0x2c, - 0x30, 0xfe, 0xbb, 0x45, 0x60, 0x00, 0x4e, 0x37, 0x06, 0xa4, 0x58, 0xfe, 0xc0, 0x14, 0xfe, 0xf8, - 0x14, 0xb1, 0x3e, 0x05, 0xc8, 0xfe, 0x16, 0x13, 0x04, 0xfe, 0x9e, 0x00, 0x2c, 0xa9, 0x04, 0x56, - 0x2c, 0x30, 0x62, 0x02, 0x7a, 0xfe, 0xc0, 0x5d, 0xfe, 0xe4, 0x14, 0xfe, 0x03, 0x17, 0x04, 0x5b, - 0xc2, 0x0e, 0x5b, 0x62, 0x3b, 0x01, 0x0c, 0x26, 0x9c, 0x01, 0xfe, 0xd0, 0x14, 0x02, 0x9c, 0x2f, - 0xfe, 0xb4, 0x12, 0x19, 0x32, 0x1f, 0x55, 0x23, 0x29, 0x98, 0x05, 0x06, 0x28, 0x55, 0xfe, 0xf6, - 0x14, 0xfe, 0x42, 0x58, 0xfe, 0x70, 0x14, 0xfe, 0x92, 0x14, 0xb1, 0xfe, 0x4a, 0xf4, 0x0b, 0x1a, - 0x55, 0xfe, 0x4a, 0xf4, 0x06, 0xd8, 0x3e, 0x05, 0xc8, 0xd1, 0x02, 0x7a, 0x04, 0x56, 0xc2, 0x0e, - 0x56, 0x62, 0x3b, 0x01, 0x0c, 0x26, 0x9c, 0x01, 0xfe, 0xfe, 0x14, 0x02, 0x9c, 0x26, 0xe2, 0x76, - 0xf7, 0x76, 0x03, 0x35, 0xfe, 0x18, 0x13, 0x71, 0xfe, 0x18, 0x13, 0x62, 0x3b, 0x01, 0x0c, 0xfe, - 0xe3, 0x10, 0x07, 0x6a, 0xff, 0x02, 0x00, 0x57, 0x6c, 0x80, 0x1b, 0xfe, 0xff, 0x7f, 0xfe, 0x30, - 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x07, 0x6a, 0xff, 0x02, 0x00, 0x57, 0x6c, 0x80, 0x1b, 0x58, 0xfe, - 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x07, 0x6a, 0xff, 0x02, 0x00, 0x57, 0x6c, 0x80, 0x03, 0x07, - 0x6a, 0xff, 0x02, 0x00, 0x57, 0x6c, 0x80, 0xfe, 0x0b, 0x58, 0x03, 0x0f, 0x5b, 0x01, 0x9f, 0x0f, - 0x56, 0x01, 0x9f, 0x03, 0xd0, 0x1b, 0x10, 0xff, 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, 0x22, 0x6c, - 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, 0x03, 0x7c, 0x6b, 0x33, 0x0e, 0x63, - 0x12, 0x64, 0x4d, 0x44, 0x6e, 0x45, 0x03, 0xfe, 0x62, 0x18, 0xfe, 0x82, 0x5a, 0xfe, 0xe1, 0x1a, - 0xbe, 0xfe, 0x02, 0x58, 0x03, 0x01, 0xfe, 0x40, 0x19, 0xfe, 0x42, 0x48, 0x69, 0x50, 0x7c, 0x01, - 0x0c, 0x1f, 0xfe, 0xc8, 0x14, 0x23, 0x29, 0xfe, 0xe9, 0x09, 0xfe, 0xc1, 0x59, 0x01, 0x0c, 0x1f, - 0xfe, 0xc8, 0x14, 0x23, 0x29, 0xfe, 0xe8, 0x0a, 0x04, 0xfe, 0x9e, 0x00, 0x2c, 0xfe, 0xc2, 0x12, - 0x24, 0xb8, 0x1d, 0xe4, 0x60, 0xd6, 0x77, 0xfe, 0x18, 0x14, 0x59, 0x07, 0x06, 0x09, 0xd6, 0xa4, - 0xfe, 0x00, 0x10, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xa8, 0xff, 0x02, 0x83, 0x55, 0xb8, - 0x18, 0xfe, 0x12, 0x13, 0x61, 0xfe, 0x30, 0x00, 0x95, 0xf3, 0x09, 0x88, 0x07, 0x06, 0xfe, 0x56, - 0x10, 0xb8, 0x0b, 0xfe, 0x16, 0x13, 0x61, 0xfe, 0x64, 0x00, 0x95, 0xf3, 0x0f, 0xfe, 0x64, 0x00, - 0x09, 0xae, 0x07, 0x06, 0xfe, 0x28, 0x10, 0xb8, 0x06, 0xfe, 0x5e, 0x13, 0x61, 0xfe, 0xc8, 0x00, - 0x95, 0xf3, 0x0f, 0xfe, 0xc8, 0x00, 0x09, 0x5d, 0x07, 0x06, 0xab, 0x61, 0xfe, 0x90, 0x01, 0x96, - 0xfe, 0x7e, 0x14, 0x7c, 0xad, 0xfe, 0x43, 0xf4, 0xb2, 0xfe, 0x56, 0xf0, 0xfe, 0x90, 0x14, 0xfe, - 0x04, 0xf4, 0x6a, 0xfe, 0x43, 0xf4, 0xae, 0xfe, 0xf3, 0x10, 0xb7, 0x01, 0xf1, 0x1b, 0x58, 0xda, - 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x8b, 0x96, 0xfe, 0xc2, 0x14, 0x7c, 0xfe, 0x14, 0x10, 0xfe, - 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0xec, 0x96, 0xfe, 0xc2, 0x14, 0xd2, 0xec, 0xa2, 0x50, 0x7c, 0x07, - 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, 0x03, 0x50, 0x07, 0x0b, 0x03, 0x14, 0x06, 0x01, 0x0c, - 0x26, 0xfe, 0xfc, 0x14, 0x14, 0x0b, 0x01, 0x0c, 0x26, 0xfe, 0xfc, 0x14, 0x14, 0x18, 0x01, 0x0c, - 0x26, 0xfe, 0xfc, 0x14, 0x76, 0xfe, 0x89, 0x49, 0x01, 0x0c, 0x03, 0x14, 0x06, 0x01, 0x0c, 0x26, - 0xb4, 0x14, 0x18, 0x01, 0x0c, 0x26, 0xb4, 0x14, 0x06, 0x01, 0x0c, 0x26, 0xb4, 0xfe, 0x89, 0x49, - 0x01, 0x0c, 0x26, 0xb4, 0x76, 0xfe, 0x89, 0x4a, 0x01, 0x0c, 0x03, 0x50, 0x03, 0x2a, 0xe8, 0x05, - 0x06, 0xfe, 0x44, 0x13, 0xb5, 0x16, 0xe8, 0xfe, 0x49, 0xf4, 0x00, 0x59, 0x76, 0xce, 0x62, 0xfe, - 0x01, 0xec, 0xfe, 0x27, 0x01, 0xf7, 0x01, 0x0c, 0x3e, 0x05, 0xfe, 0xe3, 0x00, 0xfe, 0x20, 0x13, - 0x1f, 0xfe, 0x80, 0x15, 0x24, 0x16, 0xfa, 0x01, 0x41, 0x2a, 0xfa, 0x05, 0x06, 0x4e, 0x0a, 0x4f, - 0x06, 0x3a, 0x03, 0x0e, 0x5c, 0x12, 0x8e, 0xfe, 0x43, 0x58, 0x01, 0x15, 0x05, 0x10, 0xfe, 0x1e, - 0x12, 0x49, 0xee, 0x94, 0x01, 0x47, 0xfe, 0x90, 0x4d, 0xe6, 0x10, 0xfe, 0xc5, 0x59, 0x01, 0x47, - 0xfe, 0x8d, 0x56, 0xbe, 0x49, 0x03, 0x49, 0x21, 0x8e, 0x01, 0x15, 0x49, 0x94, 0x01, 0x47, 0xe9, - 0x10, 0xe6, 0x10, 0x21, 0x5c, 0x61, 0x1e, 0x87, 0x0f, 0x5e, 0x01, 0xc5, 0x03, 0x0e, 0x5c, 0x12, - 0x8e, 0xfe, 0xc3, 0x58, 0x01, 0x15, 0x05, 0x10, 0xfe, 0x1a, 0x12, 0x49, 0xee, 0x94, 0x01, 0x47, - 0xe9, 0x10, 0xfe, 0x80, 0x4d, 0xfe, 0xc5, 0x59, 0x01, 0x47, 0x49, 0x03, 0x49, 0x21, 0x5c, 0x01, - 0x15, 0x49, 0x94, 0x01, 0x47, 0xe9, 0x10, 0xe6, 0x10, 0x21, 0x5c, 0x61, 0x1e, 0x87, 0x0f, 0x5e, - 0x01, 0xc5, 0x03, 0x0e, 0x5c, 0x12, 0x8e, 0xfe, 0x43, 0x58, 0x01, 0x15, 0xfe, 0x42, 0x48, 0x94, - 0x01, 0x47, 0xfe, 0xc0, 0x5a, 0xb7, 0xfe, 0x00, 0xcd, 0xfe, 0x01, 0xcc, 0xfe, 0x4a, 0x46, 0xe4, - 0x9a, 0x7f, 0x05, 0x10, 0xfe, 0x2e, 0x13, 0x5a, 0x5c, 0xfe, 0x4d, 0xf4, 0x1e, 0xe2, 0x0f, 0x5e, - 0x01, 0x9f, 0xad, 0xfe, 0x40, 0x4c, 0xfe, 0xc5, 0x58, 0x01, 0x47, 0xfe, 0x00, 0x07, 0x7f, 0x05, - 0x10, 0x87, 0x5a, 0x8e, 0xfe, 0x05, 0x57, 0xfe, 0x08, 0x10, 0xfe, 0x45, 0x58, 0x01, 0x47, 0xfe, - 0x8d, 0x56, 0xbe, 0xfe, 0x80, 0x4c, 0xfe, 0x05, 0x17, 0x03, 0x09, 0x10, 0x75, 0x6d, 0xfe, 0x60, - 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x24, 0x1c, 0xe3, 0x39, 0x9e, 0xfe, 0xc4, 0x16, - 0x01, 0xfe, 0xca, 0x17, 0xd9, 0x8a, 0x39, 0x6d, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x03, 0xbf, - 0x28, 0xfe, 0xb4, 0x16, 0xfe, 0xda, 0x10, 0x09, 0x10, 0x75, 0x04, 0xfe, 0x64, 0x01, 0xfe, 0x00, - 0xf4, 0x22, 0xfe, 0x18, 0x58, 0x04, 0xfe, 0x66, 0x01, 0xfe, 0x19, 0x58, 0x8a, 0x22, 0xfe, 0x3c, - 0x90, 0xfe, 0x30, 0xf4, 0x06, 0xfe, 0x3c, 0x50, 0x6d, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, - 0x1c, 0xf7, 0x22, 0x9e, 0xfe, 0x0e, 0x17, 0xfe, 0xb6, 0x14, 0x30, 0x03, 0xbf, 0x28, 0xfe, 0xe6, - 0x16, 0xfe, 0x9c, 0x10, 0x09, 0x10, 0x75, 0xbe, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xdf, 0xe3, 0x31, - 0x9e, 0xfe, 0x30, 0x17, 0xfe, 0x94, 0x14, 0x2e, 0x8a, 0x31, 0x6d, 0x1d, 0xfe, 0xaf, 0x19, 0xfe, - 0x98, 0xe7, 0x00, 0x03, 0xbf, 0x28, 0xfe, 0x24, 0x17, 0xfe, 0x6c, 0x10, 0x09, 0x10, 0x75, 0xfe, - 0x30, 0xbc, 0xfe, 0xb2, 0xbc, 0x8a, 0xe0, 0x6d, 0x1d, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0xe0, - 0x9e, 0xfe, 0x68, 0x17, 0xfe, 0x5c, 0x14, 0x30, 0x03, 0xbf, 0x28, 0xfe, 0x54, 0x17, 0xfe, 0x42, - 0x10, 0xfe, 0x02, 0xf6, 0x10, 0x75, 0xfe, 0x18, 0xfe, 0x65, 0xfe, 0x19, 0xfe, 0x66, 0xd0, 0xe3, - 0x78, 0x9e, 0xfe, 0x8e, 0x17, 0xfe, 0x36, 0x14, 0xe2, 0x8a, 0x78, 0x46, 0xfe, 0x83, 0x58, 0xfe, - 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x10, 0xfe, 0x81, 0xe7, 0x10, 0x11, 0xfe, 0xdd, 0x00, 0x6b, 0x33, - 0x03, 0x6b, 0x33, 0xfe, 0x12, 0x45, 0x28, 0xfe, 0x7e, 0x17, 0x17, 0x06, 0x4b, 0xfb, 0xe5, 0x02, - 0x27, 0xfe, 0x39, 0xf0, 0xfe, 0xd2, 0x17, 0x24, 0x03, 0xfe, 0x7e, 0x18, 0x1b, 0x18, 0x85, 0x07, - 0x0d, 0x03, 0x75, 0x04, 0xe7, 0x1b, 0x06, 0xfe, 0xef, 0x12, 0xfe, 0xe1, 0x10, 0x1c, 0x0f, 0x1e, - 0x01, 0x15, 0x05, 0x10, 0x4e, 0x4c, 0xfe, 0x78, 0x14, 0xfe, 0x34, 0x12, 0x58, 0x89, 0x37, 0x39, - 0xc6, 0xfe, 0xe9, 0x13, 0x1c, 0x0f, 0x3d, 0x01, 0x15, 0x05, 0x10, 0x4e, 0x4c, 0xfe, 0x56, 0x14, - 0xb0, 0x58, 0x89, 0x37, 0x39, 0xc6, 0xfe, 0xe9, 0x13, 0x09, 0x0b, 0x03, 0xfe, 0x9c, 0xe7, 0x0b, - 0x13, 0xfe, 0x15, 0x00, 0x97, 0xa3, 0x33, 0x01, 0xfe, 0xf8, 0x0e, 0x09, 0x06, 0x03, 0x0a, 0x4f, - 0x39, 0x3a, 0x07, 0x3d, 0x09, 0xa1, 0x01, 0x40, 0x11, 0x48, 0x07, 0x1e, 0x09, 0x51, 0x01, 0x79, - 0x09, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x36, 0xfe, 0xa8, 0x00, 0x21, 0x7b, 0xfe, - 0x48, 0x55, 0x30, 0xfe, 0xc9, 0x55, 0x03, 0x2a, 0xc4, 0x72, 0x16, 0xc4, 0x03, 0x0f, 0xc7, 0x01, - 0x15, 0xed, 0x0f, 0x7e, 0x01, 0x15, 0xfe, 0x49, 0x44, 0x28, 0xfe, 0xc8, 0x18, 0x0f, 0x1e, 0x01, - 0x15, 0x05, 0x10, 0x4e, 0x0f, 0x5e, 0x01, 0xc5, 0x0f, 0x7e, 0x01, 0x15, 0x72, 0x7f, 0x03, 0xfe, - 0x40, 0x5e, 0xfe, 0xe2, 0x08, 0xfe, 0xc0, 0x4c, 0x2a, 0x3c, 0x05, 0x10, 0xfe, 0x52, 0x12, 0x4c, - 0x05, 0x00, 0xfe, 0x18, 0x12, 0xfe, 0xe1, 0x18, 0xfe, 0x19, 0xf4, 0xfe, 0x7f, 0x00, 0x2e, 0xfe, - 0xe2, 0x08, 0x72, 0x4c, 0x3e, 0x05, 0x7b, 0xa7, 0xfe, 0x82, 0x48, 0xfe, 0x01, 0x80, 0xfe, 0xd7, - 0x10, 0xfe, 0xc4, 0x48, 0x07, 0x2d, 0x09, 0x3c, 0xfe, 0x40, 0x5f, 0x1c, 0x01, 0x40, 0x11, 0xfe, - 0xdd, 0x00, 0xfe, 0x14, 0x46, 0x07, 0x2d, 0x09, 0x3c, 0x01, 0x40, 0x11, 0xfe, 0xdd, 0x00, 0xfe, - 0x40, 0x4a, 0x70, 0xfe, 0x06, 0x17, 0xfe, 0x01, 0x07, 0xfe, 0x82, 0x48, 0xfe, 0x04, 0x17, 0x03, - 0xf0, 0x18, 0x77, 0xfe, 0x50, 0x19, 0x04, 0xfe, 0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, - 0xf0, 0xd5, 0x77, 0xfe, 0x62, 0x19, 0x04, 0xfe, 0x92, 0x00, 0xcf, 0x1d, 0xdf, 0xf0, 0xfe, 0x0b, - 0x00, 0x77, 0xfe, 0x74, 0x19, 0x04, 0xfe, 0x94, 0x00, 0xcf, 0x22, 0xfe, 0x08, 0x10, 0x04, 0xfe, - 0x96, 0x00, 0xcf, 0x88, 0xfe, 0x4e, 0x45, 0xd8, 0xfe, 0x0a, 0x45, 0xff, 0x04, 0x68, 0x54, 0xfe, - 0xf1, 0x10, 0x1b, 0x8b, 0xfe, 0x08, 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c, 0xfe, 0x1a, 0xf4, - 0xfe, 0x00, 0x04, 0xd8, 0xfe, 0x48, 0xf4, 0x18, 0x96, 0xfe, 0xa8, 0x19, 0x07, 0x18, 0x03, 0x05, - 0xa5, 0xfe, 0x5a, 0xf0, 0xfe, 0xb8, 0x19, 0x20, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10, 0x05, 0x1d, - 0xfe, 0x5a, 0xf0, 0xfe, 0xc6, 0x19, 0x20, 0xd6, 0xfe, 0x26, 0x10, 0x05, 0x18, 0x85, 0x20, 0x88, - 0xdf, 0x05, 0x0b, 0x85, 0x20, 0xae, 0xfe, 0x0e, 0x10, 0x05, 0x06, 0x85, 0x20, 0x5d, 0xce, 0xb5, - 0x03, 0x17, 0xfe, 0x09, 0x00, 0x01, 0x2e, 0x2f, 0xfe, 0xf6, 0x19, 0x04, 0x74, 0xb7, 0x03, 0x19, - 0xfe, 0x16, 0x1a, 0xfe, 0x14, 0xf0, 0x0c, 0x2f, 0xfe, 0x0a, 0x1a, 0x19, 0xfe, 0x16, 0x1a, 0xfe, - 0x82, 0xf0, 0xfe, 0x0e, 0x1a, 0x03, 0xff, 0x34, 0x00, 0x00,}; + 0x00, 0x02, 0xfe, 0x0a, 0x0c, 0x6a, 0xfe, 0x9a, 0x81, 0x6f, 0x8f, 0xfe, 0x09, 0x6f, 0xfe, 0x93, + 0x45, 0x19, 0xfe, 0x88, 0x07, 0x2f, 0xfe, 0x60, 0x07, 0x1b, 0x32, 0xd7, 0xfe, 0x58, 0x07, 0x73, + 0x97, 0x85, 0xfe, 0x78, 0x07, 0x02, 0x26, 0x01, 0x55, 0x02, 0xfe, 0xbe, 0x06, 0x14, 0x22, 0x02, + 0xfe, 0xbe, 0x06, 0xfe, 0x9c, 0xf7, 0xfe, 0xf0, 0x07, 0xfe, 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x53, + 0xfe, 0xd6, 0x07, 0x0d, 0x66, 0x12, 0x67, 0x0a, 0x41, 0x60, 0x39, 0x01, 0xfe, 0x14, 0x19, 0x05, + 0x10, 0x87, 0xfe, 0x83, 0xe7, 0xfe, 0x95, 0x00, 0x8a, 0xfe, 0x03, 0x40, 0x0a, 0x41, 0x46, 0x39, + 0x01, 0xc5, 0xb6, 0xfe, 0x1f, 0x40, 0x16, 0x68, 0x01, 0xfe, 0xbe, 0x13, 0xfe, 0x08, 0x50, 0xfe, + 0x8a, 0x50, 0xfe, 0x34, 0x51, 0xfe, 0xb6, 0x51, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0d, 0x64, + 0x12, 0x65, 0xda, 0xfa, 0x0d, 0x3c, 0x12, 0x3d, 0xfe, 0x60, 0x10, 0x0a, 0x07, 0x60, 0xe9, 0xfe, + 0x2c, 0x90, 0xfe, 0xae, 0x90, 0x0d, 0x66, 0x12, 0x67, 0x0a, 0x07, 0x46, 0xd1, 0x01, 0xc5, 0xfe, + 0x1f, 0x80, 0x16, 0x68, 0xfe, 0x34, 0x90, 0xfe, 0xb6, 0x90, 0x0d, 0x43, 0x12, 0x44, 0xfe, 0x08, + 0x90, 0xfe, 0x8a, 0x90, 0x0d, 0x64, 0x12, 0x65, 0xa7, 0x07, 0x46, 0xdb, 0xda, 0xfa, 0x0d, 0x3c, + 0x12, 0x3d, 0xad, 0xfe, 0x28, 0x90, 0xfe, 0xaa, 0x90, 0x0d, 0x3c, 0x12, 0x3d, 0x0d, 0x30, 0x12, + 0x42, 0x2b, 0x0d, 0x54, 0x0d, 0x69, 0x0a, 0x41, 0x22, 0x39, 0x2e, 0x08, 0x84, 0x2f, 0xfe, 0x70, + 0x08, 0xfe, 0x9e, 0xf0, 0xfe, 0x84, 0x08, 0xa3, 0x19, 0x32, 0x2e, 0x5b, 0xfe, 0xed, 0x10, 0xac, + 0xfe, 0xa8, 0x08, 0xae, 0xfe, 0xc4, 0x08, 0x85, 0xfe, 0x9c, 0x08, 0xd3, 0xfe, 0xa2, 0x08, 0x73, + 0x97, 0x02, 0x26, 0x01, 0x55, 0xfe, 0xc9, 0x10, 0x14, 0x22, 0xfe, 0xc9, 0x10, 0x71, 0x07, 0x06, + 0xfe, 0x10, 0x12, 0x71, 0x07, 0x0b, 0x50, 0x0a, 0x07, 0x0b, 0xfe, 0xa6, 0x12, 0xfe, 0x2e, 0x1c, + 0xb0, 0x71, 0x07, 0x06, 0x50, 0x71, 0x07, 0x0b, 0xfe, 0x92, 0x12, 0xfe, 0x2c, 0x1c, 0xa7, 0x07, + 0x46, 0xaf, 0xa7, 0x41, 0x46, 0xfe, 0x05, 0x40, 0xda, 0xfa, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, + 0xfe, 0xaa, 0xf0, 0xfe, 0xf6, 0x09, 0xfe, 0xac, 0xf0, 0xfe, 0x24, 0x09, 0x02, 0xfe, 0x02, 0x0a, + 0xfe, 0xb7, 0xf0, 0xfe, 0x20, 0x09, 0xfe, 0x02, 0xf6, 0x1d, 0x6a, 0xfe, 0x70, 0x18, 0xfe, 0xf1, + 0x18, 0xfe, 0x40, 0x55, 0xfe, 0xe1, 0x55, 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0xfe, 0x14, 0x59, + 0xfe, 0x95, 0x59, 0x1b, 0x9b, 0xfe, 0x8c, 0xf0, 0xfe, 0x20, 0x09, 0xfe, 0xac, 0xf0, 0xfe, 0x14, + 0x09, 0xed, 0xfe, 0xcb, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0x30, 0x09, 0x02, 0xfe, 0x3c, 0x0b, 0xee, + 0xfe, 0xbf, 0x10, 0xfe, 0x2b, 0xf0, 0x9b, 0xfe, 0x6b, 0x18, 0x1a, 0xfe, 0x00, 0xfe, 0xe2, 0xcd, + 0xfe, 0xd2, 0xf0, 0x9b, 0xfe, 0x76, 0x18, 0x1a, 0x18, 0x19, 0x9b, 0x04, 0xe7, 0x1a, 0x06, 0x19, + 0x9b, 0xac, 0x58, 0xae, 0x58, 0xed, 0xee, 0xfe, 0x89, 0x10, 0x92, 0x63, 0x3a, 0x17, 0xa9, 0x01, + 0x3b, 0x13, 0xfe, 0x35, 0x00, 0x34, 0x6b, 0x13, 0x93, 0x02, 0x6b, 0xfb, 0xb2, 0x0b, 0xfe, 0x1a, + 0x12, 0x51, 0xfe, 0x19, 0x82, 0xfe, 0x6c, 0x18, 0xfe, 0x44, 0x54, 0xf0, 0xdf, 0xfe, 0x74, 0x18, + 0x94, 0x95, 0x19, 0xfe, 0xf2, 0x08, 0x02, 0x58, 0x0a, 0x07, 0x60, 0xaf, 0x04, 0x30, 0x2a, 0x42, + 0x0d, 0x43, 0x12, 0x44, 0x83, 0x30, 0x5a, 0x42, 0xfe, 0x6c, 0x18, 0xfe, 0xed, 0x18, 0xfe, 0x44, + 0x54, 0xfe, 0xe5, 0x54, 0x36, 0x43, 0x21, 0x44, 0x04, 0x54, 0x2a, 0x69, 0x94, 0xfe, 0xe3, 0x54, + 0xfe, 0x74, 0x18, 0xfe, 0xf5, 0x18, 0x94, 0xfe, 0xe3, 0x54, 0x95, 0xca, 0x53, 0xfe, 0xf2, 0x08, + 0x02, 0x58, 0xfe, 0x37, 0xf0, 0xfe, 0xfe, 0x09, 0xfe, 0x8b, 0xf0, 0xfe, 0x84, 0x09, 0x02, 0x58, + 0xfb, 0xb2, 0x0b, 0x28, 0xfe, 0x1e, 0x0b, 0x36, 0x54, 0x21, 0x69, 0x53, 0x7a, 0x08, 0xfe, 0xc0, + 0x07, 0x47, 0x62, 0x00, 0xd9, 0xfe, 0x01, 0x59, 0xfe, 0x52, 0xf0, 0xfe, 0x30, 0x0a, 0x94, 0x99, + 0xfe, 0x48, 0x0a, 0x36, 0x54, 0x94, 0xfe, 0xe3, 0x54, 0x4e, 0x54, 0x70, 0x69, 0xfe, 0x14, 0x58, + 0xfe, 0x95, 0x58, 0x02, 0x58, 0x36, 0x54, 0x21, 0x69, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0xf0, + 0x4e, 0x54, 0x4e, 0x69, 0x02, 0x58, 0x0a, 0x07, 0x60, 0xfe, 0x82, 0x12, 0x0a, 0x07, 0x22, 0xfe, + 0x66, 0x13, 0x29, 0x68, 0x72, 0xd0, 0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, + 0x04, 0x91, 0xfe, 0x86, 0x91, 0x6d, 0x31, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x53, 0xfe, 0xfa, + 0x08, 0x04, 0x66, 0x2a, 0x67, 0x0d, 0xb5, 0x12, 0x93, 0x4e, 0x66, 0x70, 0x67, 0x01, 0xc5, 0xb6, + 0x6d, 0x31, 0x16, 0x68, 0x83, 0x30, 0x5a, 0x42, 0x36, 0x43, 0x21, 0x44, 0x95, 0xca, 0xfe, 0x04, + 0xfa, 0x30, 0xfe, 0x05, 0xfa, 0x42, 0x01, 0xfe, 0xbe, 0x13, 0xfe, 0x36, 0x10, 0x2b, 0x0d, 0xb5, + 0x0d, 0x93, 0x36, 0x43, 0x21, 0x44, 0xb0, 0x0a, 0x07, 0x22, 0x19, 0xfe, 0xfa, 0x08, 0x36, 0x3c, + 0x21, 0x3d, 0x0a, 0x07, 0xfe, 0xf7, 0x00, 0x39, 0x04, 0x64, 0x2a, 0x65, 0xfe, 0x10, 0x58, 0xfe, + 0x91, 0x58, 0x4e, 0x54, 0x70, 0x69, 0x02, 0xfe, 0x18, 0x0a, 0x0a, 0x07, 0x22, 0x19, 0xfe, 0xfa, + 0x08, 0x0a, 0x07, 0xfe, 0xf7, 0x00, 0x39, 0xf0, 0xdf, 0x6a, 0xfe, 0x10, 0x90, 0xfe, 0x92, 0x90, + 0xfe, 0xd3, 0x10, 0x40, 0x05, 0xcb, 0x19, 0xfe, 0x2c, 0x09, 0x11, 0xcb, 0xfb, 0xb2, 0x0b, 0xfe, + 0x14, 0x13, 0x04, 0x3c, 0x2a, 0x3d, 0x53, 0xfe, 0x2c, 0x09, 0xfe, 0x0c, 0x58, 0xfe, 0x8d, 0x58, + 0x02, 0x58, 0x2b, 0x47, 0xfe, 0x19, 0x80, 0xfe, 0xf1, 0x10, 0x0a, 0x07, 0x0b, 0xab, 0xfe, 0x6c, + 0x19, 0xfe, 0x19, 0x41, 0xfe, 0x8e, 0x10, 0xfe, 0x6c, 0x19, 0x4e, 0x3c, 0xfe, 0xed, 0x19, 0x70, + 0x3d, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xfe, 0x6b, 0x18, 0x1a, 0xfe, 0x00, 0xff, 0x35, 0xfe, + 0x74, 0x10, 0xcd, 0xfe, 0xd2, 0xf0, 0xfe, 0xb6, 0x0b, 0xfe, 0x76, 0x18, 0x1a, 0x18, 0xd6, 0x04, + 0xe7, 0x1a, 0x06, 0x89, 0x13, 0xfe, 0x16, 0x00, 0x02, 0x6b, 0xfe, 0xd1, 0xf0, 0xfe, 0xc8, 0x0b, + 0x17, 0x84, 0x01, 0x3b, 0x13, 0xfe, 0x17, 0x00, 0xfe, 0x42, 0x10, 0xfe, 0xce, 0xf0, 0xfe, 0xce, + 0x0b, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xda, 0x0b, 0x13, 0xfe, 0x22, 0x00, 0x02, 0x6b, + 0xfe, 0xcb, 0xf0, 0xfe, 0xe6, 0x0b, 0x13, 0xfe, 0x24, 0x00, 0x02, 0x6b, 0xfe, 0xd0, 0xf0, 0xfe, + 0xf0, 0x0b, 0x13, 0xb1, 0xe0, 0xfe, 0xcf, 0xf0, 0xfe, 0xfa, 0x0b, 0x13, 0x8f, 0xdd, 0xfe, 0xcc, + 0xf0, 0xfe, 0x0a, 0x0c, 0xfe, 0x84, 0x80, 0xb2, 0x22, 0x4f, 0x13, 0xfe, 0x12, 0x00, 0x2e, 0x08, + 0x84, 0x2f, 0xfe, 0x10, 0x0c, 0xfe, 0x9e, 0xf0, 0xfe, 0x24, 0x0c, 0xa3, 0x19, 0x32, 0x2e, 0x5b, + 0xfe, 0xed, 0x10, 0xac, 0x26, 0xae, 0x26, 0x2e, 0xfe, 0x9c, 0x32, 0x2f, 0xfe, 0x30, 0x0c, 0x1b, + 0x32, 0x85, 0xfe, 0x4c, 0x0c, 0x73, 0x97, 0xac, 0xfe, 0xf0, 0x07, 0xae, 0xfe, 0xf0, 0x07, 0x02, + 0x26, 0x01, 0x55, 0xfe, 0xdb, 0x10, 0x11, 0xfe, 0xe8, 0x00, 0xed, 0xee, 0x92, 0x86, 0x76, 0xfe, + 0x89, 0xf0, 0x26, 0x24, 0x23, 0xfe, 0xe9, 0x09, 0x01, 0x0c, 0x86, 0x76, 0x1f, 0x26, 0x24, 0x23, + 0x9a, 0x34, 0xfe, 0x88, 0x0c, 0x1b, 0x32, 0x02, 0xfe, 0x7c, 0x0c, 0xa3, 0x50, 0x13, 0xfe, 0x42, + 0x00, 0x02, 0x6b, 0xa6, 0x06, 0xfe, 0x81, 0x49, 0xfe, 0xcc, 0x12, 0x0a, 0x07, 0x0b, 0xfe, 0x5a, + 0x13, 0x13, 0x00, 0x61, 0x0b, 0xfe, 0x6a, 0x12, 0x61, 0xfe, 0x28, 0x00, 0x28, 0xfe, 0xce, 0x0d, + 0x0f, 0x7d, 0x01, 0x15, 0x05, 0x00, 0x89, 0x37, 0xfe, 0x28, 0x00, 0x02, 0xfe, 0xce, 0x0d, 0x01, + 0x9f, 0x01, 0xa1, 0x0f, 0xc8, 0x01, 0xfe, 0x24, 0x0f, 0xb9, 0x08, 0x3f, 0x09, 0xa2, 0x01, 0x45, + 0x11, 0x48, 0x08, 0x1e, 0x09, 0x52, 0x01, 0x7e, 0x02, 0x27, 0x13, 0xfe, 0x44, 0x00, 0x61, 0x0b, + 0xab, 0x37, 0x0b, 0xfe, 0xc0, 0x10, 0x01, 0xc2, 0x37, 0x0b, 0xfe, 0xb6, 0x10, 0x01, 0xc2, 0xfe, + 0x19, 0x82, 0xfe, 0x34, 0x46, 0xfe, 0x0a, 0x13, 0x37, 0x0b, 0x13, 0xfe, 0x43, 0x00, 0xfe, 0xa2, + 0x10, 0x0a, 0x41, 0x0b, 0x39, 0x01, 0x9f, 0x01, 0xa1, 0xb9, 0x08, 0x3f, 0x09, 0xa2, 0x01, 0x45, + 0x11, 0x48, 0x08, 0x1e, 0x09, 0x52, 0x01, 0x7e, 0x88, 0x0b, 0xb9, 0x1c, 0xd2, 0x02, 0xfe, 0x4c, + 0x03, 0x0a, 0x07, 0x0b, 0xd6, 0x37, 0x0b, 0x13, 0x00, 0xfe, 0x54, 0x10, 0x71, 0x07, 0x1d, 0xfe, + 0x50, 0x12, 0x0a, 0x07, 0x1d, 0xfe, 0x48, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x8c, + 0x0d, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x92, 0x0d, 0x0a, 0x41, 0x1d, 0x39, 0xfe, 0x95, + 0x10, 0x13, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0b, 0x6a, 0xfe, 0x26, 0x10, 0x13, 0xfe, 0x13, + 0x00, 0xdd, 0x13, 0xfe, 0x47, 0x00, 0x8a, 0x13, 0xfe, 0x41, 0x00, 0xa4, 0x13, 0xfe, 0x24, 0x00, + 0x04, 0x7c, 0x2c, 0x28, 0xf6, 0x6a, 0xfe, 0x04, 0xe6, 0x1d, 0xfe, 0x9d, 0x41, 0xfe, 0x1c, 0x42, + 0xb9, 0x01, 0xea, 0x02, 0x27, 0xde, 0x17, 0x0b, 0x4c, 0xfe, 0x9b, 0x00, 0xe5, 0x17, 0xfe, 0x31, + 0x00, 0x4c, 0xc4, 0x01, 0xfe, 0x30, 0x10, 0x02, 0xfe, 0xc6, 0x01, 0x1c, 0xfe, 0x06, 0xec, 0xfe, + 0xb9, 0x00, 0x8c, 0x37, 0x38, 0xc7, 0x35, 0x1c, 0xfe, 0x06, 0xea, 0xfe, 0xb9, 0x00, 0xfe, 0x47, + 0x4b, 0x9e, 0xfe, 0x75, 0x57, 0x04, 0x5f, 0xfe, 0x98, 0x56, 0xfe, 0x28, 0x12, 0x0f, 0x7d, 0xfe, + 0xf4, 0x14, 0x47, 0xf2, 0x0f, 0xc8, 0xfe, 0xea, 0x14, 0xfe, 0x49, 0x54, 0x98, 0xfe, 0x42, 0x0e, + 0x0f, 0x1e, 0xfe, 0xde, 0x14, 0xfe, 0x44, 0x48, 0x02, 0xfe, 0x4c, 0x03, 0x0f, 0x5f, 0xfe, 0xc8, + 0x14, 0x8c, 0x37, 0x38, 0xc7, 0x35, 0x1c, 0xfe, 0xce, 0x47, 0xfe, 0xbd, 0x13, 0x02, 0x27, 0x29, + 0x2d, 0x05, 0x10, 0xfe, 0x78, 0x12, 0x2b, 0x16, 0x5e, 0x16, 0xb4, 0x29, 0x48, 0x47, 0x4c, 0x48, + 0xa3, 0xd9, 0xfe, 0xbc, 0xf0, 0xfe, 0xde, 0x0e, 0x08, 0x06, 0x16, 0x5e, 0x01, 0xfe, 0xe6, 0x16, + 0x04, 0xfe, 0x38, 0x01, 0x2a, 0xfe, 0x3a, 0x01, 0x53, 0xfe, 0xe2, 0x0e, 0x04, 0xfe, 0x38, 0x01, + 0x1a, 0xfe, 0xf0, 0xff, 0x0d, 0xfe, 0x60, 0x01, 0x04, 0xfe, 0x3a, 0x01, 0x0d, 0xfe, 0x62, 0x01, + 0x20, 0x06, 0x16, 0x48, 0xfe, 0x04, 0xec, 0x2d, 0x08, 0x2d, 0x09, 0x3e, 0x1c, 0x01, 0x45, 0x82, + 0xfe, 0x05, 0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x56, 0x17, 0x11, 0x48, 0xd2, 0x08, 0x06, 0x03, + 0x2b, 0x03, 0x29, 0x5e, 0xfe, 0xf7, 0x12, 0x29, 0xb4, 0x72, 0x16, 0xb4, 0x05, 0x84, 0xfe, 0x93, + 0x13, 0xfe, 0x24, 0x1c, 0x17, 0x18, 0x4c, 0xfe, 0x9b, 0x00, 0xe5, 0xfe, 0xd9, 0x10, 0x9c, 0xfe, + 0x03, 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x03, 0x9c, 0xfe, 0x03, 0xdc, 0xfe, 0x5b, 0x57, + 0xfe, 0x80, 0x5d, 0x03, 0xfe, 0x03, 0x57, 0x9c, 0x2b, 0xfe, 0x00, 0xcc, 0x03, 0xfe, 0x03, 0x57, + 0x9c, 0x80, 0x03, 0x01, 0xfe, 0x8e, 0x17, 0x40, 0x05, 0x48, 0xfe, 0x0a, 0x13, 0x08, 0x1e, 0x09, + 0x52, 0xdd, 0x01, 0x9f, 0x01, 0xa1, 0x08, 0x3f, 0x09, 0xa2, 0x01, 0x45, 0x11, 0xfe, 0xe9, 0x00, + 0x0a, 0x07, 0x8f, 0xfe, 0x52, 0x13, 0x01, 0xfe, 0x18, 0x17, 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, + 0x0d, 0xfe, 0x64, 0x01, 0xfe, 0x16, 0x90, 0x0d, 0xfe, 0x66, 0x01, 0x0a, 0x07, 0x46, 0xef, 0xfe, + 0x03, 0x80, 0x5b, 0x4d, 0x11, 0x7b, 0x08, 0x2d, 0x09, 0x3e, 0x1c, 0x7a, 0x01, 0x90, 0xfe, 0x62, + 0x08, 0x72, 0x4d, 0x11, 0x7b, 0x08, 0x2d, 0x09, 0x3e, 0x1c, 0x7a, 0x01, 0x90, 0x6d, 0x31, 0x11, + 0x7b, 0x08, 0x2d, 0x09, 0x3e, 0x1c, 0x7a, 0x01, 0x7e, 0x03, 0xfe, 0x08, 0x1c, 0x04, 0xfe, 0xac, + 0x00, 0xfe, 0x06, 0x58, 0x04, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x04, 0xfe, 0xb0, 0x00, 0xfe, + 0x08, 0x58, 0x04, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, 0x20, 0x74, 0x16, 0xfe, + 0xb9, 0x00, 0x2b, 0x0d, 0x5c, 0x0d, 0x56, 0x20, 0x10, 0x16, 0x2d, 0x16, 0x3e, 0x51, 0xa6, 0xfe, + 0x93, 0x00, 0x08, 0x2d, 0x09, 0x3e, 0x1c, 0x01, 0x7e, 0x82, 0x11, 0x7b, 0xfe, 0x14, 0x56, 0xfe, + 0xd6, 0xf0, 0x8a, 0xde, 0x92, 0xfe, 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, 0x18, 0x1c, 0x03, 0x1c, + 0xfe, 0x0c, 0x14, 0x8c, 0xfe, 0x07, 0xe6, 0x38, 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x03, 0x01, + 0xc2, 0x0f, 0x3f, 0x01, 0x15, 0x05, 0x10, 0xdb, 0x0f, 0x1e, 0x01, 0x15, 0x05, 0x10, 0xe2, 0xfe, + 0x44, 0x58, 0x4d, 0xfe, 0x01, 0xec, 0xc4, 0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, + 0xe7, 0x1d, 0xa5, 0x31, 0x01, 0xea, 0xfe, 0xc9, 0x10, 0x03, 0x2e, 0x86, 0x76, 0x24, 0x23, 0xba, + 0x05, 0x1d, 0xfe, 0x48, 0x12, 0x05, 0x0b, 0xfe, 0x4c, 0x12, 0x05, 0x18, 0xfe, 0x30, 0x12, 0x05, + 0xd4, 0x19, 0xfe, 0xd4, 0x11, 0x05, 0xfe, 0x23, 0x00, 0x19, 0xfe, 0xe0, 0x11, 0x05, 0x06, 0x19, + 0xfe, 0x3e, 0x12, 0x05, 0x22, 0xfe, 0x12, 0x12, 0x05, 0x00, 0x19, 0x26, 0x17, 0xd4, 0x01, 0x3b, + 0xce, 0x3a, 0x01, 0x0c, 0x85, 0x55, 0x03, 0x3a, 0x11, 0xfe, 0xcc, 0x00, 0x02, 0x27, 0x3a, 0x40, + 0x05, 0xcb, 0xfe, 0xe3, 0x13, 0x36, 0x3c, 0x21, 0x3d, 0x53, 0xfe, 0x92, 0x11, 0x0a, 0x07, 0x60, + 0xfe, 0x72, 0x12, 0x83, 0x30, 0x5a, 0x42, 0x95, 0xca, 0x98, 0xfe, 0x5c, 0x11, 0x29, 0x68, 0xfe, + 0x26, 0x13, 0x04, 0xb5, 0x2a, 0x93, 0x53, 0xfe, 0xb2, 0x0d, 0x0d, 0x66, 0x12, 0x67, 0x2b, 0x0d, + 0xb5, 0x0d, 0x93, 0x01, 0xc5, 0x20, 0x74, 0x5b, 0x16, 0x68, 0x01, 0xfe, 0xbe, 0x13, 0x83, 0x30, + 0x5a, 0x42, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x30, 0xfe, 0x05, 0xfa, 0x42, + 0xfe, 0x91, 0x10, 0x04, 0x43, 0x2a, 0x44, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56, 0x0d, 0x43, 0x12, + 0x44, 0xad, 0x83, 0x30, 0x5a, 0x42, 0x95, 0xca, 0x04, 0x64, 0x2a, 0x65, 0xfe, 0x00, 0x56, 0xfe, + 0xa1, 0x56, 0x0d, 0x64, 0x12, 0x65, 0x0a, 0x07, 0x60, 0xfe, 0x1e, 0x12, 0x29, 0x68, 0xfe, 0x1f, + 0x40, 0x04, 0x66, 0x2a, 0x67, 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x04, 0x43, 0x2a, 0x44, 0xfe, + 0x34, 0x50, 0xfe, 0xb6, 0x50, 0x04, 0x64, 0x2a, 0x65, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x04, + 0x3c, 0x2a, 0x3d, 0xfe, 0x28, 0x50, 0xfe, 0xaa, 0x50, 0x02, 0xa0, 0x20, 0x06, 0x16, 0xfc, 0x02, + 0x7f, 0x3a, 0x01, 0x0c, 0x1f, 0x57, 0x24, 0x23, 0xba, 0x05, 0x06, 0x28, 0x57, 0x40, 0x05, 0xcb, + 0x28, 0x7f, 0x01, 0xfe, 0x9c, 0x13, 0x1a, 0x59, 0x19, 0x57, 0x0a, 0x07, 0x0b, 0xe4, 0x36, 0x3c, + 0x21, 0x3d, 0xfe, 0x0a, 0x55, 0x35, 0xfe, 0x8b, 0x55, 0x4e, 0x3c, 0x70, 0x3d, 0xfe, 0x0c, 0x51, + 0xfe, 0x8e, 0x51, 0x02, 0x7f, 0xdf, 0xfe, 0x0a, 0x45, 0xfe, 0x19, 0x41, 0x02, 0x7f, 0x3a, 0x01, + 0x0c, 0x1f, 0xfe, 0xd6, 0x10, 0x24, 0x23, 0xfe, 0xe9, 0x09, 0x61, 0x18, 0xfe, 0x94, 0x12, 0x61, + 0x0b, 0x4f, 0x02, 0x57, 0x2f, 0xfe, 0x5e, 0x12, 0x1b, 0x32, 0x1f, 0xfe, 0xd6, 0x10, 0x24, 0x23, + 0x9a, 0x05, 0x18, 0x28, 0x57, 0x01, 0x0c, 0x1f, 0xfe, 0xd6, 0x10, 0x24, 0x23, 0xfe, 0xe8, 0x09, + 0x51, 0x04, 0xfe, 0x9c, 0x00, 0x2c, 0x35, 0xfe, 0xbb, 0x45, 0x61, 0x00, 0x50, 0x37, 0x06, 0xa6, + 0x59, 0xfe, 0xc0, 0x14, 0xfe, 0xf8, 0x14, 0xb3, 0x40, 0x05, 0xc9, 0xfe, 0x16, 0x13, 0x04, 0xfe, + 0x9e, 0x00, 0x2c, 0xd6, 0x04, 0x56, 0x2c, 0x35, 0x63, 0x02, 0x7f, 0xfe, 0xc0, 0x5d, 0xfe, 0xe4, + 0x14, 0xfe, 0x03, 0x17, 0x04, 0x5c, 0xc3, 0x0d, 0x5c, 0x63, 0x3a, 0x01, 0x0c, 0x25, 0xa0, 0x01, + 0xfe, 0x06, 0x15, 0x02, 0xa0, 0x2f, 0xfe, 0xe8, 0x12, 0x1b, 0x32, 0x1f, 0x57, 0x24, 0x23, 0x9a, + 0x05, 0x06, 0x28, 0x57, 0xfe, 0xf6, 0x14, 0xfe, 0x42, 0x58, 0xfe, 0x70, 0x14, 0xfe, 0x92, 0x14, + 0xb3, 0xfe, 0x4a, 0xf4, 0x0b, 0x19, 0x57, 0xfe, 0x4a, 0xf4, 0x06, 0xd8, 0x40, 0x05, 0xc9, 0xd1, + 0x02, 0x7f, 0x04, 0x56, 0xc3, 0x0d, 0x56, 0x63, 0x3a, 0x01, 0x0c, 0x25, 0xa0, 0x01, 0xfe, 0x34, + 0x15, 0x02, 0xa0, 0x25, 0xfe, 0x50, 0x13, 0x78, 0xf9, 0x78, 0x03, 0x34, 0xfe, 0x4c, 0x13, 0x73, + 0xfe, 0x4c, 0x13, 0x63, 0x3a, 0x01, 0x0c, 0xfe, 0xe3, 0x10, 0x08, 0x6c, 0xff, 0x02, 0x00, 0x57, + 0x6e, 0x81, 0x1a, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x08, 0x6c, 0xff, + 0x02, 0x00, 0x57, 0x6e, 0x81, 0x1a, 0x59, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x08, 0x6c, + 0xff, 0x02, 0x00, 0x57, 0x6e, 0x81, 0x03, 0x08, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x6e, 0x81, 0xfe, + 0x0b, 0x58, 0x03, 0x0f, 0x5c, 0x01, 0x8e, 0x0f, 0x56, 0x01, 0x8e, 0x03, 0xd0, 0x1a, 0x10, 0xff, + 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, 0x22, 0x6e, 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, + 0x7d, 0xfe, 0x03, 0x7c, 0x6d, 0x31, 0x0d, 0x64, 0x12, 0x65, 0x4e, 0x43, 0x70, 0x44, 0x03, 0xfe, + 0x62, 0x18, 0xfe, 0x82, 0x5a, 0xfe, 0xe1, 0x1a, 0xbf, 0xfe, 0x02, 0x58, 0x03, 0x01, 0xfe, 0x7e, + 0x19, 0xfe, 0x42, 0x48, 0x6a, 0x51, 0x9e, 0x01, 0x0c, 0x1f, 0xfe, 0xfe, 0x14, 0x24, 0x23, 0xfe, + 0xe9, 0x09, 0xfe, 0xc1, 0x59, 0x01, 0x0c, 0x1f, 0xfe, 0xfe, 0x14, 0x24, 0x23, 0xfe, 0xe8, 0x0a, + 0x04, 0xfe, 0x9e, 0x00, 0x2c, 0xfe, 0xc4, 0x12, 0x2b, 0xb8, 0x1d, 0xe4, 0x61, 0xd5, 0x79, 0xfe, + 0x4c, 0x14, 0x4f, 0x08, 0x06, 0x09, 0xd5, 0xa6, 0xfe, 0x00, 0x10, 0xfe, 0x78, 0x10, 0xff, 0x02, + 0x83, 0x55, 0x8a, 0xff, 0x02, 0x83, 0x55, 0xb8, 0x18, 0xfe, 0x12, 0x13, 0x62, 0xfe, 0x30, 0x00, + 0x98, 0xfe, 0xa6, 0x14, 0x09, 0x8b, 0x08, 0x06, 0xfe, 0x56, 0x10, 0xb8, 0x0b, 0xfe, 0x16, 0x13, + 0x62, 0xfe, 0x64, 0x00, 0x98, 0xfe, 0xa6, 0x14, 0x0f, 0xfe, 0x64, 0x00, 0x09, 0xb1, 0x08, 0x06, + 0xfe, 0x28, 0x10, 0xb8, 0x06, 0xfe, 0x60, 0x13, 0x62, 0xfe, 0xc8, 0x00, 0x98, 0xfe, 0xa6, 0x14, + 0x0f, 0xfe, 0xc8, 0x00, 0x09, 0x5e, 0x08, 0x06, 0xad, 0x62, 0xfe, 0x90, 0x01, 0x99, 0xfe, 0xb2, + 0x14, 0x9e, 0xb0, 0xfe, 0x43, 0xf4, 0xb4, 0xfe, 0x56, 0xf0, 0xfe, 0xc4, 0x14, 0xfe, 0x04, 0xf4, + 0x6c, 0xfe, 0x43, 0xf4, 0xb1, 0xfe, 0xf3, 0x10, 0xb7, 0x01, 0xfe, 0x8e, 0x13, 0x1a, 0x59, 0xaf, + 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x74, 0x99, 0xfe, 0xf8, 0x14, 0xa8, 0x74, 0xfe, 0x14, 0x10, + 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0xf1, 0x99, 0xfe, 0xf8, 0x14, 0xa8, 0xf1, 0xa4, 0x51, 0x9e, + 0x08, 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, 0x03, 0x51, 0x08, 0x0b, 0x03, 0x14, 0x06, 0x01, + 0x0c, 0x25, 0xec, 0x14, 0x0b, 0x01, 0x0c, 0x25, 0xec, 0x14, 0x18, 0x01, 0x0c, 0x25, 0xec, 0x78, + 0xfe, 0x89, 0x49, 0x01, 0x0c, 0x03, 0x14, 0x06, 0x01, 0x0c, 0x25, 0xbc, 0x14, 0x18, 0x01, 0x0c, + 0x25, 0xbc, 0x14, 0x06, 0x01, 0x0c, 0x25, 0xbc, 0xfe, 0x89, 0x49, 0x01, 0x0c, 0x25, 0xbc, 0x78, + 0xfe, 0x89, 0x4a, 0x01, 0x0c, 0x03, 0x51, 0x03, 0x29, 0xe8, 0x05, 0x06, 0x3b, 0xb6, 0x16, 0xe8, + 0xfe, 0x49, 0xf4, 0x00, 0x4f, 0x78, 0xce, 0x63, 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xf9, 0x01, + 0x0c, 0x40, 0x05, 0xfe, 0xe3, 0x00, 0xfe, 0x20, 0x13, 0x1f, 0xfe, 0xb6, 0x15, 0x2b, 0x16, 0xfc, + 0x01, 0x55, 0x29, 0xfc, 0x05, 0x06, 0x50, 0x0a, 0x41, 0x06, 0x39, 0x03, 0x0d, 0x5d, 0x12, 0x91, + 0xfe, 0x43, 0x58, 0x01, 0x15, 0x05, 0x10, 0xfe, 0x1e, 0x12, 0x4a, 0xf3, 0x96, 0x01, 0x49, 0xfe, + 0x90, 0x4d, 0xe6, 0x10, 0xfe, 0xc5, 0x59, 0x01, 0x49, 0xfe, 0x8d, 0x56, 0xbf, 0x4a, 0x03, 0x4a, + 0x21, 0x91, 0x01, 0x15, 0x4a, 0x96, 0x01, 0x49, 0xeb, 0x10, 0xe6, 0x10, 0x21, 0x5d, 0x62, 0x1e, + 0x89, 0x0f, 0x5f, 0x01, 0xaa, 0x03, 0x0d, 0x5d, 0x12, 0x91, 0xfe, 0xc3, 0x58, 0x01, 0x15, 0x05, + 0x10, 0xfe, 0x1a, 0x12, 0x4a, 0xf3, 0x96, 0x01, 0x49, 0xeb, 0x10, 0xfe, 0x80, 0x4d, 0xfe, 0xc5, + 0x59, 0x01, 0x49, 0x4a, 0x03, 0x4a, 0x21, 0x5d, 0x01, 0x15, 0x4a, 0x96, 0x01, 0x49, 0xeb, 0x10, + 0xe6, 0x10, 0x21, 0x5d, 0x62, 0x1e, 0x89, 0x0f, 0x5f, 0x01, 0xaa, 0x03, 0x0d, 0x5d, 0x12, 0x91, + 0xfe, 0x43, 0x58, 0x01, 0x15, 0xfe, 0x42, 0x48, 0x96, 0x01, 0x49, 0xfe, 0xc0, 0x5a, 0xb7, 0xfe, + 0x00, 0xcd, 0xfe, 0x01, 0xcc, 0xfe, 0x4a, 0x46, 0xe4, 0x9c, 0x80, 0x05, 0x10, 0xfe, 0x2e, 0x13, + 0x5a, 0x5d, 0xfe, 0x4d, 0xf4, 0x1e, 0xfe, 0x1c, 0x13, 0x0f, 0x5f, 0x01, 0x8e, 0xb0, 0xfe, 0x40, + 0x4c, 0xfe, 0xc5, 0x58, 0x01, 0x49, 0xfe, 0x00, 0x07, 0x80, 0x05, 0x10, 0x89, 0x5a, 0x91, 0xfe, + 0x05, 0x57, 0xfe, 0x08, 0x10, 0xfe, 0x45, 0x58, 0x01, 0x49, 0xfe, 0x8d, 0x56, 0xbf, 0xfe, 0x80, + 0x4c, 0xfe, 0x05, 0x17, 0x03, 0x09, 0x10, 0x77, 0x6f, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, + 0x19, 0xde, 0xfe, 0x24, 0x1c, 0xe3, 0x38, 0x9d, 0xfe, 0xfa, 0x16, 0x01, 0xfe, 0x08, 0x18, 0xd9, + 0x8d, 0x38, 0x6f, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x03, 0xc0, 0x28, 0xfe, 0xea, 0x16, 0xfe, + 0xe2, 0x10, 0x09, 0x10, 0x77, 0x04, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x22, 0xfe, 0x18, 0x58, + 0x04, 0xfe, 0x66, 0x01, 0xfe, 0x19, 0x58, 0x8d, 0x22, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, 0x06, + 0xfe, 0x3c, 0x50, 0x6f, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x22, 0x9d, 0xfe, + 0x44, 0x17, 0xfe, 0xbe, 0x14, 0x35, 0x03, 0xc0, 0x28, 0xfe, 0x1c, 0x17, 0xfe, 0xa4, 0x10, 0x09, + 0x10, 0x77, 0xbf, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xdf, 0xe3, 0x30, 0x9d, 0xfe, 0x66, 0x17, 0xfe, + 0x9c, 0x14, 0xfe, 0x18, 0x13, 0x8d, 0x30, 0x6f, 0x1d, 0xfe, 0xaf, 0x19, 0xfe, 0x98, 0xe7, 0x00, + 0xa7, 0x07, 0xfe, 0x7f, 0x00, 0xfe, 0x05, 0x40, 0x03, 0xc0, 0x28, 0xfe, 0x5a, 0x17, 0xfe, 0x6c, + 0x10, 0x09, 0x10, 0x77, 0xfe, 0x30, 0xbc, 0xfe, 0xb2, 0xbc, 0x8d, 0xe1, 0x6f, 0x1d, 0xfe, 0x0f, + 0x79, 0xfe, 0x1c, 0xf7, 0xe1, 0x9d, 0xfe, 0xa6, 0x17, 0xfe, 0x5c, 0x14, 0x35, 0x03, 0xc0, 0x28, + 0xfe, 0x92, 0x17, 0xfe, 0x42, 0x10, 0xfe, 0x02, 0xf6, 0x10, 0x77, 0xfe, 0x18, 0xfe, 0x66, 0xfe, + 0x19, 0xfe, 0x67, 0xd0, 0xe3, 0x46, 0x9d, 0xfe, 0xcc, 0x17, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13, + 0x8d, 0x46, 0x47, 0xfe, 0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x10, 0xfe, 0x81, 0xe7, + 0x10, 0x11, 0xfe, 0xdd, 0x00, 0x6d, 0x31, 0x03, 0x6d, 0x31, 0xfe, 0x12, 0x45, 0x28, 0xfe, 0xbc, + 0x17, 0x17, 0x06, 0x4c, 0xfe, 0x9b, 0x00, 0xe5, 0x02, 0x27, 0xfe, 0x39, 0xf0, 0xfe, 0x10, 0x18, + 0x2b, 0x03, 0xfe, 0x7e, 0x18, 0x1a, 0x18, 0x87, 0x08, 0x0e, 0x03, 0x77, 0x04, 0xe7, 0x1a, 0x06, + 0xfe, 0xef, 0x12, 0xfe, 0xe1, 0x10, 0x1c, 0x0f, 0x1e, 0x01, 0x15, 0x05, 0x10, 0x50, 0x4d, 0xfe, + 0x78, 0x14, 0xfe, 0x34, 0x12, 0x59, 0x8c, 0x37, 0x38, 0xc7, 0xfe, 0xe9, 0x13, 0x1c, 0x0f, 0x3f, + 0x01, 0x15, 0x05, 0x10, 0x50, 0x4d, 0xfe, 0x56, 0x14, 0xe9, 0x59, 0x8c, 0x37, 0x38, 0xc7, 0xfe, + 0xe9, 0x13, 0x09, 0x0b, 0x03, 0xfe, 0x9c, 0xe7, 0x0b, 0x13, 0xfe, 0x15, 0x00, 0x7a, 0xa5, 0x31, + 0x01, 0xea, 0x09, 0x06, 0x03, 0x0a, 0x41, 0x38, 0x39, 0x08, 0x3f, 0x09, 0xa2, 0x01, 0x45, 0x11, + 0x48, 0x08, 0x1e, 0x09, 0x52, 0x01, 0x7e, 0x09, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, + 0x36, 0xfe, 0xa8, 0x00, 0x21, 0x7b, 0xfe, 0x48, 0x55, 0x35, 0xfe, 0xc9, 0x55, 0x03, 0x29, 0xc6, + 0x5b, 0x16, 0xc6, 0x03, 0x0f, 0xc8, 0x01, 0x15, 0xf2, 0x0f, 0x7d, 0x01, 0x15, 0xfe, 0x49, 0x44, + 0x28, 0xfe, 0x06, 0x19, 0x0f, 0x1e, 0x01, 0x15, 0x05, 0x10, 0x50, 0x0f, 0x5f, 0x01, 0xaa, 0x0f, + 0x7d, 0x01, 0x15, 0x5b, 0x80, 0x03, 0xfe, 0x40, 0x5e, 0xfe, 0xe2, 0x08, 0xfe, 0xc0, 0x4c, 0x29, + 0x3e, 0x05, 0x10, 0xfe, 0x52, 0x12, 0x4d, 0x05, 0x00, 0xfe, 0x18, 0x12, 0xfe, 0xe1, 0x18, 0xfe, + 0x19, 0xf4, 0xfe, 0x7f, 0x00, 0xaf, 0xfe, 0xe2, 0x08, 0x5b, 0x4d, 0x40, 0x05, 0x7b, 0xab, 0xfe, + 0x82, 0x48, 0xfe, 0x01, 0x80, 0xfe, 0xd7, 0x10, 0xfe, 0xc4, 0x48, 0x08, 0x2d, 0x09, 0x3e, 0xfe, + 0x40, 0x5f, 0x1c, 0x01, 0x45, 0x11, 0xfe, 0xdd, 0x00, 0xfe, 0x14, 0x46, 0x08, 0x2d, 0x09, 0x3e, + 0x01, 0x45, 0x11, 0xfe, 0xdd, 0x00, 0xfe, 0x40, 0x4a, 0x72, 0xfe, 0x06, 0x17, 0xfe, 0x01, 0x07, + 0xfe, 0x82, 0x48, 0xfe, 0x04, 0x17, 0x03, 0xf5, 0x18, 0x79, 0xfe, 0x8e, 0x19, 0x04, 0xfe, 0x90, + 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xf5, 0xd4, 0x79, 0xfe, 0xa0, 0x19, 0x04, 0xfe, 0x92, + 0x00, 0xcf, 0x1d, 0xe0, 0xf5, 0xfe, 0x0b, 0x00, 0x79, 0xfe, 0xb2, 0x19, 0x04, 0xfe, 0x94, 0x00, + 0xcf, 0x22, 0xfe, 0x08, 0x10, 0x04, 0xfe, 0x96, 0x00, 0xcf, 0x8b, 0xfe, 0x4e, 0x45, 0xd8, 0xfe, + 0x0a, 0x45, 0xff, 0x04, 0x68, 0x54, 0xfe, 0xf1, 0x10, 0x1a, 0x74, 0xfe, 0x08, 0x1c, 0xfe, 0x67, + 0x19, 0xfe, 0x0a, 0x1c, 0xfe, 0x1a, 0xf4, 0xfe, 0x00, 0x04, 0xd8, 0xfe, 0x48, 0xf4, 0x18, 0x99, + 0xfe, 0xe6, 0x19, 0x08, 0x18, 0x03, 0x05, 0x84, 0xfe, 0x5a, 0xf0, 0xfe, 0xf6, 0x19, 0x20, 0xfe, + 0x09, 0x00, 0xfe, 0x34, 0x10, 0x05, 0x1d, 0xfe, 0x5a, 0xf0, 0xfe, 0x04, 0x1a, 0x20, 0xd5, 0xfe, + 0x26, 0x10, 0x05, 0x18, 0x87, 0x20, 0x8b, 0xe0, 0x05, 0x0b, 0x87, 0x20, 0xb1, 0xfe, 0x0e, 0x10, + 0x05, 0x06, 0x87, 0x20, 0x5e, 0xce, 0xb6, 0x03, 0x17, 0xfe, 0x09, 0x00, 0x01, 0x3b, 0x2f, 0xfe, + 0x34, 0x1a, 0x04, 0x76, 0xb7, 0x03, 0x1b, 0xfe, 0x54, 0x1a, 0xfe, 0x14, 0xf0, 0x0c, 0x2f, 0xfe, + 0x48, 0x1a, 0x1b, 0xfe, 0x54, 0x1a, 0xfe, 0x82, 0xf0, 0xfe, 0x4c, 0x1a, 0x03, 0xff, 0x15, 0x00, + 0x00, +}; STATIC unsigned short _adv_asc38C0800_size = - sizeof(_adv_asc38C0800_buf); /* 0x14AA */ -STATIC unsigned long _adv_asc38C0800_chksum = - 0x05297A65UL; /* Expanded checksum. */ + sizeof(_adv_asc38C0800_buf); /* 0x14F1 */ +STATIC ADV_DCNT _adv_asc38C0800_chksum = + 0x053503A5; /* Expanded checksum. */ /* a_init.c */ /* @@ -15372,8 +15437,8 @@ */ STATIC ADVEEP_3550_CONFIG Default_3550_EEPROM_Config ASC_INITDATA = { - ADV_EEPROM_BIOS_ENABLE, /* cfg_msw */ - 0x0000, /* cfg_lsw */ + ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */ + 0x0000, /* cfg_msw */ 0xFFFF, /* disc_enable */ 0xFFFF, /* wdtr_able */ 0xFFFF, /* sdtr_able */ @@ -15410,8 +15475,8 @@ STATIC ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config ASC_INITDATA = { - ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_msw */ - 0x0000, /* 01 cfg_lsw */ + ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ + 0x0000, /* 01 cfg_msw */ 0xFFFF, /* 02 disc_enable */ 0xFFFF, /* 03 wdtr_able */ 0x4444, /* 04 sdtr_speed1 */ @@ -15497,6 +15562,9 @@ /* * PCI Command Register + * + * Note: AscPCICmdRegBits_BusMastering definition (0x0007) includes + * I/O Space Control, Memory Space Control and Bus Master Control bits. */ if (((pci_cmd_reg = DvcAdvReadPCIConfigByte(asc_dvc, @@ -15550,11 +15618,11 @@ asc_dvc->cfg->chip_version = AdvGetChipVersion(iop_base, asc_dvc->bus_type); - ASC_DBG2(1, "iopb_chip_id_1: %x %x\n", + ASC_DBG2(1, "AdvInitGetConfig: iopb_chip_id_1: %x %x\n", (ushort) AdvReadByteRegister(iop_base, IOPB_CHIP_ID_1), (ushort) ADV_CHIP_ID_BYTE); - ASC_DBG2(1, "iopw_chip_id_0: %x %x\n", + ASC_DBG2(1, "AdvInitGetConfig: iopw_chip_id_0: %x %x\n", (ushort) AdvReadWordRegister(iop_base, IOPW_CHIP_ID_0), (ushort) ADV_CHIP_ID_WORD); @@ -15619,7 +15687,7 @@ { AdvPortAddr iop_base; ushort warn_code; - ulong sum; + ADV_DCNT sum; int begin_addr; int end_addr; ushort code_sum; @@ -15627,9 +15695,9 @@ int j; int adv_asc3550_expanded_size; ADV_CARR_T *carrp; - ulong contig_len; - long buf_size; - ulong carr_paddr; + ADV_DCNT contig_len; + ADV_SDCNT buf_size; + ADV_PADDR carr_paddr; int i; ushort scsi_cfg1; uchar tid; @@ -15678,7 +15746,7 @@ bios_version = bios_mem[(ASC_MC_BIOS_VERSION - ASC_MC_BIOSMEM)/2]; major = (bios_version >> 12) & 0xF; minor = (bios_version >> 8) & 0xF; - if (major <= 3 || (major == 3 && minor == 1)) + if (major < 3 || (major == 3 && minor == 1)) { /* BIOS 3.1 and earlier location of 'wdtr_able' variable. */ AdvReadWordLram(iop_base, 0x120, wdtr_able); @@ -15723,21 +15791,24 @@ { for (j = 0; j < _adv_asc3550_buf[i + 1]; j++) { - AdvWriteWordAutoIncLram(iop_base, - *((ushort *) (&_adv_asc3550_buf[i + 2]))); + AdvWriteWordAutoIncLram(iop_base, (((ushort) + _adv_asc3550_buf[i + 3] << 8) | + _adv_asc3550_buf[i + 2])); word++; } - i += 3; + i += 3; } else if (_adv_asc3550_buf[i] == 0xfe) { - AdvWriteWordAutoIncLram(iop_base, - *((ushort *) (&_adv_asc3550_buf[i + 1]))); + AdvWriteWordAutoIncLram(iop_base, (((ushort) + _adv_asc3550_buf[i + 2] << 8) | + _adv_asc3550_buf[i + 1])); i += 2; word++; } else { - AdvWriteWordAutoIncLram(iop_base, - *((ushort *) &_adv_asc3550_buf[_adv_asc3550_buf[i] * 2])); + AdvWriteWordAutoIncLram(iop_base, (((ushort) + _adv_asc3550_buf[(_adv_asc3550_buf[i] * 2) + 1] << 8) | + _adv_asc3550_buf[_adv_asc3550_buf[i] * 2])); word++; } } @@ -15837,7 +15908,7 @@ * queuing will be set in AdvInquiryHandling() based on what a * device reports it is capable of in Inquiry byte 7. * - * If SCSI Bus Resets haev been disabled, then directly set + * If SCSI Bus Resets have been disabled, then directly set * SDTR and WDTR from the EEPROM configuration. This will allow * the BIOS and warm boot to work without a SCSI bus hang on * the Inquiry caused by host and target mismatched DTR values. @@ -16016,7 +16087,7 @@ * after it is started below. */ AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, - FLTR_11_TO_20NS | scsi_cfg1); + FLTR_DISABLE | scsi_cfg1); /* * Set MEM_CFG Microcode Default Value @@ -16046,7 +16117,7 @@ * * Driver must have already allocated memory and set 'carrier_buf'. */ - ADV_ASSERT(asc_dvc->carrier_buf != NULL); + ASC_ASSERT(asc_dvc->carrier_buf != NULL); carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf); asc_dvc->carr_freelist = NULL; @@ -16063,8 +16134,8 @@ * Get physical address of the carrier 'carrp'. */ contig_len = sizeof(ADV_CARR_T); - carr_paddr = DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp, - (long *) &contig_len, ADV_IS_CARRIER_FLAG); + carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp, + (ADV_SDCNT *) &contig_len, ADV_IS_CARRIER_FLAG)); buf_size -= sizeof(ADV_CARR_T); @@ -16080,12 +16151,12 @@ } carrp->carr_pa = carr_paddr; - carrp->carr_va = (ulong) carrp; + carrp->carr_va = ADV_VADDR_TO_U32(carrp); /* * Insert the carrier at the beginning of the freelist. */ - carrp->next_vpa = (ulong) asc_dvc->carr_freelist; + carrp->next_vpa = ADV_VADDR_TO_U32(asc_dvc->carr_freelist); asc_dvc->carr_freelist = carrp; carrp++; @@ -16101,7 +16172,8 @@ asc_dvc->err_code |= ASC_IERR_NO_CARRIER; return ADV_ERROR; } - asc_dvc->carr_freelist = (ADV_CARR_T *) asc_dvc->icq_sp->next_vpa; + asc_dvc->carr_freelist = + (ADV_CARR_T *) ADV_U32_TO_VADDR(asc_dvc->icq_sp->next_vpa); /* * The first command issued will be placed in the stopper carrier. @@ -16111,7 +16183,8 @@ /* * Set RISC ICQ physical address start value. */ - AdvWriteDWordLram(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); + AdvWriteDWordLram(iop_base, ASC_MC_ICQ, + cpu_to_le32(asc_dvc->icq_sp->carr_pa)); /* * Set-up the RISC->Host Initiator Response Queue (IRQ). @@ -16121,7 +16194,8 @@ asc_dvc->err_code |= ASC_IERR_NO_CARRIER; return ADV_ERROR; } - asc_dvc->carr_freelist = (ADV_CARR_T *) asc_dvc->irq_sp->next_vpa; + asc_dvc->carr_freelist = + (ADV_CARR_T *) ADV_U32_TO_VADDR(asc_dvc->irq_sp->next_vpa); /* * The first command completed by the RISC will be placed in @@ -16135,7 +16209,8 @@ /* * Set RISC IRQ physical address start value. */ - AdvWriteDWordLram(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); + AdvWriteDWordLram(iop_base, ASC_MC_IRQ, + cpu_to_le32(asc_dvc->irq_sp->carr_pa)); asc_dvc->carr_pending_cnt = 0; AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES, @@ -16202,7 +16277,7 @@ { AdvPortAddr iop_base; ushort warn_code; - ulong sum; + ADV_DCNT sum; int begin_addr; int end_addr; ushort code_sum; @@ -16210,9 +16285,9 @@ int j; int adv_asc38C0800_expanded_size; ADV_CARR_T *carrp; - ulong contig_len; - long buf_size; - ulong carr_paddr; + ADV_DCNT contig_len; + ADV_SDCNT buf_size; + ADV_PADDR carr_paddr; int i; ushort scsi_cfg1; uchar byte; @@ -16366,21 +16441,24 @@ { for (j = 0; j < _adv_asc38C0800_buf[i + 1]; j++) { - AdvWriteWordAutoIncLram(iop_base, - *((ushort *) (&_adv_asc38C0800_buf[i + 2]))); + AdvWriteWordAutoIncLram(iop_base, (((ushort) + _adv_asc38C0800_buf[i + 3] << 8) | + _adv_asc38C0800_buf[i + 2])); word++; } - i += 3; + i += 3; } else if (_adv_asc38C0800_buf[i] == 0xfe) { - AdvWriteWordAutoIncLram(iop_base, - *((ushort *) (&_adv_asc38C0800_buf[i + 1]))); + AdvWriteWordAutoIncLram(iop_base, (((ushort) + _adv_asc38C0800_buf[i + 2] << 8) | + _adv_asc38C0800_buf[i + 1])); i += 2; word++; } else { - AdvWriteWordAutoIncLram(iop_base, *((ushort *) - &_adv_asc38C0800_buf[_adv_asc38C0800_buf[i] * 2])); + AdvWriteWordAutoIncLram(iop_base, (((ushort) + _adv_asc38C0800_buf[(_adv_asc38C0800_buf[i] * 2) + 1] << 8) | + _adv_asc38C0800_buf[_adv_asc38C0800_buf[i] * 2])); word++; } } @@ -16410,6 +16488,11 @@ { sum += AdvReadWordAutoIncLram(iop_base); } + ASC_DBG2(1, "AdvInitAsc38C0800Driver: word %d, i %d\n", word, i); + + ASC_DBG2(1, + "AdvInitAsc38C0800Driver: sum 0x%lx, _adv_asc38C0800_chksum 0x%lx\n", + (ulong) sum, (ulong) _adv_asc38C0800_chksum); if (sum != _adv_asc38C0800_chksum) { @@ -16665,8 +16748,7 @@ * * Driver must have already allocated memory and set 'carrier_buf'. */ - - ADV_ASSERT(asc_dvc->carrier_buf != NULL); + ASC_ASSERT(asc_dvc->carrier_buf != NULL); carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf); asc_dvc->carr_freelist = NULL; @@ -16683,8 +16765,8 @@ * Get physical address for the carrier 'carrp'. */ contig_len = sizeof(ADV_CARR_T); - carr_paddr = DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp, - (long *) &contig_len, ADV_IS_CARRIER_FLAG); + carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp, + (ADV_SDCNT *) &contig_len, ADV_IS_CARRIER_FLAG)); buf_size -= sizeof(ADV_CARR_T); @@ -16700,12 +16782,12 @@ } carrp->carr_pa = carr_paddr; - carrp->carr_va = (ulong) carrp; + carrp->carr_va = ADV_VADDR_TO_U32(carrp); /* * Insert the carrier at the beginning of the freelist. */ - carrp->next_vpa = (ulong) asc_dvc->carr_freelist; + carrp->next_vpa = ADV_VADDR_TO_U32(asc_dvc->carr_freelist); asc_dvc->carr_freelist = carrp; carrp++; @@ -16721,7 +16803,8 @@ asc_dvc->err_code |= ASC_IERR_NO_CARRIER; return ADV_ERROR; } - asc_dvc->carr_freelist = (ADV_CARR_T *) asc_dvc->icq_sp->next_vpa; + asc_dvc->carr_freelist = + (ADV_CARR_T *) ADV_U32_TO_VADDR(asc_dvc->icq_sp->next_vpa); /* * The first command issued will be placed in the stopper carrier. @@ -16731,7 +16814,8 @@ /* * Set RISC ICQ physical address start value. */ - AdvWriteDWordLram(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); + AdvWriteDWordLram(iop_base, ASC_MC_ICQ, + cpu_to_le32(asc_dvc->icq_sp->carr_pa)); /* * Set-up the RISC->Host Initiator Response Queue (IRQ). @@ -16741,7 +16825,8 @@ asc_dvc->err_code |= ASC_IERR_NO_CARRIER; return ADV_ERROR; } - asc_dvc->carr_freelist = (ADV_CARR_T *) asc_dvc->irq_sp->next_vpa; + asc_dvc->carr_freelist = + (ADV_CARR_T *) ADV_U32_TO_VADDR(asc_dvc->irq_sp->next_vpa); /* * The first command completed by the RISC will be placed in @@ -16755,7 +16840,8 @@ /* * Set RISC IRQ physical address start value. */ - AdvWriteDWordLram(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); + AdvWriteDWordLram(iop_base, ASC_MC_IRQ, + cpu_to_le32(asc_dvc->irq_sp->carr_pa)); asc_dvc->carr_pending_cnt = 0; AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES, @@ -16822,15 +16908,13 @@ */ ASC_INITFUNC( STATIC int, -AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) +AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) ) { - AdvPortAddr iop_base; - ushort warn_code; - ADVEEP_38C0800_CONFIG eep_config; - int i; - uchar tid, termination; - ushort sdtr_speed = 0; + AdvPortAddr iop_base; + ushort warn_code; + ADVEEP_3550_CONFIG eep_config; + int i; iop_base = asc_dvc->iop_base; @@ -16840,18 +16924,20 @@ * Read the board's EEPROM configuration. * * Set default values if a bad checksum is found. + * + * XXX - Don't handle big-endian access to EEPROM yet. */ - if (AdvGet38C0800EEPConfig(iop_base, &eep_config) != eep_config.check_sum) + if (AdvGet3550EEPConfig(iop_base, &eep_config) != eep_config.check_sum) { warn_code |= ASC_WARN_EEPROM_CHKSUM; /* * Set EEPROM default values. */ - for (i = 0; i < sizeof(ADVEEP_38C0800_CONFIG); i++) + for (i = 0; i < sizeof(ADVEEP_3550_CONFIG); i++) { *((uchar *) &eep_config + i) = - *((uchar *) &Default_38C0800_EEPROM_Config + i); + *((uchar *) &Default_3550_EEPROM_Config + i); } /* @@ -16868,19 +16954,17 @@ eep_config.serial_number_word1 = AdvReadEEPWord(iop_base, ASC_EEP_DVC_CFG_END - 3); - AdvSet38C0800EEPConfig(iop_base, &eep_config); + AdvSet3550EEPConfig(iop_base, &eep_config); } /* - * Set ADV_DVC_VAR and ADV_DVC_CFG variables from the + * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the * EEPROM configuration that was read. * * This is the mapping of EEPROM fields to Adv Library fields. */ asc_dvc->wdtr_able = eep_config.wdtr_able; - asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; - asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; - asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; - asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; + asc_dvc->sdtr_able = eep_config.sdtr_able; + asc_dvc->ultra_able = eep_config.ultra_able; asc_dvc->tagqng_able = eep_config.tagqng_able; asc_dvc->cfg->disc_enable = eep_config.disc_enable; asc_dvc->max_host_qng = eep_config.max_host_qng; @@ -16895,33 +16979,6 @@ asc_dvc->cfg->serial3 = eep_config.serial_number_word3; /* - * For every Target ID if any of its 'sdtr_speed[1234]' bits - * are set, then set an 'sdtr_able' bit for it. - */ - asc_dvc->sdtr_able = 0; - for (tid = 0; tid <= ADV_MAX_TID; tid++) - { - if (tid == 0) - { - sdtr_speed = asc_dvc->sdtr_speed1; - } else if (tid == 4) - { - sdtr_speed = asc_dvc->sdtr_speed2; - } else if (tid == 8) - { - sdtr_speed = asc_dvc->sdtr_speed3; - } else if (tid == 12) - { - sdtr_speed = asc_dvc->sdtr_speed4; - } - if (sdtr_speed & ADV_MAX_TID) - { - asc_dvc->sdtr_able |= (1 << tid); - } - sdtr_speed >>= 4; - } - - /* * Set the host maximum queuing (max. 253, min. 16) and the per device * maximum queuing (max. 63, min. 4). */ @@ -16971,6 +17028,7 @@ asc_dvc->max_host_qng = eep_config.max_host_qng; asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; + /* * If the EEPROM 'termination' field is set to automatic (0), then set * the ADV_DVC_CFG 'termination' field to automatic also. @@ -16979,63 +17037,32 @@ * value check that a legal value is set and set the ADV_DVC_CFG * 'termination' field appropriately. */ - if (eep_config.termination_se == 0) - { - termination = 0; /* auto termination for SE */ - } else - { - /* Enable manual control with low off / high off. */ - if (eep_config.termination_se == 1) - { - termination = 0; - - /* Enable manual control with low off / high on. */ - } else if (eep_config.termination_se == 2) - { - termination = TERM_SE_HI; - - /* Enable manual control with low on / high on. */ - } else if (eep_config.termination_se == 3) - { - termination = TERM_SE; - } else - { - /* - * The EEPROM 'termination_se' field contains a bad value. - * Use automatic termination instead. - */ - termination = 0; - warn_code |= ASC_WARN_EEPROM_TERMINATION; - } - } - - if (eep_config.termination_lvd == 0) + if (eep_config.termination == 0) { - asc_dvc->cfg->termination = termination; /* auto termination for LVD */ + asc_dvc->cfg->termination = 0; /* auto termination */ } else { /* Enable manual control with low off / high off. */ - if (eep_config.termination_lvd == 1) + if (eep_config.termination == 1) { - asc_dvc->cfg->termination = termination; + asc_dvc->cfg->termination = TERM_CTL_SEL; /* Enable manual control with low off / high on. */ - } else if (eep_config.termination_lvd == 2) + } else if (eep_config.termination == 2) { - asc_dvc->cfg->termination = termination | TERM_LVD_HI; + asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H; /* Enable manual control with low on / high on. */ - } else if (eep_config.termination_lvd == 3) + } else if (eep_config.termination == 3) { - asc_dvc->cfg->termination = - termination | TERM_LVD; + asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H | TERM_CTL_L; } else { /* - * The EEPROM 'termination_lvd' field contains a bad value. - * Use automatic termination instead. + * The EEPROM 'termination' field contains a bad value. Use + * automatic termination instead. */ - asc_dvc->cfg->termination = termination; + asc_dvc->cfg->termination = 0; warn_code |= ASC_WARN_EEPROM_TERMINATION; } } @@ -17057,13 +17084,15 @@ */ ASC_INITFUNC( STATIC int, -AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) +AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) ) { - AdvPortAddr iop_base; - ushort warn_code; - ADVEEP_3550_CONFIG eep_config; - int i; + AdvPortAddr iop_base; + ushort warn_code; + ADVEEP_38C0800_CONFIG eep_config; + int i; + uchar tid, termination; + ushort sdtr_speed = 0; iop_base = asc_dvc->iop_base; @@ -17073,18 +17102,20 @@ * Read the board's EEPROM configuration. * * Set default values if a bad checksum is found. + * + * XXX - Don't handle big-endian access to EEPROM yet. */ - if (AdvGet3550EEPConfig(iop_base, &eep_config) != eep_config.check_sum) + if (AdvGet38C0800EEPConfig(iop_base, &eep_config) != eep_config.check_sum) { warn_code |= ASC_WARN_EEPROM_CHKSUM; /* * Set EEPROM default values. */ - for (i = 0; i < sizeof(ADVEEP_3550_CONFIG); i++) + for (i = 0; i < sizeof(ADVEEP_38C0800_CONFIG); i++) { *((uchar *) &eep_config + i) = - *((uchar *) &Default_3550_EEPROM_Config + i); + *((uchar *) &Default_38C0800_EEPROM_Config + i); } /* @@ -17101,17 +17132,19 @@ eep_config.serial_number_word1 = AdvReadEEPWord(iop_base, ASC_EEP_DVC_CFG_END - 3); - AdvSet3550EEPConfig(iop_base, &eep_config); + AdvSet38C0800EEPConfig(iop_base, &eep_config); } /* - * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the + * Set ADV_DVC_VAR and ADV_DVC_CFG variables from the * EEPROM configuration that was read. * * This is the mapping of EEPROM fields to Adv Library fields. */ asc_dvc->wdtr_able = eep_config.wdtr_able; - asc_dvc->sdtr_able = eep_config.sdtr_able; - asc_dvc->ultra_able = eep_config.ultra_able; + asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; + asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; + asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; + asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; asc_dvc->tagqng_able = eep_config.tagqng_able; asc_dvc->cfg->disc_enable = eep_config.disc_enable; asc_dvc->max_host_qng = eep_config.max_host_qng; @@ -17126,6 +17159,33 @@ asc_dvc->cfg->serial3 = eep_config.serial_number_word3; /* + * For every Target ID if any of its 'sdtr_speed[1234]' bits + * are set, then set an 'sdtr_able' bit for it. + */ + asc_dvc->sdtr_able = 0; + for (tid = 0; tid <= ADV_MAX_TID; tid++) + { + if (tid == 0) + { + sdtr_speed = asc_dvc->sdtr_speed1; + } else if (tid == 4) + { + sdtr_speed = asc_dvc->sdtr_speed2; + } else if (tid == 8) + { + sdtr_speed = asc_dvc->sdtr_speed3; + } else if (tid == 12) + { + sdtr_speed = asc_dvc->sdtr_speed4; + } + if (sdtr_speed & ADV_MAX_TID) + { + asc_dvc->sdtr_able |= (1 << tid); + } + sdtr_speed >>= 4; + } + + /* * Set the host maximum queuing (max. 253, min. 16) and the per device * maximum queuing (max. 63, min. 4). */ @@ -17175,7 +17235,6 @@ asc_dvc->max_host_qng = eep_config.max_host_qng; asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; - /* * If the EEPROM 'termination' field is set to automatic (0), then set * the ADV_DVC_CFG 'termination' field to automatic also. @@ -17184,32 +17243,63 @@ * value check that a legal value is set and set the ADV_DVC_CFG * 'termination' field appropriately. */ - if (eep_config.termination == 0) + if (eep_config.termination_se == 0) { - asc_dvc->cfg->termination = 0; /* auto termination */ + termination = 0; /* auto termination for SE */ } else { /* Enable manual control with low off / high off. */ - if (eep_config.termination == 1) + if (eep_config.termination_se == 1) { - asc_dvc->cfg->termination = TERM_CTL_SEL; + termination = 0; /* Enable manual control with low off / high on. */ - } else if (eep_config.termination == 2) + } else if (eep_config.termination_se == 2) { - asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H; + termination = TERM_SE_HI; /* Enable manual control with low on / high on. */ - } else if (eep_config.termination == 3) + } else if (eep_config.termination_se == 3) { - asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H | TERM_CTL_L; + termination = TERM_SE; } else { /* - * The EEPROM 'termination' field contains a bad value. Use - * automatic termination instead. + * The EEPROM 'termination_se' field contains a bad value. + * Use automatic termination instead. */ - asc_dvc->cfg->termination = 0; + termination = 0; + warn_code |= ASC_WARN_EEPROM_TERMINATION; + } + } + + if (eep_config.termination_lvd == 0) + { + asc_dvc->cfg->termination = termination; /* auto termination for LVD */ + } else + { + /* Enable manual control with low off / high off. */ + if (eep_config.termination_lvd == 1) + { + asc_dvc->cfg->termination = termination; + + /* Enable manual control with low off / high on. */ + } else if (eep_config.termination_lvd == 2) + { + asc_dvc->cfg->termination = termination | TERM_LVD_HI; + + /* Enable manual control with low on / high on. */ + } else if (eep_config.termination_lvd == 3) + { + asc_dvc->cfg->termination = + termination | TERM_LVD; + } else + { + /* + * The EEPROM 'termination_lvd' field contains a bad value. + * Use automatic termination instead. + */ + asc_dvc->cfg->termination = termination; warn_code |= ASC_WARN_EEPROM_TERMINATION; } } @@ -17224,8 +17314,7 @@ */ ASC_INITFUNC( STATIC ushort, -AdvGet38C0800EEPConfig(AdvPortAddr iop_base, - ADVEEP_38C0800_CONFIG *cfg_buf) +AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) ) { ushort wval, chksum; @@ -17254,7 +17343,6 @@ return chksum; } - /* * Read EEPROM configuration into the specified buffer. * @@ -17262,7 +17350,8 @@ */ ASC_INITFUNC( STATIC ushort, -AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) +AdvGet38C0800EEPConfig(AdvPortAddr iop_base, + ADVEEP_38C0800_CONFIG *cfg_buf) ) { ushort wval, chksum; @@ -17291,6 +17380,7 @@ return chksum; } + /* * Read the EEPROM from specified location */ @@ -17325,7 +17415,7 @@ } if ((AdvReadWordRegister(iop_base, IOPW_EE_CMD) & ASC_EEP_CMD_DONE) == 0) { - ADV_ASSERT(0); + ASC_ASSERT(0); } return; } @@ -17444,6 +17534,10 @@ * If 'done_status' is not set to QD_DO_RETRY, then 'error_retry' will be * set to SCSI_MAX_RETRY. * + * Multi-byte fields in the ASC_SCSI_REQ_Q that are used by the microcode + * for DMA addresses or math operations are byte swapped to little-endian + * order. + * * Return: * ADV_SUCCESS(1) - The request was successfully queued. * ADV_BUSY(0) - Resource unavailable; Retry again after pending @@ -17457,11 +17551,11 @@ { int last_int_level; AdvPortAddr iop_base; - long req_size; - ulong req_paddr; + ADV_DCNT req_size; + ADV_PADDR req_paddr; ADV_CARR_T *new_carrp; - ADV_ASSERT(scsiq != NULL); /* 'scsiq' should never be NULL. */ + ASC_ASSERT(scsiq != NULL); /* 'scsiq' should never be NULL. */ /* * The ADV_SCSI_REQ_Q 'target_id' field should never exceed ADV_MAX_TID. @@ -17485,7 +17579,8 @@ { return ADV_BUSY; } - asc_dvc->carr_freelist = (ADV_CARR_T *) new_carrp->next_vpa; + asc_dvc->carr_freelist = + (ADV_CARR_T *) ADV_U32_TO_VADDR(new_carrp->next_vpa); asc_dvc->carr_pending_cnt++; /* @@ -17501,18 +17596,21 @@ scsiq->a_flag &= ~ADV_SCSIQ_DONE; req_size = sizeof(ADV_SCSI_REQ_Q); - req_paddr = DvcGetPhyAddr(asc_dvc, scsiq, (uchar *) scsiq, - (long *) &req_size, ADV_IS_SCSIQ_FLAG); + req_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, scsiq, (uchar *) scsiq, + (ADV_SDCNT *) &req_size, ADV_IS_SCSIQ_FLAG)); - ADV_ASSERT(ADV_DWALIGN(req_paddr) == req_paddr); - ADV_ASSERT(req_size >= sizeof(ADV_SCSI_REQ_Q)); + ASC_ASSERT(ADV_DWALIGN(req_paddr) == req_paddr); + ASC_ASSERT(req_size >= sizeof(ADV_SCSI_REQ_Q)); - /* Save virtual and physical address of ADV_SCSI_REQ_Q and Carrier. */ - scsiq->scsiq_ptr = (ADV_SCSI_REQ_Q *) scsiq; + /* Save virtual and physical address of ADV_SCSI_REQ_Q and carrier. */ + scsiq->scsiq_ptr = ADV_VADDR_TO_U32(scsiq); scsiq->scsiq_rptr = req_paddr; - /* XXX - Could have the RISC set these values. */ - scsiq->carr_va = (ulong) asc_dvc->icq_sp; + scsiq->carr_va = ADV_VADDR_TO_U32(asc_dvc->icq_sp); + /* + * Every ADV_CARR_T.carr_pa is byte swapped to little-endian + * order during initialization. + */ scsiq->carr_pa = asc_dvc->icq_sp->carr_pa; /* @@ -17520,7 +17618,7 @@ * the microcode. The newly allocated stopper will become the new * stopper. */ - asc_dvc->icq_sp->areq_vpa = (ulong) req_paddr; + asc_dvc->icq_sp->areq_vpa = req_paddr; /* * Set the 'next_vpa' pointer for the old stopper to be the @@ -17595,7 +17693,7 @@ return status; } - DvcSleepMilliSecond((ulong) asc_dvc->scsi_reset_wait * 1000); + DvcSleepMilliSecond((ADV_DCNT) asc_dvc->scsi_reset_wait * 1000); return status; } @@ -17715,7 +17813,7 @@ uchar int_stat; ushort target_bit; ADV_CARR_T *free_carrp; - ulong irq_next_vpa; + ADV_VADDR irq_next_vpa; int flags; ADV_SCSI_REQ_Q *scsiq; @@ -17766,8 +17864,13 @@ /* * Get a pointer to the newly completed ADV_SCSI_REQ_Q structure. * The RISC will have set 'areq_vpa' to a virtual address. + * + * The firmware will have copied the ASC_SCSI_REQ_Q.scsiq_ptr + * field to the carrier ADV_CARR_T.areq_vpa field. The conversion + * below complements the conversion of ASC_SCSI_REQ_Q.scsiq_ptr' + * in AdvExeScsiQueue(). */ - scsiq = (ADV_SCSI_REQ_Q *) asc_dvc->irq_sp->areq_vpa; + scsiq = (ADV_SCSI_REQ_Q *) ADV_U32_TO_VADDR(asc_dvc->irq_sp->areq_vpa); /* * Advance the stopper pointer to the next carrier @@ -17775,14 +17878,14 @@ * stopper carrier. */ free_carrp = asc_dvc->irq_sp; - asc_dvc->irq_sp = ASC_GET_CARRP(irq_next_vpa); + asc_dvc->irq_sp = (ADV_CARR_T *) + ADV_U32_TO_VADDR(ASC_GET_CARRP(irq_next_vpa)); - free_carrp->next_vpa = (ulong) asc_dvc->carr_freelist; - asc_dvc->carr_freelist = (ADV_CARR_T *) free_carrp; + free_carrp->next_vpa = ADV_VADDR_TO_U32(asc_dvc->carr_freelist); + asc_dvc->carr_freelist = free_carrp; asc_dvc->carr_pending_cnt--; - - ADV_ASSERT(scsiq != NULL); + ASC_ASSERT(scsiq != NULL); target_bit = ADV_TID_TO_TIDMASK(scsiq->target_id); /* @@ -17790,22 +17893,23 @@ */ scsiq->cntl = 0; +#if __BIG_ENDIAN /* - * Check Condition handling + * After the request completes the only field in the ASC_SCSI_REQ_Q + * structure needs to be byte swapped from little endian order to + * big endian order is the residual data count. */ - if ((scsiq->done_status == QD_WITH_ERROR) && - (scsiq->scsi_status == SS_CHK_CONDITION) - ) - { - } + scsiqp->data_cnt = le32_to_cpu(scsiqp->data_cnt); +#endif /* __BIG_ENDIAN */ + /* * If the command that completed was a SCSI INQUIRY and * LUN 0 was sent the command, then process the INQUIRY * command information for the device. */ - else if (scsiq->done_status == QD_NO_ERROR && - scsiq->cdb[0] == SCSICMD_Inquiry && - scsiq->target_lun == 0) + if (scsiq->done_status == QD_NO_ERROR && + scsiq->cdb[0] == SCSICMD_Inquiry && + scsiq->target_lun == 0) { AdvInquiryHandling(asc_dvc, scsiq); } @@ -17855,11 +17959,11 @@ STATIC int AdvSendIdleCmd(ADV_DVC_VAR *asc_dvc, ushort idle_cmd, - ulong idle_cmd_parameter) + ADV_DCNT idle_cmd_parameter) { int last_int_level; int result; - ulong i, j; + ADV_DCNT i, j; AdvPortAddr iop_base; last_int_level = DvcEnterCritical(); @@ -17914,7 +18018,7 @@ } } - ADV_ASSERT(0); /* The idle command should never timeout. */ + ASC_ASSERT(0); /* The idle command should never timeout. */ DvcLeaveCritical(last_int_level); return ADV_ERROR; } diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/aha152x.c linux/drivers/scsi/aha152x.c --- v2.3.28/linux/drivers/scsi/aha152x.c Thu Nov 11 20:11:44 1999 +++ linux/drivers/scsi/aha152x.c Thu Nov 18 19:25:28 1999 @@ -952,7 +952,7 @@ ok = 0; for (i = 0; i < ADDRESS_COUNT && !ok; i++) for (j = 0; (j < SIGNATURE_COUNT) && !ok; j++) - ok = check_signature(addresses[i] + signatures[j].sig_offset, + ok = isa_check_signature(addresses[i] + signatures[j].sig_offset, signatures[j].signature, signatures[j].sig_length); if (!ok && setup_count == 0) diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/aic7xxx/aic7xxx.seq linux/drivers/scsi/aic7xxx/aic7xxx.seq --- v2.3.28/linux/drivers/scsi/aic7xxx/aic7xxx.seq Wed Jun 9 16:59:15 1999 +++ linux/drivers/scsi/aic7xxx/aic7xxx.seq Thu Nov 18 21:13:47 1999 @@ -446,7 +446,8 @@ data_phase_reinit: if ((p->features & AHC_CMD_CHAN) != 0) { if ((p->features & AHC_ULTRA2) != 0) { - bmov HCNT, SCB_RESID_DCNT, 3; + bmov HADDR, SHADDR, 4; + bmov HCNT, SCB_RESID_DCNT, 3; } bmov STCNT, SCB_RESID_DCNT, 3; } else { @@ -658,11 +659,25 @@ test DFCNTRL, DIRECTION jnz ultra2_dmahalt; and DFCNTRL, ~SCSIEN; test DFCNTRL, SCSIEN jnz .; +ultra2_dmafifoflush: or DFCNTRL, FIFOFLUSH; test DFSTATUS, FIFOEMP jz . - 1; + /* + * hardware bug alert! This needless set of jumps is to + * protect against a FIFOEMP status bit glitch in the + * silicon. + */ + test DFSTATUS, FIFOEMP jz ultra2_dmafifoflush; + test DFSTATUS, FIFOEMP jz ultra2_dmafifoflush; + test DFSTATUS, FIFOEMP jz ultra2_dmafifoflush; + test DFSTATUS, FIFOEMP jz ultra2_dmafifoflush; + test DFSTATUS, FIFOEMP jz ultra2_dmafifoflush; + test DFSTATUS, MREQPEND jnz .; ultra2_dmahalt: - and DFCNTRL, ~(SCSIEN|HDMAEN); + and DFCNTRL, ~HDMAEN; test DFCNTRL, HDMAEN jnz .; + and DFCNTRL, ~SCSIEN; + test DFCNTRL, SCSIEN jnz .; bmov SCB_RESID_DCNT, STCNT, 3; mov SCB_RESID_SGCNT, SG_COUNT; or SXFRCTL0, CLRSTCNT|CLRCHN; @@ -701,8 +716,10 @@ test SSTAT0, DMADONE jnz p_command_ultra2_dma_done; test SSTAT1,PHASEMIS jz p_command_dma_loop; /* ie. underrun */ p_command_ultra2_dma_done: - and DFCNTRL, ~(SCSIEN|HDMAEN); + and DFCNTRL, ~HDMAEN; test DFCNTRL, HDMAEN jnz .; + and DFCNTRL, ~SCSIEN; + test DFCNTRL, SCSIEN jnz .; or SXFRCTL0, CLRSTCNT|CLRCHN; } jmp ITloop; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c --- v2.3.28/linux/drivers/scsi/aic7xxx.c Thu Nov 11 20:11:44 1999 +++ linux/drivers/scsi/aic7xxx.c Fri Nov 19 21:15:06 1999 @@ -263,7 +263,7 @@ */ #define VIRT_TO_BUS(a) (unsigned int)virt_to_bus((void *)(a)) -#define AIC7XXX_C_VERSION "5.1.20" +#define AIC7XXX_C_VERSION "5.1.21" #define NUMBER(arr) (sizeof(arr) / sizeof(arr[0])) #define MIN(a,b) (((a) < (b)) ? (a) : (b)) @@ -280,10 +280,6 @@ # define FALSE 0 #endif -#ifndef KERNEL_VERSION -# define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z)) -#endif - /* * We need the bios32.h file if we are kernel version 2.1.92 or less. The * full set of pci_* changes wasn't in place until 2.1.93 @@ -1355,6 +1351,18 @@ */ static int aic7xxx_scbram = 0; /* + * So that we can set how long each device is given as a selection timeout. + * The table of values goes like this: + * 0 - 256ms + * 1 - 128ms + * 2 - 64ms + * 3 - 32ms + * We default to 64ms because it's fast. Some old SCSI-I devices need a + * longer time. The final value has to be left shifted by 3, hence 0x10 + * is the final value. + */ +static int aic7xxx_seltime = 0x10; +/* * So that insmod can find the variable and make it point to something */ #ifdef MODULE @@ -1515,6 +1523,7 @@ { "dump_card", &aic7xxx_dump_card }, { "dump_sequencer", &aic7xxx_dump_sequencer }, { "scbram", &aic7xxx_scbram }, + { "seltime", &aic7xxx_seltime }, { "tag_info", NULL } }; @@ -1608,6 +1617,10 @@ else if (p[n] == ':') { *(options[i].flag) = simple_strtoul(p + n + 1, NULL, 0); + if(!strncmp(p, "seltime", n)) + { + *(options[i].flag) = (*(options[i].flag) % 4) << 3; + } } else if (!strncmp(p, "verbose", n)) { @@ -1616,6 +1629,10 @@ else { *(options[i].flag) = ~(*(options[i].flag)); + if(!strncmp(p, "seltime", n)) + { + *(options[i].flag) = (*(options[i].flag) % 4) << 3; + } } } } @@ -1850,10 +1867,13 @@ } } aic_outb(p, (instr.integer & 0xff), SEQRAM); + udelay(50); aic_outb(p, ((instr.integer >> 8) & 0xff), SEQRAM); + udelay(50); aic_outb(p, ((instr.integer >> 16) & 0xff), SEQRAM); + udelay(50); aic_outb(p, ((instr.integer >> 24) & 0xff), SEQRAM); - udelay(15); + udelay(50); break; default: @@ -7895,7 +7915,7 @@ host->this_id = p->scsi_id; host->io_port = p->base; host->n_io_port = 0xFF; - host->base = (unsigned char *) p->mbase; + host->base = p->mbase; host->irq = p->irq; if (p->features & AHC_WIDE) { @@ -8019,7 +8039,7 @@ { unsigned char devconfig; -#if LINUX_KERNEL_VERSION > KERNEL_VERSION(2,1,92) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) pci_read_config_byte(p->pdev, DEVCONFIG, &devconfig); #else pcibios_read_config_byte(p->pci_bus, p->pci_device_fn, @@ -8037,7 +8057,7 @@ if (aic7xxx_verbose & VERBOSE_PROBE2) printk("(scsi%d) Force clearing STPWLEV bit\n", p->host_no); } -#if LINUX_KERNEL_VERSION > KERNEL_VERSION(2,1,92) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) pci_write_config_byte(p->pdev, DEVCONFIG, devconfig); #else pcibios_write_config_byte(p->pci_bus, p->pci_device_fn, @@ -8117,7 +8137,7 @@ aic_outb(p, p->scsi_id_b, SCSIID); scsi_conf = aic_inb(p, SCSICONF + 1); aic_outb(p, DFON | SPIOEN, SXFRCTL0); - aic_outb(p, (scsi_conf & ENSPCHK) | STIMESEL | term | + aic_outb(p, (scsi_conf & ENSPCHK) | aic7xxx_seltime | term | ENSTIMER | ACTNEGEN, SXFRCTL1); aic_outb(p, 0, SIMODE0); aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1); @@ -8141,7 +8161,7 @@ term = ((p->flags & (AHC_TERM_ENB_A|AHC_TERM_ENB_LVD)) ? STPWEN : 0); scsi_conf = aic_inb(p, SCSICONF); aic_outb(p, DFON | SPIOEN, SXFRCTL0); - aic_outb(p, (scsi_conf & ENSPCHK) | STIMESEL | term | + aic_outb(p, (scsi_conf & ENSPCHK) | aic7xxx_seltime | term | ENSTIMER | ACTNEGEN, SXFRCTL1); aic_outb(p, 0, SIMODE0); aic_outb(p, ENSELTIMO | ENSCSIRST | ENSCSIPERR, SIMODE1); @@ -9656,7 +9676,7 @@ devconfig |= 0x80000040; pcibios_write_config_dword(pci_bus, pci_devfn, DEVCONFIG, devconfig); #endif /* AIC7XXX_STRICT_PCI_SETUP */ -#endif /* LINUIX_VERSION_CODE > KERNEL_VERSION(2,1,92) */ +#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) */ temp_p->unpause = INTEN; temp_p->pause = temp_p->unpause | PAUSE; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/aic7xxx_proc.c linux/drivers/scsi/aic7xxx_proc.c --- v2.3.28/linux/drivers/scsi/aic7xxx_proc.c Wed Jun 30 11:24:54 1999 +++ linux/drivers/scsi/aic7xxx_proc.c Thu Nov 18 21:13:47 1999 @@ -224,6 +224,11 @@ { size += sprintf(BLS, " BIOS Memory Address: 0x%08x\n", p->bios_address); } + if( p->chip & AHC_PCI ) + { + size += sprintf(BLS, " PCI Bus 0x%02x Device 0x%02x\n", p->pci_bus, + p->pci_device_fn); + } size += sprintf(BLS, " Adapter SEEPROM Config: %s\n", (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : @@ -373,11 +378,9 @@ } else { - *start = &aic7xxx_buffer[offset]; /* Start of wanted data */ - if (size - offset < length) - { - length = size - offset; - } + *start = buffer; + length = MIN(length, size - offset); + memcpy(buffer, &aic7xxx_buffer[offset], length); } return (length); diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/aic7xxx_seq.c linux/drivers/scsi/aic7xxx_seq.c --- v2.3.28/linux/drivers/scsi/aic7xxx_seq.c Wed Jun 9 16:59:16 1999 +++ linux/drivers/scsi/aic7xxx_seq.c Thu Nov 18 21:13:47 1999 @@ -26,12 +26,12 @@ 0x00, 0x4d, 0x12, 0x70, 0x01, 0x4e, 0x9c, 0x18, 0xbf, 0x60, 0xc0, 0x08, - 0x00, 0x6a, 0x92, 0x5c, + 0x00, 0x6a, 0xa8, 0x5c, 0xff, 0x4e, 0xc8, 0x18, - 0x02, 0x6a, 0xa8, 0x5b, + 0x02, 0x6a, 0xbe, 0x5b, 0xff, 0x52, 0x20, 0x09, 0x0d, 0x6a, 0x6a, 0x00, - 0x00, 0x52, 0x1e, 0x5c, + 0x00, 0x52, 0x34, 0x5c, 0x03, 0xb0, 0x52, 0x31, 0xff, 0xb0, 0x52, 0x09, 0xff, 0xb1, 0x54, 0x09, @@ -76,7 +76,7 @@ 0x10, 0x03, 0xfc, 0x78, 0xff, 0x50, 0xc8, 0x08, 0x88, 0x6a, 0xcc, 0x00, - 0x49, 0x6a, 0x0e, 0x5c, + 0x49, 0x6a, 0x24, 0x5c, 0x01, 0x6a, 0x26, 0x01, 0xff, 0x6a, 0xca, 0x08, 0x08, 0x01, 0x02, 0x00, @@ -117,11 +117,11 @@ 0xff, 0x65, 0xca, 0x18, 0xff, 0x65, 0xd8, 0x68, 0x0a, 0x93, 0x26, 0x01, - 0x00, 0x65, 0x84, 0x5c, + 0x00, 0x65, 0x9a, 0x5c, 0x40, 0x51, 0xf0, 0x78, 0xe4, 0x6a, 0x06, 0x00, 0x08, 0x01, 0x02, 0x00, - 0x04, 0x6a, 0x40, 0x5b, + 0x04, 0x6a, 0x56, 0x5b, 0x01, 0x50, 0xa0, 0x18, 0x00, 0x50, 0xf6, 0xe0, 0xff, 0x6a, 0xa0, 0x08, @@ -147,13 +147,13 @@ 0x08, 0x6a, 0x66, 0x58, 0x80, 0x6a, 0x68, 0x00, 0x80, 0x36, 0x6c, 0x00, - 0x00, 0x65, 0xf2, 0x5b, + 0x00, 0x65, 0x08, 0x5c, 0xff, 0x3d, 0xc8, 0x08, - 0xbf, 0x64, 0x58, 0x79, - 0x80, 0x64, 0x0e, 0x72, - 0xa0, 0x64, 0x3a, 0x72, - 0xc0, 0x64, 0x32, 0x72, - 0xe0, 0x64, 0x7a, 0x72, + 0xbf, 0x64, 0x5a, 0x79, + 0x80, 0x64, 0x20, 0x72, + 0xa0, 0x64, 0x50, 0x72, + 0xc0, 0x64, 0x48, 0x72, + 0xe0, 0x64, 0x90, 0x72, 0x01, 0x6a, 0x22, 0x01, 0x00, 0x65, 0x22, 0x41, 0xf7, 0x11, 0x22, 0x08, @@ -169,16 +169,17 @@ 0xdf, 0x01, 0x02, 0x08, 0x01, 0x6a, 0x7a, 0x00, 0xff, 0x6a, 0x6c, 0x0c, + 0x04, 0x14, 0x10, 0x31, 0x03, 0xa9, 0x18, 0x31, 0x03, 0xa9, 0x10, 0x30, 0x08, 0x6a, 0xcc, 0x00, - 0xa9, 0x6a, 0x08, 0x5c, - 0x00, 0x65, 0x78, 0x41, + 0xa9, 0x6a, 0x1e, 0x5c, + 0x00, 0x65, 0x7a, 0x41, 0xa8, 0x6a, 0x6a, 0x00, 0x79, 0x6a, 0x6a, 0x00, - 0x40, 0x3d, 0x60, 0x69, + 0x40, 0x3d, 0x62, 0x69, 0x04, 0x35, 0x6a, 0x00, - 0x00, 0x65, 0x62, 0x5b, + 0x00, 0x65, 0x78, 0x5b, 0x80, 0x6a, 0xd4, 0x01, 0x10, 0x36, 0x4e, 0x69, 0x10, 0x36, 0x6c, 0x00, @@ -186,11 +187,11 @@ 0x03, 0x8c, 0x10, 0x30, 0x05, 0xa3, 0x70, 0x30, 0x88, 0x6a, 0xcc, 0x00, - 0xac, 0x6a, 0x00, 0x5c, - 0x00, 0x65, 0xfa, 0x5b, + 0xac, 0x6a, 0x16, 0x5c, + 0x00, 0x65, 0x10, 0x5c, 0x38, 0x6a, 0xcc, 0x00, - 0xa3, 0x6a, 0x04, 0x5c, - 0xff, 0x38, 0x88, 0x69, + 0xa3, 0x6a, 0x1a, 0x5c, + 0xff, 0x38, 0x8a, 0x69, 0x80, 0x02, 0x04, 0x00, 0xe7, 0x35, 0x6a, 0x08, 0x03, 0x69, 0x18, 0x31, @@ -198,51 +199,51 @@ 0xff, 0x6a, 0x10, 0x00, 0xff, 0x6a, 0x12, 0x00, 0xff, 0x6a, 0x14, 0x00, - 0x01, 0x38, 0x8c, 0x61, + 0x01, 0x38, 0x8e, 0x61, 0xbf, 0x35, 0x6a, 0x08, 0xff, 0x69, 0xca, 0x08, 0xff, 0x35, 0x26, 0x09, - 0x04, 0x0b, 0x90, 0x69, + 0x04, 0x0b, 0x92, 0x69, + 0x04, 0x0b, 0x9e, 0x69, + 0x10, 0x0c, 0x94, 0x79, 0x04, 0x0b, 0x9c, 0x69, - 0x10, 0x0c, 0x92, 0x79, - 0x04, 0x0b, 0x9a, 0x69, 0xff, 0x6a, 0xca, 0x08, - 0x00, 0x35, 0x4a, 0x5b, - 0x80, 0x02, 0xf0, 0x69, - 0xff, 0x65, 0xe0, 0x79, + 0x00, 0x35, 0x60, 0x5b, + 0x80, 0x02, 0xf2, 0x69, + 0xff, 0x65, 0xe2, 0x79, 0xff, 0x38, 0x70, 0x18, - 0xff, 0x38, 0xe0, 0x79, - 0x80, 0xea, 0xbc, 0x61, + 0xff, 0x38, 0xe2, 0x79, + 0x80, 0xea, 0xbe, 0x61, 0xef, 0x38, 0xc8, 0x18, 0x80, 0x6a, 0xc8, 0x00, - 0x00, 0x65, 0xae, 0x49, + 0x00, 0x65, 0xb0, 0x49, 0x33, 0x38, 0xc8, 0x28, 0xff, 0x64, 0xd0, 0x09, 0x04, 0x39, 0xc0, 0x31, 0x09, 0x6a, 0xd6, 0x01, - 0x80, 0xeb, 0xb4, 0x79, + 0x80, 0xeb, 0xb6, 0x79, 0xf7, 0xeb, 0xd6, 0x09, - 0x08, 0xeb, 0xb8, 0x69, + 0x08, 0xeb, 0xba, 0x69, 0x01, 0x6a, 0xd6, 0x01, 0x08, 0xe9, 0x10, 0x31, 0x03, 0x8c, 0x10, 0x30, 0x88, 0x6a, 0xcc, 0x00, - 0x39, 0x6a, 0x06, 0x5c, + 0x39, 0x6a, 0x1c, 0x5c, 0x08, 0x6a, 0x18, 0x01, 0xff, 0x6a, 0x1a, 0x09, 0xff, 0x6a, 0x1c, 0x09, 0x0d, 0x93, 0x26, 0x01, - 0x00, 0x65, 0x84, 0x5c, - 0x88, 0x6a, 0x74, 0x5c, - 0x00, 0x65, 0xfa, 0x5b, + 0x00, 0x65, 0x9a, 0x5c, + 0x88, 0x6a, 0x8a, 0x5c, + 0x00, 0x65, 0x10, 0x5c, 0xff, 0x6a, 0xc8, 0x08, 0x08, 0x39, 0x72, 0x18, 0x00, 0x3a, 0x74, 0x20, - 0x01, 0x0c, 0xd8, 0x79, - 0x10, 0x0c, 0x78, 0x79, + 0x01, 0x0c, 0xda, 0x79, + 0x10, 0x0c, 0x7a, 0x79, 0xff, 0x35, 0x26, 0x09, - 0x04, 0x0b, 0xde, 0x69, - 0x00, 0x65, 0xf8, 0x59, + 0x04, 0x0b, 0xe0, 0x69, + 0x00, 0x65, 0xfa, 0x59, 0x03, 0x08, 0x52, 0x31, 0xff, 0x38, 0x50, 0x09, 0xff, 0x08, 0x52, 0x09, @@ -250,265 +251,275 @@ 0xff, 0x0a, 0x56, 0x09, 0xff, 0x38, 0x50, 0x09, 0x00, 0x65, 0x22, 0x41, - 0x00, 0x65, 0xf8, 0x59, + 0x00, 0x65, 0xfa, 0x59, 0x7f, 0x02, 0x04, 0x08, 0xe1, 0x6a, 0x22, 0x01, 0x00, 0x65, 0x22, 0x41, - 0x04, 0x93, 0x02, 0x6a, + 0x04, 0x93, 0x10, 0x6a, 0xdf, 0x93, 0x26, 0x09, - 0x20, 0x93, 0xfc, 0x69, + 0x20, 0x93, 0xfe, 0x69, 0x02, 0x93, 0x26, 0x01, - 0x01, 0x94, 0xfe, 0x79, - 0xd7, 0x93, 0x26, 0x09, - 0x08, 0x93, 0x04, 0x6a, + 0x01, 0x94, 0x00, 0x7a, + 0x01, 0x94, 0x00, 0x7a, + 0x01, 0x94, 0x00, 0x7a, + 0x01, 0x94, 0x00, 0x7a, + 0x01, 0x94, 0x00, 0x7a, + 0x01, 0x94, 0x00, 0x7a, + 0x10, 0x94, 0x0e, 0x6a, + 0xf7, 0x93, 0x26, 0x09, + 0x08, 0x93, 0x12, 0x6a, + 0xdf, 0x93, 0x26, 0x09, + 0x20, 0x93, 0x16, 0x6a, 0x03, 0x08, 0x52, 0x31, 0xff, 0x38, 0x50, 0x09, 0x12, 0x01, 0x02, 0x00, 0xff, 0x6a, 0xd4, 0x0c, - 0x00, 0x65, 0x62, 0x5b, + 0x00, 0x65, 0x78, 0x5b, 0x05, 0xb4, 0x10, 0x31, 0x02, 0x6a, 0x1a, 0x31, 0x03, 0x8c, 0x10, 0x30, 0x88, 0x6a, 0xcc, 0x00, - 0xb4, 0x6a, 0x04, 0x5c, + 0xb4, 0x6a, 0x1a, 0x5c, 0xff, 0x6a, 0x1a, 0x09, 0xff, 0x6a, 0x1c, 0x09, - 0x00, 0x65, 0xfa, 0x5b, - 0x3d, 0x6a, 0x4a, 0x5b, + 0x00, 0x65, 0x10, 0x5c, + 0x3d, 0x6a, 0x60, 0x5b, 0xac, 0x6a, 0x26, 0x01, - 0x04, 0x0b, 0x24, 0x6a, - 0x01, 0x0b, 0x2a, 0x6a, - 0x10, 0x0c, 0x26, 0x7a, - 0xd7, 0x93, 0x26, 0x09, - 0x08, 0x93, 0x2c, 0x6a, + 0x04, 0x0b, 0x36, 0x6a, + 0x01, 0x0b, 0x3c, 0x6a, + 0x10, 0x0c, 0x38, 0x7a, + 0xf7, 0x93, 0x26, 0x09, + 0x08, 0x93, 0x3e, 0x6a, + 0xdf, 0x93, 0x26, 0x09, + 0x20, 0x93, 0x42, 0x6a, 0x12, 0x01, 0x02, 0x00, 0x00, 0x65, 0x22, 0x41, - 0x00, 0x65, 0x62, 0x5b, + 0x00, 0x65, 0x78, 0x5b, 0xff, 0x06, 0x44, 0x09, 0x00, 0x65, 0x22, 0x41, 0x10, 0x3d, 0x06, 0x00, 0xff, 0x34, 0xca, 0x08, - 0x80, 0x65, 0x5e, 0x62, + 0x80, 0x65, 0x74, 0x62, 0x0f, 0xa1, 0xca, 0x08, 0x07, 0xa1, 0xca, 0x08, 0x40, 0xa0, 0xc8, 0x08, 0x00, 0x65, 0xca, 0x00, 0x80, 0x65, 0xca, 0x00, - 0x80, 0xa0, 0x4e, 0x7a, + 0x80, 0xa0, 0x64, 0x7a, 0xff, 0x65, 0x0c, 0x08, - 0x00, 0x65, 0x60, 0x42, - 0x20, 0xa0, 0x66, 0x7a, + 0x00, 0x65, 0x76, 0x42, + 0x20, 0xa0, 0x7c, 0x7a, 0xff, 0x65, 0x0c, 0x08, - 0x00, 0x65, 0xf2, 0x5b, - 0xa0, 0x3d, 0x6e, 0x62, + 0x00, 0x65, 0x08, 0x5c, + 0xa0, 0x3d, 0x84, 0x62, 0x23, 0xa0, 0x0c, 0x08, - 0x00, 0x65, 0xf2, 0x5b, - 0xa0, 0x3d, 0x6e, 0x62, - 0x00, 0xb9, 0x66, 0x42, - 0xff, 0x65, 0x66, 0x62, + 0x00, 0x65, 0x08, 0x5c, + 0xa0, 0x3d, 0x84, 0x62, + 0x00, 0xb9, 0x7c, 0x42, + 0xff, 0x65, 0x7c, 0x62, 0xa1, 0x6a, 0x22, 0x01, 0xff, 0x6a, 0xd4, 0x08, - 0x10, 0x51, 0x6e, 0x72, + 0x10, 0x51, 0x84, 0x72, 0x40, 0x6a, 0x18, 0x00, 0xff, 0x65, 0x0c, 0x08, - 0x00, 0x65, 0xf2, 0x5b, - 0xa0, 0x3d, 0x38, 0x72, + 0x00, 0x65, 0x08, 0x5c, + 0xa0, 0x3d, 0x4e, 0x72, 0x40, 0x6a, 0x18, 0x00, 0xff, 0x34, 0xa6, 0x08, - 0x80, 0x34, 0x76, 0x62, + 0x80, 0x34, 0x8c, 0x62, 0x7f, 0xa0, 0x40, 0x09, 0x08, 0x6a, 0x68, 0x00, 0x00, 0x65, 0x22, 0x41, - 0x64, 0x6a, 0x3a, 0x5b, - 0x80, 0x64, 0xea, 0x6a, - 0x04, 0x64, 0xcc, 0x72, - 0x02, 0x64, 0xd2, 0x72, - 0x00, 0x6a, 0x94, 0x72, - 0x03, 0x64, 0xe6, 0x72, - 0x01, 0x64, 0xc8, 0x72, - 0x07, 0x64, 0x28, 0x73, - 0x08, 0x64, 0x90, 0x72, + 0x64, 0x6a, 0x50, 0x5b, + 0x80, 0x64, 0x00, 0x6b, + 0x04, 0x64, 0xe2, 0x72, + 0x02, 0x64, 0xe8, 0x72, + 0x00, 0x6a, 0xaa, 0x72, + 0x03, 0x64, 0xfc, 0x72, + 0x01, 0x64, 0xde, 0x72, + 0x07, 0x64, 0x3e, 0x73, + 0x08, 0x64, 0xa6, 0x72, 0x11, 0x6a, 0x22, 0x01, - 0x07, 0x6a, 0x2c, 0x5b, + 0x07, 0x6a, 0x42, 0x5b, 0xff, 0x06, 0xd4, 0x08, 0x00, 0x65, 0x22, 0x41, - 0xff, 0xa8, 0x98, 0x6a, - 0xff, 0xa2, 0xb0, 0x7a, + 0xff, 0xa8, 0xae, 0x6a, + 0xff, 0xa2, 0xc6, 0x7a, 0x01, 0x6a, 0x6a, 0x00, - 0x00, 0xb9, 0x1e, 0x5c, - 0xff, 0xa2, 0xb0, 0x7a, + 0x00, 0xb9, 0x34, 0x5c, + 0xff, 0xa2, 0xc6, 0x7a, 0x71, 0x6a, 0x22, 0x01, 0xff, 0x6a, 0xd4, 0x08, - 0x40, 0x51, 0xb0, 0x62, + 0x40, 0x51, 0xc6, 0x62, 0x0d, 0x6a, 0x6a, 0x00, - 0x00, 0xb9, 0x1e, 0x5c, + 0x00, 0xb9, 0x34, 0x5c, 0xff, 0x3e, 0x74, 0x09, 0xff, 0x90, 0x7c, 0x08, 0x00, 0x65, 0x50, 0x58, 0x00, 0x65, 0x34, 0x41, - 0x20, 0xa0, 0xb8, 0x6a, + 0x20, 0xa0, 0xce, 0x6a, 0xff, 0x37, 0xc8, 0x08, - 0x00, 0x6a, 0xc8, 0x5b, - 0xff, 0x6a, 0xde, 0x5b, + 0x00, 0x6a, 0xde, 0x5b, + 0xff, 0x6a, 0xf4, 0x5b, 0xff, 0xf8, 0xc8, 0x08, 0xff, 0x4f, 0xc8, 0x08, - 0x01, 0x6a, 0xc8, 0x5b, - 0x00, 0xb9, 0xde, 0x5b, + 0x01, 0x6a, 0xde, 0x5b, + 0x00, 0xb9, 0xf4, 0x5b, 0x01, 0x4f, 0x9e, 0x18, 0x02, 0x6a, 0x22, 0x01, - 0x00, 0x65, 0x8c, 0x5c, + 0x00, 0x65, 0xa2, 0x5c, 0x00, 0x65, 0x34, 0x41, 0x41, 0x6a, 0x22, 0x01, 0x00, 0x65, 0x22, 0x41, 0x04, 0xa0, 0x40, 0x01, - 0x00, 0x65, 0xa4, 0x5c, + 0x00, 0x65, 0xba, 0x5c, 0x00, 0x65, 0x34, 0x41, - 0x10, 0x36, 0x90, 0x7a, + 0x10, 0x36, 0xa6, 0x7a, 0x05, 0x38, 0x46, 0x31, 0x04, 0x14, 0x58, 0x31, 0x03, 0xa9, 0x60, 0x31, 0xa3, 0x6a, 0xcc, 0x00, - 0x38, 0x6a, 0x04, 0x5c, + 0x38, 0x6a, 0x1a, 0x5c, 0xac, 0x6a, 0xcc, 0x00, - 0x14, 0x6a, 0x06, 0x5c, - 0xa9, 0x6a, 0x08, 0x5c, - 0x00, 0x65, 0x90, 0x42, + 0x14, 0x6a, 0x1c, 0x5c, + 0xa9, 0x6a, 0x1e, 0x5c, + 0x00, 0x65, 0xa6, 0x42, 0xef, 0x36, 0x6c, 0x08, - 0x00, 0x65, 0x90, 0x42, + 0x00, 0x65, 0xa6, 0x42, 0x0f, 0x64, 0xc8, 0x08, 0x07, 0x64, 0xc8, 0x08, 0x00, 0x37, 0x6e, 0x00, 0xff, 0x6a, 0xa4, 0x00, - 0x00, 0x65, 0x98, 0x5b, - 0xff, 0x51, 0xfc, 0x72, - 0x20, 0x36, 0x06, 0x7b, - 0x00, 0x90, 0x86, 0x5b, - 0x00, 0x65, 0x08, 0x43, + 0x00, 0x65, 0xae, 0x5b, + 0xff, 0x51, 0x12, 0x73, + 0x20, 0x36, 0x1c, 0x7b, + 0x00, 0x90, 0x9c, 0x5b, + 0x00, 0x65, 0x1e, 0x43, 0xff, 0x06, 0xd4, 0x08, - 0x00, 0x65, 0xf2, 0x5b, - 0xe0, 0x3d, 0x22, 0x63, - 0x20, 0x12, 0x22, 0x63, - 0x51, 0x6a, 0x30, 0x5b, - 0x00, 0x65, 0x80, 0x5b, + 0x00, 0x65, 0x08, 0x5c, + 0xe0, 0x3d, 0x38, 0x63, + 0x20, 0x12, 0x38, 0x63, + 0x51, 0x6a, 0x46, 0x5b, + 0x00, 0x65, 0x96, 0x5b, 0xff, 0x37, 0xc8, 0x08, - 0x00, 0xa1, 0x1a, 0x63, - 0x04, 0xa0, 0x1a, 0x7b, + 0x00, 0xa1, 0x30, 0x63, + 0x04, 0xa0, 0x30, 0x7b, 0xfb, 0xa0, 0x40, 0x09, 0x80, 0x36, 0x6c, 0x00, - 0x80, 0xa0, 0x90, 0x7a, + 0x80, 0xa0, 0xa6, 0x7a, 0x7f, 0xa0, 0x40, 0x09, - 0xff, 0x6a, 0x2c, 0x5b, - 0x00, 0x65, 0x90, 0x42, - 0x04, 0xa0, 0x20, 0x7b, - 0x00, 0x65, 0xa4, 0x5c, - 0x00, 0x65, 0x22, 0x43, - 0x00, 0x65, 0x8c, 0x5c, + 0xff, 0x6a, 0x42, 0x5b, + 0x00, 0x65, 0xa6, 0x42, + 0x04, 0xa0, 0x36, 0x7b, + 0x00, 0x65, 0xba, 0x5c, + 0x00, 0x65, 0x38, 0x43, + 0x00, 0x65, 0xa2, 0x5c, 0x31, 0x6a, 0x22, 0x01, - 0x0c, 0x6a, 0x2c, 0x5b, - 0x00, 0x65, 0x90, 0x42, + 0x0c, 0x6a, 0x42, 0x5b, + 0x00, 0x65, 0xa6, 0x42, 0x61, 0x6a, 0x22, 0x01, - 0x00, 0x65, 0x90, 0x42, + 0x00, 0x65, 0xa6, 0x42, 0x10, 0x3d, 0x06, 0x00, 0xff, 0x65, 0x68, 0x0c, 0xff, 0x06, 0xd4, 0x08, - 0x01, 0x0c, 0x32, 0x7b, - 0x04, 0x0c, 0x32, 0x6b, + 0x01, 0x0c, 0x48, 0x7b, + 0x04, 0x0c, 0x48, 0x6b, 0xe0, 0x03, 0x7a, 0x08, - 0xe0, 0x3d, 0x46, 0x63, + 0xe0, 0x3d, 0x5c, 0x63, 0xff, 0x65, 0xcc, 0x08, 0xff, 0x12, 0xda, 0x0c, 0xff, 0x06, 0xd4, 0x0c, 0xff, 0x65, 0x0c, 0x08, - 0x02, 0x0b, 0x42, 0x7b, + 0x02, 0x0b, 0x58, 0x7b, 0xff, 0x6a, 0xd4, 0x0c, 0xd1, 0x6a, 0x22, 0x01, 0x00, 0x65, 0x22, 0x41, 0xff, 0x65, 0x26, 0x09, - 0x01, 0x0b, 0x5a, 0x6b, - 0x10, 0x0c, 0x4c, 0x7b, - 0x04, 0x0b, 0x54, 0x6b, + 0x01, 0x0b, 0x70, 0x6b, + 0x10, 0x0c, 0x62, 0x7b, + 0x04, 0x0b, 0x6a, 0x6b, 0xff, 0x6a, 0xca, 0x08, - 0x04, 0x93, 0x58, 0x6b, - 0x01, 0x94, 0x56, 0x7b, - 0x10, 0x94, 0x58, 0x6b, + 0x04, 0x93, 0x6e, 0x6b, + 0x01, 0x94, 0x6c, 0x7b, + 0x10, 0x94, 0x6e, 0x6b, 0xc7, 0x93, 0x26, 0x09, 0xff, 0x99, 0xd4, 0x08, - 0x38, 0x93, 0x5c, 0x6b, + 0x38, 0x93, 0x72, 0x6b, 0xff, 0x6a, 0xd4, 0x0c, - 0x80, 0x36, 0x60, 0x6b, + 0x80, 0x36, 0x76, 0x6b, 0x21, 0x6a, 0x22, 0x05, 0xff, 0x65, 0x20, 0x09, - 0xff, 0x51, 0x6e, 0x63, + 0xff, 0x51, 0x84, 0x63, 0xff, 0x37, 0xc8, 0x08, - 0xa1, 0x6a, 0x7a, 0x43, + 0xa1, 0x6a, 0x90, 0x43, 0xff, 0x51, 0xc8, 0x08, - 0xb9, 0x6a, 0x7a, 0x43, + 0xb9, 0x6a, 0x90, 0x43, 0xff, 0x90, 0xa4, 0x08, - 0xff, 0xba, 0x7e, 0x73, + 0xff, 0xba, 0x94, 0x73, 0xff, 0xba, 0x20, 0x09, 0xff, 0x65, 0xca, 0x18, - 0x00, 0x6c, 0x72, 0x63, + 0x00, 0x6c, 0x88, 0x63, 0xff, 0x90, 0xca, 0x0c, 0xff, 0x6a, 0xca, 0x04, - 0x20, 0x36, 0x92, 0x7b, - 0x00, 0x90, 0x66, 0x5b, - 0xff, 0x65, 0x92, 0x73, - 0xff, 0x52, 0x90, 0x73, + 0x20, 0x36, 0xa8, 0x7b, + 0x00, 0x90, 0x7c, 0x5b, + 0xff, 0x65, 0xa8, 0x73, + 0xff, 0x52, 0xa6, 0x73, 0xff, 0xba, 0xcc, 0x08, 0xff, 0x52, 0x20, 0x09, 0xff, 0x66, 0x74, 0x09, 0xff, 0x65, 0x20, 0x0d, 0xff, 0xba, 0x7e, 0x0c, - 0x00, 0x6a, 0x92, 0x5c, + 0x00, 0x6a, 0xa8, 0x5c, 0x0d, 0x6a, 0x6a, 0x00, - 0x00, 0x51, 0x1e, 0x44, - 0xff, 0x3f, 0xec, 0x73, + 0x00, 0x51, 0x34, 0x44, + 0xff, 0x3f, 0x02, 0x74, 0xff, 0x6a, 0xa2, 0x00, - 0x00, 0x3f, 0x66, 0x5b, - 0xff, 0x65, 0xec, 0x73, + 0x00, 0x3f, 0x7c, 0x5b, + 0xff, 0x65, 0x02, 0x74, 0x20, 0x36, 0x6c, 0x00, - 0x20, 0xa0, 0xa6, 0x6b, + 0x20, 0xa0, 0xbc, 0x6b, 0xff, 0xb9, 0xa2, 0x0c, 0xff, 0x6a, 0xa2, 0x04, 0xff, 0x65, 0xa4, 0x08, 0xe0, 0x6a, 0xcc, 0x00, - 0x45, 0x6a, 0x12, 0x5c, + 0x45, 0x6a, 0x28, 0x5c, 0x01, 0x6a, 0xd0, 0x01, 0x09, 0x6a, 0xd6, 0x01, - 0x80, 0xeb, 0xb2, 0x7b, + 0x80, 0xeb, 0xc8, 0x7b, 0x01, 0x6a, 0xd6, 0x01, 0x01, 0xe9, 0xa4, 0x34, 0x88, 0x6a, 0xcc, 0x00, - 0x45, 0x6a, 0x12, 0x5c, + 0x45, 0x6a, 0x28, 0x5c, 0x01, 0x6a, 0x18, 0x01, 0xff, 0x6a, 0x1a, 0x09, 0xff, 0x6a, 0x1c, 0x09, 0x0d, 0x6a, 0x26, 0x01, - 0x00, 0x65, 0x84, 0x5c, + 0x00, 0x65, 0x9a, 0x5c, 0xff, 0x99, 0xa4, 0x0c, 0xff, 0x65, 0xa4, 0x08, 0xe0, 0x6a, 0xcc, 0x00, - 0x45, 0x6a, 0x12, 0x5c, + 0x45, 0x6a, 0x28, 0x5c, 0x01, 0x6a, 0xd0, 0x01, 0x01, 0x6a, 0xdc, 0x05, 0x88, 0x6a, 0xcc, 0x00, - 0x45, 0x6a, 0x12, 0x5c, + 0x45, 0x6a, 0x28, 0x5c, 0x01, 0x6a, 0x18, 0x01, 0xff, 0x6a, 0x1a, 0x09, 0xff, 0x6a, 0x1c, 0x09, 0x01, 0x6a, 0x26, 0x05, 0x01, 0x65, 0xd8, 0x31, 0x09, 0xee, 0xdc, 0x01, - 0x80, 0xee, 0xe2, 0x7b, + 0x80, 0xee, 0xf8, 0x7b, 0xff, 0x6a, 0xdc, 0x0d, 0xff, 0x65, 0x32, 0x09, 0x0a, 0x93, 0x26, 0x01, - 0x00, 0x65, 0x84, 0x44, + 0x00, 0x65, 0x9a, 0x44, 0xff, 0x37, 0xc8, 0x08, - 0x00, 0x6a, 0xa8, 0x5b, + 0x00, 0x6a, 0xbe, 0x5b, 0xff, 0x52, 0xa2, 0x0c, - 0x01, 0x0c, 0xf2, 0x7b, - 0x04, 0x0c, 0xf2, 0x6b, + 0x01, 0x0c, 0x08, 0x7c, + 0x04, 0x0c, 0x08, 0x6c, 0xe0, 0x03, 0x06, 0x08, 0xe0, 0x03, 0x7a, 0x0c, 0xff, 0x8c, 0x10, 0x08, @@ -531,29 +542,29 @@ 0x00, 0x6c, 0xda, 0x24, 0xff, 0x65, 0xc8, 0x08, 0xe0, 0x6a, 0xcc, 0x00, - 0x41, 0x6a, 0x0e, 0x5c, + 0x41, 0x6a, 0x24, 0x5c, 0xff, 0x90, 0xe2, 0x09, 0x20, 0x6a, 0xd0, 0x01, - 0x04, 0x35, 0x30, 0x7c, + 0x04, 0x35, 0x46, 0x7c, 0x1d, 0x6a, 0xdc, 0x01, - 0xdc, 0xee, 0x2c, 0x64, - 0x00, 0x65, 0x3c, 0x44, + 0xdc, 0xee, 0x42, 0x64, + 0x00, 0x65, 0x52, 0x44, 0x01, 0x6a, 0xdc, 0x01, 0x20, 0xa0, 0xd8, 0x31, 0x09, 0xee, 0xdc, 0x01, - 0x80, 0xee, 0x36, 0x7c, + 0x80, 0xee, 0x4c, 0x7c, 0x19, 0x6a, 0xdc, 0x01, - 0xd8, 0xee, 0x3a, 0x64, + 0xd8, 0xee, 0x50, 0x64, 0xff, 0x6a, 0xdc, 0x09, - 0x18, 0xee, 0x3e, 0x6c, + 0x18, 0xee, 0x54, 0x6c, 0xff, 0x6a, 0xd4, 0x0c, 0x88, 0x6a, 0xcc, 0x00, - 0x41, 0x6a, 0x0e, 0x5c, + 0x41, 0x6a, 0x24, 0x5c, 0x20, 0x6a, 0x18, 0x01, 0xff, 0x6a, 0x1a, 0x09, 0xff, 0x6a, 0x1c, 0x09, 0xff, 0x35, 0x26, 0x09, - 0x04, 0x35, 0x68, 0x6c, + 0x04, 0x35, 0x7e, 0x6c, 0xa0, 0x6a, 0xca, 0x00, 0x20, 0x65, 0xc8, 0x18, 0xff, 0x6c, 0x32, 0x09, @@ -564,14 +575,14 @@ 0xff, 0x6c, 0x32, 0x09, 0xff, 0x6c, 0x32, 0x09, 0xff, 0x6c, 0x32, 0x09, - 0x00, 0x65, 0x54, 0x64, + 0x00, 0x65, 0x6a, 0x64, 0x0a, 0x93, 0x26, 0x01, - 0x00, 0x65, 0x84, 0x5c, - 0x04, 0x35, 0x60, 0x7b, - 0xa0, 0x6a, 0x74, 0x5c, - 0x00, 0x65, 0x76, 0x5c, - 0x00, 0x65, 0x76, 0x5c, - 0x00, 0x65, 0x76, 0x44, + 0x00, 0x65, 0x9a, 0x5c, + 0x04, 0x35, 0x76, 0x7b, + 0xa0, 0x6a, 0x8a, 0x5c, + 0x00, 0x65, 0x8c, 0x5c, + 0x00, 0x65, 0x8c, 0x5c, + 0x00, 0x65, 0x8c, 0x44, 0xff, 0x65, 0xcc, 0x08, 0xff, 0x99, 0xda, 0x08, 0xff, 0x99, 0xda, 0x08, @@ -580,19 +591,19 @@ 0xff, 0x99, 0xda, 0x08, 0xff, 0x99, 0xda, 0x08, 0xff, 0x99, 0xda, 0x0c, - 0x08, 0x94, 0x84, 0x7c, + 0x08, 0x94, 0x9a, 0x7c, 0xf7, 0x93, 0x26, 0x09, - 0x08, 0x93, 0x88, 0x6c, + 0x08, 0x93, 0x9e, 0x6c, 0xff, 0x6a, 0xd4, 0x0c, 0xff, 0x40, 0x74, 0x09, 0xff, 0x90, 0x80, 0x08, 0xff, 0x6a, 0x72, 0x05, - 0xff, 0x40, 0xa0, 0x64, - 0xff, 0x3f, 0x98, 0x64, + 0xff, 0x40, 0xb6, 0x64, + 0xff, 0x3f, 0xae, 0x64, 0xff, 0x6a, 0xca, 0x04, 0xff, 0x3f, 0x20, 0x09, 0x01, 0x6a, 0x6a, 0x00, - 0x00, 0xb9, 0x1e, 0x5c, + 0x00, 0xb9, 0x34, 0x5c, 0xff, 0xba, 0x7e, 0x0c, 0xff, 0x40, 0x20, 0x09, 0xff, 0xba, 0x80, 0x0c, @@ -739,60 +750,60 @@ { aic7xxx_patch1_func, 68, 60, 1 }, { aic7xxx_patch8_func, 162, 1, 2 }, { aic7xxx_patch0_func, 163, 2, 1 }, - { aic7xxx_patch2_func, 167, 2, 3 }, - { aic7xxx_patch8_func, 167, 1, 1 }, - { aic7xxx_patch0_func, 169, 2, 1 }, - { aic7xxx_patch8_func, 172, 1, 2 }, - { aic7xxx_patch0_func, 173, 1, 1 }, - { aic7xxx_patch2_func, 177, 1, 1 }, - { aic7xxx_patch2_func, 180, 3, 2 }, - { aic7xxx_patch0_func, 183, 5, 1 }, - { aic7xxx_patch2_func, 191, 2, 3 }, - { aic7xxx_patch8_func, 191, 1, 1 }, - { aic7xxx_patch0_func, 193, 3, 1 }, - { aic7xxx_patch10_func, 196, 2, 1 }, - { aic7xxx_patch8_func, 198, 7, 2 }, - { aic7xxx_patch0_func, 205, 1, 1 }, - { aic7xxx_patch2_func, 210, 14, 3 }, - { aic7xxx_patch10_func, 223, 1, 1 }, - { aic7xxx_patch0_func, 224, 9, 1 }, - { aic7xxx_patch8_func, 238, 2, 1 }, - { aic7xxx_patch8_func, 240, 1, 1 }, - { aic7xxx_patch10_func, 241, 6, 3 }, - { aic7xxx_patch2_func, 241, 2, 2 }, - { aic7xxx_patch0_func, 243, 4, 1 }, - { aic7xxx_patch8_func, 248, 1, 1 }, - { aic7xxx_patch8_func, 252, 11, 1 }, - { aic7xxx_patch2_func, 264, 3, 3 }, - { aic7xxx_patch10_func, 266, 1, 1 }, - { aic7xxx_patch0_func, 267, 5, 1 }, - { aic7xxx_patch10_func, 272, 1, 2 }, - { aic7xxx_patch0_func, 273, 7, 1 }, - { aic7xxx_patch11_func, 287, 1, 2 }, - { aic7xxx_patch0_func, 288, 1, 1 }, - { aic7xxx_patch5_func, 348, 1, 2 }, - { aic7xxx_patch0_func, 349, 1, 1 }, - { aic7xxx_patch3_func, 352, 1, 1 }, - { aic7xxx_patch2_func, 362, 3, 2 }, - { aic7xxx_patch0_func, 365, 5, 1 }, - { aic7xxx_patch11_func, 373, 1, 2 }, - { aic7xxx_patch0_func, 374, 1, 1 }, - { aic7xxx_patch6_func, 379, 1, 1 }, - { aic7xxx_patch1_func, 416, 3, 1 }, - { aic7xxx_patch10_func, 421, 11, 1 }, - { aic7xxx_patch2_func, 469, 7, 2 }, - { aic7xxx_patch0_func, 476, 8, 1 }, - { aic7xxx_patch2_func, 485, 4, 2 }, - { aic7xxx_patch0_func, 489, 6, 1 }, - { aic7xxx_patch2_func, 495, 4, 2 }, - { aic7xxx_patch0_func, 499, 3, 1 }, - { aic7xxx_patch12_func, 509, 10, 1 }, - { aic7xxx_patch2_func, 528, 17, 4 }, - { aic7xxx_patch13_func, 536, 4, 2 }, - { aic7xxx_patch0_func, 540, 2, 1 }, - { aic7xxx_patch0_func, 545, 33, 1 }, - { aic7xxx_patch12_func, 578, 4, 1 }, - { aic7xxx_patch6_func, 582, 2, 1 }, - { aic7xxx_patch6_func, 585, 9, 1 }, + { aic7xxx_patch2_func, 167, 3, 3 }, + { aic7xxx_patch8_func, 167, 2, 1 }, + { aic7xxx_patch0_func, 170, 2, 1 }, + { aic7xxx_patch8_func, 173, 1, 2 }, + { aic7xxx_patch0_func, 174, 1, 1 }, + { aic7xxx_patch2_func, 178, 1, 1 }, + { aic7xxx_patch2_func, 181, 3, 2 }, + { aic7xxx_patch0_func, 184, 5, 1 }, + { aic7xxx_patch2_func, 192, 2, 3 }, + { aic7xxx_patch8_func, 192, 1, 1 }, + { aic7xxx_patch0_func, 194, 3, 1 }, + { aic7xxx_patch10_func, 197, 2, 1 }, + { aic7xxx_patch8_func, 199, 7, 2 }, + { aic7xxx_patch0_func, 206, 1, 1 }, + { aic7xxx_patch2_func, 211, 14, 3 }, + { aic7xxx_patch10_func, 224, 1, 1 }, + { aic7xxx_patch0_func, 225, 9, 1 }, + { aic7xxx_patch8_func, 239, 2, 1 }, + { aic7xxx_patch8_func, 241, 1, 1 }, + { aic7xxx_patch10_func, 242, 6, 3 }, + { aic7xxx_patch2_func, 242, 2, 2 }, + { aic7xxx_patch0_func, 244, 4, 1 }, + { aic7xxx_patch8_func, 249, 1, 1 }, + { aic7xxx_patch8_func, 253, 19, 1 }, + { aic7xxx_patch2_func, 273, 3, 3 }, + { aic7xxx_patch10_func, 275, 1, 1 }, + { aic7xxx_patch0_func, 276, 5, 1 }, + { aic7xxx_patch10_func, 281, 1, 2 }, + { aic7xxx_patch0_func, 282, 9, 1 }, + { aic7xxx_patch11_func, 298, 1, 2 }, + { aic7xxx_patch0_func, 299, 1, 1 }, + { aic7xxx_patch5_func, 359, 1, 2 }, + { aic7xxx_patch0_func, 360, 1, 1 }, + { aic7xxx_patch3_func, 363, 1, 1 }, + { aic7xxx_patch2_func, 373, 3, 2 }, + { aic7xxx_patch0_func, 376, 5, 1 }, + { aic7xxx_patch11_func, 384, 1, 2 }, + { aic7xxx_patch0_func, 385, 1, 1 }, + { aic7xxx_patch6_func, 390, 1, 1 }, + { aic7xxx_patch1_func, 427, 3, 1 }, + { aic7xxx_patch10_func, 432, 11, 1 }, + { aic7xxx_patch2_func, 480, 7, 2 }, + { aic7xxx_patch0_func, 487, 8, 1 }, + { aic7xxx_patch2_func, 496, 4, 2 }, + { aic7xxx_patch0_func, 500, 6, 1 }, + { aic7xxx_patch2_func, 506, 4, 2 }, + { aic7xxx_patch0_func, 510, 3, 1 }, + { aic7xxx_patch12_func, 520, 10, 1 }, + { aic7xxx_patch2_func, 539, 17, 4 }, + { aic7xxx_patch13_func, 547, 4, 2 }, + { aic7xxx_patch0_func, 551, 2, 1 }, + { aic7xxx_patch0_func, 556, 33, 1 }, + { aic7xxx_patch12_func, 589, 4, 1 }, + { aic7xxx_patch6_func, 593, 2, 1 }, + { aic7xxx_patch6_func, 596, 9, 1 }, }; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/dtc.c linux/drivers/scsi/dtc.c --- v2.3.28/linux/drivers/scsi/dtc.c Thu Nov 11 20:11:46 1999 +++ linux/drivers/scsi/dtc.c Fri Nov 19 11:30:54 1999 @@ -147,7 +147,7 @@ #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) static struct base { - unsigned int address; + unsigned long address; int noauto; } bases[] __initdata = {{0xcc000, 0}, {0xc8000, 0}, {0xdc000, 0}, {0xd8000, 0}}; @@ -222,7 +222,7 @@ #endif for (sig = 0; sig < NO_SIGNATURES; ++sig) if (!bases[current_base].noauto && - check_signature(bases[current_base].address + + isa_check_signature(bases[current_base].address + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) { base = bases[current_base].address; @@ -241,7 +241,7 @@ break; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); - instance->base = (void *)base; + instance->base = base; NCR5380_init(instance, 0); @@ -360,7 +360,7 @@ while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) ++i; rtrc(3); - memcpy_fromio(d, base + DTC_DATA_BUF, 128); + isa_memcpy_fromio(d, base + DTC_DATA_BUF, 128); d += 128; len -= 128; rtrc(7); /*** with int's on, it sometimes hangs after here. @@ -410,7 +410,7 @@ while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) ++i; rtrc(3); - memcpy_toio(base + DTC_DATA_BUF, src, 128); + isa_memcpy_toio(base + DTC_DATA_BUF, src, 128); src += 128; len -= 128; } diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/eata_dma.c linux/drivers/scsi/eata_dma.c --- v2.3.28/linux/drivers/scsi/eata_dma.c Thu Nov 11 20:11:46 1999 +++ linux/drivers/scsi/eata_dma.c Fri Nov 19 11:30:54 1999 @@ -1281,7 +1281,7 @@ hd->channel = gc->MAX_CHAN; sh->max_channel = gc->MAX_CHAN; sh->unique_id = base; - sh->base = (char *) base; + sh->base = base; sh->io_port = base; sh->n_io_port = 9; sh->irq = gc->IRQ; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/eata_pio.c linux/drivers/scsi/eata_pio.c --- v2.3.28/linux/drivers/scsi/eata_pio.c Thu Nov 11 20:11:46 1999 +++ linux/drivers/scsi/eata_pio.c Fri Nov 19 11:30:54 1999 @@ -782,7 +782,7 @@ SD(sh)->devflags=1<scsi_id[3]; SD(sh)->moresupport=gc->MORE_support; sh->unique_id = base; - sh->base = (char *) base; + sh->base = base; sh->io_port = base; sh->n_io_port = 8; sh->irq = gc->IRQ; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/fdomain.c linux/drivers/scsi/fdomain.c --- v2.3.28/linux/drivers/scsi/fdomain.c Thu Nov 11 20:11:46 1999 +++ linux/drivers/scsi/fdomain.c Thu Nov 18 19:25:28 1999 @@ -699,7 +699,7 @@ printk( " %lx(%lx),", addresses[i], bios_base ); #endif for (j = 0; !bios_base && j < SIGNATURE_COUNT; j++) { - if (check_signature(addresses[i] + signatures[j].sig_offset, + if (isa_check_signature(addresses[i] + signatures[j].sig_offset, signatures[j].signature, signatures[j].sig_length )) { bios_major = signatures[j].major_bios_version; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/g_NCR5380.c linux/drivers/scsi/g_NCR5380.c --- v2.3.28/linux/drivers/scsi/g_NCR5380.c Thu Nov 11 20:11:47 1999 +++ linux/drivers/scsi/g_NCR5380.c Fri Nov 19 11:30:54 1999 @@ -490,7 +490,7 @@ dst[start+i] = NCR5380_read(C400_HOST_BUFFER); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); + isa_memcpy_fromio(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); #endif start+=128; blocks--; @@ -511,7 +511,7 @@ dst[start+i] = NCR5380_read(C400_HOST_BUFFER); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); + isa_memcpy_fromio(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); #endif start+=128; blocks--; @@ -598,7 +598,7 @@ NCR5380_write(C400_HOST_BUFFER, src[start+i]); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); + isa_memcpy_toio(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); #endif start+=128; blocks--; @@ -618,7 +618,7 @@ NCR5380_write(C400_HOST_BUFFER, src[start+i]); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); + isa_memcpy_toio(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); #endif start+=128; blocks--; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/g_NCR5380.h linux/drivers/scsi/g_NCR5380.h --- v2.3.28/linux/drivers/scsi/g_NCR5380.h Sun Jun 7 10:37:41 1998 +++ linux/drivers/scsi/g_NCR5380.h Fri Nov 19 11:30:54 1999 @@ -140,8 +140,8 @@ #define NCR5380_region_size 0x3a00 -#define NCR5380_read(reg) (*(NCR5380_map_name + NCR53C400_mem_base + (reg))) -#define NCR5380_write(reg, value) (*(NCR5380_map_name + NCR53C400_mem_base + (reg)) = value) +#define NCR5380_read(reg) isa_readb(NCR5380_map_name + NCR53C400_mem_base + (reg)) +#define NCR5380_write(reg, value) isa_writeb(NCR5380_map_name + NCR53C400_mem_base + (reg), value) #endif diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/gdth_proc.c linux/drivers/scsi/gdth_proc.c --- v2.3.28/linux/drivers/scsi/gdth_proc.c Wed May 12 13:27:37 1999 +++ linux/drivers/scsi/gdth_proc.c Tue Nov 23 10:29:16 1999 @@ -463,11 +463,7 @@ /* controller information */ size = sprintf(buffer+len,"\nDisk Array Controller Information:\n"); len += size; pos = begin + len; -#if LINUX_VERSION_CODE >= 0x020000 strcpy(hrec, ha->binfo.type_string); -#else - sprintf(hrec, "%s (Bus %d)", ha->binfo.type_string, busnum); -#endif size = sprintf(buffer+len, " Number: \t%d \tName: \t%s\n", hanum, hrec); @@ -1002,13 +998,8 @@ for (i = 0; i < GDTH_MAXCMDS; ++i) { scp = ha->cmd_tab[i].cmnd; -#if LINUX_VERSION_CODE >= 0x020000 if (!SPECIAL_SCP(scp) && scp->target == (unchar)id && scp->channel == (unchar)busnum) -#else - if (!SPECIAL_SCP(scp) && scp->target == (unchar)id && - NUMDATA(scp->host)->busnum == (unchar)busnum) -#endif { scp->SCp.have_data_in = 0; GDTH_UNLOCK_HA(ha, flags); @@ -1033,13 +1024,8 @@ GDTH_LOCK_HA(ha, flags); for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { -#if LINUX_VERSION_CODE >= 0x020000 if (scp->target == (unchar)id && scp->channel == (unchar)busnum) -#else - if (scp->target == (unchar)id && - NUMDATA(scp->host)->busnum == (unchar)busnum) -#endif { TRACE2(("gdth_stop_timeout(): update_timeout()\n")); scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); @@ -1058,13 +1044,8 @@ GDTH_LOCK_HA(ha, flags); for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { -#if LINUX_VERSION_CODE >= 0x020000 if (scp->target == (unchar)id && scp->channel == (unchar)busnum) -#else - if (scp->target == (unchar)id && - NUMDATA(scp->host)->busnum == (unchar)busnum) -#endif { TRACE2(("gdth_start_timeout(): update_timeout()\n")); gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual); diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c --- v2.3.28/linux/drivers/scsi/hosts.c Thu Nov 11 20:11:47 1999 +++ linux/drivers/scsi/hosts.c Thu Nov 18 20:01:27 1999 @@ -703,8 +703,6 @@ retval->loaded_as_module = scsi_loadable_module_flag; retval->host_no = max_scsi_hosts++; /* never reuse host_no (DB) */ next_scsi_host++; - /* FIXME: what with overflows? Old code suffered from the same, BTW */ - sprintf(retval->proc_name, "%d", retval->host_no); retval->host_queue = NULL; init_waitqueue_head(&retval->host_wait); retval->resetting = 0; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/hosts.h linux/drivers/scsi/hosts.h --- v2.3.28/linux/drivers/scsi/hosts.h Thu Nov 11 20:11:47 1999 +++ linux/drivers/scsi/hosts.h Tue Nov 23 12:57:28 1999 @@ -25,7 +25,6 @@ $Header: /vger/u4/cvs/linux/drivers/scsi/hosts.h,v 1.6 1997/01/19 23:07:13 davem Exp $ */ -#include #include /* It is senseless to set SG_ALL any higher than this - the performance @@ -327,7 +326,6 @@ /* public: */ unsigned short extra_bytes; unsigned short host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ - char proc_name[4]; int resetting; /* if set, it means that last_reset is a valid value */ unsigned long last_reset; @@ -351,7 +349,7 @@ unsigned wish_block:1; /* These parameters should be set by the detect routine */ - unsigned char *base; + unsigned long base; unsigned long io_port; unsigned char n_io_port; unsigned char dma_channel; @@ -487,11 +485,7 @@ * Even bigger hack for SparcSTORAGE arrays. Those are at least 6 disks, but * usually up to 30 disks, so everyone would need to change this. -jj */ -#ifdef CONFIG_SCSI_PLUTO_MODULE #define SD_EXTRA_DEVS 40 -#else -#define SD_EXTRA_DEVS 4 -#endif #define ST_EXTRA_DEVS 2 #define SR_EXTRA_DEVS 2 #define SG_EXTRA_DEVS (SD_EXTRA_DEVS + SR_EXTRA_DEVS + ST_EXTRA_DEVS) diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/ini9100u.c linux/drivers/scsi/ini9100u.c --- v2.3.28/linux/drivers/scsi/ini9100u.c Thu Nov 11 20:11:47 1999 +++ linux/drivers/scsi/ini9100u.c Fri Nov 19 11:30:54 1999 @@ -397,7 +397,7 @@ hreg->max_lun = 32; /* 10/21/97 */ hreg->irq = pHCB->HCS_Intr; hreg->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */ - hreg->base = (UCHAR *) pHCB; + hreg->base = (unsigned long)pHCB; hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */ /* Initial tulip chip */ diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/inia100.c linux/drivers/scsi/inia100.c --- v2.3.28/linux/drivers/scsi/inia100.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/scsi/inia100.c Fri Nov 19 11:30:54 1999 @@ -399,7 +399,7 @@ */ hreg->irq = pHCB->HCS_Intr; hreg->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */ - hreg->base = (UCHAR *) pHCB; + hreg->base = (unsigned long)pHCB; #if 1 hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */ diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/ncr53c8xx.c linux/drivers/scsi/ncr53c8xx.c --- v2.3.28/linux/drivers/scsi/ncr53c8xx.c Thu Nov 11 20:11:48 1999 +++ linux/drivers/scsi/ncr53c8xx.c Fri Nov 19 11:30:54 1999 @@ -4498,7 +4498,7 @@ instance->max_id = np->maxwide ? 16 : 8; instance->max_lun = SCSI_NCR_MAX_LUN; #ifndef NCR_IOMAPPED - instance->base = (char *) np->reg; + instance->base = (unsigned long)np->reg; #endif instance->irq = device->slot.irq; instance->unique_id = device->slot.io_port; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/script_asm.pl linux/drivers/scsi/script_asm.pl --- v2.3.28/linux/drivers/scsi/script_asm.pl Wed Oct 27 16:34:12 1999 +++ linux/drivers/scsi/script_asm.pl Sun Nov 21 17:41:43 1999 @@ -896,6 +896,7 @@ open (OUTPUT, ">$output") || die "$0 : can't open $output for writing\n"; open (OUTPUTU, ">$outputu") || die "$0 : can't open $outputu for writing\n"; +print OUTPUT "/* DO NOT EDIT - Generated automatically by ".$0." */\n"; print OUTPUT "static u32 ".$prefix."SCRIPT[] = {\n"; $instructions = 0; for ($i = 0; $i < $#code; ) { diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v2.3.28/linux/drivers/scsi/scsi.c Thu Nov 11 20:11:48 1999 +++ linux/drivers/scsi/scsi.c Sun Nov 21 11:13:56 1999 @@ -59,6 +59,7 @@ #include #include #include +#include #include "scsi.h" #include "hosts.h" @@ -73,8 +74,7 @@ struct proc_dir_entry *proc_scsi = NULL; #ifdef CONFIG_PROC_FS -static int scsi_proc_info(char *buffer, char **start, off_t offset, - int length, int inout); +static int scsi_proc_info(char *buffer, char **start, off_t offset, int length); static void scsi_dump_status(int level); #endif @@ -112,14 +112,19 @@ * lock up. */ -#define BLIST_NOLUN 0x01 -#define BLIST_FORCELUN 0x02 -#define BLIST_BORKEN 0x04 -#define BLIST_KEY 0x08 -#define BLIST_SINGLELUN 0x10 -#define BLIST_NOTQ 0x20 -#define BLIST_SPARSELUN 0x40 -#define BLIST_MAX5LUN 0x80 +#define BLIST_NOLUN 0x001 +#define BLIST_FORCELUN 0x002 +#define BLIST_BORKEN 0x004 +#define BLIST_KEY 0x008 +#define BLIST_SINGLELUN 0x010 +#define BLIST_NOTQ 0x020 +#define BLIST_SPARSELUN 0x040 +#define BLIST_MAX5LUN 0x080 +#define BLIST_ISDISK 0x100 +#define BLIST_ISROM 0x200 +#define BLIST_GHOST 0x400 + + /* * Data declarations. @@ -187,11 +192,11 @@ extern void scsi_old_done(Scsi_Cmnd * SCpnt); extern void scsi_old_times_out(Scsi_Cmnd * SCpnt); -#define SCSI_BLOCK(DEVICE, HOST) \ - ((HOST->block && host_active && HOST != host_active) \ - || ((HOST)->can_queue && HOST->host_busy >= HOST->can_queue) \ - || ((HOST)->host_blocked) \ - || ((DEVICE) != NULL && (DEVICE)->device_blocked) ) +#define SCSI_BLOCK(DEVICE, HOST) \ + ((HOST->block && host_active && HOST != host_active) \ + || ((HOST)->can_queue && HOST->host_busy >= HOST->can_queue) \ + || ((HOST)->host_blocked) \ + || ((DEVICE) != NULL && (DEVICE)->device_blocked) ) @@ -243,6 +248,7 @@ {"TEAC", "CD-ROM", "1.06", BLIST_NOLUN}, /* causes failed REQUEST SENSE on lun 1 * for seagate controller, which causes * SCSI code to reset bus.*/ + {"TEAC", "MT-2ST/45S2-27", "RV M", BLIST_NOLUN}, /* Responds to all lun */ {"TEXEL", "CD-ROM", "1.06", BLIST_NOLUN}, /* causes failed REQUEST SENSE on lun 1 * for seagate controller, which causes * SCSI code to reset bus.*/ @@ -254,7 +260,9 @@ {"HP", "C1750A", "3226", BLIST_NOLUN}, /* scanjet iic */ {"HP", "C1790A", "", BLIST_NOLUN}, /* scanjet iip */ {"HP", "C2500A", "", BLIST_NOLUN}, /* scanjet iicx */ - {"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* extra reset */ + {"YAMAHA", "CDR100", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */ + {"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 + * extra reset */ {"RELISYS", "Scorpio", "*", BLIST_NOLUN}, /* responds to all LUN */ /* @@ -277,10 +285,12 @@ {"CANON", "IPUBJD", "*", BLIST_SPARSELUN}, {"nCipher", "Fastness Crypto", "*", BLIST_FORCELUN}, {"NEC", "PD-1 ODX654P", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, - {"MATSHITA", "PD", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, - {"YAMAHA", "CDR100", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */ - {"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */ + {"MATSHITA", "PD-1", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, {"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN}, + {"CREATIVE","DVD-RAM RAM","*", BLIST_GHOST}, + {"MATSHITA","PD-2 LF-D100","*", BLIST_GHOST}, + {"HITACHI", "GF-1050","*", BLIST_GHOST}, /* Hitachi SCSI DVD-RAM */ + {"TOSHIBA","CDROM","*", BLIST_ISROM}, /* * Must be at end of list... @@ -471,7 +481,7 @@ SCpnt->request.rq_status = RQ_SCSI_BUSY; spin_lock_irqsave(&io_request_lock, flags); scsi_do_cmd (SCpnt, (void *) cmnd, - buffer, bufflen, done, timeout, retries); + buffer, bufflen, done, timeout, retries); spin_unlock_irqrestore(&io_request_lock, flags); down (&sem); SCpnt->request.sem = NULL; @@ -690,6 +700,8 @@ struct Scsi_Device_Template *sdtpnt; Scsi_Device *SDtail, *SDpnt = *SDpnt2; int bflags, type = -1; + static int ghost_channel=-1, ghost_dev=-1; + int org_lun = lun; SDpnt->host = shpnt; SDpnt->id = dev; @@ -697,6 +709,14 @@ SDpnt->channel = channel; SDpnt->online = TRUE; + + if ((channel == ghost_channel) && (dev == ghost_dev) && (lun == 1)) { + SDpnt->lun = 0; + } else { + ghost_channel = ghost_dev = -1; + } + + /* Some low level driver could use device->type (DB) */ SDpnt->type = -1; @@ -719,8 +739,8 @@ SCpnt->channel = SDpnt->channel; scsi_wait_cmd (SCpnt, (void *) scsi_cmd, - (void *) NULL, - 0, scan_scsis_done, SCSI_TIMEOUT + 4 * HZ, 5); + (void *) NULL, + 0, scan_scsis_done, SCSI_TIMEOUT + 4 * HZ, 5); SCSI_LOG_SCAN_BUS(3, printk("scsi: scan_scsis_single id %d lun %d. Return code 0x%08x\n", dev, lun, SCpnt->result)); @@ -752,8 +772,8 @@ SCpnt->cmd_len = 0; scsi_wait_cmd (SCpnt, (void *) scsi_cmd, - (void *) scsi_result, - 256, scan_scsis_done, SCSI_TIMEOUT, 3); + (void *) scsi_result, + 256, scan_scsis_done, SCSI_TIMEOUT, 3); SCSI_LOG_SCAN_BUS(3, printk("scsi: INQUIRY %s with code 0x%x\n", SCpnt->result ? "failed" : "successful", SCpnt->result)); @@ -768,15 +788,41 @@ if ((scsi_result[0] >> 5) == 3) { return 0; /* assume no peripheral if any sort of error */ } + /* - * It would seem some TOSHIBA CDROM gets things wrong + * Get any flags for this device. */ - if (!strncmp(scsi_result + 8, "TOSHIBA", 7) && - !strncmp(scsi_result + 16, "CD-ROM", 6) && - scsi_result[0] == TYPE_DISK) { + bflags = get_device_flags (scsi_result); + + + /* The Toshiba ROM was "gender-changed" here as an inline hack. + This is now much more generic. + This is a mess: What we really want is to leave the scsi_result + alone, and just change the SDpnt structure. And the SDpnt is what + we want print_inquiry to print. -- REW + */ + if (bflags & BLIST_ISDISK) { + scsi_result[0] = TYPE_DISK; + scsi_result[1] |= 0x80; /* removable */ + } + + if (bflags & BLIST_ISROM) { scsi_result[0] = TYPE_ROM; - scsi_result[1] |= 0x80; /* removable */ + scsi_result[1] |= 0x80; /* removable */ + } + + if (bflags & BLIST_GHOST) { + if ((ghost_channel == channel) && (ghost_dev == dev) && (org_lun == 1)) { + lun=1; + } else { + ghost_channel = channel; + ghost_dev = dev; + scsi_result[0] = TYPE_MOD; + scsi_result[1] |= 0x80; /* removable */ + } } + + memcpy(SDpnt->vendor, scsi_result + 8, 8); memcpy(SDpnt->model, scsi_result + 16, 16); memcpy(SDpnt->rev, scsi_result + 32, 4); @@ -839,10 +885,6 @@ */ SDpnt->disconnect = 0; - /* - * Get any flags for this device. - */ - bflags = get_device_flags(scsi_result); /* * Set the tagged_queue flag for SCSI-II devices that purport to support @@ -885,8 +927,8 @@ scsi_cmd[5] = 0; SCpnt->cmd_len = 0; scsi_wait_cmd (SCpnt, (void *) scsi_cmd, - (void *) scsi_result, 0x2a, - scan_scsis_done, SCSI_TIMEOUT, 3); + (void *) scsi_result, 0x2a, + scan_scsis_done, SCSI_TIMEOUT, 3); } /* * Detach the command from the device. It was just a temporary to be used while @@ -961,6 +1003,17 @@ *max_dev_lun = 5; return 1; } + + /* + * If this device is Ghosted, scan upto two luns. (It physically only + * has one). -- REW + */ + if (bflags & BLIST_GHOST) { + *max_dev_lun = 2; + return 1; + } + + /* * We assume the device can't handle lun!=0 if: - it reports scsi-0 (ANSI * SCSI Revision 0) (old drives like MAXTOR XT-3280) or - it reports scsi-1 @@ -1201,9 +1254,14 @@ } if (!SCpnt || SCpnt->request.rq_status != RQ_INACTIVE) { /* Might have changed */ if (wait && SCwait && SCwait->request.rq_status != RQ_INACTIVE) { - spin_unlock(&io_request_lock); /* FIXME!!!! */ - sleep_on(&device->device_wait); - spin_lock_irq(&io_request_lock); /* FIXME!!!! */ + DECLARE_WAITQUEUE(wait,current); + add_wait_queue(&device->device_wait,&wait); + current->state=TASK_UNINTERRUPTIBLE; + spin_unlock(&io_request_lock); + schedule(); + current->state=TASK_RUNNING; + remove_wait_queue(&device->device_wait,&wait); + spin_lock_irq(&io_request_lock); } else { if (!wait) return NULL; @@ -1966,6 +2024,9 @@ SDpnt->has_cmdblocks = 1; } +static ssize_t proc_scsi_gen_write(struct file * file, const char * buf, + unsigned long length, void *data); + #ifndef MODULE /* { */ /* * scsi_dev_init() is our initialization routine, which in turn calls host @@ -1977,6 +2038,7 @@ Scsi_Device *SDpnt; struct Scsi_Host *shpnt; struct Scsi_Device_Template *sdtpnt; + struct proc_dir_entry *generic; #ifdef FOO_ON_YOU return; #endif @@ -1993,7 +2055,13 @@ return -ENOMEM; } - create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + generic = create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + if (!generic) { + printk (KERN_ERR "cannot init /proc/scsi/scsi\n"); + remove_proc_entry("scsi", 0); + return -ENOMEM; + } + generic->write_proc = proc_scsi_gen_write; #endif /* Init a few things so we can "malloc" memory. */ @@ -2102,63 +2170,77 @@ printk("\n"); } - #ifdef CONFIG_PROC_FS -static int scsi_proc_info(char *buffer, char **start, off_t offset, - int length, int inout) +static int scsi_proc_info(char *buffer, char **start, off_t offset, int length) { - Scsi_Cmnd *SCpnt; - struct Scsi_Device_Template *SDTpnt; Scsi_Device *scd; struct Scsi_Host *HBA_ptr; - char *p; - int host, channel, id, lun; int size, len = 0; off_t begin = 0; off_t pos = 0; - if (inout == 0) { - /* - * First, see if there are any attached devices or not. - */ - for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { - if (HBA_ptr->host_queue != NULL) { - break; - } + /* + * First, see if there are any attached devices or not. + */ + for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { + if (HBA_ptr->host_queue != NULL) { + break; } - size = sprintf(buffer + len, "Attached devices: %s\n", (HBA_ptr) ? "" : "none"); + } + size = sprintf(buffer + len, "Attached devices: %s\n", (HBA_ptr) ? "" : "none"); + len += size; + pos = begin + len; + for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { +#if 0 + size += sprintf(buffer + len, "scsi%2d: %s\n", (int) HBA_ptr->host_no, + HBA_ptr->hostt->procname); len += size; pos = begin + len; - for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { -#if 0 - size += sprintf(buffer + len, "scsi%2d: %s\n", (int) HBA_ptr->host_no, - HBA_ptr->hostt->procname); +#endif + for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { + proc_print_scsidevice(scd, buffer, &size, len); len += size; pos = begin + len; -#endif - for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { - proc_print_scsidevice(scd, buffer, &size, len); - len += size; - pos = begin + len; - - if (pos < offset) { - len = 0; - begin = pos; - } - if (pos > offset + length) - goto stop_output; + + if (pos < offset) { + len = 0; + begin = pos; } + if (pos > offset + length) + goto stop_output; } - - stop_output: - *start = buffer + (offset - begin); /* Start of wanted data */ - len -= (offset - begin); /* Start slop */ - if (len > length) - len = length; /* Ending slop */ - return (len); } - if (!buffer || length < 11 || strncmp("scsi", buffer, 4)) - return (-EINVAL); + +stop_output: + *start = buffer + (offset - begin); /* Start of wanted data */ + len -= (offset - begin); /* Start slop */ + if (len > length) + len = length; /* Ending slop */ + return (len); +} + +static ssize_t proc_scsi_gen_write(struct file * file, const char * buf, + unsigned long length, void *data) +{ + Scsi_Cmnd *SCpnt; + struct Scsi_Device_Template *SDTpnt; + Scsi_Device *scd; + struct Scsi_Host *HBA_ptr; + char *p; + int host, channel, id, lun; + char * buffer; + int err; + + if (!buf || length>PAGE_SIZE) + return -EINVAL; + + if (!(buffer = (char *) __get_free_page(GFP_KERNEL))) + return -ENOMEM; + copy_from_user(buffer, buf, length); + + err = -EINVAL; + if (length < 11 || strncmp("scsi", buffer, 4)) + goto out; /* * Usage: echo "scsi dump #N" > /proc/scsi/scsi @@ -2171,7 +2253,7 @@ p = buffer + 10; if (*p == '\0') - return (-EINVAL); + goto out; level = simple_strtoul(p, NULL, 0); scsi_dump_status(level); @@ -2205,7 +2287,7 @@ */ scsi_logging_level = 0; } else { - return (-EINVAL); + goto out; } } else { *p++ = '\0'; @@ -2236,7 +2318,7 @@ } else if (strcmp(token, "ioctl") == 0) { SCSI_SET_IOCTL_LOGGING(level); } else { - return (-EINVAL); + goto out; } } @@ -2271,8 +2353,9 @@ break; } } + err = -ENXIO; if (!HBA_ptr) - return (-ENXIO); + goto out; for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { if ((scd->channel == channel @@ -2282,8 +2365,9 @@ } } + err = -ENOSYS; if (scd) - return (-ENOSYS); /* We do not yet support unplugging */ + goto out; /* We do not yet support unplugging */ scan_scsis(HBA_ptr, 1, channel, id, lun); @@ -2293,8 +2377,8 @@ if (HBA_ptr->select_queue_depths != NULL) (HBA_ptr->select_queue_depths) (HBA_ptr, HBA_ptr->host_queue); - return (length); - + err = length; + goto out; } /* * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi @@ -2321,8 +2405,9 @@ break; } } + err = -ENODEV; if (!HBA_ptr) - return (-ENODEV); + goto out; for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { if ((scd->channel == channel @@ -2333,10 +2418,11 @@ } if (scd == NULL) - return (-ENODEV); /* there is no such device attached */ + goto out; /* there is no such device attached */ + err = -EBUSY; if (scd->access_count) - return (-EBUSY); + goto out; SDTpnt = scsi_devicelist; while (SDTpnt != NULL) { @@ -2366,11 +2452,14 @@ } scsi_init_free((char *) scd, sizeof(Scsi_Device)); } else { - return (-EBUSY); + goto out; } - return (0); + err = 0; } - return (-EINVAL); +out: + + free_page((unsigned long) buffer); + return err; } #endif @@ -2746,6 +2835,7 @@ struct Scsi_Host *shpnt; Scsi_Host_Template *SHT; Scsi_Host_Template *SHTp; + char name[10]; /* host_no>=10^9? I don't think so. */ /* * First verify that this host adapter is completely free with no pending @@ -2887,7 +2977,8 @@ continue; pcount = next_scsi_host; /* Remove the /proc/scsi directory entry */ - remove_proc_entry(shpnt->proc_name, tpnt->proc_dir); + sprintf(name,"%d",shpnt->host_no); + remove_proc_entry(name, tpnt->proc_dir); if (tpnt->release) (*tpnt->release) (shpnt); else { @@ -3238,6 +3329,7 @@ { unsigned long size; int has_space = 0; + struct proc_dir_entry *generic; /* * This makes /proc/scsi and /proc/scsi/scsi visible. @@ -3248,7 +3340,13 @@ printk (KERN_ERR "cannot init /proc/scsi\n"); return -ENOMEM; } - create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + generic = create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + if (!generic) { + printk (KERN_ERR "cannot init /proc/scsi/scsi\n"); + remove_proc_entry("scsi", 0); + return -ENOMEM; + } + generic->write_proc = proc_scsi_gen_write; #endif scsi_loadable_module_flag = 1; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/scsi_proc.c linux/drivers/scsi/scsi_proc.c --- v2.3.28/linux/drivers/scsi/scsi_proc.c Thu Nov 11 20:11:48 1999 +++ linux/drivers/scsi/scsi_proc.c Thu Nov 18 20:01:27 1999 @@ -118,6 +118,7 @@ void build_proc_dir_entries(Scsi_Host_Template * tpnt) { struct Scsi_Host *hpnt; + char name[10]; /* see scsi_unregister_host() */ tpnt->proc_dir = create_proc_entry(tpnt->proc_name, S_IFDIR, proc_scsi); tpnt->proc_dir->owner = tpnt->module; @@ -126,7 +127,8 @@ while (hpnt) { if (tpnt == hpnt->hostt) { struct proc_dir_entry *p; - p = create_proc_read_entry(hpnt->proc_name, + sprintf(name,"%d",hpnt->host_no); + p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, tpnt->proc_dir, proc_scsi_read, diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/scsicam.c linux/drivers/scsi/scsicam.c --- v2.3.28/linux/drivers/scsi/scsicam.c Mon Oct 4 15:49:30 1999 +++ linux/drivers/scsi/scsicam.c Thu Nov 18 19:09:14 1999 @@ -42,18 +42,20 @@ kdev_t dev, /* Device major, minor */ int *ip /* Heads, sectors, cylinders in that order */ ) { - struct buffer_head *bh; int ret_code; int size = disk->capacity; unsigned long temp_cyl; + int ma = MAJOR(dev); + int mi = (MINOR(dev) & ~0xf); + int block = 1024; - if(blksize_size[MAJOR(dev)]) - block = blksize_size[MAJOR(dev)][MINOR(dev)]; + if(blksize_size[ma]) + block = blksize_size[ma][mi]; - if (!(bh = bread(MKDEV(MAJOR(dev), MINOR(dev) & ~0xf), 0, block))) + if (!(bh = bread(MKDEV(ma,mi), 0, block))) return -1; /* try to infer mapping from partition table */ diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/seagate.c linux/drivers/scsi/seagate.c --- v2.3.28/linux/drivers/scsi/seagate.c Thu Nov 11 20:11:48 1999 +++ linux/drivers/scsi/seagate.c Fri Nov 19 11:30:54 1999 @@ -245,10 +245,10 @@ static int irq = IRQ; #define retcode(result) (((result) << 16) | (message << 8) | status) -#define STATUS ((u8) readb(st0x_cr_sr)) -#define DATA ((u8) readb(st0x_dr)) -#define WRITE_CONTROL(d) { writeb((d), st0x_cr_sr); } -#define WRITE_DATA(d) { writeb((d), st0x_dr); } +#define STATUS ((u8) isa_readb(st0x_cr_sr)) +#define DATA ((u8) isa_readb(st0x_dr)) +#define WRITE_CONTROL(d) { isa_writeb((d), st0x_cr_sr); } +#define WRITE_DATA(d) { isa_writeb((d), st0x_dr); } void st0x_setup (char *str, int *ints) { @@ -447,7 +447,7 @@ for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i) for (j = 0; !base_address && j < NUM_SIGNATURES; ++j) - if (check_signature (seagate_bases[i] + signatures[j].offset, + if (isa_check_signature (seagate_bases[i] + signatures[j].offset, signatures[j].signature, signatures[j].length)) { base_address = seagate_bases[i]; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/sim710.c linux/drivers/scsi/sim710.c --- v2.3.28/linux/drivers/scsi/sim710.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/scsi/sim710.c Fri Nov 19 11:30:54 1999 @@ -58,11 +58,10 @@ * */ -#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s)) - #include #include +#include #include #include #include @@ -74,9 +73,9 @@ #include #include #include -#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17) #include -#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93) #include #endif #include @@ -291,8 +290,9 @@ static void process_issue_queue (struct sim710_hostdata *, unsigned long flags); static int full_reset(struct Scsi_Host * host); + /* - * Function: void sim710_setup(char *str, int *ints) + * Function: int param_setup(char *str) */ #ifdef MODULE @@ -301,8 +301,8 @@ #define ARG_SEP ',' #endif -void -sim710_setup(char *str, int *ints) +static int +param_setup(char *str) { char *cur = str; char *pc, *pv; @@ -340,7 +340,7 @@ opt_noneg = val; else if (!strncmp(cur, "disabled:", 5)) { no_of_boards = -1; - return; + return 1; } #ifdef DEBUG else if (!strncmp(cur, "debug:", 6)) { @@ -348,19 +348,28 @@ } #endif else - printk("sim710_setup: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur); + printk("sim710: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur); if ((cur = strchr(cur, ARG_SEP)) != NULL) ++cur; } + return 1; } -#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) #ifndef MODULE -__setup("sim710=", sim710_setup); +__setup("sim710=", param_setup); #endif +#else +/* Old boot param syntax support */ +void +sim710_setup(char *str, int *ints) +{ + param_setup(str); +} #endif + /* * Function: static const char *sbcl_to_phase (int sbcl) */ @@ -1324,7 +1333,7 @@ #ifdef MODULE if (sim710) - sim710_setup(sim710, (int *)0); + param_setup(sim710); #endif if (no_of_boards < 0) { @@ -1462,7 +1471,7 @@ host->irq = irq_vector; host->this_id = scsi_id; host->unique_id = base_addr; - host->base = (char *)base_addr; + host->base = base_addr; ncr_halt(host); diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/sym53c8xx.c linux/drivers/scsi/sym53c8xx.c --- v2.3.28/linux/drivers/scsi/sym53c8xx.c Thu Nov 11 20:11:49 1999 +++ linux/drivers/scsi/sym53c8xx.c Mon Nov 22 11:02:36 1999 @@ -5474,7 +5474,7 @@ instance->max_id = np->maxwide ? 16 : 8; instance->max_lun = MAX_LUN; #ifndef NCR_IOMAPPED - instance->base = (char *) np->reg; + instance->base = (unsigned long)np->reg; #endif instance->irq = np->irq; instance->unique_id = np->base_io; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/t128.c linux/drivers/scsi/t128.c --- v2.3.28/linux/drivers/scsi/t128.c Thu Nov 11 20:11:49 1999 +++ linux/drivers/scsi/t128.c Fri Nov 19 11:30:54 1999 @@ -122,14 +122,14 @@ #include static struct override { - unsigned char *address; + unsigned long address; int irq; } overrides #ifdef T128_OVERRIDE [] __initdata = T128_OVERRIDE; #else - [4] __initdata = {{NULL,IRQ_AUTO}, {NULL,IRQ_AUTO}, - {NULL,IRQ_AUTO}, {NULL,IRQ_AUTO}}; + [4] __initdata = {{0, IRQ_AUTO}, {0, IRQ_AUTO}, + {0 ,IRQ_AUTO}, {0, IRQ_AUTO}}; #endif #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) @@ -169,7 +169,7 @@ printk("t128_setup : usage t128=address,irq\n"); else if (commandline_current < NO_OVERRIDES) { - overrides[commandline_current].address = (unsigned char *) ints[1]; + overrides[commandline_current].address = ints[1]; overrides[commandline_current].irq = ints[2]; for (i = 0; i < NO_BASES; ++i) if (bases[i].address == ints[1]) { @@ -196,14 +196,14 @@ int __init t128_detect(Scsi_Host_Template * tpnt){ static int current_override = 0, current_base = 0; struct Scsi_Host *instance; - unsigned char *base; + unsigned long base; int sig, count; tpnt->proc_name = "t128"; tpnt->proc_info = &t128_proc_info; for (count = 0; current_override < NO_OVERRIDES; ++current_override) { - base = NULL; + base = 0; if (overrides[current_override].address) base = overrides[current_override].address; @@ -214,11 +214,11 @@ #endif for (sig = 0; sig < NO_SIGNATURES; ++sig) if (!bases[current_base].noauto && - check_signature(bases[current_base].address + + isa_check_signature(bases[current_base].address + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) { - base = (unsigned char *) bases[current_base].address; + base = bases[current_base].address; #if (TDEBUG & TDEBUG_INIT) printk("scsi-t128 : detected board.\n"); #endif @@ -234,7 +234,7 @@ break; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); - instance->base = phys_to_virt((unsigned int)base); + instance->base = base; NCR5380_init(instance, 0); @@ -259,8 +259,7 @@ printk("scsi%d : irq = %d\n", instance->host_no, instance->irq); #endif - printk("scsi%d : at 0x%08x", instance->host_no, (int) - instance->base); + printk("scsi%d : at 0x%08lx", instance->host_no, instance->base); if (instance->irq == IRQ_NONE) printk (" interrupts disabled"); else @@ -320,28 +319,28 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, int len) { - register unsigned char *reg = (unsigned char *) (instance->base + - T_DATA_REG_OFFSET), *d = dst; + unsigned long reg = instance->base + T_DATA_REG_OFFSET; + unsigned char *d = dst; register int i = len; #if 0 for (; i; --i) { - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); #else - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); for (; i; --i) { #endif - *d++ = *reg; + *d++ = isa_readb(reg); } - if (*(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { + if (isa_readb(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { unsigned char tmp; - volatile unsigned char *foo; + unsigned long foo; foo = instance->base + T_CONTROL_REG_OFFSET; - tmp = *foo; - *foo = tmp | T_CR_CT; - *foo = tmp; + tmp = isa_readb(foo); + isa_writeb(tmp | T_CR_CT, foo); + isa_writeb(tmp, foo); printk("scsi%d : watchdog timer fired in NCR5380_pread()\n", instance->host_no); return -1; @@ -364,27 +363,27 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src, int len) { - register unsigned char *reg = (unsigned char *) (instance->base + - T_DATA_REG_OFFSET), *s = src; + unsigned long reg = instance->base + T_DATA_REG_OFFSET; + unsigned char *s = src; register int i = len; #if 0 for (; i; --i) { - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); #else - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); for (; i; --i) { #endif - *reg = *s++; + isa_writeb(*s++, reg); } - if (*(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { + if (isa_readb(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { unsigned char tmp; - volatile unsigned char *foo; + unsigned long foo; foo = instance->base + T_CONTROL_REG_OFFSET; - tmp = *foo; - *foo = tmp | T_CR_CT; - *foo = tmp; + tmp = isa_readb(foo); + isa_writeb(tmp | T_CR_CT, foo); + isa_writeb(tmp, foo); printk("scsi%d : watchdog timer fired in NCR5380_pwrite()\n", instance->host_no); return -1; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/t128.h linux/drivers/scsi/t128.h --- v2.3.28/linux/drivers/scsi/t128.h Sat Apr 11 11:13:25 1998 +++ linux/drivers/scsi/t128.h Fri Nov 19 11:30:54 1999 @@ -137,28 +137,28 @@ #ifndef HOSTS_C #define NCR5380_implementation_fields \ - volatile unsigned char *base + unsigned long base #define NCR5380_local_declare() \ - volatile unsigned char *base + unsigned long base #define NCR5380_setup(instance) \ - base = (volatile unsigned char *) (instance)->base + base = (instance)->base #define T128_address(reg) (base + T_5380_OFFSET + ((reg) * 0x20)) #if !(TDEBUG & TDEBUG_TRANSFER) -#define NCR5380_read(reg) (*(T128_address(reg))) -#define NCR5380_write(reg, value) (*(T128_address(reg)) = (value)) +#define NCR5380_read(reg) isa_readb(T128_address(reg)) +#define NCR5380_write(reg, value) isa_writeb((value),(T128_address(reg))) #else #define NCR5380_read(reg) \ (((unsigned char) printk("scsi%d : read register %d at address %08x\n"\ - , instance->hostno, (reg), T128_address(reg))), *(T128_address(reg))) + , instance->hostno, (reg), T128_address(reg))), isa_readb(T128_address(reg))) #define NCR5380_write(reg, value) { \ printk("scsi%d : write %02x to register %d at address %08x\n", \ instance->hostno, (value), (reg), T128_address(reg)); \ - *(T128_address(reg)) = (value); \ + isa_writeb((value), (T128_address(reg))); \ } #endif diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/wd33c93.c linux/drivers/scsi/wd33c93.c --- v2.3.28/linux/drivers/scsi/wd33c93.c Mon Aug 9 12:33:30 1999 +++ linux/drivers/scsi/wd33c93.c Tue Nov 23 10:29:16 1999 @@ -77,12 +77,7 @@ #include #include #include - -#if LINUX_VERSION_CODE >= 0x010300 #include -#else -#include "../block/blk.h" -#endif #include "scsi.h" #include "hosts.h" @@ -1404,11 +1399,7 @@ -#if LINUX_VERSION_CODE >= 0x010300 int wd33c93_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags) -#else -int wd33c93_reset(Scsi_Cmnd *SCpnt) -#endif { struct Scsi_Host *instance; struct WD33C93_hostdata *hostdata; diff -u --recursive --new-file v2.3.28/linux/drivers/scsi/wd33c93.h linux/drivers/scsi/wd33c93.h --- v2.3.28/linux/drivers/scsi/wd33c93.h Thu Nov 18 20:25:37 1999 +++ linux/drivers/scsi/wd33c93.h Tue Nov 23 10:29:16 1999 @@ -340,11 +340,6 @@ int wd33c93_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)); void wd33c93_intr (struct Scsi_Host *instance); int wd33c93_proc_info(char *, char **, off_t, int, int, int); - -#if LINUX_VERSION_CODE >= 0x010300 int wd33c93_reset (Scsi_Cmnd *, unsigned int); -#else -int wd33c93_reset (Scsi_Cmnd *); -#endif #endif /* WD33C93_H */ diff -u --recursive --new-file v2.3.28/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c --- v2.3.28/linux/drivers/sound/soundcard.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/sound/soundcard.c Sun Nov 21 11:13:56 1999 @@ -152,7 +152,7 @@ return 0; } -static int sound_proc_get_info(char *buffer, char **start, off_t offset, int length, int inout) +static int sound_proc_get_info(char *buffer, char **start, off_t offset, int length) { int len, i, drv; off_t pos = 0; @@ -325,7 +325,7 @@ count = MIN(PROC_BLOCK_SIZE, nbytes); start = NULL; - n = sound_proc_get_info(page, &start, *ppos, count, 0); + n = sound_proc_get_info(page, &start, *ppos, count); if (n < count) eof = 1; @@ -382,6 +382,7 @@ switch (dev & 0x0f) { case SND_DEV_STATUS: ret = sndstat_file_read(file, buf, count, ppos); + break; #ifdef CONFIG_AUDIO case SND_DEV_DSP: diff -u --recursive --new-file v2.3.28/linux/drivers/usb/Config.in linux/drivers/usb/Config.in --- v2.3.28/linux/drivers/usb/Config.in Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/Config.in Sat Nov 20 10:11:27 1999 @@ -1,14 +1,10 @@ # # USB device configuration # -# NOTE NOTE NOTE! This is still considered extremely experimental. -# Right now hubs, mice and keyboards work - at least with UHCI. -# But that may be more a lucky coincidence than anything else.. -# mainmenu_option next_comment -comment 'USB drivers - not for the faint of heart' +comment 'Support for USB' -tristate 'Support for USB (EXPERIMENTAL!)' CONFIG_USB +tristate 'Support for USB' CONFIG_USB if [ ! "$CONFIG_USB" = "n" ]; then comment 'USB Controllers' dep_tristate ' UHCI (Intel PIIX4 and others) support' CONFIG_USB_UHCI \ diff -u --recursive --new-file v2.3.28/linux/drivers/usb/README.dc2xx linux/drivers/usb/README.dc2xx --- v2.3.28/linux/drivers/usb/README.dc2xx Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/README.dc2xx Thu Nov 18 20:34:10 1999 @@ -1,4 +1,4 @@ -3 November 1999 +13 November 1999 david-b@pacbell.net This is an overview of how to use the "dc2xx" USB driver with certain @@ -15,13 +15,14 @@ (www.gphoto.org), since version 0.4 and later know how to use it to talk to Kodak DC-240 and DC-280 cameras over USB. -The DC-260 is currently recognized. However, like other cameras using the -"Digita OS" (from www.flashpoint.com) there is no application software -(such as gPhoto) support for this camera. Until it's available, those -cameras aren't much use with Linux; when it's available, this driver -should be able to handle the cameras' communication requirements. Today, -that's six more cameras. From Kodak: DC-220, DC-260, DC-265, DC-290. -Minolta has the Dimage EX-1500; HP, the PhotoSmart C500. +In addition the DC-260, DC-265, and DC-290 are currently recognized. +However, like other cameras using the "Digita OS" (from www.flashpoint.com) +there is no gPhoto support for this camera. At this writing the best +known support for these cameras is a Python script that supports image +downloading from those cameras. (See archives of the linux-usb mailing +list.) The DC-220 should also work with this driver, given information +about the USB product IDs. When it becomes available, the HP PhotoSmart +C500 should also work ... it's another Digita OS camera with USB support.) It's likely that other digital still cameras can also use this USB driver, even if they're not from Kodak and don't use Digita. The reason is that @@ -34,7 +35,11 @@ This has been shown to work on x86 OHCI and UHCI (Intel) chipsets. OHCI has been trouble free; not so with UHCI, which was first seen to be happy with -2.3.24 kernels. +2.3.24 kernels, and has not been as fast as OHCI. + +Note that in some cases changes in BIOS settings may be needed before +your USB works. At least one user has reported a need for SMP-related +settings as well. As yet, no reports have come from Linux users on non-Intel hardware. (You could color coordinate your iMac with a DC-240i ... :-) @@ -88,7 +93,7 @@ USB new device connect, assigned device number 1 Manufacturer: Eastman Kodak Company Product: KODAK DC240 Zoom Digital Camera - USB Camera (Kodak DC-240) is connected + USB Camera is connected usbcore: dc2xx driver claimed interface c3a68600 ohci-control thread sleeping diff -u --recursive --new-file v2.3.28/linux/drivers/usb/cpia.c linux/drivers/usb/cpia.c --- v2.3.28/linux/drivers/usb/cpia.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/cpia.c Fri Nov 19 12:21:43 1999 @@ -26,7 +26,8 @@ #include "usb.h" #include "cpia.h" -#define CPIA_DEBUG /* Gobs of debugging info */ +static int debug = 0; +MODULE_PARM(debug, "i"); /* Video Size 384 x 288 x 3 bytes for RGB */ /* 384 because xawtv tries to grab 384 even though we tell it 352 is our max */ @@ -295,7 +296,8 @@ { struct cpia_frame *frame, *pframe; unsigned char *data = cpia->scratch; - unsigned long l; + unsigned long left; + long copylen = 0; /* Grab the current frame and the previous frame */ frame = &cpia->frame[cpia->curframe]; @@ -310,7 +312,7 @@ { struct cpia_frame_header *header; - /* We need atleast 2 bytes for the magic value */ + /* We need at least 2 bytes for the magic value */ if (scratch_left(data) < 2) goto out; @@ -329,7 +331,8 @@ while (scratch_left(data) >= 4) { if (*((__u32 *)data) == 0xFFFFFFFF) { data += 4; - printk(KERN_INFO "cpia: EOF while scanning for magic\n"); + if (debug >= 1) + printk(KERN_INFO "cpia: EOF while scanning for magic\n"); goto error; } data++; @@ -337,7 +340,7 @@ break; } case STATE_HEADER: - /* We need atleast 64 bytes for the header */ + /* We need at least 64 bytes for the header */ if (scratch_left(data) < sizeof(struct cpia_frame_header)) goto out; @@ -352,16 +355,17 @@ frame->header.col_start) * 8; frame->hdrheight = (frame->header.row_end - frame->header.row_start) * 4; -#ifdef CPIA_DEBUG - printk("cpia: frame size %dx%d\n", - frame->hdrwidth, frame->hdrheight); - printk("cpia: frame %scompressed\n", - frame->header.comp_enable ? "" : "not "); -#endif + if (debug >= 2) { + printk(KERN_DEBUG "cpia: frame size %dx%d\n", + frame->hdrwidth, frame->hdrheight); + printk(KERN_DEBUG "cpia: frame %scompressed\n", + frame->header.comp_enable ? "" : "not "); + } frame->scanstate = STATE_LINES; frame->curline = 0; break; + case STATE_LINES: { unsigned char *f, *end; @@ -378,7 +382,8 @@ /* Check to make sure it's nothing outrageous */ if (len > (frame->hdrwidth * 2) + 1) { - printk(KERN_INFO "cpia: bad length, resynching (expected %d, got %d)\n", (frame->hdrwidth * 2) + 1, len); + if (debug >= 1) + printk(KERN_DEBUG "cpia: bad length, resynching (expected %d, got %d)\n", (frame->hdrwidth * 2) + 1, len); goto error; } @@ -391,7 +396,8 @@ /* Is the end of the line there */ if (data[len - 1] != 0xFD) { - printk(KERN_INFO "cpia: lost synch\n"); + if (debug >= 1) + printk(KERN_DEBUG "cpia: lost synch\n"); goto error; } @@ -412,6 +418,7 @@ /* Compress RLE data */ i = *data >> 1; memcpy(f, fp, i * 3); + copylen += (i * 3); f += (i * 3); fp += (i * 3); data++; @@ -432,6 +439,7 @@ *f++ = LIMIT(b + y); *f++ = LIMIT(g + y); *f++ = LIMIT(r + y); *f++ = LIMIT(b + y1); *f++ = LIMIT(g + y1); *f++ = LIMIT(r + y1); fp += 6; + copylen += 6; } } } else { @@ -448,15 +456,10 @@ y1 *= 76310; *f++ = LIMIT(b + y); *f++ = LIMIT(g + y); *f++ = LIMIT(r + y); *f++ = LIMIT(b + y1); *f++ = LIMIT(g + y1); *f++ = LIMIT(r + y1); +copylen += 6; } } -#ifdef CPIA_DEBUG - /* Make sure we found the end correctly */ - if (*data != 0xFD) - printk("cpia: missed end!\n"); -#endif - /* Skip the last byte */ data++; @@ -464,43 +467,48 @@ goto nextframe; break; - } - } - } + } /* end case STATE_LINES */ + } /* end switch (scanstate) */ + } /* end while (1) */ nextframe: -#ifdef CPIA_DEBUG - printk("cpia: marking as success\n"); -#endif + if (debug >= 1) + printk(KERN_DEBUG "cpia: marking as success\n"); + if (scratch_left(data) >= 4 && *((__u32 *)data) == 0xFFFFFFFF) data += 4; frame->grabstate = FRAME_DONE; - cpia->curframe = -1; - /* This will cause the process to request another frame */ - if (waitqueue_active(&frame->wq)) - wake_up_interruptible(&frame->wq); - - goto out; + goto wakeup; error: -#ifdef CPIA_DEBUG - printk("cpia: marking as error\n"); -#endif + if (debug >= 1) + printk(KERN_DEBUG "cpia: marking as error\n"); + frame->grabstate = FRAME_ERROR; - cpia->curframe = -1; + + /* Get a fresh frame since this frame may have been important */ cpia->compress = 0; - /* This will cause the process to request another frame */ + copylen = 0; + +wakeup: + + cpia->curframe = -1; + + /* This will cause the process to request another frame. */ if (waitqueue_active(&frame->wq)) wake_up_interruptible(&frame->wq); out: /* Grab the remaining */ - l = scratch_left(data); - memmove(cpia->scratch, data, l); - cpia->scratchlen = l; + left = scratch_left(data); + memmove(cpia->scratch, data, left); + cpia->scratchlen = left; + + /* Update the frame's uncompressed length. */ + frame->scanlength += copylen; } /* @@ -515,24 +523,23 @@ data = cpia->scratch + cpia->scratchlen; for (i = 0; i < isodesc->frame_count; i++) { int n = isodesc->frames[i].frame_length; -#ifdef CPIA_DEBUG int st = isodesc->frames[i].frame_status; - if (st) + if (st && debug >= 1) printk(KERN_DEBUG "cpia data error: [%d] len=%d, status=%X\n", i, n, st); -#endif + if ((cpia->scratchlen + n) > SCRATCH_BUF_SIZE) { - printk(KERN_ERR "cpia: scratch buf overflow!\n"); - return 0; + printk(KERN_DEBUG "cpia: scratch buf overflow!\n"); + return totlen; } - if (n) + if (n) { memmove(data, cdata, n); - - data += n; - totlen += n; - cpia->scratchlen += n; + data += n; + totlen += n; + cpia->scratchlen += n; + } cdata += isodesc->frame_size; } @@ -547,7 +554,8 @@ int i; if (!cpia->streaming) { - printk("cpia: oops, not streaming, but interrupt\n"); + if (debug >= 1) + printk(KERN_DEBUG "cpia: oops, not streaming, but interrupt\n"); return 0; } @@ -558,10 +566,11 @@ len = cpia_compress_isochronous(cpia, sbuf->isodesc); /* If we don't have a frame we're current working on, complain */ - if (len) { - if (cpia->curframe < 0) - printk("cpia: received data, but no frame available\n"); - else + if (cpia->scratchlen) { + if (cpia->curframe < 0) { + if (debug >= 1) + printk(KERN_DEBUG "cpia: received data, but no frame available\n"); + } else cpia_parse_data(cpia); } @@ -583,6 +592,7 @@ struct usb_isoc_desc *id; int fx, err; + cpia->compress = 0; cpia->curframe = -1; cpia->cursbuf = 0; cpia->scratchlen = 0; @@ -597,7 +607,7 @@ err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, cpia, &cpia->sbuf[0].isodesc); if (err) { - printk(KERN_ERR "cpia_init_isoc: usb_init_isoc() ret %d\n", + printk(KERN_ERR "cpia_init_isoc: usb_init_isoc ret %d\n", err); return -ENOMEM; } @@ -605,17 +615,12 @@ err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, cpia, &cpia->sbuf[1].isodesc); if (err) { - printk(KERN_ERR "cpia_init_isoc: usb_init_isoc() ret %d\n", + printk(KERN_ERR "cpia_init_isoc: usb_init_isoc ret %d\n", err); usb_free_isoc (cpia->sbuf[0].isodesc); return -ENOMEM; } -#ifdef CPIA_DEBUG - printk("isodesc[0] @ %p\n", cpia->sbuf[0].isodesc); - printk("isodesc[1] @ %p\n", cpia->sbuf[1].isodesc); -#endif - /* Set the Isoc. desc. parameters. */ /* First for desc. [0] */ id = cpia->sbuf[0].isodesc; @@ -639,10 +644,12 @@ err = usb_run_isoc(cpia->sbuf[0].isodesc, NULL); if (err) - printk(KERN_ERR "CPiA USB driver error (%d) on usb_run_isoc\n", err); + printk(KERN_ERR "cpia_init_isoc: usb_run_isoc ret %d\n", + err); err = usb_run_isoc(cpia->sbuf[1].isodesc, cpia->sbuf[0].isodesc); if (err) - printk(KERN_ERR "CPiA USB driver error (%d) on usb_run_isoc\n", err); + printk(KERN_ERR "cpia_init_isoc: usb_run_isoc ret %d\n", + err); cpia->streaming = 1; @@ -656,13 +663,13 @@ /* Turn off continuous grab */ if (usb_cpia_set_grab_mode(cpia->dev, 0) < 0) { - printk(KERN_INFO "cpia_set_grab_mode error\n"); + printk(KERN_ERR "cpia_set_grab_mode error\n"); return /* -EBUSY */; } /* Set packet size to 0 */ if (usb_set_interface(cpia->dev, 1, 0) < 0) { - printk(KERN_INFO "usb_set_interface error\n"); + printk(KERN_ERR "usb_set_interface error\n"); return /* -EINVAL */; } @@ -696,6 +703,7 @@ frame->grabstate = FRAME_GRABBING; frame->scanstate = STATE_SCANNING; + frame->scanlength = 0; /* accumulated in cpia_parse_data() */ cpia->curframe = framenum; @@ -714,7 +722,7 @@ if (usb_cpia_set_compression(cpia->dev, cpia->compress ? COMP_AUTO : COMP_DISABLED, DONT_DECIMATE) < 0) { - printk(KERN_INFO "cpia_set_compression error\n"); + printk(KERN_ERR "cpia_set_compression error\n"); return -EBUSY; } @@ -723,7 +731,7 @@ /* Grab the frame */ if (usb_cpia_upload_frame(cpia->dev, WAIT_FOR_NEXT_FRAME) < 0) { - printk(KERN_INFO "cpia_upload_frame error\n"); + printk(KERN_ERR "cpia_upload_frame error\n"); return -EBUSY; } @@ -733,16 +741,18 @@ /* Video 4 Linux API */ static int cpia_open(struct video_device *dev, int flags) { - int err = -ENOMEM; + int err = -EBUSY; struct usb_cpia *cpia = (struct usb_cpia *)dev; -#ifdef CPIA_DEBUG - printk("cpia_open\n"); -#endif + down(&cpia->lock); + if (cpia->user) + goto out_unlock; cpia->frame[0].grabstate = FRAME_UNUSED; cpia->frame[1].grabstate = FRAME_UNUSED; + err = -ENOMEM; + /* Allocate memory for the frame buffers */ cpia->fbuf = rvmalloc(2 * MAX_FRAME_SIZE); if (!cpia->fbuf) @@ -750,10 +760,6 @@ cpia->frame[0].data = cpia->fbuf; cpia->frame[1].data = cpia->fbuf + MAX_FRAME_SIZE; -#ifdef CPIA_DEBUG - printk("frame [0] @ %p\n", cpia->frame[0].data); - printk("frame [1] @ %p\n", cpia->frame[1].data); -#endif cpia->sbuf[0].data = kmalloc (FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL); if (!cpia->sbuf[0].data) @@ -763,15 +769,22 @@ if (!cpia->sbuf[1].data) goto open_err_on1; -#ifdef CPIA_DEBUG - printk("sbuf[0] @ %p\n", cpia->sbuf[0].data); - printk("sbuf[1] @ %p\n", cpia->sbuf[1].data); -#endif + /* Set default sizes in case IOCTL (VIDIOCMCAPTURE) is not used + * (using read() instead). */ + cpia->frame[0].width = 352; + cpia->frame[0].height = 288; + cpia->frame[0].bytes_read = 0; + cpia->frame[1].width = 352; + cpia->frame[1].height = 288; + cpia->frame[1].bytes_read = 0; err = cpia_init_isoc(cpia); if (err) goto open_err_on2; + cpia->user++; + up(&cpia->lock); + MOD_INC_USE_COUNT; return 0; @@ -784,15 +797,18 @@ rvfree(cpia->fbuf, 2 * MAX_FRAME_SIZE); open_err_ret: return err; + +out_unlock: + up(&cpia->lock); + return err; } static void cpia_close(struct video_device *dev) { struct usb_cpia *cpia = (struct usb_cpia *)dev; -#ifdef CPIA_DEBUG - printk("cpia_close\n"); -#endif + down(&cpia->lock); + cpia->user--; MOD_DEC_USE_COUNT; @@ -802,6 +818,8 @@ kfree(cpia->sbuf[1].data); kfree(cpia->sbuf[0].data); + + up(&cpia->lock); } static int cpia_init_done(struct video_device *dev) @@ -823,10 +841,6 @@ { struct video_capability b; -#ifdef CPIA_DEBUG - printk("GCAP\n"); -#endif - strcpy(b.name, "CPiA USB Camera"); b.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE; b.channels = 1; @@ -845,10 +859,6 @@ { struct video_channel v; -#ifdef CPIA_DEBUG - printk("GCHAN\n"); -#endif - if (copy_from_user(&v, arg, sizeof(v))) return -EFAULT; if (v.channel != 0) @@ -861,16 +871,13 @@ if (copy_to_user(arg, &v, sizeof(v))) return -EFAULT; + return 0; } case VIDIOCSCHAN: { int v; -#ifdef CPIA_DEBUG - printk("SCHAN\n"); -#endif - if (copy_from_user(&v, arg, sizeof(v))) return -EFAULT; @@ -883,10 +890,6 @@ { struct video_picture p; -#ifdef CPIA_DEBUG - printk("GPICT\n"); -#endif - p.colour = 0x8000; /* Damn British people :) */ p.hue = 0x8000; p.brightness = 180 << 8; /* XXX */ @@ -904,39 +907,24 @@ { struct video_picture p; -#ifdef CPIA_DEBUG - printk("SPICT\n"); -#endif - if (copy_from_user(&p, arg, sizeof(p))) return -EFAULT; -#ifdef CPIA_DEBUG - printk("Attempting to set palette %d, depth %d\n", - p.palette, p.depth); - printk("SPICT: brightness=%d, hue=%d, colour=%d, contrast=%d, whiteness=%d\n", - p.brightness, p.hue, p.colour, p.contrast, p.whiteness); -#endif - return 0; } case VIDIOCSWIN: { struct video_window vw; -#ifdef CPIA_DEBUG - printk("SWIN\n"); -#endif - if (copy_from_user(&vw, arg, sizeof(vw))) return -EFAULT; if (vw.flags) return -EINVAL; if (vw.clipcount) return -EINVAL; - if (vw.height != 176) + if (vw.height != 288) return -EINVAL; - if (vw.width != 144) + if (vw.width != 352) return -EINVAL; cpia->compress = 0; @@ -947,16 +935,12 @@ { struct video_window vw; -#ifdef CPIA_DEBUG - printk("GWIN\n"); -#endif - vw.x = 0; vw.y = 0; - vw.width = 176; - vw.height = 144; + vw.width = 352; + vw.height = 288; vw.chromakey = 0; - vw.flags = 0; + vw.flags = 30; /* 30 fps */ if (copy_to_user(arg, &vw, sizeof(vw))) return -EFAULT; @@ -966,9 +950,6 @@ case VIDIOCGMBUF: { struct video_mbuf vm; -#ifdef CPIA_DEBUG - printk("MBUF\n"); -#endif memset(&vm, 0, sizeof(vm)); vm.size = MAX_FRAME_SIZE * 2; @@ -988,11 +969,9 @@ if (copy_from_user((void *)&vm, (void *)arg, sizeof(vm))) return -EFAULT; -#ifdef CPIA_DEBUG - printk("MCAPTURE\n"); - printk("frame: %d, size: %dx%d, format: %d\n", - vm.frame, vm.width, vm.height, vm.format); -#endif + if (debug >= 1) + printk(KERN_DEBUG "frame: %d, size: %dx%d, format: %d\n", + vm.frame, vm.width, vm.height, vm.format); if (vm.format != VIDEO_PALETTE_RGB24) return -EINVAL; @@ -1020,16 +999,11 @@ { int frame; -#ifdef CPIA_DEBUG - printk("SYNC\n"); -#endif - if (copy_from_user((void *)&frame, arg, sizeof(int))) return -EFAULT; -#ifdef CPIA_DEBUG - printk("cpia: syncing to frame %d\n", frame); -#endif + if (debug >= 1) + printk(KERN_DEBUG "cpia: syncing to frame %d\n", frame); switch (cpia->frame[frame].grabstate) { case FRAME_UNUSED: @@ -1039,15 +1013,15 @@ case FRAME_ERROR: redo: do { +#if 0 init_waitqueue_head(&cpia->frame[frame].wq); +#endif interruptible_sleep_on(&cpia->frame[frame].wq); if (signal_pending(current)) return -EINTR; - } while (cpia->frame[frame].grabstate == - FRAME_GRABBING); + } while (cpia->frame[frame].grabstate == FRAME_GRABBING); - if (cpia->frame[frame].grabstate == - FRAME_ERROR) { + if (cpia->frame[frame].grabstate == FRAME_ERROR) { int ret; if ((ret = cpia_new_frame(cpia, frame)) < 0) @@ -1059,9 +1033,6 @@ break; } -#ifdef CPIA_DEBUG - printk("cpia: finished, synced to frame %d\n", frame); -#endif cpia->frame[frame].grabstate = FRAME_UNUSED; return 0; @@ -1070,10 +1041,6 @@ { struct video_buffer vb; -#ifdef CPIA_DEBUG - printk("GFBUF\n"); -#endif - memset(&vb, 0, sizeof(vb)); vb.base = NULL; /* frame buffer not supported, not used */ @@ -1105,15 +1072,81 @@ static long cpia_read(struct video_device *dev, char *buf, unsigned long count, int noblock) { -#if 0 struct usb_cpia *cpia = (struct usb_cpia *)dev; - int len; -#endif + int frmx = -1; + volatile struct cpia_frame *frame; -#ifdef CPIA_DEBUG - printk("cpia_read: %ld bytes\n", count); -#endif - return 0; + if (debug >= 1) + printk(KERN_DEBUG "cpia_read: %ld bytes, noblock=%d\n", count, noblock); + + if (!dev || !buf) + return -EFAULT; + + /* See if a frame is completed, then use it. */ + if (cpia->frame[0].grabstate >= FRAME_DONE) /* _DONE or _ERROR */ + frmx = 0; + else if (cpia->frame[1].grabstate >= FRAME_DONE)/* _DONE or _ERROR */ + frmx = 1; + + if (noblock && (frmx == -1)) + return -EAGAIN; + + /* If no FRAME_DONE, look for a FRAME_GRABBING state. */ + /* See if a frame is in process (grabbing), then use it. */ + if (frmx == -1) { + if (cpia->frame[0].grabstate == FRAME_GRABBING) + frmx = 0; + else if (cpia->frame[1].grabstate == FRAME_GRABBING) + frmx = 1; + } + + /* If no frame is active, start one. */ + if (frmx == -1) + cpia_new_frame(cpia, frmx = 0); + + frame = &cpia->frame[frmx]; + +restart: + while (frame->grabstate == FRAME_GRABBING) { + interruptible_sleep_on(&frame->wq); + if (signal_pending(current)) + return -EINTR; + } + + if (frame->grabstate == FRAME_ERROR) { + frame->bytes_read = 0; +printk("cpia_read: errored frame %d\n", cpia->curframe); + if (cpia_new_frame(cpia, frmx)) + printk(KERN_ERR "cpia_read: cpia_new_frame error\n"); + goto restart; + } + + if (debug >= 1) + printk(KERN_DEBUG "cpia_read: frmx=%d, bytes_read=%ld, scanlength=%ld\n", + frmx, frame->bytes_read, frame->scanlength); + + /* copy bytes to user space; we allow for partials reads */ + if ((count + frame->bytes_read) > frame->scanlength) + count = frame->scanlength - frame->bytes_read; + + if (copy_to_user(buf, frame->data + frame->bytes_read, count)) + return -EFAULT; + + frame->bytes_read += count; + if (debug >= 1) + printk(KERN_DEBUG "cpia_read: {copy} count used=%ld, new bytes_read=%ld\n", + count, frame->bytes_read); + + if (frame->bytes_read >= frame->scanlength) { /* All data has been read */ + frame->bytes_read = 0; + + /* Mark it as available to be used again. */ + cpia->frame[frmx].grabstate = FRAME_UNUSED; + if (cpia_new_frame(cpia, frmx ? 0 : 1)) + printk(KERN_ERR "cpia_read: cpia_new_frame returned error\n"); + } + + return count; } static int cpia_mmap(struct video_device *dev, const char *adr, unsigned long size) @@ -1122,9 +1155,6 @@ unsigned long start = (unsigned long)adr; unsigned long page, pos; -#ifdef CPIA_DEBUG - printk("mmap: %ld (%lX) bytes\n", size, size); -#endif if (size > (((2 * MAX_FRAME_SIZE) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))) return -EINVAL; @@ -1173,17 +1203,18 @@ /* Set altsetting 0 on interface 1 */ if (usb_set_interface(dev, 1, 0) < 0) { - printk(KERN_INFO "usb_set_interface error\n"); + printk(KERN_ERR "usb_set_interface error\n"); return -EBUSY; } if (usb_cpia_get_version(dev, version) < 0) { - printk(KERN_INFO "cpia_get_version error\n"); + printk(KERN_ERR "cpia_get_version error\n"); return -EBUSY; } - printk(KERN_DEBUG "cpia: Firmware v%d.%d, VC Hardware v%d.%d\n", - version[0], version[1], version[2], version[3]); + if (debug >= 1) + printk(KERN_DEBUG "cpia: Firmware v%d.%d, VC Hardware v%d.%d\n", + version[0], version[1], version[2], version[3]); memcpy(&cpia->vdev, &cpia_template, sizeof(cpia_template)); @@ -1191,45 +1222,47 @@ init_waitqueue_head(&cpia->frame[1].wq); if (video_register_device(&cpia->vdev, VFL_TYPE_GRABBER) == -1) { - printk(KERN_INFO "video_register_device failed\n"); + printk(KERN_ERR "video_register_device failed\n"); return -EBUSY; } if (usb_cpia_goto_hi_power(dev) < 0) { - printk(KERN_INFO "cpia_goto_hi_power error\n"); + printk(KERN_ERR "cpia_goto_hi_power error\n"); goto error; } if (usb_cpia_get_vp_version(dev, version) < 0) { - printk(KERN_INFO "cpia_get_vp_version error\n"); + printk(KERN_ERR "cpia_get_vp_version error\n"); goto error; } - printk(KERN_DEBUG "cpia: VP v%d rev %d\n", version[0], version[1]); - printk(KERN_DEBUG "cpia: Camera Head ID %04X\n", (version[3] << 8) + version[2]); + if (debug >= 1) { + printk(KERN_DEBUG "cpia: VP v%d rev %d\n", version[0], version[1]); + printk(KERN_DEBUG "cpia: Camera Head ID %04X\n", (version[3] << 8) + version[2]); + } /* Turn on continuous grab */ if (usb_cpia_set_grab_mode(dev, 1) < 0) { - printk(KERN_INFO "cpia_set_grab_mode error\n"); + printk(KERN_ERR "cpia_set_grab_mode error\n"); goto error; } /* Set up the sensor to be 30fps */ if (usb_cpia_set_sensor_fps(dev, 1, 0) < 0) { - printk(KERN_INFO "cpia_set_sensor_fps error\n"); + printk(KERN_ERR "cpia_set_sensor_fps error\n"); goto error; } /* Set video into CIF mode, and order into YUYV mode */ if (usb_cpia_set_format(dev, FORMAT_CIF, FORMAT_422, FORMAT_YUYV) < 0) { - printk(KERN_INFO "cpia_set_format error\n"); + printk(KERN_ERR "cpia_set_format error\n"); goto error; } /* Turn off compression */ if (usb_cpia_set_compression(dev, COMP_DISABLED, DONT_DECIMATE) < 0) { - printk(KERN_INFO "cpia_set_compression error\n"); + printk(KERN_ERR "cpia_set_compression error\n"); goto error; } @@ -1283,6 +1316,8 @@ cpia->dev = dev; if (!usb_cpia_configure(cpia)) { + cpia->user=0; + init_MUTEX(&cpia->lock); /* to 1 == available */ return cpia; } else return NULL; } diff -u --recursive --new-file v2.3.28/linux/drivers/usb/cpia.h linux/drivers/usb/cpia.h --- v2.3.28/linux/drivers/usb/cpia.h Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/cpia.h Fri Nov 19 12:21:43 1999 @@ -159,11 +159,14 @@ int hdrwidth; /* Width the frame actually is */ int hdrheight; /* Height */ - int grabstate; /* State of grabbing */ + volatile int grabstate; /* State of grabbing */ int scanstate; /* State of scanning */ int curline; /* Line of frame we're working on */ + long scanlength; /* uncompressed, raw data length of frame */ + long bytes_read; /* amount of scanlength that has been read from *data */ + wait_queue_head_t wq; /* Processes waiting */ }; @@ -176,6 +179,9 @@ /* Device structure */ struct usb_device *dev; + struct semaphore lock; + int user; /* user count for exclusive use */ + int streaming; /* Are we streaming Isochronous? */ int grabbing; /* Are we grabbing? */ @@ -195,4 +201,3 @@ }; #endif - diff -u --recursive --new-file v2.3.28/linux/drivers/usb/dc2xx.c linux/drivers/usb/dc2xx.c --- v2.3.28/linux/drivers/usb/dc2xx.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/dc2xx.c Thu Nov 18 20:34:10 1999 @@ -41,6 +41,9 @@ * 12 Oct, 1999 -- handle DC-280 interface class (0xff not 0x0); * added timeouts to bulk_msg calls. Minor updates, docs. * 03 Nov, 1999 -- update for 2.3.25 kernel API changes. + * + * Thanks to: the folk who've provided USB product IDs, sent in + * patches, and shared their sucesses! */ #include @@ -74,33 +77,30 @@ /* table of cameras that work through this driver */ -static struct camera { +static const struct camera { short idVendor; short idProduct; - - /* should get this name from the USB subsystem */ - const char *nameProduct; + /* plus hooks for camera-specific info if needed */ } cameras [] = { - { 0x040a, 0x0120, "Kodak DC-240" }, - { 0x040a, 0x0130, "Kodak DC-280" }, + { 0x040a, 0x0120 }, // Kodak DC-240 + { 0x040a, 0x0130 }, // Kodak DC-280 /* Kodak has several other USB-enabled devices, which (along with * models from other vendors) all use the Flashpoint "Digita - * OS" and its wire protocol. This driver should work with such - * devices, which need different application level protocol code - * from the DC-240/280 models. Note that Digita isn't just for - * cameras -- Epson has a non-USB Digita photo printer. + * OS" and its wire protocol. These use a different application + * level protocol from the DC-240/280 models. Note that Digita + * isn't just for cameras -- Epson has a non-USB Digita printer. */ -/* { 0x040a, 0x0100, "Kodak DC-220" }, */ - { 0x040a, 0x0110, "Kodak DC-260" }, -/* { 0x040a, 0x0115, "Kodak DC-265" }, */ -/* { 0x040a, 0x0140, "Kodak DC-290" }, */ +// { 0x040a, 0x0100 }, // Kodak DC-220 + { 0x040a, 0x0110 }, // Kodak DC-260 + { 0x040a, 0x0111 }, // Kodak DC-265 + { 0x040a, 0x0112 }, // Kodak DC-290 -/* { 0xffff, 0xffff, "Minolta Dimage EX 1500" }, */ -/* { 0x03f0, 0xffff, "HP PhotoSmart C500" }, */ +// { 0x03f0, 0xffff }, // HP PhotoSmart C500 /* Other USB cameras may well work here too, so long as they - * just stick to half duplex packet exchanges. + * just stick to half duplex packet exchanges and bulk messages. + * Some non-camera devices have also been shown to work. */ }; @@ -110,7 +110,7 @@ struct usb_device *dev; /* USB device handle */ char inEP; /* read endpoint */ char outEP; /* write endpoint */ - struct camera *info; /* DC-240, etc */ + const struct camera *info; /* DC-240, etc */ /* valid iff isOpen */ int isOpen; /* device opened? */ @@ -159,9 +159,10 @@ return -ENODEV; } - result = camera->dev->bus->op->bulk_msg (camera->dev, + result = usb_bulk_msg (camera->dev, usb_rcvbulkpipe (camera->dev, camera->inEP), camera->buf, len, &count, HZ*10); + #ifdef CAMERA_DEBUG printk ("camera.r (%d) - 0x%x %ld\n", len, result, count); #endif @@ -205,7 +206,6 @@ /* it's not clear that retrying can do any good ... or that * fragmenting application packets into N writes is correct. - * consider those mechanisms mostly untested legacy code */ thistime = copy_size = len; if (copy_from_user (obuf, buf, copy_size)) { @@ -227,7 +227,7 @@ goto done; } - result = camera->dev->bus->op->bulk_msg (camera->dev, + result = usb_bulk_msg (camera->dev, usb_sndbulkpipe (camera->dev, camera->outEP), obuf, thistime, &count, HZ*10); #ifdef CAMERA_DEBUG @@ -311,7 +311,7 @@ * to applications ... what USB exposes should suffice. * apps should be able to see the camera type. */ -static struct file_operations usb_camera_fops = { +static /* const */ struct file_operations usb_camera_fops = { NULL, /* llseek */ camera_read, camera_write, @@ -333,6 +333,7 @@ USB_CAMERA_MINOR, "USB camera (Kodak DC-2xx)", &usb_camera_fops + // next, prev }; @@ -340,9 +341,10 @@ static void * camera_probe(struct usb_device *dev, unsigned int ifnum) { int i; - struct camera *camera_info = NULL; + const struct camera *camera_info = NULL; struct usb_interface_descriptor *interface; struct usb_endpoint_descriptor *endpoint; + int direction, ep; struct camera_state *camera = &static_camera_state; @@ -365,13 +367,10 @@ return NULL; } - /* the interface class bit is odd -- the dc240 and dc260 return - * a zero there, and at least some dc280s report 0xff - */ - // interface = &dev->config[0].interface[0].altsetting[0]; + /* models differ in how they report themselves */ interface = &dev->actconfig->interface[ifnum].altsetting[0]; - if ((interface->bInterfaceClass != 0 - && interface->bInterfaceClass != 0xff) + if ((interface->bInterfaceClass != USB_CLASS_PER_INTERFACE + && interface->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || interface->bInterfaceSubClass != 0 || interface->bInterfaceProtocol != 0 || interface->bNumEndpoints != 2 @@ -383,31 +382,33 @@ /* can only show one camera at a time through /dev ... */ if (!camera->dev) { camera->dev = dev; - printk(KERN_INFO "USB Camera (%s) is connected\n", - camera_info->nameProduct); + printk(KERN_INFO "USB Camera is connected\n"); } else { - printk(KERN_INFO "Ignoring additional USB Camera (%s)\n", - camera_info->nameProduct); + printk(KERN_INFO "Ignoring additional USB Camera\n"); return NULL; } -// XXX there are now masks for these constants ... see printer.c - /* get input and output endpoints (either order) */ endpoint = interface->endpoint; camera->outEP = camera->inEP = -1; - if ((endpoint [0].bEndpointAddress & 0x80) == 0x80) - camera->inEP = endpoint [0].bEndpointAddress & 0x7f; + + ep = endpoint [0].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; + direction = endpoint [0].bEndpointAddress & USB_ENDPOINT_DIR_MASK; + if (direction == USB_DIR_IN) + camera->inEP = ep; else - camera->outEP = endpoint [0].bEndpointAddress; + camera->outEP = ep; - if ((endpoint [1].bEndpointAddress & 0x80) == 0x80) - camera->inEP = endpoint [1].bEndpointAddress & 0x7f; + ep = endpoint [1].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; + direction = endpoint [1].bEndpointAddress & USB_ENDPOINT_DIR_MASK; + if (direction == USB_DIR_IN) + camera->inEP = ep; else - camera->outEP = endpoint [1].bEndpointAddress; + camera->outEP = ep; + if (camera->outEP == -1 || camera->inEP == -1 - || endpoint [0].bmAttributes != 0x02 - || endpoint [1].bmAttributes != 0x02 + || endpoint [0].bmAttributes != USB_ENDPOINT_XFER_BULK + || endpoint [1].bmAttributes != USB_ENDPOINT_XFER_BULK ) { printk (KERN_INFO "Bogus camera endpoints\n"); camera->dev = NULL; @@ -428,7 +429,6 @@ static void camera_disconnect(struct usb_device *dev, void *ptr) { struct camera_state *camera = (struct camera_state *) ptr; - struct camera *info = camera->info; if (camera->dev != dev) return; @@ -443,10 +443,10 @@ camera->info = NULL; camera->dev = NULL; - printk (KERN_INFO "USB Camera (%s) disconnected\n", info->nameProduct); + printk (KERN_INFO "USB Camera disconnected\n"); } -static struct usb_driver camera_driver = { +static /* const */ struct usb_driver camera_driver = { "dc2xx", camera_probe, camera_disconnect, diff -u --recursive --new-file v2.3.28/linux/drivers/usb/ezusb.c linux/drivers/usb/ezusb.c --- v2.3.28/linux/drivers/usb/ezusb.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/usb/ezusb.c Fri Nov 19 14:46:56 1999 @@ -491,7 +491,7 @@ } } } - ret = usbdev->bus->op->bulk_msg(usbdev, pipe, tbuf, length, &len2, timeout); + ret = usb_bulk_msg(usbdev, pipe, tbuf, length, &len2, timeout); if (ret < 0) { if (length > 0) free_page((unsigned long)tbuf); diff -u --recursive --new-file v2.3.28/linux/drivers/usb/hp_scanner.c linux/drivers/usb/hp_scanner.c --- v2.3.28/linux/drivers/usb/hp_scanner.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/hp_scanner.c Fri Nov 19 14:46:56 1999 @@ -128,7 +128,7 @@ return bytes_written ? bytes_written : -EINTR; } - result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev,usb_sndbulkpipe(hps->hpscan_dev, 2), obuf, thistime, &partial, HZ*10); + result = usb_bulk_msg(hps->hpscan_dev,usb_sndbulkpipe(hps->hpscan_dev, 2), obuf, thistime, &partial, HZ*10); //printk(KERN_DEBUG "write stats: result:%d thistime:%lu partial:%lu\n", result, thistime, partial); @@ -186,7 +186,7 @@ return -ENODEV; this_read = (count > IBUF_SIZE) ? IBUF_SIZE : count; - result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev, usb_rcvbulkpipe(hps->hpscan_dev, 1), ibuf, this_read, &partial, HZ*10); + result = usb_bulk_msg(hps->hpscan_dev, usb_rcvbulkpipe(hps->hpscan_dev, 1), ibuf, this_read, &partial, HZ*10); printk(KERN_DEBUG "read stats: result:%d this_read:%u partial:%lu\n", result, this_read, partial); diff -u --recursive --new-file v2.3.28/linux/drivers/usb/proc_usb.c linux/drivers/usb/proc_usb.c --- v2.3.28/linux/drivers/usb/proc_usb.c Thu Nov 11 20:11:49 1999 +++ linux/drivers/usb/proc_usb.c Fri Nov 19 14:46:56 1999 @@ -2,6 +2,7 @@ * drivers/usb/proc_usb.c * (C) Copyright 1999 Randy Dunlap. * (C) Copyright 1999 Thomas Sailer . (proc file per device) + * (C) Copyright 1999 Deti Fliegl (new USB architecture) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -591,7 +592,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); if (!i && len2) { copy_to_user_ret(bulk.data, tbuf, len2, -EFAULT); } @@ -599,7 +600,7 @@ if (len1) { copy_from_user_ret(tbuf, bulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); } free_page((unsigned long)tbuf); if (i) { @@ -670,7 +671,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); if (!i && len2) { copy_to_user_ret(obulk.data, tbuf, len2, -EFAULT); } @@ -678,7 +679,7 @@ if (len1) { copy_from_user_ret(tbuf, obulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); } free_page((unsigned long)tbuf); if (i) { @@ -804,7 +805,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); if (!i && len2) { copy_to_user_ret(bulk.data, tbuf, len2, -EFAULT); } @@ -812,7 +813,7 @@ if (len1) { copy_from_user_ret(tbuf, bulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); } free_page((unsigned long)tbuf); if (i) { @@ -877,7 +878,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); if (!i && len2) { copy_to_user_ret(obulk.data, tbuf, len2, -EFAULT); } @@ -885,7 +886,7 @@ if (len1) { copy_from_user_ret(tbuf, obulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); } free_page((unsigned long)tbuf); if (i) { diff -u --recursive --new-file v2.3.28/linux/drivers/usb/uhci.c linux/drivers/usb/uhci.c --- v2.3.28/linux/drivers/usb/uhci.c Thu Nov 11 20:11:49 1999 +++ linux/drivers/usb/uhci.c Thu Nov 18 21:01:15 1999 @@ -156,7 +156,8 @@ if (rval) *rval += actlength; - if (explength != actlength && tmp->pipetype == PIPE_BULK) { + if (explength != actlength && + ((tmp->pipetype == PIPE_BULK) || (tmp->pipetype == PIPE_CONTROL))) { /* If the packet is short, none of the */ /* packets after this were processed, so */ /* fix the DT accordingly */ diff -u --recursive --new-file v2.3.28/linux/drivers/usb/usb.c linux/drivers/usb/usb.c --- v2.3.28/linux/drivers/usb/usb.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/usb/usb.c Sun Nov 21 17:23:32 1999 @@ -383,7 +383,7 @@ return -1; } - interface = &dev->actconfig->interface[ifnum]; + interface = dev->actconfig->interface + ifnum; if (usb_interface_claimed(interface)) return -1; @@ -416,7 +416,7 @@ for (ifnum = 0; ifnum < dev->actconfig->bNumInterfaces; ifnum++) { /* if this interface hasn't already been claimed */ - if (!usb_interface_claimed(dev->actconfig->interface)) { + if (!usb_interface_claimed(dev->actconfig->interface + ifnum)) { if (usb_find_interface_driver(dev, ifnum)) rejected++; } diff -u --recursive --new-file v2.3.28/linux/drivers/usb/usb_scsi.c linux/drivers/usb/usb_scsi.c --- v2.3.28/linux/drivers/usb/usb_scsi.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/usb/usb_scsi.c Thu Nov 18 20:01:27 1999 @@ -114,15 +114,6 @@ #define US_ACT_BUS_RESET 4 #define US_ACT_HOST_RESET 5 -static struct proc_dir_entry proc_usb_scsi = -{ - PROC_SCSI_USB_SCSI, /* It's currently b0rken */ - 0, - NULL, - S_IFDIR | S_IRUGO | S_IXUGO, - 2 -}; - static struct us_data *us_list; static struct usb_scsi_filter *filters; @@ -615,26 +606,19 @@ char name[32]; sprintf(name, "usbscsi%d", us->host_number); - proc_usb_scsi.namelen = strlen(name); - proc_usb_scsi.name = kmalloc(proc_usb_scsi.namelen+1, GFP_KERNEL); - if (!proc_usb_scsi.name) + sht->name = sht->proc_name = kmalloc(strlen(name)+1, GFP_KERNEL); + if (!sht->proc_name) return 0; - strcpy((char *)proc_usb_scsi.name, name); - sht->proc_dir = kmalloc(sizeof(*sht->proc_dir), GFP_KERNEL); - if (!sht->proc_dir) { - kfree(proc_usb_scsi.name); - return 0; - } - *sht->proc_dir = proc_usb_scsi; - sht->name = proc_usb_scsi.name; + strcpy(sht->proc_name, name); + sht->proc_dir = NULL; us->host = scsi_register(sht, sizeof(us)); if (us->host) { us->host->hostdata[0] = (unsigned long)us; us->host_no = us->host->host_no; return 1; } - kfree(proc_usb_scsi.name); - kfree(sht->proc_dir); + kfree(sht->proc_name); + sht->proc_name = sht->name = NULL; return 0; } diff -u --recursive --new-file v2.3.28/linux/drivers/video/Makefile linux/drivers/video/Makefile --- v2.3.28/linux/drivers/video/Makefile Sun Nov 7 16:37:34 1999 +++ linux/drivers/video/Makefile Sat Nov 20 10:10:10 1999 @@ -1,553 +1,119 @@ -# -# Makefile for the kernel video drivers. -# -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definitions are now inherited from the -# parent makes.. -# - -L_TARGET := video.a -L_OBJS := -M_OBJS := -LX_OBJS := -MX_OBJS := -MOD_LIST_NAME := VIDEO_MODULES - -CONFIG_FBGEN_BUILTIN := -CONFIG_FBGEN_MODULE := - -# Frame Buffer Console - -ifeq ($(CONFIG_FB),y) - # Nasty trick to make sure all wanted stuff is linked in - O_TARGET = fbdev.o - L_OBJS += fbdev.o -endif - -ifeq ($(CONFIG_DUMMY_CONSOLE),y) - L_OBJS += dummycon.o -endif - -ifeq ($(CONFIG_PROM_CONSOLE),y) - L_OBJS += promcon.o promcon_tbl.o -endif - -ifeq ($(CONFIG_FB),y) - L_OBJS += fonts.o - OX_OBJS += fbcon.o fbcmap.o fbmem.o modedb.o - ifeq ($(CONFIG_FONT_8x8),y) - L_OBJS += font_8x8.o - endif - ifeq ($(CONFIG_FONT_8x16),y) - L_OBJS += font_8x16.o - endif - ifeq ($(CONFIG_FONT_SUN8x16),y) - L_OBJS += font_sun8x16.o - endif - ifeq ($(CONFIG_FONT_SUN12x22),y) - L_OBJS += font_sun12x22.o - endif - ifeq ($(CONFIG_FONT_6x11),y) - L_OBJS += font_6x11.o - endif - ifeq ($(CONFIG_FONT_ACORN_8x8),y) - L_OBJS += font_acorn_8x8.o - endif - ifeq ($(CONFIG_FONT_PEARL_8x8),y) - L_OBJS += font_pearl_8x8.o - endif -endif - -# Frame Buffer Devices - -ifeq ($(CONFIG_FB_ACORN),y) -L_OBJS += acornfb.o -else - ifeq ($(CONFIG_FB_ACORN),m) - M_OBJS += acornfb.o - endif -endif - -ifeq ($(CONFIG_FB_AMIGA),y) -L_OBJS += amifb.o -else - ifeq ($(CONFIG_FB_AMIGA),m) - M_OBJS += amifb.o - endif -endif - -ifeq ($(CONFIG_FB_PM2),y) -L_OBJS += pm2fb.o -CONFIG_FBGEN_BUILTIN = y -else - ifeq ($(CONFIG_FB_PM2),m) - M_OBJS += pm2fb.o - CONFIG_FBGEN_MODULE = y - endif -endif - -ifeq ($(CONFIG_FB_APOLLO),y) -L_OBJS += dnfb.o -endif - -ifeq ($(CONFIG_FB_Q40),y) -L_OBJS += q40fb.o -endif - -ifeq ($(CONFIG_FB_ATARI),y) -L_OBJS += atafb.o -else - ifeq ($(CONFIG_FB_ATARI),m) - M_OBJS += atafb.o - endif -endif - -ifeq ($(CONFIG_FB_ATY),y) -L_OBJS += atyfb.o -else - ifeq ($(CONFIG_FB_ATY),m) - M_OBJS += atyfb.o - endif -endif - -ifeq ($(CONFIG_FB_ATY128),y) -L_OBJS += aty128fb.o -endif - -ifeq ($(CONFIG_FB_IGA),y) -L_OBJS += igafb.o -endif - -ifeq ($(CONFIG_FB_CONTROL),y) -L_OBJS += controlfb.o -endif - -ifeq ($(CONFIG_FB_PLATINUM),y) -L_OBJS += platinumfb.o -endif - -ifeq ($(CONFIG_FB_VALKYRIE),y) -L_OBJS += valkyriefb.o -endif - -ifeq ($(CONFIG_FB_CT65550),y) -L_OBJS += chipsfb.o -endif - -ifeq ($(CONFIG_FB_CYBER),y) -L_OBJS += cyberfb.o -else - ifeq ($(CONFIG_FB_CYBER),m) - M_OBJS += cyberfb.o - endif -endif - -ifeq ($(CONFIG_FB_CYBER2000),y) -L_OBJS += cyber2000fb.o -else - ifeq ($(CONFIG_FB_CYBER2000),m) - M_OBJS += cyber2000fb.o - endif -endif - -ifeq ($(CONFIG_FB_SGIVW),y) -LX_OBJS += sgivwfb.o -else - ifeq ($(CONFIG_FB_SGIVW),m) - MX_OBJS += sgivwfb.o - endif -endif - -ifeq ($(CONFIG_FB_RIVA),y) -L_OBJS += rivafb.o riva_hw.o -endif - -ifeq ($(CONFIG_FB_3DFX),y) -L_OBJS += tdfxfb.o -endif - -ifeq ($(CONFIG_FB_MAC),y) -L_OBJS += macfb.o -endif - -ifeq ($(CONFIG_FB_HP300),y) -L_OBJS += hpfb.o -endif - -ifeq ($(CONFIG_FB_OF),y) -L_OBJS += offb.o macmodes.o -endif - -ifeq ($(CONFIG_FB_IMSTT),y) -L_OBJS += imsttfb.o -endif - -ifeq ($(CONFIG_FB_RETINAZ3),y) -L_OBJS += retz3fb.o -else - ifeq ($(CONFIG_FB_RETINAZ3),m) - M_OBJS += retz3fb.o - endif -endif - -ifeq ($(CONFIG_FB_CLGEN),y) -L_OBJS += clgenfb.o -CONFIG_FBGEN_BUILTIN = y -else - ifeq ($(CONFIG_FB_CLGEN),m) - M_OBJS += clgenfb.o - CONFIG_FBGEN_MODULE = y - endif -endif - -ifeq ($(CONFIG_FB_S3TRIO),y) -L_OBJS += S3triofb.o -else - ifeq ($(CONFIG_FB_S3TRIO),m) - M_OBJS += S3triofb.o - endif -endif - -ifeq ($(CONFIG_FB_TGA),y) -L_OBJS += tgafb.o -CONFIG_FBGEN_BUILTIN = y -else - ifeq ($(CONFIG_FB_TGA),m) - M_OBJS += tgafb.o - CONFIG_FBGEN_MODULE = y - endif -endif - -ifeq ($(CONFIG_FB_VESA),y) -L_OBJS += vesafb.o -endif - -ifeq ($(CONFIG_FB_VGA16),y) -L_OBJS += vga16fb.o -else - ifeq ($(CONFIG_FB_VGA16),m) - M_OBJS += vga16fb.o - endif -endif - -ifeq ($(CONFIG_FB_VIRGE),y) -L_OBJS += virgefb.o -else - ifeq ($(CONFIG_FB_VIRGE),m) - M_OBJS += virgefb.o - endif -endif - -ifdef CONFIG_FB_G364 -L_OBJS := $(L_OBJS) g364fb.o -endif - -ifdef CONFIG_FB_FM2 -L_OBJS := $(L_OBJS) fm2fb.o -endif - -ifeq ($(CONFIG_FB_SBUS),y) -L_OBJS += sbusfb.o - ifeq ($(CONFIG_FB_CREATOR),y) - L_OBJS += creatorfb.o - else - ifeq ($(CONFIG_FB_CREATOR),m) - M_OBJS += creatorfb.o - endif - endif - ifeq ($(CONFIG_FB_CGSIX),y) - L_OBJS += cgsixfb.o - else - ifeq ($(CONFIG_FB_CGSIX),m) - M_OBJS += cgsixfb.o - endif - endif - ifeq ($(CONFIG_FB_BWTWO),y) - L_OBJS += bwtwofb.o - else - ifeq ($(CONFIG_FB_BWTWO),m) - M_OBJS += bwtwofb.o - endif - endif - ifeq ($(CONFIG_FB_CGTHREE),y) - L_OBJS += cgthreefb.o - else - ifeq ($(CONFIG_FB_CGTHREE),m) - M_OBJS += cgthreefb.o - endif - endif - ifeq ($(CONFIG_FB_TCX),y) - L_OBJS += tcxfb.o - else - ifeq ($(CONFIG_FB_TCX),m) - M_OBJS += tcxfb.o - endif - endif - ifeq ($(CONFIG_FB_CGFOURTEEN),y) - L_OBJS += cgfourteenfb.o - else - ifeq ($(CONFIG_FB_CGFOURTEEN),m) - M_OBJS += cgfourteenfb.o - endif - endif - ifeq ($(CONFIG_FB_P9100),y) - L_OBJS += p9100fb.o - else - ifeq ($(CONFIG_FB_P9100),m) - M_OBJS += p9100fb.o - endif - endif - ifeq ($(CONFIG_FB_LEO),y) - L_OBJS += leofb.o - else - ifeq ($(CONFIG_FB_LEO),m) - M_OBJS += leofb.o - endif - endif -else - ifeq ($(CONFIG_FB_SBUS),m) - M_OBJS += sbusfb.o - ifeq ($(CONFIG_FB_CREATOR),y) - M_OBJS += creatorfb.o - else - ifeq ($(CONFIG_FB_CREATOR),m) - M_OBJS += creatorfb.o - endif - endif - ifeq ($(CONFIG_FB_CGSIX),y) - M_OBJS += cgsixfb.o - else - ifeq ($(CONFIG_FB_CGSIX),m) - M_OBJS += cgsixfb.o - endif - endif - ifeq ($(CONFIG_FB_BWTWO),y) - M_OBJS += bwtwofb.o - else - ifeq ($(CONFIG_FB_BWTWO),m) - M_OBJS += bwtwofb.o - endif - endif - ifeq ($(CONFIG_FB_CGTHREE),y) - M_OBJS += cgthreefb.o - else - ifeq ($(CONFIG_FB_CGTHREE),m) - M_OBJS += cgthreefb.o - endif - endif - ifeq ($(CONFIG_FB_TCX),y) - M_OBJS += tcxfb.o - else - ifeq ($(CONFIG_FB_TCX),m) - M_OBJS += tcxfb.o - endif - endif - ifeq ($(CONFIG_FB_CGFOURTEEN),y) - M_OBJS += cgfourteenfb.o - else - ifeq ($(CONFIG_FB_CGFOURTEEN),m) - M_OBJS += cgfourteenfb.o - endif - endif - ifeq ($(CONFIG_FB_P9100),y) - M_OBJS += p9100fb.o - else - ifeq ($(CONFIG_FB_P9100),m) - M_OBJS += p9100fb.o - endif - endif - ifeq ($(CONFIG_FB_LEO),y) - M_OBJS += leofb.o - else - ifeq ($(CONFIG_FB_LEO),m) - M_OBJS += leofb.o - endif - endif - endif -endif - -ifeq ($(CONFIG_FB_VIRTUAL),y) -L_OBJS += vfb.o -else - ifeq ($(CONFIG_FB_VIRTUAL),m) - M_OBJS += vfb.o - endif -endif - -ifdef CONFIG_FBGEN_BUILTIN -OX_OBJS += fbgen.o -else - ifdef CONFIG_FBGEN_MODULE - MX_OBJS += fbgen.o - endif -endif - -ifeq ($(CONFIG_FB_MATROX),y) -L_OBJS += matroxfb.o -else - ifeq ($(CONFIG_FB_MATROX),m) - M_OBJS += matroxfb.o - endif -endif +# Makefile for the Linux video drivers. +# 5 Aug 1999, James Simmons, +# Rewritten to use lists instead of if-statements. + +SUB_DIRS := +MOD_SUB_DIRS := +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := + +# All of the (potential) objects that export symbols. +# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. + +export-objs := fbmem.o fbcmap.o fbcon.o fbcon-afb.o fbcon-ilbm.o fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o fbcon-vga.o + +# Object file lists. +obj-y := +obj-m := +obj-n := +obj- := + +# Each configuration option enables a list of files. + +obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o +obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o vga_font.o +obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o +obj-$(CONFIG_VGA_CONSOLE) += vgacon.o +obj-$(CONFIG_MDA_CONSOLE) += mdacon.o + +obj-$(CONFIG_FONT_SUN8x16) += font_sun8x16.o +obj-$(CONFIG_FONT_SUN12x22) += font_sun12x22.o +obj-$(CONFIG_FONT_8x8) += font_8x8.o +obj-$(CONFIG_FONT_8x16) += font_8x16.o +obj-$(CONFIG_FONT_6x11) += font_6x11.o +obj-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o +obj-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o + +obj-$(CONFIG_FB) += fbmem.o fbcmap.o modedb.o fbcon.o fonts.o fbmon.o + +obj-$(CONFIG_FB_ACORN) += acornfb.o +obj-$(CONFIG_FB_AMIGA) += amifb.o +obj-$(CONFIG_FB_PM2) += pm2fb.o fbgen.o +obj-$(CONFIG_FB_APOLLO) += dnfb.o +obj-$(CONFIG_FB_Q40) += q40fb.o +obj-$(CONFIG_FB_ATARI) += atafb.o +obj-$(CONFIG_FB_ATY) += atyfb.o +obj-$(CONFIG_FB_ATY128) += aty128fb.o +obj-$(CONFIG_FB_IGA) += igafb.o +obj-$(CONFIG_FB_CONTROL) += controlfb.o +obj-$(CONFIG_FB_PLATINUM) += platinumfb.o +obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o +obj-$(CONFIG_FB_CT65550) += chipsfb.o +obj-$(CONFIG_FB_CYBER) += cyberfb.o +obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o +obj-$(CONFIG_FB_SGIVW) += sgivwfb.o +obj-$(CONFIG_FB_RIVA) += rivafb.o riva_hw.o +obj-$(CONFIG_FB_3DFX) += tdfxfb.o +obj-$(CONFIG_FB_MAC) += macfb.o +obj-$(CONFIG_FB_HP300) += hpfb.o +obj-$(CONFIG_FB_OF) += offb.o macmodes.o +obj-$(CONFIG_FB_IMSTT) += imsttfb.o +obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o +obj-$(CONFIG_FB_CLGEN) += clgenfb.o fbgen.o +obj-$(CONFIG_FB_S3TRIO) += S3triofb.o +obj-$(CONFIG_FB_TGA) += tgafb.o fbgen.o +obj-$(CONFIG_FB_VESA) += vesafb.o +obj-$(CONFIG_FB_VGA16) += vga16fb.o fbcon-vga-planes.o +obj-$(CONFIG_FB_VIRGE) += virgefb.o +obj-$(CONFIG_FB_G364) += g364fb.o +obj-$(CONFIG_FB_FM2) += fm2fb.o +obj-$(CONFIG_FB_CREATOR) += creatorfb.o sbusfb.o +obj-$(CONFIG_FB_CGSIX) += cgsixfb.o sbusfb.o +obj-$(CONFIG_FB_BWTWO) += bwtwofb.o sbusfb.o +obj-$(CONFIG_FB_CGTHREE) += cgthreefb.o sbusfb.o +obj-$(CONFIG_FB_TCX) += tcxfb.o sbusfb.o +obj-$(CONFIG_FB_CGFOURTEEN) += cgfourteenfb.o sbusfb.o +obj-$(CONFIG_FB_P9100) += p9100fb.o sbusfb.o +obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o +obj-$(CONFIG_FB_MATROX) += matroxfb.o +obj-$(CONFIG_FB_VIRTUAL) += vfb.o # Generic Low Level Drivers -ifeq ($(CONFIG_FBCON_AFB),y) -OX_OBJS += fbcon-afb.o -else - ifeq ($(CONFIG_FBCON_AFB),m) - MX_OBJS += fbcon-afb.o - endif -endif - -ifeq ($(CONFIG_FBCON_CFB2),y) -OX_OBJS += fbcon-cfb2.o -else - ifeq ($(CONFIG_FBCON_CFB2),m) - MX_OBJS += fbcon-cfb2.o - endif -endif - -ifeq ($(CONFIG_FBCON_CFB4),y) -OX_OBJS += fbcon-cfb4.o -else - ifeq ($(CONFIG_FBCON_CFB4),m) - MX_OBJS += fbcon-cfb4.o - endif -endif - -ifeq ($(CONFIG_FBCON_CFB8),y) -OX_OBJS += fbcon-cfb8.o -else - ifeq ($(CONFIG_FBCON_CFB8),m) - MX_OBJS += fbcon-cfb8.o - endif -endif - -ifeq ($(CONFIG_FBCON_CFB16),y) -OX_OBJS += fbcon-cfb16.o -else - ifeq ($(CONFIG_FBCON_CFB16),m) - MX_OBJS += fbcon-cfb16.o - endif -endif - -ifeq ($(CONFIG_FBCON_CFB24),y) -OX_OBJS += fbcon-cfb24.o -else - ifeq ($(CONFIG_FBCON_CFB24),m) - MX_OBJS += fbcon-cfb24.o - endif -endif - -ifeq ($(CONFIG_FBCON_CFB32),y) -OX_OBJS += fbcon-cfb32.o -else - ifeq ($(CONFIG_FBCON_CFB32),m) - MX_OBJS += fbcon-cfb32.o - endif -endif - -ifeq ($(CONFIG_FBCON_ILBM),y) -OX_OBJS += fbcon-ilbm.o -else - ifeq ($(CONFIG_FBCON_ILBM),m) - MX_OBJS += fbcon-ilbm.o - endif -endif - -ifeq ($(CONFIG_FBCON_IPLAN2P2),y) -OX_OBJS += fbcon-iplan2p2.o -else - ifeq ($(CONFIG_FBCON_IPLAN2P2),m) - MX_OBJS += fbcon-iplan2p2.o - endif -endif - -ifeq ($(CONFIG_FBCON_IPLAN2P4),y) -OX_OBJS += fbcon-iplan2p4.o -else - ifeq ($(CONFIG_FBCON_IPLAN2P4),m) - MX_OBJS += fbcon-iplan2p4.o - endif -endif - -ifeq ($(CONFIG_FBCON_IPLAN2P8),y) -OX_OBJS += fbcon-iplan2p8.o -else - ifeq ($(CONFIG_FBCON_IPLAN2P8),m) - MX_OBJS += fbcon-iplan2p8.o - endif -endif - -ifeq ($(CONFIG_FBCON_IPLAN2P16),y) -OX_OBJS += fbcon-iplan2p16.o -else - ifeq ($(CONFIG_FBCON_IPLAN2P16),m) - MX_OBJS += fbcon-iplan2p16.o - endif -endif - -ifeq ($(CONFIG_FBCON_MAC),y) -OX_OBJS += fbcon-mac.o -else - ifeq ($(CONFIG_FBCON_MAC),m) - MX_OBJS += fbcon-mac.o - endif -endif - -ifeq ($(CONFIG_FBCON_MFB),y) -OX_OBJS += fbcon-mfb.o -else - ifeq ($(CONFIG_FBCON_MFB),m) - MX_OBJS += fbcon-mfb.o - endif -endif - -ifeq ($(CONFIG_FBCON_VGA_PLANES),y) -OX_OBJS += fbcon-vga-planes.o -else - ifeq ($(CONFIG_FBCON_VGA_PLANES),m) - MX_OBJS += fbcon-vga-planes.o - endif -endif - -ifeq ($(CONFIG_FBCON_VGA),y) -OX_OBJS += fbcon-vga.o -else - ifeq ($(CONFIG_FBCON_VGA),m) - MX_OBJS += fbcon-vga.o - endif -endif - -# VGA Text Console - -ifdef CONFIG_VGA_CONSOLE -L_OBJS += vgacon.o -endif - -# MDA Text Console - -ifeq ($(CONFIG_MDA_CONSOLE),y) -L_OBJS += mdacon.o -else - ifeq ($(CONFIG_MDA_CONSOLE),m) - M_OBJS += mdacon.o - endif -endif - -# Newport Text Console - -ifeq ($(CONFIG_SGI_NEWPORT_CONSOLE),y) -L_OBJS += newport_con.o vga_font.o -else - ifeq ($(CONFIG_SGI_NEWPORT_CONSOLE),m) - M_OBJS += newport_con.o vga_font.o - endif -endif +obj-$(CONFIG_FBCON_AFB) += fbcon-afb.o +obj-$(CONFIG_FBCON_CFB2) += fbcon-cfb2.o +obj-$(CONFIG_FBCON_CFB4) += fbcon-cfb4.o +obj-$(CONFIG_FBCON_CFB8) += fbcon-cfb8.o +obj-$(CONFIG_FBCON_CFB16) += fbcon-cfb16.o +obj-$(CONFIG_FBCON_CFB24) += fbcon-cfb24.o +obj-$(CONFIG_FBCON_CFB32) += fbcon-cfb32.o +obj-$(CONFIG_FBCON_ILBM) += fbcon-ilbm.o +obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o +obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o +obj-$(CONFIG_FBCON_IPLAN2P8) += fbcon-iplan2p8.o +obj-$(CONFIG_FBCON_IPLAN2P16) += fbcon-iplan2p16.o +obj-$(CONFIG_FBCON_MAC) += fbcon-mac.o +obj-$(CONFIG_FBCON_MFB) += fbcon-mfb.o +obj-$(CONFIG_FBCON_VGA) += fbcon-vga.o + +# Files that are both resident and modular: remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) + +# Take multi-part drivers out of obj-y and put components in. + +obj-y := $(filter-out $(list-multi), $(obj-y)) + +# Translate to Rules.make lists. + +L_TARGET := video.a +# This is a nice idea but needs depmod altering +#MOD_LIST_NAME := VIDEO_MODULES + +L_OBJS := $(sort $(filter-out $(export-objs), $(obj-y))) +LX_OBJS := $(sort $(filter $(export-objs), $(obj-y))) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.3.28/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c --- v2.3.28/linux/drivers/video/fbmem.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/video/fbmem.c Sat Nov 20 10:10:10 1999 @@ -674,39 +674,6 @@ fb_drivers[i].init(); } - -int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, - const struct fb_info *fb_info) -{ -#if 0 - /* - * long long divisions .... $#%%#$ - */ - unsigned long long hpicos, vpicos; - const unsigned long long _1e12 = 1000000000000ULL; - const struct fb_monspecs *monspecs = &fb_info->monspecs; - - hpicos = (unsigned long long)htotal*(unsigned long long)pixclock; - vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos; - if (!vpicos) - return 0; - - if (monspecs->hfmin == 0) - return 1; - - if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 || - vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12) - return 0; -#endif - return 1; -} - -int fbmon_dpms(const struct fb_info *fb_info) -{ - return fb_info->monspecs.dpms; -} - - /* * Command line options */ diff -u --recursive --new-file v2.3.28/linux/drivers/video/fbmon.c linux/drivers/video/fbmon.c --- v2.3.28/linux/drivers/video/fbmon.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/fbmon.c Sun Nov 21 11:09:22 1999 @@ -0,0 +1,74 @@ +/* + * linux/drivers/video/fbmon.c + * + * Copyright (C) 1999 James Simmons + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + * + * Notes: + * This code handles the different types of monitors that are out their. + * Most video cards for example can support a mode like 800x600 but fix + * frequency monitors can't. So the code here checks if the monitor can + * support the mode as well as the card can. Fbmonospecs takes on + * different meaning with different types of monitors. For multifrequency + * monitors fbmonospecs represents the range of frequencies the monitor + * can support. Only one fbmonospec needs to be allocated. The fbmonospecs + * pointer in fb_info points to this one. If you specific a mode that has + * timing greater than the allowed range then setting the video mode will + * fail. With multifrequency monitors you can set any mode you like as long + * as you have a programmable clock on the video card. + * With fixed frequency monitors you have only a SET of very narrow + * allowed frequency ranges. So for a fixed fequency monitor you have a + * array of fbmonospecs. The fbmonospecs in fb_info represents the + * monitor frequency for the CURRENT mode. If you change the mode and ask + * for fbmonospecs you will NOT get the same values as before. Note this + * is not true for multifrequency monitors where you do get the same + * fbmonospecs each time. Also the values in each fbmonospecs represent the + * very narrow frequency band for range. Well you can't have exactly the + * same frequencies from fixed monitor. So some tolerance is excepted. + * By DEFAULT all monitors are assumed fixed frequency since they are so + * easy to fry or screw up a mode with. Just try setting a 800x600 mode on + * one. After you boot you can run a simple program the tells what kind of + * monitor you have. If you have a multifrequency monitor then you can set + * any mode size you like as long as your video card has a programmable clock. + * By default also besides assuming you have a fixed frequency monitor it + * assumes the monitor only supports lower modes. This way for example you + * can't set a 1280x1024 mode on a fixed frequency monitor that can only + * support up to 1024x768. + * + */ +#include +#include + +int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, + const struct fb_info *fb_info) +{ +#if 0 + /* + * long long divisions .... $#%%#$ + */ + unsigned long long hpicos, vpicos; + const unsigned long long _1e12 = 1000000000000ULL; + const struct fb_monspecs *monspecs = &fb_info->monspecs; + + hpicos = (unsigned long long)htotal*(unsigned long long)pixclock; + vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos; + if (!vpicos) + return 0; + + if (monspecs->hfmin == 0) + return 1; + + if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 || + vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12) + return 0; +#endif + return 1; +} + +int fbmon_dpms(const struct fb_info *fb_info) +{ + return fb_info->monspecs.dpms; +} diff -u --recursive --new-file v2.3.28/linux/drivers/video/matroxfb.c linux/drivers/video/matroxfb.c --- v2.3.28/linux/drivers/video/matroxfb.c Fri Sep 10 23:57:36 1999 +++ linux/drivers/video/matroxfb.c Fri Nov 19 11:38:21 1999 @@ -587,7 +587,6 @@ int text_type_aux; int video64bits; unsigned int vgastep; - unsigned int vgastepdisp; unsigned int textmode; unsigned int textstep; unsigned int textvram; /* character cells */ @@ -5490,10 +5489,11 @@ #define DEVF_DMA 0x80 #define DEVF_SUPPORT32MB 0x100 #define DEVF_ANY_VXRES 0x200 +#define DEVF_TEXT16B 0x400 #define DEVF_G100 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2) /* no doc, no vxres... */ #define DEVF_G200 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2 | DEVF_ANY_VXRES) -#define DEVF_G400 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2 | DEVF_ANY_VXRES | DEVF_SUPPORT32MB) +#define DEVF_G400 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2 | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B) static struct board { unsigned short vendor, device, rev, svid, sid; @@ -5666,12 +5666,14 @@ if (b->flags & DEVF_TEXT4B) { ACCESS_FBINFO(devflags.vgastep) = 4; ACCESS_FBINFO(devflags.textmode) = 4; - ACCESS_FBINFO(devflags.vgastepdisp) = 16; + ACCESS_FBINFO(devflags.text_type_aux) = FB_AUX_TEXT_MGA_STEP16; + } else if (b->flags & DEVF_TEXT16B) { + ACCESS_FBINFO(devflags.vgastep) = 16; + ACCESS_FBINFO(devflags.textmode) = 1; ACCESS_FBINFO(devflags.text_type_aux) = FB_AUX_TEXT_MGA_STEP16; } else { ACCESS_FBINFO(devflags.vgastep) = 8; ACCESS_FBINFO(devflags.textmode) = 1; - ACCESS_FBINFO(devflags.vgastepdisp) = 64; ACCESS_FBINFO(devflags.text_type_aux) = FB_AUX_TEXT_MGA_STEP8; } #ifdef CONFIG_FB_MATROX_32MB diff -u --recursive --new-file v2.3.28/linux/drivers/video/tgafb.c linux/drivers/video/tgafb.c --- v2.3.28/linux/drivers/video/tgafb.c Tue Aug 31 17:29:14 1999 +++ linux/drivers/video/tgafb.c Tue Nov 23 10:10:38 1999 @@ -937,7 +937,7 @@ static void tgafb_set_disp(const void *fb_par, struct display *disp, struct fb_info_gen *info) { - disp->screen_base = ioremap(fb_info.tga_fb_base); + disp->screen_base = ioremap(fb_info.tga_fb_base, 0); switch (fb_info.tga_type) { #ifdef FBCON_HAS_CFB8 case 0: /* 8-plane */ diff -u --recursive --new-file v2.3.28/linux/drivers/zorro/proc.c linux/drivers/zorro/proc.c --- v2.3.28/linux/drivers/zorro/proc.c Mon Nov 1 13:56:27 1999 +++ linux/drivers/zorro/proc.c Fri Nov 19 11:33:29 1999 @@ -99,8 +99,8 @@ NULL /* revalidate */ }; -int -get_zorro_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int +get_zorro_dev_info(char *buf, char **start, off_t pos, int count) { u_int slot; off_t at = 0; diff -u --recursive --new-file v2.3.28/linux/fs/Config.in linux/fs/Config.in --- v2.3.28/linux/fs/Config.in Sun Nov 7 16:37:34 1999 +++ linux/fs/Config.in Sat Nov 20 10:11:27 1999 @@ -12,14 +12,14 @@ tristate 'ADFS filesystem support (read only) (EXPERIMENTAL)' CONFIG_ADFS_FS fi tristate 'Amiga FFS filesystem support' CONFIG_AFFS_FS -tristate 'Apple Macintosh filesystem support (EXPERIMENTAL)' CONFIG_HFS_FS -# msdos filesystems if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate 'Apple Macintosh filesystem support (EXPERIMENTAL)' CONFIG_HFS_FS tristate 'BFS filesystem (read only) support (EXPERIMENTAL)' CONFIG_BFS_FS if [ "$CONFIG_BFS_FS" != "n" ]; then bool ' BFS filesystem write support (DANGEROUS)' CONFIG_BFS_FS_WRITE fi fi +# msdos filesystems tristate 'DOS FAT fs support' CONFIG_FAT_FS dep_tristate ' MSDOS fs support' CONFIG_MSDOS_FS $CONFIG_FAT_FS dep_tristate ' UMSDOS: Unix-like filesystem on top of standard MSDOS filesystem' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS diff -u --recursive --new-file v2.3.28/linux/fs/Makefile linux/fs/Makefile --- v2.3.28/linux/fs/Makefile Mon Nov 1 13:56:27 1999 +++ linux/fs/Makefile Fri Nov 19 11:34:24 1999 @@ -265,14 +265,6 @@ endif endif -ifeq ($(CONFIG_BINFMT_ELF),y) -BINFMTS += binfmt_elf.o -else - ifeq ($(CONFIG_BINFMT_ELF),m) - M_OBJS += binfmt_elf.o - endif -endif - ifeq ($(CONFIG_BINFMT_AOUT),y) BINFMTS += binfmt_aout.o else @@ -289,7 +281,6 @@ endif endif - ifeq ($(CONFIG_BINFMT_MISC),y) BINFMTS += binfmt_misc.o else @@ -300,5 +291,13 @@ # binfmt_script is always there BINFMTS += binfmt_script.o + +ifeq ($(CONFIG_BINFMT_ELF),y) +BINFMTS += binfmt_elf.o +else + ifeq ($(CONFIG_BINFMT_ELF),m) + M_OBJS += binfmt_elf.o + endif +endif include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.3.28/linux/fs/binfmt_aout.c linux/fs/binfmt_aout.c --- v2.3.28/linux/fs/binfmt_aout.c Fri Oct 22 13:21:52 1999 +++ linux/fs/binfmt_aout.c Tue Nov 23 10:04:00 1999 @@ -27,7 +27,7 @@ #include #include -#include +#include static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); static int load_aout_library(int fd); @@ -551,5 +551,8 @@ unregister_binfmt(&aout_format); } -module_init(init_aout_binfmt) -module_exit(exit_aout_binfmt) +EXPORT_NO_SYMBOLS; + +module_init(init_aout_binfmt); +module_exit(exit_aout_binfmt); + diff -u --recursive --new-file v2.3.28/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c --- v2.3.28/linux/fs/binfmt_elf.c Mon Nov 1 13:56:27 1999 +++ linux/fs/binfmt_elf.c Sat Nov 20 10:09:05 1999 @@ -31,7 +31,7 @@ #include #include -#include +#include #include diff -u --recursive --new-file v2.3.28/linux/fs/binfmt_misc.c linux/fs/binfmt_misc.c --- v2.3.28/linux/fs/binfmt_misc.c Thu Nov 11 20:11:49 1999 +++ linux/fs/binfmt_misc.c Tue Nov 23 10:04:00 1999 @@ -15,7 +15,6 @@ * 1997-08-09 removed extension stripping, locking cleanup */ -#include #include #include @@ -515,5 +514,5 @@ EXPORT_NO_SYMBOLS; -module_init(init_misc_binfmt) -module_exit(exit_misc_binfmt) +module_init(init_misc_binfmt); +module_exit(exit_misc_binfmt); diff -u --recursive --new-file v2.3.28/linux/fs/coda/sysctl.c linux/fs/coda/sysctl.c --- v2.3.28/linux/fs/coda/sysctl.c Thu Nov 11 20:11:49 1999 +++ linux/fs/coda/sysctl.c Fri Nov 19 11:33:29 1999 @@ -285,7 +285,7 @@ } int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -352,7 +352,7 @@ } int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; int i; @@ -399,7 +399,7 @@ } int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -428,7 +428,7 @@ } int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; diff -u --recursive --new-file v2.3.28/linux/fs/exec.c linux/fs/exec.c --- v2.3.28/linux/fs/exec.c Thu Nov 11 20:11:49 1999 +++ linux/fs/exec.c Sat Nov 20 10:09:05 1999 @@ -35,7 +35,7 @@ #include #include -#include +#include #include #ifdef CONFIG_KMOD diff -u --recursive --new-file v2.3.28/linux/fs/inode.c linux/fs/inode.c --- v2.3.28/linux/fs/inode.c Thu Nov 18 20:25:37 1999 +++ linux/fs/inode.c Thu Nov 18 19:30:51 1999 @@ -4,6 +4,7 @@ * (C) 1997 Linus Torvalds */ +#include #include #include #include diff -u --recursive --new-file v2.3.28/linux/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c --- v2.3.28/linux/fs/ncpfs/dir.c Thu Nov 11 20:11:49 1999 +++ linux/fs/ncpfs/dir.c Sat Nov 20 10:09:05 1999 @@ -522,7 +522,7 @@ if (!page) goto read_really; - ctl.cache = cache = (union ncp_dir_cache *) page_address(page); + ctl.cache = cache = (union ncp_dir_cache *) kmap(page); ctl.head = cache->head; if (!Page_Uptodate(page) || !ctl.head.eof) @@ -550,10 +550,10 @@ ctl.page = ncp_get_cache_page(inode, ctl.ofs, 1); if (!ctl.page) goto invalid_cache; + ctl.cache = (union ncp_dir_cache *) + kmap(ctl.page); if (!Page_Uptodate(ctl.page)) goto invalid_cache; - ctl.cache = (union ncp_dir_cache *) - page_address(ctl.page); } while (ctl.idx < NCP_DIRCACHE_SIZE) { struct dentry *dent; @@ -575,6 +575,7 @@ goto finished; } if (ctl.page) { + kunmap(ctl.page); SetPageUptodate(ctl.page); UnlockPage(ctl.page); page_cache_release(ctl.page); @@ -585,6 +586,7 @@ } invalid_cache: if (ctl.page) { + kunmap(ctl.page); UnlockPage(ctl.page); page_cache_release(ctl.page); ctl.page = NULL; @@ -614,12 +616,14 @@ ctl.head.eof = ctl.valid; finished: if (page) { + kunmap(page); cache->head = ctl.head; SetPageUptodate(page); UnlockPage(page); page_cache_release(page); } if (ctl.page) { + kunmap(ctl.page); SetPageUptodate(ctl.page); UnlockPage(ctl.page); page_cache_release(ctl.page); @@ -680,6 +684,7 @@ if (ctl.idx >= NCP_DIRCACHE_SIZE) { if (ctl.page) { + kunmap(ctl.page); SetPageUptodate(ctl.page); UnlockPage(ctl.page); page_cache_release(ctl.page); @@ -690,7 +695,7 @@ ctl.page = ncp_get_cache_page(inode, ctl.ofs, 0); if (ctl.page) ctl.cache = (union ncp_dir_cache *) - page_address(ctl.page); + kmap(ctl.page); } if (ctl.cache) { ctl.cache->dentry[ctl.idx] = newdent; diff -u --recursive --new-file v2.3.28/linux/fs/ncpfs/mmap.c linux/fs/ncpfs/mmap.c --- v2.3.28/linux/fs/ncpfs/mmap.c Thu Nov 11 20:11:49 1999 +++ linux/fs/ncpfs/mmap.c Sat Nov 20 10:09:05 1999 @@ -43,10 +43,11 @@ int bufsize; int pos; - page = alloc_page(GFP_KERNEL); + page = alloc_page(GFP_HIGHMEM); /* ncpfs has nothing against GFP_HIGHMEM + as long as recvmsg and memset works on it */ if (!page) return page; - pg_addr = page_address(page); + pg_addr = kmap(page); address &= PAGE_MASK; pos = address - area->vm_start + (area->vm_pgoff << PAGE_SHIFT); @@ -87,6 +88,7 @@ if (already_read < PAGE_SIZE) memset((char*)(pg_addr + already_read), 0, PAGE_SIZE - already_read); + kunmap(page); return page; } diff -u --recursive --new-file v2.3.28/linux/fs/nfs/dir.c linux/fs/nfs/dir.c --- v2.3.28/linux/fs/nfs/dir.c Mon Nov 1 13:56:27 1999 +++ linux/fs/nfs/dir.c Tue Nov 23 10:04:00 1999 @@ -346,8 +346,9 @@ goto repeat; } + kmap(page); rd_args.fh = NFS_FH(dentry); - rd_res.buffer = (char *)page_address(page_cache); + rd_res.buffer = (char *)page_address(page); rd_res.bufsiz = PAGE_CACHE_SIZE; rd_res.cookie = *cookiep; do { @@ -365,6 +366,8 @@ goto error; SetPageUptodate(page); +unmap_out: + kunmap(page); unlock_out: UnlockPage(page); out: @@ -372,7 +375,7 @@ error: SetPageError(page); - goto unlock_out; + goto unmap_out; } /* Seek up to dirent assosciated with the passed in cookie, @@ -438,8 +441,10 @@ if (!Page_Uptodate(page)) goto dirent_read_error; success: + kmap(page); filp->f_pos = nfs_do_filldir((__u32 *) page_address(page), filp->f_pos, dirent, filldir); + kunmap(page); page_cache_release(page); return 0; @@ -681,6 +686,7 @@ NULL /* d_iput */ }; +#if 0 /* dead code */ #ifdef NFS_PARANOIA /* * Display all dentries holding the specified inode. @@ -702,7 +708,8 @@ unhashed); } } -#endif +#endif /* NFS_PARANOIA */ +#endif /* 0 */ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry) { diff -u --recursive --new-file v2.3.28/linux/fs/nfs/file.c linux/fs/nfs/file.c --- v2.3.28/linux/fs/nfs/file.c Fri Oct 15 15:25:14 1999 +++ linux/fs/nfs/file.c Sat Nov 20 10:09:05 1999 @@ -171,7 +171,8 @@ { long status; - bytes -= copy_from_user((u8*)page_address(page) + offset, buf, bytes); + bytes -= copy_from_user((u8*)kmap(page) + offset, buf, bytes); + kunmap(page); status = -EFAULT; if (bytes) { lock_kernel(); diff -u --recursive --new-file v2.3.28/linux/fs/nfs/read.c linux/fs/nfs/read.c --- v2.3.28/linux/fs/nfs/read.c Mon Nov 1 13:56:27 1999 +++ linux/fs/nfs/read.c Sat Nov 20 10:09:05 1999 @@ -71,7 +71,7 @@ { struct nfs_rreq rqst; unsigned long offset = page->index << PAGE_CACHE_SHIFT; - char *buffer = (char *) page_address(page); + char *buffer; int rsize = NFS_SERVER(inode)->rsize; int result, refresh = 0; int count = PAGE_SIZE; @@ -79,6 +79,12 @@ dprintk("NFS: nfs_readpage_sync(%p)\n", page); + /* + * This works now because the socket layer never tries to DMA + * into this buffer directly. + */ + buffer = (char *) kmap(page); + do { if (count < rsize) rsize = count; @@ -116,6 +122,7 @@ result = 0; io_error: + kunmap(page); UnlockPage(page); /* Note: we don't refresh if the call returned error */ if (refresh && result >= 0) @@ -152,6 +159,7 @@ fail++; dprintk("NFS: %d successful reads, %d failures\n", succ, fail); } + kunmap(page); UnlockPage(page); free_page(address); @@ -163,7 +171,7 @@ nfs_readpage_async(struct dentry *dentry, struct inode *inode, struct page *page) { - unsigned long address = page_address(page); + unsigned long address; struct nfs_rreq *req; int result = -1, flags; @@ -177,6 +185,7 @@ if (!req) goto out_defer; + address = kmap(page); /* Initialize request */ /* N.B. Will the dentry remain valid for life of request? */ nfs_readreq_setup(req, NFS_FH(dentry), page->index << PAGE_CACHE_SHIFT, @@ -200,6 +209,7 @@ goto out; out_free: dprintk("NFS: failed to enqueue async READ request.\n"); + kunmap(page); kfree(req); goto out; } @@ -254,7 +264,7 @@ out_error: UnlockPage(page); out_free: - free_page(page_address(page)); + __free_page(page); out: unlock_kernel(); return error; diff -u --recursive --new-file v2.3.28/linux/fs/nfs/symlink.c linux/fs/nfs/symlink.c --- v2.3.28/linux/fs/nfs/symlink.c Wed Oct 27 16:34:12 1999 +++ linux/fs/nfs/symlink.c Sat Nov 20 10:09:05 1999 @@ -80,6 +80,8 @@ goto repeat; } + kmap(page); + /* We place the length at the beginning of the page, * in host byte order, followed by the string. The * XDR response verification will NULL terminate it. @@ -91,6 +93,7 @@ goto error; SetPageUptodate(page); unlock_out: + kunmap(page); UnlockPage(page); out: return page; @@ -113,11 +116,12 @@ if (!Page_Uptodate(page)) goto readlink_read_error; success: - p = (u32 *) page_address(page); + p = (u32 *) kmap(page); len = *p++; if (len > buflen) len = buflen; copy_to_user(buffer, p, len); + kunmap(page); page_cache_release(page); return len; @@ -148,8 +152,9 @@ if (!Page_Uptodate(page)) goto followlink_read_error; success: - p = (u32 *) page_address(page); + p = (u32 *) kmap(page); result = lookup_dentry((char *) (p + 1), base, follow); + kunmap(page); page_cache_release(page); return result; diff -u --recursive --new-file v2.3.28/linux/fs/nfs/write.c linux/fs/nfs/write.c --- v2.3.28/linux/fs/nfs/write.c Mon Nov 1 13:56:27 1999 +++ linux/fs/nfs/write.c Sat Nov 20 10:09:05 1999 @@ -99,7 +99,7 @@ dentry->d_parent->d_name.name, dentry->d_name.name, count, page->index, offset); - buffer = (u8 *) page_address(page) + offset; + buffer = (u8 *) kmap(page) + offset; offset += page->index << PAGE_CACHE_SHIFT; do { @@ -132,6 +132,7 @@ } while (count); io_error: + kunmap(page); /* Note: we don't refresh if the call failed (fattr invalid) */ if (refresh && result >= 0) { /* See comments in nfs_wback_result */ @@ -314,6 +315,7 @@ wreq->wb_bytes = bytes; wreq->wb_count = 2; /* One for the IO, one for us */ + kmap(page); append_write_request(&NFS_WRITEBACK(inode), wreq); if (nr_write_requests++ > NFS_WRITEBACK_MAX*3/4) @@ -687,6 +689,7 @@ if (WB_INVALIDATE(req)) ClearPageUptodate(page); + kunmap(page); __free_page(page); remove_write_request(&NFS_WRITEBACK(inode), req); nr_write_requests--; diff -u --recursive --new-file v2.3.28/linux/fs/nfsd/nfsfh.c linux/fs/nfsd/nfsfh.c --- v2.3.28/linux/fs/nfsd/nfsfh.c Sun Nov 7 16:37:34 1999 +++ linux/fs/nfsd/nfsfh.c Mon Nov 22 17:29:23 1999 @@ -5,7 +5,7 @@ * * Copyright (C) 1995, 1996 Olaf Kirch * Portions Copyright (C) 1999 G. Allen Morris III - * Extensive cleanup by Neil Brown Southern-Spring 1999 + * Extensive rewrite by Neil Brown Southern-Spring 1999 */ #include @@ -63,7 +63,7 @@ } /* - * Read a directory and return the name of the specified entry. + * Read a directory and return the name of the specified entry. i_sem is already down(). */ static int get_ino_name(struct dentry *dentry, struct qstr *name, unsigned long ino) { @@ -94,9 +94,7 @@ buffer.sequence = 0; while (1) { int old_seq = buffer.sequence; - down(&dir->i_sem); error = file.f_op->readdir(&file, &buffer, filldir_one); - up(&dir->i_sem); if (error < 0) break; @@ -118,7 +116,7 @@ /* this should be provided by each filesystem in an nfsd_operations interface as * iget isn't really the right interface */ -static inline struct dentry *nfsd_iget(struct super_block *sb, unsigned long ino, __u32 generation) +static struct dentry *nfsd_iget(struct super_block *sb, unsigned long ino, __u32 generation) { /* iget isn't really right if the inode is currently unallocated!! @@ -209,6 +207,7 @@ * it is well connected. But nobody returns different dentrys do they? */ pdentry = child->d_inode->i_op->lookup(child->d_inode, tdentry); + d_drop(tdentry); /* we never want ".." hashed */ if (!pdentry) { /* I don't want to return a ".." dentry. * I would prefer to return an unconnected "IS_ROOT" dentry, @@ -233,10 +232,62 @@ if (pdentry == NULL) pdentry = ERR_PTR(-ENOMEM); } - dput(tdentry); /* it was never rehashed, it will be discarded */ + dput(tdentry); /* it is not hashed, it will be discarded */ return pdentry; } +static struct dentry *splice(struct dentry *child, struct dentry *parent) +{ + int err = 0; + struct qstr qs; + char namebuf[256]; + struct list_head *lp; + struct dentry *tmp; + /* child is an IS_ROOT (anonymous) dentry, but it is hypothesised that + * it should be a child of parent. + * We see if we can find a name and, if we can - splice it in. + * We hold the i_sem on the parent the whole time to try to follow locking protocols. + */ + qs.name = namebuf; + down(&parent->d_inode->i_sem); + + /* Now, things might have changed while we waited. + * Possibly a friendly filesystem found child and spliced it in in response + * to a lookup (though nobody does this yet). In this case, just succeed. + */ + if (child->d_parent == parent) goto out; + /* Possibly a new dentry has been made for this child->d_inode in parent by + * a lookup. In this case return that dentry. caller must notice and act accordingly + */ + for (lp = child->d_inode->i_dentry.next; lp != &child->d_inode->i_dentry ; lp=lp->next) { + tmp = list_entry(lp,struct dentry, d_alias); + if (tmp->d_parent == parent) { + child = dget(tmp); + goto out; + } + } + /* well, if we can find a name for child in parent, it should be safe to splice it in */ + err = get_ino_name(parent, &qs, child->d_inode->i_ino); + if (err) + goto out; + tmp = d_lookup(parent, &qs); + if (tmp) { + /* Now that IS odd. I wonder what it means... */ + err = -EEXIST; + printk("nfsd-fh: found a name that I didn't expect: %s/%s\n", parent->d_name.name, qs.name); + dput(tmp); + goto out; + } + err = d_splice(child, parent, &qs); + dprintk("nfsd_fh: found name %s for ino %ld\n", child->d_name.name, child->d_inode->i_ino); + out: + up(&parent->d_inode->i_sem); + if (err) + return ERR_PTR(err); + else + return child; +} + /* * This is the basic lookup mechanism for turning an NFS file handle * into a dentry. @@ -248,15 +299,22 @@ find_fh_dentry(struct super_block *sb, struct knfs_fh *fh, int needpath) { struct dentry *dentry, *result = NULL; - struct qstr qs; - char namebuf[256]; + struct dentry *tmp; int found =0; u32 err; + /* This semaphore is needed to make sure that only one unconnected (free) + * dcache path ever exists, as otherwise two partial paths might get + * joined together, which would be very confusing. + * If there is ever an unconnected non-root directory, then this lock + * must be held. This could sensibly be per-filesystem. + */ + static DECLARE_MUTEX(free_path_sem); - qs.name = namebuf; + nfsdstats.fh_lookup++; /* * Attempt to find the inode. */ + retry: result = nfsd_iget(sb, fh->fh_ino, fh->fh_generation); err = PTR_ERR(result); if (IS_ERR(result)) @@ -269,10 +327,11 @@ if (!IS_ROOT(result) || result->d_inode->i_sb->s_root ==result) return result; - /* result is now a "root" dentry, which may be adequate as it stands, or else + /* result is now an anonymous dentry, which may be adequate as it stands, or else * will get spliced into the dcache tree */ if (!S_ISDIR(result->d_inode->i_mode) && ! needpath) { + nfsdstats.fh_anon++; return result; } @@ -280,8 +339,10 @@ * location in the tree. */ dprintk("nfs_fh: need to look harder for %d/%d\n",sb->s_dev,fh->fh_ino); + down(&free_path_sem); found = 0; if (!S_ISDIR(result->d_inode->i_mode)) { + nfsdstats.fh_nocache_nondir++; if (fh->fh_dirino == 0) goto err_result; /* don't know how to find parent */ else { @@ -297,22 +358,26 @@ } if (!IS_ROOT(dentry) || dentry->d_inode->i_sb->s_root ==dentry) found = 1; - err = get_ino_name(dentry, &qs, result->d_inode->i_ino); - if (err) - goto err_dentry; - - /* OK, we have the name in parent of inode, lets fill in the dentry */ - err = d_splice(result, dentry, &qs); - if (err) + tmp = splice(result, dentry); + err = PTR_ERR(tmp); + if (IS_ERR(tmp)) goto err_dentry; + if (tmp != result) { + /* it is safe to just use tmp instead, but we must discard result first */ + d_drop(result); + dput(result); + result = tmp; + /* If !found, then this is really wierd, but it shouldn't hurt */ + } } - } - else + } else { + nfsdstats.fh_nocache_dir++; dentry = dget(result); + } while(!found) { /* LOOP INVARIANT */ - /* haven't found a place in the tree yet, but we do have a path + /* haven't found a place in the tree yet, but we do have a free path * from dentry down to result, and dentry is a directory. * Have a hold on dentry and result */ struct dentry *pdentry; @@ -334,23 +399,41 @@ if (!IS_ROOT(pdentry) || parent->i_sb->s_root == pdentry) found = 1; - err = get_ino_name(pdentry, &qs, dentry->d_inode->i_ino); - if (err) { + tmp = splice(dentry, pdentry); + if (tmp != dentry) { + /* Something wrong. We need to drop thw whole dentry->result path + * whatever it was + */ + struct dentry *d; + for (d=result ; d ; d=(d->d_parent == d)?NULL:d->d_parent) + d_drop(d); + } + if (IS_ERR(tmp)) { + err = PTR_ERR(tmp); dput(pdentry); goto err_dentry; } - err = d_splice(dentry, pdentry, &qs); - dprintk("nfsd_fh: found name %s for ino %ld\n", dentry->d_name.name, dentry->d_inode->i_ino); + if (tmp != dentry) { + /* we lost a race, try again + */ + dput(tmp); + dput(dentry); + dput(result); /* this will discard the whole free path, so we can up the semaphore */ + up(&free_path_sem); + goto retry; + } dput(dentry); dentry = pdentry; } dput(dentry); + up(&free_path_sem); return result; err_dentry: dput(dentry); err_result: dput(result); + up(&free_path_sem); err_out: if (err == -ESTALE) nfsdstats.fh_stale++; diff -u --recursive --new-file v2.3.28/linux/fs/nfsd/nfsproc.c linux/fs/nfsd/nfsproc.c --- v2.3.28/linux/fs/nfsd/nfsproc.c Mon Apr 12 10:08:18 1999 +++ linux/fs/nfsd/nfsproc.c Mon Nov 22 17:29:23 1999 @@ -237,6 +237,9 @@ if (nfserr) goto done; inode = newfhp->fh_dentry->d_inode; + if (inode && newfhp->fh_handle.fh_ino == 0) + /* inode might have been instantiated while we slept */ + fh_update(newfhp); /* Unfudge the mode bits */ if (attr->ia_valid & ATTR_MODE) { diff -u --recursive --new-file v2.3.28/linux/fs/nfsd/stats.c linux/fs/nfsd/stats.c --- v2.3.28/linux/fs/nfsd/stats.c Thu Nov 18 20:25:37 1999 +++ linux/fs/nfsd/stats.c Mon Nov 22 17:29:23 1999 @@ -38,11 +38,12 @@ nfsdstats.rchits, nfsdstats.rcmisses, nfsdstats.rcnocache, - nfsdstats.fh_cached, - nfsdstats.fh_valid, - nfsdstats.fh_fixup, + nfsdstats.fh_stale, nfsdstats.fh_lookup, - nfsdstats.fh_stale); + nfsdstats.fh_anon, + nfsdstats.fh_nocache_dir, + nfsdstats.fh_nocache_nondir); + /* Assume we haven't hit EOF yet. Will be set by svc_proc_read. */ *eof = 0; diff -u --recursive --new-file v2.3.28/linux/fs/pipe.c linux/fs/pipe.c --- v2.3.28/linux/fs/pipe.c Fri Sep 10 23:57:36 1999 +++ linux/fs/pipe.c Sun Nov 21 11:17:45 1999 @@ -51,6 +51,7 @@ /* Seeks are not allowed on pipes. */ ret = -ESPIPE; + read = 0; if (ppos != &filp->f_pos) goto out_nolock; @@ -65,6 +66,7 @@ goto out_nolock; if (PIPE_EMPTY(*inode)) { +do_more_read: ret = 0; if (!PIPE_WRITERS(*inode)) goto out; @@ -74,7 +76,9 @@ goto out; for (;;) { + PIPE_WAITING_READERS(*inode)++; pipe_wait(inode); + PIPE_WAITING_READERS(*inode)--; ret = -ERESTARTSYS; if (signal_pending(current)) goto out_nolock; @@ -90,7 +94,6 @@ /* Read what data is available. */ ret = -EFAULT; - read = 0; while (count > 0 && (size = PIPE_LEN(*inode))) { char *pipebuf = PIPE_BASE(*inode) + PIPE_START(*inode); ssize_t chars = PIPE_MAX_RCHUNK(*inode); @@ -115,16 +118,26 @@ if (!PIPE_LEN(*inode)) PIPE_START(*inode) = 0; - /* Signal writers there is more room. */ + if (count && PIPE_WAITING_WRITERS(*inode) && !(filp->f_flags & O_NONBLOCK)) { + /* + * We know that we are going to sleep: signal + * writers synchronously that there is more + * room. + */ + wake_up_interruptible_sync(PIPE_WAIT(*inode)); + if (!PIPE_EMPTY(*inode)) + BUG(); + goto do_more_read; + } + /* Signal writers asynchronously that there is more room. */ wake_up_interruptible(PIPE_WAIT(*inode)); - if (read) - UPDATE_ATIME(inode); ret = read; - out: up(PIPE_SEM(*inode)); out_nolock: + if (read) + ret = read; return ret; } @@ -136,6 +149,7 @@ /* Seeks are not allowed on pipes. */ ret = -ESPIPE; + written = 0; if (ppos != &filp->f_pos) goto out_nolock; @@ -148,13 +162,13 @@ if (down_interruptible(PIPE_SEM(*inode))) goto out_nolock; +do_more_write: /* No readers yields SIGPIPE. */ if (!PIPE_READERS(*inode)) goto sigpipe; /* If count <= PIPE_BUF, we have to make it atomic. */ free = (count <= PIPE_BUF ? count : 1); - written = 0; /* Wait, or check for, available space. */ if (filp->f_flags & O_NONBLOCK) { @@ -163,7 +177,9 @@ goto out; } else { while (PIPE_FREE(*inode) < free) { + PIPE_WAITING_WRITERS(*inode)++; pipe_wait(inode); + PIPE_WAITING_WRITERS(*inode)--; ret = -ERESTARTSYS; if (signal_pending(current)) goto out_nolock; @@ -204,9 +220,15 @@ break; do { - /* This should be a synchronous wake-up: don't do idle reschedules! */ - wake_up_interruptible(PIPE_WAIT(*inode)); + /* + * Synchronous wake-up: it knows that this process + * is going to give up this CPU, so it doesnt have + * to do idle reschedules. + */ + wake_up_interruptible_sync(PIPE_WAIT(*inode)); + PIPE_WAITING_WRITERS(*inode)++; pipe_wait(inode); + PIPE_WAITING_WRITERS(*inode)--; if (signal_pending(current)) goto out_nolock; if (down_interruptible(PIPE_SEM(*inode))) @@ -217,19 +239,27 @@ ret = -EFAULT; } - /* Signal readers there is more data. */ + if (count && PIPE_WAITING_READERS(*inode) && + !(filp->f_flags & O_NONBLOCK)) { + wake_up_interruptible_sync(PIPE_WAIT(*inode)); + goto do_more_write; + } + /* Signal readers asynchronously that there is more data. */ wake_up_interruptible(PIPE_WAIT(*inode)); - ret = (written ? written : -EAGAIN); inode->i_ctime = inode->i_mtime = CURRENT_TIME; mark_inode_dirty(inode); out: up(PIPE_SEM(*inode)); out_nolock: + if (written) + ret = written; return ret; sigpipe: + if (written) + goto out; up(PIPE_SEM(*inode)); send_sig(SIGPIPE, current, 0); return -EPIPE; @@ -552,6 +582,7 @@ PIPE_BASE(*inode) = (char *) page; PIPE_START(*inode) = PIPE_LEN(*inode) = 0; PIPE_READERS(*inode) = PIPE_WRITERS(*inode) = 1; + PIPE_WAITING_READERS(*inode) = PIPE_WAITING_WRITERS(*inode) = 0; /* * Mark the inode dirty from the very beginning, diff -u --recursive --new-file v2.3.28/linux/fs/proc/Makefile linux/fs/proc/Makefile --- v2.3.28/linux/fs/proc/Makefile Thu Nov 11 20:11:50 1999 +++ linux/fs/proc/Makefile Thu Nov 18 20:02:57 1999 @@ -18,9 +18,11 @@ ifeq ($(CONFIG_SUN_OPENPROMFS),y) O_OBJS += openpromfs.o +OX_OBJS := openprom-dev.o else ifeq ($(CONFIG_SUN_OPENPROMFS),m) M_OBJS += openpromfs.o + OX_OBJS := openprom-dev.o endif endif diff -u --recursive --new-file v2.3.28/linux/fs/proc/generic.c linux/fs/proc/generic.c --- v2.3.28/linux/fs/proc/generic.c Mon Nov 1 13:56:27 1999 +++ linux/fs/proc/generic.c Fri Nov 19 21:16:10 1999 @@ -16,8 +16,6 @@ #include #include -extern struct inode_operations proc_dyna_dir_inode_operations; - static ssize_t proc_file_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos); static ssize_t proc_file_write(struct file * file, const char * buffer, @@ -37,37 +35,10 @@ proc_file_lseek, /* lseek */ proc_file_read, /* read */ proc_file_write, /* write */ - NULL, /* readdir */ - NULL, /* poll */ - NULL, /* ioctl */ - NULL, /* mmap */ - NULL, /* no special open code */ - NULL, /* flush */ - NULL, /* no special release code */ - NULL /* can't fsync */ }; -struct inode_operations proc_file_inode_operations = { +static struct inode_operations proc_file_inode_operations = { &proc_file_operations, /* default proc file-ops */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ }; #ifndef MIN @@ -101,12 +72,8 @@ /* * Handle backwards compatibility with the old net * routines. - * - * XXX What gives with the file->f_flags & O_ACCMODE - * test? Seems stupid to me.... */ - n = dp->get_info(page, &start, *ppos, count, - (file->f_flags & O_ACCMODE) == O_RDWR); + n = dp->get_info(page, &start, *ppos, count); if (n < count) eof = 1; } else if (dp->read_proc) { @@ -114,7 +81,7 @@ count, &eof, dp->data); } else break; - + if (!start) { /* * For proc files that are less than 4k @@ -221,6 +188,340 @@ return 0; } +static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8] = {0}; + +static int make_inode_number(void) +{ + int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC); + if (i<0 || i>=PROC_NDYNAMIC) + return -1; + set_bit(i, (void *) proc_alloc_map); + return PROC_DYNAMIC_FIRST + i; +} + +static int proc_readlink(struct dentry * dentry, char * buffer, int buflen) +{ + struct inode *inode = dentry->d_inode; + struct proc_dir_entry * de; + int len; + de = (struct proc_dir_entry *) inode->u.generic_ip; + len = de->size+1; + if (len > buflen) + len = buflen; + copy_to_user(buffer, de->data, len); + return len; +} + +struct dentry * proc_follow_link(struct dentry * dentry, struct dentry *base, unsigned int follow) +{ + struct inode *inode = dentry->d_inode; + struct proc_dir_entry * de; + de = (struct proc_dir_entry *) inode->u.generic_ip; + return lookup_dentry(de->data, base, follow); +} + +static struct inode_operations proc_link_inode_operations = { + NULL, /* no file-ops */ + NULL, /* create */ + NULL, /* lookup */ + NULL, /* link */ + NULL, /* unlink */ + NULL, /* symlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* mknod */ + NULL, /* rename */ + proc_readlink, /* readlink */ + proc_follow_link, /* follow_link */ +}; + +/* + * As some entries in /proc are volatile, we want to + * get rid of unused dentries. This could be made + * smarter: we could keep a "volatile" flag in the + * inode to indicate which ones to keep. + */ +static void +proc_delete_dentry(struct dentry * dentry) +{ + d_drop(dentry); +} + +static struct dentry_operations proc_dentry_operations = +{ + NULL, /* revalidate */ + NULL, /* d_hash */ + NULL, /* d_compare */ + proc_delete_dentry /* d_delete(struct dentry *) */ +}; + +/* + * Don't create negative dentries here, return -ENOENT by hand + * instead. + */ +struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry) +{ + struct inode *inode; + struct proc_dir_entry * de; + int error; + + error = -ENOENT; + inode = NULL; + de = (struct proc_dir_entry *) dir->u.generic_ip; + if (de) { + for (de = de->subdir; de ; de = de->next) { + if (!de || !de->low_ino) + continue; + if (de->namelen != dentry->d_name.len) + continue; + if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { + int ino = de->low_ino; + error = -EINVAL; + inode = proc_get_inode(dir->i_sb, ino, de); + break; + } + } + } + + if (inode) { + dentry->d_op = &proc_dentry_operations; + d_add(dentry, inode); + return NULL; + } + return ERR_PTR(error); +} + +/* + * This returns non-zero if at EOF, so that the /proc + * root directory can use this and check if it should + * continue with the entries.. + * + * Note that the VFS-layer doesn't care about the return + * value of the readdir() call, as long as it's non-negative + * for success.. + */ +int proc_readdir(struct file * filp, + void * dirent, filldir_t filldir) +{ + struct proc_dir_entry * de; + unsigned int ino; + int i; + struct inode *inode = filp->f_dentry->d_inode; + + ino = inode->i_ino; + de = (struct proc_dir_entry *) inode->u.generic_ip; + if (!de) + return -EINVAL; + i = filp->f_pos; + switch (i) { + case 0: + if (filldir(dirent, ".", 1, i, ino) < 0) + return 0; + i++; + filp->f_pos++; + /* fall through */ + case 1: + if (filldir(dirent, "..", 2, i, + filp->f_dentry->d_parent->d_inode->i_ino + ) < 0) + return 0; + i++; + filp->f_pos++; + /* fall through */ + default: + de = de->subdir; + i -= 2; + for (;;) { + if (!de) + return 1; + if (!i) + break; + de = de->next; + i--; + } + + do { + if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino) < 0) + return 0; + filp->f_pos++; + de = de->next; + } while (de); + } + return 1; +} + +/* + * These are the generic /proc directory operations. They + * use the in-memory "struct proc_dir_entry" tree to parse + * the /proc directory. + */ +static struct file_operations proc_dir_operations = { + NULL, /* lseek - default */ + NULL, /* read - bad */ + NULL, /* write - bad */ + proc_readdir, /* readdir */ +}; + +/* + * proc directories can do almost nothing.. + */ +struct inode_operations proc_dir_inode_operations = { + &proc_dir_operations, /* default net directory file-ops */ + NULL, /* create */ + proc_lookup, /* lookup */ +}; + +int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) +{ + int i; + + i = make_inode_number(); + if (i < 0) + return -EAGAIN; + dp->low_ino = i; + dp->next = dir->subdir; + dp->parent = dir; + dir->subdir = dp; + if (S_ISDIR(dp->mode)) { + if (dp->ops == NULL) + dp->ops = &proc_dir_inode_operations; + dir->nlink++; + } else if (S_ISLNK(dp->mode)) { + if (dp->ops == NULL) + dp->ops = &proc_link_inode_operations; + } else if (S_ISREG(dp->mode)) { + if (dp->ops == NULL) + dp->ops = &proc_file_inode_operations; + } + return 0; +} + +/* + * Kill an inode that got unregistered.. + */ +static void proc_kill_inodes(struct proc_dir_entry *de) +{ + struct list_head *p; + struct super_block *sb; + + /* + * Actually it's a partial revoke(). We have to go through all + * copies of procfs. proc_super_blocks is protected by the big + * lock for the time being. + */ + for (sb = proc_super_blocks; + sb; + sb = (struct super_block*)sb->u.generic_sbp) { + file_list_lock(); + for (p = sb->s_files.next; p != &sb->s_files; p = p->next) { + struct file * filp = list_entry(p, struct file, f_list); + struct dentry * dentry; + struct inode * inode; + + dentry = filp->f_dentry; + if (!dentry) + continue; + if (dentry->d_op != &proc_dentry_operations) + continue; + inode = dentry->d_inode; + if (!inode) + continue; + if (inode->u.generic_ip != de) + continue; + filp->f_op = NULL; + } + file_list_unlock(); + } +} + +struct proc_dir_entry *proc_symlink(const char *name, + struct proc_dir_entry *parent, char *dest) +{ + struct proc_dir_entry *ent = NULL; + const char *fn = name; + int len; + + if (!parent && xlate_proc_name(name, &parent, &fn) != 0) + goto out; + len = strlen(fn); + + ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); + if (!ent) + goto out; + memset(ent, 0, sizeof(struct proc_dir_entry)); + memcpy(((char *) ent) + sizeof(*ent), fn, len + 1); + ent->name = ((char *) ent) + sizeof(*ent); + ent->namelen = len; + ent->nlink = 1; + ent->mode = S_IFLNK|S_IRUGO|S_IWUGO|S_IXUGO; + ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL); + if (!ent->data) { + kfree(ent); + goto out; + } + strcpy((char*)ent->data,dest); + + proc_register(parent, ent); + +out: + return ent; +} + +struct proc_dir_entry *proc_mknod(const char *name, mode_t mode, + struct proc_dir_entry *parent, kdev_t rdev) +{ + struct proc_dir_entry *ent = NULL; + const char *fn = name; + int len; + + if (!parent && xlate_proc_name(name, &parent, &fn) != 0) + goto out; + len = strlen(fn); + + ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); + if (!ent) + goto out; + memset(ent, 0, sizeof(struct proc_dir_entry)); + memcpy(((char *) ent) + sizeof(*ent), fn, len + 1); + ent->name = ((char *) ent) + sizeof(*ent); + ent->namelen = len; + ent->nlink = 1; + ent->mode = mode; + ent->rdev = rdev; + + proc_register(parent, ent); + +out: + return ent; +} + +struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *parent) +{ + struct proc_dir_entry *ent = NULL; + const char *fn = name; + int len; + + if (!parent && xlate_proc_name(name, &parent, &fn) != 0) + goto out; + len = strlen(fn); + + ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); + if (!ent) + goto out; + memset(ent, 0, sizeof(struct proc_dir_entry)); + memcpy(((char *) ent) + sizeof(*ent), fn, len + 1); + ent->name = ((char *) ent) + sizeof(*ent); + ent->namelen = len; + ent->ops = &proc_dir_inode_operations; + ent->nlink = 2; + ent->mode = S_IFDIR | S_IRUGO | S_IXUGO; + + proc_register(parent, ent); + +out: + return ent; +} + struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { @@ -243,7 +544,7 @@ if (S_ISDIR(mode)) { if ((mode & S_IALLUGO) == 0) mode |= S_IRUGO | S_IXUGO; - ent->ops = &proc_dyna_dir_inode_operations; + ent->ops = &proc_dir_inode_operations; ent->nlink = 2; } else { if ((mode & S_IFMT) == 0) @@ -260,14 +561,16 @@ return ent; } -extern void free_proc_entry(struct proc_dir_entry *); void free_proc_entry(struct proc_dir_entry *de) { int ino = de->low_ino; - if (ino >= PROC_DYNAMIC_FIRST && - ino < PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) - kfree(de); + if (ino < PROC_DYNAMIC_FIRST && + ino >= PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) + return; + if (S_ISLNK(de->mode) && de->data) + kfree(de->data); + kfree(de); } /* @@ -276,6 +579,7 @@ */ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) { + struct proc_dir_entry **p; struct proc_dir_entry *de; const char *fn = name; int len; @@ -283,14 +587,17 @@ if (!parent && xlate_proc_name(name, &parent, &fn) != 0) goto out; len = strlen(fn); - - for (de = parent->subdir; de ; de = de->next) { - if (proc_match(len, fn, de)) - break; - } - - if (de) { - proc_unregister(parent, de->low_ino); + for (p = &parent->subdir; *p; p=&(*p)->next ) { + if (!proc_match(len, fn, *p)) + continue; + de = *p; + *p = de->next; + de->next = NULL; + if (S_ISDIR(de->mode)) + parent->nlink--; + clear_bit(de->low_ino-PROC_DYNAMIC_FIRST, + (void *) proc_alloc_map); + proc_kill_inodes(de); de->nlink = 0; de->deleted = 1; if (!de->count) @@ -299,6 +606,7 @@ printk("remove_proc_entry: %s/%s busy, count=%d\n", parent->name, de->name, de->count); } + break; } out: return; diff -u --recursive --new-file v2.3.28/linux/fs/proc/inode-alloc.txt linux/fs/proc/inode-alloc.txt --- v2.3.28/linux/fs/proc/inode-alloc.txt Thu Nov 11 20:11:50 1999 +++ linux/fs/proc/inode-alloc.txt Fri Nov 19 11:33:29 1999 @@ -5,7 +5,6 @@ 001 root-ino 00001000-00001fff dynamic entries - 00002000-00002fff openprom entries 0001xxxx-7fffxxxx pid-dir entries for pid 1-7fff 80000000-ffffffff unused diff -u --recursive --new-file v2.3.28/linux/fs/proc/inode.c linux/fs/proc/inode.c --- v2.3.28/linux/fs/proc/inode.c Thu Nov 18 20:25:37 1999 +++ linux/fs/proc/inode.c Fri Nov 19 21:16:10 1999 @@ -13,7 +13,6 @@ #include #include #include -#include #define __NO_VERSION__ #include @@ -52,10 +51,6 @@ static void proc_put_inode(struct inode *inode) { -#ifdef CONFIG_SUN_OPENPROMFS_MODULE - if (PROC_INODE_OPENPROM(inode) && proc_openprom_use) - (*proc_openprom_use)(inode, 0); -#endif /* * Kill off unused inodes ... VFS will unhash and * delete the inode if we set i_nlink to zero. @@ -75,9 +70,6 @@ proc_pid_delete_inode(inode); return; } - if (PROC_INODE_OPENPROM(inode)) - return; - if (de) { if (de->owner) __MOD_DEC_USE_COUNT(de->owner); @@ -98,6 +90,30 @@ *p = (struct super_block *)(*p)->u.generic_sbp; } +static void proc_write_inode(struct inode * inode) +{ +} + +static void proc_read_inode(struct inode * inode) +{ + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; +} + +static int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) +{ + struct statfs tmp; + + tmp.f_type = PROC_SUPER_MAGIC; + tmp.f_bsize = PAGE_SIZE/sizeof(long); + tmp.f_blocks = 0; + tmp.f_bfree = 0; + tmp.f_bavail = 0; + tmp.f_files = 0; + tmp.f_ffree = 0; + tmp.f_namelen = NAME_MAX; + return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; +} + static struct super_operations proc_sops = { proc_read_inode, proc_write_inode, @@ -159,11 +175,6 @@ if (!inode) goto out_fail; -#ifdef CONFIG_SUN_OPENPROMFS_MODULE - if (PROC_INODE_OPENPROM(inode) && proc_openprom_use) - (*proc_openprom_use)(inode, 1); -#endif - inode->u.generic_ip = (void *) de; if (de) { if (de->mode) { @@ -173,26 +184,16 @@ } if (de->size) inode->i_size = de->size; - if (de->ops) - inode->i_op = de->ops; if (de->nlink) inode->i_nlink = de->nlink; if (de->owner) __MOD_INC_USE_COUNT(de->owner); + if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode)) + init_special_inode(inode,de->mode,kdev_t_to_nr(de->rdev)); + else if (de->ops) + inode->i_op = de->ops; } - /* - * Fixup the root inode's nlink value - */ - if (inode->i_ino == PROC_ROOT_INO) { - struct task_struct *p; - read_lock(&tasklist_lock); - for_each_task(p) { - if (p->pid) - inode->i_nlink++; - } - read_unlock(&tasklist_lock); - } out: return inode; @@ -205,6 +206,7 @@ int silent) { struct inode * root_inode; + struct task_struct *p; lock_super(s); s->s_blocksize = 1024; @@ -214,6 +216,12 @@ root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); if (!root_inode) goto out_no_root; + /* + * Fixup the root inode's nlink value + */ + read_lock(&tasklist_lock); + for_each_task(p) if (p->pid) root_inode->i_nlink++; + read_unlock(&tasklist_lock); s->s_root = d_alloc_root(root_inode); if (!s->s_root) goto out_no_root; @@ -229,28 +237,4 @@ s->s_dev = 0; unlock_super(s); return NULL; -} - -int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) -{ - struct statfs tmp; - - tmp.f_type = PROC_SUPER_MAGIC; - tmp.f_bsize = PAGE_SIZE/sizeof(long); - tmp.f_blocks = 0; - tmp.f_bfree = 0; - tmp.f_bavail = 0; - tmp.f_files = 0; - tmp.f_ffree = 0; - tmp.f_namelen = NAME_MAX; - return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; -} - -void proc_read_inode(struct inode * inode) -{ - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; -} - -void proc_write_inode(struct inode * inode) -{ } diff -u --recursive --new-file v2.3.28/linux/fs/proc/kcore.c linux/fs/proc/kcore.c --- v2.3.28/linux/fs/proc/kcore.c Thu Nov 18 20:25:37 1999 +++ linux/fs/proc/kcore.c Thu Nov 18 19:32:51 1999 @@ -3,9 +3,9 @@ * * Modelled on fs/exec.c:aout_core_dump() * Jeremy Fitzhardinge - * Implemented by David Howells + * ELF version written by David Howells * Modified and incorporated into 2.3.x by Tigran Aivazian - * Support to dump vmalloc'd data structures (ELF only), Tigran Aivazian + * Support to dump vmalloc'd areas (ELF only), Tigran Aivazian */ #include @@ -42,8 +42,7 @@ }; #ifdef CONFIG_KCORE_AOUT -static ssize_t read_kcore(struct file * file, char * buf, - size_t count, loff_t *ppos) +static ssize_t read_kcore(struct file *file, char *buf, size_t count, loff_t *ppos) { unsigned long long p = *ppos, memsize; ssize_t read; @@ -78,7 +77,8 @@ if (p + count1 > sizeof(struct user)) count1 = sizeof(struct user)-p; pnt = (char *) &dump + p; - copy_to_user(buf,(void *) pnt, count1); + if (copy_to_user(buf,(void *) pnt, count1)) + return -EFAULT; buf += count1; p += count1; count -= count1; @@ -89,14 +89,16 @@ count1 = PAGE_SIZE + FIRST_MAPPED - p; if (count1 > count) count1 = count; - clear_user(buf, count1); + if (clear_user(buf, count1)) + return -EFAULT; buf += count1; p += count1; count -= count1; read += count1; } if (count > 0) { - copy_to_user(buf, (void *) (PAGE_OFFSET+p-PAGE_SIZE), count); + if (copy_to_user(buf, (void *) (PAGE_OFFSET+p-PAGE_SIZE), count)) + return -EFAULT; read += count; } *ppos += read; @@ -129,6 +131,8 @@ } for (m=vmlist; m; m=m->next) { + if (m->flags & VM_IOREMAP) /* don't dump ioremap'd stuff! (TA) */ + continue; try = (size_t)m->addr + m->size; if (try > size) size = try; @@ -247,8 +251,11 @@ phdr->p_filesz = phdr->p_memsz = ((unsigned long)high_memory - PAGE_OFFSET); phdr->p_align = PAGE_SIZE; - /* setup ELF PT_LOAD program headers, one for every kvma range */ + /* setup ELF PT_LOAD program header for every vmalloc'd area */ for (m=vmlist; m; m=m->next) { + if (m->flags & VM_IOREMAP) /* don't dump ioremap'd stuff! (TA) */ + continue; + phdr = (struct elf_phdr *) bufp; bufp += sizeof(struct elf_phdr); offset += sizeof(struct elf_phdr); @@ -315,12 +322,8 @@ { ssize_t acc = 0; size_t size, tsz; - char * elf_buffer; - size_t elf_buflen = 0; - int num_vma = 0; - - if (verify_area(VERIFY_WRITE, buffer, buflen)) - return -EFAULT; + size_t elf_buflen; + int num_vma; /* XXX we need to somehow lock vmlist between here * and after elf_kcore_store_hdr() returns. @@ -336,16 +339,21 @@ /* construct an ELF core header if we'll need some of it */ if (*fpos < elf_buflen) { + char * elf_buf; + tsz = elf_buflen - *fpos; if (buflen < tsz) tsz = buflen; - elf_buffer = kmalloc(elf_buflen, GFP_KERNEL); - if (!elf_buffer) + elf_buf = kmalloc(elf_buflen, GFP_ATOMIC); + if (!elf_buf) return -ENOMEM; - memset(elf_buffer, 0, elf_buflen); - elf_kcore_store_hdr(elf_buffer, num_vma, elf_buflen); - copy_to_user(buffer, elf_buffer + *fpos, tsz); - kfree(elf_buffer); + memset(elf_buf, 0, elf_buflen); + elf_kcore_store_hdr(elf_buf, num_vma, elf_buflen); + if (copy_to_user(buffer, elf_buf + *fpos, tsz)) { + kfree(elf_buf); + return -EFAULT; + } + kfree(elf_buf); buflen -= tsz; *fpos += tsz; buffer += tsz; @@ -365,7 +373,8 @@ tsz = buflen; /* write zeros to buffer */ - clear_user(buffer, tsz); + if (clear_user(buffer, tsz)) + return -EFAULT; buflen -= tsz; *fpos += tsz; buffer += tsz; @@ -376,13 +385,12 @@ return tsz; } #endif - /* fill the remainder of the buffer from kernel VM space */ - copy_to_user(buffer, __va(*fpos - elf_buflen), buflen); + if (copy_to_user(buffer, __va(*fpos - elf_buflen), buflen)) + return -EFAULT; acc += buflen; *fpos += buflen; return acc; - } #endif /* CONFIG_KCORE_AOUT */ diff -u --recursive --new-file v2.3.28/linux/fs/proc/openprom-dev.c linux/fs/proc/openprom-dev.c --- v2.3.28/linux/fs/proc/openprom-dev.c Wed Dec 31 16:00:00 1969 +++ linux/fs/proc/openprom-dev.c Thu Nov 18 20:02:57 1999 @@ -0,0 +1,46 @@ +/* + * linux/fs/proc/openprom-dev.c + * + * handling of devices attached to openpromfs. + */ + +#include +#include +#include +#include +#include +#include +#include + +struct openpromfs_dev *openprom_devices = NULL; +static ino_t openpromdev_ino = PROC_OPENPROMD_FIRST; + +int proc_openprom_regdev(struct openpromfs_dev *d) +{ + if (openpromdev_ino == PROC_OPENPROMD_FIRST + PROC_NOPENPROMD) + return -1; + d->next = openprom_devices; + d->inode = openpromdev_ino++; + openprom_devices = d; + return 0; +} + +int proc_openprom_unregdev(struct openpromfs_dev *d) +{ + if (d == openprom_devices) { + openprom_devices = d->next; + } else if (!openprom_devices) + return -1; + else { + struct openpromfs_dev *p; + + for (p = openprom_devices; p->next != d && p->next; p = p->next); + if (!p->next) return -1; + p->next = d->next; + } + return 0; +} + +#if defined(CONFIG_SUN_OPENPROMFS_MODULE) +EXPORT_SYMBOL(openprom_devices); +#endif diff -u --recursive --new-file v2.3.28/linux/fs/proc/openpromfs.c linux/fs/proc/openpromfs.c --- v2.3.28/linux/fs/proc/openpromfs.c Tue Aug 31 17:29:14 1999 +++ linux/fs/proc/openpromfs.c Fri Nov 19 21:16:10 1999 @@ -50,8 +50,7 @@ static u16 aliases = 0xffff; static int aliases_nodes = 0; static char *alias_names [ALIASES_NNODES]; -static struct inode_operations *proc_openprom_iops = 0; -static struct openpromfs_dev **devices; +extern struct openpromfs_dev *openprom_devices; #define NODE(ino) nodes[ino - PROC_OPENPROM_FIRST] #define NODE2INO(node) (node + PROC_OPENPROM_FIRST) @@ -661,6 +660,8 @@ NULL /* revalidate */ }; +extern struct inode_operations openprom_inode_operations; + static int lookup_children(u16 n, const char * name, int len) { int ret; @@ -772,7 +773,7 @@ } } if (!ino) { - for (d = *devices; d; d = d->next) + for (d = openprom_devices; d; d = d->next) if ((d->node == n) && (strlen (d->name) == len) && !strncmp (d->name, name, len)) { ino = d->inode; @@ -787,7 +788,7 @@ else return ERR_PTR(-ENOENT); } - inode = proc_get_inode (dir->i_sb, ino, 0); + inode = iget (dir->i_sb, ino, 0); if (!inode) return ERR_PTR(-EINVAL); switch (type) { @@ -797,7 +798,7 @@ inode->i_mode |= S_IWUSR; inode->i_op = &openprom_alias_inode_operations; } else - inode->i_op = proc_openprom_iops; + inode->i_op = &openprom_inode_operations; inode->i_nlink = 2; break; case OPFSL_NODENUM: @@ -825,11 +826,7 @@ (((u16)(ino - NODEP2INO(NODE(dir->i_ino).first_prop) - 1)) << 16)); break; case OPFSL_DEVICE: - inode->i_mode = d->mode; - inode->i_op = &chrdev_inode_operations; - inode->i_nlink = 1; - inode->i_rdev = d->rdev; - break; + init_special_inode(d->mode, kdev_to_nr(d->rdev)); } inode->i_gid = 0; @@ -914,7 +911,7 @@ } } } - for (d = *devices; d; d = d->next) { + for (d = openprom_devices; d; d = d->next) { if (d->node == n) { if (i) i--; else { @@ -947,9 +944,8 @@ strncpy (p, dentry->d_name.name, dentry->d_name.len); p [dentry->d_name.len] = 0; alias_names [aliases_nodes++] = p; - inode = proc_get_inode (dir->i_sb, - NODEP2INO(NODE(dir->i_ino).first_prop) - + aliases_nodes, 0); + inode = iget (dir->i_sb, + NODEP2INO(NODE(dir->i_ino).first_prop) + aliases_nodes); if (!inode) return -EINVAL; inode->i_mode = S_IFREG | S_IRUGO | S_IWUSR; @@ -1090,25 +1086,6 @@ { static int root_fresh = 1; static int dec_first = 1; -#ifdef OPENPROM_DEBUGGING - static int usec = 0; - - if (inc) { - if (inode->i_count == 1) - usec++; - else if (root_fresh && inode->i_ino == PROC_OPENPROM_FIRST) { - root_fresh = 0; - usec++; - } - } else { - if (inode->i_ino == PROC_OPENPROM_FIRST) - root_fresh = 0; - if (!dec_first) - usec--; - } - printk ("openpromfs_use: %d %d %d %d\n", - inode->i_ino, inc, usec, inode->i_count); -#else if (inc) { if (inode->i_count == 1) MOD_INC_USE_COUNT; @@ -1122,7 +1099,6 @@ if (!dec_first) MOD_DEC_USE_COUNT; } -#endif dec_first = 0; } @@ -1130,39 +1106,131 @@ #define openpromfs_use 0 #endif -#ifndef MODULE -#define RET(x) -void __init openpromfs_init (void) -#else +static struct file_operations openprom_operations = { + NULL, /* lseek - default */ + NULL, /* read - bad */ + NULL, /* write - bad */ + openpromfs_readdir, /* readdir */ +}; -EXPORT_NO_SYMBOLS; +static struct inode_operations openprom_inode_operations = { + &openprom_operations,/* default net directory file-ops */ + NULL, /* create */ + openpromfs_lookup, /* lookup */ +}; -#define RET(x) -x -int init_module (void) -#endif +static void openprom_read_inode(struct inode * inode) +{ + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; + if (inode->i_ino == PROC_OPENPROM) { + inode->i_op = &openprom_inode_operations; + } +} + +static void openprom_put_super(struct super_block *sb) +{ + MOD_DEC_USE_COUNT; +} + +static int openprom_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) +{ + struct statfs tmp; + + tmp.f_type = PROC_SUPER_MAGIC; /* FIXME */ + tmp.f_bsize = PAGE_SIZE/sizeof(long); /* ??? */ + tmp.f_blocks = 0; + tmp.f_bfree = 0; + tmp.f_bavail = 0; + tmp.f_files = 0; + tmp.f_ffree = 0; + tmp.f_namelen = NAME_MAX; + return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; +} + +static struct super_operations openprom_sops = { + openprom_read_inode, + NULL, + NULL, + NULL, + NULL, + openprom_put_super, + NULL, + openprom_statfs, + NULL +}; + +struct super_block *openprom_read_super(struct super_block *s,void *data, + int silent) +{ + struct inode * root_inode; + + MOD_INC_USE_COUNT; + lock_super(s); + s->s_blocksize = 1024; + s->s_blocksize_bits = 10; + s->s_magic = PROC_SUPER_MAGIC; /* FIXME */ + s->s_op = &openprom_sops; + root_inode = iget(s, PROC_OPENPROM); + if (!root_inode) + goto out_no_root; + s->s_root = d_alloc_root(root_inode); + if (!s->s_root) + goto out_no_root; + unlock_super(s); + return s; + +out_no_root: + printk("proc_read_super: get root inode failed\n"); + iput(root_inode); + s->s_dev = 0; + unlock_super(s); + return NULL; +} + +static struct file_system_type openprom_fs_type = { + "openprom", + 0, + openprom_read_super, + NULL +}; + +static int init_openprom_fs(void) { nodes = (openpromfs_node *)__get_free_pages(GFP_KERNEL, 0); if (!nodes) { printk (KERN_WARNING "/proc/openprom: can't get free page\n"); - return RET(EIO); + return -EIO; } if (get_nodes (0xffff, prom_root_node) == 0xffff) { printk (KERN_WARNING "/proc/openprom: couldn't setup tree\n"); - return RET(EIO); + return -EIO; } nodes[last_node].first_prop = first_prop; - proc_openprom_iops = proc_openprom_register (openpromfs_readdir, - openpromfs_lookup, - openpromfs_use, - &devices); - return RET(0); + return register_filesystem(&openprom_fs_type); +} + +#ifdef MODULE + +EXPORT_NO_SYMBOLS; + +int init_module (void) +{ + return init_openprom_fs(); +} + +#else + +void __init openpromfs_init (void) +{ + init_openprom_fs(); } +#endif #ifdef MODULE void cleanup_module (void) { int i; - proc_openprom_deregister (); + unregister_filesystem(&openprom_fs_type); free_pages ((unsigned long)nodes, alloced); for (i = 0; i < aliases_nodes; i++) if (alias_names [i]) diff -u --recursive --new-file v2.3.28/linux/fs/proc/proc_misc.c linux/fs/proc/proc_misc.c --- v2.3.28/linux/fs/proc/proc_misc.c Thu Nov 11 20:11:50 1999 +++ linux/fs/proc/proc_misc.c Tue Nov 23 12:15:29 1999 @@ -60,7 +60,6 @@ extern int get_exec_domain_list(char *); extern int get_irq_list(char *); extern int get_dma_list(char *); -extern int get_rtc_status (char *); extern int get_locks_status (char *, char **, off_t, int); extern int get_swaparea_info (char *); #ifdef CONFIG_SGI_DS1286 @@ -452,20 +451,6 @@ return len; } -#ifdef CONFIG_RTC -static int rtc_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - int len = get_rtc_status(page); - if (len <= off+count) *eof = 1; - *start = page + off; - len -= off; - if (len>count) len = count; - if (len<0) len = 0; - return len; -} -#endif - #ifdef CONFIG_SGI_DS1286 static int ds1286_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) @@ -664,9 +649,6 @@ {"dma", dma_read_proc}, {"ioports", ioports_read_proc}, {"cmdline", cmdline_read_proc}, -#ifdef CONFIG_RTC - {"rtc", rtc_read_proc}, -#endif #ifdef CONFIG_SGI_DS1286 {"rtc", ds1286_read_proc}, #endif diff -u --recursive --new-file v2.3.28/linux/fs/proc/proc_tty.c linux/fs/proc/proc_tty.c --- v2.3.28/linux/fs/proc/proc_tty.c Tue Aug 31 17:29:14 1999 +++ linux/fs/proc/proc_tty.c Fri Nov 19 21:16:10 1999 @@ -161,10 +161,9 @@ if (!ent) return; - proc_unregister(proc_tty_driver, ent->low_ino); + remove_proc_entry(driver->driver_name, proc_tty_driver); driver->proc_entry = 0; - kfree(ent); } /* diff -u --recursive --new-file v2.3.28/linux/fs/proc/procfs_syms.c linux/fs/proc/procfs_syms.c --- v2.3.28/linux/fs/proc/procfs_syms.c Thu Nov 11 20:11:51 1999 +++ linux/fs/proc/procfs_syms.c Fri Nov 19 21:16:10 1999 @@ -8,21 +8,15 @@ #ifdef CONFIG_SYSCTL EXPORT_SYMBOL(proc_sys_root); #endif -EXPORT_SYMBOL(proc_register); -EXPORT_SYMBOL(proc_unregister); +EXPORT_SYMBOL(proc_symlink); +EXPORT_SYMBOL(proc_mknod); +EXPORT_SYMBOL(proc_mkdir); EXPORT_SYMBOL(create_proc_entry); EXPORT_SYMBOL(remove_proc_entry); EXPORT_SYMBOL(proc_root); EXPORT_SYMBOL(proc_root_fs); -EXPORT_SYMBOL(proc_get_inode); -EXPORT_SYMBOL(proc_dir_inode_operations); EXPORT_SYMBOL(proc_net); EXPORT_SYMBOL(proc_bus); - -#if defined(CONFIG_SUN_OPENPROMFS_MODULE) -EXPORT_SYMBOL(proc_openprom_register); -EXPORT_SYMBOL(proc_openprom_deregister); -#endif static struct file_system_type proc_fs_type = { "proc", diff -u --recursive --new-file v2.3.28/linux/fs/proc/root.c linux/fs/proc/root.c --- v2.3.28/linux/fs/proc/root.c Thu Nov 11 20:11:51 1999 +++ linux/fs/proc/root.c Fri Nov 19 21:16:10 1999 @@ -15,370 +15,13 @@ #include #include #include -#ifdef CONFIG_KMOD -#include -#endif -#ifdef CONFIG_ZORRO -#include -#endif - -static int proc_root_readdir(struct file *, void *, filldir_t); -static struct dentry *proc_root_lookup(struct inode *,struct dentry *); -static int proc_unlink(struct inode *, struct dentry *); - -static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8] = {0}; - -/* - * These are the generic /proc directory operations. They - * use the in-memory "struct proc_dir_entry" tree to parse - * the /proc directory. - */ -static struct file_operations proc_dir_operations = { - NULL, /* lseek - default */ - NULL, /* read - bad */ - NULL, /* write - bad */ - proc_readdir, /* readdir */ -}; - -/* - * proc directories can do almost nothing.. - */ -struct inode_operations proc_dir_inode_operations = { - &proc_dir_operations, /* default net directory file-ops */ - NULL, /* create */ - proc_lookup, /* lookup */ -}; - -/* - * /proc dynamic directories now support unlinking - */ -struct inode_operations proc_dyna_dir_inode_operations = { - &proc_dir_operations, /* default proc dir ops */ - NULL, /* create */ - proc_lookup, /* lookup */ - NULL, /* link */ - proc_unlink, /* unlink(struct inode *, struct dentry *) */ -}; - -/* - * The root /proc directory is special, as it has the - * directories. Thus we don't use the generic - * directory handling functions for that.. - */ -static struct file_operations proc_root_operations = { - NULL, /* lseek - default */ - NULL, /* read - bad */ - NULL, /* write - bad */ - proc_root_readdir, /* readdir */ -}; - -/* - * proc root can do almost nothing.. - */ -static struct inode_operations proc_root_inode_operations = { - &proc_root_operations, /* default base directory file-ops */ - NULL, /* create */ - proc_root_lookup, /* lookup */ -}; - -/* - * This is the root "inode" in the /proc tree.. - */ -struct proc_dir_entry proc_root = { - PROC_ROOT_INO, 5, "/proc", - S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, - 0, &proc_root_inode_operations, - NULL, NULL, - NULL, - &proc_root, NULL -}; struct proc_dir_entry *proc_net, *proc_bus, *proc_root_fs, *proc_root_driver; -#ifdef CONFIG_MCA -struct proc_dir_entry *proc_mca; -#endif - #ifdef CONFIG_SYSCTL struct proc_dir_entry *proc_sys_root; #endif -#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) - -static int (*proc_openprom_defreaddir_ptr)(struct file *, void *, filldir_t); -static struct dentry * (*proc_openprom_deflookup_ptr)(struct inode *, struct dentry *); -void (*proc_openprom_use)(struct inode *, int) = 0; -static struct openpromfs_dev *proc_openprom_devices = NULL; -static ino_t proc_openpromdev_ino = PROC_OPENPROMD_FIRST; - -struct inode_operations * -proc_openprom_register(int (*readdir)(struct file *, void *, filldir_t), - struct dentry * (*lookup)(struct inode *, struct dentry *), - void (*use)(struct inode *, int), - struct openpromfs_dev ***devices) -{ - proc_openprom_defreaddir_ptr = (proc_openprom_inode_operations.default_file_ops)->readdir; - proc_openprom_deflookup_ptr = proc_openprom_inode_operations.lookup; - (proc_openprom_inode_operations.default_file_ops)->readdir = readdir; - proc_openprom_inode_operations.lookup = lookup; - proc_openprom_use = use; - *devices = &proc_openprom_devices; - return &proc_openprom_inode_operations; -} - -int proc_openprom_regdev(struct openpromfs_dev *d) -{ - if (proc_openpromdev_ino == PROC_OPENPROMD_FIRST + PROC_NOPENPROMD) - return -1; - d->next = proc_openprom_devices; - d->inode = proc_openpromdev_ino++; - proc_openprom_devices = d; - return 0; -} - -int proc_openprom_unregdev(struct openpromfs_dev *d) -{ - if (d == proc_openprom_devices) { - proc_openprom_devices = d->next; - } else if (!proc_openprom_devices) - return -1; - else { - struct openpromfs_dev *p; - - for (p = proc_openprom_devices; p->next != d && p->next; p = p->next); - if (!p->next) return -1; - p->next = d->next; - } - return 0; -} - -#ifdef CONFIG_SUN_OPENPROMFS_MODULE -void -proc_openprom_deregister(void) -{ - (proc_openprom_inode_operations.default_file_ops)->readdir = proc_openprom_defreaddir_ptr; - proc_openprom_inode_operations.lookup = proc_openprom_deflookup_ptr; - proc_openprom_use = 0; -} -#endif - -#if defined(CONFIG_SUN_OPENPROMFS_MODULE) && defined(CONFIG_KMOD) -static int -proc_openprom_defreaddir(struct file * filp, void * dirent, filldir_t filldir) -{ - request_module("openpromfs"); - if ((proc_openprom_inode_operations.default_file_ops)->readdir != - proc_openprom_defreaddir) - return (proc_openprom_inode_operations.default_file_ops)->readdir - (filp, dirent, filldir); - return -EINVAL; -} -#define OPENPROM_DEFREADDIR proc_openprom_defreaddir - -static struct dentry * -proc_openprom_deflookup(struct inode * dir, struct dentry *dentry) -{ - request_module("openpromfs"); - if (proc_openprom_inode_operations.lookup != - proc_openprom_deflookup) - return proc_openprom_inode_operations.lookup - (dir, dentry); - return ERR_PTR(-ENOENT); -} -#define OPENPROM_DEFLOOKUP proc_openprom_deflookup -#else -#define OPENPROM_DEFREADDIR NULL -#define OPENPROM_DEFLOOKUP NULL -#endif - -static struct file_operations proc_openprom_operations = { - NULL, /* lseek - default */ - NULL, /* read - bad */ - NULL, /* write - bad */ - OPENPROM_DEFREADDIR, /* readdir */ -}; - -struct inode_operations proc_openprom_inode_operations = { - &proc_openprom_operations,/* default net directory file-ops */ - NULL, /* create */ - OPENPROM_DEFLOOKUP, /* lookup */ -}; - -struct proc_dir_entry proc_openprom = { - PROC_OPENPROM, 8, "openprom", - S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, - 0, &proc_openprom_inode_operations, - NULL, NULL, - NULL, - &proc_root, NULL -}; - -extern void openpromfs_init (void); -#endif /* CONFIG_SUN_OPENPROMFS */ - -static int make_inode_number(void) -{ - int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC); - if (i<0 || i>=PROC_NDYNAMIC) - return -1; - set_bit(i, (void *) proc_alloc_map); - return PROC_DYNAMIC_FIRST + i; -} - -int proc_readlink(struct dentry * dentry, char * buffer, int buflen) -{ - struct inode *inode = dentry->d_inode; - struct proc_dir_entry * de; - char *page; - int len = 0; - - de = (struct proc_dir_entry *) inode->u.generic_ip; - if (!de) - return -ENOENT; - if (!(page = (char*) __get_free_page(GFP_KERNEL))) - return -ENOMEM; - - if (de->readlink_proc) - len = de->readlink_proc(de, page); - - if (len > buflen) - len = buflen; - - copy_to_user(buffer, page, len); - free_page((unsigned long) page); - return len; -} - -struct dentry * proc_follow_link(struct dentry * dentry, struct dentry *base, unsigned int follow) -{ - struct inode *inode = dentry->d_inode; - struct proc_dir_entry * de; - char *page; - struct dentry *d; - int len = 0; - - de = (struct proc_dir_entry *) inode->u.generic_ip; - if (!(page = (char*) __get_free_page(GFP_KERNEL))) - return NULL; - - if (de->readlink_proc) - len = de->readlink_proc(de, page); - - d = lookup_dentry(page, base, follow); - free_page((unsigned long) page); - return d; -} - -static struct inode_operations proc_link_inode_operations = { - NULL, /* no file-ops */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - proc_readlink, /* readlink */ - proc_follow_link, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ -}; - -int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) -{ - int i; - - if (dp->low_ino == 0) { - i = make_inode_number(); - if (i < 0) - return -EAGAIN; - dp->low_ino = i; - } - dp->next = dir->subdir; - dp->parent = dir; - dir->subdir = dp; - if (S_ISDIR(dp->mode)) { - if (dp->ops == NULL) - dp->ops = &proc_dir_inode_operations; - dir->nlink++; - } else if (S_ISLNK(dp->mode)) { - if (dp->ops == NULL) - dp->ops = &proc_link_inode_operations; - } else { - if (dp->ops == NULL) - dp->ops = &proc_file_inode_operations; - } - return 0; -} - -/* - * Kill an inode that got unregistered.. - */ -static void proc_kill_inodes(int ino) -{ - struct list_head *p; - struct super_block *sb; - - /* - * Actually it's a partial revoke(). We have to go through all - * copies of procfs. proc_super_blocks is protected by the big - * lock for the time being. - */ - for (sb = proc_super_blocks; - sb; - sb = (struct super_block*)sb->u.generic_sbp) { - file_list_lock(); - for (p = sb->s_files.next; p != &sb->s_files; p = p->next) { - struct file * filp = list_entry(p, struct file, f_list); - struct dentry * dentry; - struct inode * inode; - - dentry = filp->f_dentry; - if (!dentry) - continue; - if (dentry->d_op != &proc_dentry_operations) - continue; - inode = dentry->d_inode; - if (!inode) - continue; - if (inode->i_ino != ino) - continue; - filp->f_op = NULL; - } - file_list_unlock(); - } -} - -int proc_unregister(struct proc_dir_entry * dir, int ino) -{ - struct proc_dir_entry **p = &dir->subdir, *dp; - - while ((dp = *p) != NULL) { - if (dp->low_ino == ino) { - *p = dp->next; - dp->next = NULL; - if (S_ISDIR(dp->mode)) - dir->nlink--; - if (ino >= PROC_DYNAMIC_FIRST && - ino < PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) - clear_bit(ino-PROC_DYNAMIC_FIRST, - (void *) proc_alloc_map); - proc_kill_inodes(ino); - return 0; - } - p = &dp->next; - } - return -EINVAL; -} - /* * /proc/self: */ @@ -417,14 +60,6 @@ NULL, /* rename */ proc_self_readlink, /* readlink */ proc_self_follow_link, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ }; static struct proc_dir_entry proc_root_self = { @@ -435,7 +70,7 @@ #ifdef __powerpc__ static struct proc_dir_entry proc_root_ppc_htab = { 0, 8, "ppc_htab", - S_IFREG | S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, 1, 0, 0, + S_IFREG | S_IRUGO|S_IWUSR, 1, 0, 0, 0, &proc_ppc_htab_inode_operations, }; #endif @@ -444,23 +79,21 @@ { proc_misc_init(); proc_register(&proc_root, &proc_root_self); - proc_net = create_proc_entry("net", S_IFDIR, 0); + proc_net = proc_mkdir("net", 0); #ifdef CONFIG_SYSVIPC - create_proc_entry("sysvipc", S_IFDIR, 0); + proc_mkdir("sysvipc", 0); #endif #ifdef CONFIG_SYSCTL - proc_sys_root = create_proc_entry("sys", S_IFDIR, 0); -#endif -#ifdef CONFIG_MCA - proc_mca = create_proc_entry("mca", S_IFDIR, 0); + proc_sys_root = proc_mkdir("sys", 0); #endif - proc_root_fs = create_proc_entry("fs", S_IFDIR, 0); - proc_root_driver = create_proc_entry("driver", S_IFDIR, 0); + proc_root_fs = proc_mkdir("fs", 0); + proc_root_driver = proc_mkdir("driver", 0); #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) #ifdef CONFIG_SUN_OPENPROMFS openpromfs_init (); #endif - proc_register(&proc_root, &proc_openprom); + /* just give it a mountpoint */ + proc_mkdir("openprom", 0); #endif proc_tty_init(); #ifdef __powerpc__ @@ -469,63 +102,7 @@ #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); #endif - proc_bus = create_proc_entry("bus", S_IFDIR, 0); -} - -/* - * As some entries in /proc are volatile, we want to - * get rid of unused dentries. This could be made - * smarter: we could keep a "volatile" flag in the - * inode to indicate which ones to keep. - */ -static void -proc_delete_dentry(struct dentry * dentry) -{ - d_drop(dentry); -} - -struct dentry_operations proc_dentry_operations = -{ - NULL, /* revalidate */ - NULL, /* d_hash */ - NULL, /* d_compare */ - proc_delete_dentry /* d_delete(struct dentry *) */ -}; - -/* - * Don't create negative dentries here, return -ENOENT by hand - * instead. - */ -struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry) -{ - struct inode *inode; - struct proc_dir_entry * de; - int error; - - error = -ENOENT; - inode = NULL; - de = (struct proc_dir_entry *) dir->u.generic_ip; - if (de) { - for (de = de->subdir; de ; de = de->next) { - if (!de || !de->low_ino) - continue; - if (de->namelen != dentry->d_name.len) - continue; - if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { - int ino = de->low_ino; - error = -EINVAL; - inode = proc_get_inode(dir->i_sb, ino, de); - break; - } - } - } - - if (inode) { - dentry->d_op = &proc_dentry_operations; - d_add(dentry, inode); - return NULL; - } - return ERR_PTR(error); + proc_bus = proc_mkdir("bus", 0); } static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry) @@ -564,63 +141,6 @@ return proc_pid_lookup(dir, dentry); } -/* - * This returns non-zero if at EOF, so that the /proc - * root directory can use this and check if it should - * continue with the entries.. - * - * Note that the VFS-layer doesn't care about the return - * value of the readdir() call, as long as it's non-negative - * for success.. - */ -int proc_readdir(struct file * filp, - void * dirent, filldir_t filldir) -{ - struct proc_dir_entry * de; - unsigned int ino; - int i; - struct inode *inode = filp->f_dentry->d_inode; - - ino = inode->i_ino; - de = (struct proc_dir_entry *) inode->u.generic_ip; - if (!de) - return -EINVAL; - i = filp->f_pos; - switch (i) { - case 0: - if (filldir(dirent, ".", 1, i, ino) < 0) - return 0; - i++; - filp->f_pos++; - /* fall through */ - case 1: - if (filldir(dirent, "..", 2, i, de->parent->low_ino) < 0) - return 0; - i++; - filp->f_pos++; - /* fall through */ - default: - de = de->subdir; - i -= 2; - for (;;) { - if (!de) - return 1; - if (!i) - break; - de = de->next; - i--; - } - - do { - if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino) < 0) - return 0; - filp->f_pos++; - de = de->next; - } while (de); - } - return 1; -} - static int proc_root_readdir(struct file * filp, void * dirent, filldir_t filldir) { @@ -636,14 +156,35 @@ return proc_pid_readdir(filp, dirent, filldir); } -static int proc_unlink(struct inode *dir, struct dentry *dentry) -{ - struct proc_dir_entry * dp = dir->u.generic_ip; +/* + * The root /proc directory is special, as it has the + * directories. Thus we don't use the generic + * directory handling functions for that.. + */ +static struct file_operations proc_root_operations = { + NULL, /* lseek - default */ + NULL, /* read - bad */ + NULL, /* write - bad */ + proc_root_readdir, /* readdir */ +}; -printk("proc_file_unlink: deleting %s/%s\n", dp->name, dentry->d_name.name); +/* + * proc root can do almost nothing.. + */ +static struct inode_operations proc_root_inode_operations = { + &proc_root_operations, /* default base directory file-ops */ + NULL, /* create */ + proc_root_lookup, /* lookup */ +}; - remove_proc_entry(dentry->d_name.name, dp); - dentry->d_inode->i_nlink = 0; - d_delete(dentry); - return 0; -} +/* + * This is the root "inode" in the /proc tree.. + */ +struct proc_dir_entry proc_root = { + PROC_ROOT_INO, 5, "/proc", + S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, + 0, &proc_root_inode_operations, + NULL, NULL, + NULL, + &proc_root, NULL +}; diff -u --recursive --new-file v2.3.28/linux/fs/super.c linux/fs/super.c --- v2.3.28/linux/fs/super.c Thu Nov 18 20:25:37 1999 +++ linux/fs/super.c Thu Nov 18 20:58:08 1999 @@ -567,7 +567,6 @@ if (!type->read_super(s, data, silent)) goto out_fail; s->s_dev = dev; /* N.B. why do this again?? */ - s->s_rd_only = 0; s->s_type = type; out: return s; diff -u --recursive --new-file v2.3.28/linux/fs/udf/balloc.c linux/fs/udf/balloc.c --- v2.3.28/linux/fs/udf/balloc.c Mon Nov 1 13:56:27 1999 +++ linux/fs/udf/balloc.c Fri Nov 19 11:35:10 1999 @@ -34,6 +34,56 @@ #include "udf_i.h" #include "udf_sb.h" +#define udf_clear_bit(nr,addr) ext2_clear_bit(nr,addr) +#define udf_set_bit(nr,addr) ext2_set_bit(nr,addr) +#define udf_test_bit(nr, addr) ext2_test_bit(nr, addr) +#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size) +#define udf_find_next_one_bit(addr, size, offset) find_next_one_bit(addr, size, offset) + +#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x) +#define leNUM_to_cpup(x,y) xleNUM_to_cpup(x,y) +#define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y)) + +extern inline int find_next_one_bit (void * addr, int size, int offset) +{ + unsigned long * p = ((unsigned long *) addr) + (offset / BITS_PER_LONG); + unsigned long result = offset & ~(BITS_PER_LONG-1); + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= (BITS_PER_LONG-1); + if (offset) + { + tmp = leBPL_to_cpup(p++); + tmp &= ~0UL << offset; + if (size < BITS_PER_LONG) + goto found_first; + if (tmp) + goto found_middle; + size -= BITS_PER_LONG; + result += BITS_PER_LONG; + } + while (size & ~(BITS_PER_LONG-1)) + { + if ((tmp = leBPL_to_cpup(p++))) + goto found_middle; + result += BITS_PER_LONG; + size -= BITS_PER_LONG; + } + if (!size) + return result; + tmp = leBPL_to_cpup(p); +found_first: + tmp &= ~0UL >> (BITS_PER_LONG-size); +found_middle: + return result + ffz(~tmp); +} + +#define find_first_one_bit(addr, size)\ + find_next_one_bit((addr), (size), 0) + static int read_block_bitmap(struct super_block * sb, unsigned int block, unsigned long bitmap_nr) { diff -u --recursive --new-file v2.3.28/linux/fs/udf/dir.c linux/fs/udf/dir.c --- v2.3.28/linux/fs/udf/dir.c Thu Nov 18 20:25:37 1999 +++ linux/fs/udf/dir.c Sat Nov 20 16:16:57 1999 @@ -159,13 +159,13 @@ struct FileIdentDesc *fi=NULL; struct FileIdentDesc cfi; int block, iblock; - int nf_pos = filp->f_pos; + loff_t nf_pos = filp->f_pos; int flen; char fname[255]; char *nameptr; Uint16 liu; Uint8 lfi; - int size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; + loff_t size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; struct buffer_head * bh = NULL; lb_addr bloc, eloc; Uint32 extoffset, elen, offset; @@ -276,10 +276,6 @@ udf_release_data(bh); return 1; /* halt enum */ } - } - else - { - udf_debug("size=%d, nf_pos=%d, liu=%d, lfi=%d\n", size, nf_pos, liu, lfi); } } } /* end while */ diff -u --recursive --new-file v2.3.28/linux/fs/udf/directory.c linux/fs/udf/directory.c --- v2.3.28/linux/fs/udf/directory.c Mon Nov 1 13:56:27 1999 +++ linux/fs/udf/directory.c Sat Nov 20 16:16:57 1999 @@ -17,7 +17,6 @@ */ #include "udfdecl.h" -#include "udf_sb.h" #if defined(__linux__) && defined(__KERNEL__) @@ -85,7 +84,7 @@ } struct FileIdentDesc * -udf_fileident_read(struct inode *dir, int *nf_pos, +udf_fileident_read(struct inode *dir, loff_t *nf_pos, struct udf_fileident_bh *fibh, struct FileIdentDesc *cfi, lb_addr *bloc, Uint32 *extoffset, diff -u --recursive --new-file v2.3.28/linux/fs/udf/file.c linux/fs/udf/file.c --- v2.3.28/linux/fs/udf/file.c Thu Nov 18 20:25:37 1999 +++ linux/fs/udf/file.c Fri Nov 19 11:35:10 1999 @@ -43,11 +43,7 @@ #include "udf_i.h" #include "udf_sb.h" -#define NBUF 32 - -typedef void * poll_table; - -static long long udf_file_llseek(struct file *, long long, int); +static loff_t udf_file_llseek(struct file *, loff_t, int); static ssize_t udf_file_read_adinicb (struct file *, char *, size_t, loff_t *); static ssize_t udf_file_write (struct file *, const char *, size_t, loff_t *); #if BITS_PER_LONG < 64 @@ -152,7 +148,7 @@ /* * Make sure the offset never goes beyond the 32-bit mark.. */ -static long long udf_file_llseek(struct file * file, long long offset, int origin) +static loff_t udf_file_llseek(struct file * file, loff_t offset, int origin) { struct inode * inode = file->f_dentry->d_inode; @@ -169,12 +165,6 @@ break; } } -#if BITS_PER_LONG < 64 - if (((unsigned long long) offset >> 32) != 0) - { - return -EINVAL; - } -#endif if (offset != file->f_pos) { file->f_pos = offset; @@ -272,7 +262,8 @@ size_t bufsize, loff_t * loff) { struct inode *inode = filp->f_dentry->d_inode; - Uint32 size, left, pos, block; + loff_t size, left, pos; + Uint32 block; struct buffer_head *bh = NULL; size = inode->i_size; @@ -454,7 +445,7 @@ */ static int udf_open_file(struct inode * inode, struct file * filp) { - if (inode->i_size == (Uint32)-1 && (filp->f_mode & FMODE_WRITE)) + if ((inode->i_size & 0xFFFFFFFF00000000UL) && !(filp->f_flags & O_LARGEFILE)) return -EFBIG; return 0; } diff -u --recursive --new-file v2.3.28/linux/fs/udf/inode.c linux/fs/udf/inode.c --- v2.3.28/linux/fs/udf/inode.c Mon Nov 1 13:56:27 1999 +++ linux/fs/udf/inode.c Sat Nov 20 16:16:57 1999 @@ -201,8 +201,8 @@ if (isdir) { struct udf_fileident_bh sfibh, dfibh; - int f_pos = UDF_I_EXT0OFFS(inode) >> 2; - int size = (UDF_I_EXT0OFFS(inode) + inode->i_size) >> 2; + loff_t f_pos = UDF_I_EXT0OFFS(inode) >> 2; + loff_t size = (UDF_I_EXT0OFFS(inode) + inode->i_size) >> 2; struct FileIdentDesc cfi, *sfi, *dfi; sfibh.soffset = sfibh.eoffset = (f_pos & ((inode->i_sb->s_blocksize - 1) >> 2)) << 2; @@ -383,7 +383,7 @@ pextoffset = cextoffset; cextoffset = nextoffset; - + if ((etype = udf_next_aext(inode, &cbloc, &nextoffset, &eloc, &elen, &cbh, 1)) == -1) break; @@ -701,14 +701,31 @@ (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits))) { - laarr[i].extLength = laarr[i+1].extLength + - (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + - inode->i_sb->s_blocksize - 1) & ~(inode->i_sb->s_blocksize-1)); - if (*endnum > (i+2)) - memmove(&laarr[i+1], &laarr[i+2], - sizeof(long_ad) * (*endnum - (i+2))); - i --; - (*endnum) --; + if (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + + (laarr[i+1].extLength & UDF_EXTENT_LENGTH_MASK) + + inode->i_sb->s_blocksize - 1) & ~UDF_EXTENT_LENGTH_MASK) + { + laarr[i+1].extLength = (laarr[i+1].extLength - + (laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + + UDF_EXTENT_LENGTH_MASK) & ~(inode->i_sb->s_blocksize-1); + laarr[i].extLength = (UDF_EXTENT_LENGTH_MASK + 1) - + inode->i_sb->s_blocksize; + laarr[i+1].extLocation.logicalBlockNum = + laarr[i].extLocation.logicalBlockNum + + ((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) >> + inode->i_sb->s_blocksize_bits); + } + else + { + laarr[i].extLength = laarr[i+1].extLength + + (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + + inode->i_sb->s_blocksize - 1) & ~(inode->i_sb->s_blocksize-1)); + if (*endnum > (i+2)) + memmove(&laarr[i+1], &laarr[i+2], + sizeof(long_ad) * (*endnum - (i+2))); + i --; + (*endnum) --; + } } } } diff -u --recursive --new-file v2.3.28/linux/fs/udf/lowlevel.c linux/fs/udf/lowlevel.c --- v2.3.28/linux/fs/udf/lowlevel.c Mon Nov 1 13:56:27 1999 +++ linux/fs/udf/lowlevel.c Sat Nov 20 16:16:57 1999 @@ -123,7 +123,7 @@ BLKGETSIZE, (unsigned long) &lblock); - if (!ret) /* Hard Disk */ + if (!ret && lblock != 0x7FFFFFFF) /* Hard Disk */ { if (mult) lblock *= mult; diff -u --recursive --new-file v2.3.28/linux/fs/udf/namei.c linux/fs/udf/namei.c --- v2.3.28/linux/fs/udf/namei.c Mon Nov 1 13:56:27 1999 +++ linux/fs/udf/namei.c Sat Nov 20 16:16:57 1999 @@ -25,6 +25,8 @@ * */ +#include "udfdecl.h" + #if defined(__linux__) && defined(__KERNEL__) #include #include "udf_i.h" @@ -36,8 +38,6 @@ #include #endif -#include "udfdecl.h" - static inline int udf_match(int len, const char * const name, struct qstr *qs) { if (len != qs->len) @@ -147,13 +147,13 @@ struct FileIdentDesc *cfi) { struct FileIdentDesc *fi=NULL; - int f_pos, block; - int flen; + loff_t f_pos; + int block, flen; char fname[255]; char *nameptr; Uint8 lfi; Uint16 liu; - int size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; + loff_t size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; lb_addr bloc, eloc; Uint32 extoffset, elen, offset; struct buffer_head *bh = NULL; @@ -333,10 +333,10 @@ struct ustr unifilename; char name[UDF_NAME_LEN], fname[UDF_NAME_LEN]; int namelen; - int f_pos; + loff_t f_pos; int flen; char *nameptr; - int size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; + loff_t size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; int nfidlen; Uint8 lfi; Uint16 liu; @@ -492,7 +492,6 @@ extoffset -= sizeof(long_ad); } - dir->i_size += nfidlen; if (sb->s_blocksize - fibh->eoffset >= nfidlen) { fibh->soffset = fibh->eoffset; @@ -550,8 +549,8 @@ else { elen = ((elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); - block = eloc.logicalBlockNum + ((elen - 1) >> - dir->i_sb->s_blocksize_bits); + block = eloc.logicalBlockNum + + ((elen - 1) >> dir->i_sb->s_blocksize_bits); elen = (EXTENT_RECORDED_ALLOCATED << 30) | elen; udf_write_aext(dir, bloc, &lextoffset, eloc, elen, &bh, 0); } @@ -568,11 +567,30 @@ if (udf_next_aext(dir, &bloc, &lextoffset, &eloc, &elen, &bh, 1) == EXTENT_RECORDED_ALLOCATED) { - block = eloc.logicalBlockNum + ((elen - 1) >> - dir->i_sb->s_blocksize_bits); + if (block == (eloc.logicalBlockNum + + ((elen - 1) >> dir->i_sb->s_blocksize_bits))) + { + if (udf_next_aext(dir, &bloc, &lextoffset, &eloc, &elen, &bh, 1) != + EXTENT_RECORDED_ALLOCATED) + { + udf_release_data(bh); + udf_release_data(fibh->sbh); + udf_release_data(fibh->ebh); + udf_debug("next extent not recorded and allocated\n"); + return NULL; + } + } } else - block ++; + { + udf_release_data(bh); + udf_release_data(fibh->sbh); + udf_release_data(fibh->ebh); + udf_debug("next extent not recorded and allocated\n"); + return NULL; + } + block = eloc.logicalBlockNum + ((elen - 1) >> + dir->i_sb->s_blocksize_bits); } fi = (struct FileIdentDesc *)(fibh->sbh->b_data + sb->s_blocksize + fibh->soffset); @@ -586,6 +604,7 @@ if (!udf_write_fi(cfi, fi, fibh, NULL, name)) { udf_release_data(bh); + dir->i_size += nfidlen; if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) UDF_I_LENALLOC(dir) += nfidlen; dir->i_version = ++event; @@ -595,7 +614,6 @@ else { udf_release_data(bh); - dir->i_size -= nfidlen; if (fibh->sbh != fibh->ebh) udf_release_data(fibh->ebh); udf_release_data(fibh->sbh); @@ -807,8 +825,8 @@ { struct FileIdentDesc *fi, cfi; struct udf_fileident_bh fibh; - int f_pos; - int size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; + loff_t f_pos; + loff_t size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; int block; lb_addr bloc, eloc; Uint32 extoffset, elen, offset; diff -u --recursive --new-file v2.3.28/linux/fs/udf/super.c linux/fs/udf/super.c --- v2.3.28/linux/fs/udf/super.c Thu Nov 18 20:25:37 1999 +++ linux/fs/udf/super.c Fri Nov 19 11:35:10 1999 @@ -42,13 +42,10 @@ * 12/20/98 find the free space bitmap (if it exists) */ -#ifndef LINUX_VERSION_CODE -#include -#endif - #include "udfdecl.h" #include +#include #include #include #include @@ -66,6 +63,15 @@ #include #include +#define VDS_POS_PRIMARY_VOL_DESC 0 +#define VDS_POS_UNALLOC_SPACE_DESC 1 +#define VDS_POS_LOGICAL_VOL_DESC 2 +#define VDS_POS_PARTITION_DESC 3 +#define VDS_POS_IMP_USE_VOL_DESC 4 +#define VDS_POS_VOL_DESC_PTR 5 +#define VDS_POS_TERMINATING_DESC 6 +#define VDS_POS_LENGTH 7 + static char error_buf[1024]; /* These are the "meat" - everything else is stuffing */ @@ -1366,7 +1372,6 @@ /* Fill in the rest of the superblock */ sb->s_op = &udf_sb_ops; - sb->s_time = 0; sb->dq_op = NULL; sb->s_dirt = 0; sb->s_magic = UDF_SUPER_MAGIC; diff -u --recursive --new-file v2.3.28/linux/fs/udf/truncate.c linux/fs/udf/truncate.c --- v2.3.28/linux/fs/udf/truncate.c Sun Nov 7 16:37:34 1999 +++ linux/fs/udf/truncate.c Fri Nov 19 11:35:10 1999 @@ -38,8 +38,7 @@ lb_addr neloc = { 0, 0 }; int nelen = 0; int blocks = inode->i_sb->s_blocksize / 512; - int last_block = (elen + inode->i_sb->s_blocksize - 1) / inode->i_sb->s_blocksize; - + int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; if (offset) { diff -u --recursive --new-file v2.3.28/linux/fs/udf/udf_sb.h linux/fs/udf/udf_sb.h --- v2.3.28/linux/fs/udf/udf_sb.h Tue Sep 7 12:14:07 1999 +++ linux/fs/udf/udf_sb.h Fri Nov 19 11:35:10 1999 @@ -1,9 +1,6 @@ #ifndef __LINUX_UDF_SB_H #define __LINUX_UDF_SB_H -#include -#include - /* Since UDF 1.50 is ISO 13346 based... */ #define UDF_SUPER_MAGIC 0x15013346 diff -u --recursive --new-file v2.3.28/linux/fs/udf/udfdecl.h linux/fs/udf/udfdecl.h --- v2.3.28/linux/fs/udf/udfdecl.h Thu Nov 11 20:11:51 1999 +++ linux/fs/udf/udfdecl.h Sat Nov 20 16:16:57 1999 @@ -1,9 +1,11 @@ #ifndef __UDF_DECL_H #define __UDF_DECL_H -#define UDF_VERSION_NOTICE "v0.8.9.3" +#define UDF_VERSION_NOTICE "v0.8.9.4" +#include #include +#include "udfend.h" #ifdef __KERNEL__ @@ -20,15 +22,33 @@ #endif #include -/* if we're not defined, we must be compiling outside of the kernel tree */ + #if !defined(CONFIG_UDF_FS) && !defined(CONFIG_UDF_FS_MODULE) -/* ... so override config */ #define CONFIG_UDF_FS_MODULE -/* explicitly include udf_fs_sb.h and udf_fs_i.h */ #include #include #endif +#define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) +#define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) ) + +#define CURRENT_UTIME (xtime.tv_usec) + +#define udf_file_entry_alloc_offset(inode)\ + ((UDF_I_EXTENDED_FE(inode) ?\ + sizeof(struct ExtendedFileEntry) :\ + sizeof(struct FileEntry)) + UDF_I_LENEATTR(inode)) + +#else + +#include + +#endif /* __KERNEL__ */ + + + +#ifdef __KERNEL__ + struct dentry; struct inode; struct task_struct; @@ -48,8 +68,49 @@ int eoffset; }; +#endif /* __KERNEL__ */ + +struct udf_directory_record +{ + Uint32 d_parent; + Uint32 d_inode; + Uint32 d_name[255]; +}; + + +struct udf_vds_record +{ + Uint32 block; + Uint32 volDescSeqNum; +}; + +struct ktm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_isdst; +}; + +struct ustr +{ + Uint8 u_cmpID; + Uint8 u_name[UDF_NAME_LEN-1]; + Uint8 u_len; + Uint8 padding; + unsigned long u_hash; +}; + +#ifdef __KERNEL__ + +/* super.c */ extern void udf_error(struct super_block *, const char *, const char *, ...); extern void udf_warning(struct super_block *, const char *, const char *, ...); + +/* namei.c */ extern int udf_write_fi(struct FileIdentDesc *, struct FileIdentDesc *, struct udf_fileident_bh *, Uint8 *, Uint8 *); extern struct dentry * udf_lookup(struct inode *, struct dentry *); extern int udf_create(struct inode *, struct dentry *, int); @@ -60,7 +121,11 @@ extern int udf_symlink(struct inode *, struct dentry *, const char *); extern int udf_link(struct dentry *, struct inode *, struct dentry *); extern int udf_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); + +/* file.c */ extern int udf_ioctl(struct inode *, struct file *, unsigned int, unsigned long); + +/* inode.c */ extern struct inode *udf_iget(struct super_block *, lb_addr); extern int udf_sync_inode(struct inode *); extern struct buffer_head * udf_expand_adinicb(struct inode *, int *, int, int *); @@ -80,9 +145,10 @@ extern int udf_delete_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *); extern int udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); extern int udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); +extern void udf_discard_prealloc(struct inode *); +/* misc.c */ extern int udf_read_tagged_data(char *, int size, int fd, int block, int partref); - extern struct buffer_head *udf_tread(struct super_block *, int, int); extern struct GenericAttrFormat *udf_add_extendedattr(struct inode *, Uint32, Uint32, Uint8, struct buffer_head **); extern struct GenericAttrFormat *udf_get_extendedattr(struct inode *, Uint32, Uint8, struct buffer_head **); @@ -91,186 +157,73 @@ extern struct buffer_head *udf_read_untagged(struct super_block *, Uint32, Uint32); extern void udf_release_data(struct buffer_head *); +/* lowlevel.c */ extern unsigned int udf_get_last_session(kdev_t); extern unsigned int udf_get_last_block(kdev_t, int *); +/* partition.c */ extern Uint32 udf_get_pblock(struct super_block *, Uint32, Uint16, Uint32); extern Uint32 udf_get_lb_pblock(struct super_block *, lb_addr, Uint32); +/* unicode.c */ extern int udf_get_filename(Uint8 *, Uint8 *, int); +/* ialloc.c */ extern void udf_free_inode(struct inode *); extern struct inode * udf_new_inode (const struct inode *, int, int *); -extern void udf_discard_prealloc(struct inode *); + +/* truncate.c */ extern void udf_truncate(struct inode *); extern void udf_truncate_adinicb(struct inode *); + +/* balloc.c */ extern void udf_free_blocks(const struct inode *, lb_addr, Uint32, Uint32); extern int udf_alloc_blocks(const struct inode *, Uint16, Uint32, Uint32); extern int udf_new_block(const struct inode *, Uint16, Uint32, int *); extern int udf_sync_file(struct file *, struct dentry *); -#else - -#include +/* directory.c */ +extern Uint8 * udf_filead_read(struct inode *, Uint8 *, Uint8, lb_addr, int *, int *, struct buffer_head **, int *); +extern struct FileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct FileIdentDesc *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **); #endif /* __KERNEL__ */ -#include "udfend.h" - -/* structures */ -struct udf_directory_record -{ - Uint32 d_parent; - Uint32 d_inode; - Uint32 d_name[255]; -}; - -#define VDS_POS_PRIMARY_VOL_DESC 0 -#define VDS_POS_UNALLOC_SPACE_DESC 1 -#define VDS_POS_LOGICAL_VOL_DESC 2 -#define VDS_POS_PARTITION_DESC 3 -#define VDS_POS_IMP_USE_VOL_DESC 4 -#define VDS_POS_VOL_DESC_PTR 5 -#define VDS_POS_TERMINATING_DESC 6 -#define VDS_POS_LENGTH 7 - -struct udf_vds_record -{ - Uint32 block; - Uint32 volDescSeqNum; -}; - -struct ktm -{ - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_isdst; -}; - -struct ustr -{ - Uint8 u_cmpID; - Uint8 u_name[UDF_NAME_LEN-1]; - Uint8 u_len; - Uint8 padding; - unsigned long u_hash; -}; - - -#define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) -#define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) ) - -#ifdef __KERNEL__ - -#define CURRENT_UTIME (xtime.tv_usec) - -#define udf_file_entry_alloc_offset(inode)\ - ((UDF_I_EXTENDED_FE(inode) ?\ - sizeof(struct ExtendedFileEntry) :\ - sizeof(struct FileEntry)) + UDF_I_LENEATTR(inode)) - -#define udf_clear_bit(nr,addr) ext2_clear_bit(nr,addr) -#define udf_set_bit(nr,addr) ext2_set_bit(nr,addr) -#define udf_test_bit(nr, addr) ext2_test_bit(nr, addr) -#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size) -#define udf_find_next_one_bit(addr, size, offset) find_next_one_bit(addr, size, offset) - -#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x) -#define leNUM_to_cpup(x,y) xleNUM_to_cpup(x,y) -#define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y)) - -extern inline int find_next_one_bit (void * addr, int size, int offset) -{ - unsigned long * p = ((unsigned long *) addr) + (offset / BITS_PER_LONG); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset &= (BITS_PER_LONG-1); - if (offset) - { - tmp = leBPL_to_cpup(p++); - tmp &= ~0UL << offset; - if (size < BITS_PER_LONG) - goto found_first; - if (tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) - { - if ((tmp = leBPL_to_cpup(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = leBPL_to_cpup(p); -found_first: - tmp &= ~0UL >> (BITS_PER_LONG-size); -found_middle: - return result + ffz(~tmp); -} - -#define find_first_one_bit(addr, size)\ - find_next_one_bit((addr), (size), 0) - -#endif - /* Miscellaneous UDF Prototypes */ +/* unicode.c */ extern int udf_ustr_to_dchars(Uint8 *, const struct ustr *, int); extern int udf_ustr_to_char(Uint8 *, const struct ustr *, int); extern int udf_ustr_to_dstring(dstring *, const struct ustr *, int); extern int udf_dchars_to_ustr(struct ustr *, const Uint8 *, int); extern int udf_char_to_ustr(struct ustr *, const Uint8 *, int); extern int udf_dstring_to_ustr(struct ustr *, const dstring *, int); - -extern Uint16 udf_crc(Uint8 *, Uint32, Uint16); extern int udf_translate_to_linux(Uint8 *, Uint8 *, int, Uint8 *, int); extern int udf_build_ustr(struct ustr *, dstring *, int); extern int udf_build_ustr_exact(struct ustr *, dstring *, int); extern int udf_CS0toUTF8(struct ustr *, struct ustr *); extern int udf_UTF8toCS0(dstring *, struct ustr *, int); +/* crc.c */ +extern Uint16 udf_crc(Uint8 *, Uint32, Uint16); + +/* misc.c */ extern uid_t udf_convert_uid(int); extern gid_t udf_convert_gid(int); extern Uint32 udf64_low32(Uint64); extern Uint32 udf64_high32(Uint64); +extern void udf_update_tag(char *, int); +extern void udf_new_tag(char *, Uint16, Uint16, Uint16, Uint32, int); - +/* udftime.c */ extern time_t *udf_stamp_to_time(time_t *, long *, timestamp); extern timestamp *udf_time_to_stamp(timestamp *, time_t, long); extern time_t udf_converttime (struct ktm *); -#ifdef __KERNEL__ -extern Uint8 * -udf_filead_read(struct inode *, Uint8 *, Uint8, lb_addr, int *, int *, - struct buffer_head **, int *); - -extern struct FileIdentDesc * -udf_fileident_read(struct inode *, int *, - struct udf_fileident_bh *, - struct FileIdentDesc *, - lb_addr *, Uint32 *, - Uint32 *, struct buffer_head **); -#endif -extern struct FileIdentDesc * -udf_get_fileident(void * buffer, int bufsize, int * offset); +/* directory.c */ +extern struct FileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset); extern extent_ad * udf_get_fileextent(void * buffer, int bufsize, int * offset); extern long_ad * udf_get_filelongad(void * buffer, int bufsize, int * offset, int); extern short_ad * udf_get_fileshortad(void * buffer, int bufsize, int * offset, int); extern Uint8 * udf_get_filead(struct FileEntry *, Uint8 *, int, int, int, int *); -extern void udf_update_tag(char *, int); -extern void udf_new_tag(char *, Uint16, Uint16, Uint16, Uint32, int); - -#endif +#endif /* __UDF_DECL_H */ diff -u --recursive --new-file v2.3.28/linux/fs/udf/udfend.h linux/fs/udf/udfend.h --- v2.3.28/linux/fs/udf/udfend.h Mon Nov 1 13:56:27 1999 +++ linux/fs/udf/udfend.h Fri Nov 19 11:35:10 1999 @@ -3,6 +3,8 @@ #ifndef __KERNEL__ +#include + #if __BYTE_ORDER == 0 #error "__BYTE_ORDER must be defined" @@ -44,8 +46,11 @@ #endif /* __BYTE_ORDER == 0 */ +#include + #else /* __KERNEL__ */ +#include #include #endif /* ! __KERNEL__ */ diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/core_tsunami.h linux/include/asm-alpha/core_tsunami.h --- v2.3.28/linux/include/asm-alpha/core_tsunami.h Tue Sep 7 12:14:07 1999 +++ linux/include/asm-alpha/core_tsunami.h Tue Nov 23 10:10:38 1999 @@ -291,6 +291,9 @@ #define TSUNAMI_IO_BIAS TSUNAMI_IO(0) #define TSUNAMI_MEM_BIAS TSUNAMI_MEM(0) +/* The IO address space is larger than 0xffff */ +#define TSUNAMI_IO_SPACE (TSUNAMI_CONF(0) - TSUNAMI_IO(0)) +#define TSUNAMI_MEM_SPACE (_TSUNAMI_IACK_SC(0) - TSUNAMI_MEM(0)) /* * Data structure for handling TSUNAMI machine checks: diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/div64.h linux/include/asm-alpha/div64.h --- v2.3.28/linux/include/asm-alpha/div64.h Thu Nov 11 20:11:51 1999 +++ linux/include/asm-alpha/div64.h Tue Nov 23 10:10:38 1999 @@ -7,8 +7,8 @@ */ #define do_div(n,base) ({ \ int __res; \ - __res = ((unsigned long) n) % (unsigned) base; \ - n = ((unsigned long) n) / (unsigned) base; \ + __res = ((unsigned long) (n)) % (unsigned) (base); \ + (n) = ((unsigned long) (n)) / (unsigned) (base); \ __res; }) #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/machvec.h linux/include/asm-alpha/machvec.h --- v2.3.28/linux/include/asm-alpha/machvec.h Tue Aug 31 17:29:14 1999 +++ linux/include/asm-alpha/machvec.h Tue Nov 23 10:10:38 1999 @@ -78,7 +78,7 @@ void (*device_interrupt)(unsigned long vector, struct pt_regs *regs); void (*machine_check)(u64 vector, u64 la, struct pt_regs *regs); - void (*init_arch)(unsigned long *, unsigned long *); + void (*init_arch)(void); void (*init_irq)(void); void (*init_pit)(void); void (*init_pci)(void); diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/page.h linux/include/asm-alpha/page.h --- v2.3.28/linux/include/asm-alpha/page.h Thu Jul 29 13:37:22 1999 +++ linux/include/asm-alpha/page.h Tue Nov 23 10:10:38 1999 @@ -19,7 +19,7 @@ * results in clearer kernel profiles as we see _who_ is * doing page clearing or copying. */ -static inline void clear_page(unsigned long page) +static inline void clear_page(void * page) { unsigned long count = PAGE_SIZE/64; unsigned long *ptr = (unsigned long *)page; @@ -38,7 +38,7 @@ } while (count); } -static inline void copy_page(unsigned long _to, unsigned long _from) +static inline void copy_page(void * _to, void * _from) { unsigned long count = PAGE_SIZE/64; unsigned long *to = (unsigned long *)_to; @@ -106,7 +106,16 @@ #endif /* STRICT_MM_TYPECHECKS */ +#if 0 #define BUG() __asm__ __volatile__("call_pal 129 # bugchk") +#else +/* hack to see the BUG() information in the early boot stage */ +#define BUG() \ +do { \ + SRM_printf("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ + halt(); \ +} while(0) +#endif #define PAGE_BUG(page) BUG() #endif /* !ASSEMBLY */ diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/pgalloc.h linux/include/asm-alpha/pgalloc.h --- v2.3.28/linux/include/asm-alpha/pgalloc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-alpha/pgalloc.h Tue Nov 23 10:10:38 1999 @@ -0,0 +1,337 @@ +#ifndef _ALPHA_PGALLOC_H +#define _ALPHA_PGALLOC_H + +#include + +/* Caches aren't brain-dead on the Alpha. */ +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(mm, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_page_to_ram(page) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) + +/* + * Use a few helper functions to hide the ugly broken ASN + * numbers on early Alphas (ev4 and ev45) + */ + +#ifndef __EXTERN_INLINE +#define __EXTERN_INLINE extern inline +#define __MMU_EXTERN_INLINE +#endif + +__EXTERN_INLINE void +ev4_flush_tlb_current(struct mm_struct *mm) +{ + tbiap(); +} + +__EXTERN_INLINE void +ev4_flush_tlb_other(struct mm_struct *mm) +{ +} + +extern void ev5_flush_tlb_current(struct mm_struct *mm); + +__EXTERN_INLINE void +ev5_flush_tlb_other(struct mm_struct *mm) +{ + mm->context = 0; +} + +/* + * Flush just one page in the current TLB set. + * We need to be very careful about the icache here, there + * is no way to invalidate a specific icache page.. + */ + +__EXTERN_INLINE void +ev4_flush_tlb_current_page(struct mm_struct * mm, + struct vm_area_struct *vma, + unsigned long addr) +{ + tbi(2 + ((vma->vm_flags & VM_EXEC) != 0), addr); +} + +__EXTERN_INLINE void +ev5_flush_tlb_current_page(struct mm_struct * mm, + struct vm_area_struct *vma, + unsigned long addr) +{ + if (vma->vm_flags & VM_EXEC) + ev5_flush_tlb_current(mm); + else + tbi(2, addr); +} + + +#ifdef CONFIG_ALPHA_GENERIC +# define flush_tlb_current alpha_mv.mv_flush_tlb_current +# define flush_tlb_other alpha_mv.mv_flush_tlb_other +# define flush_tlb_current_page alpha_mv.mv_flush_tlb_current_page +#else +# ifdef CONFIG_ALPHA_EV4 +# define flush_tlb_current ev4_flush_tlb_current +# define flush_tlb_other ev4_flush_tlb_other +# define flush_tlb_current_page ev4_flush_tlb_current_page +# else +# define flush_tlb_current ev5_flush_tlb_current +# define flush_tlb_other ev5_flush_tlb_other +# define flush_tlb_current_page ev5_flush_tlb_current_page +# endif +#endif + +#ifdef __MMU_EXTERN_INLINE +#undef __EXTERN_INLINE +#undef __MMU_EXTERN_INLINE +#endif + +/* + * Flush current user mapping. + */ +static inline void flush_tlb(void) +{ + flush_tlb_current(current->mm); +} + +#ifndef __SMP__ +/* + * Flush everything (kernel mapping may also have + * changed due to vmalloc/vfree) + */ +static inline void flush_tlb_all(void) +{ + tbia(); +} + +/* + * Flush a specified user mapping + */ +static inline void flush_tlb_mm(struct mm_struct *mm) +{ + if (mm != current->mm) + flush_tlb_other(mm); + else + flush_tlb_current(mm); +} + +/* + * Page-granular tlb flush. + * + * do a tbisd (type = 2) normally, and a tbis (type = 3) + * if it is an executable mapping. We want to avoid the + * itlb flush, because that potentially also does a + * icache flush. + */ +static inline void flush_tlb_page(struct vm_area_struct *vma, + unsigned long addr) +{ + struct mm_struct * mm = vma->vm_mm; + + if (mm != current->mm) + flush_tlb_other(mm); + else + flush_tlb_current_page(mm, vma, addr); +} + +/* + * Flush a specified range of user mapping: on the + * Alpha we flush the whole user tlb. + */ +static inline void flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + flush_tlb_mm(mm); +} + +#else /* __SMP__ */ + +extern void flush_tlb_all(void); +extern void flush_tlb_mm(struct mm_struct *); +extern void flush_tlb_page(struct vm_area_struct *, unsigned long); +extern void flush_tlb_range(struct mm_struct *, unsigned long, unsigned long); + +#endif /* __SMP__ */ + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ +#ifndef __SMP__ +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; +#else +#include +#define quicklists cpu_data[smp_processor_id()] +#endif +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init; + + if (ret) { + init = pgd_offset(&init_mm, 0UL); + memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); + memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + + pgd_val(ret[PTRS_PER_PGD]) + = pte_val(mk_pte(mem_map + MAP_NR(ret), PAGE_KERNEL)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_premasked); + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pmd_t *)ret; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ + *(unsigned long *)pmd = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pmd; + pgtable_cache_size++; +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ + free_page((unsigned long)pmd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +extern void __bad_pte(pmd_t *pmd); +extern void __bad_pmd(pgd_t *pgd); + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pmd_free_kernel(pmd) free_pmd_fast(pmd) +#define pmd_free(pmd) free_pmd_fast(pmd) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc(pmd_t *pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_set(pmd, page); + return page + address; + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + if (pgd_none(*pgd)) { + pmd_t *page = get_pmd_fast(); + + if (!page) + return get_pmd_slow(pgd, address); + pgd_set(pgd, page); + return page + address; + } + if (pgd_bad(*pgd)) { + __bad_pmd(pgd); + return NULL; + } + return (pmd_t *) pgd_page(*pgd) + address; +} + +#define pte_alloc_kernel pte_alloc +#define pmd_alloc_kernel pmd_alloc + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[(address >> PGDIR_SHIFT) & (PTRS_PER_PAGE - 1)] = entry; +} + +#endif /* _ALPHA_PGALLOC_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/pgtable.h linux/include/asm-alpha/pgtable.h --- v2.3.28/linux/include/asm-alpha/pgtable.h Fri Oct 15 15:25:14 1999 +++ linux/include/asm-alpha/pgtable.h Tue Nov 23 10:10:38 1999 @@ -9,165 +9,11 @@ * in (currently 8192). */ #include -#include /* For the task lock */ -#include +#include #include /* For TASK_SIZE */ -#include #include - -/* Caches aren't brain-dead on the Alpha. */ -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_range(mm, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr) do { } while (0) -#define flush_page_to_ram(page) do { } while (0) -#define flush_icache_range(start, end) do { } while (0) - -/* - * Use a few helper functions to hide the ugly broken ASN - * numbers on early Alphas (ev4 and ev45) - */ - -#ifndef __EXTERN_INLINE -#define __EXTERN_INLINE extern inline -#define __MMU_EXTERN_INLINE -#endif - -__EXTERN_INLINE void -ev4_flush_tlb_current(struct mm_struct *mm) -{ - tbiap(); -} - -__EXTERN_INLINE void -ev4_flush_tlb_other(struct mm_struct *mm) -{ -} - -extern void ev5_flush_tlb_current(struct mm_struct *mm); - -__EXTERN_INLINE void -ev5_flush_tlb_other(struct mm_struct *mm) -{ - mm->context = 0; -} - -/* - * Flush just one page in the current TLB set. - * We need to be very careful about the icache here, there - * is no way to invalidate a specific icache page.. - */ - -__EXTERN_INLINE void -ev4_flush_tlb_current_page(struct mm_struct * mm, - struct vm_area_struct *vma, - unsigned long addr) -{ - tbi(2 + ((vma->vm_flags & VM_EXEC) != 0), addr); -} - -__EXTERN_INLINE void -ev5_flush_tlb_current_page(struct mm_struct * mm, - struct vm_area_struct *vma, - unsigned long addr) -{ - if (vma->vm_flags & VM_EXEC) - ev5_flush_tlb_current(mm); - else - tbi(2, addr); -} - - -#ifdef CONFIG_ALPHA_GENERIC -# define flush_tlb_current alpha_mv.mv_flush_tlb_current -# define flush_tlb_other alpha_mv.mv_flush_tlb_other -# define flush_tlb_current_page alpha_mv.mv_flush_tlb_current_page -#else -# ifdef CONFIG_ALPHA_EV4 -# define flush_tlb_current ev4_flush_tlb_current -# define flush_tlb_other ev4_flush_tlb_other -# define flush_tlb_current_page ev4_flush_tlb_current_page -# else -# define flush_tlb_current ev5_flush_tlb_current -# define flush_tlb_other ev5_flush_tlb_other -# define flush_tlb_current_page ev5_flush_tlb_current_page -# endif -#endif - -#ifdef __MMU_EXTERN_INLINE -#undef __EXTERN_INLINE -#undef __MMU_EXTERN_INLINE -#endif - -/* - * Flush current user mapping. - */ -static inline void flush_tlb(void) -{ - flush_tlb_current(current->mm); -} - -#ifndef __SMP__ -/* - * Flush everything (kernel mapping may also have - * changed due to vmalloc/vfree) - */ -static inline void flush_tlb_all(void) -{ - tbia(); -} - -/* - * Flush a specified user mapping - */ -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - if (mm != current->mm) - flush_tlb_other(mm); - else - flush_tlb_current(mm); -} - -/* - * Page-granular tlb flush. - * - * do a tbisd (type = 2) normally, and a tbis (type = 3) - * if it is an executable mapping. We want to avoid the - * itlb flush, because that potentially also does a - * icache flush. - */ -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - struct mm_struct * mm = vma->vm_mm; - - if (mm != current->mm) - flush_tlb_other(mm); - else - flush_tlb_current_page(mm, vma, addr); -} - -/* - * Flush a specified range of user mapping: on the - * Alpha we flush the whole user tlb. - */ -static inline void flush_tlb_range(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - flush_tlb_mm(mm); -} - -#else /* __SMP__ */ - -extern void flush_tlb_all(void); -extern void flush_tlb_mm(struct mm_struct *); -extern void flush_tlb_page(struct vm_area_struct *, unsigned long); -extern void flush_tlb_range(struct mm_struct *, unsigned long, unsigned long); - -#endif /* __SMP__ */ - /* Certain architectures need to do special things when PTEs * within a page table are directly modified. Thus, the following * hook is made available. @@ -293,7 +139,7 @@ #define BAD_PAGETABLE __bad_pagetable() #define BAD_PAGE __bad_page() -#define ZERO_PAGE(vaddr) (PAGE_OFFSET+0x30A000) +#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(ZERO_PGE)) /* number of bits that fit into a memory pointer */ #define BITS_PER_PTR (8*sizeof(unsigned long)) @@ -330,8 +176,14 @@ * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot) -{ pte_t pte; pte_val(pte) = ((page-PAGE_OFFSET) << (32-PAGE_SHIFT)) | pgprot_val(pgprot); return pte; } +#define mk_pte(page, pgprot) \ +({ \ + pte_t pte; \ + \ + pte_val(pte) = ((unsigned long)(page - mem_map) << 32) | \ + pgprot_val(pgprot); \ + pte; \ +}) extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) { pte_t pte; pte_val(pte) = (PHYS_TWIDDLE(physpage) << (32-PAGE_SHIFT)) | pgprot_val(pgprot); return pte; } @@ -345,8 +197,8 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) { pgd_val(*pgdp) = _PAGE_TABLE | ((((unsigned long) pmdp) - PAGE_OFFSET) << (32-PAGE_SHIFT)); } -extern inline unsigned long pte_page(pte_t pte) -{ return PAGE_OFFSET + ((pte_val(pte) & _PFN_MASK) >> (32-PAGE_SHIFT)); } +#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> 32))) +#define pte_page(x) (mem_map+pte_pagenr(x)) extern inline unsigned long pmd_page(pmd_t pmd) { return PAGE_OFFSET + ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } @@ -368,6 +220,9 @@ extern inline int pgd_present(pgd_t pgd) { return pgd_val(pgd) & _PAGE_VALID; } extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; } +#define page_address(page) ((page)->virtual) +#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) + /* * The following only work if pte_present() is true. * Undefined behaviour if not.. @@ -395,10 +250,8 @@ #define pgd_offset_k(address) pgd_offset(&init_mm, address) /* to find an entry in a page-table-directory. */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + ((address >> PGDIR_SHIFT) & (PTRS_PER_PAGE - 1)); -} +#define __pgd_offset(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) +#define pgd_offset(mm, address) ((mm)->pgd+__pgd_offset(address)) /* Find an entry in the second-level page table.. */ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) @@ -412,186 +265,6 @@ return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); } -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ -#ifndef __SMP__ -extern struct pgtable_cache_struct { - unsigned long *pgd_cache; - unsigned long *pte_cache; - unsigned long pgtable_cache_sz; -} quicklists; -#else -#include -#define quicklists cpu_data[smp_processor_id()] -#endif -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) - -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init; - - if (ret) { - init = pgd_offset(&init_mm, 0); - memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); - memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - - pgd_val(ret[PTRS_PER_PGD]) - = pte_val(mk_pte((unsigned long)ret, PAGE_KERNEL)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_premasked); - -extern __inline__ pmd_t *get_pmd_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pmd_t *)ret; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pmd; - pgtable_cache_size++; -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ - free_page((unsigned long)pmd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -extern void __bad_pte(pmd_t *pmd); -extern void __bad_pmd(pgd_t *pgd); - -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) -#define pmd_free_kernel(pmd) free_pmd_fast(pmd) -#define pmd_free(pmd) free_pmd_fast(pmd) -#define pgd_free(pgd) free_pgd_fast(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_set(pmd, page); - return page + address; - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) -{ - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_pmd_fast(); - - if (!page) - return get_pmd_slow(pgd, address); - pgd_set(pgd, page); - return page + address; - } - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + address; -} - -#define pte_alloc_kernel pte_alloc -#define pmd_alloc_kernel pmd_alloc - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[(address >> PGDIR_SHIFT) & (PTRS_PER_PAGE - 1)] = entry; -} - extern pgd_t swapper_pg_dir[1024]; /* @@ -610,9 +283,11 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) { pte_t pte; pte_val(pte) = (type << 32) | (offset << 40); return pte; } -#define SWP_TYPE(entry) (((entry) >> 32) & 0xff) -#define SWP_OFFSET(entry) ((entry) >> 40) -#define SWP_ENTRY(type,offset) pte_val(mk_swap_pte((type),(offset))) +#define SWP_TYPE(x) (((x).val >> 32) & 0xff) +#define SWP_OFFSET(x) ((x).val >> 40) +#define SWP_ENTRY(type, offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(x) ((pte_t) { (x).val }) #define module_map vmalloc #define module_unmap vfree @@ -622,6 +297,13 @@ #define kern_addr_valid(addr) (1) #define io_remap_page_range(start, busaddr, size, prot) \ - remap_page_range(start, virt_to_phys(__ioremap(busaddr)), size, prot) + remap_page_range(start, virt_to_phys(__ioremap(busaddr), 0), size, prot) + +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) #endif /* _ALPHA_PGTABLE_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h --- v2.3.28/linux/include/asm-alpha/system.h Tue Aug 31 17:29:14 1999 +++ linux/include/asm-alpha/system.h Tue Nov 23 10:10:38 1999 @@ -363,6 +363,17 @@ ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) #define tas(ptr) (xchg((ptr),1)) +/* Very dirty but nevertheless very fun hack ;). I recall the aboot printf() + that will in turn use the SRM console to do the debugging of the boot + process. As there's no runtime symbol table, the address of printf() + is hardwired and is in function of the bootlx binary you have in /boot... + 1999 Andrea Arcangeli */ +#if 0 +#define SRM_printf(args...) ({ int (*__SRM_printf)(const char *fmt, ...) = (int (*)(const char *fmt, ...)) 0x20000aa0; __SRM_printf(args); }) +#else +#define SRM_printf(args...) +#endif + #endif /* __ASSEMBLY__ */ #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-arc/serial.h linux/include/asm-arm/arch-arc/serial.h --- v2.3.28/linux/include/asm-arm/arch-arc/serial.h Fri May 8 00:42:39 1998 +++ linux/include/asm-arm/arch-arc/serial.h Tue Nov 23 22:23:11 1999 @@ -23,30 +23,24 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 16 + #if defined(CONFIG_ARCH_A5K) /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ + +#define STD_SERIAL_PORT_DEFNS { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ -#elif defined(CONFIG_ARCH_ARC) +#else - /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS1 */ + +#endif + +#define EXTRA_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ @@ -60,5 +54,4 @@ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ -#endif #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/acornfb.h linux/include/asm-arm/arch-cl7500/acornfb.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/acornfb.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/acornfb.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,33 @@ +#define acornfb_valid_pixrate(rate) (rate >= 39325 && rate <= 40119) + +static inline void +acornfb_vidc20_find_rates(struct vidc_timing *vidc, + struct fb_var_screeninfo *var) +{ + u_int bandwidth; + + vidc->control |= VIDC20_CTRL_PIX_CK; + + /* Calculate bandwidth */ + bandwidth = var->pixclock * 8 / var->bits_per_pixel; + + /* Encode bandwidth as VIDC20 setting */ + if (bandwidth > 16667*2) + vidc->control |= VIDC20_CTRL_FIFO_16; + else if (bandwidth > 13333*2) + vidc->control |= VIDC20_CTRL_FIFO_20; + else if (bandwidth > 11111*2) + vidc->control |= VIDC20_CTRL_FIFO_24; + else + vidc->control |= VIDC20_CTRL_FIFO_28; + + vidc->pll_ctl = 0x2020; +} + +#ifdef CONFIG_CHRONTEL_7003 +#define acornfb_default_control() VIDC20_CTRL_PIX_HCLK +#else +#define acornfb_default_control() VIDC20_CTRL_PIX_VCLK +#endif + +#define acornfb_default_econtrol() VIDC20_ECTL_DAC | VIDC20_ECTL_REG(3) | VIDC20_ECTL_ECK diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/dma.h linux/include/asm-arm/arch-cl7500/dma.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/dma.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/dma.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,21 @@ +/* + * linux/include/asm-arm/arch-cl7500/dma.h + * + * Copyright (C) 1999 Nexus Electronics Ltd. + */ + +#ifndef __ASM_ARCH_DMA_H +#define __ASM_ARCH_DMA_H + +/* + * This is the maximum DMA address that can be DMAd to. + * There should not be more than (0xd0000000 - 0xc0000000) + * bytes of RAM. + */ +#define MAX_DMA_ADDRESS 0xd0000000 + +#define MAX_DMA_CHANNELS 1 + +#define DMA_S0 0 + +#endif /* _ASM_ARCH_DMA_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/hardware.h linux/include/asm-arm/arch-cl7500/hardware.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/hardware.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/hardware.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,97 @@ +/* + * linux/include/asm-arm/arch-cl7500/hardware.h + * + * Copyright (C) 1996-1999 Russell King. + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * This file contains the hardware definitions of the + * CL7500 evaluation board. + */ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +#include +#include + +/* + * What hardware must be present + */ +#define HAS_IOMD +#define HAS_VIDC20 + +/* Hardware addresses of major areas. + * *_START is the physical address + * *_SIZE is the size of the region + * *_BASE is the virtual address + */ + +#define IO_START 0x03000000 /* I/O */ +#define IO_SIZE 0x01000000 +#define IO_BASE 0xe0000000 + +#define ISA_START 0x0c000000 /* ISA */ +#define ISA_SIZE 0x00010000 +#define ISA_BASE 0xe1000000 + +#define FLASH_START 0x01000000 /* XXX */ +#define FLASH_SIZE 0x01000000 +#define FLASH_BASE 0xe2000000 + +#define LED_START 0x0302B000 +#define LED_SIZE 0x00001000 +#define LED_BASE 0xe3000000 +#define LED_ADDRESS (LED_BASE + 0xa00) + +/* Let's define SCREEN_START for CL7500, even though it's a lie. */ +#define SCREEN_START 0x02000000 /* VRAM */ +#define SCREEN2_END 0xe0000000 +#define SCREEN2_BASE 0xd8000000 +#define SCREEN1_END 0xd8000000 +#define SCREEN1_BASE 0xd0000000 + +#define FLUSH_BASE 0xdf000000 + + +#ifndef __ASSEMBLER__ + +/* + * for use with inb/outb + */ +#define IO_VIDC_AUDIO_BASE 0x80140000 +#define IO_VIDC_BASE 0x80100000 +#define IO_IOMD_BASE 0x80080000 +#define IOC_BASE 0x80080000 + +/* + * IO definitions + */ +#define EXPMASK_BASE ((volatile unsigned char *)0xe0360000) +#define IOEB_BASE ((volatile unsigned char *)0xe0350050) +#define PCIO_FLOPPYDMABASE ((volatile unsigned char *)0xe002a000) +#define PCIO_BASE 0xe0010000 + +/* + * RAM definitions + */ +#define GET_MEMORY_END(p) (PAGE_OFFSET + p->u1.s.page_size * \ + (p->u1.s.pages_in_bank[0] + \ + p->u1.s.pages_in_bank[1] + \ + p->u1.s.pages_in_bank[2] + \ + p->u1.s.pages_in_bank[3])) + +#define PARAMS_BASE 0 + +#define FLUSH_BASE_PHYS 0x00000000 /* ROM */ + +#else + +#define VIDC_SND_BASE 0xe0500000 +#define VIDC_BASE 0xe0400000 +#define IOMD_BASE 0xe0200000 +#define IOC_BASE 0xe0200000 +#define PCIO_FLOPPYDMABASE 0xe002a000 +#define PCIO_BASE 0xe0010000 + +#endif +#endif + diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/ide.h linux/include/asm-arm/arch-cl7500/ide.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/ide.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/ide.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,38 @@ +/* + * linux/include/asm-arm/arch-cl7500/ide.h + * + * Copyright (c) 1997 Russell King + * + * Modifications: + * 29-07-1998 RMK Major re-work of IDE architecture specific code + */ +#include + +/* + * Set up a hw structure for a specified data port, control port and IRQ. + * This should follow whatever the default interface uses. + */ +static __inline__ void +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq) +{ + ide_ioreg_t reg = (ide_ioreg_t) data_port; + int i; + + memset(hw, 0, sizeof(*hw)); + + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { + hw->io_ports[i] = reg; + reg += 1; + } + hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; + hw->irq = irq; +} + +/* + * This registers the standard ports for this architecture with the IDE + * driver. + */ +static __inline__ void +ide_init_default_hwifs(void) +{ +} diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/io.h linux/include/asm-arm/arch-cl7500/io.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/io.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/io.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,210 @@ +/* + * linux/include/asm-arm/arch-cl7500/io.h + * from linux/include/asm-arm/arch-rpc/io.h + * + * Copyright (C) 1997 Russell King + * + * Modifications: + * 06-Dec-1997 RMK Created. + */ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +/* + * This architecture does not require any delayed IO, and + * has the constant-optimised IO + */ +#undef ARCH_IO_DELAY + +/* + * We use two different types of addressing - PC style addresses, and ARM + * addresses. PC style accesses the PC hardware with the normal PC IO + * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+ + * and are translated to the start of IO. Note that all addresses are + * shifted left! + */ +#define __PORT_PCIO(x) (!((x) & 0x80000000)) + +/* + * Dynamic IO functions - let the compiler + * optimize the expressions + */ +extern __inline__ void __outb (unsigned int value, unsigned int port) +{ + unsigned long temp; + __asm__ __volatile__( + "tst %2, #0x80000000\n\t" + "mov %0, %4\n\t" + "addeq %0, %0, %3\n\t" + "strb %1, [%0, %2, lsl #2] @ outb" + : "=&r" (temp) + : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) + : "cc"); +} + +extern __inline__ void __outw (unsigned int value, unsigned int port) +{ + unsigned long temp; + __asm__ __volatile__( + "tst %2, #0x80000000\n\t" + "mov %0, %4\n\t" + "addeq %0, %0, %3\n\t" + "str %1, [%0, %2, lsl #2] @ outw" + : "=&r" (temp) + : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) + : "cc"); +} + +extern __inline__ void __outl (unsigned int value, unsigned int port) +{ + unsigned long temp; + __asm__ __volatile__( + "tst %2, #0x80000000\n\t" + "mov %0, %4\n\t" + "addeq %0, %0, %3\n\t" + "str %1, [%0, %2, lsl #2] @ outl" + : "=&r" (temp) + : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) + : "cc"); +} + +#define DECLARE_DYN_IN(sz,fnsuffix,instr) \ +extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ +{ \ + unsigned long temp, value; \ + __asm__ __volatile__( \ + "tst %2, #0x80000000\n\t" \ + "mov %0, %4\n\t" \ + "addeq %0, %0, %3\n\t" \ + "ldr" ##instr## " %1, [%0, %2, lsl #2] @ in"###fnsuffix \ + : "=&r" (temp), "=r" (value) \ + : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ + : "cc"); \ + return (unsigned sz)value; \ +} + +extern __inline__ unsigned int __ioaddr (unsigned int port) \ +{ \ + if (__PORT_PCIO(port)) \ + return (unsigned int)(PCIO_BASE + (port << 2)); \ + else \ + return (unsigned int)(IO_BASE + (port << 2)); \ +} + +#define DECLARE_IO(sz,fnsuffix,instr) \ + DECLARE_DYN_IN(sz,fnsuffix,instr) + +DECLARE_IO(char,b,"b") +DECLARE_IO(short,w,"") +DECLARE_IO(long,l,"") + +#undef DECLARE_IO +#undef DECLARE_DYN_IN + +/* + * Constant address IO functions + * + * These have to be macros for the 'J' constraint to work - + * +/-4096 immediate operand. + */ +#define __outbc(value,port) \ +({ \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "strb %0, [%1, %2] @ outbc" \ + : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "strb %0, [%1, %2] @ outbc" \ + : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \ +}) + +#define __inbc(port) \ +({ \ + unsigned char result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2] @ inbc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2] @ inbc" \ + : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ + result; \ +}) + +#define __outwc(value,port) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outwc" \ + : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outwc" \ + : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \ +}) + +#define __inwc(port) \ +({ \ + unsigned short result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ + result & 0xffff; \ +}) + +#define __outlc(value,port) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outlc" \ + : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outlc" \ + : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \ +}) + +#define __inlc(port) \ +({ \ + unsigned long result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inlc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inlc" \ + : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ + result; \ +}) + +#define __ioaddrc(port) \ + (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2)) + +/* + * Translated address IO functions + * + * IO address has already been translated to a virtual address + */ +#define outb_t(v,p) \ + (*(volatile unsigned char *)(p) = (v)) + +#define inb_t(p) \ + (*(volatile unsigned char *)(p)) + +#define outl_t(v,p) \ + (*(volatile unsigned long *)(p) = (v)) + +#define inl_t(p) \ + (*(volatile unsigned long *)(p)) + +#endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/irq.h linux/include/asm-arm/arch-cl7500/irq.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/irq.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/irq.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,267 @@ +/* + * include/asm-arm/arch-cl7500/irq.h + * + * Copyright (C) 1996 Russell King + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * Changelog: + * 10-10-1996 RMK Brought up to date with arch-sa110eval + * 22-08-1998 RMK Restructured IRQ routines + * 11-08-1999 PJB Created ARM7500 version, derived from RiscPC code + */ +#include + +static inline int fixup_irq(unsigned int irq) +{ + if (irq == IRQ_ISA) { + int isabits = *((volatile unsigned int *)0xe002b700); + if (isabits == 0) { + printk("Spurious ISA IRQ!\n"); + return irq; + } + irq = 40; + while (!(isabits & 1)) { + irq++; + isabits >>= 1; + } + } + + return irq; +} + +static void cl7500_mask_irq_ack_a(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]\n" +" strb %1, [%3]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKA)), + "r" (ioaddr(IOMD_IRQCLRA))); +} + +static void cl7500_mask_irq_a(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKA))); +} + +static void cl7500_unmask_irq_a(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKA))); +} + +static void cl7500_mask_irq_b(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKB))); +} + +static void cl7500_unmask_irq_b(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKB))); +} + +static void cl7500_mask_irq_c(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKC))); +} + +static void cl7500_unmask_irq_c(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKC))); +} + + +static void cl7500_mask_irq_d(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKD))); +} + +static void cl7500_unmask_irq_d(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKD))); +} + +static void cl7500_mask_irq_dma(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_DMAMASK))); +} + +static void cl7500_unmask_irq_dma(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_DMAMASK))); +} + +static void cl7500_mask_irq_fiq(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_FIQMASK))); +} + +static void cl7500_unmask_irq_fiq(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_FIQMASK))); +} + +static void no_action(int cpl, void *dev_id, struct pt_regs *regs) +{ +} + +static struct irqaction irq_isa = { no_action, 0, 0, "isa", NULL, NULL }; + +static __inline__ void irq_init_irq(void) +{ + extern void ecard_disableirq(unsigned int irq); + extern void ecard_enableirq(unsigned int irq); + int irq; + + outb(0, IOMD_IRQMASKA); + outb(0, IOMD_IRQMASKB); + outb(0, IOMD_FIQMASK); + outb(0, IOMD_DMAMASK); + + for (irq = 0; irq < NR_IRQS; irq++) { + switch (irq) { + case 0 ... 6: + irq_desc[irq].probe_ok = 1; + case 7: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_ack_a; + irq_desc[irq].mask = cl7500_mask_irq_a; + irq_desc[irq].unmask = cl7500_unmask_irq_a; + break; + + case 9 ... 15: + irq_desc[irq].probe_ok = 1; + case 8: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_b; + irq_desc[irq].mask = cl7500_mask_irq_b; + irq_desc[irq].unmask = cl7500_unmask_irq_b; + break; + + case 16 ... 22: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_dma; + irq_desc[irq].mask = cl7500_mask_irq_dma; + irq_desc[irq].unmask = cl7500_unmask_irq_dma; + break; + + case 24 ... 31: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_c; + irq_desc[irq].mask = cl7500_mask_irq_c; + irq_desc[irq].unmask = cl7500_unmask_irq_c; + break; + + case 32 ... 39: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_d; + irq_desc[irq].mask = cl7500_mask_irq_d; + irq_desc[irq].unmask = cl7500_unmask_irq_d; + break; + + case 40 ... 47: + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = no_action; + irq_desc[irq].mask = no_action; + irq_desc[irq].unmask = no_action; + break; + + case 64 ... 72: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_fiq; + irq_desc[irq].mask = cl7500_mask_irq_fiq; + irq_desc[irq].unmask = cl7500_unmask_irq_fiq; + break; + } + } + + setup_arm_irq(IRQ_ISA, &irq_isa); +} diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/irqs.h linux/include/asm-arm/arch-cl7500/irqs.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/irqs.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/irqs.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,59 @@ +/* + * linux/include/asm-arm/arch-cl7500/irqs.h + * + * Copyright (C) 1999 Nexus Electronics Ltd + */ + +#define IRQ_INT2 0 +#define IRQ_INT1 2 +#define IRQ_VSYNCPULSE 3 +#define IRQ_POWERON 4 +#define IRQ_TIMER0 5 +#define IRQ_TIMER1 6 +#define IRQ_FORCE 7 +#define IRQ_INT8 8 +#define IRQ_ISA 9 +#define IRQ_INT6 10 +#define IRQ_INT5 11 +#define IRQ_INT4 12 +#define IRQ_INT3 13 +#define IRQ_KEYBOARDTX 14 +#define IRQ_KEYBOARDRX 15 + +#define IRQ_DMA0 16 +#define IRQ_DMA1 17 +#define IRQ_DMA2 18 +#define IRQ_DMA3 19 +#define IRQ_DMAS0 20 +#define IRQ_DMAS1 21 + +#define IRQ_IOP0 24 +#define IRQ_IOP1 25 +#define IRQ_IOP2 26 +#define IRQ_IOP3 27 +#define IRQ_IOP4 28 +#define IRQ_IOP5 29 +#define IRQ_IOP6 30 +#define IRQ_IOP7 31 +#define IRQ_MOUSERX 32 +#define IRQ_MOUSETX 33 +#define IRQ_ADC 34 +#define IRQ_EVENT1 35 +#define IRQ_EVENT2 36 + +#define IRQ_ISA_3 40 +#define IRQ_ISA_4 41 +#define IRQ_ISA_5 42 +#define IRQ_ISA_7 43 +#define IRQ_ISA_9 44 +#define IRQ_ISA_10 45 +#define IRQ_ISA_11 46 +#define IRQ_ISA_14 47 + +#define FIQ_INT9 0 +#define FIQ_INT5 1 +#define FIQ_INT6 4 +#define FIQ_INT8 6 +#define FIQ_FORCE 7 + +#define IRQ_TIMER IRQ_TIMER0 diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/keyboard.h linux/include/asm-arm/arch-cl7500/keyboard.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/keyboard.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/keyboard.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-cl7500/keyboard.h + * from linux/include/asm-arm/arch-rpc/keyboard.h + * + * Keyboard driver definitions for CL7500 architecture + * + * (C) 1998 Russell King + */ + +#include + +#define NR_SCANCODES 128 + +extern void ps2kbd_leds(unsigned char leds); +extern void ps2kbd_init_hw(void); +extern unsigned char ps2kbd_sysrq_xlate[NR_SCANCODES]; + +#define kbd_setkeycode(sc,kc) (-EINVAL) +#define kbd_getkeycode(sc) (-EINVAL) + +#define kbd_translate(sc, kcp, rm) ({ *(kcp) = (sc); 1; }) +#define kbd_unexpected_up(kc) (0200) +#define kbd_leds(leds) ps2kbd_leds(leds) +#define kbd_init_hw() ps2kbd_init_hw() +#define kbd_sysrq_xlate ps2kbd_sysrq_xlate +#define kbd_disable_irq() disable_irq(IRQ_KEYBOARDRX) +#define kbd_enable_irq() enable_irq(IRQ_KEYBOARDRX) + +#define SYSRQ_KEY 13 diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/memory.h linux/include/asm-arm/arch-cl7500/memory.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/memory.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/memory.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,41 @@ +/* + * linux/include/asm-arm/arch-cl7500/memory.h + * + * Copyright (c) 1996,1997,1998 Russell King. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings + * 11-Jan-1998 RMK Uninlined to reduce hits on cache + * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Added TASK_SIZE and PAGE_OFFSET + */ +#ifndef __ASM_ARCH_MMU_H +#define __ASM_ARCH_MMU_H + +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) + +#ifndef __ASSEMBLY__ +extern unsigned long __virt_to_phys(unsigned long vpage); +extern unsigned long __phys_to_virt(unsigned long ppage); +#endif + +/* + * These are exactly the same on the RiscPC as the + * physical memory view. + */ +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + +#endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/param.h linux/include/asm-arm/arch-cl7500/param.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/param.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/param.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,5 @@ +/* + * linux/include/asm-arm/arch-cl7500/param.h + * + * Copyright (C) 1999 Nexus Electronics Ltd + */ diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/processor.h linux/include/asm-arm/arch-cl7500/processor.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/processor.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/processor.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-cl7500/processor.h + * + * Copyright (c) 1996-1999 Russell King. + * + * Changelog: + * 10-Sep-1996 RMK Created + * 21-Mar-1999 RMK Added asm/arch/memory.h + */ + +#ifndef __ASM_ARCH_PROCESSOR_H +#define __ASM_ARCH_PROCESSOR_H + +#include + +/* + * Bus types + */ +#define EISA_bus 0 +#define EISA_bus__is_a_macro /* for versions in ksyms.c */ +#define MCA_bus 0 +#define MCA_bus__is_a_macro /* for versions in ksyms.c */ + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + +#endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/serial.h linux/include/asm-arm/arch-cl7500/serial.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/serial.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/serial.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,42 @@ +/* + * linux/include/asm-arm/arch-cl7500/serial.h + * + * Copyright (c) 1996 Russell King. + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * Changelog: + * 15-10-1996 RMK Created + * 10-08-1999 PJB Added COM3/COM4 for CL7500 + */ +#ifndef __ASM_ARCH_SERIAL_H +#define __ASM_ARCH_SERIAL_H + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD (1843200 / 16) + +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) + + /* UART CLK PORT IRQ FLAGS */ +#define SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x804002e8, 41, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x804003e8, 40, STD_COM_FLAGS }, /* ttyS3 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + +#endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/shmparam.h linux/include/asm-arm/arch-cl7500/shmparam.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/shmparam.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/shmparam.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,8 @@ +/* + * linux/include/asm-arm/arch-cl7500/shmparam.h + * + * Copyright (c) 1999 Nexus Electronics Ltd + */ + +/* The processor-centric definitions are OK. */ + diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/system.h linux/include/asm-arm/arch-cl7500/system.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/system.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/system.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,27 @@ +/* + * linux/include/asm-arm/arch-cl7500/system.h + * + * Copyright (c) 1999 Nexus Electronics Ltd. + */ +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +#include + +#define arch_reset(mode) { \ + outb (0, IOMD_ROMCR0); \ + cli(); \ + __asm__ __volatile__("msr spsr, r1;" \ + "mcr p15, 0, %0, c1, c0, 0;" \ + "movs pc, #0" \ + : \ + : "r" (cpu_reset())); \ + } + +/* + * We can wait for an interrupt... + */ +#define proc_idle() \ + outb(0, IOMD_SUSMODE) + +#endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/time.h linux/include/asm-arm/arch-cl7500/time.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/time.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/time.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,123 @@ +/* + * linux/include/asm-arm/arch-cl7500/time.h + * + * Copyright (c) 1996 Russell King. + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * Changelog: + * 24-Sep-1996 RMK Created + * 10-Oct-1996 RMK Brought up to date with arch-sa110eval + * 04-Dec-1997 RMK Updated for new arch/arm/time.c + * 10-Aug-1999 PJB Converted for CL7500 + */ +#include + +static long last_rtc_update = 0; /* last time the cmos clock got updated */ + +extern __inline__ unsigned long gettimeoffset (void) +{ + unsigned long offset = 0; + unsigned int count1, count2, status1, status2; + + status1 = IOMD_IRQREQA; + barrier (); + outb(0, IOMD_T0LATCH); + barrier (); + count1 = inb(IOMD_T0CNTL) | (inb(IOMD_T0CNTH) << 8); + barrier (); + status2 = inb(IOMD_IRQREQA); + barrier (); + outb(0, IOMD_T0LATCH); + barrier (); + count2 = inb(IOMD_T0CNTL) | (inb(IOMD_T0CNTH) << 8); + + if (count2 < count1) { + /* + * This means that we haven't just had an interrupt + * while reading into status2. + */ + if (status2 & (1 << 5)) + offset = tick; + count1 = count2; + } else if (count2 > count1) { + /* + * We have just had another interrupt while reading + * status2. + */ + offset += tick; + count1 = count2; + } + + count1 = LATCH - count1; + /* + * count1 = number of clock ticks since last interrupt + */ + offset += count1 * tick / LATCH; + return offset; +} + +extern __inline__ unsigned long get_rtc_time(void) +{ + return mktime(1976, 06, 24, 0, 0, 0); +} + +static int set_rtc_time(unsigned long nowtime) +{ + return 0; +} + +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + do_timer(regs); + + /* If we have an externally synchronized linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 && + xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec >= 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_time(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } + + { + /* Twinkle the lights. */ + static int count, bit = 8, dir = 1; + if (count-- == 0) { + bit += dir; + if (bit == 8 || bit == 15) dir = -dir; + count = 5; + *((volatile unsigned int *)(0xe002ba00)) = 1 << bit; + } + } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); +} + +static struct irqaction timerirq = { + timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; + +/* + * Set up timer interrupt, and return the current time in seconds. + */ +extern __inline__ void setup_timer(void) +{ + outb(LATCH & 255, IOMD_T0LTCHL); + outb(LATCH >> 8, IOMD_T0LTCHH); + outb(0, IOMD_T0GO); + + xtime.tv_sec = get_rtc_time(); + + setup_arm_irq(IRQ_TIMER, &timerirq); +} diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/timex.h linux/include/asm-arm/arch-cl7500/timex.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/timex.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/timex.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,13 @@ +/* + * linux/include/asm-arm/arch-cl7500/timex.h + * + * CL7500 architecture timex specifications + * + * Copyright (C) 1999 Nexus Electronics Ltd + */ + +/* + * On the ARM7500, the clock ticks at 2MHz. + */ +#define CLOCK_TICK_RATE 2000000 + diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-cl7500/uncompress.h linux/include/asm-arm/arch-cl7500/uncompress.h --- v2.3.28/linux/include/asm-arm/arch-cl7500/uncompress.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-cl7500/uncompress.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,42 @@ +/* + * linux/include/asm-arm/arch-cl7500/uncompress.h + * + * Copyright (C) 1999 Nexus Electronics Ltd. + */ + +#define BASE 0x03010000 + +static __inline__ void putc(char c) +{ + while (!(*((volatile unsigned int *)(BASE + 0xbf4)) & 0x20)); + *((volatile unsigned int *)(BASE + 0xbe0)) = c; +} + +/* + * This does not append a newline + */ +static void puts(const char *s) +{ + while (*s) { + putc(*s); + if (*s == '\n') + putc('\r'); + s++; + } +} + +static __inline__ void arch_decomp_setup(void) +{ + int baud = 3686400 / (9600 * 16); + + *((volatile unsigned int *)(BASE + 0xBEC)) = 0x80; + *((volatile unsigned int *)(BASE + 0xBE0)) = baud & 0xff; + *((volatile unsigned int *)(BASE + 0xBE4)) = (baud & 0xff00) >> 8; + *((volatile unsigned int *)(BASE + 0xBEC)) = 3; /* 8 bits */ + *((volatile unsigned int *)(BASE + 0xBF0)) = 3; /* DTR, RTS */ +} + +/* + * nothing to do + */ +#define arch_decomp_wdog() diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-ebsa110/serial.h linux/include/asm-arm/arch-ebsa110/serial.h --- v2.3.28/linux/include/asm-arm/arch-ebsa110/serial.h Fri May 8 00:42:39 1998 +++ linux/include/asm-arm/arch-ebsa110/serial.h Tue Nov 23 22:23:11 1999 @@ -20,22 +20,14 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 2 + /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x3F8, 1, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 2, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0x2F8, 2, STD_COM_FLAGS } /* ttyS1 */ + +#define EXTRA_SERIAL_PORT_DEFNS #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-ebsa285/serial.h linux/include/asm-arm/arch-ebsa285/serial.h --- v2.3.28/linux/include/asm-arm/arch-ebsa285/serial.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-ebsa285/serial.h Tue Nov 23 22:23:11 1999 @@ -24,23 +24,15 @@ #define _SER_IRQ0 IRQ_ISA_UART #define _SER_IRQ1 IRQ_ISA_UART2 +#define RS_TABLE_SIZE 16 + #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x3F8, _SER_IRQ0, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, _SER_IRQ1, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0x2F8, _SER_IRQ1, STD_COM_FLAGS }, /* ttyS1 */ + +#define EXTRA_SERIAL_PORT_DEFNS #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-rpc/serial.h linux/include/asm-arm/arch-rpc/serial.h --- v2.3.28/linux/include/asm-arm/arch-rpc/serial.h Fri May 8 00:42:40 1998 +++ linux/include/asm-arm/arch-rpc/serial.h Tue Nov 23 22:23:11 1999 @@ -20,8 +20,10 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 16 + /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ @@ -35,6 +37,8 @@ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS } /* ttyS13 */ + +#define EXTRA_SERIAL_PORT_DEFNS #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/arch-sa1100/serial.h linux/include/asm-arm/arch-sa1100/serial.h --- v2.3.28/linux/include/asm-arm/arch-sa1100/serial.h Fri Oct 22 13:21:53 1999 +++ linux/include/asm-arm/arch-sa1100/serial.h Tue Nov 23 22:23:11 1999 @@ -20,11 +20,13 @@ /* Standard COM flags */ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 4 + #define STD_SERIAL_PORT_DEFNS \ /* UART CLK PORT IRQ FLAGS */ \ { 0, BASE_BAUD, 0x3F8, IRQ_GPIO3, STD_COM_FLAGS }, /* ttyS0 */ \ { 0, BASE_BAUD, 0x2F8, IRQ_GPIO3, STD_COM_FLAGS }, /* ttyS1 */ \ { 0, BASE_BAUD, 0x3E8, IRQ_GPIO3, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0x2E8, IRQ_GPIO3, STD_COM4_FLAGS }, /* ttyS3 */ + { 0, BASE_BAUD, 0x2E8, IRQ_GPIO3, STD_COM4_FLAGS } /* ttyS3 */ diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/div64.h linux/include/asm-arm/div64.h --- v2.3.28/linux/include/asm-arm/div64.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/div64.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,33 @@ +#ifndef __ASM_ARM_DIV64 +#define __ASM_ARM_DIV64 + +/* + * unsigned long long division. Yuck Yuck! What is Linux coming to? + * This is 100% disgusting + */ +#define do_div(n,base) \ +({ \ + unsigned long __low, __low2, __high, __rem; \ + __low = (n) & 0xffffffff; \ + __high = (n) >> 32; \ + if (__high) { \ + __rem = __high % (unsigned long)base; \ + __high = __high / (unsigned long)base; \ + __low2 = __low >> 16; \ + __low2 += __rem << 16; \ + __rem = __low2 % (unsigned long)base; \ + __low2 = __low2 / (unsigned long)base; \ + __low = __low & 0xffff; \ + __low += __rem << 16; \ + __rem = __low % (unsigned long)base; \ + __low = __low / (unsigned long)base; \ + n = __low + (__low2 << 16) + (__high << 32); \ + } else { \ + __rem = __low % (unsigned long)base; \ + n = (__low / (unsigned long)base); \ + } \ + __rem; \ +}) + +#endif + diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/fcntl.h linux/include/asm-arm/fcntl.h --- v2.3.28/linux/include/asm-arm/fcntl.h Wed Oct 21 13:30:46 1998 +++ linux/include/asm-arm/fcntl.h Tue Nov 23 22:23:11 1999 @@ -3,21 +3,23 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 #define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ #define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ +#define O_LARGEFILE 0400000 #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/page.h linux/include/asm-arm/page.h --- v2.3.28/linux/include/asm-arm/page.h Mon Nov 1 13:56:27 1999 +++ linux/include/asm-arm/page.h Tue Nov 23 22:23:11 1999 @@ -69,9 +69,9 @@ #include -#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) -#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) +#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) +#define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT) #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/pgalloc.h linux/include/asm-arm/pgalloc.h --- v2.3.28/linux/include/asm-arm/pgalloc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/pgalloc.h Tue Nov 23 22:23:11 1999 @@ -0,0 +1,205 @@ +/* + * linux/include/asm-arm/pgalloc.h + */ +#ifndef _ASMARM_PGALLOC_H +#define _ASMARM_PGALLOC_H + +#include +#include + +#include + +/* + * Get the cache handling stuff now. + */ +#include + +/* + * Page table cache stuff + */ +#ifndef CONFIG_NO_PGT_CACHE + +#ifdef __SMP__ +#error Pgtable caches have to be per-CPU, so that no locking is needed. +#endif /* __SMP__ */ + +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; + +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +/* used for quicklists */ +#define __pgd_next(pgd) (((unsigned long *)pgd)[1]) +#define __pte_next(pte) (((unsigned long *)pte)[0]) + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if ((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)__pgd_next(ret); + ret[1] = ret[2]; + clean_cache_area(ret + 1, 4); + pgtable_cache_size--; + } + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + __pgd_next(pgd) = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +/* We don't use pmd cache, so this is a dummy routine */ +#define get_pmd_fast() ((pmd_t *)0) + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)__pte_next(ret); + ret[0] = ret[1]; + clean_cache_area(ret, 4); + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + __pte_next(pte) = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +#else /* CONFIG_NO_PGT_CACHE */ + +#define pgd_quicklist ((unsigned long *)0) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist ((unsigned long *)0) + +#define get_pgd_fast() ((pgd_t *)0) +#define get_pmd_fast() ((pmd_t *)0) +#define get_pte_fast() ((pte_t *)0) + +#define free_pgd_fast(pgd) free_pgd_slow(pgd) +#define free_pmd_fast(pmd) free_pmd_slow(pmd) +#define free_pte_fast(pte) free_pte_slow(pte) + +#endif /* CONFIG_NO_PGT_CACHE */ + +extern pgd_t *get_pgd_slow(void); +extern void free_pgd_slow(pgd_t *pgd); + +#define free_pmd_slow(pmd) do { } while (0) + +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long addr_preadjusted); +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long addr_preadjusted); +extern void free_pte_slow(pte_t *pte); + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) + +#ifndef pte_alloc_kernel +extern __inline__ pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_kernel_slow(pmd, address); + set_pmd(pmd, mk_kernel_pmd(page)); + return page + address; + } + if (pmd_bad(*pmd)) { + __handle_bad_pmd_kernel(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} +#endif + +extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + set_pmd(pmd, mk_user_pmd(page)); + return page + address; + } + if (pmd_bad(*pmd)) { + __handle_bad_pmd(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +#define pmd_free_kernel pmd_free +#define pmd_free(pmd) do { } while (0) + +#define pmd_alloc_kernel pmd_alloc +extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +#define pgd_free(pgd) free_pgd_fast(pgd) + +extern __inline__ pgd_t *pgd_alloc(void) +{ + pgd_t *pgd; + + pgd = get_pgd_fast(); + if (!pgd) + pgd = get_pgd_slow(); + + return pgd; +} + +extern int do_check_pgt_cache(int, int); + +extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); + +#ifndef CONFIG_NO_PGT_CACHE + { + pgd_t *pgd; + for (pgd = (pgd_t *)pgd_quicklist; pgd; + pgd = (pgd_t *)__pgd_next(pgd)) + pgd[address >> PGDIR_SHIFT] = entry; + } +#endif +} + +#endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/pgtable.h linux/include/asm-arm/pgtable.h --- v2.3.28/linux/include/asm-arm/pgtable.h Mon Nov 1 13:56:27 1999 +++ linux/include/asm-arm/pgtable.h Tue Nov 23 22:23:11 1999 @@ -86,21 +86,12 @@ /* * Permanent address of a page. */ -#define page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) #define pte_page(x) (mem_map + pte_pagenr(x)) /* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -#define pgd_none(pgd) (0) -#define pgd_bad(pgd) (0) -#define pgd_present(pgd) (1) -#define pgd_clear(pgdp) - -/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ @@ -111,12 +102,24 @@ return pte; } -extern __inline__ pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t pte; - pte_val(pte) = (PHYS_OFFSET + ((page - mem_map) << PAGE_SHIFT)) | pgprot_val(pgprot); - return pte; -} +#define mk_pte(page,pgprot) \ +({ \ + pte_t __pte; \ + pte_val(__pte) = PHYS_OFFSET + \ + (((page) - mem_map) << PAGE_SHIFT) + \ + pgprot_val(pgprot); \ + __pte; \ +}) + +/* + * The "pgd_xxx()" functions here are trivial for a folded two-level + * setup: the pgd is never bad, and a pmd always exists (as it's folded + * into the pgd entry) + */ +#define pgd_none(pgd) (0) +#define pgd_bad(pgd) (0) +#define pgd_present(pgd) (1) +#define pgd_clear(pgdp) #define page_pte_prot(page,prot) mk_pte(page, prot) #define page_pte(page) mk_pte(page, __pgprot(0)) @@ -136,107 +139,6 @@ #define __pte_offset(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) #define pte_offset(dir, addr) ((pte_t *)pmd_page(*(dir)) + __pte_offset(addr)) -/* - * Get the cache handling stuff now. - */ -#include - -/* - * Page table cache stuff - */ -#ifndef CONFIG_NO_PGT_CACHE - -#ifdef __SMP__ -#error Pgtable caches have to be per-CPU, so that no locking is needed. -#endif /* __SMP__ */ - -extern struct pgtable_cache_struct { - unsigned long *pgd_cache; - unsigned long *pte_cache; - unsigned long pgtable_cache_sz; -} quicklists; - -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) - -/* used for quicklists */ -#define __pgd_next(pgd) (((unsigned long *)pgd)[1]) -#define __pte_next(pte) (((unsigned long *)pte)[0]) - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if ((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)__pgd_next(ret); - ret[1] = ret[2]; - clean_cache_area(ret + 1, 4); - pgtable_cache_size--; - } - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - __pgd_next(pgd) = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -/* We don't use pmd cache, so this is a dummy routine */ -#define get_pmd_fast() ((pmd_t *)0) - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ -} - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)__pte_next(ret); - ret[0] = ret[1]; - clean_cache_area(ret, 4); - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - __pte_next(pte) = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -#else /* CONFIG_NO_PGT_CACHE */ - -#define pgd_quicklist ((unsigned long *)0) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist ((unsigned long *)0) - -#define get_pgd_fast() ((pgd_t *)0) -#define get_pmd_fast() ((pmd_t *)0) -#define get_pte_fast() ((pte_t *)0) - -#define free_pgd_fast(pgd) free_pgd_slow(pgd) -#define free_pmd_fast(pmd) free_pmd_slow(pmd) -#define free_pte_fast(pte) free_pte_slow(pte) - -#endif /* CONFIG_NO_PGT_CACHE */ - -extern pgd_t *get_pgd_slow(void); -extern void free_pgd_slow(pgd_t *pgd); - -#define free_pmd_slow(pmd) do { } while (0) - -extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long addr_preadjusted); -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long addr_preadjusted); -extern void free_pte_slow(pte_t *pte); - #include extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) @@ -245,131 +147,25 @@ return pte; } -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) - -#ifndef pte_alloc_kernel -extern __inline__ pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_kernel_slow(pmd, address); - set_pmd(pmd, mk_kernel_pmd(page)); - return page + address; - } - if (pmd_bad(*pmd)) { - __handle_bad_pmd_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} -#endif - -extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - set_pmd(pmd, mk_user_pmd(page)); - return page + address; - } - if (pmd_bad(*pmd)) { - __handle_bad_pmd(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -#define pmd_free_kernel pmd_free -#define pmd_free(pmd) do { } while (0) - -#define pmd_alloc_kernel pmd_alloc -extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -#define pgd_free(pgd) free_pgd_fast(pgd) - -extern __inline__ pgd_t *pgd_alloc(void) -{ - pgd_t *pgd; - - pgd = get_pgd_fast(); - if (!pgd) - pgd = get_pgd_slow(); - - return pgd; -} - -extern int do_check_pgt_cache(int, int); - -extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); - -#ifndef CONFIG_NO_PGT_CACHE - { - pgd_t *pgd; - for (pgd = (pgd_t *)pgd_quicklist; pgd; - pgd = (pgd_t *)__pgd_next(pgd)) - pgd[address >> PGDIR_SHIFT] = entry; - } -#endif -} - extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; -#define update_mmu_cache(vma,address,pte) +#define update_mmu_cache(vma,address,pte) do { } while (0) -/* +/* Encode and decode a swap entry. + * * We support up to 32GB of swap on 4k machines */ -#define SWP_TYPE(entry) (((pte_val(entry)) >> 2) & 0x7f) -#define SWP_OFFSET(entry) ((pte_val(entry)) >> 9) -#define SWP_ENTRY(type,offset) __pte((((type) << 2) | ((offset) << 9))) +#define SWP_TYPE(x) (((x).val >> 2) & 0x7f) +#define SWP_OFFSET(x) ((x).val >> 9) +#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 9) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(swp) ((pte_t) { (swp).val }) #define module_map vmalloc #define module_unmap vfree -/* - * We rely on GCC optimising this code away for - * architectures which it doesn't apply to. Note - * that `addr' is checked against PAGE_OFFSET and - * end_mem by the calling code. - */ -#define __kern_valid_idx(a) (((a) - PAGE_OFFSET) >> 20) - -extern __inline__ int __kern_valid_addr(unsigned long addr) -{ - extern unsigned long *valid_addr_bitmap; - unsigned int idx = __kern_valid_idx(addr); - - return test_bit(idx, valid_addr_bitmap); -} - /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (machine_is_riscpc() && test_bit(PG_skip, &(page)->flags)) -#define kern_addr_valid(addr) (!machine_is_riscpc() || __kern_valid_addr(addr)) #define io_remap_page_range remap_page_range diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/proc-armo/processor.h linux/include/asm-arm/proc-armo/processor.h --- v2.3.28/linux/include/asm-arm/proc-armo/processor.h Fri Oct 22 13:21:53 1999 +++ linux/include/asm-arm/proc-armo/processor.h Tue Nov 23 22:23:11 1999 @@ -67,14 +67,15 @@ regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ }) +#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) +#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020]) + /* Allocation and freeing of basic task resources. */ /* * NOTE! The task struct and the stack go together */ extern unsigned long get_page_8k(int priority); extern void free_page_8k(unsigned long page); - -#define THREAD_SIZE (8192) #define ll_alloc_task_struct() ((struct task_struct *)get_page_8k(GFP_KERNEL)) #define ll_free_task_struct(p) free_page_8k((unsigned long)(p)) diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/proc-armv/cache.h linux/include/asm-arm/proc-armv/cache.h --- v2.3.28/linux/include/asm-arm/proc-armv/cache.h Mon Nov 1 13:56:27 1999 +++ linux/include/asm-arm/proc-armv/cache.h Tue Nov 23 22:23:11 1999 @@ -56,8 +56,7 @@ */ static __inline__ void flush_page_to_ram(struct page *page) { - unsigned long virt = page_address(page); - cpu_flush_ram_page(virt); + cpu_flush_ram_page(page_address(page)); } /* diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/proc-armv/processor.h linux/include/asm-arm/proc-armv/processor.h --- v2.3.28/linux/include/asm-arm/proc-armv/processor.h Fri Oct 22 13:21:53 1999 +++ linux/include/asm-arm/proc-armv/processor.h Tue Nov 23 22:23:11 1999 @@ -57,11 +57,13 @@ regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ }) +#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1021]) +#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019]) + /* Allocation and freeing of basic task resources. */ /* * NOTE! The task struct and the stack go together */ -#define THREAD_SIZE (PAGE_SIZE * 2) #define ll_alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) #define ll_free_task_struct(p) free_pages((unsigned long)(p),1) diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/processor.h linux/include/asm-arm/processor.h --- v2.3.28/linux/include/asm-arm/processor.h Thu Nov 18 20:25:38 1999 +++ linux/include/asm-arm/processor.h Tue Nov 23 22:23:11 1999 @@ -35,6 +35,7 @@ #define NR_DEBUGS 5 +#include #include #include #include @@ -49,6 +50,7 @@ }; struct thread_struct { + atomic_t refcount; /* fault info */ unsigned long address; unsigned long trap_no; @@ -66,6 +68,7 @@ { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_THREAD { \ + ATOMIC_INIT(1), \ 0, \ 0, \ 0, \ @@ -110,16 +113,17 @@ unsigned long get_wchan(struct task_struct *p); -#ifdef CONFIG_CPU_26 -# define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) -# define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020]) -#else -# define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1021]) -# define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019]) -#endif +#define THREAD_SIZE (8192) extern struct task_struct *alloc_task_struct(void); -extern void free_task_struct(struct task_struct *); +extern void __free_task_struct(struct task_struct *); +#define get_task_struct(p) atomic_inc(&(p)->thread.refcount) +#define put_task_struct(p) free_task_struct(p) +#define free_task_struct(p) \ + do { \ + if (atomic_dec_and_test(&(p)->thread.refcount)) \ + __free_task_struct((p)); \ + } while (0) #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/serial.h linux/include/asm-arm/serial.h --- v2.3.28/linux/include/asm-arm/serial.h Tue Jan 20 16:39:43 1998 +++ linux/include/asm-arm/serial.h Tue Nov 23 22:23:11 1999 @@ -12,4 +12,8 @@ #include +#define SERIAL_PORT_DFNS \ + STD_SERIAL_PORT_DEFNS \ + EXTRA_SERIAL_PORT_DEFNS + #endif diff -u --recursive --new-file v2.3.28/linux/include/asm-arm/signal.h linux/include/asm-arm/signal.h --- v2.3.28/linux/include/asm-arm/signal.h Thu Jan 7 15:51:33 1999 +++ linux/include/asm-arm/signal.h Thu Nov 18 19:37:03 1999 @@ -63,6 +63,7 @@ #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/e820.h linux/include/asm-i386/e820.h --- v2.3.28/linux/include/asm-i386/e820.h Mon Oct 4 15:49:30 1999 +++ linux/include/asm-i386/e820.h Thu Nov 18 19:25:28 1999 @@ -18,7 +18,8 @@ #define E820_RAM 1 #define E820_RESERVED 2 -#define E820_ACPI 3 +#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ +#define E820_NVS 4 #define HIGH_MEMORY (1024*1024) diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/highmem.h linux/include/asm-i386/highmem.h --- v2.3.28/linux/include/asm-i386/highmem.h Thu Nov 11 20:11:51 1999 +++ linux/include/asm-i386/highmem.h Tue Nov 23 12:55:49 1999 @@ -37,7 +37,20 @@ extern void kmap_init(void) __init; +/* + * Right now we initialize only a single pte table. It can be extended + * easily, subsequent pte tables have to be allocated in one physical + * chunk of RAM. + */ #define PKMAP_BASE (0xff000000UL) +#ifdef CONFIG_X86_PAE +#define LAST_PKMAP 512 +#else +#define LAST_PKMAP 1024 +#endif +#define LAST_PKMAP_MASK (LAST_PKMAP-1) +#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) +#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) extern unsigned long FASTCALL(kmap_high(struct page *page)); extern void FASTCALL(kunmap_high(struct page *page)); diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/io.h linux/include/asm-i386/io.h --- v2.3.28/linux/include/asm-i386/io.h Thu Nov 11 20:11:51 1999 +++ linux/include/asm-i386/io.h Tue Nov 23 12:55:56 1999 @@ -103,7 +103,6 @@ #ifdef __KERNEL__ -#include #include /* @@ -227,6 +226,25 @@ out: return retval; } + +static inline int isa_check_signature(unsigned long io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; + do { + if (isa_readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: + return retval; +} + + + /* Nothing to do */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/pgalloc-2level.h linux/include/asm-i386/pgalloc-2level.h --- v2.3.28/linux/include/asm-i386/pgalloc-2level.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-i386/pgalloc-2level.h Sat Nov 20 10:09:05 1999 @@ -0,0 +1,23 @@ +#ifndef _I386_PGALLOC_2LEVEL_H +#define _I386_PGALLOC_2LEVEL_H + +/* + * traditional i386 two-level paging, page table allocation routines: + */ + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) { } +extern __inline__ void free_pmd_slow(pmd_t *pmd) { } + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + if (!pgd) + BUG(); + return (pmd_t *) pgd; +} + +#endif /* _I386_PGALLOC_2LEVEL_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/pgalloc-3level.h linux/include/asm-i386/pgalloc-3level.h --- v2.3.28/linux/include/asm-i386/pgalloc-3level.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-i386/pgalloc-3level.h Sat Nov 20 10:09:05 1999 @@ -0,0 +1,68 @@ +#ifndef _I386_PGALLOC_3LEVEL_H +#define _I386_PGALLOC_3LEVEL_H + +/* + * Intel Physical Address Extension (PAE) Mode - three-level page + * tables on PPro+ CPUs. Page-table allocation routines. + * + * Copyright (C) 1999 Ingo Molnar + */ + +extern __inline__ pmd_t *get_pmd_slow(void) +{ + pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL); + + if (ret) + memset(ret, 0, PAGE_SIZE); + return ret; +} + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + unsigned long *ret; + + if ((ret = pmd_quicklist) != NULL) { + pmd_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pmd_slow(); + return (pmd_t *)ret; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ + *(unsigned long *)pmd = (unsigned long) pmd_quicklist; + pmd_quicklist = (unsigned long *) pmd; + pgtable_cache_size++; +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ + free_page((unsigned long)pmd); +} + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + if (!pgd) + BUG(); + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + if (pgd_none(*pgd)) { + pmd_t *page = get_pmd_fast(); + + if (!page) + page = get_pmd_slow(); + if (page) { + if (pgd_none(*pgd)) { + pgd_val(*pgd) = 1 + __pa(page); + __flush_tlb(); + return page + address; + } else + free_pmd_fast(page); + } else + return NULL; + } + return (pmd_t *)pgd_page(*pgd) + address; +} + +#endif /* _I386_PGALLOC_3LEVEL_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/pgalloc.h linux/include/asm-i386/pgalloc.h --- v2.3.28/linux/include/asm-i386/pgalloc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-i386/pgalloc.h Tue Nov 23 12:55:46 1999 @@ -0,0 +1,247 @@ +#ifndef _I386_PGALLOC_H +#define _I386_PGALLOC_H + +#include +#include +#include +#include + +#define pgd_quicklist (current_cpu_data.pgd_quick) +#define pmd_quicklist (current_cpu_data.pmd_quick) +#define pte_quicklist (current_cpu_data.pte_quick) +#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) + +#if CONFIG_X86_PAE +# include +#else +# include +#endif + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); + + if (ret) { +#if CONFIG_X86_PAE + int i; + for (i = 0; i < USER_PTRS_PER_PGD; i++) + __pgd_clear(ret + i); +#else + memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); +#endif + memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if ((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +#define pte_free_kernel(pte) free_pte_slow(pte) +#define pte_free(pte) free_pte_slow(pte) +#define pgd_free(pgd) free_pgd_slow(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) +{ + if (!pmd) + BUG(); + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t * page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_kernel_slow(pmd, address); + pmd_val(*pmd) = _KERNPG_TABLE + __pa(page); + return page + address; + } + if (pmd_bad(*pmd)) { + __handle_bad_pmd_kernel(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) + goto getnew; + if (pmd_bad(*pmd)) + goto fix; + return (pte_t *)pmd_page(*pmd) + address; +getnew: +{ + unsigned long page = (unsigned long) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_val(*pmd) = _PAGE_TABLE + __pa(page); + return (pte_t *)page + address; +} +fix: + __handle_bad_pmd(pmd); + return NULL; +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + * (In the PAE case we free the page.) + */ +#define pmd_free(pmd) free_pmd_slow(pmd) + +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; +#ifdef __SMP__ + int i; +#endif + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); +#ifndef __SMP__ + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#else + /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can + modify pgd caches of other CPUs as well. -jj */ + for (i = 0; i < NR_CPUS; i++) + for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#endif +} + +/* + * TLB flushing: + * + * - flush_tlb() flushes the current mm struct TLBs + * - flush_tlb_all() flushes all processes TLBs + * - flush_tlb_mm(mm) flushes the specified mm context TLB's + * - flush_tlb_page(vma, vmaddr) flushes one page + * - flush_tlb_range(mm, start, end) flushes a range of pages + * + * ..but the i386 has somewhat limited tlb flushing capabilities, + * and page-granular flushes are available only on i486 and up. + */ + +#ifndef __SMP__ + +#define flush_tlb() __flush_tlb() +#define flush_tlb_all() __flush_tlb() +#define local_flush_tlb() __flush_tlb() + +static inline void flush_tlb_mm(struct mm_struct *mm) +{ + if (mm == current->active_mm) + __flush_tlb(); +} + +static inline void flush_tlb_page(struct vm_area_struct *vma, + unsigned long addr) +{ + if (vma->vm_mm == current->active_mm) + __flush_tlb_one(addr); +} + +static inline void flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + if (mm == current->active_mm) + __flush_tlb(); +} + +#else + +/* + * We aren't very clever about this yet - SMP could certainly + * avoid some global flushes.. + */ + +#include + +#define local_flush_tlb() \ + __flush_tlb() + +extern void flush_tlb_all(void); +extern void flush_tlb_current_task(void); +extern void flush_tlb_mm(struct mm_struct *); +extern void flush_tlb_page(struct vm_area_struct *, unsigned long); + +#define flush_tlb() flush_tlb_current_task() + +static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, unsigned long end) +{ + flush_tlb_mm(mm); +} + +#endif + +#endif /* _I386_PGALLOC_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/pgtable-2level.h linux/include/asm-i386/pgtable-2level.h --- v2.3.28/linux/include/asm-i386/pgtable-2level.h Mon Nov 1 13:56:27 1999 +++ linux/include/asm-i386/pgtable-2level.h Sat Nov 20 10:09:05 1999 @@ -42,19 +42,4 @@ return (pmd_t *) dir; } -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) { } -extern __inline__ void free_pmd_slow(pmd_t *pmd) { } - -extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) -{ - if (!pgd) - BUG(); - return (pmd_t *) pgd; -} - #endif /* _I386_PGTABLE_2LEVEL_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/pgtable-3level.h linux/include/asm-i386/pgtable-3level.h --- v2.3.28/linux/include/asm-i386/pgtable-3level.h Mon Nov 1 13:56:27 1999 +++ linux/include/asm-i386/pgtable-3level.h Sat Nov 20 10:09:05 1999 @@ -27,11 +27,11 @@ #define PTRS_PER_PTE 512 #define pte_ERROR(e) \ - printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e)) + printk("%s:%d: bad pte %p(%016Lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) #define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %016Lx.\n", __FILE__, __LINE__, pmd_val(e)) + printk("%s:%d: bad pmd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pmd_val(e)) #define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %016Lx.\n", __FILE__, __LINE__, pgd_val(e)) + printk("%s:%d: bad pgd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) /* * Subtle, in PAE mode we cannot have zeroes in the top level @@ -63,62 +63,5 @@ /* Find an entry in the second-level page table.. */ #define pmd_offset(dir, address) ((pmd_t *) pgd_page(*(dir)) + \ __pmd_offset(address)) - -extern __inline__ pmd_t *get_pmd_slow(void) -{ - pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL); - - if (ret) - memset(ret, 0, PAGE_SIZE); - return ret; -} - -extern __inline__ pmd_t *get_pmd_fast(void) -{ - unsigned long *ret; - - if ((ret = pmd_quicklist) != NULL) { - pmd_quicklist = (unsigned long *)(*ret); - ret[0] = 0; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pmd_slow(); - return (pmd_t *)ret; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long) pmd_quicklist; - pmd_quicklist = (unsigned long *) pmd; - pgtable_cache_size++; -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ - free_page((unsigned long)pmd); -} - -extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) -{ - if (!pgd) - BUG(); - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_pmd_fast(); - - if (!page) - page = get_pmd_slow(); - if (page) { - if (pgd_none(*pgd)) { - pgd_val(*pgd) = 1 + __pa(page); - __flush_tlb(); - return page + address; - } else - free_pmd_fast(page); - } else - return NULL; - } - return (pmd_t *)pgd_page(*pgd) + address; -} #endif /* _I386_PGTABLE_3LEVEL_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/pgtable.h linux/include/asm-i386/pgtable.h --- v2.3.28/linux/include/asm-i386/pgtable.h Sun Nov 7 16:37:34 1999 +++ linux/include/asm-i386/pgtable.h Tue Nov 23 12:55:45 1999 @@ -27,19 +27,6 @@ #define flush_page_to_ram(page) do { } while (0) #define flush_icache_range(start, end) do { } while (0) -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - * - * ..but the i386 has somewhat limited tlb flushing capabilities, - * and page-granular flushes are available only on i486 and up. - */ - #define __flush_tlb() \ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0) @@ -49,65 +36,9 @@ #define __flush_tlb_one(addr) \ __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) #endif - -#ifndef __SMP__ - -#define flush_tlb() __flush_tlb() -#define flush_tlb_all() __flush_tlb() -#define local_flush_tlb() __flush_tlb() - -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - if (mm == current->active_mm) - __flush_tlb(); -} - -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - if (vma->vm_mm == current->active_mm) - __flush_tlb_one(addr); -} - -static inline void flush_tlb_range(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - if (mm == current->active_mm) - __flush_tlb(); -} - -#else - -/* - * We aren't very clever about this yet - SMP could certainly - * avoid some global flushes.. - */ - -#include - -#define local_flush_tlb() \ - __flush_tlb() - -extern void flush_tlb_all(void); -extern void flush_tlb_current_task(void); -extern void flush_tlb_mm(struct mm_struct *); -extern void flush_tlb_page(struct vm_area_struct *, unsigned long); -#define flush_tlb() flush_tlb_current_task() - -static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, unsigned long end) -{ - flush_tlb_mm(mm); -} - -#endif #endif /* !__ASSEMBLY__ */ -#define pgd_quicklist (current_cpu_data.pgd_quick) -#define pmd_quicklist (current_cpu_data.pmd_quick) -#define pte_quicklist (current_cpu_data.pte_quick) -#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) - /* * The Linux x86 paging architecture is 'compile-time dual-mode', it * implements both the traditional 2-level x86 page tables and the @@ -247,7 +178,8 @@ * Permanent address of a page. Obviously must never be * called on a highmem page. */ -#define page_address(page) ({ if (PageHighMem(page)) BUG(); PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT); }) +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define __page_address(page) ({ if (PageHighMem(page)) BUG(); PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT); }) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) (mem_map+pte_pagenr(x)) @@ -277,14 +209,14 @@ * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t __pte; - - pte_val(__pte) = (page-mem_map)*(unsigned long long)PAGE_SIZE + - pgprot_val(pgprot); - return __pte; -} +#define mk_pte(page,pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = ((page)-mem_map)*(unsigned long long)PAGE_SIZE + \ + pgprot_val(pgprot); \ + __pte; \ +}) /* This takes a physical page address that is used by the remapping functions */ #define mk_pte_phys(physpage, pgprot) \ @@ -317,182 +249,10 @@ __pte_offset(address)) /* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ - -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); - - if (ret) { -#if 0 - /* - * On PAE allocating a whole page is overkill - we will - * either embedd this in mm_struct, or do a SLAB cache. - */ - memcpy(ret, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); -#endif -#if CONFIG_X86_PAE - int i; - for (i = 0; i < USER_PTRS_PER_PGD; i++) - __pgd_clear(ret + i); -#else - memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); -#endif - memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if ((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = 0; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); -extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -#define pte_free_kernel(pte) free_pte_slow(pte) -#define pte_free(pte) free_pte_slow(pte) -#define pgd_free(pgd) free_pgd_slow(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) -{ - if (!pmd) - BUG(); - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t * page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_kernel_slow(pmd, address); - pmd_val(*pmd) = _KERNPG_TABLE + __pa(page); - return page + address; - } - if (pmd_bad(*pmd)) { - __handle_bad_pmd_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - - if (pmd_none(*pmd)) - goto getnew; - if (pmd_bad(*pmd)) - goto fix; - return (pte_t *)pmd_page(*pmd) + address; -getnew: -{ - unsigned long page = (unsigned long) get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_val(*pmd) = _PAGE_TABLE + __pa(page); - return (pte_t *)page + address; -} -fix: - __handle_bad_pmd(pmd); - return NULL; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - * (In the PAE case we free the page.) - */ -#define pmd_free(pmd) free_pmd_slow(pmd) - -#define pmd_free_kernel pmd_free -#define pmd_alloc_kernel pmd_alloc - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; -#ifdef __SMP__ - int i; -#endif - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); -#ifndef __SMP__ - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#else - /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can - modify pgd caches of other CPUs as well. -jj */ - for (i = 0; i < NR_CPUS; i++) - for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#endif -} - -/* * The i386 doesn't have any external MMU info: the kernel page * tables contain all the necessary information. */ -extern inline void update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte) -{ -} +#define update_mmu_cache(vma,address,pte) do { } while (0) /* Encode and de-code a swap entry */ #define SWP_TYPE(x) (((x).val >> 1) & 0x3f) diff -u --recursive --new-file v2.3.28/linux/include/asm-i386/signal.h linux/include/asm-i386/signal.h --- v2.3.28/linux/include/asm-i386/signal.h Wed Jul 28 12:55:50 1999 +++ linux/include/asm-i386/signal.h Thu Nov 18 19:37:03 1999 @@ -63,6 +63,7 @@ #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff -u --recursive --new-file v2.3.28/linux/include/asm-m68k/signal.h linux/include/asm-m68k/signal.h --- v2.3.28/linux/include/asm-m68k/signal.h Thu Jul 30 11:08:20 1998 +++ linux/include/asm-m68k/signal.h Thu Nov 18 19:37:03 1999 @@ -63,6 +63,7 @@ #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff -u --recursive --new-file v2.3.28/linux/include/asm-ppc/pgalloc.h linux/include/asm-ppc/pgalloc.h --- v2.3.28/linux/include/asm-ppc/pgalloc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-ppc/pgalloc.h Mon Nov 22 15:35:37 1999 @@ -0,0 +1,151 @@ +#ifndef _PPC_PGALLOC_H +#define _PPC_PGALLOC_H + + + +/* We don't use pmd cache, so this is a dummy routine */ +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + */ +extern inline void pmd_free(pmd_t * pmd) +{ +} + +extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc +#define pte_alloc_kernel pte_alloc + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret, *init; + /*if ( (ret = (pgd_t *)get_zero_page_fast()) == NULL )*/ + if ( (ret = (pgd_t *)__get_free_page(GFP_KERNEL)) != NULL ) + memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); + if (ret) { + init = pgd_offset(&init_mm, 0); + memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t * page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_val(*pmd) = (unsigned long) page; + return page + address; + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern int do_check_pgt_cache(int, int); + +extern __inline__ pte_t *find_pte(struct mm_struct *mm,unsigned long va) +{ + pgd_t *dir; + pmd_t *pmd; + pte_t *pte; + + va &= PAGE_MASK; + + dir = pgd_offset( mm, va ); + if (dir) + { + pmd = pmd_offset(dir, va & PAGE_MASK); + if (pmd && pmd_present(*pmd)) + { + pte = pte_offset(pmd, va); + if (pte && pte_present(*pte)) + { + pte_uncache(*pte); + flush_tlb_page(find_vma(mm,va),va); + } + } + } + return pte; +} + +#endif /* _PPC_PGALLOC_H */ diff -u --recursive --new-file v2.3.28/linux/include/asm-ppc/pgtable.h linux/include/asm-ppc/pgtable.h --- v2.3.28/linux/include/asm-ppc/pgtable.h Sun Nov 7 16:37:34 1999 +++ linux/include/asm-ppc/pgtable.h Mon Nov 22 15:35:37 1999 @@ -4,13 +4,16 @@ #define _PPC_PGTABLE_H #ifndef __ASSEMBLY__ -#include #include +#include +#include #include /* For TASK_SIZE */ #include #include #ifndef CONFIG_8xx +struct mm_struct; +struct vm_area_struct; extern void local_flush_tlb_all(void); extern void local_flush_tlb_mm(struct mm_struct *mm); extern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); @@ -274,6 +277,7 @@ * Permanent address of a page. */ #define page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define __page_address(page) ({ if (PageHighMem(page)) BUG(); PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT); }) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) (mem_map+pte_pagenr(x)) @@ -354,12 +358,12 @@ return pte; } -extern inline pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t pte; - pte_val(pte) = ((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot); - return pte; -} +#define mk_pte(page,pgprot) \ +({ \ + pte_t pte; \ + pte_val(pte) = ((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot); \ + pte; \ +}) extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { @@ -437,129 +441,8 @@ /* return a pre-zero'd page from the list, return NULL if none available -- Cort */ extern unsigned long get_zero_page_fast(void); -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret, *init; - /*if ( (ret = (pgd_t *)get_zero_page_fast()) == NULL )*/ - if ( (ret = (pgd_t *)__get_free_page(GFP_KERNEL)) != NULL ) - memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); - if (ret) { - init = pgd_offset(&init_mm, 0); - memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -/* We don't use pmd cache, so this is a dummy routine */ -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ -} - extern void __bad_pte(pmd_t *pmd); -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) -#define pgd_free(pgd) free_pgd_fast(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t * page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_val(*pmd) = (unsigned long) page; - return page + address; - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern inline void pmd_free(pmd_t * pmd) -{ -} - -extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -#define pmd_free_kernel pmd_free -#define pmd_alloc_kernel pmd_alloc -#define pte_alloc_kernel pte_alloc - -extern int do_check_pgt_cache(int, int); - extern inline void set_pgdir(unsigned long address, pgd_t entry) { struct task_struct * p; @@ -588,31 +471,6 @@ } extern pgd_t swapper_pg_dir[1024]; - -extern __inline__ pte_t *find_pte(struct mm_struct *mm,unsigned long va) -{ - pgd_t *dir; - pmd_t *pmd; - pte_t *pte; - - va &= PAGE_MASK; - - dir = pgd_offset( mm, va ); - if (dir) - { - pmd = pmd_offset(dir, va & PAGE_MASK); - if (pmd && pmd_present(*pmd)) - { - pte = pte_offset(pmd, va); - if (pte && pte_present(*pte)) - { - pte_uncache(*pte); - flush_tlb_page(find_vma(mm,va),va); - } - } - } - return pte; -} /* * Page tables may have changed. We don't need to do anything here diff -u --recursive --new-file v2.3.28/linux/include/asm-ppc/signal.h linux/include/asm-ppc/signal.h --- v2.3.28/linux/include/asm-ppc/signal.h Tue Aug 4 16:06:36 1998 +++ linux/include/asm-ppc/signal.h Thu Nov 18 19:37:03 1999 @@ -54,6 +54,7 @@ #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff -u --recursive --new-file v2.3.28/linux/include/asm-sh/signal.h linux/include/asm-sh/signal.h --- v2.3.28/linux/include/asm-sh/signal.h Fri Oct 22 13:21:54 1999 +++ linux/include/asm-sh/signal.h Thu Nov 18 19:37:03 1999 @@ -51,6 +51,7 @@ #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff -u --recursive --new-file v2.3.28/linux/include/linux/acpi.h linux/include/linux/acpi.h --- v2.3.28/linux/include/linux/acpi.h Thu Nov 18 20:25:38 1999 +++ linux/include/linux/acpi.h Tue Nov 23 12:55:51 1999 @@ -84,6 +84,21 @@ typedef int acpi_dstate_t; +/* + * System sleep states + */ +enum +{ + ACPI_S0, /* working */ + ACPI_S1, /* sleep */ + ACPI_S2, /* sleep */ + ACPI_S3, /* sleep */ + ACPI_S4, /* non-volatile sleep */ + ACPI_S5, /* soft-off */ +}; + +typedef int acpi_sstate_t; + struct acpi_dev; /* @@ -217,6 +232,8 @@ /* strangess to avoid integer overflow */ #define ACPI_uS_TO_TMR_TICKS(val) \ (((val) * (ACPI_TMR_HZ / 10000)) / 100) +#define ACPI_TMR_TICKS_TO_uS(ticks) \ + (((ticks) * 100) / (ACPI_TMR_HZ / 10000)) /* CPU cycles -> PM timer cycles, looks somewhat heuristic but (ticks = 3/11 * CPU_MHz + 2) comes pretty close for my systems @@ -242,6 +259,16 @@ /* FACS flags */ #define ACPI_S4BIOS 0x00000001 +/* processor block offsets */ +#define ACPI_P_CNT 0x00000000 +#define ACPI_P_LVL2 0x00000004 +#define ACPI_P_LVL3 0x00000005 + +/* C-state latencies (microseconds) */ +#define ACPI_MAX_P_LVL2_LAT 100 +#define ACPI_MAX_P_LVL3_LAT 1000 +#define ACPI_INFINITE_LAT (~0UL) + struct acpi_rsdp { __u32 signature[2]; __u8 checksum; @@ -331,14 +358,12 @@ ACPI_GPE_ENABLE, ACPI_GPE_LEVEL, ACPI_EVENT, - ACPI_P_LVL2, - ACPI_P_LVL3, + ACPI_P_BLK, ACPI_P_LVL2_LAT, ACPI_P_LVL3_LAT, ACPI_S5_SLP_TYP, }; -#define ACPI_P_LVL_DISABLED 0x80 #define ACPI_SLP_TYP_DISABLED (~0UL) /* @@ -363,9 +388,7 @@ #define ACPI_PIIX4_S5_MASK (0x0000 << 10) #define ACPI_PIIX4_PM_TMR 0x0008 #define ACPI_PIIX4_GPE0 0x000c -#define ACPI_PIIX4_P_CNT 0x0010 -#define ACPI_PIIX4_P_LVL2 0x0014 -#define ACPI_PIIX4_P_LVL3 0x0015 +#define ACPI_PIIX4_P_BLK 0x0010 #define ACPI_PIIX4_PM1_EVT_LEN 0x04 #define ACPI_PIIX4_PM1_CNT_LEN 0x02 diff -u --recursive --new-file v2.3.28/linux/include/linux/bootmem.h linux/include/linux/bootmem.h --- v2.3.28/linux/include/linux/bootmem.h Thu Nov 11 20:11:52 1999 +++ linux/include/linux/bootmem.h Tue Nov 23 12:56:44 1999 @@ -3,6 +3,8 @@ #include #include +#include +#include /* * simple boot-time physical memory area allocator. diff -u --recursive --new-file v2.3.28/linux/include/linux/coda_proc.h linux/include/linux/coda_proc.h --- v2.3.28/linux/include/linux/coda_proc.h Tue Jul 6 19:08:33 1999 +++ linux/include/linux/coda_proc.h Sat Nov 20 16:19:00 1999 @@ -133,13 +133,13 @@ /* these functions are called to form the content of /proc/fs/coda/... files */ int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); #endif /* _CODA_PROC_H */ diff -u --recursive --new-file v2.3.28/linux/include/linux/fb.h linux/include/linux/fb.h --- v2.3.28/linux/include/linux/fb.h Mon Nov 1 13:56:27 1999 +++ linux/include/linux/fb.h Mon Nov 22 15:35:34 1999 @@ -1,6 +1,7 @@ #ifndef _LINUX_FB_H #define _LINUX_FB_H +#include #include /* Definitions of frame buffers */ @@ -408,17 +409,18 @@ extern void fbgen_blank(int blank, struct fb_info *info); -/* drivers/char/fbmem.c */ +/* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern int unregister_framebuffer(const struct fb_info *fb_info); -extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, - const struct fb_info *fb_info); -extern int fbmon_dpms(const struct fb_info *fb_info); - extern int num_registered_fb; extern struct fb_info *registered_fb[FB_MAX]; extern char con2fb_map[MAX_NR_CONSOLES]; + +/* drivers/video/fbmon.c */ +extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, + const struct fb_info *fb_info); +extern int fbmon_dpms(const struct fb_info *fb_info); /* drivers/video/fbcon.c */ extern struct display fb_display[MAX_NR_CONSOLES]; diff -u --recursive --new-file v2.3.28/linux/include/linux/fs.h linux/include/linux/fs.h --- v2.3.28/linux/include/linux/fs.h Thu Nov 18 20:25:38 1999 +++ linux/include/linux/fs.h Tue Nov 23 12:55:47 1999 @@ -543,14 +543,12 @@ unsigned long s_blocksize; unsigned char s_blocksize_bits; unsigned char s_lock; - unsigned char s_rd_only; unsigned char s_dirt; struct file_system_type *s_type; struct super_operations *s_op; struct dquot_operations *dq_op; unsigned long s_flags; unsigned long s_magic; - unsigned long s_time; struct dentry *s_root; wait_queue_head_t s_wait; diff -u --recursive --new-file v2.3.28/linux/include/linux/ftape.h linux/include/linux/ftape.h --- v2.3.28/linux/include/linux/ftape.h Wed Aug 18 16:43:46 1999 +++ linux/include/linux/ftape.h Tue Nov 23 12:55:52 1999 @@ -40,9 +40,6 @@ #include #include #include -#if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) -typedef daddr_t __kernel_daddr_t; /* needed for mtio.h */ -#endif #include #define FT_SECTOR(x) (x+1) /* sector offset into real sector */ diff -u --recursive --new-file v2.3.28/linux/include/linux/highmem.h linux/include/linux/highmem.h --- v2.3.28/linux/include/linux/highmem.h Thu Nov 11 20:11:53 1999 +++ linux/include/linux/highmem.h Tue Nov 23 12:55:50 1999 @@ -2,8 +2,7 @@ #define _LINUX_HIGHMEM_H #include -#include -#include +#include #ifdef CONFIG_HIGHMEM @@ -24,7 +23,7 @@ extern inline unsigned int nr_free_highpages(void) { return 0; } #define prepare_highmem_swapout(page) page #define replace_with_highmem(page) page -#define kmap(page) page_address(page) +#define kmap(page) __page_address(page) #define kunmap(page) do { } while (0) #endif /* CONFIG_HIGHMEM */ diff -u --recursive --new-file v2.3.28/linux/include/linux/if_arp.h linux/include/linux/if_arp.h --- v2.3.28/linux/include/linux/if_arp.h Mon Nov 1 13:56:27 1999 +++ linux/include/linux/if_arp.h Tue Nov 23 12:56:41 1999 @@ -76,7 +76,7 @@ #define ARPHRD_FCPL 786 /* Fibrechannel public loop */ #define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ /* 787->799 reserved for fibrechannel media types */ - +#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ diff -u --recursive --new-file v2.3.28/linux/include/linux/ioport.h linux/include/linux/ioport.h --- v2.3.28/linux/include/linux/ioport.h Tue Sep 7 12:14:07 1999 +++ linux/include/linux/ioport.h Tue Nov 23 10:10:38 1999 @@ -80,10 +80,11 @@ extern int request_resource(struct resource *root, struct resource *new); extern int release_resource(struct resource *new); +struct pci_dev; extern int allocate_resource(struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, - unsigned long align); + unsigned long align, struct pci_dev *); /* Convenience shorthand with allocation */ #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) @@ -106,5 +107,8 @@ #define HAVE_AUTOIRQ extern void autoirq_setup(int waittime); extern int autoirq_report(int waittime); + +extern unsigned long resource_fixup(struct pci_dev *, struct resource *, + unsigned long, unsigned long); #endif /* _LINUX_IOPORT_H */ diff -u --recursive --new-file v2.3.28/linux/include/linux/mm.h linux/include/linux/mm.h --- v2.3.28/linux/include/linux/mm.h Thu Nov 11 20:11:53 1999 +++ linux/include/linux/mm.h Tue Nov 23 12:55:52 1999 @@ -16,6 +16,7 @@ extern int page_cluster; #include +#include #include /* @@ -118,6 +119,8 @@ unsigned long val; } swp_entry_t; +struct zone_struct; + /* * Try to keep the most commonly accessed fields in single cache lines * here (16 bytes or greater). This ordering should be particularly @@ -127,7 +130,6 @@ * is used for linear searches (eg. clock algorithm scans). */ typedef struct page { - /* these must be first (free area handling) */ struct list_head list; struct address_space *mapping; unsigned long index; @@ -139,6 +141,7 @@ struct page **pprev_hash; struct buffer_head * buffers; unsigned long virtual; /* nonzero if kmapped */ + struct zone_struct *zone; } mem_map_t; #define get_page(p) atomic_inc(&(p)->count) @@ -283,19 +286,113 @@ extern mem_map_t * mem_map; /* - * This is timing-critical - most of the time in getting a new page - * goes to clearing the page. If you want a page without the clearing - * overhead, just use __get_free_page() directly.. - * - * We have two allocation namespaces - the *get*page*() variants - * return virtual kernel addresses to the allocated page(s), the - * alloc_page*() variants return 'struct page *'. - */ -#define __get_free_page(gfp_mask) __get_free_pages((gfp_mask),0) -#define __get_dma_pages(gfp_mask, order) __get_free_pages((gfp_mask) | GFP_DMA,(order)) -extern unsigned long FASTCALL(__get_free_pages(int gfp_mask, unsigned long order)); -extern struct page * FASTCALL(alloc_pages(int gfp_mask, unsigned long order)); -#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) + * Free memory management - zoned buddy allocator. + */ + +#if CONFIG_AP1000 +/* the AP+ needs to allocate 8MB contiguous, aligned chunks of ram + for the ring buffers */ +#define MAX_ORDER 12 +#else +#define MAX_ORDER 10 +#endif + +typedef struct free_area_struct { + struct list_head free_list; + unsigned int * map; +} free_area_t; + +typedef struct zone_struct { + /* + * Commonly accessed fields: + */ + spinlock_t lock; + unsigned long offset; + unsigned long free_pages; + int low_on_memory; + unsigned long pages_low, pages_high; + + /* + * free areas of different sizes + */ + free_area_t free_area[MAX_ORDER]; + + /* + * rarely used fields: + */ + char * name; + unsigned long size; +} zone_t; + +#define ZONE_DMA 0 +#define ZONE_NORMAL 1 +#define ZONE_HIGHMEM 2 + +/* + * NUMA architectures will have more: + */ +#define MAX_NR_ZONES 3 + +/* + * One allocation request operates on a zonelist. A zonelist + * is a list of zones, the first one is the 'goal' of the + * allocation, the other zones are fallback zones, in decreasing + * priority. On NUMA we want to fall back on other CPU's zones + * as well. + * + * Right now a zonelist takes up less than a cacheline. We never + * modify it apart from boot-up, and only a few indices are used, + * so despite the zonelist table being relatively big, the cache + * footprint of this construct is very small. + */ +typedef struct zonelist_struct { + zone_t * zones [MAX_NR_ZONES+1]; // NULL delimited + int gfp_mask; +} zonelist_t; + +#define NR_GFPINDEX 0x100 + +extern zonelist_t zonelists [NR_GFPINDEX]; + +/* + * There is only one page-allocator function, and two main namespaces to + * it. The alloc_page*() variants return 'struct page *' and as such + * can allocate highmem pages, the *get*page*() variants return + * virtual kernel addresses to the allocated page(s). + */ +extern struct page * FASTCALL(__alloc_pages(zonelist_t *zonelist, unsigned long order)); + +extern inline struct page * alloc_pages(int gfp_mask, unsigned long order) +{ + /* temporary check. */ + if (zonelists[gfp_mask].gfp_mask != (gfp_mask)) + BUG(); + /* + * Gets optimized away by the compiler. + */ + if (order >= MAX_ORDER) + return NULL; + return __alloc_pages(zonelists+(gfp_mask), order); +} + +#define alloc_page(gfp_mask) \ + alloc_pages(gfp_mask, 0) + +extern inline unsigned long __get_free_pages (int gfp_mask, unsigned long order) +{ + struct page * page; + + page = alloc_pages(gfp_mask, order); + if (!page) + return 0; + return __page_address(page); +} + +#define __get_free_page(gfp_mask) \ + __get_free_pages((gfp_mask),0) + +#define __get_dma_pages(gfp_mask, order) \ + __get_free_pages((gfp_mask) | GFP_DMA,(order)) extern inline unsigned long get_zeroed_page(int gfp_mask) { @@ -312,11 +409,29 @@ */ #define get_free_page get_zeroed_page -/* memory.c & swap.c*/ +/* + * There is only one 'core' page-freeing function. + */ +extern void FASTCALL(__free_pages_ok(struct page * page, unsigned long order)); + +extern inline void __free_pages(struct page *page, unsigned long order) +{ + if (!put_page_testzero(page)) + return; + __free_pages_ok(page, order); +} + +#define __free_page(page) __free_pages(page, 0) + +extern inline void free_pages(unsigned long addr, unsigned long order) +{ + unsigned long map_nr = MAP_NR(addr); + + if (map_nr < max_mapnr) + __free_pages(mem_map + map_nr, order); +} #define free_page(addr) free_pages((addr),0) -extern int FASTCALL(free_pages(unsigned long addr, unsigned long order)); -extern int FASTCALL(__free_page(struct page *)); extern void show_free_areas(void); extern struct page * put_dirty_page(struct task_struct * tsk, struct page *page, @@ -398,7 +513,7 @@ #define GFP_DMA __GFP_DMA /* Flag - indicates that the buffer can be taken from high memory which is not - directly addressable by the kernel */ + permanently mapped by the kernel */ #define GFP_HIGHMEM __GFP_HIGHMEM @@ -446,7 +561,6 @@ #define vmlist_access_unlock(mm) spin_unlock(&mm->page_table_lock) #define vmlist_modify_lock(mm) vmlist_access_lock(mm) #define vmlist_modify_unlock(mm) vmlist_access_unlock(mm) - #endif /* __KERNEL__ */ diff -u --recursive --new-file v2.3.28/linux/include/linux/netdevice.h linux/include/linux/netdevice.h --- v2.3.28/linux/include/linux/netdevice.h Thu Aug 26 13:05:41 1999 +++ linux/include/linux/netdevice.h Tue Nov 23 12:56:39 1999 @@ -391,7 +391,6 @@ #define HAVE_NETIF_RX 1 extern void netif_rx(struct sk_buff *skb); extern void net_bh(void); -extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy); extern int dev_ioctl(unsigned int cmd, void *); extern int dev_change_flags(struct net_device *, unsigned); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); @@ -423,7 +422,6 @@ extern void fddi_setup(struct net_device *dev); extern void tr_setup(struct net_device *dev); extern void fc_setup(struct net_device *dev); -extern void tr_freedev(struct net_device *dev); extern void fc_freedev(struct net_device *dev); extern int ether_config(struct net_device *dev, struct ifmap *map); /* Support for loadable net-drivers */ diff -u --recursive --new-file v2.3.28/linux/include/linux/nfsd/stats.h linux/include/linux/nfsd/stats.h --- v2.3.28/linux/include/linux/nfsd/stats.h Wed Nov 26 13:08:38 1997 +++ linux/include/linux/nfsd/stats.h Mon Nov 22 17:29:23 1999 @@ -13,11 +13,11 @@ unsigned int rchits; /* repcache hits */ unsigned int rcmisses; /* repcache hits */ unsigned int rcnocache; /* uncached reqs */ - unsigned int fh_cached; /* dentry cached */ - unsigned int fh_valid; /* dentry validated */ - unsigned int fh_fixup; /* dentry fixup validated */ - unsigned int fh_lookup; /* new lookup required */ unsigned int fh_stale; /* FH stale error */ + unsigned int fh_lookup; /* dentry cached */ + unsigned int fh_anon; /* anon file dentry returned */ + unsigned int fh_nocache_dir; /* filehandle not foudn in dcache */ + unsigned int fh_nocache_nondir; /* filehandle not foudn in dcache */ }; #ifdef __KERNEL__ diff -u --recursive --new-file v2.3.28/linux/include/linux/pagemap.h linux/include/linux/pagemap.h --- v2.3.28/linux/include/linux/pagemap.h Thu Nov 11 20:11:53 1999 +++ linux/include/linux/pagemap.h Tue Nov 23 12:55:56 1999 @@ -13,6 +13,7 @@ #include #include +#include /* * The page cache can done in larger chunks than diff -u --recursive --new-file v2.3.28/linux/include/linux/pci.h linux/include/linux/pci.h --- v2.3.28/linux/include/linux/pci.h Sun Nov 7 16:37:34 1999 +++ linux/include/linux/pci.h Tue Nov 23 12:55:43 1999 @@ -404,8 +404,16 @@ int (*write_dword)(struct pci_dev *, int where, u32 val); }; +struct pbus_set_ranges_data +{ + int found_vga; + unsigned long io_start, io_end; + unsigned long mem_start, mem_end; +}; + void pcibios_init(void); void pcibios_fixup_bus(struct pci_bus *); +void pcibios_fixup_pbus_ranges(struct pci_bus *, struct pbus_set_ranges_data *); int pcibios_enable_device(struct pci_dev *); char *pcibios_setup (char *str); diff -u --recursive --new-file v2.3.28/linux/include/linux/pci_ids.h linux/include/linux/pci_ids.h --- v2.3.28/linux/include/linux/pci_ids.h Thu Nov 18 20:25:38 1999 +++ linux/include/linux/pci_ids.h Tue Nov 23 10:15:42 1999 @@ -434,6 +434,10 @@ #define PCI_VENDOR_ID_LEADTEK 0x107d #define PCI_DEVICE_ID_LEADTEK_805 0x0000 +#define PCI_VENDOR_ID_INTERPHASE 0x107e +#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 +#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 + #define PCI_VENDOR_ID_CONTAQ 0x1080 #define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 #define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 @@ -707,10 +711,10 @@ #define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424 #define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d -#define PCI_VENDOR_ID_SK 0x1148 -#define PCI_DEVICE_ID_SK_FP 0x4000 -#define PCI_DEVICE_ID_SK_TR 0x4200 -#define PCI_DEVICE_ID_SK_GE 0x4300 +#define PCI_VENDOR_ID_SYSKONNECT 0x1148 +#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000 +#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 +#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 #define PCI_VENDOR_ID_VMIC 0x114a #define PCI_DEVICE_ID_VMIC_VME 0x7587 @@ -783,6 +787,7 @@ #define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 #define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 #define PCI_VENDOR_ID_AURAVISION 0x11d1 #define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7 @@ -874,9 +879,13 @@ #define PCI_DEVICE_ID_ENSONIQ_AUDIOPCI 0x5000 #define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 +#define PCI_VENDOR_ID_ROCKWELL 0x127A + #define PCI_VENDOR_ID_ALTEON 0x12ae #define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001 +#define PCI_VENDOR_ID_USR 0x12B9 + #define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 @@ -893,30 +902,65 @@ #define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 #define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041 +#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 + #define PCI_VENDOR_ID_CBOARDS 0x1307 #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 #define PCI_VENDOR_ID_SIIG 0x131f +#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 +#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 +#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 #define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 #define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 #define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 #define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 #define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 +#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030 +#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031 +#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032 #define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 #define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 #define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 +#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050 +#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051 +#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052 +#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000 +#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001 +#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002 #define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 #define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 +#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030 +#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031 +#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032 #define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 #define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 #define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 #define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 #define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 #define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 +#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050 +#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051 +#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052 #define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 #define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 #define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 +#define PCI_VENDOR_ID_QUATECH 0x135C +#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 +#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 +#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030 +#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040 +#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 +#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 + #define PCI_VENDOR_ID_SEALEVEL 0x135e #define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 #define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201 @@ -929,11 +973,18 @@ #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a #define PCI_VENDOR_ID_LAVA 0x1407 +#define PCI_DEVICE_ID_LAVA_DUAL_SERIAL 0x0100 #define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 #define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ #define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ #define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800 +#define PCI_VENDOR_ID_TIMEDIA 0x1409 +#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 + +#define PCI_VENDOR_ID_OXSEMI 0x1415 +#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 + #define PCI_VENDOR_ID_PANACOM 0x14d4 #define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 #define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 @@ -1022,8 +1073,6 @@ #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 #define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -#define PCI_VENDOR_ID_COMPUTONE 0x8e0e -#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 #define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 #define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 @@ -1034,6 +1083,14 @@ #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca +#define PCI_VENDOR_ID_COMPUTONE 0x8e0e +#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 +#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 +#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e +#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003 + #define PCI_VENDOR_ID_KTI 0x8e2e #define PCI_DEVICE_ID_KTI_ET32P2 0x3000 @@ -1099,15 +1156,4 @@ #define PCI_DEVICE_ID_ARK_STINGARK 0xa099 #define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 - -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 - -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 diff -u --recursive --new-file v2.3.28/linux/include/linux/pipe_fs_i.h linux/include/linux/pipe_fs_i.h --- v2.3.28/linux/include/linux/pipe_fs_i.h Thu Aug 26 13:05:41 1999 +++ linux/include/linux/pipe_fs_i.h Sun Nov 21 11:17:45 1999 @@ -7,6 +7,8 @@ unsigned int start; unsigned int readers; unsigned int writers; + unsigned int waiting_readers; + unsigned int waiting_writers; }; /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual @@ -20,6 +22,8 @@ #define PIPE_LEN(inode) ((inode).i_size) #define PIPE_READERS(inode) ((inode).i_pipe->readers) #define PIPE_WRITERS(inode) ((inode).i_pipe->writers) +#define PIPE_WAITING_READERS(inode) ((inode).i_pipe->waiting_readers) +#define PIPE_WAITING_WRITERS(inode) ((inode).i_pipe->waiting_writers) #define PIPE_EMPTY(inode) (PIPE_LEN(inode) == 0) #define PIPE_FULL(inode) (PIPE_LEN(inode) == PIPE_SIZE) diff -u --recursive --new-file v2.3.28/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h --- v2.3.28/linux/include/linux/proc_fs.h Thu Nov 11 20:11:53 1999 +++ linux/include/linux/proc_fs.h Tue Nov 23 12:56:20 1999 @@ -53,7 +53,7 @@ int count, int *eof, void *data); typedef int (write_proc_t)(struct file *file, const char *buffer, unsigned long count, void *data); -typedef int (get_info_t)(char *, char **, off_t, int, int); +typedef int (get_info_t)(char *, char **, off_t, int); struct proc_dir_entry { unsigned short low_ino; @@ -71,24 +71,18 @@ void *data; read_proc_t *read_proc; write_proc_t *write_proc; - int (*readlink_proc)(struct proc_dir_entry *de, char *page); unsigned int count; /* use count */ int deleted; /* delete flag */ + kdev_t rdev; }; #define PROC_INODE_PROPER(inode) ((inode)->i_ino & ~0xffff) -#define PROC_INODE_OPENPROM(inode) \ - ((inode->i_ino >= PROC_OPENPROM_FIRST) \ - && (inode->i_ino < PROC_OPENPROM_FIRST + PROC_NOPENPROM)) #ifdef CONFIG_PROC_FS extern struct proc_dir_entry proc_root; extern struct proc_dir_entry *proc_root_fs; extern struct proc_dir_entry *proc_net; -extern struct proc_dir_entry proc_sys; -extern struct proc_dir_entry proc_openprom; -extern struct proc_dir_entry *proc_mca; extern struct proc_dir_entry *proc_bus; extern struct proc_dir_entry *proc_root_driver; extern struct proc_dir_entry proc_root_kcore; @@ -101,62 +95,15 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *); -extern int proc_unregister(struct proc_dir_entry *, int); extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent); extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); - -/* - * retrieve the proc_dir_entry associated with /proc/driver/$module_name - */ -extern inline -struct proc_dir_entry *proc_driver_find (const char *module_name) -{ - struct proc_dir_entry *p; - - p = proc_root_driver->subdir; - while (p != NULL) { - if (strcmp (p->name, module_name) == 0) - return p; - - p = p->next; - } - return NULL; -} - - -/* - * remove /proc/driver/$module_name, and all its contents - */ -extern inline int proc_driver_unregister(const char *module_name) -{ - remove_proc_entry (module_name, proc_root_driver); - return 0; -} - - -/* - * create driver-specific playground directory, /proc/driver/$module_name - */ -extern inline int proc_driver_register(const char *module_name) -{ - struct proc_dir_entry *p; - - p = create_proc_entry (module_name, S_IFDIR, proc_root_driver); - - return (p == NULL) ? -1 : 0; -} - extern struct super_block *proc_super_blocks; -extern struct dentry_operations proc_dentry_operations; extern struct super_block *proc_read_super(struct super_block *,void *,int); extern int init_proc_fs(void); extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *); -extern int proc_statfs(struct super_block *, struct statfs *, int); -extern void proc_read_inode(struct inode *); -extern void proc_write_inode(struct inode *); extern int proc_match(int, const char *,struct proc_dir_entry *); @@ -178,22 +125,11 @@ mode_t mode; char name[32]; }; -extern struct inode_operations * -proc_openprom_register(int (*readdir)(struct file *, void *, filldir_t), - struct dentry * (*lookup)(struct inode *, struct dentry *), - void (*use)(struct inode *, int), - struct openpromfs_dev ***); -extern void proc_openprom_deregister(void); -extern void (*proc_openprom_use)(struct inode *,int); extern int proc_openprom_regdev(struct openpromfs_dev *); extern int proc_openprom_unregdev(struct openpromfs_dev *); -extern struct inode_operations proc_dir_inode_operations; -extern struct inode_operations proc_file_inode_operations; -extern struct inode_operations proc_openprom_inode_operations; extern struct inode_operations proc_sys_inode_operations; extern struct inode_operations proc_kcore_inode_operations; -extern struct inode_operations proc_profile_inode_operations; extern struct inode_operations proc_kmsg_inode_operations; #if CONFIG_AP1000 extern struct inode_operations proc_ringbuf_inode_operations; @@ -213,6 +149,12 @@ */ extern void proc_device_tree_init(void); +extern struct proc_dir_entry *proc_symlink(const char *, + struct proc_dir_entry *,char *); +extern struct proc_dir_entry *proc_mknod(const char *,mode_t, + struct proc_dir_entry *,kdev_t); +extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); + extern inline struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, struct proc_dir_entry *base, read_proc_t *read_proc, void * data) @@ -247,7 +189,6 @@ #else extern inline int proc_register(struct proc_dir_entry *a, struct proc_dir_entry *b) { return 0; } -extern inline int proc_unregister(struct proc_dir_entry *a, int b) { return 0; } extern inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode, get_info_t *get_info) {return NULL;} extern inline void proc_net_remove(const char *name) {} @@ -256,6 +197,12 @@ mode_t mode, struct proc_dir_entry *parent) { return NULL; } extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *parent) {}; +extern inline proc_dir_entry *proc_symlink(const char *name, + struct proc_dir_entry *parent,char *dest) {return NULL;} +extern inline proc_dir_entry *proc_mknod(const char *name,mode_t mode, + struct proc_dir_entry *parent,kdev_t rdev) {return NULL;} +extern struct proc_dir_entry *proc_mkdir(const char *name, + struct proc_dir_entry *parent) {return NULL;} extern inline struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, struct proc_dir_entry *base, @@ -267,22 +214,6 @@ extern inline void proc_tty_register_driver(struct tty_driver *driver) {}; extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; - -extern inline -struct proc_dir_entry *proc_driver_find (const char *module_name) -{ - return NULL; -} - -extern inline int proc_driver_unregister(const char *module_name) -{ - return 0; -} - -extern inline int proc_driver_register(const char *module_name) -{ - return 0; -} extern struct proc_dir_entry proc_root; diff -u --recursive --new-file v2.3.28/linux/include/linux/sched.h linux/include/linux/sched.h --- v2.3.28/linux/include/linux/sched.h Thu Nov 11 20:11:53 1999 +++ linux/include/linux/sched.h Tue Nov 23 12:55:51 1999 @@ -498,6 +498,7 @@ #define CURRENT_TIME (xtime.tv_sec) extern void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode)); +extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode)); extern void FASTCALL(sleep_on(wait_queue_head_t *q)); extern long FASTCALL(sleep_on_timeout(wait_queue_head_t *q, signed long timeout)); @@ -507,7 +508,9 @@ extern void FASTCALL(wake_up_process(struct task_struct * tsk)); #define wake_up(x) __wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) +#define wake_up_sync(x) __wake_up_sync((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) #define wake_up_interruptible(x) __wake_up((x),TASK_INTERRUPTIBLE) +#define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE) extern int in_group_p(gid_t); @@ -845,7 +848,7 @@ down(&p->exit_sem); if (p->p_pptr) return 1; - /* He's dead, Jim. You take his wallet, I'll take tricoder... */ + /* He's dead, Jim. You take his wallet, I'll take the tricorder... */ up(&p->exit_sem); return 0; } diff -u --recursive --new-file v2.3.28/linux/include/linux/serial.h linux/include/linux/serial.h --- v2.3.28/linux/include/linux/serial.h Mon Nov 1 13:56:27 1999 +++ linux/include/linux/serial.h Fri Nov 19 11:30:54 1999 @@ -20,7 +20,8 @@ int custom_divisor; int baud_base; unsigned short close_delay; - char reserved_char[2]; + char io_type; + char reserved_char[1]; int hub6; unsigned short closing_wait; /* time to wait before closing */ unsigned short closing_wait2; /* no longer used... */ @@ -67,6 +68,11 @@ #define PORT_16654 11 #define PORT_16850 12 #define PORT_MAX 12 + +#define SERIAL_IO_PORT 0 +#define SERIAL_IO_HUB6 1 +#define SERIAL_IO_MEM 2 +#define SERIAL_IO_GSC 3 struct serial_uart_config { char *name; diff -u --recursive --new-file v2.3.28/linux/include/linux/serialP.h linux/include/linux/serialP.h --- v2.3.28/linux/include/linux/serialP.h Mon Nov 1 13:56:27 1999 +++ linux/include/linux/serialP.h Tue Nov 23 12:55:47 1999 @@ -45,6 +45,7 @@ struct async_icount icount; struct termios normal_termios; struct termios callout_termios; + int io_type; struct async_struct *info; }; @@ -80,6 +81,7 @@ int xmit_cnt; u8 *iomem_base; u16 iomem_reg_shift; + int io_type; struct tq_struct tqueue; #ifdef DECLARE_WAITQUEUE wait_queue_head_t open_wait; @@ -99,6 +101,10 @@ #define SERIAL_MAGIC 0x5301 #define SSTATE_MAGIC 0x5302 +/* + * The size of the serial xmit buffer is 1 page, or 4096 bytes + */ +#define SERIAL_XMIT_SIZE 4096 /* * Events are used to schedule things to happen at timer-interrupt @@ -132,7 +138,6 @@ #define ALPHA_KLUDGE_MCR 0 #endif -#ifdef CONFIG_PCI /* * Structures and definitions for PCI support */ @@ -147,8 +152,9 @@ int base_baud; int uart_offset; int reg_shift; - void (*init_fn)(struct pci_dev *dev, struct pci_board *board, + int (*init_fn)(struct pci_dev *dev, struct pci_board *board, int enable); + int first_uart_offset; }; struct pci_board_inst { @@ -158,7 +164,6 @@ #ifndef PCI_ANY_ID #define PCI_ANY_ID (~0) -#endif #endif #define SPCI_FL_BASE_MASK 0x0007 diff -u --recursive --new-file v2.3.28/linux/include/linux/sysctl.h linux/include/linux/sysctl.h --- v2.3.28/linux/include/linux/sysctl.h Thu Nov 11 20:11:53 1999 +++ linux/include/linux/sysctl.h Fri Nov 19 11:41:51 1999 @@ -106,7 +106,8 @@ KERN_RANDOM=40, /* Random driver */ KERN_SHMALL=41, /* int: Maximum size of shared memory */ KERN_MSGMNI=42, /* int: msg queue identifiers */ - KERN_SEM=43 /* int: sysv semaphore limits */ + KERN_SEM=43, /* int: sysv semaphore limits */ + KERN_SPARC_STOP_A=44 /* int: Sparc Stop-A enable */ }; diff -u --recursive --new-file v2.3.28/linux/include/linux/udf_fs.h linux/include/linux/udf_fs.h --- v2.3.28/linux/include/linux/udf_fs.h Mon Nov 1 13:56:27 1999 +++ linux/include/linux/udf_fs.h Fri Nov 19 11:35:10 1999 @@ -30,8 +30,8 @@ #define UDF_DEFAULT_PREALLOC_BLOCKS 8 #define UDF_DEFAULT_PREALLOC_DIR_BLOCKS 0 -#define UDFFS_DATE "99/10/29" -#define UDFFS_VERSION "0.8.9.3" +#define UDFFS_DATE "99/11/18" +#define UDFFS_VERSION "0.8.9.4" #define UDFFS_DEBUG #ifdef UDFFS_DEBUG diff -u --recursive --new-file v2.3.28/linux/include/linux/videodev.h linux/include/linux/videodev.h --- v2.3.28/linux/include/linux/videodev.h Thu Nov 11 20:11:54 1999 +++ linux/include/linux/videodev.h Fri Nov 19 11:41:51 1999 @@ -175,6 +175,7 @@ struct video_clip *clips; /* Set only */ int clipcount; #define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ #define VIDEO_CLIP_BITMAP -1 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */ #define VIDEO_CLIPMAP_SIZE (128 * 625) diff -u --recursive --new-file v2.3.28/linux/include/linux/vmalloc.h linux/include/linux/vmalloc.h --- v2.3.28/linux/include/linux/vmalloc.h Thu Nov 11 20:11:54 1999 +++ linux/include/linux/vmalloc.h Tue Nov 23 12:55:56 1999 @@ -6,6 +6,10 @@ #include +/* bits in vm_struct->flags */ +#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ +#define VM_ALLOC 0x00000002 /* vmalloc() */ + struct vm_struct { unsigned long flags; void * addr; @@ -13,7 +17,7 @@ struct vm_struct * next; }; -struct vm_struct * get_vm_area(unsigned long size); +struct vm_struct * get_vm_area(unsigned long size, unsigned long flags); void vfree(void * addr); void * vmalloc(unsigned long size); long vread(char *buf, char *addr, unsigned long count); diff -u --recursive --new-file v2.3.28/linux/include/linux/wanrouter.h linux/include/linux/wanrouter.h --- v2.3.28/linux/include/linux/wanrouter.h Fri Oct 15 15:25:14 1999 +++ linux/include/linux/wanrouter.h Tue Nov 23 12:58:24 1999 @@ -363,7 +363,7 @@ struct wan_device* next; /* -> next device */ struct net_device* dev; /* list of network interfaces */ unsigned ndev; /* number of interfaces */ - struct proc_dir_entry dent; /* proc filesystem entry */ + struct proc_dir_entry *dent; /* proc filesystem entry */ } wan_device_t; /* Public functions available for device drivers */ diff -u --recursive --new-file v2.3.28/linux/include/net/ax25.h linux/include/net/ax25.h --- v2.3.28/linux/include/net/ax25.h Wed Aug 18 16:44:31 1999 +++ linux/include/net/ax25.h Tue Nov 23 12:56:44 1999 @@ -286,7 +286,7 @@ /* ax25_route.c */ extern void ax25_rt_device_down(struct net_device *); extern int ax25_rt_ioctl(unsigned int, void *); -extern int ax25_rt_get_info(char *, char **, off_t, int, int); +extern int ax25_rt_get_info(char *, char **, off_t, int); extern int ax25_rt_autobind(ax25_cb *, ax25_address *); extern ax25_route *ax25_rt_find_route(ax25_address *, struct net_device *); extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); @@ -339,7 +339,7 @@ extern int ax25_uid_policy; extern ax25_address *ax25_findbyuid(uid_t); extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *); -extern int ax25_uid_get_info(char *, char **, off_t, int, int); +extern int ax25_uid_get_info(char *, char **, off_t, int); extern void ax25_uid_free(void); /* sysctl_net_ax25.c */ diff -u --recursive --new-file v2.3.28/linux/include/net/br.h linux/include/net/br.h --- v2.3.28/linux/include/net/br.h Thu Aug 26 13:05:41 1999 +++ linux/include/net/br.h Fri Nov 19 11:33:29 1999 @@ -296,7 +296,6 @@ struct fdb *br_avl_find_addr(unsigned char addr[6]); struct fdb *br_avl_insert (struct fdb * new_node); void sprintf_avl (char **pbuffer, struct fdb * tree, off_t *pos,int* len, off_t offset, int length); -int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy); void br_avl_delete_by_port(int port); /* externs */ diff -u --recursive --new-file v2.3.28/linux/include/net/ip.h linux/include/net/ip.h --- v2.3.28/linux/include/net/ip.h Thu Nov 18 20:25:38 1999 +++ linux/include/net/ip.h Tue Nov 23 12:57:01 1999 @@ -78,7 +78,7 @@ extern void ip_mc_dropsocket(struct sock *); extern void ip_mc_dropdevice(struct net_device *dev); -extern int ip_mc_procinfo(char *, char **, off_t, int, int); +extern int ip_mc_procinfo(char *, char **, off_t, int); /* * Functions provided by ip.c @@ -110,6 +110,22 @@ struct rtable *rt, int flags); +/* + * Map a multicast IP onto multicast MAC for type Token Ring. + * This conforms to RFC1469 Option 2 Multicasting i.e. + * using a functional address to transmit / receive + * multicast packets. + */ + +extern __inline__ void ip_tr_mc_map(u32 addr, char *buf) +{ + buf[0]=0xC0; + buf[1]=0x00; + buf[2]=0x00; + buf[3]=0x04; + buf[4]=0x00; + buf[5]=0x00; +} struct ip_reply_arg { struct iovec iov[2]; diff -u --recursive --new-file v2.3.28/linux/include/net/irda/irda_device.h linux/include/net/irda/irda_device.h --- v2.3.28/linux/include/net/irda/irda_device.h Wed Oct 27 16:34:12 1999 +++ linux/include/net/irda/irda_device.h Tue Nov 23 14:21:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Apr 14 12:41:42 1998 - * Modified at: Tue Oct 19 20:00:03 1999 + * Modified at: Tue Nov 16 12:54:01 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -164,6 +164,7 @@ int irda_device_txqueue_empty(struct net_device *dev); int irda_device_set_raw_mode(struct net_device* self, int status); int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts); +int irda_device_change_speed(struct net_device *dev, __u32 speed); int irda_device_setup(struct net_device *dev); /* Dongle interface */ diff -u --recursive --new-file v2.3.28/linux/include/net/irda/irlap.h linux/include/net/irda/irlap.h --- v2.3.28/linux/include/net/irda/irlap.h Wed Oct 27 16:34:12 1999 +++ linux/include/net/irda/irlap.h Tue Nov 23 14:21:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Thu Oct 7 23:06:36 1999 + * Modified at: Tue Nov 16 10:00:36 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -162,6 +162,8 @@ hashbin_t *discovery_log; discovery_t *discovery_cmd; + __u32 speed; + struct qos_info qos_tx; /* QoS requested by peer */ struct qos_info qos_rx; /* QoS requested by self */ struct qos_info *qos_dev; /* QoS supported by device */ @@ -220,7 +222,7 @@ int irlap_generate_rand_time_slot(int S, int s); void irlap_initiate_connection_state(struct irlap_cb *); void irlap_flush_all_queues(struct irlap_cb *); -void irlap_change_speed(struct irlap_cb *self, __u32 speed); +void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now); void irlap_wait_min_turn_around(struct irlap_cb *, struct qos_info *); void irlap_init_qos_capabilities(struct irlap_cb *, struct qos_info *); diff -u --recursive --new-file v2.3.28/linux/include/net/irda/irport.h linux/include/net/irda/irport.h --- v2.3.28/linux/include/net/irda/irport.h Sun Nov 7 16:37:34 1999 +++ linux/include/net/irda/irport.h Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Aug 3 13:49:59 1997 - * Modified at: Sat Oct 30 19:54:07 1999 + * Modified at: Sat Nov 13 23:48:55 1999 * Modified by: Dag Brattli * * Copyright (c) 1997, 1998-1999 Dag Brattli @@ -64,6 +64,7 @@ dongle_t *dongle; /* Dongle driver */ __u32 flags; /* Interface flags */ + __u32 new_speed; spinlock_t lock; /* For serializing operations */ @@ -74,6 +75,7 @@ void irport_stop(struct irport_cb *self, int iobase); int irport_probe(int iobase); +int irport_change_speed(struct irda_task *task); void __irport_change_speed(struct irport_cb *self, __u32 speed); void irport_interrupt(int irq, void *dev_id, struct pt_regs *regs); int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev); diff -u --recursive --new-file v2.3.28/linux/include/net/irda/irtty.h linux/include/net/irda/irtty.h --- v2.3.28/linux/include/net/irda/irtty.h Wed Oct 27 16:34:12 1999 +++ linux/include/net/irda/irtty.h Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Dec 9 21:13:12 1997 - * Modified at: Mon Oct 18 23:24:31 1999 + * Modified at: Fri Nov 5 10:46:51 1999 * Modified by: Dag Brattli * * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. @@ -60,6 +60,8 @@ struct qos_info qos; /* QoS capabilities for this device */ dongle_t *dongle; /* Dongle driver */ + + __u32 new_speed; __u32 flags; /* Interface flags */ diff -u --recursive --new-file v2.3.28/linux/include/net/irda/pc87108.h linux/include/net/irda/pc87108.h --- v2.3.28/linux/include/net/irda/pc87108.h Wed Oct 27 16:34:12 1999 +++ linux/include/net/irda/pc87108.h Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Fri Nov 13 14:37:40 1998 - * Modified at: Mon Oct 18 15:08:53 1999 + * Modified at: Mon Nov 8 10:00:27 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli @@ -194,6 +194,7 @@ struct qos_info qos; /* QoS capabilities for this device */ __u32 flags; /* Interface flags */ + __u32 new_speed; }; static inline void switch_bank(int iobase, int bank) diff -u --recursive --new-file v2.3.28/linux/include/net/irda/toshoboe.h linux/include/net/irda/toshoboe.h --- v2.3.28/linux/include/net/irda/toshoboe.h Wed Oct 27 16:34:12 1999 +++ linux/include/net/irda/toshoboe.h Sun Nov 21 11:13:57 1999 @@ -163,6 +163,7 @@ struct qos_info qos; /* QoS capabilities for this device */ __u32 flags; /* Interface flags */ + __u32 new_speed; struct pci_dev *pdev; /*PCI device */ int base; /*IO base */ diff -u --recursive --new-file v2.3.28/linux/include/net/irda/w83977af_ir.h linux/include/net/irda/w83977af_ir.h --- v2.3.28/linux/include/net/irda/w83977af_ir.h Wed Oct 27 16:34:12 1999 +++ linux/include/net/irda/w83977af_ir.h Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Paul VanderSpek * Created at: Thu Nov 19 13:55:34 1998 - * Modified at: Fri Oct 15 16:06:46 1999 + * Modified at: Mon Nov 8 10:00:40 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. @@ -181,6 +181,7 @@ struct qos_info qos; /* QoS capabilities for this device */ __u32 flags; /* Interface flags */ + __u32 new_speed; }; static inline void switch_bank( int iobase, int set) diff -u --recursive --new-file v2.3.28/linux/include/net/netrom.h linux/include/net/netrom.h --- v2.3.28/linux/include/net/netrom.h Wed Aug 18 11:38:47 1999 +++ linux/include/net/netrom.h Fri Nov 19 11:33:29 1999 @@ -147,8 +147,8 @@ extern int nr_rt_ioctl(unsigned int, void *); extern void nr_link_failed(ax25_cb *, int); extern int nr_route_frame(struct sk_buff *, ax25_cb *); -extern int nr_nodes_get_info(char *, char **, off_t, int, int); -extern int nr_neigh_get_info(char *, char **, off_t, int, int); +extern int nr_nodes_get_info(char *, char **, off_t, int); +extern int nr_neigh_get_info(char *, char **, off_t, int); extern void nr_rt_free(void); /* nr_subr.c */ diff -u --recursive --new-file v2.3.28/linux/include/net/rose.h linux/include/net/rose.h --- v2.3.28/linux/include/net/rose.h Wed Aug 18 11:38:47 1999 +++ linux/include/net/rose.h Fri Nov 19 11:33:29 1999 @@ -207,9 +207,9 @@ extern int rose_rt_ioctl(unsigned int, void *); extern void rose_link_failed(ax25_cb *, int); extern int rose_route_frame(struct sk_buff *, ax25_cb *); -extern int rose_nodes_get_info(char *, char **, off_t, int, int); -extern int rose_neigh_get_info(char *, char **, off_t, int, int); -extern int rose_routes_get_info(char *, char **, off_t, int, int); +extern int rose_nodes_get_info(char *, char **, off_t, int); +extern int rose_neigh_get_info(char *, char **, off_t, int); +extern int rose_routes_get_info(char *, char **, off_t, int); extern void rose_rt_free(void); /* rose_subr.c */ diff -u --recursive --new-file v2.3.28/linux/include/net/x25.h linux/include/net/x25.h --- v2.3.28/linux/include/net/x25.h Wed Aug 18 11:38:47 1999 +++ linux/include/net/x25.h Fri Nov 19 11:33:29 1999 @@ -192,7 +192,7 @@ extern struct net_device *x25_dev_get(char *); extern void x25_route_device_down(struct net_device *); extern int x25_route_ioctl(unsigned int, void *); -extern int x25_routes_get_info(char *, char **, off_t, int, int); +extern int x25_routes_get_info(char *, char **, off_t, int); extern void x25_route_free(void); /* x25_subr.c */ diff -u --recursive --new-file v2.3.28/linux/init/main.c linux/init/main.c --- v2.3.28/linux/init/main.c Fri Oct 22 13:21:55 1999 +++ linux/init/main.c Sat Nov 20 10:09:05 1999 @@ -479,7 +479,6 @@ size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1; prof_buffer = (unsigned int *) alloc_bootmem(size); - memset(prof_buffer, 0, size); } kmem_cache_init(); diff -u --recursive --new-file v2.3.28/linux/ipc/sem.c linux/ipc/sem.c --- v2.3.28/linux/ipc/sem.c Thu Nov 11 20:11:54 1999 +++ linux/ipc/sem.c Tue Nov 23 10:04:00 1999 @@ -494,6 +494,8 @@ if(sma==NULL) return -EINVAL; + nsems = sma->sem_nsems; + err=-EIDRM; if (sem_checkid(sma,semid)) goto out_unlock; @@ -502,7 +504,6 @@ if (ipcperms (&sma->sem_perm, (cmd==SETVAL||cmd==SETALL)?S_IWUGO:S_IRUGO)) goto out_unlock; - nsems = sma->sem_nsems; switch (cmd) { case GETALL: { diff -u --recursive --new-file v2.3.28/linux/kernel/fork.c linux/kernel/fork.c --- v2.3.28/linux/kernel/fork.c Thu Nov 11 20:11:54 1999 +++ linux/kernel/fork.c Sat Nov 20 10:09:05 1999 @@ -19,6 +19,7 @@ #include #include +#include #include #include diff -u --recursive --new-file v2.3.28/linux/kernel/ksyms.c linux/kernel/ksyms.c --- v2.3.28/linux/kernel/ksyms.c Thu Nov 11 20:11:54 1999 +++ linux/kernel/ksyms.c Tue Nov 23 14:16:40 1999 @@ -92,9 +92,9 @@ EXPORT_SYMBOL(exit_sighand); /* internal kernel memory management */ -EXPORT_SYMBOL(__get_free_pages); -EXPORT_SYMBOL(free_pages); -EXPORT_SYMBOL(__free_page); +EXPORT_SYMBOL(__alloc_pages); +EXPORT_SYMBOL(__free_pages_ok); +EXPORT_SYMBOL(zonelists); EXPORT_SYMBOL(kmem_find_general_cachep); EXPORT_SYMBOL(kmem_cache_create); EXPORT_SYMBOL(kmem_cache_destroy); @@ -114,6 +114,11 @@ EXPORT_SYMBOL(find_vma); EXPORT_SYMBOL(get_unmapped_area); EXPORT_SYMBOL(init_mm); +#ifdef CONFIG_HIGHMEM +EXPORT_SYMBOL(kmap_high); +EXPORT_SYMBOL(kunmap_high); +EXPORT_SYMBOL(highmem_start_page); +#endif /* filesystem internal functions */ EXPORT_SYMBOL(in_group_p); @@ -173,6 +178,7 @@ EXPORT_SYMBOL(__bforget); EXPORT_SYMBOL(ll_rw_block); EXPORT_SYMBOL(__wait_on_buffer); +EXPORT_SYMBOL(___wait_on_page); EXPORT_SYMBOL(add_blkdev_randomness); EXPORT_SYMBOL(block_read_full_page); EXPORT_SYMBOL(block_write_full_page); diff -u --recursive --new-file v2.3.28/linux/kernel/module.c linux/kernel/module.c --- v2.3.28/linux/kernel/module.c Thu Aug 26 13:05:42 1999 +++ linux/kernel/module.c Sat Nov 20 10:09:05 1999 @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include /* diff -u --recursive --new-file v2.3.28/linux/kernel/resource.c linux/kernel/resource.c --- v2.3.28/linux/kernel/resource.c Thu Nov 11 20:11:54 1999 +++ linux/kernel/resource.c Tue Nov 23 10:10:38 1999 @@ -126,7 +126,7 @@ static int find_resource(struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, - unsigned long align) + unsigned long align, struct pci_dev * dev) { struct resource *this = root->child; unsigned long start, end; @@ -142,6 +142,7 @@ if (end > max) end = max; start = (start + align - 1) & ~(align - 1); + start = resource_fixup (dev, new, start, size); if (start < end && end - start + 1 >= size) { new->start = start; new->end = start + size - 1; @@ -161,12 +162,12 @@ int allocate_resource(struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, - unsigned long align) + unsigned long align, struct pci_dev * dev) { int err; write_lock(&resource_lock); - err = find_resource(root, new, size, min, max, align); + err = find_resource(root, new, size, min, max, align, dev); if (err >= 0 && __request_resource(root, new)) err = -EBUSY; write_unlock(&resource_lock); diff -u --recursive --new-file v2.3.28/linux/kernel/sched.c linux/kernel/sched.c --- v2.3.28/linux/kernel/sched.c Fri Oct 15 15:25:14 1999 +++ linux/kernel/sched.c Sun Nov 21 11:17:45 1999 @@ -223,49 +223,87 @@ return goodness(p, cpu, prev->mm) - goodness(prev, cpu, prev->mm); } -static void reschedule_idle(struct task_struct * p) +/* + * This is ugly, but reschedule_idle() is very timing-critical. + * We enter with the runqueue spinlock held, but we might end + * up unlocking it early, so the caller must not unlock the + * runqueue, it's always done by reschedule_idle(). + */ +static inline void reschedule_idle(struct task_struct * p, unsigned long flags) { #ifdef __SMP__ int this_cpu = smp_processor_id(), target_cpu; - struct task_struct *tsk, *target_tsk; + struct task_struct *tsk; int cpu, best_cpu, i; - unsigned long flags; - - spin_lock_irqsave(&runqueue_lock, flags); /* * shortcut if the woken up task's last CPU is * idle now. */ best_cpu = p->processor; - target_tsk = idle_task(best_cpu); - if (cpu_curr(best_cpu) == target_tsk) + tsk = idle_task(best_cpu); + if (cpu_curr(best_cpu) == tsk) goto send_now; - target_tsk = NULL; + /* + * The only heuristics - we use the tsk->avg_slice value + * to detect 'frequent reschedulers'. + * + * If both the woken-up process and the preferred CPU is + * is a frequent rescheduler, then skip the asynchronous + * wakeup, the frequent rescheduler will likely chose this + * task during it's next schedule(): + */ + tsk = cpu_curr(best_cpu); + if ((p->avg_slice < cacheflush_time) && + (tsk->avg_slice < cacheflush_time)) + goto out_no_target; + + /* + * We know that the preferred CPU has a cache-affine current + * process, lets try to find a new idle CPU for the woken-up + * process: + */ for (i = 0; i < smp_num_cpus; i++) { cpu = cpu_logical_map(i); tsk = cpu_curr(cpu); + /* + * We use the first available idle CPU. This creates + * a priority list between idle CPUs, but this is not + * a problem. + */ if (tsk == idle_task(cpu)) - target_tsk = tsk; + goto send_now; } - if (target_tsk && p->avg_slice > cacheflush_time) - goto send_now; - + /* + * No CPU is idle, but maybe this process has enough priority + * to preempt it's preferred CPU. (this is a shortcut): + */ tsk = cpu_curr(best_cpu); if (preemption_goodness(tsk, p, best_cpu) > 0) - target_tsk = tsk; + goto send_now; /* - * found any suitable CPU? + * We should get here rarely - or in the high CPU contention + * case. No CPU is idle and this process is either lowprio or + * the preferred CPU is highprio. Maybe some other CPU can/must + * be preempted: */ - if (!target_tsk) - goto out_no_target; + for (i = 0; i < smp_num_cpus; i++) { + cpu = cpu_logical_map(i); + tsk = cpu_curr(cpu); + if (preemption_goodness(tsk, p, cpu) > 0) + goto send_now; + } + +out_no_target: + spin_unlock_irqrestore(&runqueue_lock, flags); + return; send_now: - target_cpu = target_tsk->processor; - target_tsk->need_resched = 1; + target_cpu = tsk->processor; + tsk->need_resched = 1; spin_unlock_irqrestore(&runqueue_lock, flags); /* * the APIC stuff can go outside of the lock because @@ -274,9 +312,6 @@ if (target_cpu != this_cpu) smp_send_reschedule(target_cpu); return; -out_no_target: - spin_unlock_irqrestore(&runqueue_lock, flags); - return; #else /* UP */ int this_cpu = smp_processor_id(); struct task_struct *tsk; @@ -320,7 +355,7 @@ * "current->state = TASK_RUNNING" to mark yourself runnable * without the overhead of this. */ -void wake_up_process(struct task_struct * p) +inline void wake_up_process(struct task_struct * p) { unsigned long flags; @@ -332,14 +367,29 @@ if (task_on_runqueue(p)) goto out; add_to_runqueue(p); - spin_unlock_irqrestore(&runqueue_lock, flags); + reschedule_idle(p, flags); // spin_unlocks runqueue - reschedule_idle(p); return; out: spin_unlock_irqrestore(&runqueue_lock, flags); } +static inline void wake_up_process_synchronous(struct task_struct * p) +{ + unsigned long flags; + + /* + * We want the common case fall through straight, thus the goto. + */ + spin_lock_irqsave(&runqueue_lock, flags); + p->state = TASK_RUNNING; + if (task_on_runqueue(p)) + goto out; + add_to_runqueue(p); +out: + spin_unlock_irqrestore(&runqueue_lock, flags); +} + static void process_timeout(unsigned long __data) { struct task_struct * p = (struct task_struct *) __data; @@ -541,8 +591,12 @@ { #ifdef __SMP__ if ((prev->state == TASK_RUNNING) && - (prev != idle_task(smp_processor_id()))) - reschedule_idle(prev); + (prev != idle_task(smp_processor_id()))) { + unsigned long flags; + + spin_lock_irqsave(&runqueue_lock, flags); + reschedule_idle(prev, flags); // spin_unlocks runqueue + } wmb(); prev->has_cpu = 0; #endif /* __SMP__ */ @@ -765,7 +819,7 @@ return; } -void __wake_up(wait_queue_head_t *q, unsigned int mode) +static inline void __wake_up_common(wait_queue_head_t *q, unsigned int mode, const int sync) { struct list_head *tmp, *head; struct task_struct *p; @@ -801,7 +855,10 @@ #if WAITQUEUE_DEBUG curr->__waker = (long)__builtin_return_address(0); #endif - wake_up_process(p); + if (sync) + wake_up_process_synchronous(p); + else + wake_up_process(p); if (state & TASK_EXCLUSIVE) break; } @@ -809,6 +866,16 @@ wq_write_unlock_irqrestore(&q->lock, flags); out: return; +} + +void __wake_up(wait_queue_head_t *q, unsigned int mode) +{ + __wake_up_common(q, mode, 0); +} + +void __wake_up_sync(wait_queue_head_t *q, unsigned int mode) +{ + __wake_up_common(q, mode, 1); } #define SLEEP_ON_VAR \ diff -u --recursive --new-file v2.3.28/linux/kernel/sysctl.c linux/kernel/sysctl.c --- v2.3.28/linux/kernel/sysctl.c Thu Nov 11 20:11:54 1999 +++ linux/kernel/sysctl.c Fri Nov 19 21:16:10 1999 @@ -584,13 +584,12 @@ continue; } - /* Don't unregoster proc entries that are still being used.. */ + /* Don't unregister proc entries that are still being used.. */ if (de->count) continue; - proc_unregister(root, de->low_ino); table->de = NULL; - kfree(de); + remove_proc_entry(table->procname, root); } } diff -u --recursive --new-file v2.3.28/linux/mm/bootmem.c linux/mm/bootmem.c --- v2.3.28/linux/mm/bootmem.c Thu Nov 18 20:25:38 1999 +++ linux/mm/bootmem.c Sat Nov 20 10:09:05 1999 @@ -178,11 +178,11 @@ last_offset = offset+size; ret = phys_to_virt(last_pos*PAGE_SIZE + offset); } else { - size -= remaining_size; - areasize = (size+PAGE_SIZE-1)/PAGE_SIZE; + remaining_size = size - remaining_size; + areasize = (remaining_size+PAGE_SIZE-1)/PAGE_SIZE; ret = phys_to_virt(last_pos*PAGE_SIZE + offset); last_pos = start+areasize-1; - last_offset = size; + last_offset = remaining_size; } last_offset &= ~PAGE_MASK; } else { @@ -196,7 +196,7 @@ for (i = start; i < start+areasize; i++) if (test_and_set_bit(i, bootmem_map)) BUG(); - + memset(ret, 0, size); return ret; } diff -u --recursive --new-file v2.3.28/linux/mm/filemap.c linux/mm/filemap.c --- v2.3.28/linux/mm/filemap.c Thu Nov 11 20:11:55 1999 +++ linux/mm/filemap.c Mon Nov 22 12:46:37 1999 @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -1791,18 +1791,21 @@ struct dentry *dentry = file->f_dentry; struct inode *inode = dentry->d_inode; unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur; - loff_t pos = *ppos; + loff_t pos; struct page *page, **hash, *cached_page; unsigned long written; long status; int err; - if (pos < 0) - return -EINVAL; - cached_page = NULL; down(&inode->i_sem); + + pos = *ppos; + err = -EINVAL; + if (pos < 0) + goto out; + err = file->f_error; if (err) { file->f_error = 0; diff -u --recursive --new-file v2.3.28/linux/mm/highmem.c linux/mm/highmem.c --- v2.3.28/linux/mm/highmem.c Thu Nov 18 20:25:38 1999 +++ linux/mm/highmem.c Sat Nov 20 10:56:59 1999 @@ -70,9 +70,9 @@ return page; } - vaddr = kmap(page); + vaddr = kmap(highpage); copy_page((void *)vaddr, (void *)page_address(page)); - kunmap(page); + kunmap(highpage); /* Preserve the caching of the swap_entry. */ highpage->index = page->index; @@ -88,20 +88,6 @@ } /* - * Right now we initialize only a single pte table. It can be extended - * easily, subsequent pte tables have to be allocated in one physical - * chunk of RAM. - */ -#ifdef CONFIG_X86_PAE -#define LAST_PKMAP 2048 -#else -#define LAST_PKMAP 4096 -#endif -#define LAST_PKMAP_MASK (LAST_PKMAP-1) -#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) -#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) - -/* * Virtual_count is not a pure "count". * 0 means that it is not mapped, and has not been mapped * since a TLB flush - it is usable. @@ -135,7 +121,7 @@ pkmap_count[i] = 0; pte = pkmap_page_table[i]; if (pte_none(pte)) - continue; + BUG(); pte_clear(pkmap_page_table+i); page = pte_page(pte); page->virtual = 0; @@ -167,30 +153,27 @@ current->state = TASK_UNINTERRUPTIBLE; add_wait_queue(&pkmap_map_wait, &wait); spin_unlock(&kmap_lock); - // it's not quite possible to saturate the - // pkmap pool right now. - BUG(); schedule(); remove_wait_queue(&pkmap_map_wait, &wait); spin_lock(&kmap_lock); - } - /* Somebody else might have mapped it while we slept */ - if (page->virtual) - return page->virtual; + /* Somebody else might have mapped it while we slept */ + if (page->virtual) + return page->virtual; - /* Re-start */ - count = LAST_PKMAP; + /* Re-start */ + count = LAST_PKMAP; + } } vaddr = PKMAP_ADDR(last_pkmap_nr); pkmap_page_table[last_pkmap_nr] = mk_pte(page, kmap_prot); - /* * Subtle! For some reason if we dont do this TLB flush then * we get data corruption and weird behavior in dbench runs. * But invlpg this should not be necessery ... Any ideas? */ __flush_tlb_one(vaddr); + pkmap_count[last_pkmap_nr] = 1; page->virtual = vaddr; @@ -201,8 +184,6 @@ { unsigned long vaddr; - if (!PageHighMem(page)) - BUG(); /* * For highmem pages, we can't trust "virtual" until * after we have the lock. diff -u --recursive --new-file v2.3.28/linux/mm/memory.c linux/mm/memory.c --- v2.3.28/linux/mm/memory.c Thu Nov 11 20:11:55 1999 +++ linux/mm/memory.c Sat Nov 20 10:09:05 1999 @@ -39,14 +39,14 @@ #include #include #include -#include #include #include #include +#include +#include #include +#include -#include -#include unsigned long max_mapnr = 0; unsigned long num_physpages = 0; diff -u --recursive --new-file v2.3.28/linux/mm/mmap.c linux/mm/mmap.c --- v2.3.28/linux/mm/mmap.c Thu Nov 11 20:11:55 1999 +++ linux/mm/mmap.c Sat Nov 20 10:09:05 1999 @@ -14,7 +14,7 @@ #include #include -#include +#include /* description of effects of mapping type and prot in current implementation. * this is due to the limited x86 page protection hardware. The expected diff -u --recursive --new-file v2.3.28/linux/mm/mprotect.c linux/mm/mprotect.c --- v2.3.28/linux/mm/mprotect.c Mon Nov 1 13:56:27 1999 +++ linux/mm/mprotect.c Sat Nov 20 10:09:05 1999 @@ -9,7 +9,7 @@ #include #include -#include +#include static inline void change_pte_range(pmd_t * pmd, unsigned long address, unsigned long size, pgprot_t newprot) diff -u --recursive --new-file v2.3.28/linux/mm/mremap.c linux/mm/mremap.c --- v2.3.28/linux/mm/mremap.c Mon Nov 1 13:56:27 1999 +++ linux/mm/mremap.c Sat Nov 20 10:09:05 1999 @@ -11,7 +11,7 @@ #include #include -#include +#include extern int vm_enough_memory(long pages); diff -u --recursive --new-file v2.3.28/linux/mm/page_alloc.c linux/mm/page_alloc.c --- v2.3.28/linux/mm/page_alloc.c Thu Nov 11 20:11:55 1999 +++ linux/mm/page_alloc.c Tue Nov 23 10:20:58 1999 @@ -9,74 +9,25 @@ #include #include -#include #include #include #include -#include #include -#include #include -#include -#include /* for copy_to/from_user */ -#include - int nr_swap_pages = 0; int nr_lru_pages; LIST_HEAD(lru_cache); -/* - * Free area management - * - * The free_area_list arrays point to the queue heads of the free areas - * of different sizes - */ - -#if CONFIG_AP1000 -/* the AP+ needs to allocate 8MB contiguous, aligned chunks of ram - for the ring buffers */ -#define MAX_ORDER 12 -#else -#define MAX_ORDER 10 -#endif - -typedef struct free_area_struct { - struct list_head free_list; - unsigned int * map; -} free_area_t; - -#define ZONE_DMA 0 -#define ZONE_NORMAL 1 - -#ifdef CONFIG_HIGHMEM -# define ZONE_HIGHMEM 2 -# define NR_ZONES 3 -#else -# define NR_ZONES 2 -#endif - -typedef struct zone_struct { - spinlock_t lock; - unsigned long offset; - unsigned long size; - free_area_t free_area[MAX_ORDER]; - - unsigned long free_pages; - unsigned long pages_low, pages_high; - int low_on_memory; - char * name; -} zone_t; - -static zone_t zones[NR_ZONES] = +static zone_t zones [MAX_NR_ZONES] = { { name: "DMA" }, { name: "Normal" }, -#ifdef CONFIG_HIGHMEM { name: "HighMem" } -#endif }; +zonelist_t zonelists [NR_GFPINDEX]; + /* * Free_page() adds the page to the free lists. This is optimized for * fast normal cases (no error jumps taken normally). @@ -100,7 +51,7 @@ /* * Temporary debugging check. */ -#define BAD_RANGE(zone,x) ((((x)-mem_map) < zone->offset) || (((x)-mem_map) >= zone->offset+zone->size)) +#define BAD_RANGE(zone,x) (((zone) != (x)->zone) || (((x)-mem_map) < (zone)->offset) || (((x)-mem_map) >= (zone)->offset+(zone)->size)) /* * Buddy system. Hairy. You really aren't expected to understand this @@ -108,43 +59,50 @@ * Hint: -mask = 1+~mask */ -static inline void free_pages_ok (struct page *page, unsigned long map_nr, unsigned long order) +void __free_pages_ok (struct page *page, unsigned long order) { - struct free_area_struct *area; - unsigned long index, page_idx, mask, offset; - unsigned long flags; - struct page *buddy; + unsigned long index, page_idx, mask, flags; + free_area_t *area; + struct page *base; zone_t *zone; - int i; /* - * Which zone is this page belonging to. - * - * (NR_ZONES is low, and we do not want (yet) to introduce - * put page->zone, it increases the size of mem_map[] - * unnecesserily. This small loop is basically equivalent - * to the previous #ifdef jungle, speed-wise.) + * Subtle. We do not want to test this in the inlined part of + * __free_page() - it's a rare condition and just increases + * cache footprint unnecesserily. So we do an 'incorrect' + * decrement on page->count for reserved pages, but this part + * makes it safe. */ - i = NR_ZONES-1; - zone = zones + i; - for ( ; i >= 0; i--, zone--) - if (map_nr >= zone->offset) - break; + if (PageReserved(page)) + return; + + if (page-mem_map >= max_mapnr) + BUG(); + if (PageSwapCache(page)) + BUG(); + if (PageLocked(page)) + BUG(); + + zone = page->zone; mask = (~0UL) << order; - offset = zone->offset; - area = zone->free_area; - area += order; - page_idx = map_nr - zone->offset; - page_idx &= mask; + base = mem_map + zone->offset; + page_idx = page - base; + if (page_idx & ~mask) + BUG(); index = page_idx >> (1 + order); - mask = (~0UL) << order; + + area = zone->free_area + order; spin_lock_irqsave(&zone->lock, flags); zone->free_pages -= mask; while (mask + (1 << (MAX_ORDER-1))) { + struct page *buddy1, *buddy2; + + if (area >= zone->free_area + MAX_ORDER) + BUG(); if (!test_and_change_bit(index, area->map)) /* * the buddy page is still allocated. @@ -153,87 +111,52 @@ /* * Move the buddy up one level. */ - buddy = mem_map + offset + (page_idx ^ -mask); - page = mem_map + offset + page_idx; - if (BAD_RANGE(zone,buddy)) + buddy1 = base + (page_idx ^ -mask); + buddy2 = base + page_idx; + if (BAD_RANGE(zone,buddy1)) BUG(); - if (BAD_RANGE(zone,page)) + if (BAD_RANGE(zone,buddy2)) BUG(); - memlist_del(&buddy->list); + memlist_del(&buddy1->list); mask <<= 1; area++; index >>= 1; page_idx &= mask; } - memlist_add_head(&mem_map[offset + page_idx].list, &area->free_list); + memlist_add_head(&(base + page_idx)->list, &area->free_list); spin_unlock_irqrestore(&zone->lock, flags); } -/* - * Some ugly macros to speed up __get_free_pages().. - */ #define MARK_USED(index, order, area) \ change_bit((index) >> (1+(order)), (area)->map) -#define ADDRESS(x) (PAGE_OFFSET + ((x) << PAGE_SHIFT)) - -int __free_page (struct page *page) -{ - if (!PageReserved(page) && put_page_testzero(page)) { - if (PageSwapCache(page)) - PAGE_BUG(page); - if (PageLocked(page)) - PAGE_BUG(page); - - free_pages_ok(page, page-mem_map, 0); - return 1; - } - return 0; -} -int free_pages (unsigned long addr, unsigned long order) -{ - unsigned long map_nr = MAP_NR(addr); - - if (map_nr < max_mapnr) { - mem_map_t * map = mem_map + map_nr; - if (!PageReserved(map) && put_page_testzero(map)) { - if (PageSwapCache(map)) - PAGE_BUG(map); - if (PageLocked(map)) - PAGE_BUG(map); - free_pages_ok(map, map_nr, order); - return 1; - } - } - return 0; -} - -static inline unsigned long EXPAND (zone_t *zone, struct page *map, unsigned long index, - int low, int high, struct free_area_struct * area) +static inline struct page * expand (zone_t *zone, struct page *page, + unsigned long index, int low, int high, free_area_t * area) { unsigned long size = 1 << high; while (high > low) { - if (BAD_RANGE(zone,map)) + if (BAD_RANGE(zone,page)) BUG(); area--; high--; size >>= 1; - memlist_add_head(&(map)->list, &(area)->free_list); + memlist_add_head(&(page)->list, &(area)->free_list); MARK_USED(index, high, area); index += size; - map += size; + page += size; } - set_page_count(map, 1); - return index; + if (BAD_RANGE(zone,page)) + BUG(); + return page; } static inline struct page * rmqueue (zone_t *zone, unsigned long order) { - struct free_area_struct * area = zone->free_area + order; - unsigned long curr_order = order, map_nr; + free_area_t * area = zone->free_area + order; + unsigned long curr_order = order; struct list_head *head, *curr; unsigned long flags; struct page *page; @@ -247,15 +170,17 @@ unsigned int index; page = memlist_entry(curr, struct page, list); + if (BAD_RANGE(zone,page)) + BUG(); memlist_del(curr); - map_nr = page - mem_map; - index = map_nr - zone->offset; + index = (page - mem_map) - zone->offset; MARK_USED(index, curr_order, area); zone->free_pages -= 1 << order; - map_nr = zone->offset + EXPAND(zone, page, index, order, curr_order, area); + + page = expand(zone, page, index, order, curr_order, area); spin_unlock_irqrestore(&zone->lock, flags); - page = mem_map + map_nr; + set_page_count(page, 1); if (BAD_RANGE(zone,page)) BUG(); return page; @@ -268,11 +193,14 @@ return NULL; } -static inline int balance_memory (zone_t *zone, int gfp_mask) +#define ZONE_BALANCED(zone) \ + (((zone)->free_pages > (zone)->pages_low) && (!(zone)->low_on_memory)) + +static inline int zone_balance_memory (zone_t *zone, int gfp_mask) { int freed; - if (zone->free_pages > zone->pages_low) { + if (zone->free_pages >= zone->pages_low) { if (!zone->low_on_memory) return 1; /* @@ -283,8 +211,16 @@ zone->low_on_memory = 0; return 1; } - } - zone->low_on_memory = 1; + } else + zone->low_on_memory = 1; + + /* + * In the atomic allocation case we only 'kick' the + * state machine, but do not try to free pages + * ourselves. + */ + if (!(gfp_mask & __GFP_WAIT)) + return 1; current->flags |= PF_MEMALLOC; freed = try_to_free_pages(gfp_mask); @@ -295,39 +231,96 @@ return 1; } -static inline struct page * __get_pages (zone_t *zone, unsigned int gfp_mask, - unsigned long order) +/* + * We are still balancing memory in a global way: + */ +static inline int balance_memory (int gfp_mask) { - struct page *page; + unsigned long free = nr_free_pages(); + static int low_on_memory = 0; + int freed; - if (order >= MAX_ORDER) - goto nopage; + if (free >= freepages.low) { + if (!low_on_memory) + return 1; + /* + * Simple hysteresis: exit 'low memory mode' if + * the upper limit has been reached: + */ + if (free >= freepages.high) { + low_on_memory = 0; + return 1; + } + } else + low_on_memory = 1; /* - * If anyone calls gfp from interrupts nonatomically then it - * will sooner or later tripped up by a schedule(). + * In the atomic allocation case we only 'kick' the + * state machine, but do not try to free pages + * ourselves. */ + if (!(gfp_mask & __GFP_WAIT)) + return 1; + + current->flags |= PF_MEMALLOC; + freed = try_to_free_pages(gfp_mask); + current->flags &= ~PF_MEMALLOC; + + if (!freed && !(gfp_mask & (__GFP_MED | __GFP_HIGH))) + return 0; + return 1; +} + +/* + * This is the 'heart' of the zoned buddy allocator: + */ +struct page * __alloc_pages (zonelist_t *zonelist, unsigned long order) +{ + zone_t **zone, *z; + struct page *page; + int gfp_mask; /* - * If this is a recursive call, we'd better - * do our best to just allocate things without - * further thought. - */ - if (!(current->flags & PF_MEMALLOC)) - if (!balance_memory(zone, gfp_mask)) - goto nopage; - /* + * (If anyone calls gfp from interrupts nonatomically then it + * will sooner or later tripped up by a schedule().) + * * We are falling back to lower-level zones if allocation - * in a higher zone fails. This assumes a hierarchical - * dependency between zones, which is true currently. If - * you need something else then move this loop outside - * this function, into the zone-specific allocator. + * in a higher zone fails. */ - do { - page = rmqueue(zone, order); - if (page) - return page; - } while (zone-- != zones) ; + zone = zonelist->zones; + gfp_mask = zonelist->gfp_mask; + for (;;) { + z = *(zone++); + if (!z) + break; + if (!z->size) + BUG(); + /* + * If this is a recursive call, we'd better + * do our best to just allocate things without + * further thought. + */ + if (!(current->flags & PF_MEMALLOC)) + /* + * fastpath + */ + if (!ZONE_BALANCED(z)) + goto balance; + /* + * This is an optimization for the 'higher order zone + * is empty' case - it can happen even in well-behaved + * systems, think the page-cache filling up all RAM. + * We skip over empty zones. (this is not exact because + * we do not take the spinlock and it's not exact for + * the higher order case, but will do it for most things.) + */ +ready: + if (z->free_pages) { + page = rmqueue(z, order); + if (page) + return page; + } + } /* * If we can schedule, do so, and make sure to yield. @@ -341,37 +334,14 @@ nopage: return NULL; -} - -static inline zone_t * gfp_mask_to_zone (int gfp_mask) -{ - zone_t *zone; - -#if CONFIG_HIGHMEM - if (gfp_mask & __GFP_HIGHMEM) - zone = zones + ZONE_HIGHMEM; - else -#endif - if (gfp_mask & __GFP_DMA) - zone = zones + ZONE_DMA; - else - zone = zones + ZONE_NORMAL; - return zone; -} -unsigned long __get_free_pages (int gfp_mask, unsigned long order) -{ - struct page *page; - - page = __get_pages(gfp_mask_to_zone(gfp_mask), gfp_mask, order); - if (!page) - return 0; - return page_address(page); -} - -struct page * alloc_pages (int gfp_mask, unsigned long order) -{ - return __get_pages(gfp_mask_to_zone(gfp_mask), gfp_mask, order); +/* + * The main chunk of the balancing code is in this offline branch: + */ +balance: + if (!balance_memory(gfp_mask)) + goto nopage; + goto ready; } /* @@ -383,7 +353,7 @@ zone_t *zone; sum = 0; - for (zone = zones; zone < zones+NR_ZONES; zone++) + for (zone = zones; zone < zones + MAX_NR_ZONES; zone++) sum += zone->free_pages; return sum; } @@ -420,8 +390,9 @@ unsigned type; printk("Free pages: %6dkB (%6dkB HighMem)\n", - nr_free_pages()<<(PAGE_SHIFT-10), - nr_free_highpages()<<(PAGE_SHIFT-10)); + nr_free_pages() << (PAGE_SHIFT-10), + nr_free_highpages() << (PAGE_SHIFT-10)); + printk("( Free: %d, lru_cache: %d (%d %d %d) )\n", nr_free_pages(), nr_lru_pages, @@ -429,25 +400,33 @@ freepages.low, freepages.high); - for (type = 0; type < NR_ZONES; type++) { + for (type = 0; type < MAX_NR_ZONES; type++) { + struct list_head *head, *curr; zone_t *zone = zones + type; - unsigned long total = 0; + unsigned long nr, total, flags; printk(" %s: ", zone->name); - for (order = 0; order < MAX_ORDER; order++) { - unsigned long i, nr; - nr = 0; - for (i = 0; i < zone->size; i += 1<offset + i; - if (!page_count(page)) + total = 0; + if (zone->size) { + spin_lock_irqsave(&zone->lock, flags); + for (order = 0; order < MAX_ORDER; order++) { + head = &(zone->free_area + order)->free_list; + curr = head; + nr = 0; + for (;;) { + curr = memlist_next(curr); + if (curr == head) + break; nr++; + } + total += nr * (1 << order); + printk("%lu*%lukB ", nr, + (PAGE_SIZE>>10) << order); } - total += nr * ((PAGE_SIZE>>10) << order); - printk("%lu*%lukB ", nr, (unsigned long)((PAGE_SIZE>>10) << order)); + spin_unlock_irqrestore(&zone->lock, flags); } - printk("= %lukB)\n", total); + printk("= %lukB)\n", total * (PAGE_SIZE>>10)); } #ifdef SWAP_CACHE_INFO @@ -455,6 +434,55 @@ #endif } +/* + * Builds allocation fallback zone lists. We are basically ready + * to do NUMA-allocations, only this function has to be modified + * and the zonelists array be made per-CPU. + */ +static inline void build_zonelists (void) +{ + int i, j, k; + + for (i = 0; i < NR_GFPINDEX; i++) { + zonelist_t *zonelist; + zone_t *zone; + + zonelist = zonelists + i; + memset(zonelist, 0, sizeof(*zonelist)); + + zonelist->gfp_mask = i; + j = 0; + k = ZONE_NORMAL; + if (i & __GFP_HIGHMEM) + k = ZONE_HIGHMEM; + if (i & __GFP_DMA) + k = ZONE_DMA; + + switch (k) { + default: + BUG(); + /* + * fallthrough: + */ + case ZONE_HIGHMEM: + zone = zones + ZONE_HIGHMEM; + if (zone->size) { +#ifndef CONFIG_HIGHMEM + BUG(); +#endif + zonelist->zones[j++] = zone; + } + case ZONE_NORMAL: + zone = zones + ZONE_NORMAL; + if (zone->size) + zonelist->zones[j++] = zone; + case ZONE_DMA: + zonelist->zones[j++] = zones + ZONE_DMA; + } + zonelist->zones[j++] = NULL; + } +} + #define LONG_ALIGN(x) (((x)+(sizeof(long))-1)&~((sizeof(long))-1)) /* @@ -465,17 +493,18 @@ */ void __init free_area_init(unsigned int *zones_size) { - mem_map_t * p; + struct page * p; unsigned long i, j; unsigned long map_size; unsigned int totalpages, offset; totalpages = 0; - for (i = 0; i < NR_ZONES; i++) - totalpages += zones_size[i]; + for (i = 0; i < MAX_NR_ZONES; i++) { + unsigned long size = zones_size[i]; + totalpages += size; + } printk("totalpages: %08x\n", totalpages); - i = totalpages >> 7; /* * Select nr of pages we try to keep free for important stuff * with a minimum of 10 pages and a maximum of 256 pages, so @@ -498,7 +527,6 @@ */ map_size = totalpages*sizeof(struct page); mem_map = (struct page *) alloc_bootmem(map_size); - memset(mem_map, 0, map_size); /* * Initially all pages are reserved - free ones are freed @@ -514,31 +542,48 @@ } offset = 0; - for (j = 0; j < NR_ZONES; j++) { + for (j = 0; j < MAX_NR_ZONES; j++) { zone_t *zone = zones + j; unsigned long mask = -1; unsigned long size; size = zones_size[j]; + + printk("zone(%ld): %ld pages.\n", j, size); zone->size = size; + if (!size) + continue; + zone->offset = offset; - zone->pages_low = freepages.low; - zone->pages_high = freepages.high; + /* + * It's unnecessery to balance the high memory zone + */ + if (j != ZONE_HIGHMEM) { + zone->pages_low = freepages.low; + zone->pages_high = freepages.high; + } zone->low_on_memory = 0; + for (i = 0; i < size; i++) { + struct page *page = mem_map + offset + i; + page->zone = zone; + if (j != ZONE_HIGHMEM) + page->virtual = __page_address(page); + } + offset += size; for (i = 0; i < MAX_ORDER; i++) { unsigned long bitmap_size; - unsigned int * map; + memlist_init(&zone->free_area[i].free_list); mask += mask; size = (size + ~mask) & mask; bitmap_size = size >> i; bitmap_size = (bitmap_size + 7) >> 3; bitmap_size = LONG_ALIGN(bitmap_size); - map = (unsigned int *) alloc_bootmem(bitmap_size); - zone->free_area[i].map = map; - memset((void *) map, 0, bitmap_size); + zone->free_area[i].map = + (unsigned int *) alloc_bootmem(bitmap_size); } } + build_zonelists(); } diff -u --recursive --new-file v2.3.28/linux/mm/slab.c linux/mm/slab.c --- v2.3.28/linux/mm/slab.c Mon Nov 1 13:56:27 1999 +++ linux/mm/slab.c Sat Nov 20 10:09:05 1999 @@ -1043,20 +1043,12 @@ int kmem_cache_shrink(kmem_cache_t *cachep) { - if (!cachep) { - printk(KERN_ERR "kmem_shrink: NULL ptr\n"); - return 2; - } - if (in_interrupt()) { - printk(KERN_ERR "kmem_shrink: Called during int - %s\n", cachep->c_name); - return 2; - } - - if (!is_chained_kmem_cache(cachep)) { - printk(KERN_ERR "kmem_shrink: Invalid cache addr %p\n", - cachep); - return 2; - } + if (!cachep) + BUG(); + if (in_interrupt()) + BUG(); + if (!is_chained_kmem_cache(cachep)) + BUG(); return __kmem_cache_shrink(cachep); } diff -u --recursive --new-file v2.3.28/linux/mm/vmalloc.c linux/mm/vmalloc.c --- v2.3.28/linux/mm/vmalloc.c Thu Nov 11 20:11:55 1999 +++ linux/mm/vmalloc.c Sat Nov 20 10:09:05 1999 @@ -9,6 +9,7 @@ #include #include +#include struct vm_struct * vmlist = NULL; @@ -152,7 +153,7 @@ return 0; } -struct vm_struct * get_vm_area(unsigned long size) +struct vm_struct * get_vm_area(unsigned long size, unsigned long flags) { unsigned long addr; struct vm_struct **p, *tmp, *area; @@ -170,6 +171,7 @@ return NULL; } } + area->flags = flags; area->addr = (void *)addr; area->size = size + PAGE_SIZE; area->next = *p; @@ -208,7 +210,7 @@ BUG(); return NULL; } - area = get_vm_area(size); + area = get_vm_area(size, VM_ALLOC); if (!area) { BUG(); return NULL; diff -u --recursive --new-file v2.3.28/linux/mm/vmscan.c linux/mm/vmscan.c --- v2.3.28/linux/mm/vmscan.c Thu Nov 11 20:11:55 1999 +++ linux/mm/vmscan.c Sat Nov 20 10:09:05 1999 @@ -20,7 +20,7 @@ #include #include -#include +#include /* * The swap-out functions return 1 if they successfully @@ -505,7 +505,6 @@ allocations (not GFP_HIGHMEM ones). */ if (nr_free_buffer_pages() >= freepages.high) break; - if (!do_try_to_free_pages(GFP_KSWAPD)) break; run_task_queue(&tq_disk); diff -u --recursive --new-file v2.3.28/linux/net/802/tr.c linux/net/802/tr.c --- v2.3.28/linux/net/802/tr.c Mon Nov 1 13:56:27 1999 +++ linux/net/802/tr.c Fri Nov 19 11:33:29 1999 @@ -189,22 +189,27 @@ skb_pull(skb,sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); - tr_add_rif_info(trh, dev); - - if(*trh->daddr & 1) + if(*trh->daddr & 0x80) { if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN)) skb->pkt_type=PACKET_BROADCAST; else skb->pkt_type=PACKET_MULTICAST; } - + else if ( (trh->daddr[0] & 0x01) && (trh->daddr[1] & 0x00) && (trh->daddr[2] & 0x5E)) + { + skb->pkt_type=PACKET_MULTICAST; + } else if(dev->flags & IFF_PROMISC) { if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN)) skb->pkt_type=PACKET_OTHERHOST; } + if ((skb->pkt_type != PACKET_BROADCAST) && + (skb->pkt_type != PACKET_MULTICAST)) + tr_add_rif_info(trh,dev) ; + /* * Strip the SNAP header from ARP packets since we don't * pass them through to the 802.2/SNAP layers. @@ -231,13 +236,15 @@ unsigned int hash; rif_cache entry; unsigned char *olddata; + unsigned char mcast_func_addr[] = {0xC0,0x00,0x00,0x04,0x00,0x00}; spin_lock_bh(&rif_lock); /* * Broadcasts are single route as stated in RFC 1042 */ - if(!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) + if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) || + (!memcmp(&(trh->daddr[0]),&(mcast_func_addr[0]), TR_ALEN)) ) { trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); @@ -448,9 +455,9 @@ */ #ifndef CONFIG_PROC_FS -int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) {} +static int rif_get_info(char *buffer,char **start, off_t offset, int length) {} #else -int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) +static int rif_get_info(char *buffer,char **start, off_t offset, int length) { int len=0; off_t begin=0; diff -u --recursive --new-file v2.3.28/linux/net/appletalk/aarp.c linux/net/appletalk/aarp.c --- v2.3.28/linux/net/appletalk/aarp.c Mon Nov 1 13:56:27 1999 +++ linux/net/appletalk/aarp.c Fri Nov 19 11:33:29 1999 @@ -1055,7 +1055,7 @@ /* * Called from proc fs */ -int aarp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int aarp_get_info(char *buffer, char **start, off_t offset, int length) { /* we should dump all our AARP entries */ struct aarp_entry *entry; diff -u --recursive --new-file v2.3.28/linux/net/appletalk/ddp.c linux/net/appletalk/ddp.c --- v2.3.28/linux/net/appletalk/ddp.c Mon Nov 1 13:56:27 1999 +++ linux/net/appletalk/ddp.c Fri Nov 19 11:33:29 1999 @@ -214,7 +214,7 @@ /* * Called from proc fs */ -int atalk_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int atalk_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; int len=0; @@ -1038,7 +1038,7 @@ /* Called from proc fs - just make it print the ifaces neatly */ -int atalk_if_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int atalk_if_get_info(char *buffer, char **start, off_t offset, int length) { struct atalk_iface *iface; int len=0; @@ -1071,7 +1071,7 @@ /* Called from proc fs - just make it print the routes neatly */ -int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length) { struct atalk_route *rt; int len=0; diff -u --recursive --new-file v2.3.28/linux/net/atm/mpoa_proc.c linux/net/atm/mpoa_proc.c --- v2.3.28/linux/net/atm/mpoa_proc.c Thu Aug 26 13:05:42 1999 +++ linux/net/atm/mpoa_proc.c Thu Nov 18 20:02:02 1999 @@ -27,7 +27,7 @@ #define STAT_FILE_NAME "mpc" /* Our statistic file's name */ extern struct mpoa_client *mpcs; -extern struct proc_dir_entry atm_proc_root; /* from proc.c. */ +extern struct proc_dir_entry *atm_proc_root; /* from proc.c. */ static ssize_t proc_mpc_read(struct file *file, char *buff, size_t count, loff_t *pos); @@ -44,13 +44,6 @@ NULL, /* lseek */ proc_mpc_read, /* read */ proc_mpc_write, /* write */ - NULL, /* readdir */ - NULL, /* poll - default */ - NULL, /* ioctl - default */ - NULL, /* mmap */ - NULL, /* no special open code */ - NULL, /* no special release code */ - NULL /* no fsync */ }; /* @@ -58,41 +51,8 @@ */ static struct inode_operations mpc_inode_operations = { &mpc_file_operations, - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* bmap */ - NULL, /* truncate */ - NULL /* permission */ }; -/* - * Our statistics file - */ -static struct proc_dir_entry mpc_stats = { - 0, /* low_ino */ - sizeof(STAT_FILE_NAME)-1, /* name length */ - STAT_FILE_NAME, /* name */ - S_IFREG | S_IRUGO, /* mode */ - 1, /* 1=file */ - 0, /* UID */ - 0, /* GID */ - 0, /* size */ - &mpc_inode_operations, /* inode operations */ - NULL /* get_info func-ptr */ - -}; - static int print_header(char *buff,struct mpoa_client *mpc){ if(mpc != NULL){ return sprintf(buff,"\nInterface %d:\n\n",mpc->dev_num); @@ -364,12 +324,14 @@ */ int mpc_proc_init(void) { - int retval = 0; + struct proc_dir_entry *p; - if ( (retval = proc_register(&atm_proc_root,&mpc_stats)) != 0 ) { + p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root); + if (!p) { printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); - return retval; + return -ENOMEM; } + p->ops = &mpc_inode_operations; return 0; } @@ -378,7 +340,7 @@ */ void mpc_proc_clean(void) { - proc_unregister(&atm_proc_root,mpc_stats.low_ino); + remove_proc_entry(STAT_FILE_NAME,atm_proc_root); } diff -u --recursive --new-file v2.3.28/linux/net/atm/proc.c linux/net/atm/proc.c --- v2.3.28/linux/net/atm/proc.c Fri Sep 10 23:57:38 1999 +++ linux/net/atm/proc.c Thu Nov 18 20:02:02 1999 @@ -50,88 +50,28 @@ extern struct atm_lane_ops atm_lane_ops; /* in common.c */ #endif - -static ssize_t proc_atm_read(struct file *file,char *buf,size_t count, +static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, + loff_t *pos); +static ssize_t proc_spec_atm_read(struct file *file,char *buf,size_t count, loff_t *pos); - -static struct file_operations proc_atm_operations = { +static struct file_operations proc_dev_atm_operations = { NULL, /* lseek */ - proc_atm_read, /* read */ - NULL, /* write */ - NULL, /* readdir */ - NULL, /* select */ - NULL, /* ioctl */ - NULL, /* mmap */ - NULL, /* no special open code */ - NULL, /* no special release */ - NULL /* can't fsync */ + proc_dev_atm_read, /* read */ }; -struct inode_operations proc_atm_inode_operations = { - &proc_atm_operations, /* default ATM directory file-ops */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* bmap */ - NULL, /* truncate */ - NULL /* permission */ +static struct file_operations proc_spec_atm_operations = { + NULL, /* lseek */ + proc_spec_atm_read, /* read */ }; +static struct inode_operations proc_dev_atm_inode_operations = { + &proc_dev_atm_operations, /* default ATM directory file-ops */ +}; -#define ENTRY(name) static struct proc_dir_entry atm_proc_entry_##name = \ - { 0, sizeof(#name)-1, #name, S_IFREG | S_IRUGO, 1, 0, 0, 0, \ - &proc_atm_inode_operations, NULL } -#define REG(name) if (!error) error = proc_register(&atm_proc_root, \ - &atm_proc_entry_##name) -#define INO(name) (atm_proc_entry_##name.low_ino) - - -ENTRY(devices); -ENTRY(pvc); -ENTRY(svc); -#ifdef CONFIG_ATM_CLIP -ENTRY(arp); -#endif -#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) -ENTRY(lec); -#endif - - -static int atm_header(ino_t ino,char *buf) -{ - if (ino == INO(devices)) - return sprintf(buf,"Itf Type ESI/\"MAC\"addr " - "AAL(TX,err,RX,err,drop) ...\n"); - if (ino == INO(pvc)) - return sprintf(buf,"Itf VPI VCI AAL RX(PCR,Class) " - "TX(PCR,Class)\n"); - if (ino == INO(svc)) - return sprintf(buf,"Itf VPI VCI State Remote\n"); -#ifdef CONFIG_ATM_CLIP - if (ino == INO(arp)) - return sprintf(buf,"IPitf TypeEncp Idle IP address " - "ATM address\n"); -#endif -#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) - if (ino == INO(lec)) - return sprintf(buf,"Itf MAC ATM destination" - " Status Flags " - "VPI/VCI Recv VPI/VCI\n"); -#endif - return -EINVAL; -} - +static struct inode_operations proc_spec_atm_inode_operations = { + &proc_spec_atm_operations, /* default ATM directory file-ops */ +}; static void add_stats(char *buf,const char *aal, const struct atm_aal_stats *stats) @@ -340,154 +280,182 @@ #endif +static int atm_devices_info(loff_t pos,char *buf) +{ + struct atm_dev *dev; + int left; + + if (!pos) { + return sprintf(buf,"Itf Type ESI/\"MAC\"addr " + "AAL(TX,err,RX,err,drop) ...\n"); + } + left = pos-1; + for (dev = atm_devs; dev && left; dev = dev->next) left--; + if (!dev) return 0; + dev_info(dev,buf); + return strlen(buf); +} /* * FIXME: it isn't safe to walk the VCC list without turning off interrupts. * What is really needed is some lock on the devices. Ditto for ATMARP. */ -static int atm_info(ino_t ino,loff_t *pos,char *buf) +static int atm_pvc_info(loff_t pos,char *buf) { struct atm_dev *dev; struct atm_vcc *vcc; int left; - if (ino == INO(devices)) { - left = *pos-1; - for (dev = atm_devs; dev && left; dev = dev->next) left--; - if (!dev) return 0; - dev_info(dev,buf); - return strlen(buf); - } - if (ino == INO(pvc)) { - left = *pos-1; - for (dev = atm_devs; dev; dev = dev->next) - for (vcc = dev->vccs; vcc; vcc = vcc->next) - if (vcc->family == PF_ATMPVC && - vcc->dev && !left--) { - pvc_info(vcc,buf); - return strlen(buf); - } - return 0; - } - if (ino == INO(svc)) { - left = *pos-1; - for (dev = atm_devs; dev; dev = dev->next) - for (vcc = dev->vccs; vcc; vcc = vcc->next) - if (vcc->family == PF_ATMSVC && !left--) { - svc_info(vcc,buf); - return strlen(buf); - } - for (vcc = nodev_vccs; vcc; vcc = vcc->next) + if (!pos) { + return sprintf(buf,"Itf VPI VCI AAL RX(PCR,Class) " + "TX(PCR,Class)\n"); + } + left = pos-1; + for (dev = atm_devs; dev; dev = dev->next) + for (vcc = dev->vccs; vcc; vcc = vcc->next) + if (vcc->family == PF_ATMPVC && + vcc->dev && !left--) { + pvc_info(vcc,buf); + return strlen(buf); + } + return 0; +} + +static int atm_svc_info(loff_t pos,char *buf) +{ + struct atm_dev *dev; + struct atm_vcc *vcc; + int left; + + if (!pos) + return sprintf(buf,"Itf VPI VCI State Remote\n"); + left = pos-1; + for (dev = atm_devs; dev; dev = dev->next) + for (vcc = dev->vccs; vcc; vcc = vcc->next) if (vcc->family == PF_ATMSVC && !left--) { svc_info(vcc,buf); return strlen(buf); } - return 0; - } + for (vcc = nodev_vccs; vcc; vcc = vcc->next) + if (vcc->family == PF_ATMSVC && !left--) { + svc_info(vcc,buf); + return strlen(buf); + } + return 0; +} + #ifdef CONFIG_ATM_CLIP - if (ino == INO(arp)) { - struct neighbour *n; - int i,count; - - count = *pos; - read_lock_bh(&clip_tbl.lock); - for (i = 0; i <= NEIGH_HASHMASK; i++) - for (n = clip_tbl.hash_buckets[i]; n; n = n->next) { - struct atmarp_entry *entry = NEIGH2ENTRY(n); - struct clip_vcc *vcc; - - if (!entry->vccs) { - if (--count) continue; - atmarp_info(n->dev,entry,NULL,buf); - read_unlock_bh(&clip_tbl.lock); - return strlen(buf); - } - for (vcc = entry->vccs; vcc; - vcc = vcc->next) { - if (--count) continue; - atmarp_info(n->dev,entry,vcc,buf); - read_unlock_bh(&clip_tbl.lock); - return strlen(buf); - } - } - read_unlock_bh(&clip_tbl.lock); - return 0; +static int atm_arp_info(loff_t pos,char *buf) +{ + struct neighbour *n; + int i,count; + + if (!pos) { + return sprintf(buf,"IPitf TypeEncp Idle IP address " + "ATM address\n"); } -#endif -#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) - if (ino == INO(lec)) { - struct lec_priv *priv; - struct lec_arp_table *entry; - int i, count, d, e; - struct net_device **dev_lec; - - if (atm_lane_ops.get_lecs == NULL) - return 0; /* the lane module is not there yet */ - else - dev_lec = atm_lane_ops.get_lecs(); - - count = *pos; - for(d=0;dpriv)) continue; - for(i=0;ilec_arp_tables[i]; - for(;entry;entry=entry->next) { - if (--count) continue; - e=sprintf(buf,"%s ", - dev_lec[d]->name); - lec_info(entry,buf+e); - return strlen(buf); - } - } - for(entry=priv->lec_arp_empty_ones; entry; - entry=entry->next) { + count = pos; + read_lock_bh(&clip_tbl.lock); + for (i = 0; i <= NEIGH_HASHMASK; i++) + for (n = clip_tbl.hash_buckets[i]; n; n = n->next) { + struct atmarp_entry *entry = NEIGH2ENTRY(n); + struct clip_vcc *vcc; + + if (!entry->vccs) { if (--count) continue; - e=sprintf(buf,"%s ",dev_lec[d]->name); - lec_info(entry, buf+e); + atmarp_info(n->dev,entry,NULL,buf); + read_unlock_bh(&clip_tbl.lock); return strlen(buf); } - for(entry=priv->lec_no_forward; entry; - entry=entry->next) { + for (vcc = entry->vccs; vcc; + vcc = vcc->next) { if (--count) continue; - e=sprintf(buf,"%s ",dev_lec[d]->name); - lec_info(entry, buf+e); + atmarp_info(n->dev,entry,vcc,buf); + read_unlock_bh(&clip_tbl.lock); return strlen(buf); } - for(entry=priv->mcast_fwds; entry; - entry=entry->next) { + } + read_unlock_bh(&clip_tbl.lock); + return 0; +} +#endif + +#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) +static int atm_lec_info(loff_t pos,char *buf) +{ + struct lec_priv *priv; + struct lec_arp_table *entry; + int i, count, d, e; + struct net_device **dev_lec; + if (!pos) { + return sprintf(buf,"Itf MAC ATM destination" + " Status Flags " + "VPI/VCI Recv VPI/VCI\n"); + } + if (atm_lane_ops.get_lecs == NULL) + return 0; /* the lane module is not there yet */ + else + dev_lec = atm_lane_ops.get_lecs(); + + count = pos; + for(d=0;dpriv)) continue; + for(i=0;ilec_arp_tables[i]; + for(;entry;entry=entry->next) { if (--count) continue; - e=sprintf(buf,"%s ",dev_lec[d]->name); - lec_info(entry, buf+e); + e=sprintf(buf,"%s ", + dev_lec[d]->name); + lec_info(entry,buf+e); return strlen(buf); } } - return 0; + for(entry=priv->lec_arp_empty_ones; entry; + entry=entry->next) { + if (--count) continue; + e=sprintf(buf,"%s ",dev_lec[d]->name); + lec_info(entry, buf+e); + return strlen(buf); + } + for(entry=priv->lec_no_forward; entry; + entry=entry->next) { + if (--count) continue; + e=sprintf(buf,"%s ",dev_lec[d]->name); + lec_info(entry, buf+e); + return strlen(buf); + } + for(entry=priv->mcast_fwds; entry; + entry=entry->next) { + if (--count) continue; + e=sprintf(buf,"%s ",dev_lec[d]->name); + lec_info(entry, buf+e); + return strlen(buf); + } } -#endif - return -EINVAL; + return 0; } +#endif -static ssize_t proc_atm_read(struct file *file,char *buf,size_t count, +static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, loff_t *pos) { struct atm_dev *dev; unsigned long page; - int ino = file->f_dentry->d_inode->i_ino; int length; if (count < 0) return -EINVAL; page = get_free_page(GFP_KERNEL); if (!page) return -ENOMEM; - for (dev = atm_devs; dev; dev = dev->next) - if (dev->ops->proc_read && dev->proc_entry->low_ino == ino) - break; - if (dev) length = dev->ops->proc_read(dev,pos,(char *) page); - else if (*pos) length = atm_info(ino,pos,(char *) page); - else length = atm_header(ino,(char *) page); - if (length > count) length = -EINVAL; + dev = ((struct proc_dir_entry *)file->f_dentry->d_inode->u.generic_ip)->data; + if (!dev->ops->proc_read) + length = -EINVAL; + else { + length = dev->ops->proc_read(dev,pos,(char *) page); + if (length > count) length = -EINVAL; + } if (length >= 0) { if (copy_to_user(buf,(char *) page,length)) length = -EFAULT; (*pos)++; @@ -496,18 +464,32 @@ return length; } +static ssize_t proc_spec_atm_read(struct file *file,char *buf,size_t count, + loff_t *pos) +{ + unsigned long page; + int length; + int (*info)(loff_t,char *); + info = ((struct proc_dir_entry *)file->f_dentry->d_inode->u.generic_ip)->data; -struct proc_dir_entry atm_proc_root = { 0, 3, "atm", - S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, 0, &proc_dir_inode_operations, - NULL, NULL, NULL, NULL, NULL }; - + if (count < 0) return -EINVAL; + page = get_free_page(GFP_KERNEL); + if (!page) return -ENOMEM; + length = (*info)(*pos,(char *) page); + if (length > count) length = -EINVAL; + if (length >= 0) { + if (copy_to_user(buf,(char *) page,length)) length = -EFAULT; + (*pos)++; + } + free_page(page); + return length; +} +struct proc_dir_entry *atm_proc_root; EXPORT_SYMBOL(atm_proc_root); - int atm_proc_dev_register(struct atm_dev *dev) { - ENTRY(template); int digits,num; int error; @@ -515,45 +497,71 @@ digits = 0; for (num = dev->number; num; num /= 10) digits++; if (!digits) digits++; - dev->proc_entry = kmalloc(sizeof(*dev->proc_entry),GFP_KERNEL); - if (!dev->proc_entry) goto fail0; dev->proc_name = kmalloc(strlen(dev->type)+digits+2,GFP_KERNEL); if (!dev->proc_name) goto fail1; - *dev->proc_entry = atm_proc_entry_template; - dev->proc_entry->name = dev->proc_name; - dev->proc_entry->namelen = sprintf(dev->proc_name,"%s:%d",dev->type, - dev->number); - error = proc_register(&atm_proc_root,dev->proc_entry); - if (!error) return 0; - kfree(dev->proc_name); -fail1: + sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); + dev->proc_entry = create_proc_entry(dev->proc_name, 0, atm_proc_root); + if (!dev->proc_entry) + goto fail0; + dev->proc_entry->data = dev; + dev->proc_entry->ops = &proc_dev_atm_inode_operations; + return 0; kfree(dev->proc_entry); fail0: + kfree(dev->proc_name); +fail1: return error; } void atm_proc_dev_deregister(struct atm_dev *dev) { - proc_unregister(&atm_proc_root,dev->proc_entry->low_ino); - kfree(dev->proc_entry); + remove_proc_entry(dev->proc_name, atm_proc_root); kfree(dev->proc_name); } - int __init atm_proc_init(void) { - int error; - - error = proc_register(&proc_root,&atm_proc_root); - REG(devices); - REG(pvc); - REG(svc); + struct proc_dir_entry *dev=NULL,*pvc=NULL,*svc=NULL,*arp=NULL,*lec=NULL; + atm_proc_root = create_proc_entry("atm", S_IFDIR, &proc_root); + if (!atm_proc_root) + return -ENOMEM; + dev = create_proc_entry("devices",0,atm_proc_root); + if (!dev) + goto cleanup; + dev->data = atm_devices_info; + dev->ops = &proc_spec_atm_inode_operations; + pvc = create_proc_entry("pvc",0,atm_proc_root); + if (!pvc) + goto cleanup; + pvc->data = atm_pvc_info; + pvc->ops = &proc_spec_atm_inode_operations; + svc = create_proc_entry("svc",0,atm_proc_root); + if (!svc) + goto cleanup; + svc->data = atm_svc_info; + svc->ops = &proc_spec_atm_inode_operations; #ifdef CONFIG_ATM_CLIP - REG(arp); + arp = create_proc_entry("arp",0,atm_proc_root); + if (!arp) + goto cleanup; + arp->data = atm_arp_info; + arp->ops = &proc_spec_atm_inode_operations; #endif #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) - REG(lec); -#endif - return error; + lec = create_proc_entry("lec",0,atm_proc_root); + if (!lec) + goto cleanup; + lec->data = atm_lec_info; + lec->ops = &proc_spec_atm_inode_operations; +#endif + return 0; +cleanup: + if (dev) remove_proc_entry("devices",atm_proc_root); + if (pvc) remove_proc_entry("pvc",atm_proc_root); + if (svc) remove_proc_entry("svc",atm_proc_root); + if (arp) remove_proc_entry("arp",atm_proc_root); + if (lec) remove_proc_entry("lec",atm_proc_root); + remove_proc_entry("atm",&proc_root); + return -ENOMEM; } diff -u --recursive --new-file v2.3.28/linux/net/atm/resources.h linux/net/atm/resources.h --- v2.3.28/linux/net/atm/resources.h Thu Aug 26 13:05:42 1999 +++ linux/net/atm/resources.h Thu Nov 18 20:02:02 1999 @@ -22,8 +22,6 @@ #include -extern struct proc_dir_entry atm_proc_root; /* @@@ move elsewhere */ - int atm_proc_dev_register(struct atm_dev *dev); void atm_proc_dev_deregister(struct atm_dev *dev); diff -u --recursive --new-file v2.3.28/linux/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c --- v2.3.28/linux/net/ax25/af_ax25.c Mon Nov 1 13:56:27 1999 +++ linux/net/ax25/af_ax25.c Fri Nov 19 11:33:29 1999 @@ -1628,7 +1628,7 @@ return 0; } -static int ax25_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ax25_get_info(char *buffer, char **start, off_t offset, int length) { ax25_cb *ax25; int k; diff -u --recursive --new-file v2.3.28/linux/net/ax25/ax25_route.c linux/net/ax25/ax25_route.c --- v2.3.28/linux/net/ax25/ax25_route.c Wed Aug 18 11:38:48 1999 +++ linux/net/ax25/ax25_route.c Fri Nov 19 11:33:29 1999 @@ -236,7 +236,7 @@ return 0; } -int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length) { ax25_route *ax25_rt; int len = 0; diff -u --recursive --new-file v2.3.28/linux/net/ax25/ax25_uid.c linux/net/ax25/ax25_uid.c --- v2.3.28/linux/net/ax25/ax25_uid.c Thu Aug 26 13:05:45 1999 +++ linux/net/ax25/ax25_uid.c Fri Nov 19 11:33:29 1999 @@ -129,7 +129,7 @@ return -EINVAL; /*NOTREACHED */ } -int ax25_uid_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int ax25_uid_get_info(char *buffer, char **start, off_t offset, int length) { ax25_uid_assoc *pt; int len = 0; diff -u --recursive --new-file v2.3.28/linux/net/bridge/br.c linux/net/bridge/br.c --- v2.3.28/linux/net/bridge/br.c Thu Nov 18 20:25:38 1999 +++ linux/net/bridge/br.c Fri Nov 19 11:33:29 1999 @@ -806,7 +806,7 @@ /* Vova Oksman: Write the buffer (contents of the Bridge table) */ /* to a PROCfs file */ -int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int br_tree_get_info(char *buffer, char **start, off_t offset, int length) { int size; int len=0; diff -u --recursive --new-file v2.3.28/linux/net/core/dev.c linux/net/core/dev.c --- v2.3.28/linux/net/core/dev.c Thu Nov 11 20:11:55 1999 +++ linux/net/core/dev.c Fri Nov 19 11:33:29 1999 @@ -1228,7 +1228,7 @@ * to create /proc/net/dev */ -int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int dev_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t begin=0; @@ -1346,8 +1346,8 @@ * Print info for /proc/net/wireless (print all entries) * This is a clone of /proc/net/dev (just above) */ -int dev_get_wireless_info(char * buffer, char **start, off_t offset, - int length, int dummy) +static int dev_get_wireless_info(char * buffer, char **start, off_t offset, + int length) { int len = 0; off_t begin = 0; diff -u --recursive --new-file v2.3.28/linux/net/decnet/af_decnet.c linux/net/decnet/af_decnet.c --- v2.3.28/linux/net/decnet/af_decnet.c Mon Nov 1 13:56:27 1999 +++ linux/net/decnet/af_decnet.c Fri Nov 19 11:33:29 1999 @@ -1980,7 +1980,7 @@ NULL, }; -static int dn_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int dn_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *sk; struct dn_scp *scp; @@ -2036,7 +2036,7 @@ #ifdef CONFIG_DECNET_RAW -extern int dn_raw_get_info(char *, char **, off_t, int, int); +extern int dn_raw_get_info(char *, char **, off_t, int); #endif /* CONFIG_DECNET_RAW */ static struct net_proto_family dn_family_ops = { diff -u --recursive --new-file v2.3.28/linux/net/decnet/dn_dev.c linux/net/decnet/dn_dev.c --- v2.3.28/linux/net/decnet/dn_dev.c Mon Nov 1 13:56:27 1999 +++ linux/net/decnet/dn_dev.c Fri Nov 19 11:33:29 1999 @@ -1164,7 +1164,7 @@ return "?"; } -static int decnet_dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int decnet_dev_get_info(char *buffer, char **start, off_t offset, int length) { struct dn_dev *dn_db; struct net_device *dev; diff -u --recursive --new-file v2.3.28/linux/net/decnet/dn_fib.c linux/net/decnet/dn_fib.c --- v2.3.28/linux/net/decnet/dn_fib.c Mon Nov 1 13:56:27 1999 +++ linux/net/decnet/dn_fib.c Fri Nov 19 11:33:29 1999 @@ -759,7 +759,7 @@ return 0; } -static int decnet_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int decnet_rt_get_info(char *buffer, char **start, off_t offset, int length) { struct dn_fib_procfs pinfo; int i; diff -u --recursive --new-file v2.3.28/linux/net/decnet/dn_neigh.c linux/net/decnet/dn_neigh.c --- v2.3.28/linux/net/decnet/dn_neigh.c Mon Nov 1 13:56:27 1999 +++ linux/net/decnet/dn_neigh.c Fri Nov 19 11:33:29 1999 @@ -589,7 +589,7 @@ #ifdef CONFIG_PROC_FS -int dn_neigh_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int dn_neigh_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/decnet/dn_raw.c linux/net/decnet/dn_raw.c --- v2.3.28/linux/net/decnet/dn_raw.c Thu Aug 26 13:05:45 1999 +++ linux/net/decnet/dn_raw.c Fri Nov 19 11:33:29 1999 @@ -264,7 +264,7 @@ }; #ifdef CONFIG_PROC_FS -int dn_raw_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int dn_raw_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/decnet/dn_route.c linux/net/decnet/dn_route.c --- v2.3.28/linux/net/decnet/dn_route.c Mon Nov 1 13:56:27 1999 +++ linux/net/decnet/dn_route.c Fri Nov 19 11:33:29 1999 @@ -915,7 +915,7 @@ #ifdef CONFIG_PROC_FS -static int decnet_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int decnet_cache_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c --- v2.3.28/linux/net/ipv4/af_inet.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv4/af_inet.c Fri Nov 19 11:33:29 1999 @@ -119,12 +119,12 @@ atomic_t inet_sock_nr; -extern int raw_get_info(char *, char **, off_t, int, int); -extern int snmp_get_info(char *, char **, off_t, int, int); -extern int netstat_get_info(char *, char **, off_t, int, int); -extern int afinet_get_info(char *, char **, off_t, int, int); -extern int tcp_get_info(char *, char **, off_t, int, int); -extern int udp_get_info(char *, char **, off_t, int, int); +extern int raw_get_info(char *, char **, off_t, int); +extern int snmp_get_info(char *, char **, off_t, int); +extern int netstat_get_info(char *, char **, off_t, int); +extern int afinet_get_info(char *, char **, off_t, int); +extern int tcp_get_info(char *, char **, off_t, int); +extern int udp_get_info(char *, char **, off_t, int); extern void ip_mc_drop_socket(struct sock *sk); #ifdef CONFIG_DLCI diff -u --recursive --new-file v2.3.28/linux/net/ipv4/arp.c linux/net/ipv4/arp.c --- v2.3.28/linux/net/ipv4/arp.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv4/arp.c Fri Nov 19 11:33:29 1999 @@ -205,9 +205,12 @@ { switch (dev->type) { case ARPHRD_ETHER: - case ARPHRD_IEEE802: case ARPHRD_FDDI: - ip_eth_mc_map(addr, haddr); + case ARPHRD_IEEE802: + ip_eth_mc_map(addr, haddr) ; + return 0 ; + case ARPHRD_IEEE802_TR: + ip_tr_mc_map(addr, haddr) ; return 0; default: if (dir) { @@ -522,6 +525,12 @@ arp->ar_pro = __constant_htons(ETH_P_IP); break; #endif +#ifdef CONFIG_TR + case ARPHRD_IEEE802_TR: + arp->ar_hrd = __constant_htons(ARPHRD_IEEE802); + arp->ar_pro = __constant_htons(ETH_P_IP); + break; +#endif } arp->ar_hln = dev->addr_len; @@ -604,6 +613,19 @@ goto out; break; #endif +#ifdef CONFIG_TR + case ARPHRD_IEEE802_TR: + /* + * Token ring devices will accept ARP hardware types of either + * 1 (Ethernet) or 6 (IEEE 802.2). + */ + if (arp->ar_hrd != __constant_htons(ARPHRD_ETHER) && + arp->ar_hrd != __constant_htons(ARPHRD_IEEE802)) + goto out; + if (arp->ar_pro != __constant_htons(ETH_P_IP)) + goto out; + break; +#endif #ifdef CONFIG_FDDI case ARPHRD_FDDI: /* @@ -981,11 +1003,11 @@ * Write the contents of the ARP cache to a PROCfs file. */ #ifndef CONFIG_PROC_FS -static int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { return 0; } +static int arp_get_info(char *buffer, char **start, off_t offset, int length) { return 0; } #else #define HBUFFERLEN 30 -static int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int arp_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t pos=0; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/fib_frontend.c linux/net/ipv4/fib_frontend.c --- v2.3.28/linux/net/ipv4/fib_frontend.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv4/fib_frontend.c Fri Nov 19 11:33:29 1999 @@ -107,7 +107,7 @@ */ static int -fib_get_procinfo(char *buffer, char **start, off_t offset, int length, int dummy) +fib_get_procinfo(char *buffer, char **start, off_t offset, int length) { int first = offset/128; char *ptr = buffer; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/igmp.c linux/net/ipv4/igmp.c --- v2.3.28/linux/net/ipv4/igmp.c Thu Aug 26 13:05:45 1999 +++ linux/net/ipv4/igmp.c Fri Nov 19 11:33:29 1999 @@ -757,7 +757,7 @@ #ifdef CONFIG_IP_MULTICAST -int ip_mc_procinfo(char *buffer, char **start, off_t offset, int length, int dummy) +int ip_mc_procinfo(char *buffer, char **start, off_t offset, int length) { off_t pos=0, begin=0; struct ip_mc_list *im; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/ip_output.c linux/net/ipv4/ip_output.c --- v2.3.28/linux/net/ipv4/ip_output.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv4/ip_output.c Fri Nov 19 11:33:29 1999 @@ -1017,7 +1017,7 @@ ip_rt_init(); #ifdef CONFIG_IP_MULTICAST - proc_net_create("igmp", S_IFREG | S_IRUGO, ip_mc_procinfo); + proc_net_create("igmp", 0, ip_mc_procinfo); #endif } diff -u --recursive --new-file v2.3.28/linux/net/ipv4/ipmr.c linux/net/ipv4/ipmr.c --- v2.3.28/linux/net/ipv4/ipmr.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv4/ipmr.c Fri Nov 19 11:33:29 1999 @@ -1576,7 +1576,7 @@ * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif */ -int ipmr_vif_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ipmr_vif_info(char *buffer, char **start, off_t offset, int length) { struct vif_device *vif; int len=0; @@ -1622,7 +1622,7 @@ return len; } -int ipmr_mfc_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ipmr_mfc_info(char *buffer, char **start, off_t offset, int length) { struct mfc_cache *mfc; int len=0; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/proc.c linux/net/ipv4/proc.c --- v2.3.28/linux/net/ipv4/proc.c Sat Jul 3 17:57:22 1999 +++ linux/net/ipv4/proc.c Fri Nov 19 11:33:29 1999 @@ -53,7 +53,7 @@ /* * Report socket allocation statistics [mea@utu.fi] */ -int afinet_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int afinet_get_info(char *buffer, char **start, off_t offset, int length) { /* From net/socket.c */ extern int socket_get_info(char *, char **, off_t, int); @@ -85,7 +85,7 @@ * Called from the PROCfs module. This outputs /proc/net/snmp. */ -int snmp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int snmp_get_info(char *buffer, char **start, off_t offset, int length) { extern struct tcp_mib tcp_statistics; extern struct udp_mib udp_statistics; @@ -164,7 +164,7 @@ * Output /proc/net/netstat */ -int netstat_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int netstat_get_info(char *buffer, char **start, off_t offset, int length) { extern struct linux_mib net_statistics; int len; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/raw.c linux/net/ipv4/raw.c --- v2.3.28/linux/net/ipv4/raw.c Thu Aug 26 13:05:46 1999 +++ linux/net/ipv4/raw.c Fri Nov 19 11:33:29 1999 @@ -603,7 +603,7 @@ atomic_read(&sp->refcnt), sp); } -int raw_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int raw_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/route.c linux/net/ipv4/route.c --- v2.3.28/linux/net/ipv4/route.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv4/route.c Fri Nov 19 11:33:29 1999 @@ -202,9 +202,9 @@ } #ifndef CONFIG_PROC_FS -static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { return 0; } +static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length) { return 0; } #else -static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t pos=0; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/tcp_ipv4.c linux/net/ipv4/tcp_ipv4.c --- v2.3.28/linux/net/ipv4/tcp_ipv4.c Fri Oct 22 13:21:56 1999 +++ linux/net/ipv4/tcp_ipv4.c Fri Nov 19 11:33:29 1999 @@ -2076,7 +2076,7 @@ atomic_read(&tw->refcnt), tw); } -int tcp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int tcp_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t begin, pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipv4/udp.c linux/net/ipv4/udp.c --- v2.3.28/linux/net/ipv4/udp.c Thu Aug 26 13:05:46 1999 +++ linux/net/ipv4/udp.c Fri Nov 19 11:33:29 1999 @@ -1051,7 +1051,7 @@ atomic_read(&sp->refcnt), sp); } -int udp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int udp_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/addrconf.c linux/net/ipv6/addrconf.c --- v2.3.28/linux/net/ipv6/addrconf.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv6/addrconf.c Fri Nov 19 11:33:29 1999 @@ -1540,7 +1540,7 @@ #ifdef CONFIG_PROC_FS static int iface_proc_info(char *buffer, char **start, off_t offset, - int length, int dummy) + int length) { struct inet6_ifaddr *ifp; int i; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c --- v2.3.28/linux/net/ipv6/af_inet6.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv6/af_inet6.c Fri Nov 19 11:33:29 1999 @@ -73,11 +73,11 @@ /* IPv6 procfs goodies... */ #ifdef CONFIG_PROC_FS -extern int raw6_get_info(char *, char **, off_t, int, int); -extern int tcp6_get_info(char *, char **, off_t, int, int); -extern int udp6_get_info(char *, char **, off_t, int, int); -extern int afinet6_get_info(char *, char **, off_t, int, int); -extern int afinet6_get_snmp(char *, char **, off_t, int, int); +extern int raw6_get_info(char *, char **, off_t, int); +extern int tcp6_get_info(char *, char **, off_t, int); +extern int udp6_get_info(char *, char **, off_t, int); +extern int afinet6_get_info(char *, char **, off_t, int); +extern int afinet6_get_snmp(char *, char **, off_t, int); #endif #ifdef CONFIG_SYSCTL diff -u --recursive --new-file v2.3.28/linux/net/ipv6/ndisc.c linux/net/ipv6/ndisc.c --- v2.3.28/linux/net/ipv6/ndisc.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv6/ndisc.c Fri Nov 19 11:33:29 1999 @@ -1110,7 +1110,7 @@ #ifdef CONFIG_PROC_FS #ifndef CONFIG_RTNETLINK -int ndisc_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ndisc_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t pos=0; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/proc.c linux/net/ipv6/proc.c --- v2.3.28/linux/net/ipv6/proc.c Sat Jul 3 17:57:23 1999 +++ linux/net/ipv6/proc.c Fri Nov 19 11:33:29 1999 @@ -26,7 +26,7 @@ #include #include -int afinet6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int afinet6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; len += sprintf(buffer+len, "TCP6: inuse %d highest %d\n", @@ -122,8 +122,7 @@ }; -int afinet6_get_snmp(char *buffer, char **start, off_t offset, int length, - int dummy) +int afinet6_get_snmp(char *buffer, char **start, off_t offset, int length) { int len = 0; int i; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/raw.c linux/net/ipv6/raw.c --- v2.3.28/linux/net/ipv6/raw.c Thu Aug 26 13:05:46 1999 +++ linux/net/ipv6/raw.c Fri Nov 19 11:33:29 1999 @@ -715,7 +715,7 @@ atomic_read(&sp->refcnt), sp); } -int raw6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int raw6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/route.c linux/net/ipv6/route.c --- v2.3.28/linux/net/ipv6/route.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipv6/route.c Fri Nov 19 11:33:29 1999 @@ -1809,8 +1809,7 @@ return 0; } -static int rt6_proc_info(char *buffer, char **start, off_t offset, int length, - int dummy) +static int rt6_proc_info(char *buffer, char **start, off_t offset, int length) { struct rt6_proc_arg arg; arg.buffer = buffer; @@ -1839,8 +1838,7 @@ extern struct rt6_statistics rt6_stats; -static int rt6_proc_stats(char *buffer, char **start, off_t offset, int length, - int dummy) +static int rt6_proc_stats(char *buffer, char **start, off_t offset, int length) { int len; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c --- v2.3.28/linux/net/ipv6/tcp_ipv6.c Tue Aug 31 17:29:15 1999 +++ linux/net/ipv6/tcp_ipv6.c Fri Nov 19 11:33:29 1999 @@ -1988,7 +1988,7 @@ #define LINE_LEN 190 #define LINE_FMT "%-190s\n" -int tcp6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int tcp6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t begin, pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipv6/udp.c linux/net/ipv6/udp.c --- v2.3.28/linux/net/ipv6/udp.c Thu Aug 26 13:05:46 1999 +++ linux/net/ipv6/udp.c Fri Nov 19 11:33:29 1999 @@ -936,7 +936,7 @@ atomic_read(&sp->refcnt), sp); } -int udp6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int udp6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c --- v2.3.28/linux/net/ipx/af_ipx.c Mon Nov 1 13:56:27 1999 +++ linux/net/ipx/af_ipx.c Fri Nov 19 11:33:29 1999 @@ -1505,7 +1505,7 @@ /* Called from proc fs */ static int ipx_interface_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) + int length) { ipx_interface *i; off_t begin = 0, pos = 0; @@ -1548,8 +1548,7 @@ return (len); } -static int ipx_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +static int ipx_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; ipx_interface *i; @@ -1630,8 +1629,7 @@ return (len); } -static int ipx_rt_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +static int ipx_rt_get_info(char *buffer, char **start, off_t offset, int length) { ipx_route *rt; off_t begin = 0, pos = 0; diff -u --recursive --new-file v2.3.28/linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- v2.3.28/linux/net/irda/af_irda.c Sun Nov 7 16:37:34 1999 +++ linux/net/irda/af_irda.c Sun Nov 21 11:13:57 1999 @@ -107,7 +107,7 @@ return; sk->state = TCP_CLOSE; - sk->err = reason; + sk->err = ECONNRESET; sk->shutdown |= SEND_SHUTDOWN; if (!sk->dead) { sk->state_change(sk); @@ -341,6 +341,11 @@ static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name) { notify_t notify; + + if (self->tsap) { + WARNING(__FUNCTION__ "(), busy!\n"); + return -EBUSY; + } /* Initialize callbacks to be used by the IrDA stack */ irda_notify_init(¬ify); @@ -356,7 +361,7 @@ ¬ify); if (self->tsap == NULL) { IRDA_DEBUG( 0, __FUNCTION__ "(), Unable to allocate TSAP!\n"); - return -1; + return -ENOMEM; } /* Remember which TSAP selector we actually got */ self->stsap_sel = self->tsap->stsap_sel; @@ -437,10 +442,12 @@ * Just move to the listen state * */ -static int irda_listen( struct socket *sock, int backlog) +static int irda_listen(struct socket *sock, int backlog) { struct sock *sk = sock->sk; + IRDA_DEBUG(0, __FUNCTION__ "()\n"); + if (sk->type == SOCK_STREAM && sk->state != TCP_LISTEN) { sk->max_ack_backlog = backlog; sk->state = TCP_LISTEN; @@ -465,6 +472,8 @@ __u16 hints = 0; int err; + IRDA_DEBUG(0, __FUNCTION__ "()\n"); + self = sk->protinfo.irda; ASSERT(self != NULL, return -1;); @@ -474,7 +483,7 @@ err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); if (err < 0) - return -ENOMEM; + return err; /* Register with LM-IAS */ self->ias_obj = irias_new_object(addr->sir_name, jiffies); @@ -597,6 +606,8 @@ struct irda_sock *self; int err; + IRDA_DEBUG(0, __FUNCTION__ "()\n"); + self = sk->protinfo.irda; if (sk->state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { @@ -826,6 +837,9 @@ return -EPIPE; } + if (sk->state != TCP_ESTABLISHED) + return -ENOTCONN; + self = sk->protinfo.irda; ASSERT(self != NULL, return -1;); @@ -969,11 +983,6 @@ msg->msg_namelen = 0; - /* Lock the socket to prevent queue disordering - * while sleeps in memcpy_tomsg - */ -/* down(&self->readsem); */ - do { int chunk; struct sk_buff *skb; @@ -988,32 +997,20 @@ */ if (sk->err) { - /* up(&self->readsem); */ return sock_error(sk); } if (sk->shutdown & RCV_SHUTDOWN) break; - /* up(&self->readsem); */ - if (noblock) return -EAGAIN; irda_data_wait(sk); if (signal_pending(current)) return -ERESTARTSYS; - /* down(&self->readsem); */ continue; } - /* Never glue messages from different writers */ -/* if (check_creds && */ -/* memcmp(UNIXCREDS(skb), &scm->creds, sizeof(scm->creds)) != 0) */ -/* { */ -/* skb_queue_head(&sk->receive_queue, skb); */ -/* break; */ -/* } */ - chunk = min(skb->len, size); if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { skb_queue_head(&sk->receive_queue, skb); @@ -1024,17 +1021,10 @@ copied += chunk; size -= chunk; - /* Copy credentials */ -/* scm->creds = *UNIXCREDS(skb); */ -/* check_creds = 1; */ - /* Mark read part of skb as used */ if (!(flags & MSG_PEEK)) { skb_pull(skb, chunk); -/* if (UNIXCB(skb).fp) */ -/* unix_detach_fds(scm, skb); */ - /* put the skb back if we didn't use it up.. */ if (skb->len) { IRDA_DEBUG(1, __FUNCTION__ "(), back on q!\n"); @@ -1042,15 +1032,9 @@ break; } - kfree_skb(skb); - -/* if (scm->fp) */ -/* break; */ + kfree_skb(skb); } else { IRDA_DEBUG(0, __FUNCTION__ "() questionable!?\n"); - /* It is questionable, see note in unix_dgram_recvmsg. */ -/* if (UNIXCB(skb).fp) */ -/* scm->fp = scm_fp_dup(UNIXCB(skb).fp); */ /* put message back and return */ skb_queue_head(&sk->receive_queue, skb); @@ -1072,8 +1056,6 @@ } } - /* up(&self->readsem); */ - return copied; } @@ -1083,12 +1065,30 @@ * * */ -static int irda_shutdown( struct socket *sk, int how) +static int irda_shutdown(struct socket *sock, int how) { + struct irda_sock *self; + struct sock *sk = sock->sk; + IRDA_DEBUG( 0, __FUNCTION__ "()\n"); - /* FIXME - generate DM and RNR states */ - return -EOPNOTSUPP; + self = sk->protinfo.irda; + ASSERT(self != NULL, return -1;); + + sk->state = TCP_CLOSE; + sk->shutdown |= SEND_SHUTDOWN; + sk->state_change(sk); + + if (self->iriap) + iriap_close(self->iriap); + + if (self->tsap) { + irttp_disconnect_request(self->tsap, NULL, P_NORMAL); + irttp_close_tsap(self->tsap); + self->tsap = NULL; + } + + return 0; } /* @@ -1225,7 +1225,7 @@ switch (optname) { case IRLMP_IAS_SET: IRDA_DEBUG(0, __FUNCTION__ "(), sorry not impl. yet!\n"); - return 0; + return -ENOPROTOOPT; case IRTTP_MAX_SDU_SIZE: IRDA_DEBUG(2, __FUNCTION__ "(), setting max_sdu_size = %d\n", opt); self->max_sdu_size_rx = opt; @@ -1329,7 +1329,6 @@ break; case IRTTP_MAX_SDU_SIZE: val = self->max_data_size; - IRDA_DEBUG(2, __FUNCTION__ "(), getting max_sdu_size = %d\n", val); len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; diff -u --recursive --new-file v2.3.28/linux/net/irda/discovery.c linux/net/irda/discovery.c --- v2.3.28/linux/net/irda/discovery.c Wed Oct 27 16:34:12 1999 +++ linux/net/irda/discovery.c Fri Nov 19 11:33:29 1999 @@ -209,8 +209,7 @@ * Print discovery information in /proc file system * */ -int discovery_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int discovery_proc_read(char *buf, char **start, off_t offset, int len) { discovery_t *discovery; unsigned long flags; diff -u --recursive --new-file v2.3.28/linux/net/irda/ircomm/ircomm_core.c linux/net/irda/ircomm/ircomm_core.c --- v2.3.28/linux/net/irda/ircomm/ircomm_core.c Sun Nov 7 16:37:34 1999 +++ linux/net/irda/ircomm/ircomm_core.c Fri Nov 19 11:33:29 1999 @@ -52,8 +52,7 @@ struct sk_buff *skb, int clen); #ifdef CONFIG_PROC_FS -static int ircomm_proc_read(char *buf, char **start, off_t offset, int len, - int unused); +static int ircomm_proc_read(char *buf, char **start, off_t offset, int len); extern struct proc_dir_entry *proc_irda; #endif /* CONFIG_PROC_FS */ @@ -69,7 +68,7 @@ } #ifdef CONFIG_PROC_FS - create_proc_entry("ircomm", 0, proc_irda)->get_info = ircomm_proc_read; + create_proc_info_entry("ircomm", 0, proc_irda, ircomm_proc_read); #endif /* CONFIG_PROC_FS */ MESSAGE("IrCOMM protocol (Dag Brattli)\n"); @@ -463,13 +462,12 @@ #ifdef CONFIG_PROC_FS /* - * Function ircomm_proc_read (buf, start, offset, len, unused) + * Function ircomm_proc_read (buf, start, offset, len) * * * */ -int ircomm_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int ircomm_proc_read(char *buf, char **start, off_t offset, int len) { struct ircomm_cb *self; unsigned long flags; diff -u --recursive --new-file v2.3.28/linux/net/irda/irda_device.c linux/net/irda/irda_device.c --- v2.3.28/linux/net/irda/irda_device.c Wed Oct 27 16:34:12 1999 +++ linux/net/irda/irda_device.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sat Oct 9 09:22:27 1999 - * Modified at: Mon Oct 18 22:40:10 1999 + * Modified at: Tue Nov 16 12:54:13 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -200,6 +200,26 @@ req.ifr_rts = rts; ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCSDTRRTS); + + return ret; +} + +int irda_device_change_speed(struct net_device *dev, __u32 speed) +{ + struct if_irda_req req; + int ret; + + IRDA_DEBUG(0, __FUNCTION__ "()\n"); + + if (!dev->do_ioctl) { + ERROR(__FUNCTION__ "(), do_ioctl not impl. by " + "device driver\n"); + return -1; + } + + req.ifr_baudrate = speed; + + ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCSBANDWIDTH); return ret; } diff -u --recursive --new-file v2.3.28/linux/net/irda/iriap.c linux/net/irda/iriap.c --- v2.3.28/linux/net/irda/iriap.c Sun Nov 7 16:37:34 1999 +++ linux/net/irda/iriap.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Thu Aug 21 00:02:07 1997 - * Modified at: Sun Oct 31 22:10:45 1999 + * Modified at: Fri Nov 5 20:25:42 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -100,7 +100,7 @@ * Register some default services for IrLMP */ hints = irlmp_service_to_hint(S_COMPUTER); - hints |= irlmp_service_to_hint(S_PNP); + /*hints |= irlmp_service_to_hint(S_PNP);*/ service_handle = irlmp_register_service(hints); /* @@ -267,19 +267,16 @@ if (self->mode == IAS_CLIENT) { IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as client\n"); + + iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION, + NULL); /* * Inform service user that the request failed by sending - * it a NULL value. + * it a NULL value. Warning, the client might close us, so + * remember no to use self anymore after calling confirm */ if (self->confirm) self->confirm(IAS_DISCONNECT, 0, NULL, self->priv); - - - iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION, - NULL); - /* Close instance only if client */ - /* iriap_close(self); */ - } else { IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as server\n"); iriap_do_server_event(self, IAP_LM_DISCONNECT_INDICATION, @@ -497,6 +494,9 @@ /* Finished, close connection! */ iriap_disconnect_request(self); + /* Warning, the client might close us, so remember no to use self + * anymore after calling confirm + */ if (self->confirm) self->confirm(IAS_SUCCESS, obj_id, value, self->priv); } @@ -794,7 +794,11 @@ WARNING(__FUNCTION__ "(), No such class!\n"); /* Finished, close connection! */ iriap_disconnect_request(self); - + + /* + * Warning, the client might close us, so remember + * no to use self anymore after calling confirm + */ if (self->confirm) self->confirm(IAS_CLASS_UNKNOWN, 0, NULL, self->priv); @@ -804,13 +808,15 @@ /* Finished, close connection! */ iriap_disconnect_request(self); + /* + * Warning, the client might close us, so remember + * no to use self anymore after calling confirm + */ if (self->confirm) self->confirm(IAS_CLASS_UNKNOWN, 0, NULL, self->priv); break; - } - - /* iriap_close(self); */ + } break; default: IRDA_DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n", @@ -883,7 +889,7 @@ "IAS_STRING" }; -int irias_proc_read(char *buf, char **start, off_t offset, int len, int unused) +int irias_proc_read(char *buf, char **start, off_t offset, int len) { struct ias_object *obj; struct ias_attrib *attrib; diff -u --recursive --new-file v2.3.28/linux/net/irda/irlan/irlan_common.c linux/net/irda/irlan/irlan_common.c --- v2.3.28/linux/net/irda/irlan/irlan_common.c Sun Nov 7 16:37:34 1999 +++ linux/net/irda/irlan/irlan_common.c Fri Nov 19 11:33:29 1999 @@ -96,8 +96,7 @@ void irlan_close_tsaps(struct irlan_cb *self); #ifdef CONFIG_PROC_FS -static int irlan_proc_read(char *buf, char **start, off_t offset, int len, - int unused); +static int irlan_proc_read(char *buf, char **start, off_t offset, int len); extern struct proc_dir_entry *proc_irda; #endif /* CONFIG_PROC_FS */ @@ -1155,8 +1154,7 @@ * * Give some info to the /proc file system */ -static int irlan_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +static int irlan_proc_read(char *buf, char **start, off_t offset, int len) { struct irlan_cb *self; unsigned long flags; diff -u --recursive --new-file v2.3.28/linux/net/irda/irlap.c linux/net/irda/irlap.c --- v2.3.28/linux/net/irda/irlap.c Wed Oct 27 16:34:12 1999 +++ linux/net/irda/irlap.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Stable * Author: Dag Brattli * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Fri Oct 8 23:17:36 1999 + * Modified at: Tue Nov 16 10:01:06 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. @@ -65,7 +65,7 @@ }; #ifdef CONFIG_PROC_FS -int irlap_proc_read(char *, char **, off_t, int, int); +int irlap_proc_read(char *, char **, off_t, int); #endif /* CONFIG_PROC_FS */ @@ -849,16 +849,18 @@ * Change the speed of the IrDA port * */ -void irlap_change_speed(struct irlap_cb *self, __u32 speed) +void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now) { - IRDA_DEBUG(4, __FUNCTION__ "(), setting speed to %d\n", speed); + IRDA_DEBUG(0, __FUNCTION__ "(), setting speed to %d\n", speed); ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); - /* Must use the same speed in both directions */ - self->qos_rx.baud_rate.value = speed; - self->qos_tx.baud_rate.value = speed; + self->speed = speed; + + /* Change speed now, or just piggyback speed on frames */ + if (now) + irda_device_change_speed(self->netdev, speed); } #ifdef CONFIG_IRDA_COMPRESSION @@ -878,16 +880,16 @@ * you get when you do a little bit flicking :-) */ IRDA_DEBUG(4, __FUNCTION__ "(), comp bits 0x%02x\n", - self->qos_rx.compression.bits); + self->qos_rx.compression.bits); mask = 0x80; /* Start with testing MSB */ for (i=0;i<8;i++) { IRDA_DEBUG(4, __FUNCTION__ "(), testing bit %d\n", 8-i); if (self->qos_rx.compression.bits & mask) { - IRDA_DEBUG(4, __FUNCTION__ "(), bit %d is set by defalt\n", - 8-i); + IRDA_DEBUG(4, __FUNCTION__ + "(), bit %d is set by defalt\n", 8-i); comp = hashbin_find(irlap_compressors, - compression[ msb_index(mask)], - NULL); + compression[msb_index(mask)], + NULL); if (!comp) { /* Protocol not supported, so clear the bit */ IRDA_DEBUG(4, __FUNCTION__ "(), Compression " @@ -984,7 +986,7 @@ ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); - irlap_change_speed(self, 9600); + irlap_change_speed(self, 9600, TRUE); /* Default value in NDM */ self->bofs_count = 11; @@ -1017,7 +1019,7 @@ ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); - irlap_change_speed(self, qos->baud_rate.value); + irlap_change_speed(self, qos->baud_rate.value, FALSE); self->window_size = qos->window_size.value; self->window = qos->window_size.value; @@ -1085,13 +1087,12 @@ #ifdef CONFIG_PROC_FS /* - * Function irlap_proc_read (buf, start, offset, len, unused) + * Function irlap_proc_read (buf, start, offset, len) * * Give some info to the /proc file system * */ -int irlap_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int irlap_proc_read(char *buf, char **start, off_t offset, int len) { struct irlap_cb *self; unsigned long flags; diff -u --recursive --new-file v2.3.28/linux/net/irda/irlap_event.c linux/net/irda/irlap_event.c --- v2.3.28/linux/net/irda/irlap_event.c Wed Oct 27 16:34:13 1999 +++ linux/net/irda/irlap_event.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sat Aug 16 00:59:29 1997 - * Modified at: Sun Oct 10 11:14:22 1999 + * Modified at: Tue Nov 16 12:33:41 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -343,8 +343,9 @@ irlap_connect_indication(self, skb); } else { - IRDA_DEBUG(0, __FUNCTION__ "(), SNRM frame does not contain" - " and I field!\n"); + IRDA_DEBUG(0, __FUNCTION__ + "(), SNRM frame does not contain" + " and I field!\n"); dev_kfree_skb(skb); } break; @@ -601,36 +602,48 @@ irlap_qos_negotiate(self, skb); - irlap_initiate_connection_state( self); + irlap_initiate_connection_state(self); - /* - * We are allowed to send two frames! +#if 0 + /* + * We are allowed to send two frames, but this may increase + * the connect latency, so lets not do it for now. */ irlap_send_ua_response_frame(self, &self->qos_rx); - irlap_send_ua_response_frame(self, &self->qos_rx); - +#endif + + /* + * Applying the parameters now will make sure we change speed + * after we have sent the next frame + */ irlap_apply_connection_parameters(self, &self->qos_tx); + /* + * Sending this frame will force a speed change after it has + * been sent + */ + irlap_send_ua_response_frame(self, &self->qos_rx); + /* * The WD-timer could be set to the duration of the P-timer * for this case, but it is recommended to use twice the * value (note 3 IrLAP p. 60). */ irlap_start_wd_timer(self, self->wd_timeout); - irlap_next_state( self, LAP_NRM_S); + irlap_next_state(self, LAP_NRM_S); break; case RECV_DISCOVERY_XID_CMD: - IRDA_DEBUG( 3, __FUNCTION__ "(), event RECV_DISCOVER_XID_CMD!\n"); - irlap_next_state( self, LAP_NDM); + IRDA_DEBUG(3, __FUNCTION__ "(), event RECV_DISCOVER_XID_CMD!\n"); + irlap_next_state(self, LAP_NDM); break; case DISCONNECT_REQUEST: - irlap_send_dm_frame( self); + irlap_send_dm_frame(self); irlap_next_state( self, LAP_CONN); break; default: - IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event, - irlap_event[event]); - + IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event, + irlap_event[event]); + if (skb) dev_kfree_skb(skb); @@ -739,8 +752,8 @@ irlap_apply_connection_parameters(self, &self->qos_tx); self->retry_count = 0; - /* This frame will just be sent at the old speed */ - /* irlap_send_rr_frame( self, CMD_FRAME); */ + /* This frame will actually force the speed change */ + irlap_send_rr_frame(self, CMD_FRAME); irlap_start_final_timer(self, self->final_timeout/2); irlap_next_state(self, LAP_NRM_P); diff -u --recursive --new-file v2.3.28/linux/net/irda/irlap_frame.c linux/net/irda/irlap_frame.c --- v2.3.28/linux/net/irda/irlap_frame.c Wed Oct 27 16:34:13 1999 +++ linux/net/irda/irlap_frame.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Aug 19 10:27:26 1997 - * Modified at: Sat Oct 9 09:42:11 1999 + * Modified at: Fri Nov 5 09:45:58 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -60,7 +60,7 @@ */ cb->magic = LAP_MAGIC; cb->mtt = self->mtt_required; - cb->speed = self->qos_tx.baud_rate.value; + cb->speed = self->speed; /* Reset */ self->mtt_required = 0; diff -u --recursive --new-file v2.3.28/linux/net/irda/irlmp.c linux/net/irda/irlmp.c --- v2.3.28/linux/net/irda/irlmp.c Wed Oct 27 16:34:13 1999 +++ linux/net/irda/irlmp.c Fri Nov 19 11:33:29 1999 @@ -63,7 +63,7 @@ __u8 *irlmp_hint_to_service(__u8 *hint); #ifdef CONFIG_PROC_FS -int irlmp_proc_read(char *buf, char **start, off_t offst, int len, int unused); +int irlmp_proc_read(char *buf, char **start, off_t offst, int len); #endif /* @@ -1431,13 +1431,12 @@ #ifdef CONFIG_PROC_FS /* - * Function irlmp_proc_read (buf, start, offset, len, unused) + * Function irlmp_proc_read (buf, start, offset, len) * * Give some info to the /proc file system * */ -int irlmp_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int irlmp_proc_read(char *buf, char **start, off_t offset, int len) { struct lsap_cb *self; struct lap_cb *lap; diff -u --recursive --new-file v2.3.28/linux/net/irda/irmod.c linux/net/irda/irmod.c --- v2.3.28/linux/net/irda/irmod.c Thu Nov 11 20:11:56 1999 +++ linux/net/irda/irmod.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Mon Dec 15 13:55:39 1997 - * Modified at: Sun Oct 31 20:31:01 1999 + * Modified at: Sun Nov 14 08:57:52 1999 * Modified by: Dag Brattli * * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. diff -u --recursive --new-file v2.3.28/linux/net/irda/irproc.c linux/net/irda/irproc.c --- v2.3.28/linux/net/irda/irproc.c Thu Nov 18 20:25:38 1999 +++ linux/net/irda/irproc.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Thomas Davis, * Created at: Sat Feb 21 21:33:24 1998 - * Modified at: Fri Oct 8 09:26:46 1999 + * Modified at: Sun Nov 14 08:54:54 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999, Dag Brattli @@ -33,20 +33,15 @@ #include #include -extern int irlap_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int irlmp_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int irttp_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int irias_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int discovery_proc_read(char *buf, char **start, off_t offset, int len, - int unused); +extern int irlap_proc_read(char *buf, char **start, off_t offset, int len); +extern int irlmp_proc_read(char *buf, char **start, off_t offset, int len); +extern int irttp_proc_read(char *buf, char **start, off_t offset, int len); +extern int irias_proc_read(char *buf, char **start, off_t offset, int len); +extern int discovery_proc_read(char *buf, char **start, off_t offset, int len); struct irda_entry { char *name; - int (*fn)(char*, char**, off_t, int, int); + int (*fn)(char*, char**, off_t, int); }; struct proc_dir_entry *proc_irda; diff -u --recursive --new-file v2.3.28/linux/net/irda/irttp.c linux/net/irda/irttp.c --- v2.3.28/linux/net/irda/irttp.c Wed Oct 27 16:34:13 1999 +++ linux/net/irda/irttp.c Fri Nov 19 11:33:29 1999 @@ -1477,11 +1477,11 @@ #ifdef CONFIG_PROC_FS /* - * Function irttp_proc_read (buf, start, offset, len, unused) + * Function irttp_proc_read (buf, start, offset, len) * * Give some info to the /proc file system */ -int irttp_proc_read(char *buf, char **start, off_t offset, int len, int unused) +int irttp_proc_read(char *buf, char **start, off_t offset, int len) { struct tsap_cb *self; unsigned long flags; diff -u --recursive --new-file v2.3.28/linux/net/irda/parameters.c linux/net/irda/parameters.c --- v2.3.28/linux/net/irda/parameters.c Wed Oct 27 16:34:13 1999 +++ linux/net/irda/parameters.c Sun Nov 21 11:13:57 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Mon Jun 7 10:25:11 1999 - * Modified at: Tue Oct 5 11:52:54 1999 + * Modified at: Fri Nov 5 08:20:38 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -468,9 +468,6 @@ /* Find expected data type for this parameter identifier (pi)*/ type = pi_minor_info->type; - IRDA_DEBUG(3, __FUNCTION__ "(), pi=[%d,%d], type=%d\n", - pi_major, pi_minor, type); - /* Check if handler has been implemented */ if (!pi_minor_info->func) { MESSAGE(__FUNCTION__"(), no handler for pi=%#x\n", pi); diff -u --recursive --new-file v2.3.28/linux/net/irda/qos.c linux/net/irda/qos.c --- v2.3.28/linux/net/irda/qos.c Wed Oct 27 16:34:13 1999 +++ linux/net/irda/qos.c Sun Nov 21 11:13:57 1999 @@ -7,7 +7,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Sep 9 00:00:26 1997 - * Modified at: Tue Oct 5 11:50:41 1999 + * Modified at: Tue Nov 16 09:50:19 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -289,7 +289,7 @@ IRDA_DEBUG(2, "Final BAUD_RATE: 0x%04x\n", final); self->qos_tx.baud_rate.bits = final; - self->qos_rx.baud_rate.bits = final; + self->qos_rx.baud_rate.bits = final; } return 0; diff -u --recursive --new-file v2.3.28/linux/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c --- v2.3.28/linux/net/netrom/af_netrom.c Mon Nov 1 13:56:27 1999 +++ linux/net/netrom/af_netrom.c Fri Nov 19 11:33:29 1999 @@ -1163,7 +1163,7 @@ return 0; } -static int nr_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int nr_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; struct net_device *dev; diff -u --recursive --new-file v2.3.28/linux/net/netrom/nr_route.c linux/net/netrom/nr_route.c --- v2.3.28/linux/net/netrom/nr_route.c Thu Aug 26 13:05:46 1999 +++ linux/net/netrom/nr_route.c Fri Nov 19 11:33:29 1999 @@ -751,8 +751,7 @@ return (nr_neigh->ax25 != NULL); } -int nr_nodes_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length) { struct nr_node *nr_node; int len = 0; @@ -801,8 +800,7 @@ return len; } -int nr_neigh_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length) { struct nr_neigh *nr_neigh; int len = 0; diff -u --recursive --new-file v2.3.28/linux/net/netsyms.c linux/net/netsyms.c --- v2.3.28/linux/net/netsyms.c Tue Aug 31 17:29:15 1999 +++ linux/net/netsyms.c Thu Nov 18 19:25:28 1999 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -444,7 +445,12 @@ EXPORT_SYMBOL(register_trdev); EXPORT_SYMBOL(unregister_trdev); EXPORT_SYMBOL(init_trdev); -EXPORT_SYMBOL(tr_freedev); +#endif + +#ifdef CONFIG_NET_FC +EXPORT_SYMBOL(register_fcdev); +EXPORT_SYMBOL(unregister_fcdev); +EXPORT_SYMBOL(init_fcdev); #endif /* Device callback registration */ diff -u --recursive --new-file v2.3.28/linux/net/rose/af_rose.c linux/net/rose/af_rose.c --- v2.3.28/linux/net/rose/af_rose.c Mon Nov 1 13:56:27 1999 +++ linux/net/rose/af_rose.c Fri Nov 19 11:33:29 1999 @@ -1354,7 +1354,7 @@ return 0; } -static int rose_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int rose_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; struct net_device *dev; diff -u --recursive --new-file v2.3.28/linux/net/rose/rose_route.c linux/net/rose/rose_route.c --- v2.3.28/linux/net/rose/rose_route.c Thu Aug 26 13:05:46 1999 +++ linux/net/rose/rose_route.c Fri Nov 19 11:33:29 1999 @@ -968,8 +968,7 @@ return 1; } -int rose_nodes_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int rose_nodes_get_info(char *buffer, char **start, off_t offset, int length) { struct rose_node *rose_node; int len = 0; @@ -1020,8 +1019,7 @@ return len; } -int rose_neigh_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int rose_neigh_get_info(char *buffer, char **start, off_t offset, int length) { struct rose_neigh *rose_neigh; int len = 0; @@ -1075,8 +1073,7 @@ return len; } -int rose_routes_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int rose_routes_get_info(char *buffer, char **start, off_t offset, int length) { struct rose_route *rose_route; int len = 0; diff -u --recursive --new-file v2.3.28/linux/net/wanrouter/wanproc.c linux/net/wanrouter/wanproc.c --- v2.3.28/linux/net/wanrouter/wanproc.c Mon Nov 1 13:56:27 1999 +++ linux/net/wanrouter/wanproc.c Sat Nov 20 16:34:20 1999 @@ -65,25 +65,13 @@ /* Methods for preparing data for reading proc entries */ -static int config_get_info(char* buf, char** start, off_t offs, int len, int dummy); -static int status_get_info(char* buf, char** start, off_t offs, int len, int dummy); -static int wandev_get_info(char* buf, char** start, off_t offs, int len, int dummy); +static int config_get_info(char* buf, char** start, off_t offs, int len); +static int status_get_info(char* buf, char** start, off_t offs, int len); +static int wandev_get_info(char* buf, char** start, off_t offs, int len); /* Miscellaneous */ /* - * Global Data - */ - -/* - * Names of the proc directory entries - */ - -static char name_root[] = ROUTER_NAME; -static char name_conf[] = "config"; -static char name_stat[] = "status"; - -/* * Structures for interfacing with the /proc filesystem. * Router creates its own directory /proc/net/router with the folowing * entries: @@ -179,67 +167,10 @@ }; /* - * Proc filesystem directory entries. - */ - -/* * /proc/net/router */ -static struct proc_dir_entry proc_router = -{ - 0, /* .low_ino */ - sizeof(name_root) - 1, /* .namelen */ - name_root, /* .name */ - 0555 | S_IFDIR, /* .mode */ - 2, /* .nlink */ -}; - -/* - * /proc/net/router/config - */ - -static struct proc_dir_entry proc_router_conf = -{ - 0, /* .low_ino */ - sizeof(name_conf) - 1, /* .namelen */ - name_conf, /* .name */ - 0444 | S_IFREG, /* .mode */ - 1, /* .nlink */ - 0, /* .uid */ - 0, /* .gid */ - 0, /* .size */ - &router_inode, /* .ops */ - &config_get_info, /* .get_info */ - NULL, /* .fill_node */ - NULL, /* .next */ - NULL, /* .parent */ - NULL, /* .subdir */ - NULL, /* .data */ -}; - -/* - * /proc/net/router/status - */ - -static struct proc_dir_entry proc_router_stat = -{ - 0, /* .low_ino */ - sizeof(name_stat) - 1, /* .namelen */ - name_stat, /* .name */ - 0444 | S_IFREG, /* .mode */ - 1, /* .nlink */ - 0, /* .uid */ - 0, /* .gid */ - 0, /* .size */ - &router_inode, /* .ops */ - status_get_info, /* .get_info */ - NULL, /* .fill_node */ - NULL, /* .next */ - NULL, /* .parent */ - NULL, /* .subdir */ - NULL, /* .data */ -}; +static struct proc_dir_entry *proc_router; /* Strings */ static char conf_hdr[] = @@ -261,14 +192,28 @@ int __init wanrouter_proc_init (void) { - int err = proc_register(proc_net, &proc_router); - - if (!err) - { - proc_register(&proc_router, &proc_router_conf); - proc_register(&proc_router, &proc_router_stat); - } - return err; + struct proc_dir_entry *p; + proc_router = proc_mkdir(ROUTER_NAME, proc_net); + if (!proc_router) + goto fail; + + p = create_proc_entry("config",0,proc_router); + if (!p) + goto fail_config; + p->ops = &router_inode; + p->get_info = config_get_info; + p = create_proc_entry("status",0,proc_router); + if (!p) + goto fail_stat; + p->ops = &router_inode; + p->get_info = status_get_info; + return 0; +fail_stat: + remove_proc_entry("config", proc_router); +fail_config: + remove_proc_entry(ROUTER_NAME, proc_net); +fail: + return -ENOMEM; } /* @@ -277,9 +222,9 @@ void wanrouter_proc_cleanup (void) { - proc_unregister(&proc_router, proc_router_conf.low_ino); - proc_unregister(&proc_router, proc_router_stat.low_ino); - proc_unregister(proc_net, proc_router.low_ino); + remove_proc_entry("config", proc_router); + remove_proc_entry("status", proc_router); + remove_proc_entry(ROUTER_NAME,proc_net); } /* @@ -291,15 +236,13 @@ if (wandev->magic != ROUTER_MAGIC) return -EINVAL; - memset(&wandev->dent, 0, sizeof(wandev->dent)); - wandev->dent.namelen = strlen(wandev->name); - wandev->dent.name = wandev->name; - wandev->dent.mode = 0444 | S_IFREG; - wandev->dent.nlink = 1; - wandev->dent.ops = &wandev_inode; - wandev->dent.get_info = &wandev_get_info; - wandev->dent.data = wandev; - return proc_register(&proc_router, &wandev->dent); + wandev->dent = create_proc_entry(wandev->name, 0, proc_router); + if (!wandev->dent) + return -ENOMEM; + wandev->dent->ops = &wandev_inode; + wandev->dent->get_info = wandev_get_info; + wandev->dent->data = wandev; + return 0; } /* @@ -310,7 +253,7 @@ { if (wandev->magic != ROUTER_MAGIC) return -EINVAL; - proc_unregister(&proc_router, wandev->dent.low_ino); + remove_proc_entry(wandev->name, proc_router); return 0; } @@ -359,7 +302,7 @@ if (page == NULL) return -ENOBUFS; - pos = dent->get_info(page, dent->data, 0, 0, 0); + pos = dent->get_info(page, dent->data, 0, 0); offs = file->f_pos; if (offs < pos) { @@ -379,8 +322,7 @@ * Return length of data. */ -static int config_get_info(char* buf, char** start, off_t offs, int len, - int dummy) +static int config_get_info(char* buf, char** start, off_t offs, int len) { int cnt = sizeof(conf_hdr) - 1; wan_device_t* wandev; @@ -411,8 +353,7 @@ * Return length of data. */ -static int status_get_info(char* buf, char** start, off_t offs, int len, - int dummy) +static int status_get_info(char* buf, char** start, off_t offs, int len) { int cnt = sizeof(stat_hdr) - 1; wan_device_t* wandev; @@ -466,8 +407,7 @@ * data space. */ -static int wandev_get_info(char* buf, char** start, off_t offs, int len, - int dummy) +static int wandev_get_info(char* buf, char** start, off_t offs, int len) { wan_device_t* wandev = (void*)start; int cnt = 0; diff -u --recursive --new-file v2.3.28/linux/net/x25/af_x25.c linux/net/x25/af_x25.c --- v2.3.28/linux/net/x25/af_x25.c Mon Nov 1 13:56:27 1999 +++ linux/net/x25/af_x25.c Fri Nov 19 11:33:29 1999 @@ -1171,7 +1171,7 @@ return 0; } -static int x25_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int x25_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; struct net_device *dev; diff -u --recursive --new-file v2.3.28/linux/net/x25/x25_route.c linux/net/x25/x25_route.c --- v2.3.28/linux/net/x25/x25_route.c Thu Aug 26 13:05:47 1999 +++ linux/net/x25/x25_route.c Fri Nov 19 11:33:29 1999 @@ -217,7 +217,7 @@ return 0; } -int x25_routes_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int x25_routes_get_info(char *buffer, char **start, off_t offset, int length) { struct x25_route *x25_route; int len = 0;