diff -u --recursive --new-file v2.3.25/linux/CREDITS linux/CREDITS --- v2.3.25/linux/CREDITS Mon Nov 1 13:56:26 1999 +++ linux/CREDITS Fri Nov 5 10:01:50 1999 @@ -1612,10 +1612,11 @@ S: Czech Republic N: Vojtech Pavlik -E: vojtech@ucw.cz +E: vojtech@suse.cz D: Joystick driver D: arcnet-hardware readme D: Minor ARCnet hacking +D: USB hacking S: Ucitelska 1576 S: Prague 8 S: 182 00 Czech Republic @@ -2055,7 +2056,8 @@ S: Canada K2L 1S2 N: Andrew Tridgell -E: Andrew.Tridgell@anu.edu.au +E: tridge@samba.org +W: http://linuxcare.com.au/tridge/ D: dosemu, networking, samba S: 3 Ballow Crescent S: MacGregor A.C.T 2615 diff -u --recursive --new-file v2.3.25/linux/Documentation/Changes linux/Documentation/Changes --- v2.3.25/linux/Documentation/Changes Fri Oct 22 13:21:43 1999 +++ linux/Documentation/Changes Wed Nov 3 09:17:32 1999 @@ -45,7 +45,7 @@ - Kernel modutils 2.3.6 ; insmod -V - Gnu C 2.7.2.3 ; gcc --version -- Binutils 2.8.1.0.23 ; ld -v +- Binutils 2.9.1.0.7 ; ld -v - Linux libc5 C Library 5.4.46 ; ls -l /lib/libc* - Linux libc6 C Library 2.0.7pre6 ; ls -l /lib/libc* - Dynamic Linker (ld.so) 1.9.9 ; ldd --version or ldd -v @@ -183,13 +183,10 @@ to find out the proper way to upgrade it. No, the instruction to "rm `which encaps`" is not a joke. - The last public release of the binutils 2.8.x series was 2.8.1.0.23. -Binutils 2.8.1.0.25 to 2.9.1.0.2 are beta releases, and are known to be -very buggy. Binutils 2.9.1 (note the absence of a suffix) from the FSF -should work, and binutils 2.9.1.0.7 and later releases are also good. -Either use binutils-2.8.1.0.23 or binutils-2.9.1.0.7 or later. Glibc2 -users should especially try to use the 2.9.1.0.x releases, as they -resolve known issues with glibc2 and binutils-2.8.x releases. + You must use binutils 2.9.1.0.7 or later. Latest release is 2.9.1.0.25. +Beware that binutils 2.9.1 (note the absence of a suffix) from the FSF +does not work. If you are upgrading from earlier versions, you should +consider upgrading to the latest 2.9.5.0.x release. Gnu C ===== @@ -503,23 +500,16 @@ Binutils ======== -The 2.8.1.0.23 release: -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/binutils-2.8.1.0.23.bin.tar.gz -ftp://metalab.unc.edu/pub/Linux/GCC/binutils-2.8.1.0.23.bin.tar.gz +The 2.9.1.0.25 release: +ftp://ftp.varesearch.com/pub/support/hjl/binutils/2.9.1/binutils-2.9.1.0.25-glibc.x86.tar.gz +ftp://ftp.varesearch.com/pub/support/hjl/binutils/2.9.1/binutils-2.9.1.0.25.tar.gz Installation notes: -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/release.binutils-2.8.1.0.23 -ftp://metalab.unc.edu/pub/Linux/GCC/release.binutils-2.8.1.0.23 +ftp://ftp.varesearch.com/pub/support/hjl/binutils/2.9.1/release.binutils-2.9.1.0.25 -The 2.9.1.0.15 release: -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/binutils-2.9.1.0.15-glibc.x86.tar.gz -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/binutils-2.9.1.0.15-libc5.x86.tar.gz -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/binutils-2.9.1.0.15.tar.gz -ftp://metalab.unc.edu/pub/Linux/GCC/binutils-2.9.1.0.15-glibc.x86.tar.gz -ftp://metalab.unc.edu/pub/Linux/GCC/binutils-2.9.1.0.15-libc5.x86.tar.gz -ftp://metalab.unc.edu/pub/Linux/GCC/binutils-2.9.1.0.15.tar.gz +The 2.9.5.0.16 release: +ftp://ftp.varesearch.com/pub/support/hjl/binutils/binutils-2.9.5.0.16.tar.bz2 Installation notes: -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/release.binutils-2.9.1.0.15 -ftp://metalab.unc.edu/pub/Linux/GCC/release.binutils-2.9.1.0.15 +ftp://ftp.varesearch.com/pub/support/hjl/binutils/release.binutils-2.9.5.0.16 Gnu C ===== diff -u --recursive --new-file v2.3.25/linux/Documentation/Configure.help linux/Documentation/Configure.help --- v2.3.25/linux/Documentation/Configure.help Mon Nov 1 13:56:26 1999 +++ linux/Documentation/Configure.help Sat Nov 6 10:38:40 1999 @@ -1912,6 +1912,23 @@ building a kernel for install/rescue disks or your system is very limited in memory. +Kernel core (/proc/kcore) format +CONFIG_KCORE_ELF + If you enabled support for /proc filesystem then the file /proc/kcore + will contain the kernel core image. This can be used in gdb: + + $ cd /usr/src/linux ; gdb vmlinux /proc/kcore + + Selecting ELF will make /proc/kcore appear in ELF core format as defined + by the Executable and Linking Format specification. Selecting A.OUT will + choose the old "a.out" format which may be necessary for some old versions + of binutils or on some architectures. + + This is especially useful if you have compiled the kernel with "-g" option + to preserve debugging information. It is mainly used for examining kernel + data structures on the live kernel so if you don't understand what this + means or are not a kernel hacker, just leave it at its default value ELF. + Kernel support for ELF binaries CONFIG_BINFMT_ELF ELF (Executable and Linkable Format) is a format for libraries and @@ -2976,7 +2993,7 @@ here and read Documentation/modules.txt. The module will be called unix.o. If you try building this as a module and you have said Y to "Kernel module loader support" above, be sure to add 'alias net-pf-1 - unix' to your /etc/conf.modules file. Note that several important + unix' to your /etc/modules.conf file. Note that several important services won't work correctly if you say M here and then neglect to load the module. @@ -3700,7 +3717,7 @@ whenever you want). If you want to compile it as a module, say M here and read Documentation/modules.txt; if you use modprobe or kmod, you may also want to add "alias net-pf-17 af_packet" to - /etc/conf.modules. + /etc/modules.conf. If unsure, say Y. @@ -7841,6 +7858,18 @@ The module will be called cpia.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. +USB Kodak DC-2xx Camera support +CONFIG_USB_DC2XX + Say Y here if you want to connect this type of still camera to + your computer's USB port. See drivers/usb/README.dc2xx for more + information; some non-Kodak cameras may also work with this + driver, given application support (such as www.gPhoto.org). + + 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 dc2xx.o. If you want to compile it as a + module, say M here and read Documentation/modules.txt. + USB SCSI Support CONFIG_USB_SCSI Say Y here if you want to connect SCSI devices to your computer's @@ -7977,7 +8006,9 @@ during the boot process. It is usually mounted under /stand and corresponds to the slice marked as "STAND" in the UnixWare partition. This is useful if you want to access files on your /stand - slice from Linux. If you don't know what it is, say N. + slice from Linux. More information on this filesystem can be found in + Documentation/filesystems/bfs.txt file. If you do not know what it is, + say N. If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), @@ -8002,7 +8033,7 @@ say M here and read Documentation/modules.txt. The module will be called isofs.o. -Microsoft Joliet cdrom extensions +Microsoft Joliet CDROM extensions CONFIG_JOLIET Joliet is a Microsoft extension for the ISO 9660 CDROM filesystem which allows for long filenames in unicode format (unicode is the @@ -8011,7 +8042,7 @@ http://www.unicode.org for more information). Say Y here if you want to be able to read Joliet CDROMs under Linux. -UDF Filesystem support +UDF Filesystem support (read only) CONFIG_UDF_FS This is the new filesystem used by some CDROMS and DVD drivers. Say Y if you intend to mount DVD discs or CDRW's written in packet mode, @@ -8025,13 +8056,13 @@ If unsure, say N. -UDF read-write support (EXPERIMENTAL) +UDF write support (DANGEROUS) CONFIG_UDF_RW Say Y if you want to test write support for UDF filesystems. Due to lack of support for writing to CDR/CDRW's, this option is only supported for Hard Discs, DVD-RAM, and loopback files. -fat fs support +DOS FAT fs support CONFIG_FAT_FS If you want to use one of the FAT-based filesystems (the MS-DOS, VFAT (Windows 95) and UMSDOS (used to run Linux on top of an @@ -8067,7 +8098,7 @@ module, so don't say M here if you intend to use UMSDOS as your root filesystem. -msdos fs support +MSDOS fs support CONFIG_MSDOS_FS This allows you to mount MSDOS partitions of your hard drive (unless they are compressed; to access compressed MSDOS partitions under @@ -8096,7 +8127,7 @@ want), say M here and read Documentation/modules.txt. The module will be called msdos.o. -vfat fs support +VFAT (Windows-95) fs support CONFIG_VFAT_FS This option provides support for normal Windows filesystems with long filenames. That includes non-compressed FAT-based filesystems @@ -8117,7 +8148,7 @@ say M here and read Documentation/modules.txt. The module will be called vfat.o. -umsdos: Unix like fs on top of std MSDOS fs +UMSDOS: Unix-like filesystem on top of standard MSDOS filesystem CONFIG_UMSDOS_FS Say Y here if you want to run Linux from within an existing DOS partition of your hard drive. The advantage of this is that you can @@ -8209,7 +8240,7 @@ Most people say N here. -NFS server support +NFS server support (EXPERIMENTAL) CONFIG_NFSD If you want your Linux box to act as a NFS *server*, so that other computers on your local network which support NFS can access certain @@ -8231,7 +8262,7 @@ The module is called nfsd.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. If unsure, say N. -Emulate Sun NFS daemon +Emulate SUN NFS server CONFIG_NFSD_SUN If you would like for the server to allow clients to access directories that are mount points on the local filesystem (this is @@ -8274,11 +8305,11 @@ If unsure, say N. -System V and Coherent filesystem support +System V and Coherent filesystem support (read only) CONFIG_SYSV_FS SCO, Xenix and Coherent are commercial Unix systems for Intel - machines. Saying Y here would allow you to read to and write from - their floppies and hard disk partitions. + machines. Saying Y here would allow you to read from their floppies + and hard disk partitions. If you have floppies or hard disk partitions like that, it is likely that they contain binaries from those other Unix systems; in order @@ -8308,6 +8339,15 @@ If you haven't heard about all of this before, it's safe to say N. +SYSV filesystem write support (DANGEROUS) +CONFIG_SYSV_FS_WRITE + If you say Y here, you will (hopefully) be able to write to System V + and Coherent file systems as well as read from them. The read-write + support in SYSV is not well tested yet. If you enable this, back up + your SYSV/Coherent volumes first since they may get damaged. + + If unsure, say N. + Amiga FFS filesystem support CONFIG_AFFS_FS The Fast File System (FFS) is the common filesystem used on hard @@ -8393,7 +8433,7 @@ If you are not a part of a fairly large, distributed network, you probably do not need an automounter, and can say N here. -EFS filesystem support (EXPERIMENTAL) +EFS filesystem support (read only) (EXPERIMENTAL) CONFIG_EFS_FS EFS is an older filesystem used for non-ISO9660 CDROMs and hard disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer uses @@ -8413,7 +8453,7 @@ Say Y to this only if you plan on mounting disks with SGI disklabels. This is not required to mount EFS-format CDROMs. -UFS filesystem support +UFS filesystem support (read only) CONFIG_UFS_FS BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, OpenBSD and NeXTstep) use a filesystem called UFS. Some System V @@ -8443,7 +8483,7 @@ If you haven't heard about all of this before, it's safe to say N. -UFS filesystem write support (EXPERIMENTAL) +UFS filesystem write support (DANGEROUS) CONFIG_UFS_FS_WRITE Say Y here if you want to try writing to UFS partitions. This is experimental, so you should back up your UFS partitions beforehand. @@ -8563,7 +8603,7 @@ If you don't know what all this is about, say N. -SMB filesystem support (to mount Windows shares etc...) +SMB filesystem support (to mount Windows shares etc.) CONFIG_SMB_FS SMB (Server Message Block) is the protocol Windows for Workgroups (WfW), Windows 95/98, Windows NT and OS/2 Lan Manager use to share @@ -8589,7 +8629,7 @@ want), say M here and read Documentation/modules.txt. The module will be called smbfs.o. Most people say N, however. -Coda filesystem support +Coda filesystem support (advanced network fs) CONFIG_CODA_FS Coda is an advanced network filesystem, similar to NFS in that it enables you to mount filesystems of a remote server and access them @@ -12674,13 +12714,6 @@ read Documentation/modules.txt. This drivers currently only supports the ACTiSYS IR2000B ISA card and supports SIR, MIR and FIR (4Mbps) speeds. - -Sharp UIRCC IrDA Device Driver -CONFIG_SHARP_FIR - Say Y here if you want to build support for the Sharp UIRCC IrDA - chipset. If you want to compile it as a module, say M here and - read Documentation/modules.txt. This chipset is used by the Toshiba - Tecra laptops. Toshiba Type-O IR Port Device Driver CONFIG_TOSHIBA_FIR diff -u --recursive --new-file v2.3.25/linux/Documentation/computone.txt linux/Documentation/computone.txt --- v2.3.25/linux/Documentation/computone.txt Thu Aug 26 13:05:34 1999 +++ linux/Documentation/computone.txt Sat Nov 6 10:38:40 1999 @@ -59,7 +59,7 @@ e) Set address on ISA cards then: edit /usr/src/linux/drivers/char/ip2/ip2.h if needed or - edit /etc/conf.modules (or /etc/modules.conf) if needed (module). + edit /etc/modules.conf if needed (module). or both to match this setting. f) Run "make dep" g) Run "make modules" diff -u --recursive --new-file v2.3.25/linux/Documentation/digiboard.txt linux/Documentation/digiboard.txt --- v2.3.25/linux/Documentation/digiboard.txt Thu Apr 29 11:53:41 1999 +++ linux/Documentation/digiboard.txt Sat Nov 6 10:38:40 1999 @@ -29,7 +29,7 @@ The pcxx driver can be configured using the command line feature while loading the kernel with LILO or LOADLIN or, if built as a module, with arguments to insmod and modprobe or with parameters in -/etc/conf.modules for modprobe and kerneld. +/etc/modules.conf for modprobe and kerneld. After configuring the driver you need to create the device special files as described in "Device file creation:" below and set the appropriate @@ -96,13 +96,13 @@ The remaining board still uses ttyD8-ttyD15 and cud8-cud15. -Example line for /etc/conf.modules for use with kerneld and as default +Example line for /etc/modules.conf for use with kerneld and as default parameters for modprobe: options pcxx io=0x200 numports=8 For kerneld to work you will likely need to add these two lines to your -/etc/conf.modules: +/etc/modules.conf: alias char-major-22 pcxx alias char-major-23 pcxx diff -u --recursive --new-file v2.3.25/linux/Documentation/filesystems/bfs.txt linux/Documentation/filesystems/bfs.txt --- v2.3.25/linux/Documentation/filesystems/bfs.txt Mon Nov 1 13:56:26 1999 +++ linux/Documentation/filesystems/bfs.txt Fri Nov 5 10:30:13 1999 @@ -1,8 +1,13 @@ The BFS filesystem is used on SCO UnixWare machines for /stand slice. -There are no special mount options supported by bfs at this time. -You can mount it only read-only at this stage. Even if you attempt to -mount it read-write it will be automatically mounted read-only, unless -you have enabled "BFS write support" when configuring the kernel. +By default, if you attempt to mount it read-write it will be automatically +mounted read-only. If you want to enable (limited) write support, you need +to select "BFS write support" when configuring the kernel. The write support +at this stage is limited to the blocks preallocated for a given inode. +This means that writes beyond the value of inode->iu_eblock will fail with EIO. +In particular, this means you can create empty files but not write data to them +or you can write data to the existing files and increase their size but not the +number of blocks allocated to them. I am currently working on removing this +limitation, i.e. ability to migrate inodes within BFS filesystem. In order to access /stand partition under Linux you obviously need to know the partition number and the kernel must support UnixWare disk slices diff -u --recursive --new-file v2.3.25/linux/Documentation/filesystems/proc.txt linux/Documentation/filesystems/proc.txt --- v2.3.25/linux/Documentation/filesystems/proc.txt Fri Oct 15 15:25:13 1999 +++ linux/Documentation/filesystems/proc.txt Tue Nov 2 08:19:44 1999 @@ -190,7 +190,7 @@ ide Directory containing info about the IDE subsystem interrupts Interrupt usage ioports I/O port usage - kcore Kernel core image + kcore Kernel core image (can be ELF or A.OUT) kmsg Kernel messages ksyms Kernel symbol table loadavg Load average diff -u --recursive --new-file v2.3.25/linux/Documentation/ftape.txt linux/Documentation/ftape.txt --- v2.3.25/linux/Documentation/ftape.txt Mon May 10 13:00:10 1999 +++ linux/Documentation/ftape.txt Sat Nov 6 10:38:40 1999 @@ -244,14 +244,14 @@ insmod ftape.o ft_tracing=4 - or by editing the file `/etc/conf.modules' in which case they take + or by editing the file `/etc/modules.conf' in which case they take effect each time when the module is loaded with `modprobe' (please refer to the modules documentation, i.e. `modules.txt' and the respective manual pages). Thus, you should add a line options ftape ft_tracing=4 - to `/etc/conf.modules` if you intend to increase the debugging + to `/etc/modules.conf` if you intend to increase the debugging output of the driver. @@ -299,7 +299,7 @@ 5. Example module parameter setting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To do the same, but with ftape compiled as a loadable kernel - module, add the following line to `/etc/conf.modules': + module, add the following line to `/etc/modules.conf': options ftape ft_probe_fc10=1 ft_tracing=4 diff -u --recursive --new-file v2.3.25/linux/Documentation/hayes-esp.txt linux/Documentation/hayes-esp.txt --- v2.3.25/linux/Documentation/hayes-esp.txt Fri Jul 24 11:10:17 1998 +++ linux/Documentation/hayes-esp.txt Sat Nov 6 10:38:40 1999 @@ -109,7 +109,7 @@ insmod esp dma=3 trigger=512 The esp module can be automatically loaded when needed. To cause this to -happen, add the following lines to /etc/conf.modules (replacing the last line +happen, add the following lines to /etc/modules.conf (replacing the last line with options for your configuration): alias char-major-57 esp diff -u --recursive --new-file v2.3.25/linux/Documentation/ide.txt linux/Documentation/ide.txt --- v2.3.25/linux/Documentation/ide.txt Mon Jan 4 15:07:27 1999 +++ linux/Documentation/ide.txt Sat Nov 6 10:38:40 1999 @@ -245,7 +245,7 @@ alias block-major-3 ide-probe alias char-major-37 ide-tape -respectively to /etc/conf.modules. +respectively to /etc/modules.conf. When ide.c is used as a module, you can pass command line parameters to the driver using the "options=" keyword to insmod, while replacing any ',' with diff -u --recursive --new-file v2.3.25/linux/Documentation/joystick-parport.txt linux/Documentation/joystick-parport.txt --- v2.3.25/linux/Documentation/joystick-parport.txt Tue Dec 1 19:05:05 1998 +++ linux/Documentation/joystick-parport.txt Fri Nov 5 10:01:50 1999 @@ -1,5 +1,5 @@ Linux Joystick parport drivers v1.2 BETA - (c) 1998 Vojtech Pavlik + (c) 1998 Vojtech Pavlik (c) 1998 Andree Borrmann ---------------------------------------------------------------------------- diff -u --recursive --new-file v2.3.25/linux/Documentation/joystick.txt linux/Documentation/joystick.txt --- v2.3.25/linux/Documentation/joystick.txt Tue Dec 1 19:05:05 1998 +++ linux/Documentation/joystick.txt Fri Nov 5 10:01:50 1999 @@ -1,5 +1,5 @@ Linux Joystick driver v1.2.13 - (c) 1996-1998 Vojtech Pavlik + (c) 1996-1998 Vojtech Pavlik ---------------------------------------------------------------------------- 0. Disclaimer @@ -19,7 +19,7 @@ Temple Place, Suite 330, Boston, MA 02111-1307 USA Should you need to contact me, the author, you can do so either by e-mail -- mail your message to , or by paper mail: Vojtech Pavlik, +- mail your message to , or by paper mail: Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic For your convenience, the GNU General Public License version 2 is included @@ -58,20 +58,20 @@ The joystick package is available at the following FTP sites: ftp://atrey.karlin.mff.cuni.cz/pub/linux/joystick/ - ftp://artax.karlin.mff.cuni.cz/pub/linux/joystick/ - The joystick driver is also included in the Linux 2.1 kernels: + The joystick driver is also included in the Linux 2.1+ kernels: - ftp://linux.kernel.org/pub/linux/kernel/v2.1/ + ftp://linux.kernel.org/pub/linux/kernel/ And a homepage of the driver is at: - http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/ - http://artax.karlin.mff.cuni.cz/~vojtech/joystick/ + http://www.suse.cz/development/joystick/ - A mirror of the homepage is at: + Mirrors of the homepage are at: + http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/ http://www.trylinux.com/projects/joystick/ + http://www.linuxgames.com/joystick/ There is also a mailing list for the driver at: diff -u --recursive --new-file v2.3.25/linux/Documentation/modules.txt linux/Documentation/modules.txt --- v2.3.25/linux/Documentation/modules.txt Thu Aug 5 14:34:01 1999 +++ linux/Documentation/modules.txt Sat Nov 6 10:38:40 1999 @@ -117,7 +117,7 @@ without paying much attention to which kernel you are running, or what other modules this module depends on. -With the help of the modprobe configuration file: "/etc/conf.modules" +With the help of the modprobe configuration file: "/etc/modules.conf" you can tune the behaviour of modprobe in many ways, including an automatic setting of insmod options for each module. And, yes, there _are_ man-pages for all this... @@ -164,10 +164,10 @@ fits this symbolic description. - modprobe looks into its internal "alias" translation table to see if there is a match. This table can be reconfigured - and expanded by having "alias" lines in "/etc/conf.modules". + and expanded by having "alias" lines in "/etc/modules.conf". - insmod is then asked to insert the module(s) that modprobe has decided that the kernel needs. Every module will be - configured according to the "options" lines in "/etc/conf.modules". + configured according to the "options" lines in "/etc/modules.conf". - modprobe exits and kerneld tells the kernel that the request succeeded (or failed...) - The kernel uses the freshly installed feature just as if it @@ -191,7 +191,7 @@ To use kerneld with the least amount of "hassle", you need modprobe from a release that can be considered "recent" w.r.t. your kernel, and also -a configuration file for modprobe ("/etc/conf.modules"). +a configuration file for modprobe ("/etc/modules.conf"). Since modprobe already knows about most modules, the minimal configuration file could look something like this: @@ -207,10 +207,6 @@ alias net-pf-3 off # no ax25 module available (yet) alias net-pf-4 off # if you don't use the ipx module alias net-pf-5 off # if you don't use the appletalk module - -Finally, for the "purists": -You can name the modprobe configuration either "/etc/conf.modules" or -"/etc/modules.conf", since modprobe knows what to do in each case... Written by: diff -u --recursive --new-file v2.3.25/linux/Documentation/networking/arcnet-hardware.txt linux/Documentation/networking/arcnet-hardware.txt --- v2.3.25/linux/Documentation/networking/arcnet-hardware.txt Mon Jul 5 19:52:52 1999 +++ linux/Documentation/networking/arcnet-hardware.txt Fri Nov 5 10:01:50 1999 @@ -78,7 +78,7 @@ ----------------------- This section was rewritten by - Vojtech Pavlik + Vojtech Pavlik using information from several people, including: Avery Pennraun Stephen A. Wood @@ -270,7 +270,7 @@ that IRQ2 is the same as IRQ9, as far as Linux is concerned. You can "cat /proc/interrupts" for a somewhat complete list of which ones are in use at any given time. Here is a list of common usages from Vojtech - Pavlik : + Pavlik : ("Not on bus" means there is no way for a card to generate this interrupt) IRQ 0 - Timer 0 (Not on bus) @@ -347,8 +347,7 @@ network. Also, on many cards (not mine, though) there are red and green LED's. -Vojtech Pavlik tells me this is what they -mean: +Vojtech Pavlik tells me this is what they mean: GREEN RED Status ----- --- ------ OFF OFF Power off @@ -1735,11 +1734,11 @@ ** Acer ** 8-bit card, Model 5210-003 -------------------------- - - from Vojtech Pavlik using portions of - the existing arcnet-hardware file. + - from Vojtech Pavlik using portions of the existing + arcnet-hardware file. -This is a 90C26 based card. Its configuration seems similar to -the SMC PC100, but has some additional jumpers I don't know. +This is a 90C26 based card. Its configuration seems similar to the SMC +PC100, but has some additional jumpers I don't know the meaning of. __ | | @@ -1903,7 +1902,7 @@ ** Datapoint? ** LAN-ARC-8, an 8-bit card ------------------------ - - from Vojtech Pavlik + - from Vojtech Pavlik This is another SMC 90C65-based ARCnet card. I couldn't identify the manufacturer, but it might be DataPoint, because the card has the @@ -2043,7 +2042,7 @@ ** Topware ** 8-bit card, TA-ARC/10 ------------------------- - - from Vojtech Pavlik + - from Vojtech Pavlik This is another very similar 90C65 card. Most of the switches and jumpers are the same as on other clones. @@ -2752,7 +2751,7 @@ ** No Name ** 8-bit cards ("Made in Taiwan R.O.C.") ----------- - - from Vojtech Pavlik + - from Vojtech Pavlik I have named this ARCnet card "NONAME", since I got only the card with no manual at all and the only text identifying the manufacturer is diff -u --recursive --new-file v2.3.25/linux/Documentation/networking/baycom.txt linux/Documentation/networking/baycom.txt --- v2.3.25/linux/Documentation/networking/baycom.txt Tue Jul 6 19:16:55 1999 +++ linux/Documentation/networking/baycom.txt Sat Nov 6 10:38:40 1999 @@ -93,7 +93,7 @@ modems it should access at which ports. This can be done with the setbaycom utility. If you are only using one modem, you can also configure the driver from the insmod command line (or by means of an option line in -/etc/conf.modules). +/etc/modules.conf). Examples: insmod baycom_ser_fdx mode="ser12*" iobase=0x3f8 irq=4 diff -u --recursive --new-file v2.3.25/linux/Documentation/networking/ltpc.txt linux/Documentation/networking/ltpc.txt --- v2.3.25/linux/Documentation/networking/ltpc.txt Fri Nov 13 10:29:43 1998 +++ linux/Documentation/networking/ltpc.txt Sat Nov 6 10:38:40 1999 @@ -25,7 +25,7 @@ If you load the driver as a module, you can pass the parameters "io=", "irq=", and "dma=" on the command line with insmod or modprobe, or add -them as options in /etc/conf.modules: +them as options in /etc/modules.conf: alias lt0 ltpc # autoload the module when the interface is configured options ltpc io=0x240 irq=9 dma=1 diff -u --recursive --new-file v2.3.25/linux/Documentation/networking/soundmodem.txt linux/Documentation/networking/soundmodem.txt --- v2.3.25/linux/Documentation/networking/soundmodem.txt Tue Aug 31 17:29:12 1999 +++ linux/Documentation/networking/soundmodem.txt Sat Nov 6 10:38:40 1999 @@ -39,7 +39,7 @@ modems it should access at which ports. This can be done with the setbaycom utility. If you are only using one modem, you can also configure the driver from the insmod command line (or by means of an option line in -/etc/conf.modules). +/etc/modules.conf). Examples: insmod soundmodem mode="sbc:afsk1200" iobase=0x220 irq=5 dma=1 diff -u --recursive --new-file v2.3.25/linux/Documentation/parport.txt linux/Documentation/parport.txt --- v2.3.25/linux/Documentation/parport.txt Sat Oct 9 11:47:50 1999 +++ linux/Documentation/parport.txt Sat Nov 6 10:38:40 1999 @@ -35,7 +35,7 @@ KMod ---- -If you use kmod, you will find it useful to edit /etc/conf.modules. +If you use kmod, you will find it useful to edit /etc/modules.conf. Here is an example of the lines that need to be added: post-install parport modprobe -k parport_pc diff -u --recursive --new-file v2.3.25/linux/Documentation/pci.txt linux/Documentation/pci.txt --- v2.3.25/linux/Documentation/pci.txt Fri Oct 22 13:21:43 1999 +++ linux/Documentation/pci.txt Wed Nov 3 09:17:50 1999 @@ -4,7 +4,7 @@ "What should you avoid when writing PCI drivers" - by Martin Mares on 09-Oct-1999 + by Martin Mares on 03-Nov-1999 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -72,6 +72,8 @@ Memory and port addresses and interrupt numbers should NOT be read from the config space. You should use the values in the pci_dev structure as they might have been remapped by the kernel. + + See Documentation/IO-mapping.txt for how to access device memory. 5. Other interesting functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/AWE32 linux/Documentation/sound/AWE32 --- v2.3.25/linux/Documentation/sound/AWE32 Thu Aug 26 13:05:34 1999 +++ linux/Documentation/sound/AWE32 Sat Nov 6 10:38:40 1999 @@ -83,7 +83,7 @@ synthesis you should also get the sound bank file for general midi from http://members.xoom.com/yar/synthgm.sbk.gz. Copy it to /usr and gunzip it there. -7) Edit /etc/conf.modules, inserting at the end of the file: +7) Edit /etc/modules.conf, inserting at the end of the file: alias midi awe_wave post-install awe_wave /usr/bin/sfxload /usr/synthfm.sbk diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/AudioExcelDSP16 linux/Documentation/sound/AudioExcelDSP16 --- v2.3.25/linux/Documentation/sound/AudioExcelDSP16 Thu Apr 29 11:53:41 1999 +++ linux/Documentation/sound/AudioExcelDSP16 Sat Nov 6 10:38:40 1999 @@ -41,7 +41,7 @@ (0x300, 0x310, 0x320 or 0x330) mpu_irq MPU-401 irq line (5, 7, 9, 10 or 0) -The /etc/conf.modules will have lines like this: +The /etc/modules.conf will have lines like this: options opl3 io=0x388 options ad1848 io=0x530 irq=11 dma=3 @@ -51,7 +51,7 @@ ad1848 are the corresponding options for the MSS and OPL3 modules. Loading MSS and OPL3 needs to pre load the aedsp16 module to set up correctly -the sound card. Installation dependencies must be written in the conf.modules +the sound card. Installation dependencies must be written in the modules.conf file: pre-install ad1848 modprobe aedsp16 diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/CMI8330 linux/Documentation/sound/CMI8330 --- v2.3.25/linux/Documentation/sound/CMI8330 Wed May 26 09:29:34 1999 +++ linux/Documentation/sound/CMI8330 Sat Nov 6 10:38:40 1999 @@ -88,7 +88,7 @@ -Alma Chao suggests the following /etc/conf.modules: +Alma Chao suggests the following /etc/modules.conf: alias sound ad1848 alias synth0 opl3 diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/Introduction linux/Documentation/sound/Introduction --- v2.3.25/linux/Documentation/sound/Introduction Mon Jul 5 20:04:47 1999 +++ linux/Documentation/sound/Introduction Sat Nov 6 10:38:40 1999 @@ -145,7 +145,7 @@ ========= If loading via modprobe, these common files are automatically loaded -when requested by modprobe. For example, my /etc/conf.modules contains: +when requested by modprobe. For example, my /etc/modules.conf contains: alias sound sb options sb io=0x240 irq=9 dma=3 dma16=5 mpu_io=0x300 @@ -205,7 +205,7 @@ driver, you should do the following: 1. remove sound modules (detailed above) -2. remove the sound modules from /etc/conf.modules +2. remove the sound modules from /etc/modules.conf 3. move the sound modules from /lib/modules//misc (for example, I make a /lib/modules//misc/tmp directory and copy the sound module files to that @@ -241,7 +241,7 @@ sb.o could be copied (or symlinked) to sb1.o for the second SoundBlasster. -2. Make a second entry in /etc/conf.modules, for example, +2. Make a second entry in /etc/modules.conf, for example, sound1 or sb1. This second entry should refer to the new module names for example sb1, and should include the I/O, etc. for the second sound card. @@ -333,7 +333,7 @@ 2) On the command line when using insmod or in a bash script using command line calls to load sound. -3) In /etc/conf.modules when using modprobe. +3) In /etc/modules.conf when using modprobe. 4) Via Red Hat's /usr/sbin/sndconfig program (text based). diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/OPL3-SA2 linux/Documentation/sound/OPL3-SA2 --- v2.3.25/linux/Documentation/sound/OPL3-SA2 Mon Jul 5 20:04:47 1999 +++ linux/Documentation/sound/OPL3-SA2 Sat Nov 6 10:38:40 1999 @@ -125,7 +125,7 @@ Lastly, if you're using modules and want to set up automatic module loading with kmod, the kernel module loader, here is the section I -currently use in my conf.modules file: +currently use in my modules.conf file: # Sound alias char-major-14 opl3sa2 diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/Opti linux/Documentation/sound/Opti --- v2.3.25/linux/Documentation/sound/Opti Sat Jul 18 14:11:18 1998 +++ linux/Documentation/sound/Opti Sat Nov 6 10:38:40 1999 @@ -18,7 +18,7 @@ If you have another OS installed on your computer it is recommended that Linux and the other OS use the same resources. -Also, it is recommended that resources specified in /etc/conf.modules +Also, it is recommended that resources specified in /etc/modules.conf and resources specified in /etc/isapnp.conf agree. Compiling the sound driver @@ -68,9 +68,9 @@ Using kmod and autoloading the sound driver ------------------------------------------- Comment: as of linux-2.1.90 kmod is replacing kerneld. -The config file '/etc/conf.modules' is used as before. +The config file '/etc/modules.conf' is used as before. -This is the sound part of my /etc/conf.modules file. +This is the sound part of my /etc/modules.conf file. Following that I will explain each line. alias mixer0 mad16 diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/README.modules linux/Documentation/sound/README.modules --- v2.3.25/linux/Documentation/sound/README.modules Sun Jan 17 18:23:01 1999 +++ linux/Documentation/sound/README.modules Sat Nov 6 10:38:40 1999 @@ -26,7 +26,7 @@ drivers/sound dir. Now one simply configures and makes one's kernel and modules in the usual way. - Then, add to your /etc/modules.conf or /etc/conf.modules something like: + Then, add to your /etc/modules.conf something like: alias char-major-14 sb post-install sb /sbin/modprobe "-k" "adlib_card" @@ -82,7 +82,7 @@ To make the sound driver use persistent DMA buffers we need to pass the sound.o module a "dmabuf=1" command-line argument. This is normally done -in /etc/conf.modules (or the more proper /etc/modules.conf) like so: +in /etc/modules.conf like so: options sound dmabuf=1 diff -u --recursive --new-file v2.3.25/linux/Documentation/sound/Wavefront linux/Documentation/sound/Wavefront --- v2.3.25/linux/Documentation/sound/Wavefront Thu Apr 29 11:53:41 1999 +++ linux/Documentation/sound/Wavefront Sat Nov 6 10:38:40 1999 @@ -190,7 +190,7 @@ 6) How do I configure my card ? ************************************************************ -You need to edit /etc/conf.modules. Here's mine (edited to show the +You need to edit /etc/modules.conf. Here's mine (edited to show the relevant details): # Sound system diff -u --recursive --new-file v2.3.25/linux/Documentation/sysrq.txt linux/Documentation/sysrq.txt --- v2.3.25/linux/Documentation/sysrq.txt Mon Aug 9 10:23:09 1999 +++ linux/Documentation/sysrq.txt Tue Nov 2 08:43:37 1999 @@ -33,7 +33,7 @@ 'b' - Will immediately reboot the system without syncing or unmounting your disks. -'o' - Will shut your system off via APM (if configured and supported). +'o' - Will shut your system off (if configured and supported). 's' - Will attempt to sync all mounted filesystems. diff -u --recursive --new-file v2.3.25/linux/MAINTAINERS linux/MAINTAINERS --- v2.3.25/linux/MAINTAINERS Mon Nov 1 13:56:26 1999 +++ linux/MAINTAINERS Fri Nov 5 10:01:50 1999 @@ -266,7 +266,7 @@ M: SteveW@ACM.org W: http://www.sucs.swan.ac.uk/~rohan/ W: http://www-sigproc.eng.cam.ac.uk/~sjw44/ -L: netdev@roxanne.nuclecu.unam.mx +L: netdev@oss.sgi.com S: Maintained DEVICE NUMBER REGISTRY @@ -490,9 +490,9 @@ JOYSTICK DRIVER P: Vojtech Pavlik -M: vojtech@ucw.cz +M: vojtech@suse.cz L: linux-joystick@atrey.karlin.mff.cuni.cz -W: http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/ +W: http://www.suse.cz/development/joystick/ S: Maintained KERNEL AUTOMOUNTER (AUTOFS) @@ -616,7 +616,7 @@ NETWORKING [GENERAL] P: Networking Teak -M: netdev@nuclecu.unam.mx +M: netdev@oss.sgi.com L: linux-net@vger.rutgers.edu W: http://www.uk.linux.org/NetNews.html (2.0 only) S: Maintained @@ -628,7 +628,7 @@ M: ak@muc.de P: Alexey Kuznetsov M: kuznet@ms2.inr.ac.ru -L: netdev@roxanne.nuclecu.unam.mx +L: netdev@oss.sgi.com S: Maintained NFS CLIENT @@ -764,7 +764,7 @@ SCSI CDROM DRIVER P: Jens Axboe M: axboe@image.dk -L: linux-kernel@vger.rutgers.edu +L: linux-scsi@vger.rutgers.edu W: http://www.kernel.dk S: Maintained diff -u --recursive --new-file v2.3.25/linux/Makefile linux/Makefile --- v2.3.25/linux/Makefile Mon Nov 1 13:56:26 1999 +++ linux/Makefile Mon Nov 1 13:56:38 1999 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 3 -SUBLEVEL = 25 +SUBLEVEL = 26 EXTRAVERSION = ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) diff -u --recursive --new-file v2.3.25/linux/arch/alpha/config.in linux/arch/alpha/config.in --- v2.3.25/linux/arch/alpha/config.in Tue Aug 31 17:29:12 1999 +++ linux/arch/alpha/config.in Fri Nov 5 10:22:51 1999 @@ -172,6 +172,11 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC @@ -263,7 +268,7 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate 'Kernel FP software completion' CONFIG_MATHEMU else - define_bool CONFIG_MATHEMU y + define_tristate CONFIG_MATHEMU y fi bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ diff -u --recursive --new-file v2.3.25/linux/arch/alpha/defconfig linux/arch/alpha/defconfig --- v2.3.25/linux/arch/alpha/defconfig Tue Aug 31 17:29:12 1999 +++ linux/arch/alpha/defconfig Fri Nov 5 10:22:51 1999 @@ -47,6 +47,8 @@ CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_SYSCTL=y CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y diff -u --recursive --new-file v2.3.25/linux/arch/arm/config.in linux/arch/arm/config.in --- v2.3.25/linux/arch/arm/config.in Mon Nov 1 13:56:26 1999 +++ linux/arch/arm/config.in Fri Nov 5 10:22:51 1999 @@ -144,6 +144,11 @@ bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL tristate 'Math emulation' CONFIG_NWFPE +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC diff -u --recursive --new-file v2.3.25/linux/arch/arm/defconfig linux/arch/arm/defconfig --- v2.3.25/linux/arch/arm/defconfig Fri Oct 22 13:21:43 1999 +++ linux/arch/arm/defconfig Fri Nov 5 10:22:51 1999 @@ -49,6 +49,8 @@ # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y CONFIG_NWFPE=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set diff -u --recursive --new-file v2.3.25/linux/arch/i386/config.in linux/arch/i386/config.in --- v2.3.25/linux/arch/i386/config.in Wed Oct 27 16:34:12 1999 +++ linux/arch/i386/config.in Tue Nov 2 08:43:37 1999 @@ -104,6 +104,11 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC @@ -116,7 +121,6 @@ bool ' Enable PM at boot time' CONFIG_APM_DO_ENABLE bool ' Make CPU Idle calls when idle' CONFIG_APM_CPU_IDLE bool ' Enable console blanking using APM' CONFIG_APM_DISPLAY_BLANK - bool ' Power off on shutdown' CONFIG_APM_POWER_OFF bool ' Ignore multiple suspend' CONFIG_APM_IGNORE_MULTIPLE_SUSPEND bool ' Ignore multiple suspend/resume cycles' CONFIG_APM_IGNORE_SUSPEND_BOUNCE bool ' RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT diff -u --recursive --new-file v2.3.25/linux/arch/i386/defconfig linux/arch/i386/defconfig --- v2.3.25/linux/arch/i386/defconfig Wed Oct 27 16:34:12 1999 +++ linux/arch/i386/defconfig Wed Nov 3 14:51:33 1999 @@ -63,6 +63,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=y diff -u --recursive --new-file v2.3.25/linux/arch/i386/kernel/apm.c linux/arch/i386/kernel/apm.c --- v2.3.25/linux/arch/i386/kernel/apm.c Mon Nov 1 13:56:26 1999 +++ linux/arch/i386/kernel/apm.c Tue Nov 2 08:43:37 1999 @@ -33,6 +33,7 @@ * Nov 1998, Version 1.7 * Jan 1999, Version 1.8 * Jan 1999, Version 1.9 + * Oct 1999, Version 1.10 * * History: * 0.6b: first version in official kernel, Linux 1.3.46 @@ -90,6 +91,16 @@ * Use CONFIG_SMP instead of __SMP__ * Ignore BOUNCES for three seconds. * Stephen Rothwell + * 1.10: Fix for Thinkpad return code. + * Merge 2.2 and 2.3 drivers. + * Remove APM dependencies in arch/i386/kernel/process.c + * Remove APM dependencies in drivers/char/sysrq.c + * Reset time across standby. + * Allow more inititialisation on SMP. + * Remove CONFIG_APM_POWER_OFF and make it boot time + * configurable (default on). + * Make debug only a boot time parameter (remove APM_DEBUG). + * Try to blank all devices on any error. * * APM 1.1 Reference: * @@ -106,11 +117,8 @@ * Intel Corporation, Microsoft Corporation. Advanced Power Management * (APM) BIOS Interface Specification, Revision 1.2, February 1996. * - * [This document is available from Intel at: - * http://www.intel.com/IAL/powermgm - * or Microsoft at - * http://www.microsoft.com/windows/thirdparty/hardware/pcfuture.htm - * ] + * [This document is available from Microsoft at: + * http://www.microsoft.com/hwdev/busbios/amp_12.htm] */ #include @@ -122,7 +130,6 @@ #include #include #include -#include #include #include #include @@ -138,63 +145,27 @@ */ #include - EXPORT_SYMBOL(apm_register_callback); EXPORT_SYMBOL(apm_unregister_callback); extern unsigned long get_cmos_time(void); +extern void (*sysrq_power_off)(void); + /* * The apm_bios device is one of the misc char devices. * This is its minor number. */ #define APM_MINOR_DEV 134 -/* Configurable options: - * - * CONFIG_APM_IGNORE_USER_SUSPEND: define to ignore USER SUSPEND requests. - * This is necessary on the NEC Versa M series, which generates these when - * resuming from SYSTEM SUSPEND. However, enabling this on other laptops - * will cause the laptop to generate a CRITICAL SUSPEND when an appropriate - * USER SUSPEND is ignored -- this may prevent the APM driver from updating - * the system time on a RESUME. - * - * CONFIG_APM_DO_ENABLE: enable APM features at boot time. From page 36 of - * the specification: "When disabled, the APM BIOS does not automatically - * power manage devices, enter the Standby State, enter the Suspend State, - * or take power saving steps in response to CPU Idle calls." This driver - * will make CPU Idle calls when Linux is idle (unless this feature is - * turned off -- see below). This should always save battery power, but - * more complicated APM features will be dependent on your BIOS - * implementation. You may need to turn this option off if your computer - * hangs at boot time when using APM support, or if it beeps continuously - * instead of suspending. Turn this off if you have a NEC UltraLite Versa - * 33/C or a Toshiba T400CDT. This is off by default since most machines - * do fine without this feature. - * - * CONFIG_APM_CPU_IDLE: enable calls to APM CPU Idle/CPU Busy inside the - * idle loop. On some machines, this can activate improved power savings, - * such as a slowed CPU clock rate, when the machine is idle. These idle - * call is made after the idle loop has run for some length of time (e.g., - * 333 mS). On some machines, this will cause a hang at boot time or - * whenever the CPU becomes idle. - * - * CONFIG_APM_DISPLAY_BLANK: enable console blanking using the APM. Some - * laptops can use this to turn of the LCD backlight when the VC screen - * blanker blanks the screen. Note that this is only used by the VC screen - * blanker, and probably won't turn off the backlight when using X11. Some - * problems have been reported when using this option with gpm (if you'd - * like to debug this, please do so). - * - * CONFIG_APM_IGNORE_MULTIPLE_SUSPEND: The IBM TP560 bios seems to insist - * on returning multiple suspend/standby events whenever one occurs. We - * really only need one at a time, so just ignore any beyond the first. - * This is probably safe on most laptops. - * - * If you are debugging the APM support for your laptop, note that code for - * all of these options is contained in this file, so you can #define or - * #undef these on the next line to avoid recompiling the whole kernel. +/* + * See Documentation/Config.help for the configuration options. * + * Various options can be changed at boot time as follows: + * apm=on/off enable/disable APM + * [no-]debug log some debugging messages + * [no-]power-off power off on shutdown + * [no-]smp-power-off allow power off even for SMP */ /* KNOWN PROBLEM MACHINES: @@ -213,11 +184,6 @@ */ /* - * Define to have debug messages. - */ -#undef APM_DEBUG - -/* * Define to always call the APM BIOS busy routine even if the clock was * not slowed by the idle routine. */ @@ -272,26 +238,6 @@ __asm__ __volatile__("movl %%" #seg ",%0" : "=m" (where)) /* - * Forward declarations - */ -static void suspend(void); -static void standby(void); -static void set_time(void); - -static void check_events(void); - -static int do_open(struct inode *, struct file *); -static int do_release(struct inode *, struct file *); -static ssize_t do_read(struct file *, char *, size_t , loff_t *); -static unsigned int do_poll(struct file *, poll_table *); -static int do_ioctl(struct inode *, struct file *, u_int, u_long); - -static int apm_get_info(char *, char **, off_t, int, int); - -extern int apm_register_callback(int (*)(apm_event_t)); -extern void apm_unregister_callback(int (*)(apm_event_t)); - -/* * Local variables */ static struct { @@ -318,13 +264,13 @@ #endif static int debug = 0; static int apm_disabled = 0; +static int power_off_enabled = 1; static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); static struct apm_bios_struct * user_list = NULL; -static char driver_version[] = "1.9"; /* no spaces */ +static char driver_version[] = "1.10"; /* no spaces */ -#ifdef APM_DEBUG static char * apm_event_name[] = { "system standby", "system suspend", @@ -341,28 +287,6 @@ }; #define NR_APM_EVENT_NAME \ (sizeof(apm_event_name) / sizeof(apm_event_name[0])) -#endif - -static struct file_operations apm_bios_fops = { - NULL, /* lseek */ - do_read, - NULL, /* write */ - NULL, /* readdir */ - do_poll, - do_ioctl, - NULL, /* mmap */ - do_open, - NULL, /* flush */ - do_release, - NULL, /* fsync */ - NULL /* fasync */ -}; - -static struct miscdevice apm_device = { - APM_MINOR_DEV, - "apm", - &apm_bios_fops -}; typedef struct callback_list_t { int (* callback)(apm_event_t); @@ -392,6 +316,7 @@ { APM_RESUME_DISABLED, "Resume timer disabled" }, { APM_BAD_STATE, "Unable to enter requested state" }, /* N/A { APM_NO_EVENTS, "No events pending" }, */ + { APM_NO_ERROR, "BIOS did not set a return code" }, { APM_NOT_PRESENT, "No APM present" } }; #define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t)) @@ -418,9 +343,10 @@ # define APM_DO_CLI #endif #ifdef APM_ZERO_SEGS +# define APM_DECL_SEGS \ + unsigned int saved_fs; unsigned int saved_gs; # define APM_DO_SAVE_SEGS \ - savesegment(fs, saved_fs); \ - savesegment(gs, saved_gs) + savesegment(fs, saved_fs); savesegment(gs, saved_gs) # define APM_DO_ZERO_SEGS \ "pushl %%ds\n\t" \ "pushl %%es\n\t" \ @@ -433,20 +359,19 @@ "popl %%es\n\t" \ "popl %%ds\n\t" # define APM_DO_RESTORE_SEGS \ - loadsegment(fs, saved_fs); \ - loadsegment(gs, saved_gs) + loadsegment(fs, saved_fs); loadsegment(gs, saved_gs) #else +# define APM_DECL_SEGS # define APM_DO_SAVE_SEGS # define APM_DO_ZERO_SEGS # define APM_DO_POP_SEGS # define APM_DO_RESTORE_SEGS #endif -static u8 apm_bios_call(u32 eax_in, u32 ebx_in, u32 ecx_in, +static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, u32 *esi) { - unsigned int saved_fs; - unsigned int saved_gs; + APM_DECL_SEGS unsigned long flags; __save_flags(flags); @@ -462,7 +387,7 @@ APM_DO_POP_SEGS : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx), "=S" (*esi) - : "a" (eax_in), "b" (ebx_in), "c" (ecx_in) + : "a" (func), "b" (ebx_in), "c" (ecx_in) : "memory", "cc"); APM_DO_RESTORE_SEGS; __restore_flags(flags); @@ -473,12 +398,10 @@ * This version only returns one value (usually an error code) */ -static u8 apm_bios_call_simple(u32 eax_in, u32 ebx_in, u32 ecx_in, - u32 *eax) +static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax) { u8 error; - unsigned int saved_fs; - unsigned int saved_gs; + APM_DECL_SEGS unsigned long flags; __save_flags(flags); @@ -497,7 +420,7 @@ APM_DO_POP_SEGS : "=a" (*eax), "=b" (error), "=c" (cx), "=d" (dx), "=S" (si) - : "a" (eax_in), "b" (ebx_in), "c" (ecx_in) + : "a" (func), "b" (ebx_in), "c" (ecx_in) : "memory", "cc"); } APM_DO_RESTORE_SEGS; @@ -505,11 +428,11 @@ return error; } -static int apm_driver_version(u_short *val) +static int __init apm_driver_version(u_short *val) { u32 eax; - if (apm_bios_call_simple(0x530e, 0, *val, &eax)) + if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax)) return (eax >> 8) & 0xff; *val = eax; return APM_SUCCESS; @@ -522,7 +445,8 @@ u32 ecx; u32 dummy; - if (apm_bios_call(0x530b, 0, 0, &eax, &ebx, &ecx, &dummy, &dummy)) + if (apm_bios_call(APM_FUNC_GET_EVENT, 0, 0, &eax, &ebx, &ecx, + &dummy, &dummy)) return (eax >> 8) & 0xff; *event = ebx; if (apm_bios_info.version < 0x0102) @@ -536,16 +460,44 @@ { u32 eax; - if (apm_bios_call_simple(0x5307, what, state, &eax)) + if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax)) return (eax >> 8) & 0xff; return APM_SUCCESS; } static int apm_set_power_state(u_short state) { - return set_power_state(0x0001, state); + return set_power_state(APM_DEVICE_ALL, state); +} + +#ifdef CONFIG_APM_CPU_IDLE +static int apm_do_idle(void) +{ + u32 dummy; + + if (apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &dummy)) + return 0; + +#ifdef ALWAYS_CALL_BUSY + clock_slowed = 1; +#else + clock_slowed = (apm_bios_info.flags & APM_IDLE_SLOWS_CLOCK) != 0; +#endif + return 1; +} + +static void apm_do_busy(void) +{ + u32 dummy; + + if (clock_slowed) { + (void) apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy); + clock_slowed = 0; + } } +extern int hlt_counter; + /* * If no process has been interested in this * CPU for some time, we want to wake up the @@ -557,12 +509,10 @@ /* This should wake up kapmd and ask it to slow the CPU */ #define powermanagement_idle() do { } while (0) -extern int hlt_counter; - /* * This is the idle thing. */ -void apm_cpu_idle(void) +static void apm_cpu_idle(void) { unsigned int start_idle; @@ -589,8 +539,9 @@ start_idle = jiffies; } } +#endif -void apm_power_off(void) +static void apm_power_off(void) { /* * smp_hack == 2 means that we would have enabled APM support @@ -612,7 +563,7 @@ /* Blank the first display device */ error = set_power_state(0x0100, state); - if (error == APM_BAD_DEVICE) + if (error != APM_SUCCESS) /* try to blank them all instead */ error = set_power_state(0x01ff, state); return error; @@ -624,8 +575,7 @@ { u32 eax; - if (apm_bios_call_simple(0x5308, - (apm_bios_info.version > 0x100) ? 0x0001 : 0xffff, + if (apm_bios_call_simple(APM_FUNC_ENABLE_PM, APM_DEVICE_BALL, 1, &eax)) return (eax >> 8) & 0xff; apm_bios_info.flags &= ~APM_BIOS_DISABLED; @@ -641,19 +591,49 @@ u32 edx; u32 dummy; - if (apm_bios_call(0x530a, 1, 0, &eax, &ebx, &ecx, &edx, &dummy)) + if (apm_bios_call(APM_FUNC_GET_STATUS, APM_DEVICE_ALL, 0, + &eax, &ebx, &ecx, &edx, &dummy)) + return (eax >> 8) & 0xff; + *status = ebx; + *bat = ecx; + *life = edx; + return APM_SUCCESS; +} + +#if 0 +static int apm_get_battery_status(u_short which, u_short *status, + u_short *bat, u_short *life, u_short *nbat) +{ + u32 eax; + u32 ebx; + u32 ecx; + u32 edx; + u32 esi; + + if (apm_bios_info.version < 0x0102) { + /* pretend we only have one battery. */ + if (which != 1) + return APM_BAD_DEVICE; + *nbat = 1; + return apm_get_power_status(status, bat, life); + } + + if (apm_bios_call(APM_FUNC_GET_STATUS, (0x8000 | (which)), 0, &eax, + &ebx, &ecx, &edx, &esi)) return (eax >> 8) & 0xff; *status = ebx; *bat = ecx; *life = edx; + *nbat = esi; return APM_SUCCESS; } +#endif static int __init apm_engage_power_management(u_short device) { u32 eax; - if (apm_bios_call_simple(0x530f, device, 1, &eax)) + if (apm_bios_call_simple(APM_FUNC_ENGAGE_PM, device, 1, &eax)) return (eax >> 8) & 0xff; return APM_SUCCESS; } @@ -675,14 +655,12 @@ int apm_display_blank(void) { #ifdef CONFIG_APM_DISPLAY_BLANK - int error; - - if (!apm_enabled) - return 0; - error = apm_set_display_power_state(APM_STATE_STANDBY); - if (error == APM_SUCCESS) - return 1; - apm_error("set display standby", error); + if (apm_enabled) { + int error = apm_set_display_power_state(APM_STATE_STANDBY); + if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) + return 1; + apm_error("set display standby", error); + } #endif return 0; } @@ -691,14 +669,12 @@ int apm_display_unblank(void) { #ifdef CONFIG_APM_DISPLAY_BLANK - int error; - - if (!apm_enabled) - return 0; - error = apm_set_display_power_state(APM_STATE_READY); - if (error == APM_SUCCESS) - return 1; - apm_error("set display ready", error); + if (apm_enabled) { + int error = apm_set_display_power_state(APM_STATE_READY); + if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) + return 1; + apm_error("set display ready", error); + } #endif return 0; } @@ -740,12 +716,12 @@ return as->events[as->event_tail]; } -static int queue_event(apm_event_t event, struct apm_bios_struct *sender) +static void queue_event(apm_event_t event, struct apm_bios_struct *sender) { struct apm_bios_struct * as; if (user_list == NULL) - return 0; + return; for (as = user_list; as != NULL; as = as->next) { if (as == sender) continue; @@ -753,10 +729,8 @@ if (as->event_head == as->event_tail) { static int notified; - if (notified == 0) { + if (notified++ == 0) printk(KERN_ERR "apm: an event queue overflowed\n"); - notified = 1; - } as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; } as->events[as->event_head] = event; @@ -777,28 +751,25 @@ } } wake_up_interruptible(&apm_waitqueue); - return 1; } static void set_time(void) { unsigned long flags; - if (!got_clock_diff) /* Don't know time zone, can't set clock */ - return; - - save_flags(flags); - cli(); - CURRENT_TIME = get_cmos_time() + clock_cmos_diff; - restore_flags(flags); + if (got_clock_diff) { /* Must know time zone in order to set clock */ + save_flags(flags); + cli(); + CURRENT_TIME = get_cmos_time() + clock_cmos_diff; + restore_flags(flags); + } } -static void suspend(void) +static void get_time_diff(void) { +#ifndef CONFIG_APM_RTC_IS_GMT unsigned long flags; - int err; -#ifndef CONFIG_APM_RTC_IS_GMT /* * Estimate time zone so that set_time can update the clock */ @@ -809,9 +780,18 @@ got_clock_diff = 1; restore_flags(flags); #endif +} + +static void suspend(void) +{ + int err; +#ifdef INIT_TIMER_AFTER_SUSPEND + unsigned long flags; +#endif + get_time_diff(); err = apm_set_power_state(APM_STATE_SUSPEND); - if (err) + if ((err != APM_SUCCESS) && (err != APM_NO_ERROR)) apm_error("suspend", err); #ifdef INIT_TIMER_AFTER_SUSPEND save_flags(flags); @@ -832,8 +812,9 @@ { int err; + get_time_diff(); err = apm_set_power_state(APM_STATE_STANDBY); - if (err) + if ((err != APM_SUCCESS) && (err != APM_NO_ERROR)) apm_error("standby", err); } @@ -856,7 +837,7 @@ return 0; } -static void send_event(apm_event_t event, apm_event_t undo, +static int send_event(apm_event_t event, apm_event_t undo, struct apm_bios_struct *sender) { callback_list_t * call; @@ -868,11 +849,12 @@ fix->callback(undo); if (apm_bios_info.version > 0x100) apm_set_power_state(APM_STATE_REJECT); - return; + return 0; } } queue_event(event, sender); + return 1; } static void check_events(void) @@ -884,14 +866,14 @@ #endif while ((event = get_event()) != 0) { -#ifdef APM_DEBUG - if (event <= NR_APM_EVENT_NAME) - printk(KERN_DEBUG "apm: received %s notify\n", - apm_event_name[event - 1]); - else - printk(KERN_DEBUG "apm: received unknown " - "event 0x%02x\n", event); -#endif + if (debug) { + if (event <= NR_APM_EVENT_NAME) + printk(KERN_DEBUG "apm: received %s notify\n", + apm_event_name[event - 1]); + else + printk(KERN_DEBUG "apm: received unknown " + "event 0x%02x\n", event); + } #ifdef CONFIG_APM_IGNORE_SUSPEND_BOUNCE if (ignore_bounce && ((jiffies - last_resume) > BOUNCE_INTERVAL)) @@ -905,8 +887,8 @@ return; waiting_for_resume = 1; #endif - send_event(event, APM_STANDBY_RESUME, NULL); - if (standbys_pending <= 0) + if (send_event(event, APM_STANDBY_RESUME, NULL) + && (standbys_pending <= 0)) standby(); break; @@ -926,8 +908,8 @@ return; waiting_for_resume = 1; #endif - send_event(event, APM_NORMAL_RESUME, NULL); - if (suspends_pending <= 0) + if (send_event(event, APM_NORMAL_RESUME, NULL) + && (suspends_pending <= 0)) suspend(); break; @@ -945,9 +927,9 @@ send_event(event, 0, NULL); break; + case APM_CAPABILITY_CHANGE: case APM_LOW_BATTERY: case APM_POWER_STATUS_CHANGE: - case APM_CAPABILITY_CHANGE: send_event(event, 0, NULL); break; @@ -964,56 +946,22 @@ static void apm_event_handler(void) { - static int pending_count = 0; + static int pending_count = 0; if (((standbys_pending > 0) || (suspends_pending > 0)) - && (apm_bios_info.version > 0x100) - && (pending_count-- <= 0)) { - int err; - pending_count = 4; - - err = apm_set_power_state(APM_STATE_BUSY); - if (err) - apm_error("busy", err); - } - - if (!(((standbys_pending > 0) || (suspends_pending > 0)) - && (apm_bios_info.version == 0x100))) + && (apm_bios_info.version > 0x100)) { + if (pending_count-- <= 0) { + int err; + + pending_count = 4; + err = apm_set_power_state(APM_STATE_BUSY); + if (err) + apm_error("busy", err); + } + } else { + pending_count = 0; check_events(); -} - -static int apm_do_idle(void) -{ -#ifdef CONFIG_APM_CPU_IDLE - u32 dummy; - - if (!apm_enabled) - return 0; - - if (apm_bios_call_simple(0x5305, 0, 0, &dummy)) - return 0; - -#ifdef ALWAYS_CALL_BUSY - clock_slowed = 1; -#else - clock_slowed = (apm_bios_info.flags & APM_IDLE_SLOWS_CLOCK) != 0; -#endif - return 1; -#else - return 0; -#endif -} - -static void apm_do_busy(void) -{ -#ifdef CONFIG_APM_CPU_IDLE - u32 dummy; - - if (clock_slowed) { - (void) apm_bios_call_simple(0x5306, 0, 0, &dummy); - clock_slowed = 0; } -#endif } /* @@ -1046,6 +994,7 @@ */ current->state = TASK_INTERRUPTIBLE; apm_event_handler(); +#ifdef CONFIG_APM_CPU_IDLE if (!system_idle()) continue; if (apm_do_idle()) { @@ -1058,6 +1007,7 @@ apm_do_busy(); apm_event_handler(); } +#endif } } @@ -1075,7 +1025,7 @@ struct apm_bios_struct * as; int i; apm_event_t event; - DECLARE_WAITQUEUE(wait, current); + DECLARE_WAITQUEUE(wait, current); as = fp->private_data; if (check_apm_bios_struct(as, "read")) @@ -1098,7 +1048,11 @@ i = count; while ((i >= sizeof(event)) && !queue_empty(as)) { event = get_queued_event(as); - copy_to_user(buf, &event, sizeof(event)); + if (copy_to_user(buf, &event, sizeof(event))) { + if (i < count) + break; + return -EFAULT; + } switch (event) { case APM_SYS_SUSPEND: case APM_USER_SUSPEND: @@ -1137,6 +1091,7 @@ u_int cmd, u_long arg) { struct apm_bios_struct * as; + int send_ok = 1; as = filp->private_data; if (check_apm_bios_struct(as, "ioctl")) @@ -1151,8 +1106,9 @@ standbys_pending--; } else - send_event(APM_USER_STANDBY, APM_STANDBY_RESUME, as); - if (standbys_pending <= 0) + send_ok = send_event(APM_USER_STANDBY, + APM_STANDBY_RESUME, as); + if (send_ok && (standbys_pending <= 0)) standby(); break; case APM_IOC_SUSPEND: @@ -1162,8 +1118,9 @@ suspends_pending--; } else - send_event(APM_USER_SUSPEND, APM_NORMAL_RESUME, as); - if (suspends_pending <= 0) + send_ok = send_event(APM_USER_SUSPEND, + APM_NORMAL_RESUME, as); + if (send_ok && (suspends_pending <= 0)) suspend(); break; default: @@ -1177,9 +1134,9 @@ struct apm_bios_struct * as; as = filp->private_data; - filp->private_data = NULL; if (check_apm_bios_struct(as, "release")) return 0; + filp->private_data = NULL; if (as->standbys_pending > 0) { standbys_pending -= as->standbys_pending; if (standbys_pending <= 0) @@ -1272,7 +1229,7 @@ from the Get Power Status (0x0a) call unless otherwise noted. 0) Linux driver version (this will change if format changes) - 1) APM BIOS Version. Usually 1.0 or 1.1. + 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2. 2) APM flags from APM Installation Check (0x00): bit 0: APM_16_BIT_SUPPORT bit 1: APM_32_BIT_SUPPORT @@ -1282,13 +1239,14 @@ 3) AC line status 0x00: Off-line 0x01: On-line - 0x02: On backup power (APM BIOS 1.1 only) + 0x02: On backup power (BIOS >= 1.1 only) 0xff: Unknown 4) Battery status 0x00: High 0x01: Low 0x02: Critical 0x03: Charging + 0x04: Selected battery not present (BIOS >= 1.2 only) 0xff: Unknown 5) Battery flag bit 0: High @@ -1346,7 +1304,7 @@ if (debug) { printk(KERN_INFO "apm: Connection version %d.%d\n", (apm_bios_info.version >> 8) & 0xff, - apm_bios_info.version & 0xff ); + apm_bios_info.version & 0xff); error = apm_get_power_status(&bx, &cx, &dx); if (error) @@ -1406,10 +1364,10 @@ apm_bios_info.flags &= ~APM_BIOS_DISENGAGED; } -/* Install our power off handler.. */ -#ifdef CONFIG_APM_POWER_OFF - acpi_power_off = apm_power_off; -#endif + /* Install our power off handler.. */ + if (power_off_enabled) + acpi_power_off = apm_power_off; + sysrq_power_off = apm_power_off; apm_mainloop(); return 0; @@ -1429,6 +1387,8 @@ str += 3; if (strncmp(str, "debug", 5) == 0) debug = !invert; + if (strncmp(str, "power-off", 9) == 0) + power_off_enabled = !invert; if (strncmp(str, "smp-power-off", 13) == 0) smp_hack = !invert; str = strchr(str, ','); @@ -1440,6 +1400,29 @@ __setup("apm=", apm_setup); +static struct file_operations apm_bios_fops = { + NULL, /* lseek */ + do_read, + NULL, /* write */ + NULL, /* readdir */ + do_poll, + do_ioctl, + NULL, /* mmap */ + do_open, + NULL, /* flush */ + do_release, + NULL, /* fsync */ + NULL /* fasync */ +}; + +static struct miscdevice apm_device = { + APM_MINOR_DEV, + "apm", + &apm_bios_fops +}; + +#define APM_INIT_ERROR_RETURN return -1 + /* * Just start the APM thread. We do NOT want to do APM BIOS * calls from anything but the APM thread, if for no other reason @@ -1454,7 +1437,7 @@ { if (apm_bios_info.version == 0) { printk(KERN_INFO "apm: BIOS not found.\n"); - return -1; + APM_INIT_ERROR_RETURN; } printk(KERN_INFO "apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n", @@ -1464,7 +1447,7 @@ driver_version); if ((apm_bios_info.flags & APM_32_BIT_SUPPORT) == 0) { printk(KERN_INFO "apm: no 32 bit BIOS support\n"); - return -1; + APM_INIT_ERROR_RETURN; } /* @@ -1493,17 +1476,8 @@ if (apm_disabled) { printk(KERN_NOTICE "apm: disabled on user request.\n"); - return -1; - } - -#ifdef CONFIG_SMP - if (smp_num_cpus > 1) { - printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n"); - if (smp_hack) - smp_hack = 2; - return -1; + APM_INIT_ERROR_RETURN; } -#endif /* * Set up a segment that references the real mode segment 0x40 @@ -1545,7 +1519,16 @@ } #endif - create_proc_info_entry("apm", 0, 0, apm_get_info); +#ifdef CONFIG_SMP + if (smp_num_cpus > 1) { + printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n"); + if (smp_hack) + smp_hack = 2; + APM_INIT_ERROR_RETURN; + } +#endif + + create_proc_info_entry("apm", 0, 0, apm_get_info); misc_register(&apm_device); diff -u --recursive --new-file v2.3.25/linux/arch/i386/kernel/sys_i386.c linux/arch/i386/kernel/sys_i386.c --- v2.3.25/linux/arch/i386/kernel/sys_i386.c Thu Dec 17 16:27:35 1998 +++ linux/arch/i386/kernel/sys_i386.c Wed Nov 3 11:31:09 1999 @@ -116,86 +116,71 @@ version = call >> 16; /* hack for backward compatibility */ call &= 0xffff; - if (call <= SEMCTL) - 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; + 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) return -EINVAL; - if (get_user(fourth.__pad, (void **) ptr)) + + if (copy_from_user(&tmp, + (struct ipc_kludge *) ptr, + sizeof (tmp))) return -EFAULT; - return sys_semctl (first, second, third, fourth); - } + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); + } default: - return -EINVAL; + return sys_msgrcv (first, + (struct msgbuf *) ptr, + second, fifth, third); } + case MSGGET: + return sys_msgget ((key_t) first, second); + case MSGCTL: + return sys_msgctl (first, second, (struct msqid_ds *) ptr); - if (call <= MSGCTL) - switch (call) { - case MSGSND: - return sys_msgsnd (first, (struct msgbuf *) ptr, - second, third); - case MSGRCV: - switch (version) { - case 0: { - struct ipc_kludge tmp; - if (!ptr) - 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); - } - default: - return sys_msgrcv (first, - (struct msgbuf *) ptr, - second, fifth, third); - } - case MSGGET: - return sys_msgget ((key_t) first, second); - case MSGCTL: - return sys_msgctl (first, second, - (struct msqid_ds *) ptr); - default: - return -EINVAL; + 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); } - if (call <= SHMCTL) - switch (call) { - 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); - } - 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; + case 1: /* iBCS2 emulator entry point */ + if (!segment_eq(get_fs(), get_ds())) + return -EINVAL; + return sys_shmat (first, (char *) ptr, second, (ulong *) third); } - - return -EINVAL; + 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; + } } /* diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/README linux/arch/i386/math-emu/README --- v2.3.25/linux/arch/i386/math-emu/README Wed Jun 24 14:30:08 1998 +++ linux/arch/i386/math-emu/README Thu Nov 4 09:10:22 1999 @@ -1,9 +1,9 @@ +---------------------------------------------------------------------------+ | wm-FPU-emu an FPU emulator for 80386 and 80486SX microprocessors. | | | - | Copyright (C) 1992,1993,1994,1995,1996,1997 | + | Copyright (C) 1992,1993,1994,1995,1996,1997,1999 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | - | Australia. E-mail billm@suburbia.net | + | Australia. E-mail billm@melbpc.org.au | | | | This program is free software; you can redistribute it and/or modify | | it under the terms of the GNU General Public License version 2 as | @@ -42,14 +42,15 @@ some differences. Please report bugs, etc to me at: - billm@suburbia.net + billm@melbpc.org.au +or b.metzenthen@medoto.unimelb.edu.au For more information on the emulator and on floating point topics, see my web pages, currently at http://www.suburbia.net/~billm/ --Bill Metzenthen - December 1997 + December 1999 ----------------------- Internals of wm-FPU-emu ----------------------- @@ -98,7 +99,7 @@ ----------------------- Limitations of wm-FPU-emu ----------------------- There are a number of differences between the current wm-FPU-emu -(version 2.00) and the 80486 FPU (apart from bugs). The differences +(version 2.01) and the 80486 FPU (apart from bugs). The differences are fewer than those which applied to the 1.xx series of the emulator. Some of the more important differences are listed below: diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/fpu_trig.c linux/arch/i386/math-emu/fpu_trig.c --- v2.3.25/linux/arch/i386/math-emu/fpu_trig.c Tue Dec 9 17:57:09 1997 +++ linux/arch/i386/math-emu/fpu_trig.c Thu Nov 4 09:10:22 1999 @@ -3,9 +3,9 @@ | | | Implementation of the FPU "transcendental" functions. | | | - | Copyright (C) 1992,1993,1994,1997 | + | Copyright (C) 1992,1993,1994,1997,1999 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | - | Australia. E-mail billm@suburbia.net | + | Australia. E-mail billm@melbpc.org.au | | | | | +---------------------------------------------------------------------------*/ @@ -85,7 +85,8 @@ FPU_normalize(&tmp); tmptag = FPU_u_mul(&CONST_PI2extra, &tmp, &tmp, FULL_PRECISION, SIGN_POS, - exponent16(&CONST_PI2extra) + exponent16(&tmp)); + exponent(&CONST_PI2extra) + exponent(&tmp)); + setsign(&tmp, getsign(&CONST_PI2extra)); st0_tag = FPU_add(&tmp, tmptag, 0, FULL_PRECISION); if ( signnegative(st0_ptr) ) { @@ -117,7 +118,8 @@ FPU_normalize(&tmp); /* This must return TAG_Valid */ tmptag = FPU_u_mul(&CONST_PI2extra, &tmp, &tmp, FULL_PRECISION, SIGN_POS, - exponent16(&CONST_PI2extra) + exponent16(&tmp)); + exponent(&CONST_PI2extra) + exponent(&tmp)); + setsign(&tmp, getsign(&CONST_PI2extra)); st0_tag = FPU_sub(LOADED|(tmptag & 0x0f), (int)&tmp, FULL_PRECISION); if ( (exponent(st0_ptr) == exponent(&CONST_PI2)) && @@ -827,18 +829,29 @@ unsigned long long st1, unsigned long long q, int n) { + int dummy; unsigned long long x; x = st0 << n; /* Do the required multiplication and subtraction in the one operation */ - asm volatile ("movl %2,%%eax; mull %4; subl %%eax,%0; sbbl %%edx,%1; - movl %3,%%eax; mull %4; subl %%eax,%1; - movl %2,%%eax; mull %5; subl %%eax,%1;" - :"=m" (x), "=m" (((unsigned *)&x)[1]) - :"m" (st1),"m" (((unsigned *)&st1)[1]), - "m" (q),"m" (((unsigned *)&q)[1]) - :"%ax","%dx"); + + /* lsw x -= lsw st1 * lsw q */ + asm volatile ("mull %4; subl %%eax,%0; sbbl %%edx,%1" + :"=m" (((unsigned *)&x)[0]), "=m" (((unsigned *)&x)[1]), + "=a" (dummy) + :"2" (((unsigned *)&st1)[0]), "m" (((unsigned *)&q)[0]) + :"%dx"); + /* msw x -= msw st1 * lsw q */ + asm volatile ("mull %3; subl %%eax,%0" + :"=m" (((unsigned *)&x)[1]), "=a" (dummy) + :"1" (((unsigned *)&st1)[1]), "m" (((unsigned *)&q)[0]) + :"%dx"); + /* msw x -= lsw st1 * msw q */ + asm volatile ("mull %3; subl %%eax,%0" + :"=m" (((unsigned *)&x)[1]), "=a" (dummy) + :"1" (((unsigned *)&st1)[0]), "m" (((unsigned *)&q)[1]) + :"%dx"); *y = x; } diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/poly.h linux/arch/i386/math-emu/poly.h --- v2.3.25/linux/arch/i386/math-emu/poly.h Tue Apr 7 07:48:54 1998 +++ linux/arch/i386/math-emu/poly.h Thu Nov 4 09:10:22 1999 @@ -3,9 +3,9 @@ | | | Header file for the FPU-emu poly*.c source files. | | | - | Copyright (C) 1994 | + | Copyright (C) 1994,1999 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | - | Australia. E-mail billm@vaxc.cc.monash.edu.au | + | Australia. E-mail billm@melbpc.org.au | | | | Declarations and definitions for functions operating on Xsig (12-byte | | extended-significand) quantities. | @@ -55,15 +55,20 @@ actually be in-line. */ -/* Multiply two fixed-point 32 bit numbers. */ -extern inline void mul_32_32(const unsigned long arg1, - const unsigned long arg2, - unsigned long *out) +/* Multiply two fixed-point 32 bit numbers, producing a 32 bit result. + The answer is the ms word of the product. */ +/* Some versions of gcc make it difficult to stop eax from being clobbered. + Merely specifying that it is used doesn't work... + */ +extern inline unsigned long mul_32_32(const unsigned long arg1, + const unsigned long arg2) { - asm volatile ("movl %1,%%eax; mull %2; movl %%edx,%0" \ - :"=g" (*out) \ - :"g" (arg1), "g" (arg2) \ - :"ax","dx"); + int retval; + asm volatile ("mull %2; movl %%edx,%%eax" \ + :"=a" (retval) \ + :"0" (arg1), "g" (arg2) \ + :"dx"); + return retval; } diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/poly_sin.c linux/arch/i386/math-emu/poly_sin.c --- v2.3.25/linux/arch/i386/math-emu/poly_sin.c Tue Dec 9 17:57:09 1997 +++ linux/arch/i386/math-emu/poly_sin.c Thu Nov 4 09:10:22 1999 @@ -4,9 +4,9 @@ | Computation of an approximation of the sin function and the cosine | | function by a polynomial. | | | - | Copyright (C) 1992,1993,1994,1997 | + | Copyright (C) 1992,1993,1994,1997,1999 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia | - | E-mail billm@suburbia.net | + | E-mail billm@melbpc.org.au | | | | | +---------------------------------------------------------------------------*/ @@ -132,6 +132,9 @@ } /* pi/2 in hex is: 1.921fb54442d18469 898CC51701B839A2 52049C1 */ fixed_arg = 0x921fb54442d18469LL - fixed_arg; + /* There is a special case which arises due to rounding, to fix here. */ + if ( fixed_arg == 0xffffffffffffffffLL ) + fixed_arg = 0; XSIG_LL(argSqrd) = fixed_arg; argSqrd.lsw = 0; mul64_Xsig(&argSqrd, &fixed_arg); @@ -172,10 +175,9 @@ if ( argSqrd.msw & 0xffc00000 ) { /* Get about 32 bit precision in these: */ - mul_32_32(0x898cc517, argSqrd.msw, &adj); - fix_up -= adj/6; + fix_up -= mul_32_32(0x898cc517, argSqrd.msw) / 6; } - mul_32_32(fix_up, LL_MSW(fixed_arg), &fix_up); + fix_up = mul_32_32(fix_up, LL_MSW(fixed_arg)); adj = accumulator.lsw; /* temp save */ accumulator.lsw -= fix_up; @@ -211,7 +213,6 @@ FPU_REG result; long int exponent, exp2, echange; Xsig accumulator, argSqrd, fix_up, argTo4; - unsigned long adj; unsigned long long fixed_arg; #ifdef PARANOID @@ -300,6 +301,9 @@ } /* pi/2 in hex is: 1.921fb54442d18469 898CC51701B839A2 52049C1 */ fixed_arg = 0x921fb54442d18469LL - fixed_arg; + /* There is a special case which arises due to rounding, to fix here. */ + if ( fixed_arg == 0xffffffffffffffffLL ) + fixed_arg = 0; exponent = -1; exp2 = -1; @@ -363,10 +367,8 @@ if ( argSqrd.msw & 0xffc00000 ) { /* Get about 32 bit precision in these: */ - mul_32_32(0x898cc517, argSqrd.msw, &adj); - fix_up.msw -= adj/2; - mul_32_32(0x898cc517, argTo4.msw, &adj); - fix_up.msw += adj/24; + fix_up.msw -= mul_32_32(0x898cc517, argSqrd.msw) / 2; + fix_up.msw += mul_32_32(0x898cc517, argTo4.msw) / 24; } exp2 += norm_Xsig(&accumulator); diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/poly_tan.c linux/arch/i386/math-emu/poly_tan.c --- v2.3.25/linux/arch/i386/math-emu/poly_tan.c Tue Dec 9 17:57:09 1997 +++ linux/arch/i386/math-emu/poly_tan.c Thu Nov 4 09:10:22 1999 @@ -3,9 +3,9 @@ | | | Compute the tan of a FPU_REG, using a polynomial approximation. | | | - | Copyright (C) 1992,1993,1994,1997 | + | Copyright (C) 1992,1993,1994,1997,1999 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | - | Australia. E-mail billm@suburbia.net | + | Australia. E-mail billm@melbpc.org.au | | | | | +---------------------------------------------------------------------------*/ @@ -84,6 +84,14 @@ } /* pi/2 in hex is: 1.921fb54442d18469 898CC51701B839A2 52049C1 */ XSIG_LL(accum) = 0x921fb54442d18469LL - XSIG_LL(accum); + /* This is a special case which arises due to rounding. */ + if ( XSIG_LL(accum) == 0xffffffffffffffffLL ) + { + FPU_settag0(TAG_Valid); + significand(st0_ptr) = 0x8a51e04daabda360LL; + setexponent16(st0_ptr, 0x41 + EXTENDED_Ebias | SIGN_Negative); + return; + } argSignif.lsw = accum.lsw; XSIG_LL(argSignif) = XSIG_LL(accum); @@ -177,11 +185,11 @@ else if ( exponent > -30 ) { adj = accum.msw >> -(exponent+1); /* tan */ - mul_32_32(adj, adj, &adj); /* tan^2 */ + adj = mul_32_32(adj, adj); /* tan^2 */ } else adj = 0; - mul_32_32(0x898cc517, adj, &adj); /* delta * tan^2 */ + adj = mul_32_32(0x898cc517, adj); /* delta * tan^2 */ fix_up.msw += adj; if ( !(fix_up.msw & 0x80000000) ) /* did fix_up overflow ? */ diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/reg_round.S linux/arch/i386/math-emu/reg_round.S --- v2.3.25/linux/arch/i386/math-emu/reg_round.S Tue Aug 31 17:29:12 1999 +++ linux/arch/i386/math-emu/reg_round.S Thu Nov 4 09:10:22 1999 @@ -365,7 +365,7 @@ jne LDo_64_round_up /* Now test for round-to-even */ - testb $1,%ebx + testb $1,%bl jz LCheck_truncate_64 LDo_64_round_up: diff -u --recursive --new-file v2.3.25/linux/arch/i386/math-emu/version.h linux/arch/i386/math-emu/version.h --- v2.3.25/linux/arch/i386/math-emu/version.h Tue Dec 9 17:57:09 1997 +++ linux/arch/i386/math-emu/version.h Thu Nov 4 09:10:22 1999 @@ -2,11 +2,11 @@ | version.h | | | | | - | Copyright (C) 1992,1993,1994,1996,1997 | + | Copyright (C) 1992,1993,1994,1996,1997,1999 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia | - | E-mail billm@suburbia.net | + | E-mail billm@melbpc.org.au | | | | | +---------------------------------------------------------------------------*/ -#define FPU_VERSION "wm-FPU-emu version 2.00" +#define FPU_VERSION "wm-FPU-emu version 2.01" diff -u --recursive --new-file v2.3.25/linux/arch/i386/mm/init.c linux/arch/i386/mm/init.c --- v2.3.25/linux/arch/i386/mm/init.c Fri Oct 22 13:21:45 1999 +++ linux/arch/i386/mm/init.c Fri Nov 5 15:21:27 1999 @@ -379,10 +379,16 @@ { int i; /* - * Zap initial low-memory mappings: + * Zap initial low-memory mappings. + * + * Note that "pgd_clear()" doesn't do it for + * us in this case, because pgd_clear() is a + * no-op in the 2-level case (pmd_clear() is + * the thing that clears the page-tables in + * that case). */ for (i = 0; i < USER_PTRS_PER_PGD; i++) - pgd_clear(swapper_pg_dir + i); + pgd_val(swapper_pg_dir[i]) = 0; } /* diff -u --recursive --new-file v2.3.25/linux/arch/m68k/config.in linux/arch/m68k/config.in --- v2.3.25/linux/arch/m68k/config.in Sat Oct 9 11:47:50 1999 +++ linux/arch/m68k/config.in Fri Nov 5 10:22:51 1999 @@ -70,6 +70,11 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC diff -u --recursive --new-file v2.3.25/linux/arch/m68k/defconfig linux/arch/m68k/defconfig --- v2.3.25/linux/arch/m68k/defconfig Thu Feb 25 10:46:46 1999 +++ linux/arch/m68k/defconfig Fri Nov 5 10:22:51 1999 @@ -38,6 +38,8 @@ CONFIG_NET=y CONFIG_SYSVIPC=y CONFIG_SYSCTL=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y CONFIG_ZORRO=y diff -u --recursive --new-file v2.3.25/linux/arch/m68k/kernel/process.c linux/arch/m68k/kernel/process.c --- v2.3.25/linux/arch/m68k/kernel/process.c Tue Sep 7 12:14:06 1999 +++ linux/arch/m68k/kernel/process.c Tue Nov 2 08:43:37 1999 @@ -102,10 +102,6 @@ void machine_power_off(void) { -#if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF) - apm_set_power_state(APM_STATE_OFF); -#endif - if (mach_power_off) mach_power_off(); for (;;); diff -u --recursive --new-file v2.3.25/linux/arch/mips/config.in linux/arch/mips/config.in --- v2.3.25/linux/arch/mips/config.in Mon Nov 1 13:56:26 1999 +++ linux/arch/mips/config.in Fri Nov 5 10:22:51 1999 @@ -69,6 +69,9 @@ bool 'Generate little endian code' CONFIG_CPU_LITTLE_ENDIAN fi +if [ "$CONFIG_PROC_FS" = "y" ]; then + define_bool CONFIG_KCORE_ELF y +fi define_bool CONFIG_ELF_KERNEL y if [ "$CONFIG_CPU_LITTLE_ENDIAN" = "n" ]; then diff -u --recursive --new-file v2.3.25/linux/arch/mips/defconfig linux/arch/mips/defconfig --- v2.3.25/linux/arch/mips/defconfig Mon Jul 5 19:44:57 1999 +++ linux/arch/mips/defconfig Fri Nov 5 10:22:51 1999 @@ -35,6 +35,8 @@ CONFIG_PCI_QUIRKS=y CONFIG_PCI_OLD_PROC=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_ELF_KERNEL=y # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_ELF=y diff -u --recursive --new-file v2.3.25/linux/arch/ppc/amiga/Makefile linux/arch/ppc/amiga/Makefile --- v2.3.25/linux/arch/ppc/amiga/Makefile Sat Oct 9 11:47:50 1999 +++ linux/arch/ppc/amiga/Makefile Fri Nov 5 15:53:25 1999 @@ -9,7 +9,8 @@ O_TARGET := amiga.o O_OBJS := config.o amiints.o cia.o time.o \ - bootinfo.o amisound.o chipram.o ints.o + bootinfo.o amisound.o chipram.o + OX_OBJS := amiga_ksyms.o ifdef CONFIG_AMIGA_PCMCIA diff -u --recursive --new-file v2.3.25/linux/arch/ppc/amiga/amiints.c linux/arch/ppc/amiga/amiints.c --- v2.3.25/linux/arch/ppc/amiga/amiints.c Sat Oct 9 11:47:50 1999 +++ linux/arch/ppc/amiga/amiints.c Fri Nov 5 15:53:25 1999 @@ -53,10 +53,10 @@ #include #endif -extern int cia_request_irq(struct ciabase *base,int irq, +extern int cia_request_irq(int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); -extern void cia_free_irq(struct ciabase *base, unsigned int irq, void *dev_id); +extern void cia_free_irq(unsigned int irq, void *dev_id); extern void cia_init_IRQ(struct ciabase *base); extern int cia_get_irq_list(struct ciabase *base, char *buf); @@ -89,7 +89,8 @@ * the amiga IRQ handling routines. */ -void __init amiga_init_IRQ(void) +__init +void amiga_init_IRQ(void) { int i; @@ -216,13 +217,8 @@ return sys_request_irq(irq - IRQ_AMIGA_AUTO, handler, flags, devname, dev_id); - if (irq >= IRQ_AMIGA_CIAB) - return cia_request_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, - handler, flags, devname, dev_id); - if (irq >= IRQ_AMIGA_CIAA) - return cia_request_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA, - handler, flags, devname, dev_id); + return cia_request_irq(irq, handler, flags, devname, dev_id); /* * IRQ_AMIGA_PORTS & IRQ_AMIGA_EXTER defaults to shared, @@ -262,13 +258,8 @@ if (irq >= IRQ_AMIGA_AUTO) sys_free_irq(irq - IRQ_AMIGA_AUTO, dev_id); - if (irq >= IRQ_AMIGA_CIAB) { - cia_free_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, dev_id); - return; - } - if (irq >= IRQ_AMIGA_CIAA) { - cia_free_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA, dev_id); + cia_free_irq(irq, dev_id); return; } @@ -314,17 +305,9 @@ return; } - if (irq >= IRQ_AMIGA_CIAB) { - cia_set_irq(&ciab_base, (1 << (irq - IRQ_AMIGA_CIAB))); - cia_able_irq(&ciab_base, CIA_ICR_SETCLR | - (1 << (irq - IRQ_AMIGA_CIAB))); - return; - } - if (irq >= IRQ_AMIGA_CIAA) { - cia_set_irq(&ciaa_base, (1 << (irq - IRQ_AMIGA_CIAA))); - cia_able_irq(&ciaa_base, CIA_ICR_SETCLR | - (1 << (irq - IRQ_AMIGA_CIAA))); + cia_set_irq(irq, 0); + cia_able_irq(irq, 1); return; } @@ -349,13 +332,8 @@ return; } - if (irq >= IRQ_AMIGA_CIAB) { - cia_able_irq(&ciab_base, 1 << (irq - IRQ_AMIGA_CIAB)); - return; - } - if (irq >= IRQ_AMIGA_CIAA) { - cia_able_irq(&ciaa_base, 1 << (irq - IRQ_AMIGA_CIAA)); + cia_able_irq(irq, 0); return; } @@ -528,10 +506,20 @@ panic ("level 7 interrupt received\n"); } +#ifdef CONFIG_APUS +/* The PPC irq handling links all handlers requested on the same vector + and executes them in a loop. Having ami_badint at the end of the chain + is a bad idea. */ +void (*amiga_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { + NULL, ami_int1, NULL, NULL /* FB expects to replace ami_int3*/, + ami_int4, ami_int5, NULL, ami_int7 +}; +#else void (*amiga_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { ami_badint, ami_int1, ami_badint, ami_int3, ami_int4, ami_int5, ami_badint, ami_int7 }; +#endif int amiga_get_irq_list(char *buf) { diff -u --recursive --new-file v2.3.25/linux/arch/ppc/amiga/cia.c linux/arch/ppc/amiga/cia.c --- v2.3.25/linux/arch/ppc/amiga/cia.c Tue Aug 4 16:06:36 1998 +++ linux/arch/ppc/amiga/cia.c Fri Nov 5 15:53:25 1999 @@ -1 +1,235 @@ -#include "../../m68k/amiga/cia.c" +/* + * linux/arch/m68k/amiga/cia.c - CIA support + * + * Copyright (C) 1996 Roman Zippel + * + * The concept of some functions bases on the original Amiga OS function + * + * 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. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +struct ciabase { + volatile struct CIA *cia; + u_char icr_mask, icr_data; + u_short int_mask; + int handler_irq, cia_irq, server_irq; + char *name; + struct irq_server server; + irq_handler_t irq_list[CIA_IRQS]; +} ciaa_base = { + &ciaa, 0, 0, IF_PORTS, + IRQ_AMIGA_AUTO_2, IRQ_AMIGA_CIAA, + IRQ_AMIGA_PORTS, + "CIAA handler", {0, 0} +}, ciab_base = { + &ciab, 0, 0, IF_EXTER, + IRQ_AMIGA_AUTO_6, IRQ_AMIGA_CIAB, + IRQ_AMIGA_EXTER, + "CIAB handler", {0, 0} +}; + +#define CIA_SET_BASE_ADJUST_IRQ(base, irq) \ +do { \ + if (irq >= IRQ_AMIGA_CIAB) { \ + base = &ciab_base; \ + irq =- IRQ_AMIGA_CIAB; \ + } else { \ + base = &ciaa_base; \ + irq =- IRQ_AMIGA_CIAA; \ + } \ +} while (0) + +/* + * Cause or clear CIA interrupts, return old interrupt status. + */ + +static unsigned char cia_set_irq_private(struct ciabase *base, + unsigned char mask) +{ + u_char old; + + old = (base->icr_data |= base->cia->icr); + if (mask & CIA_ICR_SETCLR) + base->icr_data |= mask; + else + base->icr_data &= ~mask; + if (base->icr_data & base->icr_mask) + custom.intreq = IF_SETCLR | base->int_mask; + return old & base->icr_mask; +} + +unsigned char cia_set_irq(unsigned int irq, int set) +{ + struct ciabase *base; + unsigned char mask; + + if (irq >= IRQ_AMIGA_CIAB) + mask = (1 << (irq - IRQ_AMIGA_CIAB)); + else + mask = (1 << (irq - IRQ_AMIGA_CIAA)); + mask |= (set) ? CIA_ICR_SETCLR : 0; + + CIA_SET_BASE_ADJUST_IRQ(base, irq); + + return cia_set_irq_private(base, mask); +} + +unsigned char cia_get_irq_mask(unsigned int irq) +{ + struct ciabase *base; + + CIA_SET_BASE_ADJUST_IRQ(base, irq); + + return base->cia->icr; +} + +/* + * Enable or disable CIA interrupts, return old interrupt mask, + * interrupts will only be enabled if a handler exists + */ + +static unsigned char cia_able_irq_private(struct ciabase *base, + unsigned char mask) +{ + u_char old, tmp; + int i; + + old = base->icr_mask; + base->icr_data |= base->cia->icr; + base->cia->icr = mask; + if (mask & CIA_ICR_SETCLR) + base->icr_mask |= mask; + else + base->icr_mask &= ~mask; + base->icr_mask &= CIA_ICR_ALL; + for (i = 0, tmp = 1; i < CIA_IRQS; i++, tmp <<= 1) { + if ((tmp & base->icr_mask) && !base->irq_list[i].handler) { + base->icr_mask &= ~tmp; + base->cia->icr = tmp; + } + } + if (base->icr_data & base->icr_mask) + custom.intreq = IF_SETCLR | base->int_mask; + return old; +} + +unsigned char cia_able_irq(unsigned int irq, int enable) +{ + struct ciabase *base; + unsigned char mask; + + if (irq >= IRQ_AMIGA_CIAB) + mask = (1 << (irq - IRQ_AMIGA_CIAB)); + else + mask = (1 << (irq - IRQ_AMIGA_CIAA)); + mask |= (enable) ? CIA_ICR_SETCLR : 0; + + CIA_SET_BASE_ADJUST_IRQ(base, irq); + + return cia_able_irq_private(base, mask); +} + +int cia_request_irq(unsigned int irq, + void (*handler)(int, void *, struct pt_regs *), + unsigned long flags, const char *devname, void *dev_id) +{ + u_char mask; + struct ciabase *base; + + CIA_SET_BASE_ADJUST_IRQ(base, irq); + + base->irq_list[irq].handler = handler; + base->irq_list[irq].flags = flags; + base->irq_list[irq].dev_id = dev_id; + base->irq_list[irq].devname = devname; + + /* enable the interrupt */ + mask = 1 << irq; + cia_set_irq_private(base, mask); + cia_able_irq_private(base, CIA_ICR_SETCLR | mask); + return 0; +} + +void cia_free_irq(unsigned int irq, void *dev_id) +{ + struct ciabase *base; + + CIA_SET_BASE_ADJUST_IRQ(base, irq); + + if (base->irq_list[irq].dev_id != dev_id) + printk("%s: removing probably wrong IRQ %i from %s\n", + __FUNCTION__, base->cia_irq + irq, + base->irq_list[irq].devname); + + base->irq_list[irq].handler = NULL; + base->irq_list[irq].flags = 0; + + cia_able_irq_private(base, 1 << irq); +} + +static void cia_handler(int irq, void *dev_id, struct pt_regs *fp) +{ + struct ciabase *base = (struct ciabase *)dev_id; + int mach_irq, i; + unsigned char ints; + + mach_irq = base->cia_irq; + irq = SYS_IRQS + mach_irq; + ints = cia_set_irq_private(base, CIA_ICR_ALL); + custom.intreq = base->int_mask; + for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) { + if (ints & 1) { + kstat.irqs[0][irq]++; + base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp); + } + ints >>= 1; + } + amiga_do_irq_list(base->server_irq, fp, &base->server); +} + +void __init cia_init_IRQ(struct ciabase *base) +{ + int i; + + /* init isr handlers */ + for (i = 0; i < CIA_IRQS; i++) { + base->irq_list[i].handler = NULL; + base->irq_list[i].flags = 0; + } + + /* clear any pending interrupt and turn off all interrupts */ + cia_set_irq_private(base, CIA_ICR_ALL); + cia_able_irq_private(base, CIA_ICR_ALL); + + /* install CIA handler */ + request_irq(base->handler_irq, cia_handler, 0, base->name, base); + + custom.intena = IF_SETCLR | base->int_mask; +} + +int cia_get_irq_list(struct ciabase *base, char *buf) +{ + int i, j, len = 0; + + j = base->cia_irq; + for (i = 0; i < CIA_IRQS; i++) { + len += sprintf(buf+len, "cia %2d: %10d ", j + i, + kstat.irqs[0][SYS_IRQS + j + i]); + len += sprintf(buf+len, " "); + len += sprintf(buf+len, "%s\n", base->irq_list[i].devname); + } + return len; +} diff -u --recursive --new-file v2.3.25/linux/arch/ppc/amiga/config.c linux/arch/ppc/amiga/config.c --- v2.3.25/linux/arch/ppc/amiga/config.c Sat Oct 9 11:47:50 1999 +++ linux/arch/ppc/amiga/config.c Fri Nov 5 15:53:25 1999 @@ -461,6 +461,8 @@ #define TICK_SIZE 10000 +extern unsigned char cia_get_irq_mask(unsigned int irq); + /* This is always executed with interrupts disabled. */ static unsigned long amiga_gettimeoffset (void) { @@ -481,7 +483,7 @@ if (ticks > jiffy_ticks / 2) /* check for pending interrupt */ - if (cia_set_irq(&ciab_base, 0) & CIA_ICR_TA) + if (cia_get_irq_mask(IRQ_AMIGA_CIAB) & CIA_ICR_TA) offset = 10000; ticks = jiffy_ticks - ticks; diff -u --recursive --new-file v2.3.25/linux/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig --- v2.3.25/linux/arch/ppc/common_defconfig Sat Oct 9 11:47:50 1999 +++ linux/arch/ppc/common_defconfig Fri Nov 5 15:53:25 1999 @@ -1,13 +1,19 @@ # -# Automatically generated by make menuconfig: don't edit +# Automatically generated make config: don't edit # # +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y + +# # Platform support # CONFIG_PPC=y CONFIG_6xx=y # CONFIG_PPC64 is not set +# CONFIG_82xx is not set # CONFIG_8xx is not set # CONFIG_PMAC is not set # CONFIG_PREP is not set @@ -15,17 +21,19 @@ CONFIG_ALL_PPC=y # CONFIG_GEMINI is not set # CONFIG_APUS is not set -# CONFIG_MBX is not set # CONFIG_SMP is not set CONFIG_6xx=y # -# General setup +# Loadable module support # -CONFIG_EXPERIMENTAL=y CONFIG_MODULES=y CONFIG_MODVERSIONS=y CONFIG_KMOD=y + +# +# General setup +# CONFIG_PCI=y CONFIG_NET=y CONFIG_SYSCTL=y @@ -34,6 +42,11 @@ CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y # CONFIG_BINFMT_MISC is not set + +# +# PCMCIA/CardBus support +# +# CONFIG_PCMCIA is not set # CONFIG_PARPORT is not set CONFIG_VGA_CONSOLE=y CONFIG_FB=y @@ -41,7 +54,6 @@ CONFIG_PMAC_PBOOK=y CONFIG_MAC_FLOPPY=y CONFIG_MAC_SERIAL=y -# CONFIG_SERIAL_CONSOLE is not set CONFIG_ADB=y CONFIG_ADB_CUDA=y CONFIG_ADB_MACIO=y @@ -57,21 +69,27 @@ # Plug and Play configuration # # CONFIG_PNP is not set -# CONFIG_ISAPNP is not set # # Block devices # CONFIG_BLK_DEV_FD=y CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# # CONFIG_BLK_DEV_HD_IDE is not set CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set CONFIG_BLK_DEV_IDECD=y -# CONFIG_IDECD_SLOTS is not set # CONFIG_BLK_DEV_IDETAPE is not set CONFIG_BLK_DEV_IDEFLOPPY=y # CONFIG_BLK_DEV_IDESCSI is not set + +# +# IDE chipset support/bugfixes +# # CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_RZ1000 is not set # CONFIG_BLK_DEV_IDEPCI is not set @@ -83,12 +101,17 @@ CONFIG_IDEDMA_AUTO=y # CONFIG_IDE_CHIPSETS is not set # CONFIG_BLK_CPQ_DA is not set + +# +# Additional Block Devices +# CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_MD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_INITRD=y # CONFIG_BLK_DEV_XD is not set +# CONFIG_BLK_DEV_DAC960 is not set CONFIG_PARIDE_PARPORT=y # CONFIG_PARIDE is not set CONFIG_BLK_DEV_IDE_MODES=y @@ -115,10 +138,18 @@ # CONFIG_IP_MROUTE is not set CONFIG_IP_ALIAS=y CONFIG_SYN_COOKIES=y + +# +# (it is safe to leave these untouched) +# CONFIG_SKB_LARGE=y # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set + +# +# +# # CONFIG_IPX is not set CONFIG_ATALK=m # CONFIG_DECNET is not set @@ -140,11 +171,19 @@ # SCSI support # CONFIG_SCSI=y + +# +# SCSI support type (disk, tape, CD-ROM) +# CONFIG_BLK_DEV_SD=y CONFIG_CHR_DEV_ST=y CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y # CONFIG_CHR_DEV_SG is not set + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# # CONFIG_SCSI_MULTI_LUN is not set CONFIG_SCSI_CONSTANTS=y # CONFIG_SCSI_LOGGING is not set @@ -179,6 +218,7 @@ # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_SYM53C416 is not set +# CONFIG_SCSI_SIM710 is not set # CONFIG_SCSI_NCR53C7xx is not set # CONFIG_SCSI_NCR53C8XX is not set CONFIG_SCSI_SYM53C8XX=y @@ -226,17 +266,22 @@ CONFIG_NET_ETHERNET=y CONFIG_MACE=y CONFIG_BMAC=y +# CONFIG_NCR885E is not set # CONFIG_NET_VENDOR_3COM is not set # CONFIG_LANCE is not set # CONFIG_NET_VENDOR_SMC is not set # CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_YELLOWFIN is not set # CONFIG_RTL8139 is not set # CONFIG_SIS900 is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_ACENIC is not set +# CONFIG_DM9102 is not set +# CONFIG_AT1700 is not set +# CONFIG_DEPCA is not set # CONFIG_NET_ISA is not set CONFIG_NET_EISA=y CONFIG_PCNET32=y +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_ACENIC is not set # CONFIG_AC3200 is not set # CONFIG_APRICOT is not set # CONFIG_CS89x0 is not set @@ -252,7 +297,6 @@ # CONFIG_ES3210 is not set # CONFIG_EPIC100 is not set # CONFIG_ZNET is not set -# CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_NET_POCKET is not set # CONFIG_FDDI is not set # CONFIG_HIPPI is not set @@ -265,13 +309,18 @@ # CONFIG_IPDDP is not set CONFIG_PPP=y # CONFIG_PPP_ASYNC is not set +# CONFIG_PPP_SYNC_TTY is not set # CONFIG_PPP_DEFLATE is not set # CONFIG_PPP_BSDCOMP is not set # CONFIG_SLIP is not set + +# +# Wireless LAN (non-hamradio) +# # CONFIG_NET_RADIO is not set # -# Token ring devices +# Token Ring driver support # # CONFIG_TR is not set # CONFIG_NET_FC is not set @@ -281,17 +330,7 @@ # # Wan interfaces # -# CONFIG_HOSTESS_SV11 is not set -# CONFIG_COSA is not set -# CONFIG_SEALEVEL_4021 is not set -# CONFIG_DLCI is not set - -# -# PCMCIA network devices -# -# CONFIG_PCMCIA_PCNET is not set -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_RAYCS is not set +# CONFIG_WAN is not set # # Amateur Radio support @@ -311,6 +350,11 @@ # # Console drivers # + +# +# Frame-buffer support +# +CONFIG_FB=y CONFIG_DUMMY_CONSOLE=y # CONFIG_FB_CLGEN is not set # CONFIG_FB_PM2 is not set @@ -328,6 +372,8 @@ CONFIG_FB_MATROX_G100=y # CONFIG_FB_MATROX_MULTIHEAD is not set CONFIG_FB_ATY=y +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_3DFX is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FBCON_ADVANCED is not set CONFIG_FBCON_CFB8=y @@ -362,7 +408,7 @@ # CONFIG_ATIXL_BUSMOUSE is not set # CONFIG_LOGIBUSMOUSE is not set # CONFIG_MS_BUSMOUSE is not set -# CONFIG_ADB_MOUSE is not set +# CONFIG_ADBMOUSE is not set CONFIG_MOUSE=y CONFIG_PSMOUSE=y # CONFIG_82C710_MOUSE is not set @@ -403,11 +449,11 @@ CONFIG_AUTOFS_FS=y # CONFIG_ADFS_FS is not set # 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_HFS_FS=y +CONFIG_FAT_FS=y +CONFIG_MSDOS_FS=y # CONFIG_UMSDOS_FS is not set -# CONFIG_VFAT_FS is not set +CONFIG_VFAT_FS=y # CONFIG_EFS_FS is not set CONFIG_ISO9660_FS=y # CONFIG_JOLIET is not set @@ -420,6 +466,7 @@ # CONFIG_QNX4FS_FS is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y +# CONFIG_BFS_FS is not set # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set @@ -446,7 +493,39 @@ # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set # CONFIG_SUN_PARTITION is not set -# CONFIG_NLS is not set +CONFIG_NLS=y + +# +# Native Language Support +# +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set # # Sound @@ -463,27 +542,27 @@ # CONFIG_SOUND_MSNDPIN is not set CONFIG_SOUND_OSS=y # CONFIG_SOUND_DMAP is not set -# CONFIG_SOUND_PAS is not set -# CONFIG_SOUND_SB is not set -# CONFIG_SOUND_ADLIB is not set -# CONFIG_SOUND_GUS is not set -# CONFIG_SOUND_MPU401 is not set -# CONFIG_SOUND_PSS is not set -# CONFIG_SOUND_MSS is not set +# CONFIG_SOUND_AD1816 is not set +# CONFIG_SOUND_SGALAXY is not set +CONFIG_SOUND_CS4232=m # CONFIG_SOUND_SSCAPE is not set +# CONFIG_SOUND_GUS is not set +# CONFIG_SOUND_VMIDI is not set # CONFIG_SOUND_TRIX is not set -# CONFIG_SOUND_VIA82CXXX is not set +# CONFIG_SOUND_MSS is not set +# CONFIG_SOUND_MPU401 is not set +# CONFIG_SOUND_NM256 is not set # CONFIG_SOUND_MAD16 is not set +# CONFIG_SOUND_PAS is not set +# CONFIG_SOUND_PSS is not set +# CONFIG_SOUND_SOFTOSS is not set +# CONFIG_SOUND_SB is not set # CONFIG_SOUND_WAVEFRONT is not set -CONFIG_SOUND_CS4232=m -# CONFIG_SOUND_OPL3SA2 is not set # CONFIG_SOUND_MAUI is not set -# CONFIG_SOUND_SGALAXY is not set -# CONFIG_SOUND_AD1816 is not set -# CONFIG_SOUND_OPL3SA1 is not set -# CONFIG_SOUND_SOFTOSS is not set +# CONFIG_SOUND_VIA82CXXX is not set # CONFIG_SOUND_YM3812 is not set -# CONFIG_SOUND_VMIDI is not set +# CONFIG_SOUND_OPL3SA1 is not set +# CONFIG_SOUND_OPL3SA2 is not set # CONFIG_SOUND_UART6850 is not set # diff -u --recursive --new-file v2.3.25/linux/arch/ppc/config.in linux/arch/ppc/config.in --- v2.3.25/linux/arch/ppc/config.in Mon Nov 1 13:56:26 1999 +++ linux/arch/ppc/config.in Fri Nov 5 15:53:25 1999 @@ -44,6 +44,10 @@ fi bool 'Symmetric multi-processing support' CONFIG_SMP +if [ "$CONFIG_6xx" != "y" ];then + bool 'AltiVec Support' CONFIG_ALTIVEC +fi + if [ "$CONFIG_ALL_PPC" != "y" ];then define_bool CONFIG_MACH_SPECIFIC y fi @@ -85,6 +89,9 @@ bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT # only elf supported, a.out is not -- Cort +if [ "$CONFIG_PROC_FS" = "y" ]; then + define_bool CONFIG_KCORE_ELF y +fi define_bool CONFIG_BINFMT_ELF y define_bool CONFIG_KERNEL_ELF y tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC diff -u --recursive --new-file v2.3.25/linux/arch/ppc/defconfig linux/arch/ppc/defconfig --- v2.3.25/linux/arch/ppc/defconfig Wed Oct 27 16:34:12 1999 +++ linux/arch/ppc/defconfig Fri Nov 5 10:22:51 1999 @@ -43,6 +43,8 @@ CONFIG_SYSCTL=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_KCORE_AOUT is not set +CONFIG_KCORE_ELF=y CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y # CONFIG_BINFMT_MISC is not set diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile --- v2.3.25/linux/arch/ppc/kernel/Makefile Fri Oct 15 15:25:13 1999 +++ linux/arch/ppc/kernel/Makefile Fri Nov 5 15:53:25 1999 @@ -60,15 +60,12 @@ O_OBJS += i8259.o endif else -ifeq ($(CONFIG_APUS),y) -O_OBJS += apus_setup.o prom.o open_pic.o -else -ifneq ($(CONFIG_8xx),y) O_OBJS += chrp_setup.o chrp_pci.o chrp_time.o \ pmac_time.o pmac_pci.o pmac_setup.o \ prom.o open_pic.o feature.o \ i8259.o pmac_pic.o indirect_pci.o \ gemini_pci.o gemini_prom.o gemini_setup.o + ifeq ($(CONFIG_NVRAM),y) O_OBJS += pmac_support.o endif @@ -83,7 +80,8 @@ ifeq ($(CONFIG_PMAC), y) endif -endif +ifdef CONFIG_APUS +O_OBJS += apus_setup.o endif endif diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c --- v2.3.25/linux/arch/ppc/kernel/apus_setup.c Fri Oct 22 13:21:45 1999 +++ linux/arch/ppc/kernel/apus_setup.c Fri Nov 5 15:53:25 1999 @@ -32,7 +32,10 @@ #include #define ide_init_hwif_ports m68k_ide_init_hwif_ports #define ide_default_irq m68k_ide_default_irq +#undef ide_request_irq #define ide_request_irq m68k_ide_request_irq +#undef ide_free_irq +#define ide_free_irq m68k_ide_free_irq #define ide_default_io_base m68k_ide_default_io_base #define ide_check_region m68k_ide_check_region #define ide_request_region m68k_ide_request_region @@ -40,7 +43,6 @@ #define ide_fix_driveid m68k_ide_fix_driveid #define ide_init_default_hwifs m68k_ide_init_default_hwifs #define select_t m68k_select_t -#define ide_free_irq m68k_ide_free_irq //#include #include #undef ide_free_irq @@ -59,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +74,8 @@ unsigned long m68k_machtype __apusdata; char debug_device[6] __apusdata = ""; +extern void amiga_init_IRQ(void); + void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata; /* machine dependent keyboard functions */ int (*mach_keyb_init) (void) __initdata; @@ -162,57 +167,6 @@ #endif } -__apus -int apus_request_irq(unsigned int irq, - void (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, - void *dev_id) -{ -#ifdef CONFIG_APUS - extern int amiga_request_irq(unsigned int irq, - void (*handler)(int, void *, - struct pt_regs *), - unsigned long flags, - const char *devname, - void *dev_id); - - return amiga_request_irq (irq, handler, flags, devname, dev_id); -#else - return 0; -#endif -} - -__apus -void apus_free_irq(unsigned int irq, void *dev_id) -{ -#ifdef CONFIG_APUS - extern void amiga_free_irq(unsigned int irq, void *dev_id); - - amiga_free_irq (irq, dev_id); -#endif -} - -__apus -void apus_process_int(unsigned long vec, void *fp) -{ -#ifdef CONFIG_APUS - extern void process_int(unsigned long vec, struct pt_regs *fp); - - process_int (vec, (struct pt_regs*)fp); -#endif -} - -__apus -int apus_get_irq_list(char *buf) -{ -#ifdef CONFIG_APUS - extern int m68k_get_irq_list (char*); - - return m68k_get_irq_list (buf); -#else - return 0; -#endif -} /* Here some functions we don't support, but which the other ports reference */ @@ -297,6 +251,7 @@ config_amiga(); +#if 0 /* Enable for logging - also include logging.o in Makefile rule */ { #define LOG_SIZE 4096 void* base; @@ -310,6 +265,7 @@ LOG_INIT(base, base+sizeof(klog_data_t), LOG_SIZE); } #endif +#endif } __apus @@ -760,67 +716,122 @@ m68k_ide_init_hwif_ports(hw, data_port, ctrl_port, irq); } #endif -/****************************************************** from irq.c */ -#define VEC_SPUR (24) +/****************************************************** IRQ stuff */ -void -apus_do_IRQ(struct pt_regs *regs, - int cpu, - int isfake) +__apus +int apus_get_irq_list(char *buf) { - int old_level, new_level; +#ifdef CONFIG_APUS + extern int amiga_get_irq_list(char *buf); + + return amiga_get_irq_list (buf); +#else + return 0; +#endif +} - new_level = (~(regs->mq) >> 3) & IPLEMU_IPLMASK; - - if (0 != new_level && 7 != new_level) { - old_level = ~(regs->mq) & IPLEMU_IPLMASK; +/* IPL must be between 0 and 7 */ +__apus +static inline void apus_set_IPL(int ipl) +{ + APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_DISABLEINT); + APUS_WRITE(APUS_IPL_EMU, IPLEMU_IPLMASK); + APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | ((~ipl) & IPLEMU_IPLMASK)); + APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT); +} - apus_process_int (VEC_SPUR+new_level, regs); - - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_DISABLEINT); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_IPLMASK); - APUS_WRITE(APUS_IPL_EMU, (IPLEMU_SETRESET - | (~(old_level) & IPLEMU_IPLMASK))); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT); - } +__apus +static inline unsigned long apus_get_IPL(void) +{ + unsigned short __f; + APUS_READ(APUS_IPL_EMU, __f); + return ((~__f) & IPLEMU_IPLMASK); } __apus -static void apus_save_flags(unsigned long* flags) +static inline unsigned long apus_get_prev_IPL(void) { unsigned short __f; APUS_READ(APUS_IPL_EMU, __f); - return ((~__f) & IPLEMU_IPLMASK) << 8; + return ((~__f >> 3) & IPLEMU_IPLMASK); +} + + +__apus +static void apus_save_flags(unsigned long* flags) +{ + *flags = apus_get_IPL(); } __apus static void apus_restore_flags(unsigned long flags) { - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_DISABLEINT); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_IPLMASK); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET - | (~(flags >> 8) & IPLEMU_IPLMASK)); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT); + apus_set_IPL(flags); } __apus static void apus_sti(void) { - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_DISABLEINT); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_IPLMASK); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_IPLMASK); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT); + apus_set_IPL(0); } __apus static void apus_cli(void) { - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_DISABLEINT); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_IPLMASK); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET); - APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT); + apus_set_IPL(7); +} + + +#ifdef CONFIG_APUS +void free_irq(unsigned int irq, void *dev_id) +{ + extern void amiga_free_irq(unsigned int irq, void *dev_id); + + amiga_free_irq (irq, dev_id); +} + +int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), + unsigned long irqflags, const char * devname, void *dev_id) +{ + extern int amiga_request_irq(unsigned int irq, + void (*handler)(int, void *, + struct pt_regs *), + unsigned long flags, + const char *devname, + void *dev_id); + + return amiga_request_irq (irq, handler, irqflags, devname, dev_id); +} +#endif + +__apus +int apus_get_irq(struct pt_regs* regs) +{ +#ifdef CONFIG_APUS + int level = apus_get_IPL(); + unsigned short ints = custom.intreqr & custom.intenar; + + if (0 == level) + return -1; + if (7 == level) + return -2; + + return level; +#else + return 0; +#endif +} + + +__apus +void apus_post_irq(int level) +{ + /* Restore IPL to the previous value */ + apus_set_IPL(apus_get_IPL()); } + + /****************************************************** keyboard */ __apus static int apus_kbd_setkeycode(unsigned int scancode, unsigned int keycode) @@ -859,36 +870,54 @@ #ifdef CONFIG_APUS extern int amiga_keyb_init(void); -printk("**** " __FUNCTION__ "\n"); amiga_keyb_init(); #endif } /****************************************************** init */ -extern void amiga_disable_irq(unsigned int irq); -extern void amiga_enable_irq(unsigned int irq); -extern void m68k_init_IRQ (void); - -struct hw_interrupt_type amiga_irq_ctl = { - " Amiga ", - NULL, - NULL, - NULL, - amiga_enable_irq, - amiga_disable_irq, - NULL, - 0 + +/* The number of spurious interrupts */ +volatile unsigned int num_spurious; + +#define NUM_IRQ_NODES 100 +static irq_node_t nodes[NUM_IRQ_NODES]; + +extern void (*amiga_default_handler[AUTO_IRQS])(int, void *, struct pt_regs *); + +static const char *default_names[SYS_IRQS] = { + "spurious int", "int1 handler", "int2 handler", "int3 handler", + "int4 handler", "int5 handler", "int6 handler", "int7 handler" }; +irq_node_t *new_irq_node(void) +{ + irq_node_t *node; + short i; + + for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--) + if (!node->handler) + return node; + + printk ("new_irq_node: out of nodes\n"); + return NULL; +} + __init void apus_init_IRQ(void) { int i; - for (i = 0; i < NR_IRQS; i++) - irq_desc[i].ctl = &amiga_irq_ctl; - m68k_init_IRQ (); + for (i = 0; i < NUM_IRQ_NODES; i++) + nodes[i].handler = NULL; + + for (i = 0; i < AUTO_IRQS; i++) { + if (amiga_default_handler[i] != NULL) + sys_request_irq(i, amiga_default_handler[i], + 0, default_names[i], NULL); + } + + amiga_init_IRQ(); int_control.int_sti = apus_sti; int_control.int_cli = apus_cli; @@ -924,7 +953,8 @@ ppc_md.get_cpuinfo = apus_get_cpuinfo; ppc_md.irq_cannonicalize = NULL; ppc_md.init_IRQ = apus_init_IRQ; - ppc_md.do_IRQ = apus_do_IRQ; + ppc_md.get_irq = apus_get_irq; + ppc_md.post_irq = apus_post_irq; #ifdef CONFIG_HEARTBEAT ppc_md.heartbeat = apus_heartbeat; ppc_md.heartbeat_count = 1; @@ -968,4 +998,10 @@ ppc_ide_md.io_base = _IO_BASE; #endif +} + + +/*************************************************** coexistence */ +void __init adbdev_init(void) +{ } diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S --- v2.3.25/linux/arch/ppc/kernel/head.S Fri Oct 15 15:25:13 1999 +++ linux/arch/ppc/kernel/head.S Fri Nov 5 15:53:25 1999 @@ -365,10 +365,10 @@ /* External interrupt */ . = 0x500; HardwareInterrupt: -#ifndef CONFIG_APUS EXCEPTION_PROLOG; addi r3,r1,STACK_FRAME_OVERHEAD li r20,MSR_KERNEL +#ifndef CONFIG_APUS li r4,0 bl transfer_to_handler .globl do_IRQ_intercept @@ -376,9 +376,6 @@ .long do_IRQ; .long ret_from_except #else - EXCEPTION_PROLOG; - addi r3,r1,STACK_FRAME_OVERHEAD - li r20,MSR_KERNEL bl apus_interrupt_entry #endif /* CONFIG_APUS */ @@ -447,7 +444,7 @@ STD_EXCEPTION(0xd00, SingleStep, SingleStepException) STD_EXCEPTION(0xe00, Trap_0e, UnknownException) - STD_EXCEPTION(0xf00, Trap_0f, UnknownException) + STD_EXCEPTION(0xf20, AltiVec, AltiVecUnavailable) /* * Handle TLB miss for instruction on 603/603e. @@ -807,6 +804,59 @@ .align 4 /* + * Take away the altivec regs. + * + * For now, ignore the vrsave regs and save them all + * -- Cort + */ + .globl giveup_altivec +giveup_altivec: +#ifdef CONFIG_ALTIVEC + /* check for altivec */ + mfspr r4,PVR + srwi r4,r4,16 + cmpi 0,r4,12 + bnelr + + /* save altivec regs */ + addi r4,r3,THREAD+THREAD_VRSAVE + mfspr r5,256 /* vrsave */ + stw r5,0(r4) + + /* get regs for the task */ + addi r4,r3,THREAD+PT_REGS + /* turn off the altivec bit in the tasks regs */ + lwz r5,_MSR(r4) + lis r6,MSR_VEC@h + andi. r5,r5,r6 + stw r5,_MSR(r4) +#endif /* CONFIG_ALTIVEC */ + blr + + .globl load_up_altivec +load_up_altivec: +#ifdef CONFIG_ALTIVEC + /* check for altivec */ + mfspr r4,PVR + srwi r4,r4,16 + cmpi 0,r4,12 + bnelr + + /* restore altivec regs */ + addi r4,r3,THREAD+THREAD_VRSAVE + lwz r5,0(r4) + mtspr 256,r5 /* vrsave */ + + /* get regs for the task */ + addi r4,r3,THREAD+PT_REGS + /* turn on the altivec bit in the tasks regs */ + lwz r5,_MSR(r4) + oris r5,r5,MSR_VEC@h + stw r5,_MSR(r4) +#endif /* CONFIG_ALTIVEC */ + blr + +/* * giveup_fpu(tsk) * Disable FP for the task given as the argument, * and save the floating-point registers in its thread_struct. @@ -957,14 +1007,69 @@ isync /* No speculative loading until now */ blr + +apus_interrupt_entry: + /* This is horrible, but there's no way around it. Enable the + * data cache so the IRQ hardware register can be accessed + * without cache intervention. Then disable interrupts and get + * the current emulated m68k IPL value. + */ + + mfmsr 20 + xori r20,r20,MSR_DR + sync + mtmsr r20 + sync - /* On APUS the first 0x4000 bytes of the kernel will be mapped - * at a different physical address than the rest. For this - * reason, the exception code cannot use relative branches to - * access the code below. - */ - . = 0x4000 -#endif + lis r4,APUS_IPL_EMU@h + + li r20,(IPLEMU_SETRESET|IPLEMU_DISABLEINT) + stb r20,APUS_IPL_EMU@l(r4) + eieio + + lbz r3,APUS_IPL_EMU@l(r4) + + li r2,IPLEMU_IPLMASK + rlwinm. r20,r3,32-3,29,31 + bne 2f + mr r20,r2 /* lvl7! Need to reset state machine. */ + b 3f +2: cmp 0,r20,r2 + beq 1f +3: eieio + stb r2,APUS_IPL_EMU@l(r4) + ori r20,r20,IPLEMU_SETRESET + eieio + stb r20,APUS_IPL_EMU@l(r4) +1: eieio + li r20,IPLEMU_DISABLEINT + stb r20,APUS_IPL_EMU@l(r4) + + /* At this point we could do some magic to avoid the overhead + * of calling the C interrupt handler in case of a spurious + * interrupt. Could not get a simple hack to work though. + */ + + mfmsr r20 + xori r20,r20,MSR_DR + sync + mtmsr r20 + sync + + stw r3,(_CCR+4)(r21); + + addi r3,r1,STACK_FRAME_OVERHEAD; + li r20,MSR_KERNEL; + bl transfer_to_handler; + .long do_IRQ; + .long ret_from_except + +/*********************************************************************** + * Please note that on APUS the exception handlers are located at the + * physical address 0xfff0000. For this reason, the exception handlers + * cannot use relative branches to access the code below. + ***********************************************************************/ +#endif /* CONFIG_APUS */ #ifdef CONFIG_SMP .globl __secondary_hold @@ -1165,6 +1270,19 @@ bl identify_machine bl MMU_init +#ifdef CONFIG_APUS + /* Copy exception code to exception vector base on APUS. */ + lis r4,KERNELBASE@h +#ifdef CONFIG_APUS_FAST_EXCEPT + lis r3,0xfff0 /* Copy to 0xfff00000 */ +#else + lis r3,0 /* Copy to 0x00000000 */ +#endif + li r5,0x4000 /* # bytes of memory to copy */ + li r6,0 + bl copy_and_flush /* copy the first 0x4000 bytes */ +#endif /* CONFIG_APUS */ + /* * Go back to running unmapped so we can load up new values * for SDR1 (hash table pointer) and the segment registers @@ -1283,3 +1401,4 @@ mtspr IBAT3L,r20 blr + diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c --- v2.3.25/linux/arch/ppc/kernel/irq.c Wed Oct 27 16:34:12 1999 +++ linux/arch/ppc/kernel/irq.c Fri Nov 5 15:53:25 1999 @@ -67,14 +67,6 @@ volatile unsigned char *chrp_int_ack_special; -#ifdef CONFIG_APUS -/* Rename a few functions. Requires the CONFIG_APUS protection. */ -#define request_irq nop_ppc_request_irq -#define free_irq nop_ppc_free_irq -#define get_irq_list nop_get_irq_list -#define VEC_SPUR (24) -#endif - #define MAXCOUNT 10000000 #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) @@ -94,8 +86,9 @@ * this needs to be removed. * -- Cort */ -static char cache_bitmask = 0; -static struct irqaction malloc_cache[8]; +#define IRQ_KMALLOC_ENTRIES 8 +static int cache_bitmask = 0; +static struct irqaction malloc_cache[IRQ_KMALLOC_ENTRIES]; extern int mem_init_done; void *irq_kmalloc(size_t size, int pri) @@ -103,7 +96,7 @@ unsigned int i; if ( mem_init_done ) return kmalloc(size,pri); - for ( i = 0; i <= 3 ; i++ ) + for ( i = 0; i < IRQ_KMALLOC_ENTRIES ; i++ ) if ( ! ( cache_bitmask & (1<> 8) & 0xff, addr & 0xff)) @@ -67,6 +68,7 @@ while (!req.complete) pmu_poll(); return req.reply[1]; +#endif case 1: return nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult]; case 2: @@ -82,6 +84,7 @@ struct adb_request req; switch (nvram_naddrs) { +#ifdef CONFIG_ADB_PMU case -1: if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM, (addr >> 8) & 0xff, addr & 0xff, val)) @@ -89,6 +92,7 @@ while (!req.complete) pmu_poll(); break; +#endif case 1: nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult] = val; break; diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c --- v2.3.25/linux/arch/ppc/kernel/ppc_ksyms.c Fri Oct 22 13:21:45 1999 +++ linux/arch/ppc/kernel/ppc_ksyms.c Fri Nov 5 15:53:26 1999 @@ -209,8 +209,10 @@ EXPORT_SYMBOL(adb_register); EXPORT_SYMBOL(cuda_request); EXPORT_SYMBOL(cuda_poll); +#ifdef CONFIG_ADB_PMU EXPORT_SYMBOL(pmu_request); EXPORT_SYMBOL(pmu_poll); +#endif /* CONFIG_ADB_PMU */ #endif /* CONFIG_ADB */ #ifdef CONFIG_PMAC_PBOOK EXPORT_SYMBOL(pmu_register_sleep_notifier); diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c --- v2.3.25/linux/arch/ppc/kernel/process.c Sat Oct 9 11:47:50 1999 +++ linux/arch/ppc/kernel/process.c Fri Nov 5 15:53:26 1999 @@ -45,6 +45,7 @@ extern unsigned long _get_SP(void); struct task_struct *last_task_used_math = NULL; +struct task_struct *last_task_used_altivec = NULL; static struct vm_area_struct init_mmap = INIT_MMAP; static struct fs_struct init_fs = INIT_FS; static struct files_struct init_files = INIT_FILES; @@ -60,6 +61,7 @@ #undef SHOW_TASK_SWITCHES 1 #undef CHECK_STACK 1 +#if defined(CHECK_STACK) unsigned long kernel_stack_top(struct task_struct *tsk) { @@ -72,28 +74,6 @@ return ((unsigned long)tsk) + sizeof(struct task_struct); } -int -dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs) -{ - if (regs->msr & MSR_FP) - giveup_fpu(current); - memcpy(fpregs, ¤t->thread.fpr[0], sizeof(*fpregs)); - return 1; -} - -void -enable_kernel_fp(void) -{ -#ifdef __SMP__ - if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) - giveup_fpu(current); - else - giveup_fpu(NULL); /* just enables FP for kernel */ -#else - giveup_fpu(last_task_used_math); -#endif /* __SMP__ */ -} - /* check to make sure the kernel stack is healthy */ int check_stack(struct task_struct *tsk) { @@ -156,6 +136,29 @@ } return(ret); } +#endif /* defined(CHECK_STACK) */ + +int +dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs) +{ + if (regs->msr & MSR_FP) + giveup_fpu(current); + memcpy(fpregs, ¤t->thread.fpr[0], sizeof(*fpregs)); + return 1; +} + +void +enable_kernel_fp(void) +{ +#ifdef __SMP__ + if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) + giveup_fpu(current); + else + giveup_fpu(NULL); /* just enables FP for kernel */ +#else + giveup_fpu(last_task_used_math); +#endif /* __SMP__ */ +} void _switch_to(struct task_struct *prev, struct task_struct *new, @@ -187,9 +190,23 @@ * every switch, just a save. * -- Cort */ - if (prev->thread.regs && (prev->thread.regs->msr & MSR_FP)) + if ( prev->thread.regs && (prev->thread.regs->msr & MSR_FP) ) giveup_fpu(prev); - + /* + * If the previous thread 1) has some altivec regs it wants saved + * (has bits in vrsave set) and 2) used altivec in the last quantum + * (thus changing altivec regs) then save them. + * + * On SMP we always save/restore altivec regs just to avoid the + * complexity of changing processors. + * -- Cort + */ + if ( (prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)) && + prev->thread.vrsave ) + giveup_altivec(prev); + if ( (new->last_processor != NO_PROC_ID) && + (new->last_processor != new->processor) && new->mm ) + flush_tlb_mm(new->mm); prev->last_processor = prev->processor; current_set[smp_processor_id()] = new; #endif /* __SMP__ */ @@ -213,7 +230,8 @@ printk("TASK = %p[%d] '%s' ", current, current->pid, current->comm); printk("Last syscall: %ld ", current->thread.last_syscall); - printk("\nlast math %p", last_task_used_math); + printk("\nlast math %p last altivec %p", last_task_used_math, + last_task_used_altivec); #ifdef __SMP__ printk(" CPU: %d last CPU: %d", current->processor,current->last_processor); @@ -243,12 +261,16 @@ { if (last_task_used_math == current) last_task_used_math = NULL; + if (last_task_used_altivec == current) + last_task_used_altivec = NULL; } void flush_thread(void) { if (last_task_used_math == current) last_task_used_math = NULL; + if (last_task_used_altivec == current) + last_task_used_altivec = NULL; } void @@ -305,11 +327,18 @@ */ if (regs->msr & MSR_FP) giveup_fpu(current); - memcpy(&p->thread.fpr, ¤t->thread.fpr, sizeof(p->thread.fpr)); p->thread.fpscr = current->thread.fpscr; childregs->msr &= ~MSR_FP; + if (regs->msr & MSR_VEC) + giveup_altivec(current); + if ( p->thread.vrsave ) + memcpy(&p->thread.vrf, ¤t->thread.vrf, sizeof(p->thread.vrf)); + p->thread.vscr = current->thread.vscr; + p->thread.vrsave = current->thread.vrsave; + childregs->msr &= ~MSR_VEC; + #ifdef __SMP__ p->last_processor = NO_PROC_ID; #endif /* __SMP__ */ @@ -367,6 +396,8 @@ shove_aux_table(sp); if (last_task_used_math == current) last_task_used_math = 0; + if (last_task_used_altivec == current) + last_task_used_altivec = 0; current->thread.fpscr = 0; } diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c --- v2.3.25/linux/arch/ppc/kernel/setup.c Wed Oct 27 16:34:12 1999 +++ linux/arch/ppc/kernel/setup.c Fri Nov 5 15:53:26 1999 @@ -245,6 +245,9 @@ case 10: len += sprintf(len+buffer, "604ev5 (MachV)\n"); break; + case 12: + len += sprintf(len+buffer, "7400 (G4)\n"); + break; case 50: len += sprintf(len+buffer, "821\n"); case 80: diff -u --recursive --new-file v2.3.25/linux/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c --- v2.3.25/linux/arch/ppc/kernel/traps.c Fri Oct 15 15:25:13 1999 +++ linux/arch/ppc/kernel/traps.c Fri Nov 5 15:53:26 1999 @@ -129,6 +129,42 @@ } void +AltiVecUnavailable(struct pt_regs *regs) +{ + /* + * This should be changed so we don't take a trap if coming + * back when last_task_used_altivec == current. We should also + * allow the kernel to use the altivec regs on UP to store tasks + * regs during switch + * -- Cort + */ + if ( regs->msr & MSR_VEC ) + { + show_regs(regs); + panic("AltiVec trap with Altivec enabled!\n"); + } + + if ( !user_mode(regs) ) + { + show_regs(regs); + panic("Kernel Used Altivec with MSR_VEC off!\n"); + } +#ifdef __SMP__ + printk("User Mode altivec trap should not happen in SMP!\n"); +#else + if ( last_task_used_altivec != current ) + { + if ( last_task_used_altivec ) + giveup_altivec(current); + load_up_altivec(current); + last_task_used_altivec = current; + } + /* enable altivec for the task on return */ + regs->msr |= MSR_VEC; +#endif +} + +void UnknownException(struct pt_regs *regs) { printk("Bad trap at PC: %lx, SR: %lx, vector=%lx\n", diff -u --recursive --new-file v2.3.25/linux/arch/ppc/lib/checksum.S linux/arch/ppc/lib/checksum.S --- v2.3.25/linux/arch/ppc/lib/checksum.S Mon Jan 12 15:18:13 1998 +++ linux/arch/ppc/lib/checksum.S Fri Nov 5 15:53:26 1999 @@ -24,6 +24,8 @@ * len is in words and is always >= 5. */ _GLOBAL(ip_fast_csum) + cmpi 0,r4,0 + beq 10f lwz r0,0(r3) lwzu r5,4(r3) addi r4,r4,-2 @@ -38,6 +40,8 @@ not r3,r3 srwi r3,r3,16 blr +10: li r3,0 + blr /* * Compute checksum of TCP or UDP pseudo-header: diff -u --recursive --new-file v2.3.25/linux/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c --- v2.3.25/linux/arch/ppc/mm/init.c Wed Oct 27 16:34:12 1999 +++ linux/arch/ppc/mm/init.c Fri Nov 5 15:53:26 1999 @@ -1381,7 +1381,7 @@ set_phys_avail(); return ret; } -#endif /* defined(CONFIG_GEMINI) || defined(CONFIG_ALL_PPC) */ +#endif /* defined(CONFIG_GEMINI) */ #ifdef CONFIG_APUS #define HARDWARE_MAPPED_SIZE (512*1024) diff -u --recursive --new-file v2.3.25/linux/arch/sh/config.in linux/arch/sh/config.in --- v2.3.25/linux/arch/sh/config.in Fri Oct 22 13:21:45 1999 +++ linux/arch/sh/config.in Sat Nov 6 10:40:31 1999 @@ -11,9 +11,22 @@ mainmenu_option next_comment comment 'Processor type and features' -choice 'Processor family' \ - "SH-3 CONFIG_CPU_SH3 \ - SH-4 CONFIG_CPU_SH4" SH-3 +choice 'Processor type' \ + "SH7708 CONFIG_CPU_SUBTYPE_SH7708 \ + SH7709 CONFIG_CPU_SUBTYPE_SH7709 \ + SH7750 CONFIG_CPU_SUBTYPE_SH7750" SH7708 +if [ "$CONFIG_CPU_SUBTYPE_SH7708" = "y" ]; then + define_bool CONFIG_CPU_SH3 y + define_bool CONFIG_CPU_SH4 n +fi +if [ "$CONFIG_CPU_SUBTYPE_SH7709" = "y" ]; then + define_bool CONFIG_CPU_SH3 y + define_bool CONFIG_CPU_SH4 n +fi +if [ "$CONFIG_CPU_SUBTYPE_SH7750" = "y" ]; then + define_bool CONFIG_CPU_SH3 n + define_bool CONFIG_CPU_SH4 y +fi bool 'Little Endian' CONFIG_LITTLE_ENDIAN hex 'Physical memory start address' CONFIG_MEMORY_START 08000000 bool 'Use SH CPU internal real time clock' CONFIG_SH_CPU_RTC @@ -35,6 +48,12 @@ bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi + tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC endmenu @@ -61,6 +80,10 @@ if [ "$CONFIG_NET" = "y" ]; then source net/Config.in + mainmenu_option next_comment + comment 'Network device drivers' + source drivers/net/Config.in + endmenu fi mainmenu_option next_comment diff -u --recursive --new-file v2.3.25/linux/arch/sh/defconfig linux/arch/sh/defconfig --- v2.3.25/linux/arch/sh/defconfig Fri Oct 22 13:21:45 1999 +++ linux/arch/sh/defconfig Sat Nov 6 10:40:31 1999 @@ -10,10 +10,14 @@ # # Processor type and features # -# CONFIG_CPU_SH3 is not set -CONFIG_CPU_SH4=y +CONFIG_CPU_SUBTYPE_SH7708=y +# CONFIG_CPU_SUBTYPE_SH7709 is not set +# CONFIG_CPU_SUBTYPE_SH7750 is not set +CONFIG_CPU_SH3=y +# CONFIG_CPU_SH4 is not set CONFIG_LITTLE_ENDIAN=y -CONFIG_MEMORY_START=08000000 +CONFIG_MEMORY_START=0c000000 +CONFIG_SH_CPU_RTC=y # # Loadable module support @@ -27,6 +31,8 @@ # CONFIG_SYSVIPC is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set @@ -35,8 +41,8 @@ # # CONFIG_SERIAL is not set CONFIG_SERIAL_CONSOLE=y -# CONFIG_SH_SCI_SERIAL is not set -CONFIG_SH_SCIF_SERIAL=y +CONFIG_SH_SCI_SERIAL=y +# CONFIG_SH_SCIF_SERIAL is not set # # Floppy, IDE, and other block devices @@ -59,9 +65,6 @@ # 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 -# CONFIG_VFAT_FS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_UDF_FS is not set diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/entry.S linux/arch/sh/kernel/entry.S --- v2.3.25/linux/arch/sh/kernel/entry.S Wed Oct 27 16:34:12 1999 +++ linux/arch/sh/kernel/entry.S Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: entry.S,v 1.16 1999/10/21 14:00:27 gniibe Exp $ +/* $Id: entry.S,v 1.19 1999/10/31 13:19:35 gniibe Exp gniibe $ * * linux/arch/sh/entry.S * @@ -61,7 +61,11 @@ #if defined(__sh3__) TRA = 0xffffffd0 EXPEVT = 0xffffffd4 +#ifdef CONFIG_CPU_SUBTYPE_SH7709 +INTEVT = 0xa4000000 ! INTEVTE2(0xa4000000) +#else INTEVT = 0xffffffd8 +#endif MMU_TEA = 0xfffffffc ! TLB Exception Address Register #elif defined(__SH4__) TRA = 0xff000020 @@ -251,6 +255,11 @@ mov.l 1f,r2 mov.l @r2,r8 ! + ! DEBUG DEBUG + ! mov.l led,r1 + ! mov r0,r2 + ! mov.b r2,@r1 + ! #ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB mov #0x20,r1 extu.b r1,r1 @@ -320,6 +329,7 @@ 3: .long SYMBOL_NAME(syscall_trace) 2: .long 0xefffffff ! BL=0 1: .long TRA +led: .long 0xa8000000 ! For my board -- gN .section .fixup,"ax" fixup_syscall_argerr: @@ -571,6 +581,37 @@ .long SYMBOL_NAME(do_IRQ) ! rovi .long SYMBOL_NAME(do_IRQ) .long SYMBOL_NAME(do_IRQ) +#if defined(CONFIG_CPU_SUBTYPE_SH7709) + .long SYMBOL_NAME(do_IRQ) ! 32 IRQ irq0 + .long SYMBOL_NAME(do_IRQ) ! 33 irq1 + .long SYMBOL_NAME(do_IRQ) ! 34 irq2 + .long SYMBOL_NAME(do_IRQ) ! 35 irq3 + .long SYMBOL_NAME(do_IRQ) ! 36 irq4 + .long SYMBOL_NAME(do_IRQ) ! 37 irq5 + .long SYMBOL_NAME(do_IRQ) ! 38 + .long SYMBOL_NAME(do_IRQ) ! 39 + .long SYMBOL_NAME(do_IRQ) ! 40 PINT pint0-7 + .long SYMBOL_NAME(do_IRQ) ! 41 pint8-15 + .long SYMBOL_NAME(do_IRQ) ! 42 + .long SYMBOL_NAME(do_IRQ) ! 43 + .long SYMBOL_NAME(do_IRQ) ! 44 + .long SYMBOL_NAME(do_IRQ) ! 45 + .long SYMBOL_NAME(do_IRQ) ! 46 + .long SYMBOL_NAME(do_IRQ) ! 47 + .long SYMBOL_NAME(do_IRQ) ! 48 DMAC dei0 + .long SYMBOL_NAME(do_IRQ) ! 49 dei1 + .long SYMBOL_NAME(do_IRQ) ! 50 dei2 + .long SYMBOL_NAME(do_IRQ) ! 51 dei3 + .long SYMBOL_NAME(do_IRQ) ! 52 IrDA eri1 + .long SYMBOL_NAME(do_IRQ) ! 53 rxi1 + .long SYMBOL_NAME(do_IRQ) ! 54 bri1 + .long SYMBOL_NAME(do_IRQ) ! 55 txi1 + .long SYMBOL_NAME(do_IRQ) ! 56 SCIF eri2 + .long SYMBOL_NAME(do_IRQ) ! 57 rxi2 + .long SYMBOL_NAME(do_IRQ) ! 58 bri2 + .long SYMBOL_NAME(do_IRQ) ! 59 txi2 + .long SYMBOL_NAME(do_IRQ) ! 60 ADC adi +#elif defined(__SH4__) .long SYMBOL_NAME(do_IRQ) ! Hitachi UDI .long SYMBOL_NAME(do_IRQ) ! GPIO .long SYMBOL_NAME(do_IRQ) ! DMAC dmte0 @@ -589,6 +630,7 @@ .long error .long error ! fpu .long error ! fpu +#endif ENTRY(sys_call_table) .long SYMBOL_NAME(sys_ni_syscall) /* 0 - old "setup()" system call*/ @@ -608,7 +650,7 @@ .long SYMBOL_NAME(sys_mknod) .long SYMBOL_NAME(sys_chmod) /* 15 */ .long SYMBOL_NAME(sys_lchown) - .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */ .long SYMBOL_NAME(sys_stat) .long SYMBOL_NAME(sys_lseek) .long SYMBOL_NAME(sys_getpid) /* 20 */ @@ -622,8 +664,8 @@ .long SYMBOL_NAME(sys_fstat) .long SYMBOL_NAME(sys_pause) .long SYMBOL_NAME(sys_utime) /* 30 */ - .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */ - .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */ .long SYMBOL_NAME(sys_access) .long SYMBOL_NAME(sys_nice) .long SYMBOL_NAME(sys_ni_syscall) /* 35 */ /* old ftime syscall holder */ @@ -635,7 +677,7 @@ .long SYMBOL_NAME(sys_dup) .long SYMBOL_NAME(sys_pipe) .long SYMBOL_NAME(sys_times) - .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */ .long SYMBOL_NAME(sys_brk) /* 45 */ .long SYMBOL_NAME(sys_setgid) .long SYMBOL_NAME(sys_getgid) @@ -644,12 +686,12 @@ .long SYMBOL_NAME(sys_getegid) /* 50 */ .long SYMBOL_NAME(sys_acct) .long SYMBOL_NAME(sys_umount) /* recycled never used phys() */ - .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ .long SYMBOL_NAME(sys_ioctl) .long SYMBOL_NAME(sys_fcntl) /* 55 */ - .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */ .long SYMBOL_NAME(sys_setpgid) - .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */ .long SYMBOL_NAME(sys_ni_syscall) /* sys_olduname */ .long SYMBOL_NAME(sys_umask) /* 60 */ .long SYMBOL_NAME(sys_chroot) @@ -689,7 +731,7 @@ .long SYMBOL_NAME(sys_fchown) /* 95 */ .long SYMBOL_NAME(sys_getpriority) .long SYMBOL_NAME(sys_setpriority) - .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */ .long SYMBOL_NAME(sys_statfs) .long SYMBOL_NAME(sys_fstatfs) /* 100 */ .long SYMBOL_NAME(sys_ni_syscall) /* ioperm */ diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/head.S linux/arch/sh/kernel/head.S --- v2.3.25/linux/arch/sh/kernel/head.S Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/kernel/head.S Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: head.S,v 1.6 1999/10/05 12:34:16 gniibe Exp $ +/* $Id: head.S,v 1.7 1999/10/27 09:41:42 gniibe Exp gniibe $ * * arch/sh/kernel/head.S * @@ -18,9 +18,8 @@ .long 0 /* RAMDISK_FLAGS */ .long 0x0200 /* ORIG_ROOT_DEV */ .long 1 /* LOADER_TYPE */ - .long 0x88400000 /* INITRD_START */ - .long 0x00400000 /* INITRD_SIZE */ - .long 0x89000000 /* MEMORY_END */ + .long 0x00360000 /* INITRD_START */ + .long 0x000a0000 /* INITRD_SIZE */ .long 0 .text diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/irq_onchip.c linux/arch/sh/kernel/irq_onchip.c --- v2.3.25/linux/arch/sh/kernel/irq_onchip.c Wed Oct 27 16:34:12 1999 +++ linux/arch/sh/kernel/irq_onchip.c Sat Nov 6 10:40:31 1999 @@ -1,8 +1,8 @@ -/* $Id: irq_onchip.c,v 1.4 1999/10/19 12:22:05 gniibe Exp $ +/* $Id: irq_onchip.c,v 1.5 1999/10/28 02:18:33 gniibe Exp $ * * linux/arch/sh/kernel/irq_onchip.c * - * Copyright (C) 1999 Niibe Yutaka + * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi * * Interrupt handling for on-chip supporting modules (TMU, RTC, etc.). * @@ -135,6 +135,109 @@ enable_onChip_irq(irq); } + +#ifdef CONFIG_CPU_SUBTYPE_SH7709 +/* + * SH7707/SH7709/SH7709A/SH7729 Extended on-chip I/O + */ + +#define INTC_IRR0 0xa4000004UL +#define INTC_IPRC 0xa4000016UL + +#define IRQ0_IRQ 32 +#define IRQ1_IRQ 33 +#define IRQ2_IRQ 34 +#define IRQ3_IRQ 35 +#define IRQ4_IRQ 36 +#define IRQ5_IRQ 37 + +#define IRQ0_IRP_OFFSET 32 +#define IRQ1_IRP_OFFSET 36 +#define IRQ2_IRP_OFFSET 40 +#define IRQ3_IRP_OFFSET 44 +#define IRQ4_IRP_OFFSET 48 +#define IRQ5_IRP_OFFSET 52 + +#define IRQ0_PRIORITY 1 +#define IRQ1_PRIORITY 1 +#define IRQ2_PRIORITY 1 +#define IRQ3_PRIORITY 1 +#define IRQ4_PRIORITY 1 +#define IRQ5_PRIORITY 1 + +static void enable_onChip2_irq(unsigned int irq); +void disable_onChip2_irq(unsigned int irq); + +/* shutdown is same as "disable" */ +#define shutdown_onChip2_irq disable_onChip2_irq + +static void mask_and_ack_onChip2(unsigned int); +static void end_onChip2_irq(unsigned int irq); + +static unsigned int startup_onChip2_irq(unsigned int irq) +{ + enable_onChip2_irq(irq); + return 0; /* never anything pending */ +} + +static struct hw_interrupt_type onChip2_irq_type = { + "SH7709 Extended On-Chip Supporting Module", + startup_onChip2_irq, + shutdown_onChip2_irq, + enable_onChip2_irq, + disable_onChip2_irq, + mask_and_ack_onChip2, + end_onChip2_irq +}; + +void disable_onChip2_irq(unsigned int irq) +{ + unsigned long val, flags; + /* Set priority in IPR to 0 */ + int offset = ipr_data[irq-TIMER_IRQ].offset - 32; + unsigned long intc_ipr_address = INTC_IPRC + (offset/16*INTC_SIZE); + unsigned short mask = 0xffff ^ (0xf << (offset%16)); + + save_and_cli(flags); + val = ctrl_inw(intc_ipr_address); + val &= mask; + ctrl_outw(val, intc_ipr_address); + restore_flags(flags); +} + +static void enable_onChip2_irq(unsigned int irq) +{ + unsigned long val, flags; + /* Set priority in IPR back to original value */ + int offset = ipr_data[irq-TIMER_IRQ].offset - 32; + int priority = ipr_data[irq-TIMER_IRQ].priority; + unsigned long intc_ipr_address = INTC_IPRC + (offset/16*INTC_SIZE); + unsigned short value = (priority << (offset%16)); + + save_and_cli(flags); + val = ctrl_inw(intc_ipr_address); + val |= value; + ctrl_outw(val, intc_ipr_address); + restore_flags(flags); +} + +static void mask_and_ack_onChip2(unsigned int irq) +{ + disable_onChip2_irq(irq); + if (IRQ0_IRQ <= irq && irq <= IRQ5_IRQ) { + /* Clear external interrupt request */ + int a = ctrl_inb(INTC_IRR0); + a &= ~(1 << (irq - IRQ0_IRQ)); + ctrl_outb(a, INTC_IRR0); + } +} + +static void end_onChip2_irq(unsigned int irq) +{ + enable_onChip2_irq(irq); +} +#endif /* CONFIG_CPU_SUBTYPE_SH7709 */ + void __init init_IRQ(void) { int i; @@ -142,4 +245,25 @@ for (i = TIMER_IRQ; i < NR_IRQS; i++) { irq_desc[i].handler = &onChip_irq_type; } + +#ifdef CONFIG_CPU_SUBTYPE_SH7709 + for (i = IRQ0_IRQ; i < NR_IRQS; i++) { + irq_desc[i].handler = &onChip2_irq_type; + } + + /* + * Enable external irq(INTC IRQ mode). + * You should set corresponding bits of PFC to "00" + * to enable these interrupts. + */ + set_ipr_data(IRQ0_IRQ, IRQ0_IRP_OFFSET, IRQ0_PRIORITY); + set_ipr_data(IRQ1_IRQ, IRQ1_IRP_OFFSET, IRQ1_PRIORITY); + set_ipr_data(IRQ2_IRQ, IRQ2_IRP_OFFSET, IRQ2_PRIORITY); + set_ipr_data(IRQ3_IRQ, IRQ3_IRP_OFFSET, IRQ3_PRIORITY); + set_ipr_data(IRQ4_IRQ, IRQ4_IRP_OFFSET, IRQ4_PRIORITY); + set_ipr_data(IRQ5_IRQ, IRQ5_IRP_OFFSET, IRQ5_PRIORITY); + + ctrl_inb(INTC_IRR0); + ctrl_outb(0, INTC_IRR0); +#endif /* CONFIG_CPU_SUBTYPE_SH7709 */ } diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/process.c linux/arch/sh/kernel/process.c --- v2.3.25/linux/arch/sh/kernel/process.c Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/kernel/process.c Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.7 1999/09/23 00:05:41 gniibe Exp $ +/* $Id: process.c,v 1.8 1999/10/31 13:19:16 gniibe Exp $ * * linux/arch/sh/kernel/process.c * @@ -249,8 +249,6 @@ p->thread.sp = (unsigned long) childregs; p->thread.pc = (unsigned long) ret_from_fork; - if (p->mm) - p->mm->context = NO_CONTEXT; return 0; } diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/setup.c linux/arch/sh/kernel/setup.c --- v2.3.25/linux/arch/sh/kernel/setup.c Wed Oct 27 16:34:12 1999 +++ linux/arch/sh/kernel/setup.c Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: setup.c,v 1.7 1999/10/23 01:34:50 gniibe Exp $ +/* $Id: setup.c,v 1.7 1999/10/23 01:34:50 gniibe Exp gniibe $ * * linux/arch/sh/kernel/setup.c * @@ -135,9 +135,9 @@ memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; - memory_start = (unsigned long)__va(0)+__MEMORY_START; + memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START; /* Default is 4Mbyte. */ - memory_end = (unsigned long)__va(0x00400000)+__MEMORY_START; + memory_end = (unsigned long)PAGE_OFFSET+0x00400000+__MEMORY_START; for (;;) { /* @@ -214,7 +214,7 @@ /* * Initialize the boot-time allocator (with low memory only): */ - bootmap_size = init_bootmem(start_pfn, max_low_pfn); + bootmap_size = init_bootmem(start_pfn, max_low_pfn, __MEMORY_START); /* * FIXME: what about high memory? @@ -259,16 +259,18 @@ #ifdef CONFIG_BLK_DEV_INITRD if (LOADER_TYPE) { - initrd_start = INITRD_START ? INITRD_START : 0; - initrd_end = initrd_start+INITRD_SIZE; - if (initrd_end > memory_end) { + if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { + reserve_bootmem(INITRD_START, INITRD_SIZE); + initrd_start = + INITRD_START ? INITRD_START + PAGE_OFFSET + __MEMORY_START : 0; + initrd_end = initrd_start+INITRD_SIZE; + } else { printk("initrd extends beyond end of memory " "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - initrd_end,memory_end); + INITRD_START + INITRD_SIZE, + max_low_pfn << PAGE_SHIFT); initrd_start = 0; - } else - reserve_bootmem(__pa(initrd_start)-__MEMORY_START, - INITRD_SIZE); + } } #endif diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/sys_sh.c linux/arch/sh/kernel/sys_sh.c --- v2.3.25/linux/arch/sh/kernel/sys_sh.c Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/kernel/sys_sh.c Sat Nov 6 10:40:31 1999 @@ -44,9 +44,8 @@ } asmlinkage unsigned long -sys_mmap(int fd, unsigned long addr, - unsigned long len, unsigned long prot, - unsigned long flags, unsigned long off) +sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, + unsigned long flags, int fd, unsigned long off) { int error = -EFAULT; struct file *file = NULL; diff -u --recursive --new-file v2.3.25/linux/arch/sh/kernel/time.c linux/arch/sh/kernel/time.c --- v2.3.25/linux/arch/sh/kernel/time.c Wed Oct 27 16:34:12 1999 +++ linux/arch/sh/kernel/time.c Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.3 1999/10/17 10:30:15 gniibe Exp $ +/* $Id: time.c,v 1.7 1999/11/06 02:00:37 gniibe Exp $ * * linux/arch/sh/kernel/time.c * @@ -43,7 +43,10 @@ #define TMU0_TCNT 0xfffffe98 /* Long access */ #define TMU0_TCR 0xfffffe9c /* Word access */ -#define INTERVAL 37500 /* (1000000*CLOCK_MHZ/HZ/2) ??? */ +#define INTERVAL 37500 /* (1000000*CLOCK_MHZ/HZ/2) ??? for CqREEK */ +#if 0 /* Takeshi's board */ +#define INTERVAL 83333 +#endif /* SH-3 RTC */ #define R64CNT 0xfffffec0 @@ -195,6 +198,13 @@ { do_timer(regs); +#ifdef TAKESHI + { + unsigned long what_is_this=0xa4000124; + + ctrl_outb(ctrl_inb(what_is_this)+1,what_is_this); + } +#endif #if 0 if (!user_mode(regs)) sh_do_profile(regs->pc); diff -u --recursive --new-file v2.3.25/linux/arch/sh/lib/checksum.S linux/arch/sh/lib/checksum.S --- v2.3.25/linux/arch/sh/lib/checksum.S Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/lib/checksum.S Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: checksum.S,v 1.1 1999/09/18 16:56:53 gniibe Exp $ +/* $Id: checksum.S,v 1.2 1999/10/29 13:06:55 gniibe Exp $ * * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket @@ -192,7 +192,7 @@ mov #-5,r0 shld r0,r6 tst r6,r6 - bf/s 2f + bt/s 2f clrt SRC(1: mov.l @r4+,r0 ) SRC( mov.l @r4+,r1 ) diff -u --recursive --new-file v2.3.25/linux/arch/sh/mm/fault.c linux/arch/sh/mm/fault.c --- v2.3.25/linux/arch/sh/mm/fault.c Fri Oct 22 13:21:46 1999 +++ linux/arch/sh/mm/fault.c Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: fault.c,v 1.3 1999/09/21 23:09:53 gniibe Exp $ +/* $Id: fault.c,v 1.5 1999/10/31 13:17:31 gniibe Exp $ * * linux/arch/sh/mm/fault.c * Copyright (C) 1999 Niibe Yutaka @@ -81,6 +81,34 @@ return 0; } +static void handle_vmalloc_fault(struct task_struct *tsk, unsigned long address) +{ + pgd_t *dir; + pmd_t *pmd; + pte_t *pte; + pte_t entry; + + dir = pgd_offset_k(address); + pmd = pmd_offset(dir, address); + if (pmd_none(*pmd)) { + printk(KERN_ERR "vmalloced area %08lx bad\n", address); + return; + } + if (pmd_bad(*pmd)) { + pmd_ERROR(*pmd); + pmd_clear(pmd); + return; + } + pte = pte_offset(pmd, address); + entry = *pte; + if (pte_none(entry) || !pte_present(entry) || !pte_write(entry)) { + printk(KERN_ERR "vmalloced area %08lx bad\n", address); + return; + } + + update_mmu_cache(NULL, address, entry); +} + /* * This routine handles page faults. It determines the address, * and the problem, and then passes it off to one of the appropriate @@ -98,6 +126,11 @@ tsk = current; mm = tsk->mm; + if (address >= VMALLOC_START && address < VMALLOC_END) { + handle_vmalloc_fault(tsk, address); + return; + } + /* * If we're in an interrupt or have no user * context, we must not take the fault.. @@ -222,23 +255,13 @@ unsigned long address, pte_t pte) { unsigned long flags; - unsigned long asid; unsigned long pteval; - asid = get_asid(); - - address &= PAGE_MASK; -#if 0/*defined(__SH4__)*//* SH-4 has separate I/D caches: XXX really needed? */ - if ((vma->vm_flags & VM_EXEC) != 0) -/* && - ((pte_val(pte) & (_PAGE_PRESENT | _PAGE_DIRTY)) == - (_PAGE_PRESENT | _PAGE_DIRTY))) */ - flush_icache_range(address,address+PAGE_SIZE); -#endif save_and_cli(flags); - /* Set PTEH register */ - ctrl_outl((address|asid), MMU_PTEH); - + /* + * We don't need to set PTEH register. + * It's automatically set by the hardware. + */ pteval = pte_val(pte); pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ pteval |= _PAGE_FLAGS_HARDWARE_DEFAULT; /* add default flags */ @@ -246,18 +269,31 @@ ctrl_outl(pteval, MMU_PTEL); /* Load the TLB */ - asm volatile ("ldtlb" : /* no output */ : /* no input */ - : "memory"); + asm volatile("ldtlb": /* no output */ : /* no input */ : "memory"); restore_flags(flags); } -static __inline__ void __flush_tlb_page(unsigned long asid, unsigned long page) +static void __flush_tlb_page(struct mm_struct *mm, unsigned long page) { - unsigned long addr, data; + unsigned long addr, data, asid; + unsigned long saved_asid = MMU_NO_ASID; + + if (mm->context == NO_CONTEXT) + return; + + asid = mm->context & MMU_CONTEXT_ASID_MASK; + if (mm != current->mm) { + saved_asid = get_asid(); + /* + * We need to set ASID of the target entry to flush, + * because TLB is indexed by (ASID and PAGE). + */ + set_asid(asid); + } #if defined(__sh3__) - addr = MMU_TLB_ADDRESS_ARRAY | (page & 0x1F000) | MMU_PAGE_ASSOC_BIT; - data = page | asid; /* VALID bit is off */ + addr = MMU_TLB_ADDRESS_ARRAY |(page & 0x1F000)| MMU_PAGE_ASSOC_BIT; + data = (page & 0xfffe0000) | asid; /* VALID bit is off */ ctrl_outl(data, addr); #elif defined(__SH4__) int i; @@ -276,19 +312,18 @@ } } #endif + if (saved_asid != MMU_NO_ASID) + set_asid(saved_asid); } void flush_tlb_page(struct vm_area_struct *vma, unsigned long page) { - unsigned long asid; - - if (vma->vm_mm->context != NO_CONTEXT) { - unsigned long flags; + unsigned long flags; + if (vma->vm_mm) { page &= PAGE_MASK; - asid = vma->vm_mm->context & MMU_CONTEXT_ASID_MASK; save_and_cli(flags); - __flush_tlb_page (asid, page); + __flush_tlb_page(vma->vm_mm, page); restore_flags(flags); } } @@ -303,18 +338,15 @@ save_and_cli(flags); size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; if (size > (MMU_NTLB_ENTRIES/4)) { /* Too many TLB to flush */ - get_new_mmu_context(mm); + mm->context = NO_CONTEXT; if (mm == current->mm) - set_asid(mm->context & MMU_CONTEXT_ASID_MASK); + activate_context(mm); } else { - unsigned long asid; - - asid = mm->context & MMU_CONTEXT_ASID_MASK; start &= PAGE_MASK; end += (PAGE_SIZE - 1); end &= PAGE_MASK; while (start < end) { - __flush_tlb_page (asid, start); + __flush_tlb_page(mm, start); start += PAGE_SIZE; } } @@ -325,14 +357,14 @@ void flush_tlb_mm(struct mm_struct *mm) { /* Invalidate all TLB of this process. */ - /* Instead of flush TLBs, we get new MMU context. */ + /* Instead of invalidating each TLB, we get new MMU context. */ if (mm->context != NO_CONTEXT) { unsigned long flags; save_and_cli(flags); - get_new_mmu_context(mm); + mm->context = NO_CONTEXT; if (mm == current->mm) - set_asid(mm->context & MMU_CONTEXT_ASID_MASK); + activate_context(mm); restore_flags(flags); } } diff -u --recursive --new-file v2.3.25/linux/arch/sh/mm/init.c linux/arch/sh/mm/init.c --- v2.3.25/linux/arch/sh/mm/init.c Wed Oct 27 16:34:12 1999 +++ linux/arch/sh/mm/init.c Sat Nov 6 10:40:31 1999 @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.4 1999/10/23 01:37:02 gniibe Exp $ +/* $Id: init.c,v 1.4 1999/10/23 01:37:02 gniibe Exp gniibe $ * * linux/arch/sh/mm/init.c * @@ -193,13 +193,14 @@ */ void __init paging_init(void) { + int i; pgd_t * pg_dir; /* We don't need kernel mapping as hardware support that. */ pg_dir = swapper_pg_dir; - /* Unmap the original low memory mappings to detect NULL reference */ - pgd_val(pg_dir[0]) = 0; + for (i=0; i < USER_PTRS_PER_PGD*2; i++) + pgd_val(pg_dir[i]) = 0; /* Enable MMU */ ctrl_outl(MMU_CONTROL_INIT, MMUCR); diff -u --recursive --new-file v2.3.25/linux/arch/sparc/config.in linux/arch/sparc/config.in --- v2.3.25/linux/arch/sparc/config.in Mon Nov 1 13:56:26 1999 +++ linux/arch/sparc/config.in Fri Nov 5 10:22:51 1999 @@ -63,6 +63,11 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC diff -u --recursive --new-file v2.3.25/linux/arch/sparc/defconfig linux/arch/sparc/defconfig --- v2.3.25/linux/arch/sparc/defconfig Tue Aug 31 17:29:13 1999 +++ linux/arch/sparc/defconfig Fri Nov 5 10:22:51 1999 @@ -78,6 +78,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=m diff -u --recursive --new-file v2.3.25/linux/arch/sparc/kernel/signal.c linux/arch/sparc/kernel/signal.c --- v2.3.25/linux/arch/sparc/kernel/signal.c Tue Aug 31 17:29:13 1999 +++ linux/arch/sparc/kernel/signal.c Tue Nov 2 17:40:11 1999 @@ -1050,7 +1050,7 @@ ino = map->vm_file->f_dentry->d_inode->i_ino; line = d_path(map->vm_file->f_dentry, buffer, PAGE_SIZE); } - printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_offset, + printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT, kdevname(dev), ino); if (map->vm_file != NULL) printk("%s\n", line); diff -u --recursive --new-file v2.3.25/linux/arch/sparc64/config.in linux/arch/sparc64/config.in --- v2.3.25/linux/arch/sparc64/config.in Mon Nov 1 13:56:26 1999 +++ linux/arch/sparc64/config.in Fri Nov 5 10:22:51 1999 @@ -47,6 +47,11 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi bool 'Kernel support for Linux/Sparc 32bit binary compatibility' CONFIG_SPARC32_COMPAT if [ "$CONFIG_SPARC32_COMPAT" != "n" ]; then tristate ' Kernel support for 32-bit ELF binaries' CONFIG_BINFMT_ELF32 diff -u --recursive --new-file v2.3.25/linux/arch/sparc64/defconfig linux/arch/sparc64/defconfig --- v2.3.25/linux/arch/sparc64/defconfig Sat Oct 9 11:47:50 1999 +++ linux/arch/sparc64/defconfig Fri Nov 5 10:22:51 1999 @@ -88,6 +88,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_SPARC32_COMPAT=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_ELF32=y diff -u --recursive --new-file v2.3.25/linux/arch/sparc64/kernel/signal.c linux/arch/sparc64/kernel/signal.c --- v2.3.25/linux/arch/sparc64/kernel/signal.c Fri Sep 10 23:57:28 1999 +++ linux/arch/sparc64/kernel/signal.c Tue Nov 2 17:40:11 1999 @@ -618,7 +618,7 @@ ino = map->vm_file->f_dentry->d_inode->i_ino; line = d_path(map->vm_file->f_dentry, buffer, PAGE_SIZE); } - printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_offset, + printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT, kdevname(dev), ino); if (map->vm_file != NULL) printk("%s\n", line); diff -u --recursive --new-file v2.3.25/linux/arch/sparc64/kernel/signal32.c linux/arch/sparc64/kernel/signal32.c --- v2.3.25/linux/arch/sparc64/kernel/signal32.c Mon Aug 2 22:07:16 1999 +++ linux/arch/sparc64/kernel/signal32.c Tue Nov 2 17:40:11 1999 @@ -1226,7 +1226,7 @@ ino = map->vm_file->f_dentry->d_inode->i_ino; line = d_path(map->vm_file->f_dentry, buffer, PAGE_SIZE); } - printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_offset, + printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT, kdevname(dev), ino); if (map->vm_file != NULL) printk("%s\n", line); diff -u --recursive --new-file v2.3.25/linux/drivers/block/Config.in linux/drivers/block/Config.in --- v2.3.25/linux/drivers/block/Config.in Wed Oct 27 16:34:12 1999 +++ linux/drivers/block/Config.in Wed Nov 3 14:43:54 1999 @@ -209,9 +209,9 @@ # controls the choices given to the user ... if [ "$CONFIG_PARPORT" = "y" -o "$CONFIG_PARPORT" = "n" ]; then - define_bool CONFIG_PARIDE_PARPORT y + define_tristate CONFIG_PARIDE_PARPORT y else - define_bool CONFIG_PARIDE_PARPORT m + define_tristate CONFIG_PARIDE_PARPORT m fi dep_tristate 'Parallel port IDE device support' CONFIG_PARIDE $CONFIG_PARIDE_PARPORT if [ "$CONFIG_PARIDE" = "y" -o "$CONFIG_PARIDE" = "m" ]; then diff -u --recursive --new-file v2.3.25/linux/drivers/block/hpt34x.c linux/drivers/block/hpt34x.c --- v2.3.25/linux/drivers/block/hpt34x.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/hpt34x.c Fri Nov 5 10:40:23 1999 @@ -299,8 +299,7 @@ drive->waiting_for_dma = 1; if (drive->media != ide_disk) return 0; - drive->timeout = WAIT_CMD; - ide_set_handler(drive, &ide_dma_intr); /* issue cmd to drive */ + ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */ OUT_BYTE((reading == 9) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG); return 0; case ide_dma_end: /* returns 1 on error, 0 otherwise */ diff -u --recursive --new-file v2.3.25/linux/drivers/block/icside.c linux/drivers/block/icside.c --- v2.3.25/linux/drivers/block/icside.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/icside.c Fri Nov 5 10:40:23 1999 @@ -381,8 +381,7 @@ if (drive->media != ide_disk) return 0; - drive->timeout = WAIT_CMD; - ide_set_handler(drive, &ide_dma_intr); + ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG); diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c --- v2.3.25/linux/drivers/block/ide-cd.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide-cd.c Fri Nov 5 10:40:23 1999 @@ -24,11 +24,6 @@ * * ---------------------------------- * TO DO LIST: - * -Implement Microsoft Media Status Notification per the spec at - * http://www.microsoft.com/hwdev/respec/storspec.htm - * This will allow us to get automagically notified when the media changes - * on ATAPI drives (something the stock ATAPI spec is lacking). Looks - * very cool. I discovered its existance the other day at work... * -Make it so that Pioneer CD DR-A24X and friends don't get screwed up on * boot * @@ -537,6 +532,7 @@ } if (rq->cmd == READ && !rq->current_nr_sectors) uptodate = 1; + ide_end_request (uptodate, HWGROUP(drive)); } @@ -663,6 +659,21 @@ return 1; } +static int cdrom_timer_expiry(ide_drive_t *drive) +{ + struct request *rq = HWGROUP(drive)->rq; + struct packet_command *pc = (struct packet_command *) rq->buffer; + unsigned long wait = 0; + + printk("in expiry\n"); + /* blank and format can take an extremly long time to + * complete, if the IMMED bit was not set. + */ + if (pc->c[0] == GPCMD_BLANK || pc->c[0] == GPCMD_FORMAT_UNIT) + wait = 60*60*HZ; + + return wait; +} /* Set up the device registers for transferring a packet command on DEV, expecting to later transfer XFERLEN bytes. HANDLER is the routine @@ -696,7 +707,7 @@ (void) (HWIF(drive)->dmaproc(ide_dma_begin, drive)); if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { - ide_set_handler (drive, handler); + ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry); OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */ } else { OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */ @@ -706,7 +717,6 @@ return 0; } - /* Send a packet command to DRIVE described by CMD_BUF and CMD_LEN. The device registers must have already been prepared by cdrom_start_packet_command. @@ -716,11 +726,6 @@ unsigned char *cmd_buf, int cmd_len, ide_handler_t *handler) { - /* don't timeout for blank and format commands. they may take - * a _very_ long time. */ - if (cmd_buf[0] == GPCMD_BLANK || cmd_buf[0] == GPCMD_FORMAT_UNIT) - drive->timeout = 0; - if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { /* Here we should have been called after receiving an interrupt from the device. DRQ should how be set. */ @@ -736,7 +741,7 @@ } /* Arm the interrupt handler. */ - ide_set_handler (drive, handler); + ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry); /* Send the command to the device. */ atapi_output_bytes (drive, cmd_buf, cmd_len); @@ -769,17 +774,9 @@ char *dest; - /* If we don't yet have a sector buffer, try to allocate one. - If we can't get one atomically, it's not fatal -- we'll just throw - the data away rather than caching it. */ - if (info->buffer == NULL) { - info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_ATOMIC); - - /* If we couldn't get a buffer, - don't try to buffer anything... */ - if (info->buffer == NULL) + /* If we couldn't get a buffer, don't try to buffer anything... */ + if (info->buffer == NULL) sectors_to_buffer = 0; - } /* If this is the first sector in the buffer, remember its number. */ if (info->nsectors_buffered == 0) @@ -866,13 +863,14 @@ return; if (dma) { - if (!dma_error) { - for (i = rq->nr_sectors; i > 0;) { - i -= rq->current_nr_sectors; - ide_end_request(1, HWGROUP(drive)); - } - } else + if (dma_error) { ide_error (drive, "dma error", stat); + return; + } + for (i = rq->nr_sectors; i > 0;) { + i -= rq->current_nr_sectors; + ide_end_request(1, HWGROUP(drive)); + } return; } @@ -968,7 +966,7 @@ /* Done moving data! Wait for another interrupt. */ - ide_set_handler(drive, &cdrom_read_intr); + ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD, NULL); } /* @@ -1206,9 +1204,6 @@ struct request *rq = HWGROUP(drive)->rq; struct packet_command *pc = (struct packet_command *)rq->buffer; - /* restore timeout after blank or format command */ - drive->timeout = WAIT_CMD; - /* Check for errors. */ if (cdrom_decode_status (drive, 0, &stat)) return; @@ -1294,7 +1289,7 @@ } /* Now we wait for another interrupt. */ - ide_set_handler (drive, &cdrom_pc_intr); + ide_set_handler (drive, &cdrom_pc_intr, WAIT_CMD, cdrom_timer_expiry); } @@ -1789,7 +1784,7 @@ /* Now try to get the total cdrom capacity. */ #if 0 - stat = cdrom_get_last_written(MKDEV(HWIF(drive)->major, minor, + stat = cdrom_get_last_written(MKDEV(HWIF(drive)->major, minor), (long *)&toc->capacity); if (stat) #endif @@ -1797,6 +1792,7 @@ if (stat) toc->capacity = 0x1fffff; /* for general /dev/cdrom like mounting, one big disc */ + drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME; HWIF(drive)->gd->sizes[minor] = (toc->capacity * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9); @@ -1812,11 +1808,11 @@ i = toc->hdr.first_track; while ((i <= ntracks) && ((minor & CD_PART_MASK) < CD_PART_MAX)) { drive->part[minor & PARTN_MASK].start_sect = 0; - drive->part[minor & PARTN_MASK].nr_sects = (toc->ent[i].addr.lba * + drive->part[minor & PARTN_MASK].nr_sects = + (toc->ent[i].addr.lba * SECTORS_PER_FRAME) << (BLOCK_SIZE_BITS - 9); HWIF(drive)->gd->sizes[minor] = (toc->ent[i].addr.lba * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9); - blksize_size[HWIF(drive)->major][minor] = CD_FRAMESIZE; i++; minor++; } @@ -2273,8 +2269,11 @@ struct atapi_capabilities_page cap; } buf; - if (CDROM_CONFIG_FLAGS (drive)->nec260) + if (CDROM_CONFIG_FLAGS (drive)->nec260) { + CDROM_CONFIG_FLAGS (drive)->no_eject = 0; + CDROM_CONFIG_FLAGS (drive)->audio_play = 1; return nslots; + } init_cdrom_command(&cgc, &buf, sizeof(buf)); /* we have to cheat a little here. the packet will eventually @@ -2342,9 +2341,12 @@ (ntohs(buf.cap.maxspeed) + (176/2)) / 176; } - printk ("%s: ATAPI %dX %s", - drive->name, CDROM_CONFIG_FLAGS (drive)->max_speed, - (CDROM_CONFIG_FLAGS (drive)->dvd) ? "DVD-ROM" : "CD-ROM"); + /* don't print speed if the drive reported 0. + */ + printk("%s: ATAPI", drive->name); + if (CDROM_CONFIG_FLAGS(drive)->max_speed) + printk(" %dX", CDROM_CONFIG_FLAGS(drive)->max_speed); + printk(" %s", CDROM_CONFIG_FLAGS(drive)->dvd ? "DVD-ROM" : "CD-ROM"); if (CDROM_CONFIG_FLAGS (drive)->dvd_r|CDROM_CONFIG_FLAGS (drive)->dvd_ram) printk (" DVD%s%s", @@ -2398,11 +2400,10 @@ int nslots; set_device_ro(MKDEV(HWIF(drive)->major, minor), 1); - blksize_size[HWIF(drive)->major][minor] = CD_FRAMESIZE; + set_blocksize(MKDEV(HWIF(drive)->major, minor), CD_FRAMESIZE); drive->special.all = 0; drive->ready_stat = 0; - drive->timeout = WAIT_CMD; CDROM_STATE_FLAGS (drive)->media_changed = 1; CDROM_STATE_FLAGS (drive)->toc_valid = 0; @@ -2435,10 +2436,14 @@ /* limit transfer size per interrupt. */ CDROM_CONFIG_FLAGS (drive)->limit_nframes = 0; if (drive->id != NULL) { + /* a testament to the nice quality of Samsung drives... */ if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430")) CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1; else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2432")) CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1; + /* the 3231 model does not support the SET_CD_SPEED command */ + else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) + cdi->mask |= CDC_SELECT_SPEED; } #if ! STANDARD_ATAPI @@ -2534,9 +2539,12 @@ static int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive) { + struct cdrom_info *info = drive->driver_data; int rc; MOD_INC_USE_COUNT; + if (info->buffer == NULL) + info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL); rc = cdrom_fops.open (ip, fp); if (rc) { drive->usage--; @@ -2617,12 +2625,7 @@ MODULE_PARM(ignore, "s"); MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); -int init_module (void) -{ - return ide_cdrom_init(); -} - -void cleanup_module(void) +void __exit ide_cdrom_exit(void) { ide_drive_t *drive; int failed = 0; @@ -2636,7 +2639,7 @@ } #endif /* MODULE */ -int ide_cdrom_init (void) +int __init ide_cdrom_init (void) { ide_drive_t *drive; struct cdrom_info *info; @@ -2677,3 +2680,6 @@ MOD_DEC_USE_COUNT; return 0; } + +module_init(ide_cdrom_init); +module_exit(ide_cdrom_exit); diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide-disk.c linux/drivers/block/ide-disk.c --- v2.3.25/linux/drivers/block/ide-disk.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide-disk.c Fri Nov 5 10:40:23 1999 @@ -175,7 +175,7 @@ if (i > 0) { if (msect) goto read_next; - ide_set_handler (drive, &read_intr); + ide_set_handler (drive, &read_intr, WAIT_CMD, NULL); } } @@ -206,7 +206,7 @@ ide_end_request(1, hwgroup); if (i > 0) { idedisk_output_data (drive, rq->buffer, SECTOR_WORDS); - ide_set_handler (drive, &write_intr); + ide_set_handler (drive, &write_intr, WAIT_CMD, NULL); } goto out; } @@ -271,7 +271,7 @@ if (stat & DRQ_STAT) { if (rq->nr_sectors) { ide_multwrite(drive, drive->mult_count); - ide_set_handler (drive, &multwrite_intr); + ide_set_handler (drive, &multwrite_intr, WAIT_CMD, NULL); goto out; } } else { @@ -385,7 +385,7 @@ if (drive->using_dma && !(HWIF(drive)->dmaproc(ide_dma_read, drive))) return; #endif /* CONFIG_BLK_DEV_IDEDMA */ - ide_set_handler(drive, &read_intr); + ide_set_handler(drive, &read_intr, WAIT_CMD, NULL); OUT_BYTE(drive->mult_count ? WIN_MULTREAD : WIN_READ, IDE_COMMAND_REG); return; } @@ -404,10 +404,10 @@ __cli(); /* local CPU only */ if (drive->mult_count) { HWGROUP(drive)->wrq = *rq; /* scratchpad */ - ide_set_handler (drive, &multwrite_intr); + ide_set_handler (drive, &multwrite_intr, WAIT_CMD, NULL); ide_multwrite(drive, drive->mult_count); } else { - ide_set_handler (drive, &write_intr); + ide_set_handler (drive, &write_intr, WAIT_CMD, NULL); idedisk_output_data(drive, rq->buffer, SECTOR_WORDS); } return; @@ -506,7 +506,6 @@ drive->special.all = 0; drive->special.b.set_geometry = 1; drive->special.b.recalibrate = 1; - drive->timeout = WAIT_CMD; if (OK_TO_RESET_CONTROLLER) drive->mult_count = 0; if (!drive->keep_settings) diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide-dma.c linux/drivers/block/ide-dma.c --- v2.3.25/linux/drivers/block/ide-dma.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide-dma.c Fri Nov 5 10:40:23 1999 @@ -420,8 +420,7 @@ drive->waiting_for_dma = 1; if (drive->media != ide_disk) return 0; - drive->timeout = WAIT_CMD; - ide_set_handler(drive, &ide_dma_intr);/* issue cmd to drive */ + ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);/* issue cmd to drive */ OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG); case ide_dma_begin: /* Note that this is done *after* the cmd has diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide-floppy.c linux/drivers/block/ide-floppy.c --- v2.3.25/linux/drivers/block/ide-floppy.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide-floppy.c Fri Nov 5 10:40:23 1999 @@ -916,7 +916,7 @@ if (temp > pc->buffer_size) { printk (KERN_ERR "ide-floppy: The floppy wants to send us more data than expected - discarding data\n"); idefloppy_discard_data (drive,bcount.all); - ide_set_handler (drive,&idefloppy_pc_intr); + ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); return; } #if IDEFLOPPY_DEBUG_LOG @@ -938,7 +938,7 @@ pc->actually_transferred+=bcount.all; /* Update the current position */ pc->current_position+=bcount.all; - ide_set_handler (drive,&idefloppy_pc_intr); /* And set the interrupt handler again */ + ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ } static void idefloppy_transfer_pc (ide_drive_t *drive) @@ -956,7 +956,7 @@ ide_do_reset (drive); return; } - ide_set_handler (drive, &idefloppy_pc_intr); /* Set the interrupt routine */ + ide_set_handler (drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */ atapi_output_bytes (drive, floppy->pc->c, 12); /* Send the actual packet */ } @@ -1025,7 +1025,7 @@ #endif /* CONFIG_BLK_DEV_IDEDMA */ if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) { - ide_set_handler (drive, &idefloppy_transfer_pc); + ide_set_handler (drive, &idefloppy_transfer_pc, IDEFLOPPY_WAIT_CMD, NULL); OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */ } else { OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); @@ -1519,7 +1519,6 @@ *((unsigned short *) &gcw) = drive->id->config; drive->driver_data = floppy; drive->ready_stat = 0; - drive->timeout = IDEFLOPPY_WAIT_CMD; memset (floppy, 0, sizeof (idefloppy_floppy_t)); floppy->drive = drive; floppy->pc = floppy->pc_stack; diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide-pmac.c linux/drivers/block/ide-pmac.c --- v2.3.25/linux/drivers/block/ide-pmac.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide-pmac.c Fri Nov 5 10:40:23 1999 @@ -363,8 +363,7 @@ drive->waiting_for_dma = 1; if (drive->media != ide_disk) return 0; - drive->timeout = WAIT_CMD; - ide_set_handler(drive, &ide_dma_intr); + ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); OUT_BYTE(func==ide_dma_write? WIN_WRITEDMA: WIN_READDMA, IDE_COMMAND_REG); case ide_dma_begin: diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide-tape.c linux/drivers/block/ide-tape.c --- v2.3.25/linux/drivers/block/ide-tape.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide-tape.c Fri Nov 5 10:40:23 1999 @@ -1833,7 +1833,7 @@ if (temp > pc->buffer_size) { printk (KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n"); idetape_discard_data (drive,bcount.all); - ide_set_handler (drive,&idetape_pc_intr); + ide_set_handler (drive,&idetape_pc_intr,IDETAPE_WAIT_CMD,NULL); return; } #if IDETAPE_DEBUG_LOG @@ -1855,7 +1855,7 @@ pc->actually_transferred+=bcount.all; /* Update the current position */ pc->current_position+=bcount.all; - ide_set_handler (drive,&idetape_pc_intr); /* And set the interrupt handler again */ + ide_set_handler (drive,&idetape_pc_intr,IDETAPE_WAIT_CMD,NULL); /* And set the interrupt handler again */ } /* @@ -1928,7 +1928,7 @@ ide_do_reset (drive); return; } - ide_set_handler(drive, &idetape_pc_intr); /* Set the interrupt routine */ + ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */ atapi_output_bytes (drive,pc->c,12); /* Send the actual packet */ } @@ -1995,7 +1995,7 @@ } #endif /* CONFIG_BLK_DEV_IDEDMA */ if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { - ide_set_handler(drive, &idetape_transfer_pc); + ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL); OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG); } else { OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG); @@ -3579,7 +3579,6 @@ spin_lock_init(&tape->spinlock); drive->driver_data = tape; drive->ready_stat = 0; /* An ATAPI device ignores DRDY */ - drive->timeout = IDETAPE_WAIT_CMD; #ifdef CONFIG_BLK_DEV_IDEPCI /* * These two ide-pci host adapters appear to need this disabled. diff -u --recursive --new-file v2.3.25/linux/drivers/block/ide.c linux/drivers/block/ide.c --- v2.3.25/linux/drivers/block/ide.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/ide.c Fri Nov 5 10:40:23 1999 @@ -498,25 +498,14 @@ } /* - * The below two are helpers used when modifying the drive timeout. - */ -static inline unsigned long set_timeout(ide_drive_t *drive, unsigned long timeout) -{ - unsigned long foo = drive->timeout; - drive->timeout = timeout; - return foo; -} - -#define restore_timeout(drive, old) (drive->timeout = old) - -/* * This should get invoked any time we exit the driver to * wait for an interrupt response from a drive. handler() points * at the appropriate code to handle the next interrupt, and a * timer is started to prevent us from waiting forever in case * something goes wrong (see the ide_timer_expiry() handler later on). */ -void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler) +void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, + unsigned int timeout, ide_expiry_t *expiry) { unsigned long flags; ide_hwgroup_t *hwgroup = HWGROUP(drive); @@ -528,12 +517,10 @@ drive->name, hwgroup->handler, handler); } #endif - hwgroup->handler = handler; - /* 0 means don't timeout */ - if (drive->timeout && !timer_pending(&hwgroup->timer)) { - hwgroup->timer.expires = jiffies + drive->timeout; - add_timer(&(hwgroup->timer)); - } + hwgroup->handler = handler; + hwgroup->expiry = expiry; + hwgroup->timer.expires = jiffies + timeout; + add_timer(&(hwgroup->timer)); spin_unlock_irqrestore(&hwgroup->spinlock, flags); } @@ -580,7 +567,6 @@ static void atapi_reset_pollfunc (ide_drive_t *drive) { ide_hwgroup_t *hwgroup = HWGROUP(drive); - unsigned long old_timeout; byte stat; SELECT_DRIVE(HWIF(drive),drive); @@ -590,9 +576,7 @@ printk("%s: ATAPI reset complete\n", drive->name); } else { if (0 < (signed long)(hwgroup->poll_timeout - jiffies)) { - old_timeout = set_timeout(drive, HZ / 20); - ide_set_handler (drive, &atapi_reset_pollfunc); - restore_timeout(drive, old_timeout); + ide_set_handler (drive, &atapi_reset_pollfunc, HZ/20, NULL); return; /* continue polling */ } hwgroup->poll_timeout = 0; /* end of polling */ @@ -613,14 +597,11 @@ { ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwif_t *hwif = HWIF(drive); - unsigned long old_timeout; byte tmp; if (!OK_STAT(tmp=GET_STAT(), 0, BUSY_STAT)) { if (0 < (signed long)(hwgroup->poll_timeout - jiffies)) { - old_timeout = set_timeout(drive, HZ / 20); - ide_set_handler (drive, &reset_pollfunc); - restore_timeout(drive, old_timeout); + ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL); return; /* continue polling */ } printk("%s: reset timed-out, status=0x%02x\n", hwif->name, tmp); @@ -688,7 +669,6 @@ unsigned long flags; ide_hwif_t *hwif = HWIF(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive); - unsigned long old_timeout; __save_flags(flags); /* local CPU only */ __cli(); /* local CPU only */ @@ -700,9 +680,7 @@ udelay (20); OUT_BYTE (WIN_SRST, IDE_COMMAND_REG); hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; - old_timeout = set_timeout(drive, HZ / 20); - ide_set_handler (drive, &atapi_reset_pollfunc); - restore_timeout(drive, old_timeout); + ide_set_handler (drive, &atapi_reset_pollfunc, HZ/20, NULL); __restore_flags (flags); /* local CPU only */ return; } @@ -732,9 +710,7 @@ OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG); /* clear SRST, leave nIEN */ udelay(10); /* more than enough time */ hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; - old_timeout = set_timeout(drive, HZ / 20); - ide_set_handler (drive, &reset_pollfunc); - restore_timeout(drive, old_timeout); + ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL); /* * Some weird controller like resetting themselves to a strange @@ -934,7 +910,7 @@ */ void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler) { - ide_set_handler (drive, handler); + ide_set_handler (drive, handler, WAIT_CMD, NULL); if (IDE_CONTROL_REG) OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */ OUT_BYTE(nsect,IDE_NSECTOR_REG); @@ -1425,7 +1401,9 @@ ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data; ide_drive_t *drive; ide_handler_t *handler; + ide_expiry_t *expiry; unsigned long flags; + unsigned long wait; spin_lock_irqsave(&hwgroup->spinlock, flags); drive = hwgroup->drive; @@ -1434,9 +1412,22 @@ do_hwgroup_request(hwgroup); return; } + hwgroup->busy = 1; /* should already be "1" */ + + if ((expiry = hwgroup->expiry) != NULL) { + /* continue */ + if ((wait = expiry(drive)) != 0) { + /* reset timer */ + hwgroup->timer.expires = jiffies + wait; + add_timer(&(hwgroup->timer)); + spin_unlock_irqrestore(&hwgroup->spinlock, flags); + return; + } + } + hwgroup->handler = NULL; - /* polling in progress or just don't timeout */ + if (hwgroup->poll_timeout != 0) { spin_unlock_irqrestore(&hwgroup->spinlock, flags); handler(drive); diff -u --recursive --new-file v2.3.25/linux/drivers/block/loop.c linux/drivers/block/loop.c --- v2.3.25/linux/drivers/block/loop.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/block/loop.c Sat Nov 6 09:51:19 1999 @@ -151,12 +151,12 @@ int size; if (S_ISREG(lo->lo_dentry->d_inode->i_mode)) - size = (lo->lo_dentry->d_inode->i_size - lo->lo_offset) / BLOCK_SIZE; + size = (lo->lo_dentry->d_inode->i_size - lo->lo_offset) >> BLOCK_SIZE_BITS; else { kdev_t lodev = lo->lo_device; if (blk_size[MAJOR(lodev)]) size = blk_size[MAJOR(lodev)][MINOR(lodev)] - - lo->lo_offset / BLOCK_SIZE; + (lo->lo_offset >> BLOCK_SIZE_BITS); else size = MAX_DISK_SIZE; } diff -u --recursive --new-file v2.3.25/linux/drivers/block/pdc4030.c linux/drivers/block/pdc4030.c --- v2.3.25/linux/drivers/block/pdc4030.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/pdc4030.c Fri Nov 5 10:40:23 1999 @@ -162,7 +162,6 @@ if (!hwif) return 0; drive = &hwif->drives[0]; - drive->timeout = HZ/100; hwif2 = &ide_hwifs[hwif->index+1]; if (hwif->chipset == ide_pdc4030) /* we've already been found ! */ return 1; @@ -309,9 +308,6 @@ unsigned int sectors_left, sectors_avail, nsect; struct request *rq; - /* reset timeout */ - drive->timeout = HZ/100; - if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) { ide_error(drive, "promise_read_intr", stat); return; @@ -366,8 +362,7 @@ if (stat & DRQ_STAT) goto read_again; if (stat & BUSY_STAT) { - drive->timeout = WAIT_CMD; - ide_set_handler (drive, &promise_read_intr); + ide_set_handler (drive, &promise_read_intr, WAIT_CMD, NULL); #ifdef DEBUG_READ printk(KERN_DEBUG "%s: promise_read: waiting for" "interrupt\n", drive->name); @@ -396,7 +391,7 @@ if (GET_STAT() & BUSY_STAT) { if (time_before(jiffies, hwgroup->poll_timeout)) { - ide_set_handler(drive, &promise_complete_pollfunc); + ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL); return; /* continue polling... */ } hwgroup->poll_timeout = 0; @@ -425,7 +420,7 @@ if (IN_BYTE(IDE_NSECTOR_REG) != 0) { if (time_before(jiffies, hwgroup->poll_timeout)) { - ide_set_handler (drive, &promise_write_pollfunc); + ide_set_handler (drive, &promise_write_pollfunc, HZ/100, NULL); return; /* continue polling... */ } hwgroup->poll_timeout = 0; @@ -439,7 +434,7 @@ */ ide_multwrite(drive, 4); hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; - ide_set_handler(drive, &promise_complete_pollfunc); + ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL); #ifdef DEBUG_WRITE printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n", drive->name, GET_STAT()); @@ -472,7 +467,7 @@ if (rq->nr_sectors > 4) { ide_multwrite(drive, rq->nr_sectors - 4); hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; - ide_set_handler (drive, &promise_write_pollfunc); + ide_set_handler (drive, &promise_write_pollfunc, HZ/100, NULL); } else { /* * There are 4 or fewer sectors to transfer, do them all in one go @@ -480,7 +475,7 @@ */ ide_multwrite(drive, rq->nr_sectors); hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; - ide_set_handler(drive, &promise_complete_pollfunc); + ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL); #ifdef DEBUG_WRITE printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, " "status = %02x\n", drive->name, GET_STAT()); @@ -523,8 +518,7 @@ printk(KERN_DEBUG "%s: read: waiting for " "interrupt\n", drive->name); #endif - drive->timeout = WAIT_CMD; - ide_set_handler(drive, &promise_read_intr); + ide_set_handler(drive, &promise_read_intr, WAIT_CMD, NULL); return; } udelay(1); diff -u --recursive --new-file v2.3.25/linux/drivers/block/trm290.c linux/drivers/block/trm290.c --- v2.3.25/linux/drivers/block/trm290.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/block/trm290.c Fri Nov 5 10:40:23 1999 @@ -192,8 +192,7 @@ outw((count * 2) - 1, hwif->dma_base+2); /* start DMA */ if (drive->media != ide_disk) return 0; - drive->timeout = WAIT_CMD; - ide_set_handler(drive, &ide_dma_intr); + ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG); return 0; case ide_dma_begin: diff -u --recursive --new-file v2.3.25/linux/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c --- v2.3.25/linux/drivers/cdrom/cdrom.c Fri Oct 22 13:21:47 1999 +++ linux/drivers/cdrom/cdrom.c Wed Nov 3 14:01:47 1999 @@ -178,14 +178,19 @@ -- Export cdrom_mode_sense and cdrom_mode_select. -- init_cdrom_command() for setting up a cgc command. - 3.05 Sep 23, 1999 - Jens Axboe + 3.05 Oct 24, 1999 - Jens Axboe -- Changed the interface for CDROM_SEND_PACKET. Before it was virtually impossible to send the drive data in a sensible way. + -- Lowered stack usage in mmc_ioctl(), dvd_read_disckey(), and + dvd_read_manufact. + -- Added setup of write mode for packet writing. + -- Fixed CDDA ripping with cdda2wav - accept much larger requests of + number of frames and split the reads in blocks of 8. -------------------------------------------------------------------------*/ #define REVISION "Revision: 3.05" -#define VERSION "Id: cdrom.c 3.05 1999/09/23" +#define VERSION "Id: cdrom.c 3.05 1999/10/24" /* I use an error-log mask to give fine grain control over the type of messages dumped to the system logs. The available masks include: */ @@ -205,7 +210,6 @@ /* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */ /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE|CD_COUNT_TRACKS) */ - #include #include #include @@ -311,7 +315,7 @@ int register_cdrom(struct cdrom_device_info *cdi) { static char banner_printed = 0; - int major = MAJOR (cdi->dev); + int major = MAJOR(cdi->dev); struct cdrom_device_ops *cdo = cdi->ops; int *change_capability = (int *)&cdo->capability; /* hack */ @@ -362,7 +366,7 @@ int unregister_cdrom(struct cdrom_device_info *unreg) { struct cdrom_device_info *cdi, *prev; - int major = MAJOR (unreg->dev); + int major = MAJOR(unreg->dev); cdinfo(CD_OPEN, "entering unregister_cdrom\n"); @@ -388,7 +392,7 @@ } static -struct cdrom_device_info *cdrom_find_device (kdev_t dev) +struct cdrom_device_info *cdrom_find_device(kdev_t dev) { struct cdrom_device_info *cdi; @@ -736,7 +740,7 @@ return cdi->ops->generic_packet(cdi, &cgc); } -int cdrom_select_disc (struct cdrom_device_info *cdi, int slot) +int cdrom_select_disc(struct cdrom_device_info *cdi, int slot) { struct cdrom_changer_info info; int curslot; @@ -908,7 +912,8 @@ void init_cdrom_command(struct cdrom_generic_command *cgc, void *buffer, int len) { - memset(cgc, 0, sizeof(*cgc)); + memset(cgc, 0, sizeof(struct cdrom_generic_command)); + memset(buffer, 0, len); cgc->buffer = (char *) buffer; cgc->buflen = len; } @@ -918,19 +923,49 @@ #define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key)) #define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge)) -static void setup_report_key (struct cdrom_generic_command *cgc, unsigned agid, unsigned type) +static void setup_report_key(struct cdrom_generic_command *cgc, unsigned agid, unsigned type) { cgc->cmd[0] = GPCMD_REPORT_KEY; cgc->cmd[10] = type | (agid << 6); + switch (type) { + case 0: case 8: case 5: { + cgc->buflen = 8; + break; + } + case 1: { + cgc->buflen = 16; + break; + } + case 2: case 4: { + cgc->buflen = 12; + break; + } + } + cgc->cmd[9] = cgc->buflen; } -static void setup_send_key (struct cdrom_generic_command *cgc, unsigned agid, unsigned type) +static void setup_send_key(struct cdrom_generic_command *cgc, unsigned agid, unsigned type) { cgc->cmd[0] = GPCMD_SEND_KEY; cgc->cmd[10] = type | (agid << 6); + switch (type) { + case 1: { + cgc->buflen = 16; + break; + } + case 3: { + cgc->buflen = 12; + break; + } + case 6: { + cgc->buflen = 8; + break; + } + } + cgc->cmd[9] = cgc->buflen; } -static int dvd_do_auth (struct cdrom_device_info *cdi, dvd_authinfo *ai) +static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) { int ret; u_char buf[20]; @@ -943,8 +978,7 @@ /* LU data send */ case DVD_LU_SEND_AGID: cdinfo(CD_DVD, "entering DVD_LU_SEND_AGID\n"); - setup_report_key (&cgc, 0, 0); - cgc.buflen = cgc.cmd[9] = 8; + setup_report_key(&cgc, ai->lsa.agid, 0); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -955,8 +989,7 @@ case DVD_LU_SEND_KEY1: cdinfo(CD_DVD, "entering DVD_LU_SEND_KEY1\n"); - setup_report_key (&cgc, ai->lsk.agid, 2); - cgc.buflen = cgc.cmd[9] = 12; + setup_report_key(&cgc, ai->lsk.agid, 2); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -967,8 +1000,7 @@ case DVD_LU_SEND_CHALLENGE: cdinfo(CD_DVD, "entering DVD_LU_SEND_CHALLENGE\n"); - setup_report_key (&cgc, ai->lsc.agid, 1); - cgc.buflen = cgc.cmd[9] = 16; + setup_report_key(&cgc, ai->lsc.agid, 1); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -980,12 +1012,11 @@ /* Post-auth key */ case DVD_LU_SEND_TITLE_KEY: cdinfo(CD_DVD, "entering DVD_LU_SEND_TITLE_KEY\n"); - setup_report_key (&cgc, ai->lstk.agid, 4); + setup_report_key(&cgc, ai->lstk.agid, 4); cgc.cmd[5] = ai->lstk.lba; cgc.cmd[4] = ai->lstk.lba >> 8; cgc.cmd[3] = ai->lstk.lba >> 16; cgc.cmd[2] = ai->lstk.lba >> 24; - cgc.buflen = cgc.cmd[9] = 12; if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -993,14 +1024,13 @@ ai->lstk.cpm = (buf[4] >> 7) & 1; ai->lstk.cp_sec = (buf[4] >> 6) & 1; ai->lstk.cgms = (buf[4] >> 4) & 3; - copy_key (ai->lstk.title_key, &buf[5]); + copy_key(ai->lstk.title_key, &buf[5]); /* Returning data, let host change state */ break; case DVD_LU_SEND_ASF: cdinfo(CD_DVD, "entering DVD_LU_SEND_ASF\n"); - setup_report_key (&cgc, ai->lsasf.asf, 5); - cgc.buflen = cgc.cmd[9] = 8; + setup_report_key(&cgc, ai->lsasf.asf, 5); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -1011,10 +1041,9 @@ /* LU data receive (LU changes state) */ case DVD_HOST_SEND_CHALLENGE: cdinfo(CD_DVD, "entering DVD_HOST_SEND_CHALLENGE\n"); - setup_send_key (&cgc, ai->hsc.agid, 1); - cgc.buflen = cgc.cmd[9] = 16; - buf[1] = 14; - copy_chal (&buf[4], ai->hsc.chal); + setup_send_key(&cgc, ai->hsc.agid, 1); + buf[1] = 0xe; + copy_chal(&buf[4], ai->hsc.chal); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -1024,13 +1053,11 @@ case DVD_HOST_SEND_KEY2: cdinfo(CD_DVD, "entering DVD_HOST_SEND_KEY2\n"); - setup_send_key (&cgc, ai->hsk.agid, 3); - cgc.buflen = cgc.cmd[9] = 12; - buf[1] = 10; - copy_key (&buf[4], ai->hsk.key); + setup_send_key(&cgc, ai->hsk.agid, 3); + buf[1] = 0xa; + copy_key(&buf[4], ai->hsk.key); - ret = cdo->generic_packet(cdi, &cgc); - if (ret) { + if ((ret = cdo->generic_packet(cdi, &cgc))) { ai->type = DVD_AUTH_FAILURE; return ret; } @@ -1040,7 +1067,7 @@ /* Misc */ case DVD_INVALIDATE_AGID: cdinfo(CD_DVD, "entering DVD_INVALIDATE_AGID\n"); - setup_report_key (&cgc, ai->lsa.agid, 0x3f); + setup_report_key(&cgc, ai->lsa.agid, 0x3f); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; break; @@ -1053,7 +1080,7 @@ return 0; } -static int dvd_read_physical (struct cdrom_device_info *cdi, dvd_struct *s) +static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s) { int ret, i; u_char buf[4 + 4 * 20], *base; @@ -1061,7 +1088,6 @@ struct cdrom_generic_command cgc; struct cdrom_device_ops *cdo = cdi->ops; - memset(buf, 0, sizeof(buf)); init_cdrom_command(&cgc, buf, sizeof(buf)); cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; cgc.cmd[6] = s->physical.layer_num; @@ -1077,7 +1103,7 @@ /* place the data... really ugly, but at least we won't have to worry about endianess in userspace or here. */ for (i = 0; i < 4; ++i, base += 20, ++layer) { - memset (layer, 0, sizeof (*layer)); + memset(layer, 0, sizeof(*layer)); layer->book_version = base[0] & 0xf; layer->book_type = base[0] >> 4; layer->min_rate = base[1] & 0xf; @@ -1103,7 +1129,6 @@ struct cdrom_generic_command cgc; struct cdrom_device_ops *cdo = cdi->ops; - memset(buf, 0, sizeof(buf)); init_cdrom_command(&cgc, buf, sizeof(buf)); cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; cgc.cmd[6] = s->copyright.layer_num; @@ -1120,27 +1145,30 @@ return 0; } -static int dvd_read_disckey (struct cdrom_device_info *cdi, dvd_struct *s) +static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s) { - int ret; - u_char buf[4 + 2048]; + int ret, size; + u_char *buf; struct cdrom_generic_command cgc; struct cdrom_device_ops *cdo = cdi->ops; - memset(buf, 0, sizeof (buf)); - init_cdrom_command(&cgc, buf, sizeof(buf)); + size = sizeof(s->disckey.value) + 4; + + if ((buf = (u_char *) kmalloc(size, GFP_KERNEL)) == NULL) + return -ENOMEM; + + init_cdrom_command(&cgc, buf, size); cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; cgc.cmd[7] = s->type; - cgc.cmd[8] = sizeof(buf) >> 8; - cgc.cmd[9] = cgc.buflen & 0xff; + cgc.cmd[8] = size >> 8; + cgc.cmd[9] = size & 0xff; cgc.cmd[10] = s->disckey.agid << 6; - if ((ret = cdo->generic_packet(cdi, &cgc))) - return ret; - - memcpy(s->disckey.value, &buf[4], 2048); + if (!(ret = cdo->generic_packet(cdi, &cgc))) + memcpy(s->disckey.value, &buf[4], sizeof(s->disckey.value)); - return 0; + kfree(buf); + return ret; } static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s) @@ -1150,7 +1178,6 @@ struct cdrom_generic_command cgc; struct cdrom_device_ops *cdo = cdi->ops; - memset(buf, 0, sizeof (buf)); init_cdrom_command(&cgc, buf, sizeof(buf)); cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; cgc.cmd[7] = s->type; @@ -1171,30 +1198,38 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s) { - int ret; - u_char buf[4 + 2048]; + int ret = 0, size; + u_char *buf; struct cdrom_generic_command cgc; struct cdrom_device_ops *cdo = cdi->ops; - memset(buf, 0, sizeof(buf)); - init_cdrom_command(&cgc, buf, sizeof(buf)); + size = sizeof(s->manufact.value) + 4; + + if ((buf = (u_char *) kmalloc(size, GFP_KERNEL)) == NULL) + return -ENOMEM; + + init_cdrom_command(&cgc, buf, size); cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; cgc.cmd[7] = s->type; - cgc.buflen = sizeof(buf); - cgc.cmd[8] = sizeof(buf) >> 8; - cgc.cmd[9] = cgc.buflen & 0xff; + cgc.cmd[8] = size >> 8; + cgc.cmd[9] = size & 0xff; - if ((ret = cdo->generic_packet(cdi, &cgc))) + if ((ret = cdo->generic_packet(cdi, &cgc))) { + kfree(buf); return ret; + } s->manufact.len = buf[0] << 8 | buf[1]; if (s->manufact.len < 0 || s->manufact.len > 2048) { - cdinfo(CD_WARNING, "Recieved invalid manufacture info length (%d)\n", s->bca.len); - return -EIO; + cdinfo(CD_WARNING, "Received invalid manufacture info length" + " (%d)\n", s->bca.len); + ret = -EIO; + } else { + memcpy(s->manufact.value, &buf[4], s->manufact.len); } - memcpy(s->manufact.value, &buf[4], s->manufact.len); - return 0; + kfree(buf); + return ret; } static int dvd_read_struct(struct cdrom_device_info *cdi, dvd_struct *s) @@ -1709,7 +1744,7 @@ } static inline -int msf_to_lba (char m, char s, char f) +int msf_to_lba(char m, char s, char f) { return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; } @@ -1763,7 +1798,7 @@ } case CDROMREADAUDIO: { struct cdrom_read_audio ra; - int lba; + int lba, frames; IOCTL_IN(arg, struct cdrom_read_audio, ra); @@ -1780,12 +1815,10 @@ if (lba < 0) return -EINVAL; - /* do between 1 and 8 frames at the time */ - if (ra.nframes > 8 || ra.nframes < 1) - return -EINVAL; + /* do max 8 frames at the time */ + frames = ra.nframes > 8 ? 8 : ra.nframes; - /* just a nice round figure */ - if ((cgc.buffer = (char *) kmalloc(CD_FRAMESIZE_RAW*ra.nframes, + if ((cgc.buffer = (char *) kmalloc(CD_FRAMESIZE_RAW * frames, GFP_KERNEL)) == NULL) return -ENOMEM; @@ -1795,14 +1828,14 @@ } while (ra.nframes > 0) { - ret = cdrom_read_block(cdi, &cgc, lba, ra.nframes, 1, + ret = cdrom_read_block(cdi, &cgc, lba, frames, 1, CD_FRAMESIZE_RAW); if (ret) break; __copy_to_user(ra.buf, cgc.buffer, - CD_FRAMESIZE_RAW*ra.nframes); - ra.buf += (CD_FRAMESIZE_RAW * ra.nframes); - ra.nframes -= ra.nframes; - lba += ra.nframes; + CD_FRAMESIZE_RAW * frames); + ra.buf += (CD_FRAMESIZE_RAW * frames); + ra.nframes -= frames; + lba += frames; } kfree(cgc.buffer); return ret; @@ -1950,17 +1983,27 @@ cgc.cmd[8] = (cmd == CDROMRESUME) ? 1 : 0; return cdo->generic_packet(cdi, &cgc); } - + case DVD_READ_STRUCT: { - dvd_struct s; + dvd_struct *s; + int size = sizeof(dvd_struct); if (!CDROM_CAN(CDC_DVD)) return -ENOSYS; + if ((s = (dvd_struct *) kmalloc(size, GFP_KERNEL)) == NULL) + return -ENOMEM; cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); - IOCTL_IN(arg, dvd_struct, s); - if ((ret = dvd_read_struct(cdi, &s))) + if (copy_from_user(s, (dvd_struct *)arg, size)) { + kfree(s); + return -EFAULT; + } + if ((ret = dvd_read_struct(cdi, s))) { + kfree(s); return ret; - IOCTL_OUT(arg, dvd_struct, s); - return 0; + } + if (copy_to_user((dvd_struct *)arg, s, size)) + ret = -EFAULT; + kfree(s); + return ret; } case DVD_AUTH: { @@ -2069,7 +2112,6 @@ /* set up command and get the disc info */ init_cdrom_command(&cgc, di, sizeof(*di)); - memset(di, 0, sizeof(disc_information)); cgc.cmd[0] = GPCMD_READ_DISC_INFO; cgc.cmd[8] = cgc.buflen; @@ -2207,7 +2249,6 @@ memset(&di, 0, sizeof(disc_information)); memset(&ti, 0, sizeof(track_information)); - memset(&wp, 0, sizeof(write_param_page)); memset(&cdi->write, 0, sizeof(struct cdrom_write_settings)); if ((ret = cdrom_get_disc_info(cdi->dev, &di))) diff -u --recursive --new-file v2.3.25/linux/drivers/char/Makefile linux/drivers/char/Makefile --- v2.3.25/linux/drivers/char/Makefile Mon Nov 1 13:56:26 1999 +++ linux/drivers/char/Makefile Tue Nov 2 21:35:46 1999 @@ -322,6 +322,10 @@ ifeq ($(CONFIG_RTC),y) O_OBJS += rtc.o +else + ifeq ($(CONFIG_RTC),m) + M_OBJS += rtc.o + endif endif ifeq ($(CONFIG_NVRAM),y) @@ -362,16 +366,6 @@ endif endif -ifeq ($(CONFIG_VIDEO_SAA5249),y) -O_OBJS += saa5249.o -L_I2C=y -else - ifeq ($(CONFIG_VIDEO_SAA5249),m) - M_OBJS += saa5249.o - M_I2C=y - endif -endif - ifeq ($(CONFIG_I2C_PARPORT),y) O_OBJS += i2c-parport.o L_I2C = y @@ -382,11 +376,13 @@ endif endif -ifeq ($(CONFIG_VIDEO_BWQCAM),y) -O_OBJS += bw-qcam.o +ifeq ($(CONFIG_VIDEO_SAA5249),y) +O_OBJS += saa5249.o +L_I2C=y else - ifeq ($(CONFIG_VIDEO_BWQCAM),m) - M_OBJS += bw-qcam.o + ifeq ($(CONFIG_VIDEO_SAA5249),m) + M_OBJS += saa5249.o + M_I2C=y endif endif @@ -395,6 +391,14 @@ else ifeq ($(CONFIG_VIDEO_CQCAM),m) M_OBJS += c-qcam.o + endif +endif + +ifeq ($(CONFIG_VIDEO_BWQCAM),y) +O_OBJS += bw-qcam.o +else + ifeq ($(CONFIG_VIDEO_BWQCAM),m) + M_OBJS += bw-qcam.o endif endif diff -u --recursive --new-file v2.3.25/linux/drivers/char/README.computone linux/drivers/char/README.computone --- v2.3.25/linux/drivers/char/README.computone Thu Aug 26 13:05:34 1999 +++ linux/drivers/char/README.computone Sat Nov 6 10:38:40 1999 @@ -47,7 +47,7 @@ e) Set address on ISA cards then: edit /usr/src/linux/drivers/char/ip2/ip2.h if needed or - edit /etc/conf.modules (or /etc/modules.conf) if needed (module). + edit /etc/modules.conf if needed (module). or both to match this setting. f) Run "make dep" g) Run "make modules" diff -u --recursive --new-file v2.3.25/linux/drivers/char/adbmouse.c linux/drivers/char/adbmouse.c --- v2.3.25/linux/drivers/char/adbmouse.c Fri Oct 15 15:25:13 1999 +++ linux/drivers/char/adbmouse.c Tue Nov 2 21:38:44 1999 @@ -148,7 +148,7 @@ ADB_MOUSE_MINOR, "adbmouse", open_mouse, release_mouse, 7 }; -int __init adb_mouse_init(void) +static int __init adb_mouse_init(void) { #ifdef __powerpc__ if ((_machine != _MACH_chrp) && (_machine != _MACH_Pmac)) @@ -170,6 +170,8 @@ return msedev < 0 ? msedev : 0; } +#ifndef MODULE + /* * XXX this function is misnamed. * It is called if the kernel is booted with the adb_buttons=xxx @@ -193,15 +195,12 @@ __setup("adb_buttons=", adb_mouse_setup); -#ifdef MODULE -int init_module(void) -{ - return adb_mouse_init(); -} +#endif /* !MODULE */ -void cleanup_module(void) +static void __exit adb_mouse_cleanup(void) { unregister_busmouse(msedev); } -#endif +module_init(adb_mouse_init); +module_exit(adb_mouse_cleanup); diff -u --recursive --new-file v2.3.25/linux/drivers/char/amigamouse.c linux/drivers/char/amigamouse.c --- v2.3.25/linux/drivers/char/amigamouse.c Tue Sep 7 12:14:06 1999 +++ linux/drivers/char/amigamouse.c Tue Nov 2 21:38:44 1999 @@ -183,7 +183,7 @@ AMIGAMOUSE_MINOR, "amigamouse", open_mouse, release_mouse, 7 }; -int __init amiga_mouse_init(void) +static int __init amiga_mouse_init(void) { if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) return -ENODEV; @@ -200,12 +200,10 @@ return msedev < 0 ? msedev : 0; } -void __exit amiga_mouse_exit(void) +static void __exit amiga_mouse_exit(void) { unregister_busmouse(msedev); } -#ifdef MODULE -module_init(amiga_mouse_init) -module_exit(amiga_mouse_exit) -#endif +module_init(amiga_mouse_init); +module_exit(amiga_mouse_exit); diff -u --recursive --new-file v2.3.25/linux/drivers/char/atarimouse.c linux/drivers/char/atarimouse.c --- v2.3.25/linux/drivers/char/atarimouse.c Tue Sep 7 12:14:06 1999 +++ linux/drivers/char/atarimouse.c Tue Nov 2 21:38:44 1999 @@ -76,7 +76,7 @@ ATARIMOUSE_MINOR, "atarimouse", open_mouse, release_mouse, 0 }; -int __init atari_mouse_init(void) +static int __init atari_mouse_init(void) { if (!MACH_IS_ATARI) return -ENODEV; @@ -89,42 +89,50 @@ } +#ifndef MODULE + #define MIN_THRESHOLD 1 #define MAX_THRESHOLD 20 /* more seems not reasonable... */ -void __init atari_mouse_setup( char *str, int *ints ) +static int __init atari_mouse_setup( char *str ) { + int ints[8]; + + str = get_options(str, ARRAY_SIZE(ints), ints); + if (ints[0] < 1) { - printk( "atari_mouse_setup: no arguments!\n" ); - return; + printk(KERN_ERR "atari_mouse_setup: no arguments!\n" ); + return 0; } else if (ints[0] > 2) { - printk( "atari_mouse_setup: too many arguments\n" ); + printk(KERN_WARNING "atari_mouse_setup: too many arguments\n" ); } if (ints[1] < MIN_THRESHOLD || ints[1] > MAX_THRESHOLD) - printk( "atari_mouse_setup: bad threshold value (ignored)\n" ); + printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" ); else { mouse_threshold[0] = ints[1]; mouse_threshold[1] = ints[1]; if (ints[0] > 1) { if (ints[2] < MIN_THRESHOLD || ints[2] > MAX_THRESHOLD) - printk("atari_mouse_setup: bad threshold value (ignored)\n" ); + printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" ); else mouse_threshold[1] = ints[2]; } } - -} -#ifdef MODULE -int init_module(void) -{ - return atari_mouse_init(); + return 1; } -void cleanup_module(void) +__setup("atarimouse=",atari_mouse_setup); + +#endif /* !MODULE */ + +static void __exit atari_mouse_cleanup (void) { unregister_busmouse(msedev); } -#endif + +module_init(atari_mouse_init); +module_exit(atari_mouse_cleanup); + diff -u --recursive --new-file v2.3.25/linux/drivers/char/atixlmouse.c linux/drivers/char/atixlmouse.c --- v2.3.25/linux/drivers/char/atixlmouse.c Mon Aug 2 09:54:29 1999 +++ linux/drivers/char/atixlmouse.c Tue Nov 2 21:38:44 1999 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,7 @@ static int msedev; -void mouse_interrupt(int irq, void *dev_id, struct pt_regs * regs) +static void mouse_interrupt(int irq, void *dev_id, struct pt_regs * regs) { char dx, dy, buttons; @@ -102,10 +103,13 @@ ATIXL_BUSMOUSE, "atixl", open_mouse, release_mouse, 0 }; -int __init atixl_busmouse_init(void) +static int __init atixl_busmouse_init(void) { unsigned char a,b,c; + if (check_region(ATIXL_MSE_DATA_PORT, 3)) + return -EIO; + a = inb( ATIXL_MSE_SIGNATURE_PORT ); /* Get signature */ b = inb( ATIXL_MSE_SIGNATURE_PORT ); c = inb( ATIXL_MSE_SIGNATURE_PORT ); @@ -117,6 +121,8 @@ outb(0x07, ATIXL_MSE_CONTROL_PORT); /* Select Internal Register 7 */ outb(0x0a, ATIXL_MSE_DATA_PORT); /* Data Interrupts 8+, 1=30hz, 2=50hz, 3=100hz, 4=200hz rate */ + request_region(ATIXL_MSE_DATA_PORT, 3, "atixl"); + msedev = register_busmouse(&atixlmouse); if (msedev < 0) printk("Bus mouse initialisation error.\n"); @@ -125,15 +131,12 @@ return msedev < 0 ? msedev : 0; } -#ifdef MODULE - -int init_module(void) -{ - return atixl_busmouse_init(); -} - -void cleanup_module(void) +static void __exit atixl_cleanup (void) { + release_region(ATIXL_MSE_DATA_PORT, 3); unregister_busmouse(msedev); } -#endif + +module_init(atixl_busmouse_init); +module_exit(atixl_cleanup); + diff -u --recursive --new-file v2.3.25/linux/drivers/char/busmouse.c linux/drivers/char/busmouse.c --- v2.3.25/linux/drivers/char/busmouse.c Fri Oct 15 15:25:13 1999 +++ linux/drivers/char/busmouse.c Tue Nov 2 21:38:44 1999 @@ -48,12 +48,6 @@ */ /*#define BROKEN_MOUSE*/ -extern int adb_mouse_init(void); -extern int logi_busmouse_init(void); -extern int ms_bus_mouse_init(void); -extern int atixl_busmouse_init(void); -extern int amiga_mouse_init(void); -extern int atari_mouse_init(void); extern int sun_mouse_init(void); extern void mouse_rpc_init (void); @@ -435,26 +429,8 @@ int __init bus_mouse_init(void) { -#ifdef CONFIG_LOGIBUSMOUSE - logi_busmouse_init(); -#endif -#ifdef CONFIG_MS_BUSMOUSE - ms_bus_mouse_init(); -#endif -#ifdef CONFIG_ATIXL_BUSMOUSE - atixl_busmouse_init(); -#endif -#ifdef CONFIG_AMIGAMOUSE - amiga_mouse_init(); -#endif -#ifdef CONFIG_ATARIMOUSE - atari_mouse_init(); -#endif #ifdef CONFIG_SUN_MOUSE sun_mouse_init(); -#endif -#ifdef CONFIG_ADBMOUSE - adb_mouse_init(); #endif #ifdef CONFIG_RPCMOUSE mouse_rpc_init(); diff -u --recursive --new-file v2.3.25/linux/drivers/char/c-qcam.c linux/drivers/char/c-qcam.c --- v2.3.25/linux/drivers/char/c-qcam.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/char/c-qcam.c Tue Nov 2 21:35:46 1999 @@ -753,33 +753,21 @@ NULL }; -static void cqcam_init(void) +static int __init cqcam_init (void) { printk(BANNER "\n"); - parport_register_driver(&cqcam_driver); + return parport_register_driver(&cqcam_driver); } -#ifdef MODULE - MODULE_AUTHOR("Philip Blundell "); MODULE_DESCRIPTION(BANNER); -int init_module(void) -{ - cqcam_init(); - return 0; -} - -void cleanup_module(void) +static void __exit cqcam_cleanup (void) { unsigned int i; for (i = 0; i < num_cams; i++) close_cqcam(qcams[i]); } -#else -int __init init_colour_qcams(struct video_init *unused) -{ - cqcam_init(); - return 0; -} -#endif + +module_init(cqcam_init); +module_exit(cqcam_cleanup); diff -u --recursive --new-file v2.3.25/linux/drivers/char/cyclades.c linux/drivers/char/cyclades.c --- v2.3.25/linux/drivers/char/cyclades.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/char/cyclades.c Mon Nov 1 15:31:07 1999 @@ -699,6 +699,9 @@ (ZFIRM_ID==cy_readl(&((struct FIRM_ID *) \ ((card).base_addr+ID_ADDRESS))->signature))) +#ifndef SERIAL_XMIT_SIZE +#define SERIAL_XMIT_SIZE (MIN(PAGE_SIZE, 4096)) +#endif #define WAKEUP_CHARS (SERIAL_XMIT_SIZE-256) #define STD_COM_FLAGS (0) diff -u --recursive --new-file v2.3.25/linux/drivers/char/drm/proc.c linux/drivers/char/drm/proc.c --- v2.3.25/linux/drivers/char/drm/proc.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/char/drm/proc.c Tue Nov 2 17:40:11 1999 @@ -382,7 +382,7 @@ vma->vm_flags & VM_MAYSHARE ? 's' : 'p', vma->vm_flags & VM_LOCKED ? 'l' : '-', vma->vm_flags & VM_IO ? 'i' : '-', - vma->vm_offset ); + vma->vm_pgoff << PAGE_SHIFT ); #if defined(__i386__) pgprot = pgprot_val(vma->vm_page_prot); DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", diff -u --recursive --new-file v2.3.25/linux/drivers/char/drm/vm.c linux/drivers/char/drm/vm.c --- v2.3.25/linux/drivers/char/drm/vm.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/vm.c Tue Nov 2 17:40:11 1999 @@ -96,7 +96,7 @@ if (address > vma->vm_end) return 0; /* Disallow mremap */ if (!dma->pagelist) return 0; /* Nothing allocated */ - offset = address - vma->vm_start; /* vm_offset should be 0 */ + offset = address - vma->vm_start; /* vm_pgoff should be 0 */ page = offset >> PAGE_SHIFT; physical = dma->pagelist[page] + (offset & (~PAGE_MASK)); atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */ @@ -168,8 +168,8 @@ drm_device_dma_t *dma = dev->dma; unsigned long length = vma->vm_end - vma->vm_start; - DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, vma->vm_offset); + DRM_DEBUG("start = 0x%lx, end = 0x%lx, pgoff = 0x%lx\n", + vma->vm_start, vma->vm_end, vma->vm_pgoff); /* Length must match exact page count */ if ((length >> PAGE_SHIFT) != dma->page_count) return -EINVAL; @@ -192,13 +192,17 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_map_t *map = NULL; + unsigned long off; int i; DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, vma->vm_offset); + vma->vm_start, vma->vm_end, vma->vm_pgoff); - if (!vma->vm_offset) return drm_mmap_dma(filp, vma); + if (!vma->vm_pgoff) return drm_mmap_dma(filp, vma); + if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) /* overflow? */ + return -EINVAL; + off = vma->vm_pgoff << PAGE_SHIFT; /* A sequential search of a linked list is fine here because: 1) there will only be about 5-10 entries in the list and, 2) a @@ -208,7 +212,7 @@ bit longer. */ for (i = 0; i < dev->map_count; i++) { map = dev->maplist[i]; - if (map->offset == vma->vm_offset) break; + if (map->offset == off) break; } if (i >= dev->map_count) return -EINVAL; @@ -222,7 +226,7 @@ switch (map->type) { case _DRM_FRAME_BUFFER: case _DRM_REGISTERS: - if (vma->vm_offset >= __pa(high_memory)) { + if (off >= __pa(high_memory)) { #if defined(__i386__) if (boot_cpu_data.x86 > 3) { pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; @@ -232,7 +236,7 @@ vma->vm_flags |= VM_IO; /* not in core dump */ } if (remap_page_range(vma->vm_start, - vma->vm_offset, + off, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; diff -u --recursive --new-file v2.3.25/linux/drivers/char/ftape/Config.in linux/drivers/char/ftape/Config.in --- v2.3.25/linux/drivers/char/ftape/Config.in Mon Oct 11 15:38:14 1999 +++ linux/drivers/char/ftape/Config.in Wed Nov 3 14:43:54 1999 @@ -5,7 +5,7 @@ if [ "$CONFIG_ZFTAPE" != "n" ]; then int ' Default block size' CONFIG_ZFT_DFLT_BLK_SZ 10240 comment ' The compressor will be built as a module only!' - define_bool CONFIG_ZFT_COMPRESSOR m + define_tristate CONFIG_ZFT_COMPRESSOR m fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then int ' Number of ftape buffers (EXPERIMENTAL)' CONFIG_FT_NR_BUFFERS 3 diff -u --recursive --new-file v2.3.25/linux/drivers/char/ftape/lowlevel/ftape-ctl.c linux/drivers/char/ftape/lowlevel/ftape-ctl.c --- v2.3.25/linux/drivers/char/ftape/lowlevel/ftape-ctl.c Fri Jan 23 17:38:04 1998 +++ linux/drivers/char/ftape/lowlevel/ftape-ctl.c Wed Nov 3 11:41:29 1999 @@ -704,8 +704,8 @@ if ((vma_get_flags(vma) & (VM_READ|VM_WRITE)) == 0) { TRACE_ABORT(-EINVAL, ft_t_err, "Undefined mmap() access"); } - if (vma_get_offset (vma) != 0) { - TRACE_ABORT(-EINVAL, ft_t_err, "offset must be 0"); + if (vma_get_pgoff(vma) != 0) { + TRACE_ABORT(-EINVAL, ft_t_err, "page offset must be 0"); } if ((vma_get_end (vma) - vma_get_start (vma)) % FT_BUFF_SIZE != 0) { TRACE_ABORT(-EINVAL, ft_t_err, diff -u --recursive --new-file v2.3.25/linux/drivers/char/ip2/ip2.h linux/drivers/char/ip2/ip2.h --- v2.3.25/linux/drivers/char/ip2/ip2.h Thu Aug 26 13:05:35 1999 +++ linux/drivers/char/ip2/ip2.h Sat Nov 6 10:38:40 1999 @@ -70,8 +70,7 @@ * console warning. * When the driver is loaded as a module these setting can be overridden on the - * modprobe command line or on an option line in /etc/conf.modules - * or /etc/modules.conf depending on your distrubution. + * modprobe command line or on an option line in /etc/modules.conf. * If the driver is built-in the configuration must be * set here for ISA cards and address set to 1 and 2 for PCI and EISA. * @@ -92,8 +91,8 @@ /* this structure is zeroed out because the suggested method is to configure * the driver as a module, set up the parameters with an options line in - * /etc/modules.conf or /etc/conf.modules and load with modprobe, kerneld or - * kmod, the kernel module loader + * /etc/modules.conf and load with modprobe, kerneld or kmod, the kernel + * module loader */ static ip2config_t ip2config = { diff -u --recursive --new-file v2.3.25/linux/drivers/char/isicom.c linux/drivers/char/isicom.c --- v2.3.25/linux/drivers/char/isicom.c Tue Aug 31 17:29:13 1999 +++ linux/drivers/char/isicom.c Sat Nov 6 10:38:40 1999 @@ -25,7 +25,7 @@ * You can find the original tools for this direct from Multitech * ftp://ftp.multitech.com/ISI-Cards/ * - * Having installed the cards the module options (/etc/conf.modules) + * Having installed the cards the module options (/etc/modules.conf) * * options isicom io=card1,card2,card3,card4 irq=card1,card2,card3,card4 * diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-amiga.c linux/drivers/char/joystick/joy-amiga.c --- v2.3.25/linux/drivers/char/joystick/joy-amiga.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-amiga.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -39,7 +39,7 @@ static struct js_port* js_am_port __initdata = NULL; -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_am, "1-2i"); static int js_am[]={0,0}; diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-analog.c linux/drivers/char/joystick/joy-analog.c --- v2.3.25/linux/drivers/char/joystick/joy-analog.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-analog.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -43,7 +43,7 @@ static int js_an_port_list[] __initdata = {0x201, 0}; static struct js_port* js_an_port __initdata = NULL; -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_an, "2-24i"); static int js_an[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0}; diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-analog.h linux/drivers/char/joystick/joy-analog.h --- v2.3.25/linux/drivers/char/joystick/joy-analog.h Thu Oct 8 17:25:16 1998 +++ linux/drivers/char/joystick/joy-analog.h Fri Nov 5 10:01:50 1999 @@ -26,7 +26,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -238,7 +238,7 @@ break; default: printk(KERN_WARNING "joy-analog: Unknown joystick device detected " - "(data=%#x), contact \n", exist); + "(data=%#x), contact \n", exist); return -1; } } diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-assasin.c linux/drivers/char/joystick/joy-assasin.c --- v2.3.25/linux/drivers/char/joystick/joy-assasin.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-assasin.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -49,7 +49,7 @@ #define JS_AS_MODE_OEM 3 /* Panther OEM version */ #define JS_AS_MODE_PXL 4 /* Panther XL */ -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_as, "2-24i"); static int js_as[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0}; @@ -319,7 +319,7 @@ info = port->info; } else { printk(KERN_WARNING "joy-assasin: unknown joystick device detected " - "(io=%#x, id=%d), contact \n", io, data[0]); + "(io=%#x, id=%d), contact \n", io, data[0]); return port; } diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-gravis.c linux/drivers/char/joystick/joy-gravis.c --- v2.3.25/linux/drivers/char/joystick/joy-gravis.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-gravis.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-lightning.c linux/drivers/char/joystick/joy-lightning.c --- v2.3.25/linux/drivers/char/joystick/joy-lightning.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-lightning.c Fri Nov 5 10:01:50 1999 @@ -26,7 +26,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -52,7 +52,7 @@ static struct js_port* __initdata js_l4_port = NULL; -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_l4, "2-24i"); static int js_l4[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0}; diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-logitech.c linux/drivers/char/joystick/joy-logitech.c --- v2.3.25/linux/drivers/char/joystick/joy-logitech.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-logitech.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -318,7 +318,7 @@ return port; default: printk(KERN_WARNING "joy-logitech: unknown joystick device detected " - "(io=%#x, count=%d, data=0x%08x%08x), contact \n", + "(io=%#x, count=%d, data=0x%08x%08x), contact \n", io, i, (int)(data >> 32), (int)(data & 0xffffffff)); return port; } diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-sidewinder.c linux/drivers/char/joystick/joy-sidewinder.c --- v2.3.25/linux/drivers/char/joystick/joy-sidewinder.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-sidewinder.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -422,7 +422,7 @@ return port; default: printk(KERN_WARNING "joy-sidewinder: unknown joystick device detected " - "(io=%#x, count=%d, data=0x%08x%08x), contact \n", + "(io=%#x, count=%d, data=0x%08x%08x), contact \n", io, i, (int)(data >> 32), (int)(data & 0xffffffff)); return port; } diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-thrustmaster.c linux/drivers/char/joystick/joy-thrustmaster.c --- v2.3.25/linux/drivers/char/joystick/joy-thrustmaster.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-thrustmaster.c Fri Nov 5 10:01:50 1999 @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -278,7 +278,7 @@ if (info.mode >= JS_TM_MODE_MAX || !names[info.mode]) { printk(KERN_WARNING "joy-thrustmaster: unknown device detected " - "(io=%#x, id=%d), contact \n", + "(io=%#x, id=%d), contact \n", io, info.mode); return port; } diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joy-turbografx.c linux/drivers/char/joystick/joy-turbografx.c --- v2.3.25/linux/drivers/char/joystick/joy-turbografx.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-turbografx.c Fri Nov 5 10:01:50 1999 @@ -26,7 +26,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -41,7 +41,7 @@ #include -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_tg, "2-8i"); MODULE_PARM(js_tg_2, "2-8i"); MODULE_PARM(js_tg_3, "2-8i"); diff -u --recursive --new-file v2.3.25/linux/drivers/char/joystick/joystick.c linux/drivers/char/joystick/joystick.c --- v2.3.25/linux/drivers/char/joystick/joystick.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/char/joystick/joystick.c Fri Nov 5 10:01:50 1999 @@ -26,7 +26,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -90,7 +90,7 @@ * Module info. */ -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_SUPPORTED_DEVICE("js"); /* diff -u --recursive --new-file v2.3.25/linux/drivers/char/logibusmouse.c linux/drivers/char/logibusmouse.c --- v2.3.25/linux/drivers/char/logibusmouse.c Tue Aug 31 17:29:13 1999 +++ linux/drivers/char/logibusmouse.c Tue Nov 2 21:38:44 1999 @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,6 @@ #include #include #include -#include #include #include @@ -61,16 +61,26 @@ static int msedev; static int mouse_irq = MOUSE_IRQ; -#ifdef MODULE MODULE_PARM(mouse_irq, "i"); -#endif -void __init bmouse_setup(char *str, int *ints) +#ifndef MODULE + +static int __init bmouse_setup(char *str) { + int ints[4]; + + str = get_options(str, ARRAY_SIZE(ints), ints); + if (ints[0] > 0) mouse_irq=ints[1]; + + return 1; } +__setup("logi_busmouse=", bmouse_setup); + +#endif /* !MODULE */ + static void mouse_interrupt(int irq, void *dev_id, struct pt_regs *regs) { char dx, dy; @@ -118,7 +128,7 @@ LOGITECH_BUSMOUSE, "busmouse", open_mouse, close_mouse, 7 }; -int __init logi_busmouse_init(void) +static int __init logi_busmouse_init(void) { if (check_region(LOGIBM_BASE, LOGIBM_EXTENT)) return -EIO; @@ -142,16 +152,11 @@ return msedev < 0 ? msedev : 0; } -#ifdef MODULE - -int init_module(void) -{ - return logi_busmouse_init(); -} - -void cleanup_module(void) +static void __exit logi_busmouse_cleanup (void) { unregister_busmouse(msedev); release_region(LOGIBM_BASE, LOGIBM_EXTENT); } -#endif + +module_init(logi_busmouse_init); +module_exit(logi_busmouse_cleanup); diff -u --recursive --new-file v2.3.25/linux/drivers/char/msbusmouse.c linux/drivers/char/msbusmouse.c --- v2.3.25/linux/drivers/char/msbusmouse.c Tue Aug 31 17:29:13 1999 +++ linux/drivers/char/msbusmouse.c Tue Nov 2 21:38:44 1999 @@ -56,16 +56,26 @@ static int msedev; static int mouse_irq = MOUSE_IRQ; -#ifdef MODULE MODULE_PARM(mouse_irq, "i"); -#endif -void __init msmouse_setup(char *str, int *ints) +#ifndef MODULE + +static int __init msmouse_setup(char *str) { + int ints[4]; + + str = get_options(str, ARRAY_SIZE(ints), ints); + if (ints[0] > 0) mouse_irq=ints[1]; + + return 1; } +__setup("msmouse=",msmouse_setup); + +#endif /* !MODULE */ + static void ms_mouse_interrupt(int irq, void *dev_id, struct pt_regs * regs) { char dx, dy; @@ -117,7 +127,7 @@ MICROSOFT_BUSMOUSE, "msbusmouse", open_mouse, release_mouse, 0 }; -int __init ms_bus_mouse_init(void) +static int __init ms_bus_mouse_init(void) { int present = 0; int mse_byte, i; @@ -151,7 +161,7 @@ return msedev < 0 ? msedev : 0; } -void ms_bus_mouse_exit(void) +static void __exit ms_bus_mouse_exit(void) { unregister_busmouse(msedev); release_region(MS_MSE_CONTROL_PORT, 0x04); diff -u --recursive --new-file v2.3.25/linux/drivers/char/saa5249.c linux/drivers/char/saa5249.c --- v2.3.25/linux/drivers/char/saa5249.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/char/saa5249.c Tue Nov 2 21:35:46 1999 @@ -41,21 +41,22 @@ */ #include - #include #include #include #include #include #include -#include -#include -#include +#include +#include #include #include #include #include +#include +#include + #define VTX_VER_MAJ 1 #define VTX_VER_MIN 7 @@ -661,54 +662,32 @@ return -EINVAL; } -static long saa5249_read(struct video_device *v, char *buf, unsigned long l, int nb) -{ - return -EINVAL; -} - -int init_saa_5249(struct video_init *v) +static int __init init_saa_5249 (void) { printk(KERN_INFO "SAA5249 driver (" IF_NAME " interface) for VideoText version %d.%d\n", VTX_VER_MAJ, VTX_VER_MIN); - i2c_register_driver(&i2c_driver_videotext); + return i2c_register_driver(&i2c_driver_videotext); +} - return 0; +static void __exit cleanup_saa_5249 (void) +{ + i2c_unregister_driver(&i2c_driver_videotext); } -static struct video_device saa_template= +module_init(init_saa_5249); +module_exit(cleanup_saa_5249); + +static struct video_device saa_template = { IF_NAME, VID_TYPE_TELETEXT, /*| VID_TYPE_TUNER ?? */ VID_HARDWARE_SAA5249, saa5249_open, saa5249_release, - saa5249_read, + NULL, /* read */ saa5249_write, - NULL, /* poll */ + NULL, /* poll */ saa5249_ioctl, - NULL, - NULL, - NULL, - 0, - 0 + /* the rest are null */ }; -#ifdef MODULE - -/* - * Routines for loadable modules - */ - -int init_module(void) -{ - init_saa_5249(NULL); - return 0; -} - - -void cleanup_module(void) -{ - i2c_unregister_driver(&i2c_driver_videotext); -} - -#endif diff -u --recursive --new-file v2.3.25/linux/drivers/char/sysrq.c linux/drivers/char/sysrq.c --- v2.3.25/linux/drivers/char/sysrq.c Mon Jul 19 23:08:41 1999 +++ linux/drivers/char/sysrq.c Fri Nov 5 11:42:56 1999 @@ -24,15 +24,14 @@ #include -#ifdef CONFIG_APM -#include -#endif - extern void wakeup_bdflush(int); extern void reset_vc(unsigned int); extern int console_loglevel; extern struct vfsmount *vfsmntlist; +/* Machine specific power off function */ +void (*sysrq_power_off)(void) = NULL; + /* Send a signal to all user processes */ static void send_sig_all(int sig, int even_init) @@ -82,12 +81,12 @@ printk("Resetting\n"); machine_restart(NULL); break; -#ifdef CONFIG_APM case 'o': /* O -- power off */ - printk("Power off\n"); - apm_power_off(); + if (sysrq_power_off) { + printk("Power off\n"); + sysrq_power_off(); + } break; -#endif case 's': /* S -- emergency sync */ printk("Emergency Sync\n"); emergency_sync_scheduled = EMERG_SYNC; @@ -137,11 +136,10 @@ if (tty) printk("saK "); #endif - printk("Boot " -#ifdef CONFIG_APM - "Off " -#endif - "Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL\n"); + printk("Boot "); + if (sysrq_power_off) + printk("Off "); + printk("Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL\n"); /* Don't use 'A' as it's handled specially on the Sparc */ } diff -u --recursive --new-file v2.3.25/linux/drivers/char/tuner.c linux/drivers/char/tuner.c --- v2.3.25/linux/drivers/char/tuner.c Mon Oct 4 15:49:29 1999 +++ linux/drivers/char/tuner.c Tue Nov 2 08:09:01 1999 @@ -40,6 +40,8 @@ int type; /* chip type */ int freq; /* keep track of the current settings */ int radio; + + int mode; /* PAL(0)/SECAM(1) mode (PHILIPS_SECAM only) */ }; /* ---------------------------------------------------------------------- */ @@ -58,6 +60,11 @@ unsigned char config; unsigned char I2C; unsigned short IFPCoff; + + unsigned char mode; /* mode change value (tested PHILIPS_SECAM only) */ + /* 0x01 -> ??? no change ??? */ + /* 0x02 -> PAL BDGHI / SECAM L */ + /* 0x04 -> ??? PAL others / SECAM others ??? */ }; /* @@ -73,7 +80,7 @@ {"Philips NTSC", Philips, NTSC, 16*157.25,16*451.25,0xA0,0x90,0x30,0x8e,0xc0,732}, {"Philips SECAM", Philips, SECAM, - 16*168.25,16*447.25,0xA7,0x97,0x37,0x8e,0xc0,623}, + 16*168.25,16*447.25,0xA7,0x97,0x37,0x8e,0xc0,623,0x02}, {"NoTuner", NoTuner, NOTUNER, 0 ,0 ,0x00,0x00,0x00,0x00,0x00,000}, {"Philips PAL", Philips, PAL, @@ -100,6 +107,7 @@ #define TUNER_POR 0x80 #define TUNER_FL 0x40 +#define TUNER_MODE 0x38 #define TUNER_AFC 0x07 static int tuner_islocked (struct tuner *t) @@ -112,7 +120,6 @@ return (tuner_getstatus (t) & TUNER_AFC) - 2; } - static void set_tv_freq(struct tuner *t, int freq) { u8 config; @@ -133,15 +140,43 @@ else config = tun->UHF; + if (t->type == TUNER_PHILIPS_SECAM && t->mode) + config |= tun->mode; + else + config &= ~tun->mode; + div=freq + tun->IFPCoff; div&=0x7fff; LOCK_I2C_BUS(t->bus); - if (i2c_write(t->bus, t->addr, (div>>8)&0x7f, div&0xff, 1)<0) { - printk("tuner: i2c i/o error #1\n"); + if (t->type == TUNER_PHILIPS_SECAM && freq < t->freq) { + /* + * Philips FI1216MK2 remark from specification : + * for channel selection involving band switching, and to ensure + * smooth tuning to the desired channel without causing + * unnecessary charge pump action, it is recommended to consider + * the difference between wanted channel frequency and the + * current channel frequency. Unnecessary charge pump action + * will result in very low tuning voltage which may drive the + * oscillator to extreme conditions. + */ + /* + * Progfou: specification says to send config data before + * frequency in case (wanted frequency < current frequency). + */ + if (i2c_write(t->bus, t->addr, tun->config, config, 1)) { + printk("tuner: i2c i/o error #1\n"); + } else { + if (i2c_write(t->bus, t->addr, (div>>8)&0x7f, div&0xff, 1)<0) + printk("tuner: i2c i/o error #2\n"); + } } else { - if (i2c_write(t->bus, t->addr, tun->config, config, 1)) - printk("tuner: i2c i/o error #2\n"); + if (i2c_write(t->bus, t->addr, (div>>8)&0x7f, div&0xff, 1)<0) { + printk("tuner: i2c i/o error #1\n"); + } else { + if (i2c_write(t->bus, t->addr, tun->config, config, 1)) + printk("tuner: i2c i/o error #2\n"); + } } UNLOCK_I2C_BUS(t->bus); } @@ -258,6 +293,16 @@ t->freq = *iarg; break; + case TUNER_SET_MODE: + if (t->type != TUNER_PHILIPS_SECAM) { + dprintk("tuner: trying to change mode for other than TUNER_PHILIPS_SECAM\n"); + } else { + dprintk("tuner: mode set to %d\n", *iarg); + t->mode = *iarg; + set_tv_freq(t,t->freq); + } + break; + default: return -EINVAL; } diff -u --recursive --new-file v2.3.25/linux/drivers/char/tuner.h linux/drivers/char/tuner.h --- v2.3.25/linux/drivers/char/tuner.h Mon Jun 7 16:17:59 1999 +++ linux/drivers/char/tuner.h Tue Nov 2 08:09:01 1999 @@ -47,5 +47,6 @@ #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ #define TUNER_SET_RADIOFREQ _IOW('t',3,int) /* set radio freq */ +#define TUNER_SET_MODE _IOW('t',4,int) /* set tuner mode */ #endif diff -u --recursive --new-file v2.3.25/linux/drivers/char/videodev.c linux/drivers/char/videodev.c --- v2.3.25/linux/drivers/char/videodev.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/char/videodev.c Tue Nov 2 21:35:46 1999 @@ -45,12 +45,6 @@ extern int init_bttv_cards(struct video_init *); extern int i2c_tuner_init(struct video_init *); #endif -#ifdef CONFIG_VIDEO_SAA5249 -extern int init_saa_5249(struct video_init *); -#endif -#ifdef CONFIG_VIDEO_CQCAM -extern int init_colour_qcams(struct video_init *); -#endif #ifdef CONFIG_VIDEO_BWQCAM extern int init_bw_qcams(struct video_init *); #endif @@ -65,12 +59,6 @@ #ifdef CONFIG_VIDEO_BT848 {"i2c-tuner", i2c_tuner_init}, {"bttv", init_bttv_cards}, -#endif -#ifdef CONFIG_VIDEO_SAA5249 - {"saa5249", init_saa_5249}, -#endif -#ifdef CONFIG_VIDEO_CQCAM - {"c-qcam", init_colour_qcams}, #endif #ifdef CONFIG_VIDEO_BWQCAM {"bw-qcam", init_bw_qcams}, diff -u --recursive --new-file v2.3.25/linux/drivers/fc4/Config.in linux/drivers/fc4/Config.in --- v2.3.25/linux/drivers/fc4/Config.in Mon Oct 11 15:38:14 1999 +++ linux/drivers/fc4/Config.in Wed Nov 3 14:43:54 1999 @@ -19,9 +19,9 @@ dep_tristate 'Generic FC-AL disk driver' CONFIG_SCSI_FCAL $CONFIG_SCSI fi else - define_bool CONFIG_FC4_SOC n - define_bool CONFIG_FC4_SOCAL n - define_bool CONFIG_SCSI_PLUTO n - define_bool CONFIG_SCSI_FCAL n + define_tristate CONFIG_FC4_SOC n + define_tristate CONFIG_FC4_SOCAL n + define_tristate CONFIG_SCSI_PLUTO n + define_tristate CONFIG_SCSI_FCAL n fi endmenu diff -u --recursive --new-file v2.3.25/linux/drivers/i2o/i2o_block.c linux/drivers/i2o/i2o_block.c --- v2.3.25/linux/drivers/i2o/i2o_block.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/i2o/i2o_block.c Tue Nov 2 17:07:08 1999 @@ -162,27 +162,27 @@ int count = req->nr_sectors<<9; /* Map the message to a virtual address */ - msg = bus_to_virt(c->mem_offset + m); + msg = c->mem_offset + m; /* * Build the message based on the request. */ - msg[2] = i2ob_context|(unit<<8); - msg[3] = ireq->num; - msg[5] = req->nr_sectors << 9; + __raw_writel(i2ob_context|(unit<<8), &msg[2]); + __raw_writel(ireq->num, &msg[3]); + __raw_writel(req->nr_sectors << 9, &msg[5]); /* This can be optimised later - just want to be sure its right for starters */ offset = ((u64)(req->sector+base)) << 9; - msg[6] = offset & 0xFFFFFFFF; - msg[7] = (offset>>32); + __raw_writel( offset & 0xFFFFFFFF, &msg[6]); + __raw_writel(offset>>32, &msg[7]); mptr=msg+8; if(req->cmd == READ) { - msg[1] = I2O_CMD_BLOCK_READ<<24|HOST_TID<<12|tid; + __raw_writel(I2O_CMD_BLOCK_READ<<24|HOST_TID<<12|tid, &msg[1]); /* We don't yet do cache/readahead and other magic */ - msg[4] = 1<<16; + __raw_writel(1<<16, &msg[4]); while(bh!=NULL) { /* @@ -191,31 +191,31 @@ * sucky to read. */ if(bh->b_reqnext) - *mptr++ = 0x10000000|(bh->b_size); + __raw_writel(0x10000000|(bh->b_size), mptr++); else - *mptr++ = 0xD0000000|(bh->b_size); + __raw_writel(0xD0000000|(bh->b_size), mptr++); - *mptr++ = virt_to_bus(bh->b_data); + __raw_writel(virt_to_bus(bh->b_data), mptr++); count -= bh->b_size; bh = bh->b_reqnext; } } else if(req->cmd == WRITE) { - msg[1] = I2O_CMD_BLOCK_WRITE<<24|HOST_TID<<12|tid; - msg[4] = 1<<16; + __raw_writel(I2O_CMD_BLOCK_WRITE<<24|HOST_TID<<12|tid, &msg[1]); + __raw_writel(1<<16, &msg[4]); while(bh!=NULL) { if(bh->b_reqnext) - *mptr++ = 0x14000000|(bh->b_size); + __raw_writel(0x14000000|(bh->b_size), mptr++); else - *mptr++ = 0xD4000000|(bh->b_size); + __raw_writel(0xD4000000|(bh->b_size), mptr++); count -= bh->b_size; - *mptr++ = virt_to_bus(bh->b_data); + __raw_writel(virt_to_bus(bh->b_data), mptr++); bh = bh->b_reqnext; } } - msg[0] = I2O_MESSAGE_SIZE(mptr-msg) | SGL_OFFSET_8; + __raw_writel(I2O_MESSAGE_SIZE(mptr-msg) | SGL_OFFSET_8, &msg[0]); if(req->current_nr_sectors > 8) printk("Gathered sectors %ld.\n", diff -u --recursive --new-file v2.3.25/linux/drivers/i2o/i2o_core.c linux/drivers/i2o/i2o_core.c --- v2.3.25/linux/drivers/i2o/i2o_core.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/i2o/i2o_core.c Tue Nov 2 17:07:08 1999 @@ -714,15 +714,15 @@ return -ENOMEM; } - msg[0]=NINE_WORD_MSG_SIZE|SGL_OFFSET_5; - msg[1]=I2O_CMD_UTIL_PARAMS_GET<<24|HOST_TID<<12|tid; - msg[2]=0; /* Context */ - msg[3]=0; - msg[4]=0; - msg[5]=0x54000000|12; - msg[6]=virt_to_bus(op); - msg[7]=0xD0000000|(32+buflen); - msg[8]=virt_to_bus(rbuf); + __raw_writel(NINE_WORD_MSG_SIZE|SGL_OFFSET_5, &msg[0]); + __raw_writel(I2O_CMD_UTIL_PARAMS_GET<<24|HOST_TID<<12|tid, &msg[1]); + __raw_writel(0, &msg[2]); /* Context */ + __raw_writel(0, &msg[3]); + __raw_writel(0, &msg[4]); + __raw_writel(0x54000000|12, &msg[5]); + __raw_writel(virt_to_bus(op), &msg[6]); + __raw_writel(0xD0000000|(32+buflen), &msg[7]); + __raw_writel(virt_to_bus(rbuf), &msg[8]); i2o_post_message(c,m); barrier(); @@ -738,7 +738,7 @@ kfree(rbuf); return -ETIMEDOUT; } - + msg = (u32 *)bus_to_virt(m); if(msg[4]>>24) { @@ -830,7 +830,7 @@ static int i2o_parse_hrt(struct i2o_controller *c) { #ifdef DRIVERDEBUG - u32 *rows=c->hrt; + u32 *rows=(u32*)c->hrt; u8 *p=(u8 *)c->hrt; u8 *d; int count; @@ -1391,7 +1391,12 @@ I2O_REPLY_WRITE32(iop,virt_to_phys(msg)); i2o_quiesce_controller(iop); i2o_reset_controller(iop); - i2o_status_get(iop); + if(i2o_status_get(iop) || + iop->status_block->iop_state != ADAPTER_STATE_RESET) + { + printk(KERN_CRIT "Failed to initialize iop%d\n", iop->unit); + i2o_delete_controller(iop); + } } } @@ -1413,7 +1418,8 @@ if(iop->page_frame==NULL) { - printk(KERN_ERR "IOP init failed: no memory for message page.\n"); + printk(KERN_CRIT "iop%d init failed: no memory for message page.\n", + iop->unit); i2o_delete_controller(iop); continue; } @@ -1436,23 +1442,40 @@ { if(i2o_hrt_get(iop)) { + printk(KERN_CRIT "iop%d: Could not get HRT!\n", iop->unit); i2o_delete_controller(iop); break; } if(i2o_parse_hrt(iop)) + { + printk(KERN_CRIT "iop%d: Could not parse HRT!\n", iop->unit); i2o_delete_controller(iop); + } } /* * Build and send the system table - */ - i2o_build_sys_table(); + * + * If build_sys_table fails, we kill everything and bail + * as we can't init the IOPs w/o a system table + */ + if(i2o_build_sys_table()) + { + printk(KERN_CRIT "I2O: Error building system table. Aborting!\n"); + i2o_sys_shutdown(); + return; + } + for(iop = i2o_controller_chain; iop; iop = iop->next) #ifdef DRIVERDEBUG { printk(KERN_INFO "Sending system table to iop%d\n", iop->unit); #endif - i2o_systab_send(iop); + if(i2o_systab_send(iop)) + { + printk(KERN_CRIT "iop%d: Error sending system table\n", iop->unit); + i2o_delete_controller(iop); + } #ifdef DRIVERDEBUG } #endif @@ -1503,7 +1526,10 @@ i2o_quiesce_system(); for(iop = i2o_controller_chain; iop; iop = iop->next) - i2o_delete_controller(iop); + { + if(i2o_delete_controller(iop)) + iop->bus_disable(iop); + } } /* @@ -1701,7 +1727,6 @@ msg[5] = 0x00000000; /* Report now */ msg[6] = 0xD0000000|8192; msg[7] = virt_to_bus(c->lct); - return(i2o_post_wait(c, msg, sizeof(msg), 120)); } @@ -1741,21 +1766,21 @@ privio[0]=c->priv_io; /* Private I/O address */ privio[1]=c->priv_io_size; - msg[0] = NINE_WORD_MSG_SIZE|SGL_OFFSET_6; - msg[1] = I2O_CMD_SYS_TAB_SET<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[2] = 0; /* Context not needed */ - msg[3] = 0; - msg[4] = (0<<16)|(2<<12); /* Host 1 I2O 2 */ - msg[5] = 0; /* Segment 1 */ + __raw_writel(NINE_WORD_MSG_SIZE|SGL_OFFSET_6, &msg[0]); + __raw_writel(I2O_CMD_SYS_TAB_SET<<24 | HOST_TID<<12 | ADAPTER_TID, &msg[1]); + __raw_writel(0, &msg[2]); /* Context not needed */ + __raw_writel(0, &msg[3]); + __raw_writel((0<<16)|(2<<12), &msg[4]); /* Host 1 I2O 2 */ + __raw_writel(0, &msg[5]); /* Segment 1 */ /* * Scatter Gather List */ - msg[6] = 0x54000000|sys_tbl_len; /* One table for now */ - msg[7] = virt_to_phys(sys_tbl); - msg[8] = 0xD4000000|48; /* One table for now */ - msg[9] = virt_to_phys(privmem); -/* msg[10] = virt_to_phys(privio); */ + + __raw_writel(0x54000000|sys_tbl_len, &msg[6]); /* One table for now */ + __raw_writel(virt_to_phys(sys_tbl), &msg[[7]); + __raw_writel(0xD4000000|48, &msg[8]); /* One table for now */ + __raw_writel(virt_to_phys(privmem), &msg[9]); return(i2o_post_wait(c, msg, sizeof(msg), 120)); @@ -1877,8 +1902,8 @@ c->unit); return -ETIMEDOUT; } - msg = bus_to_virt(c->mem_offset + m); - memcpy(msg, data, len); + msg = (u32 *)(c->mem_offset + m); + memcpy_toio(msg, data, len); i2o_post_message(c,m); return 0; } @@ -2028,7 +2053,7 @@ int i2o_issue_params(int cmd, struct i2o_controller *iop, int tid, void *opblk, int oplen, void *resblk, int reslen) { -u32 msg[9]; + u32 msg[9]; u8 *res = (u8 *)resblk; int res_count; int blk_size; diff -u --recursive --new-file v2.3.25/linux/drivers/i2o/i2o_pci.c linux/drivers/i2o/i2o_pci.c --- v2.3.25/linux/drivers/i2o/i2o_pci.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/i2o/i2o_pci.c Tue Nov 2 17:07:08 1999 @@ -5,11 +5,11 @@ * (C) Copyright 1999 Red Hat Software * * Written by Alan Cox, Building Number Three Ltd - * Modified by Deepak Saxena + * Modified by Deepak Saxena * * 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 + * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * TODO: @@ -80,11 +80,13 @@ static void i2o_pci_enable(struct i2o_controller *c) { I2O_IRQ_WRITE32(c, 0); + c->enabled = 1; } static void i2o_pci_disable(struct i2o_controller *c) { I2O_IRQ_WRITE32(c, 0xFFFFFFFF); + c->enabled = 0; } /* @@ -216,6 +218,7 @@ printk(KERN_INFO "Installed iop%d at IRQ%d\n", c->unit, dev->irq); I2O_IRQ_WRITE32(c,0x0); + c->enabled = 1; return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/i2o/i2o_scsi.c linux/drivers/i2o/i2o_scsi.c --- v2.3.25/linux/drivers/i2o/i2o_scsi.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/i2o/i2o_scsi.c Tue Nov 2 17:07:08 1999 @@ -587,7 +587,7 @@ m = I2O_POST_READ32(c); } while(m==0xFFFFFFFF); - msg = bus_to_virt(c->mem_offset + m); + msg = c->mem_offset + m; /* * Put together a scsi execscb message @@ -614,10 +614,10 @@ } } - msg[1] = I2O_CMD_SCSI_EXEC<<24|HOST_TID<<12|tid; - msg[2] = scsi_context; /* So the I2O layer passes to us */ + __raw_writel(I2O_CMD_SCSI_EXEC<<24|HOST_TID<<12|tid, &msg[1]); + __raw_writel(scsi_context, &msg[2]); /* So the I2O layer passes to us */ /* Sorry 64bit folks. FIXME */ - msg[3] = (u32)SCpnt; /* We want the SCSI control block back */ + __raw_writel((u32)SCpnt, &msg[3]); /* We want the SCSI control block back */ /* LSI_920_PCI_QUIRK * @@ -660,7 +660,7 @@ } /* Direction, disconnect ok, tag, CDBLen */ - msg[4] = scsidir|0x20000000|SCpnt->cmd_len|tag; + __raw_writel(scsidir|0x20000000|SCpnt->cmd_len|tag, &msg[4]); mptr=msg+5; @@ -668,11 +668,12 @@ * Write SCSI command into the message - always 16 byte block */ - memcpy(mptr, SCpnt->cmnd, 16); + memcpy_toio(mptr, SCpnt->cmnd, 16); mptr+=4; lenptr=mptr++; /* Remember me - fill in when we know */ reqlen = 12; // SINGLE SGE + /* * Now fill in the SGList and command * @@ -686,14 +687,16 @@ struct scatterlist *sg = (struct scatterlist *)SCpnt->request_buffer; int chain = 0; + len = 0; + if((sg_max_frags > 11) && (SCpnt->use_sg > 11)) { chain = 1; /* * Need to chain! */ - *mptr++=direction|0xB0000000|(SCpnt->use_sg*2*4); - *mptr=virt_to_bus(sg_chain_pool + sg_chain_tag); + __raw_writel(direction|0xB0000000|(SCpnt->use_sg*2*4), mptr++); + __raw_writel(virt_to_bus(sg_chain_pool + sg_chain_tag), mptr); mptr = (u32*)(sg_chain_pool + sg_chain_tag); if (SCpnt->use_sg > max_sg_len) { @@ -703,27 +706,36 @@ } if ( ++sg_chain_tag == SG_MAX_BUFS ) sg_chain_tag = 0; + for(i = 0 ; i < SCpnt->use_sg; i++) + { + *mptr++=direction|0x10000000|sg->length; + len+=sg->length; + *mptr++=virt_to_bus(sg->address); + sg++; + } + mptr[-2]=direction|0xD0000000|(sg-1)->length; } - - len = 0; - - for(i = 0 ; i < SCpnt->use_sg; i++) - { - *mptr++=direction|0x10000000|sg->length; - len+=sg->length; - *mptr++=virt_to_bus(sg->address); - sg++; - } + else + { + for(i = 0 ; i < SCpnt->use_sg; i++) + { + __raw_writel(direction|0x10000000|sg->length, mptr++); + len+=sg->length; + __raw_writel(virt_to_bus(sg->address), mptr++); + sg++; + } - /* Make this an end of list. Again evade the 920 bug and - unwanted PCI read traffic */ + /* Make this an end of list. Again evade the 920 bug and + unwanted PCI read traffic */ - mptr[-2]=direction|0xD0000000|(sg-1)->length; + __raw_writel(direction|0xD0000000|(sg-1)->length, &mptr[-2]); + } if(!chain) reqlen = mptr - msg; - *lenptr=len; + __raw_writel(len, lenptr); + if(len != SCpnt->underflow) printk("Cmd len %08X Cmd underflow %08X\n", len, SCpnt->underflow); @@ -732,15 +744,15 @@ { dprintk(("non sg for %p, %d\n", SCpnt->request_buffer, SCpnt->request_bufflen)); - *lenptr = len = SCpnt->request_bufflen; + __raw_writel(len = SCpnt->request_bufflen, lenptr); if(len == 0) { reqlen = 9; } else { - *mptr++=0xD0000000|direction|SCpnt->request_bufflen; - *mptr++=virt_to_bus(SCpnt->request_buffer); + __raw_writel(0xD0000000|direction|SCpnt->request_bufflen, mptr++); + __raw_writel(virt_to_bus(SCpnt->request_buffer), mptr++); } } @@ -748,7 +760,7 @@ * Stick the headers on */ - msg[0] = reqlen<<16 | SGL_OFFSET_10; + __raw_writel(reqlen<<16 | SGL_OFFSET_10, msg); /* Queue the message */ i2o_post_message(c,m); @@ -815,11 +827,11 @@ while(m==0xFFFFFFFF); msg = bus_to_virt(c->mem_offset + m); - msg[0] = FIVE_WORD_MSG_SIZE; - msg[1] = I2O_CMD_SCSI_ABORT<<24|HOST_TID<<12|tid; - msg[2] = scsi_context; - msg[3] = 0; /* Not needed for an abort */ - msg[4] = (u32)SCpnt; + __raw_writel(FIVE_WORD_MSG_SIZE, &msg[0]); + __raw_writel(I2O_CMD_SCSI_ABORT<<24|HOST_TID<<12|tid, &msg[1]); + __raw_writel(scsi_context, &msg[2]); + __raw_writel(0, &msg[3]); /* Not needed for an abort */ + __raw_writel((u32)SCpnt, &msg[4]); wmb(); i2o_post_message(c,m); wmb(); @@ -862,12 +874,12 @@ return SCSI_RESET_PUNT; msg = bus_to_virt(c->mem_offset + m); - msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1] = I2O_CMD_SCSI_BUSRESET<<24|HOST_TID<<12|tid; - msg[2] = scsi_context|0x80000000; + __raw_writel(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0, &msg[0]); + __raw_writel(I2O_CMD_SCSI_BUSRESET<<24|HOST_TID<<12|tid, &msg[1]); + __raw_writel(scsi_context|0x80000000, &msg[2]); /* We use the top bit to split controller and unit transactions */ /* Now store unit,tid so we can tie the completion back to a specific device */ - msg[3] = c->unit << 16 | tid; + __raw_writel(c->unit << 16 | tid, &msg[3]); i2o_post_message(c,m); return SCSI_RESET_PENDING; } diff -u --recursive --new-file v2.3.25/linux/drivers/net/arcnet.c linux/drivers/net/arcnet.c --- v2.3.25/linux/drivers/net/arcnet.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/arcnet.c Fri Nov 5 10:01:50 1999 @@ -61,7 +61,7 @@ - Added support for promiscuous mode. v2.60 ALPHA (96/11/23) - - Added patch from Vojtech Pavlik + - Added patch from Vojtech Pavlik and Martin Mares to make the driver work with the new Linux 2.1.x memory management. I modified their patch quite a bit though; bugs are my fault. More changes should @@ -89,7 +89,7 @@ v2.50 (96/02/24) - Massively improved autoprobe routines; they now work even as a - module. Thanks to Vojtech Pavlik + module. Thanks to Vojtech Pavlik for his ideas and help in this area. - Changed printk's around quite a lot. diff -u --recursive --new-file v2.3.25/linux/drivers/net/com90xx.c linux/drivers/net/com90xx.c --- v2.3.25/linux/drivers/net/com90xx.c Wed Aug 18 11:36:41 1999 +++ linux/drivers/net/com90xx.c Wed Nov 3 10:13:44 1999 @@ -93,7 +93,7 @@ #endif int arc90xx_probe(struct net_device *dev); static void arc90xx_rx(struct net_device *dev, int recbuf); -static int arc90xx_found(struct net_device *dev, int ioaddr, int airq, u_long shmem, int more); +static int arc90xx_found(struct net_device *dev, int ioaddr, int airq, void * shmem, int more); static void arc90xx_inthandler(struct net_device *dev); static int arc90xx_reset(struct net_device *dev, int reset_delay); static void arc90xx_setmask(struct net_device *dev, u_char mask); @@ -175,7 +175,7 @@ static int ports[(0x3f0 - 0x200) / 16 + 1] __initdata = { 0 }; -static u_long shmems[(0xFF800 - 0xA0000) / 2048 + 1] __initdata = { +static void * shmems[(0xFF800 - 0xA0000) / 2048 + 1] __initdata = { 0 }; @@ -187,13 +187,13 @@ openparen = 0; unsigned long airqmask; int *port; - u_long *shmem; + void **shmem; if (!init_once) { for (count = 0x200; count <= 0x3f0; count += 16) ports[(count - 0x200) / 16] = count; for (count = 0xA0000; count <= 0xFF800; count += 2048) - shmems[(count - 0xA0000) / 2048] = count; + shmems[(count - 0xA0000) / 2048] = ioremap(count, 2048); BUGLVL(D_NORMAL) printk(version); BUGMSG(D_DURING, "space used for probe buffers: %d+%d=%d bytes\n", sizeof(ports), sizeof(shmems), @@ -211,7 +211,7 @@ return -ENXIO; if (dev->mem_start) { - shmems[0] = dev->mem_start; + shmems[0] = ioremap(dev->mem_start, 2048); numshmems = 1; } /* Stage 1: abandon any reserved ports, or ones with status==0xFF @@ -284,7 +284,7 @@ BUGMSG(D_INIT, "Stage 3: "); numprint = 0; for (shmem = &shmems[0]; shmem - shmems < numshmems; shmem++) { - u_long ptr; + void * ptr; numprint++; if (numprint > 8) { @@ -292,9 +292,9 @@ BUGMSG(D_INIT, "Stage 3: "); numprint = 1; } - BUGMSG2(D_INIT, "%lXh ", *shmem); + BUGMSG2(D_INIT, "%ph ", *shmem); - ptr = (u_long) (*shmem); + ptr = *shmem; if (readb(ptr) != TESTvalue) { BUGMSG2(D_INIT_REASONS, "(mem=%02Xh, not %02Xh)\n", @@ -342,7 +342,7 @@ BUGMSG(D_INIT, "Stage 4: "); numprint = 1; } - BUGMSG2(D_INIT, "%lXh ", *shmem); + BUGMSG2(D_INIT, "%ph ", *shmem); } BUGMSG2(D_INIT, "\n"); @@ -439,12 +439,12 @@ #endif for (shmem = &shmems[0]; shmem - shmems < numshmems; shmem++) { - u_long ptr; - ptr = (u_long) (*shmem); + void * ptr; + ptr = *shmem; if (readb(ptr) == TESTvalue) { /* found one */ int probe_more; - BUGMSG2(D_INIT, "%lXh)\n", *shmem); + BUGMSG2(D_INIT, "%ph)\n", *shmem); openparen = 0; /* register the card */ @@ -493,10 +493,10 @@ /* Set up the struct net_device associated with this card. Called after * probing succeeds. */ -static int __init arc90xx_found(struct net_device *dev, int ioaddr, int airq, u_long shmem, int more) +static int __init arc90xx_found(struct net_device *dev, int ioaddr, int airq, void * shmem, int more) { struct arcnet_local *lp; - u_long first_mirror, last_mirror; + void *first_mirror, *last_mirror; int mirror_size; /* reserve the irq */ @@ -533,8 +533,8 @@ last_mirror += mirror_size; last_mirror -= mirror_size; - dev->mem_start = first_mirror; - dev->mem_end = last_mirror + MIRROR_SIZE - 1; + dev->mem_start = (unsigned long) first_mirror; + dev->mem_end = (unsigned long) last_mirror + MIRROR_SIZE - 1; dev->rmem_start = dev->mem_start + BUFFER_SIZE * 0; dev->rmem_end = dev->mem_start + BUFFER_SIZE * 2 - 1; diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/Config.in linux/drivers/net/irda/Config.in --- v2.3.25/linux/drivers/net/irda/Config.in Mon Oct 4 15:49:29 1999 +++ linux/drivers/net/irda/Config.in Tue Nov 2 17:07:08 1999 @@ -8,7 +8,6 @@ comment 'FIR device drivers' dep_tristate 'NSC PC87108' CONFIG_NSC_FIR $CONFIG_IRDA dep_tristate 'Winbond W83977AF (IR)' CONFIG_WINBOND_FIR $CONFIG_IRDA -dep_tristate 'Sharp UIRCC' CONFIG_SHARP_FIR $CONFIG_IRDA dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA dep_tristate 'SMC IrCC' CONFIG_SMC_IRCC_FIR $CONFIG_IRDA diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/Makefile linux/drivers/net/irda/Makefile --- v2.3.25/linux/drivers/net/irda/Makefile Tue Aug 31 17:29:14 1999 +++ linux/drivers/net/irda/Makefile Tue Nov 2 17:07:08 1999 @@ -60,14 +60,6 @@ endif endif -ifeq ($(CONFIG_SHARP_FIR),y) -L_OBJS += uircc.o irport.o -else - ifeq ($(CONFIG_SHARP_FIR),m) - M_OBJS += uircc.o irport.o - endif -endif - ifeq ($(CONFIG_TOSHIBA_FIR),y) L_OBJS += toshoboe.o else diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/airport.c linux/drivers/net/irda/airport.c --- v2.3.25/linux/drivers/net/irda/airport.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/airport.c Tue Nov 2 17:07:08 1999 @@ -7,8 +7,7 @@ * Status: Experimental. * Author: Fons Botman * Created at: Wed May 19 23:14:34 CEST 1999 - * Based on: actisys.c - * By: Dag Brattli + * Based on: actisys.c by Dag Brattli * * Copyright (c) 1998-1999 Fons Botman, All Rights Reserved. * @@ -32,26 +31,21 @@ #include #include #include -#include - -static void airport_reset(struct irda_device *dev); -static void airport_open(struct irda_device *idev, int type); -static void airport_close(struct irda_device *dev); -static void airport_change_speed( struct irda_device *dev, __u32 speed); -static void airport_init_qos(struct irda_device *idev, struct qos_info *qos); - - -static struct dongle dongle = { - AIRPORT_DONGLE, +static int airport_reset_wrapper(struct irda_task *task); +static void airport_open(dongle_t *self, struct qos_info *qos); +static void airport_close(dongle_t *self); +static int airport_change_speed_wrapper(struct irda_task *task); + +static struct dongle_reg dongle = { + Q_NULL, + IRDA_AIRPORT_DONGLE, airport_open, airport_close, - airport_reset, - airport_change_speed, - airport_init_qos, + airport_reset_wrapper, + airport_change_speed_wrapper, }; - int __init airport_init(void) { int ret; @@ -69,57 +63,54 @@ irda_device_unregister_dongle(&dongle); } -static void airport_open(struct irda_device *idev, int type) +static void airport_open(dongle_t *self, struct qos_info *qos) { - IRDA_DEBUG(2, __FUNCTION__ "(,%d)\n", type); - if (strlen(idev->description) < sizeof(idev->description) - 13) - strcat(idev->description, " <-> airport"); - else - IRDA_DEBUG(0, __FUNCTION__ " description too long: %s\n", - idev->description); - - idev->io.dongle_id = type; - idev->flags |= IFF_DONGLE; + qos->baud_rate.bits &= + IR_2400|IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; + /* May need 1ms */ + qos->min_turn_time.bits &= 0x07; MOD_INC_USE_COUNT; } -static void airport_close(struct irda_device *idev) +static void airport_close(dongle_t *self) { IRDA_DEBUG(2, __FUNCTION__ "()\n"); /* Power off dongle */ - irda_device_set_dtr_rts(idev, FALSE, FALSE); + self->set_dtr_rts(self->dev, FALSE, FALSE); MOD_DEC_USE_COUNT; } -static void airport_set_command_mode(struct irda_device *idev) +static void airport_set_command_mode(dongle_t *self) { IRDA_DEBUG(2, __FUNCTION__ "()\n"); - irda_device_set_dtr_rts(idev, FALSE, TRUE); + self->set_dtr_rts(self->dev, FALSE, TRUE); } -static void airport_set_normal_mode(struct irda_device *idev) +static void airport_set_normal_mode(dongle_t *self) { IRDA_DEBUG(2, __FUNCTION__ "()\n"); - irda_device_set_dtr_rts(idev, TRUE, TRUE); + self->set_dtr_rts(self->dev, TRUE, TRUE); } - -void airport_write_char(struct irda_device *idev, unsigned char c) +void airport_write_char(dongle_t *self, unsigned char c) { int actual; IRDA_DEBUG(2, __FUNCTION__ "(,0x%x)\n", c & 0xff); - actual = idev->raw_write(idev, &c, 1); + actual = self->write(self->dev, &c, 1); ASSERT(actual == 1, return;); } #define JIFFIES_TO_MSECS(j) ((j)*1000/HZ) -static int airport_waitfor_char(struct irda_device *idev, unsigned char c) +static int airport_waitfor_char(dongle_t *self, unsigned char c) { + __u8 buf[100]; int i, found = FALSE; int before; + int len; + IRDA_DEBUG(2, __FUNCTION__ "(,0x%x)\n", c); /* Sleep approx. 10 ms */ @@ -129,17 +120,18 @@ IRDA_DEBUG(4, __FUNCTION__ " waited %ldms\n", JIFFIES_TO_MSECS(jiffies - before)); - for ( i = 0 ; !found && i < idev->rx_buff.len ; i++ ) { + len = self->read(self->dev, buf, 100); + + for (i = 0; !found && i < len; i++ ) { /* IRDA_DEBUG(6, __FUNCTION__ " 0x02x\n", idev->rx_buff.data[i]); */ - found = c == idev->rx_buff.data[i]; + found = c == buf[i]; } - idev->rx_buff.len = 0; IRDA_DEBUG(2, __FUNCTION__ " returns %s\n", (found ? "true" : "false")); return found; } -static int airport_check_command_mode(struct irda_device *idev) +static int airport_check_command_mode(dongle_t *self) { int i; int found = FALSE; @@ -147,13 +139,13 @@ IRDA_DEBUG(2, __FUNCTION__ "()\n"); current->state = TASK_INTERRUPTIBLE; schedule_timeout(MSECS_TO_JIFFIES(20)); - airport_set_command_mode(idev); + airport_set_command_mode(self); /* Loop until the time expires (200ms) or we get the magic char. */ for ( i = 0 ; i < 25 ; i++ ) { - airport_write_char(idev, 0xff); - if (airport_waitfor_char(idev, 0xc3)) { + airport_write_char(self, 0xff); + if (airport_waitfor_char(self, 0xc3)) { found = TRUE; break; } @@ -167,29 +159,28 @@ return found; } - -static int airport_write_register(struct irda_device *idev, unsigned char reg) +static int airport_write_register(dongle_t *self, unsigned char reg) { int ok = FALSE; int i; IRDA_DEBUG(4, __FUNCTION__ "(,0x%x)\n", reg); - airport_check_command_mode(idev); + airport_check_command_mode(self); for ( i = 0 ; i < 6 ; i++ ) { - airport_write_char(idev, reg); - if (!airport_waitfor_char(idev, reg)) + airport_write_char(self, reg); + if (!airport_waitfor_char(self, reg)) continue; /* Now read it back */ - airport_write_char(idev, (reg << 4) | 0x0f); - if (airport_waitfor_char(idev, reg)) { + airport_write_char(self, (reg << 4) | 0x0f); + if (airport_waitfor_char(self, reg)) { ok = TRUE; break; } } - airport_set_normal_mode(idev); + airport_set_normal_mode(self); if (ok) { IRDA_DEBUG(4, __FUNCTION__ "(,0x%x) returns OK\n", reg); } else { @@ -200,19 +191,18 @@ /* - * Function airport_change_speed (tty, baud) + * Function airport_change_speed (self, speed) * * Change speed of the Airport type IrDA dongles. */ -static void airport_change_speed(struct irda_device *idev, __u32 speed) +static void airport_change_speed(dongle_t *self, __u32 speed) { __u32 current_baudrate; int baudcode; IRDA_DEBUG(4, __FUNCTION__ "(,%d)\n", speed); - ASSERT(idev != NULL, return;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); + ASSERT(self != NULL, return;); /* Find the correct baudrate code for the required baudrate */ switch (speed) { @@ -228,23 +218,14 @@ return; } - current_baudrate = idev->qos.baud_rate.value; + current_baudrate = self->speed; IRDA_DEBUG(4, __FUNCTION__ " current baudrate: %d\n", current_baudrate); - /* The dongle falls back to 9600 baud */ - if (current_baudrate != 9600) { - IRDA_DEBUG(4, __FUNCTION__ " resetting speed to 9600 baud\n"); - ASSERT(idev->change_speed , return;); - idev->change_speed(idev, 9600); - idev->qos.baud_rate.value = 9600; - } - - if (idev->set_raw_mode) - idev->set_raw_mode(idev, TRUE); + self->set_mode(self->dev, IRDA_RAW); /* Set the new speed in both registers */ - if (airport_write_register(idev, baudcode)) { - if (airport_write_register(idev, baudcode|0x01)) { + if (airport_write_register(self, baudcode)) { + if (airport_write_register(self, baudcode|0x01)) { /* ok */ } else { IRDA_DEBUG(0, __FUNCTION__ @@ -255,35 +236,43 @@ " Cannot set new speed in first register\n"); } - if (idev->set_raw_mode) - idev->set_raw_mode(idev, FALSE); + self->set_mode(self->dev, IRDA_IRLAP); /* How do I signal an error in these functions? */ IRDA_DEBUG(4, __FUNCTION__ " returning\n"); } +int airport_change_speed_wrapper(struct irda_task *task) +{ + dongle_t *self = (dongle_t *) task->instance; + __u32 speed = (__u32) task->param; + + irda_execute_as_process(self, (TODO_CALLBACK) airport_change_speed, + speed); + + irda_task_next_state(task, IRDA_TASK_DONE); + + return 0; +} /* - * Function airport_reset (idev) + * Function airport_reset (self) * * Reset the Airport type dongle. Warning, this function must only be * called with a process context! * */ -static void airport_reset(struct irda_device *idev) +static void airport_reset(dongle_t *self) { int ok; IRDA_DEBUG(2, __FUNCTION__ "()\n"); - ASSERT(idev != NULL, return;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); - ASSERT(idev->set_raw_mode /* The airport needs this */, return;); + ASSERT(self != NULL, return;); - if (idev->set_raw_mode) - idev->set_raw_mode(idev, TRUE); + self->set_mode(self->dev, IRDA_RAW); - airport_set_normal_mode(idev); + airport_set_normal_mode(self); /* Sleep 2000 ms */ IRDA_DEBUG(2, __FUNCTION__ " waiting for powerup\n"); @@ -295,53 +284,48 @@ ok = TRUE; if (ok) - ok = airport_write_register(idev, 0x30); + ok = airport_write_register(self, 0x30); if (!ok) MESSAGE(__FUNCTION__ "() dongle not connected?\n"); if (ok) - ok = airport_write_register(idev, 0x31); + ok = airport_write_register(self, 0x31); if (ok) - ok = airport_write_register(idev, 0x02); + ok = airport_write_register(self, 0x02); if (ok) - ok = airport_write_register(idev, 0x03); + ok = airport_write_register(self, 0x03); if (ok) { - ok = airport_check_command_mode(idev); + ok = airport_check_command_mode(self); if (ok) { - airport_write_char(idev, 0x04); - ok = airport_waitfor_char(idev, 0x04); + airport_write_char(self, 0x04); + ok = airport_waitfor_char(self, 0x04); } - airport_set_normal_mode(idev); + airport_set_normal_mode(self); } - if (idev->set_raw_mode) - idev->set_raw_mode(idev, FALSE); + self->set_mode(self->dev, IRDA_IRLAP); - current->state = TASK_INTERRUPTIBLE; schedule_timeout(MSECS_TO_JIFFIES(20)); IRDA_DEBUG(4, __FUNCTION__ " waited 20ms\n"); - idev->qos.baud_rate.value = 9600; + self->speed = 9600; if (!ok) MESSAGE(__FUNCTION__ "() failed.\n"); IRDA_DEBUG(2, __FUNCTION__ " returning.\n"); } -/* - * Function airport_init_qos (qos) - * - * Initialize QoS capabilities - * - */ -static void airport_init_qos(struct irda_device *idev, struct qos_info *qos) +int airport_reset_wrapper(struct irda_task *task) { - qos->baud_rate.bits &= - IR_2400|IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; - /* May need 1ms */ - qos->min_turn_time.bits &= 0x07; + dongle_t *self = (dongle_t *) task->instance; + + irda_execute_as_process(self, (TODO_CALLBACK) airport_reset, 0); + + irda_task_next_state(task, IRDA_TASK_DONE); + + return 0; } #ifdef MODULE diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/girbil.c linux/drivers/net/irda/girbil.c --- v2.3.25/linux/drivers/net/irda/girbil.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/girbil.c Tue Nov 2 17:07:08 1999 @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: girbil.c - * Version: 1.1 + * Version: 1.2 * Description: Implementation for the Greenwich GIrBIL dongle * Status: Experimental. * Author: Dag Brattli * Created at: Sat Feb 6 21:02:33 1999 - * Modified at: Mon Oct 18 22:15:20 1999 + * Modified at: Sat Oct 30 20:25:22 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -103,8 +103,7 @@ /* * Function girbil_change_speed (dev, speed) * - * Set the speed for the Girbil type dongle. Warning, this - * function must be called with a process context! + * Set the speed for the Girbil type dongle. * */ static int girbil_change_speed(struct irda_task *task) @@ -186,8 +185,7 @@ /* * Function girbil_reset (driver) * - * This function resets the girbil dongle. Warning, this function - * must be called with a process context!! + * This function resets the girbil dongle. * * Algorithm: * 0. set RTS, and wait at least 5 ms diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/irport.c linux/drivers/net/irda/irport.c --- v2.3.25/linux/drivers/net/irda/irport.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/irport.c Tue Nov 2 17:07:08 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Aug 3 13:49:59 1997 - * Modified at: Wed Oct 20 00:07:42 1999 + * Modified at: Sat Oct 30 20:03:42 1999 * Modified by: Dag Brattli * Sources: serial.c by Linus Torvalds * @@ -83,9 +83,12 @@ static int irport_net_init(struct net_device *dev); static int irport_net_open(struct net_device *dev); static int irport_net_close(struct net_device *dev); +static int irport_net_ioctl(struct net_device *dev, struct ifreq *rq, + int cmd); static int irport_is_receiving(struct irport_cb *self); -static void irport_set_dtr_rts(struct net_device *dev, int dtr, int rts); +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); int __init irport_init(void) { @@ -207,8 +210,6 @@ ERROR(__FUNCTION__ "(), dev_alloc() failed!\n"); return -ENOMEM; } - /* dev_alloc doesn't clear the struct, so lets do a little hack */ - memset(((__u8*)dev)+sizeof(char*),0,sizeof(struct net_device)-sizeof(char*)); dev->priv = (void *) self; self->netdev = dev; @@ -218,6 +219,8 @@ dev->hard_start_xmit = irport_hard_xmit; dev->open = irport_net_open; dev->stop = irport_net_close; + dev->get_stats = irport_net_get_stats; + dev->do_ioctl = irport_net_ioctl; /* Make ifconfig display some details */ dev->base_addr = iobase; @@ -253,7 +256,7 @@ /* Release the IO-port that this driver is using */ IRDA_DEBUG(0 , __FUNCTION__ "(), Releasing Region %03x\n", - self->io.iobase2); + self->io.iobase2); release_region(self->io.iobase2, self->io.io_ext); if (self->tx_buff.head) @@ -319,7 +322,7 @@ * Set speed of IrDA port to specified baudrate * */ -void irport_change_speed(struct irport_cb *self, __u32 speed) +void __irport_change_speed(struct irport_cb *self, __u32 speed) { unsigned long flags; int iobase; @@ -371,6 +374,79 @@ } /* + * Function irport_change_speed (instance, state, param) + * + * 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) +{ + struct irport_cb *self; + __u32 speed = (__u32) task->param; + int ret = 0; + + IRDA_DEBUG(2, __FUNCTION__ "(), <%ld>\n", jiffies); + + self = (struct irport_cb *) task->instance; + + ASSERT(self != NULL, return -1;); + + switch (task->state) { + case IRDA_TASK_INIT: + case IRDA_TASK_WAIT: + /* Are we ready to change speed yet? */ + if (self->tx_buff.len > 0) { + task->state = IRDA_TASK_WAIT; + + /* Try again later */ + ret = MSECS_TO_JIFFIES(20); + break; + } + + if (self->dongle) + irda_task_next_state(task, IRDA_TASK_CHILD_INIT); + else + irda_task_next_state(task, IRDA_TASK_CHILD_DONE); + break; + case IRDA_TASK_CHILD_INIT: + /* Go to default speed */ + __irport_change_speed(self, 9600); + + /* Change speed of dongle */ + if (irda_task_execute(self->dongle, + self->dongle->issue->change_speed, + NULL, task, (void *) speed)) + { + /* Dongle need more time to change its speed */ + irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); + + /* Give dongle 1 sec to finish */ + ret = MSECS_TO_JIFFIES(1000); + } else + /* Child finished immediately */ + irda_task_next_state(task, IRDA_TASK_CHILD_DONE); + break; + case IRDA_TASK_CHILD_WAIT: + WARNING(__FUNCTION__ + "(), changing speed of dongle timed out!\n"); + ret = -1; + break; + case IRDA_TASK_CHILD_DONE: + /* Finally we are ready to change the speed */ + __irport_change_speed(self, speed); + + irda_task_next_state(task, IRDA_TASK_DONE); + break; + default: + ERROR(__FUNCTION__ "(), unknown state %d\n", task->state); + irda_task_next_state(task, IRDA_TASK_DONE); + ret = -1; + break; + } + return ret; +} + +/* * Function irport_write_wakeup (tty) * * Called by the driver when there's room for more data. If we have @@ -452,6 +528,32 @@ } /* + * Function irport_change_speed_complete (task) + * + * Called when the change speed operation completes + * + */ +static int irport_change_speed_complete(struct irda_task *task) +{ + struct irport_cb *self; + + IRDA_DEBUG(0, __FUNCTION__ "()\n"); + + self = (struct irport_cb *) task->instance; + + ASSERT(self != NULL, return -1;); + ASSERT(self->netdev != NULL, return -1;); + + /* Finished changing speed, so we are not busy any longer */ + self->netdev->tbusy = 0; + + /* Signal network layer so it can try to send the frame */ + mark_bh(NET_BH); + + return 0; +} + +/* * Function irport_xmit (void) * * Transmits the current frame until FIFO is full, then @@ -469,7 +571,6 @@ ASSERT(dev != NULL, return 0;); self = (struct irport_cb *) dev->priv; - ASSERT(self != NULL, return 0;); iobase = self->io.iobase2; @@ -482,15 +583,22 @@ WARNING("%s: transmit timed out\n", dev->name); irport_start(self, iobase); - irport_change_speed(self, self->io.speed ); + __irport_change_speed(self, self->io.speed ); dev->trans_start = jiffies; } /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) - irport_change_speed(self, 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; + } spin_lock_irqsave(&self->lock, flags); /* Init tx buffer */ @@ -533,7 +641,7 @@ * async_unwrap_char will deliver all found frames */ do { - async_unwrap_char(self->netdev, &self->rx_buff, + async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, inb(iobase+UART_RX)); /* Make sure we don't stay here to long */ @@ -619,8 +727,8 @@ /* * Function irport_net_open (dev) * - * - * + * Network device is taken up. Usually this is done by "ifconfig irda0 up" + * */ static int irport_net_open(struct net_device *dev) { @@ -659,8 +767,8 @@ /* * Function irport_net_close (self) * - * - * + * Network device is taken down. Usually this is done by + * "ifconfig irda0 down" */ static int irport_net_close(struct net_device *dev) { @@ -733,12 +841,12 @@ * This function can be used by dongles etc. to set or reset the status * of the dtr and rts lines */ -static void irport_set_dtr_rts(struct net_device *dev, int dtr, int rts) +static int irport_set_dtr_rts(struct net_device *dev, int dtr, int rts) { struct irport_cb *self = dev->priv; int iobase; - ASSERT(self != NULL, return;); + ASSERT(self != NULL, return -1;); iobase = self->io.iobase2; @@ -748,6 +856,8 @@ rts = UART_MCR_RTS; outb(dtr|rts|UART_MCR_OUT2, iobase+UART_MCR); + + return 0; } static int irport_raw_write(struct net_device *dev, __u8 *buf, int len) @@ -774,6 +884,82 @@ } return actual; +} + +/* + * Function irport_net_ioctl (dev, rq, cmd) + * + * Process IOCTL commands for this device + * + */ +static int irport_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ + struct if_irda_req *irq = (struct if_irda_req *) rq; + struct irport_cb *self; + dongle_t *dongle; + unsigned long flags; + int ret = 0; + + ASSERT(dev != NULL, return -1;); + + self = dev->priv; + + ASSERT(self != NULL, return -1;); + + IRDA_DEBUG(2, __FUNCTION__ "(), %s, (cmd=0x%X)\n", dev->name, cmd); + + /* Disable interrupts & save flags */ + save_flags(flags); + cli(); + + switch (cmd) { + case SIOCSBANDWIDTH: /* Set bandwidth */ + irda_task_execute(self, irport_change_speed, NULL, NULL, + (void *) irq->ifr_baudrate); + break; + case SIOCSDONGLE: /* Set dongle */ + /* Initialize dongle */ + dongle = irda_device_dongle_init(dev, irq->ifr_dongle); + if (!dongle) + break; + + dongle->set_mode = NULL; + dongle->read = NULL; + dongle->write = irport_raw_write; + dongle->set_dtr_rts = irport_set_dtr_rts; + + self->dongle = dongle; + + /* Now initialize the dongle! */ + dongle->issue->open(dongle, &self->qos); + + /* Reset dongle */ + irda_task_execute(dongle, dongle->issue->reset, NULL, NULL, + NULL); + break; + case SIOCSMEDIABUSY: /* Set media busy */ + irda_device_set_media_busy(self->netdev, TRUE); + break; + case SIOCGRECEIVING: /* Check if we are receiving right now */ + irq->ifr_receiving = irport_is_receiving(self); + break; + case SIOCSDTRRTS: + irport_set_dtr_rts(dev, irq->ifr_dtr, irq->ifr_rts); + break; + default: + ret = -EOPNOTSUPP; + } + + restore_flags(flags); + + return ret; +} + +static struct net_device_stats *irport_net_get_stats(struct net_device *dev) +{ + struct irport_cb *self = (struct irport_cb *) dev->priv; + + return &self->stats; } #ifdef MODULE diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/irtty.c linux/drivers/net/irda/irtty.c --- v2.3.25/linux/drivers/net/irda/irtty.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/irtty.c Tue Nov 2 17:07:08 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Dec 9 21:18:38 1997 - * Modified at: Wed Oct 20 00:05:43 1999 + * Modified at: Sun Oct 31 22:24:03 1999 * Modified by: Dag Brattli * Sources: slip.c by Laurence Culhane, * Fred N. van Kempen, @@ -345,8 +345,6 @@ struct termios old_termios; int cflag; - IRDA_DEBUG(0, __FUNCTION__ "(), <%ld>\n", jiffies); - ASSERT(self != NULL, return;); ASSERT(self->magic == IRTTY_MAGIC, return;); @@ -355,7 +353,7 @@ cflag &= ~CBAUD; - IRDA_DEBUG(0, __FUNCTION__ "(), Setting speed to %d\n", speed); + IRDA_DEBUG(2, __FUNCTION__ "(), Setting speed to %d\n", speed); switch (speed) { case 1200: @@ -562,7 +560,8 @@ switch (self->mode) { case IRDA_IRLAP: /* Unwrap and destuff one byte */ - async_unwrap_char(self->netdev, &self->rx_buff, *cp++); + async_unwrap_char(self->netdev, &self->stats, + &self->rx_buff, *cp++); break; case IRDA_RAW: /* What should we do when the buffer is full? */ @@ -587,7 +586,7 @@ { struct irtty_cb *self; - IRDA_DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); self = (struct irtty_cb *) task->instance; diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/litelink.c linux/drivers/net/irda/litelink.c --- v2.3.25/linux/drivers/net/irda/litelink.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/litelink.c Tue Nov 2 17:07:08 1999 @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: litelink.c - * Version: 1.0 + * Version: 1.1 * Description: Driver for the Parallax LiteLink dongle * Status: Stable * Author: Dag Brattli * Created at: Fri May 7 12:50:33 1999 - * Modified at: Mon Oct 18 12:45:51 1999 + * Modified at: Sat Oct 30 20:24:58 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -122,7 +122,6 @@ /* Sleep a minimum of 15 us */ udelay(MIN_DELAY); } - irda_task_next_state(task, IRDA_TASK_DONE); return 0; @@ -131,8 +130,7 @@ /* * Function litelink_reset (task) * - * Reset the Litelink type dongle. Warning, this function must only be - * called with a process context! + * Reset the Litelink type dongle. * */ static int litelink_reset(struct irda_task *task) @@ -159,6 +157,8 @@ /* This dongles speed defaults to 115200 bps */ self->speed = 115200; + + irda_task_next_state(task, IRDA_TASK_DONE); return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/pc87108.c linux/drivers/net/irda/pc87108.c --- v2.3.25/linux/drivers/net/irda/pc87108.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/pc87108.c Tue Nov 2 17:07:08 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sat Nov 7 21:43:15 1998 - * Modified at: Wed Oct 20 00:08:41 1999 + * Modified at: Sat Oct 30 16:24:17 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli @@ -1143,7 +1143,8 @@ /* Receive all characters in Rx FIFO */ do { byte = inb(iobase+RXD); - async_unwrap_char(self->netdev, &self->rx_buff, byte); + async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, + byte); } while (inb(iobase+LSR) & LSR_RXDA); /* Data available */ } diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/smc-ircc.c linux/drivers/net/irda/smc-ircc.c --- v2.3.25/linux/drivers/net/irda/smc-ircc.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/smc-ircc.c Tue Nov 2 17:07:08 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Thomas Davis (tadavis@jps.net) * Created at: - * Modified at: Wed Sep 22 07:47:19 1999 + * Modified at: Sat Oct 30 14:18:23 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Thomas Davis, All Rights Reserved. @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -58,23 +59,23 @@ static struct ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL}; /* Some prototypes */ -static int ircc_open( int i, unsigned int iobase, unsigned int board_addr); +static int ircc_open(int i, unsigned int iobase, unsigned int board_addr); #ifdef MODULE -static int ircc_close( struct irda_device *idev); +static int ircc_close(struct ircc_cb *self); #endif /* MODULE */ -static int ircc_probe( int iobase, int board_addr); -static int ircc_dma_receive( struct irda_device *idev); -static int ircc_dma_receive_complete(struct irda_device *idev, int iobase); -static int ircc_hard_xmit( struct sk_buff *skb, struct net_device *dev); -static void ircc_dma_write( struct irda_device *idev, int iobase); -static void ircc_change_speed( struct irda_device *idev, __u32 speed); +static int ircc_probe(int iobase, int board_addr); +static int ircc_dma_receive(struct ircc_cb *self); +static int ircc_dma_receive_complete(struct ircc_cb *self, int iobase); +static int ircc_hard_xmit(struct sk_buff *skb, struct net_device *dev); +static void ircc_dma_write(struct ircc_cb *self, int iobase); +static void ircc_change_speed(struct ircc_cb *self, __u32 speed); static void ircc_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static void ircc_wait_until_sent( struct irda_device *idev); -static int ircc_is_receiving( struct irda_device *idev); +static void ircc_wait_until_sent(struct ircc_cb *self); +static int ircc_is_receiving(struct ircc_cb *self); -static int ircc_net_init( struct net_device *dev); -static int ircc_net_open( struct net_device *dev); -static int ircc_net_close( struct net_device *dev); +static int ircc_net_init(struct net_device *dev); +static int ircc_net_open(struct net_device *dev); +static int ircc_net_close(struct net_device *dev); static int ircc_debug=3; static int ircc_irq=255; @@ -107,14 +108,14 @@ int i; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - for ( i=0; (io[i] < 2000) && (i < 4); i++) { + for (i=0; (io[i] < 2000) && (i < 4); i++) { int ioaddr = io[i]; if (check_region(ioaddr, CHIP_IO_EXTENT)) continue; - if (ircc_open( i, io[i], io2[i]) == 0) + if (ircc_open(i, io[i], io2[i]) == 0) return 0; } - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return -ENODEV; } @@ -132,11 +133,11 @@ IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - for ( i=0; i < 4; i++) { - if ( dev_self[i]) - ircc_close( &(dev_self[i]->idev)); + for (i=0; i < 4; i++) { + if (dev_self[i]) + ircc_close(dev_self[i]); } - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); } #endif /* MODULE */ @@ -146,16 +147,17 @@ * Open driver instance * */ -static int ircc_open( int i, unsigned int iobase, unsigned int iobase2) +static int ircc_open(int i, unsigned int iobase, unsigned int iobase2) { + struct net_device *dev; struct ircc_cb *self; - struct irda_device *idev; - int ret; int config; + int ret; + int err; - IRDA_DEBUG( ircc_debug, __FUNCTION__ " -->\n"); + IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - if ((config = ircc_probe( iobase, iobase2)) == -1) { + if ((config = ircc_probe(iobase, iobase2)) == -1) { IRDA_DEBUG(ircc_debug, __FUNCTION__ ": addr 0x%04x - no device found!\n", iobase); return -1; @@ -164,9 +166,9 @@ /* * Allocate new instance of the driver */ - self = kmalloc( sizeof(struct ircc_cb), GFP_KERNEL); - if ( self == NULL) { - printk( KERN_ERR "IrDA: Can't allocate memory for " + self = kmalloc(sizeof(struct ircc_cb), GFP_KERNEL); + if (self == NULL) { + printk(KERN_ERR "IrDA: Can't allocate memory for " "IrDA control block!\n"); return -ENOMEM; } @@ -175,110 +177,143 @@ /* Need to store self somewhere */ dev_self[i] = self; - idev = &self->idev; - /* Initialize IO */ - idev->io.iobase = iobase; - idev->io.iobase2 = iobase2; /* Used by irport */ - idev->io.irq = config >> 4 & 0x0f; + self->io.iobase = iobase; + self->io.iobase2 = iobase2; /* Used by irport */ + self->io.irq = config >> 4 & 0x0f; if (ircc_irq < 255) { printk(KERN_INFO "smc: Overriding IRQ - chip says %d, using %d\n", - idev->io.irq, ircc_irq); - idev->io.irq = ircc_irq; + self->io.irq, ircc_irq); + self->io.irq = ircc_irq; } - idev->io.io_ext = CHIP_IO_EXTENT; - idev->io.io_ext2 = 8; /* Used by irport */ - idev->io.dma = config & 0x0f; + self->io.io_ext = CHIP_IO_EXTENT; + self->io.io_ext2 = 8; /* Used by irport */ + self->io.dma = config & 0x0f; if (ircc_dma < 255) { printk(KERN_INFO "smc: Overriding DMA - chip says %d, using %d\n", - idev->io.dma, ircc_dma); - idev->io.dma = ircc_dma; + self->io.dma, ircc_dma); + self->io.dma = ircc_dma; } - idev->io.fifo_size = 16; + self->io.fifo_size = 16; /* Lock the port that we need */ - ret = check_region( idev->io.iobase, idev->io.io_ext); - if ( ret < 0) { - IRDA_DEBUG( 0, __FUNCTION__ ": can't get iobase of 0x%03x\n", - idev->io.iobase); - /* ircc_cleanup( self->idev); */ + ret = check_region(self->io.iobase, self->io.io_ext); + if (ret < 0) { + IRDA_DEBUG(0, __FUNCTION__ ": can't get iobase of 0x%03x\n", + self->io.iobase); + /* ircc_cleanup(self->self); */ return -ENODEV; } - ret = check_region( idev->io.iobase2, idev->io.io_ext2); - if ( ret < 0) { - IRDA_DEBUG( 0, __FUNCTION__ ": can't get iobase of 0x%03x\n", - idev->io.iobase2); - /* ircc_cleanup( self->idev); */ + ret = check_region(self->io.iobase2, self->io.io_ext2); + if (ret < 0) { + IRDA_DEBUG(0, __FUNCTION__ ": can't get iobase of 0x%03x\n", + self->io.iobase2); + /* ircc_cleanup(self->self); */ return -ENODEV; } - request_region( idev->io.iobase, idev->io.io_ext, idev->name); - request_region( idev->io.iobase2, idev->io.io_ext2, idev->name); + request_region(self->io.iobase, self->io.io_ext, driver_name); + request_region(self->io.iobase2, self->io.io_ext2, driver_name); /* Initialize QoS for this device */ - irda_init_max_qos_capabilies( &idev->qos); + irda_init_max_qos_capabilies(&self->qos); #if 1 /* The only value we must override it the baudrate */ - idev->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| + self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| IR_115200|IR_576000|IR_1152000|(IR_4000000 << 8); #else /* The only value we must override it the baudrate */ - idev->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| + self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| IR_115200; #endif - idev->qos.min_turn_time.bits = 0x07; - irda_qos_bits_to_value( &idev->qos); + self->qos.min_turn_time.bits = 0x07; + irda_qos_bits_to_value(&self->qos); - idev->flags = IFF_FIR|IFF_SIR|IFF_DMA|IFF_PIO; + self->flags = IFF_FIR|IFF_SIR|IFF_DMA|IFF_PIO; - /* Specify which buffer allocation policy we need */ - idev->rx_buff.flags = GFP_KERNEL | GFP_DMA; - idev->tx_buff.flags = GFP_KERNEL | GFP_DMA; - /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */ - idev->rx_buff.truesize = 4000; - idev->tx_buff.truesize = 4000; + self->rx_buff.truesize = 4000; + self->tx_buff.truesize = 4000; + + /* Allocate memory if needed */ + if (self->rx_buff.truesize > 0) { + self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize, + GFP_KERNEL|GFP_DMA); + if (self->rx_buff.head == NULL) + return -ENOMEM; + memset(self->rx_buff.head, 0, self->rx_buff.truesize); + } + if (self->tx_buff.truesize > 0) { + self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, + GFP_KERNEL|GFP_DMA); + if (self->tx_buff.head == NULL) { + kfree(self->rx_buff.head); + return -ENOMEM; + } + memset(self->tx_buff.head, 0, self->tx_buff.truesize); + } + + self->rx_buff.in_frame = FALSE; + self->rx_buff.state = OUTSIDE_FRAME; + self->tx_buff.data = self->tx_buff.head; + self->rx_buff.data = self->rx_buff.head; + + if (!(dev = dev_alloc("irda%d", &err))) { + ERROR(__FUNCTION__ "(), dev_alloc() failed!\n"); + return -ENOMEM; + } + + dev->priv = (void *) self; + self->netdev = dev; - /* Initialize callbacks */ - idev->change_speed = ircc_change_speed; - idev->wait_until_sent = ircc_wait_until_sent; - idev->is_receiving = ircc_is_receiving; - /* Override the network functions we need to use */ - idev->netdev.init = ircc_net_init; - idev->netdev.hard_start_xmit = ircc_hard_xmit; - idev->netdev.open = ircc_net_open; - idev->netdev.stop = ircc_net_close; + dev->init = ircc_net_init; + dev->hard_start_xmit = ircc_hard_xmit; + dev->open = ircc_net_open; + dev->stop = ircc_net_close; + + rtnl_lock(); + err = register_netdevice(dev); + rtnl_unlock(); + if (err) { + ERROR(__FUNCTION__ "(), register_netdev() failed!\n"); + return -1; + } - irport_start(idev, iobase2); + MESSAGE("IrDA: Registered device %s\n", dev->name); - /* Open the IrDA device */ - irda_device_open( idev, driver_name, self); - - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + irport_start(&self->irport, iobase2); + + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } /* - * Function ircc_close (idev) + * Function ircc_close (self) * * Close driver instance * */ #ifdef MODULE -static int ircc_close( struct irda_device *idev) +static int ircc_close(struct ircc_cb *self) { int iobase; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( idev != NULL, return -1;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return -1;); + ASSERT(self != NULL, return -1;); - iobase = idev->io.iobase; + iobase = self->io.iobase; - irport_stop(idev, idev->io.iobase2); + irport_stop(&self->irport, self->io.iobase2); + + /* Remove netdevice */ + if (self->netdev) { + rtnl_lock(); + unregister_netdev(self->netdev); + rtnl_unlock(); + } register_bank(iobase, 0); serial_out(iobase, UART_IER, 0); @@ -291,20 +326,27 @@ serial_out(iobase, UART_SCE_CFGB, UART_CFGB_IR); /* Release the PORT that this driver is using */ - IRDA_DEBUG( ircc_debug, - __FUNCTION__ ": releasing 0x%03x\n", idev->io.iobase); + IRDA_DEBUG(ircc_debug, + __FUNCTION__ ": releasing 0x%03x\n", self->io.iobase); - release_region( idev->io.iobase, idev->io.io_ext); + release_region(self->io.iobase, self->io.io_ext); - if ( idev->io.iobase2) { - IRDA_DEBUG( ircc_debug, __FUNCTION__ ": releasing 0x%03x\n", - idev->io.iobase2); - release_region( idev->io.iobase2, idev->io.io_ext2); + if (self->io.iobase2) { + IRDA_DEBUG(ircc_debug, __FUNCTION__ ": releasing 0x%03x\n", + self->io.iobase2); + release_region(self->io.iobase2, self->io.io_ext2); } - irda_device_close( idev); + if (self->tx_buff.head) + kfree(self->tx_buff.head); + + if (self->rx_buff.head) + kfree(self->rx_buff.head); + + kfree(self); + + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } #endif /* MODULE */ @@ -347,28 +389,25 @@ } /* - * Function ircc_change_speed (idev, baud) + * Function ircc_change_speed (self, baud) * * Change the speed of the device * */ -static void ircc_change_speed( struct irda_device *idev, __u32 speed) +static void ircc_change_speed(struct ircc_cb *self, __u32 speed) { - struct ircc_cb *self; int iobase, ir_mode, select, fast; IRDA_DEBUG(ircc_debug+1, __FUNCTION__ " -->\n"); - ASSERT(idev != NULL, return;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); + ASSERT(self != NULL, return;); - self = idev->priv; - iobase = idev->io.iobase; + iobase = self->io.iobase; /* Update accounting for new speed */ - idev->io.baudrate = speed; + self->io.speed = speed; - switch ( speed) { + switch (speed) { case 9600: case 19200: case 37600: @@ -381,8 +420,8 @@ serial_out(iobase, UART_IER, 0); serial_out(iobase, UART_MASTER, UART_MASTER_RESET); serial_out(iobase, UART_MASTER, UART_MASTER_INT_EN); - irport_start(idev, idev->io.iobase2); - irport_change_speed( idev, speed); + irport_start(&self->irport, self->io.iobase2); + irport_change_speed(&self->irport, speed); return; break; @@ -390,7 +429,7 @@ ir_mode = UART_CFGA_IRDA_HDLC; select = 0; fast = 0; - IRDA_DEBUG( ircc_debug, __FUNCTION__ ": handling baud of 576000\n"); + IRDA_DEBUG(ircc_debug, __FUNCTION__ ": handling baud of 576000\n"); break; case 1152000: ir_mode = UART_CFGA_IRDA_HDLC; @@ -405,12 +444,12 @@ IRDA_DEBUG(ircc_debug, __FUNCTION__ ": handling baud of 4000000\n"); break; default: - IRDA_DEBUG( 0, __FUNCTION__ ": unknown baud rate of %d\n", speed); + IRDA_DEBUG(0, __FUNCTION__ ": unknown baud rate of %d\n", speed); return; } #if 0 - serial_out(idev->io.iobase2, 4, 0x08); + serial_out(self->io.iobase2, 4, 0x08); #endif serial_out(iobase, UART_MASTER, UART_MASTER_RESET); @@ -418,9 +457,9 @@ register_bank(iobase, 0); serial_out(iobase, UART_IER, 0); - irport_stop(idev, idev->io.iobase2); + irport_stop(&self->irport, self->io.iobase2); - idev->netdev.tbusy = 0; + self->netdev->tbusy = 0; register_bank(iobase, 1); @@ -443,7 +482,7 @@ serial_out(iobase, UART_LCR_A, fast); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); } /* @@ -452,25 +491,31 @@ * Transmit the frame! * */ -static int ircc_hard_xmit( struct sk_buff *skb, struct net_device *dev) +static int ircc_hard_xmit(struct sk_buff *skb, struct net_device *dev) { - struct irda_device *idev; + struct ircc_cb *self; int iobase; int mtt; + __u32 speed; IRDA_DEBUG(ircc_debug+1, __FUNCTION__ " -->\n"); - idev = (struct irda_device *) dev->priv; + self = (struct ircc_cb *) dev->priv; + + ASSERT(self != NULL, return 0;); - ASSERT( idev != NULL, return 0;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return 0;); + iobase = self->io.iobase; - iobase = idev->io.iobase; + IRDA_DEBUG(ircc_debug+1, __FUNCTION__ "(%ld), skb->len=%d\n", jiffies, + (int) skb->len); - IRDA_DEBUG(ircc_debug+1, __FUNCTION__ "(%ld), skb->len=%d\n", jiffies, (int) skb->len); + /* Check if we need to change the speed */ + if ((speed = irda_get_speed(skb)) != self->io.speed) + ircc_change_speed(self, speed); /* Use irport for SIR speeds */ - if (idev->io.baudrate <= 115200) { - IRDA_DEBUG(ircc_debug+1, __FUNCTION__ ": calling irport_hard_xmit\n"); + if (self->io.speed <= 115200) { + IRDA_DEBUG(ircc_debug+1, __FUNCTION__ + ": calling irport_hard_xmit\n"); return irport_hard_xmit(skb, dev); } @@ -480,56 +525,52 @@ if (irda_lock((void *) &dev->tbusy) == FALSE) return -EBUSY; - memcpy( idev->tx_buff.head, skb->data, skb->len); + memcpy(self->tx_buff.head, skb->data, skb->len); /* Make sure that the length is a multiple of 16 bits */ - if ( skb->len & 0x01) + if (skb->len & 0x01) skb->len++; - idev->tx_buff.len = skb->len; - idev->tx_buff.data = idev->tx_buff.head; + self->tx_buff.len = skb->len; + self->tx_buff.data = self->tx_buff.head; #if 0 - idev->tx_buff.offset = 0; + self->tx_buff.offset = 0; #endif - mtt = irda_get_mtt( skb); + mtt = irda_get_mtt(skb); /* Use udelay for delays less than 50 us. */ if (mtt) - udelay( mtt); + udelay(mtt); - ircc_dma_write( idev, iobase); + ircc_dma_write(self, iobase); - dev_kfree_skb( skb); + dev_kfree_skb(skb); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } /* - * Function ircc_dma_xmit (idev, iobase) + * Function ircc_dma_xmit (self, iobase) * * Transmit data using DMA * */ -static void ircc_dma_write( struct irda_device *idev, int iobase) +static void ircc_dma_write(struct ircc_cb *self, int iobase) { - struct ircc_cb *self; - IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( idev != NULL, return;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return;); + ASSERT(self != NULL, return;); - self = idev->priv; - iobase = idev->io.iobase; + iobase = self->io.iobase; - setup_dma( idev->io.dma, idev->tx_buff.data, idev->tx_buff.len, + setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, DMA_MODE_WRITE); - idev->io.direction = IO_XMIT; + self->io.direction = IO_XMIT; - serial_out(idev->io.iobase2, 4, 0x08); + serial_out(self->io.iobase2, 4, 0x08); register_bank(iobase, 4); serial_out(iobase, UART_CONTROL, @@ -538,8 +579,8 @@ serial_out(iobase, UART_BOF_COUNT_LO, 2); serial_out(iobase, UART_BRICKWALL_CNT_LO, 0); #if 1 - serial_out(iobase, UART_BRICKWALL_TX_CNT_HI, idev->tx_buff.len >> 8); - serial_out(iobase, UART_TX_SIZE_LO, idev->tx_buff.len & 0xff); + serial_out(iobase, UART_BRICKWALL_TX_CNT_HI, self->tx_buff.len >> 8); + serial_out(iobase, UART_TX_SIZE_LO, self->tx_buff.len & 0xff); #else serial_out(iobase, UART_BRICKWALL_TX_CNT_HI, 0); serial_out(iobase, UART_TX_SIZE_LO, 0); @@ -557,88 +598,80 @@ serial_out(iobase, UART_MASTER, UART_MASTER_INT_EN); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); } /* - * Function ircc_dma_xmit_complete (idev) + * Function ircc_dma_xmit_complete (self) * * The transfer of a frame in finished. This function will only be called * by the interrupt handler * */ -static void ircc_dma_xmit_complete( struct irda_device *idev, int underrun) +static void ircc_dma_xmit_complete(struct ircc_cb *self, int underrun) { - struct ircc_cb *self; int iobase, d; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( idev != NULL, return;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return;); + ASSERT(self != NULL, return;); - register_bank(idev->io.iobase, 1); + register_bank(self->io.iobase, 1); - serial_out(idev->io.iobase, UART_SCE_CFGB, - serial_in(idev->io.iobase, UART_SCE_CFGB) & + serial_out(self->io.iobase, UART_SCE_CFGB, + serial_in(self->io.iobase, UART_SCE_CFGB) & ~UART_CFGB_DMA_ENABLE); - d = get_dma_residue(idev->io.dma); + d = get_dma_residue(self->io.dma); IRDA_DEBUG(ircc_debug, __FUNCTION__ ": dma residue = %d, len=%d, sent=%d\n", - d, idev->tx_buff.len, idev->tx_buff.len - d); - - self = idev->priv; + d, self->tx_buff.len, self->tx_buff.len - d); - iobase = idev->io.iobase; + iobase = self->io.iobase; /* Check for underrrun! */ - if ( underrun) { - idev->stats.tx_errors++; - idev->stats.tx_fifo_errors++; + if (underrun) { + self->stats.tx_errors++; + self->stats.tx_fifo_errors++; } else { - idev->stats.tx_packets++; - idev->stats.tx_bytes += idev->tx_buff.len; + self->stats.tx_packets++; + self->stats.tx_bytes += self->tx_buff.len; } /* Unlock tx_buff and request another frame */ - idev->netdev.tbusy = 0; /* Unlock */ - idev->media_busy = FALSE; + self->netdev->tbusy = 0; /* Unlock */ /* Tell the network layer, that we can accept more frames */ - mark_bh( NET_BH); + mark_bh(NET_BH); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); } /* - * Function ircc_dma_receive (idev) + * Function ircc_dma_receive (self) * * Get ready for receiving a frame. The device will initiate a DMA * if it starts to receive a frame. * */ -static int ircc_dma_receive( struct irda_device *idev) +static int ircc_dma_receive(struct ircc_cb *self) { - struct ircc_cb *self; int iobase; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( idev != NULL, return -1;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return -1;); + ASSERT(self != NULL, return -1;); - self = idev->priv; - iobase= idev->io.iobase; + iobase= self->io.iobase; - setup_dma( idev->io.dma, idev->rx_buff.data, idev->rx_buff.truesize, + setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, DMA_MODE_READ); /* driver->media_busy = FALSE; */ - idev->io.direction = IO_RECV; - idev->rx_buff.data = idev->rx_buff.head; + self->io.direction = IO_RECV; + self->rx_buff.data = self->rx_buff.head; #if 0 - idev->rx_buff.offset = 0; + self->rx_buff.offset = 0; #endif register_bank(iobase, 4); @@ -660,62 +693,59 @@ serial_in(iobase, UART_SCE_CFGB) | UART_CFGB_DMA_ENABLE | UART_CFGB_DMA_BURST); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } /* - * Function ircc_dma_receive_complete (idev) + * Function ircc_dma_receive_complete (self) * * Finished with receiving frames * * */ -static int ircc_dma_receive_complete( struct irda_device *idev, int iobase) +static int ircc_dma_receive_complete(struct ircc_cb *self, int iobase) { struct sk_buff *skb; - struct ircc_cb *self; int len, msgcnt; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - self = idev->priv; - - msgcnt = serial_in(idev->io.iobase, UART_LCR_B) & 0x08; + msgcnt = serial_in(self->io.iobase, UART_LCR_B) & 0x08; IRDA_DEBUG(ircc_debug, __FUNCTION__ ": dma count = %d\n", - get_dma_residue(idev->io.dma)); + get_dma_residue(self->io.dma)); - len = idev->rx_buff.truesize - get_dma_residue(idev->io.dma) - 4; + len = self->rx_buff.truesize - get_dma_residue(self->io.dma) - 4; IRDA_DEBUG(ircc_debug, __FUNCTION__ ": msgcnt = %d, len=%d\n", msgcnt, len); - skb = dev_alloc_skb( len+1); + skb = dev_alloc_skb(len+1); if (skb == NULL) { - printk( KERN_INFO __FUNCTION__ + printk(KERN_INFO __FUNCTION__ ": memory squeeze, dropping frame.\n"); return FALSE; } /* Make sure IP header gets aligned */ - skb_reserve( skb, 1); - skb_put( skb, len); + skb_reserve(skb, 1); + skb_put(skb, len); - memcpy(skb->data, idev->rx_buff.data, len); - idev->stats.rx_packets++; + memcpy(skb->data, self->rx_buff.data, len); + self->stats.rx_packets++; - skb->dev = &idev->netdev; + skb->dev = self->netdev; skb->mac.raw = skb->data; skb->protocol = htons(ETH_P_IRDA); - netif_rx( skb); + netif_rx(skb); - register_bank(idev->io.iobase, 1); - serial_out(idev->io.iobase, UART_SCE_CFGB, - serial_in(idev->io.iobase, UART_SCE_CFGB) & + register_bank(self->io.iobase, 1); + serial_out(self->io.iobase, UART_SCE_CFGB, + serial_in(self->io.iobase, UART_SCE_CFGB) & ~UART_CFGB_DMA_ENABLE); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return TRUE; } @@ -728,26 +758,28 @@ static void ircc_interrupt(int irq, void *dev_id, struct pt_regs *regs) { int iobase, iir; - - struct irda_device *idev = (struct irda_device *) dev_id; + struct net_device *dev = (struct net_device *) dev_id; + struct ircc_cb *self; IRDA_DEBUG(ircc_debug+1, __FUNCTION__ " -->\n"); - if (idev == NULL) { - printk( KERN_WARNING "%s: irq %d for unknown device.\n", + if (dev == NULL) { + printk(KERN_WARNING "%s: irq %d for unknown device.\n", driver_name, irq); return; } - if (idev->io.baudrate <= 115200) { + self = (struct ircc_cb *) dev->priv; + + if (self->io.speed <= 115200) { IRDA_DEBUG(ircc_debug+1, __FUNCTION__ ": routing interrupt to irport_interrupt\n"); - return irport_interrupt( irq, dev_id, regs); + return irport_interrupt(irq, dev_id, regs); } - iobase = idev->io.iobase; + iobase = self->io.iobase; - idev->netdev.interrupt = 1; + dev->interrupt = 1; serial_out(iobase, UART_MASTER, 0); @@ -761,19 +793,19 @@ if (iir & UART_IIR_EOM) { IRDA_DEBUG(ircc_debug, __FUNCTION__ ": UART_IIR_EOM\n"); - if (idev->io.direction == IO_RECV) { - ircc_dma_receive_complete(idev, iobase); + if (self->io.direction == IO_RECV) { + ircc_dma_receive_complete(self, iobase); } else { - ircc_dma_xmit_complete(idev, iobase); + ircc_dma_xmit_complete(self, iobase); } - ircc_dma_receive(idev); + ircc_dma_receive(self); } if (iir & UART_IIR_ACTIVE_FRAME) { IRDA_DEBUG(ircc_debug, __FUNCTION__ ": UART_IIR_ACTIVE_FRAME\n"); - idev->rx_buff.state = INSIDE_FRAME; + self->rx_buff.state = INSIDE_FRAME; #if 0 - ircc_dma_receive(idev); + ircc_dma_receive(self); #endif } @@ -781,22 +813,22 @@ IRDA_DEBUG(ircc_debug, __FUNCTION__ ": IIR RAW mode interrupt.\n"); } - idev->netdev.interrupt = 0; + dev->interrupt = 0; register_bank(iobase, 0); serial_out(iobase, UART_IER, UART_IER_ACTIVE_FRAME|UART_IER_EOM); serial_out(iobase, UART_MASTER, UART_MASTER_INT_EN); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); } /* - * Function ircc_wait_until_sent (idev) + * Function ircc_wait_until_sent (self) * * This function should put the current thread to sleep until all data * have been sent, so it is safe to change the speed. */ -static void ircc_wait_until_sent( struct irda_device *idev) +static void ircc_wait_until_sent(struct ircc_cb *self) { IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); @@ -804,31 +836,30 @@ current->state = TASK_INTERRUPTIBLE; schedule_timeout(MSECS_TO_JIFFIES(60)); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); } /* - * Function ircc_is_receiving (idev) + * Function ircc_is_receiving (self) * * Return TRUE is we are currently receiving a frame * */ -static int ircc_is_receiving( struct irda_device *idev) +static int ircc_is_receiving(struct ircc_cb *self) { int status = FALSE; /* int iobase; */ IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( idev != NULL, return FALSE;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return FALSE;); + ASSERT(self != NULL, return FALSE;); IRDA_DEBUG(ircc_debug, __FUNCTION__ ": dma count = %d\n", - get_dma_residue(idev->io.dma)); + get_dma_residue(self->io.dma)); - status = ( idev->rx_buff.state != OUTSIDE_FRAME); + status = (self->rx_buff.state != OUTSIDE_FRAME); - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return status; } @@ -839,16 +870,16 @@ * Initialize network device * */ -static int ircc_net_init( struct net_device *dev) +static int ircc_net_init(struct net_device *dev) { IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); /* Setup to be a normal IrDA network device driver */ - irda_device_setup( dev); + irda_device_setup(dev); /* Insert overrides below this line! */ - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } @@ -859,42 +890,47 @@ * Start the device * */ -static int ircc_net_open( struct net_device *dev) +static int ircc_net_open(struct net_device *dev) { - struct irda_device *idev; + struct ircc_cb *self; int iobase; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( dev != NULL, return -1;); - idev = (struct irda_device *) dev->priv; + ASSERT(dev != NULL, return -1;); + self = (struct ircc_cb *) dev->priv; - ASSERT( idev != NULL, return 0;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return 0;); + ASSERT(self != NULL, return 0;); - iobase = idev->io.iobase; + iobase = self->io.iobase; - if (request_irq( idev->io.irq, ircc_interrupt, 0, idev->name, - (void *) idev)) { + if (request_irq(self->io.irq, ircc_interrupt, 0, dev->name, + (void *) dev)) { return -EAGAIN; } /* * Always allocate the DMA channel after the IRQ, * and clean up on failure. */ - if (request_dma(idev->io.dma, idev->name)) { - free_irq( idev->io.irq, idev); + if (request_dma(self->io.dma, dev->name)) { + free_irq(self->io.irq, dev); return -EAGAIN; } /* Ready to play! */ - irda_device_net_open(dev); - - /* turn on interrupts */ + dev->tbusy = 0; + dev->interrupt = 0; + dev->start = 1; + + /* + * Open new IrLAP layer instance, now that everything should be + * initialized properly + */ + self->irlap = irlap_open(dev, &self->qos); MOD_INC_USE_COUNT; - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } @@ -906,31 +942,36 @@ */ static int ircc_net_close(struct net_device *dev) { - struct irda_device *idev; + struct ircc_cb *self; int iobase; IRDA_DEBUG(ircc_debug, __FUNCTION__ " -->\n"); - ASSERT( dev != NULL, return -1;); - idev = (struct irda_device *) dev->priv; + ASSERT(dev != NULL, return -1;); + self = (struct ircc_cb *) dev->priv; - ASSERT( idev != NULL, return 0;); - ASSERT( idev->magic == IRDA_DEVICE_MAGIC, return 0;); + ASSERT(self != NULL, return 0;); - iobase = idev->io.iobase; + iobase = self->io.iobase; - irda_device_net_close(dev); + /* Stop device */ + dev->tbusy = 1; + dev->start = 0; - disable_dma( idev->io.dma); + /* Stop and remove instance of IrLAP */ + if (self->irlap) + irlap_close(self->irlap); + self->irlap = NULL; + + disable_dma(self->io.dma); /* Disable interrupts */ - - free_irq( idev->io.irq, idev); - free_dma( idev->io.dma); + free_irq(self->io.irq, dev); + free_dma(self->io.dma); MOD_DEC_USE_COUNT; - IRDA_DEBUG( ircc_debug, "--> " __FUNCTION__ "\n"); + IRDA_DEBUG(ircc_debug, "--> " __FUNCTION__ "\n"); return 0; } @@ -942,23 +983,11 @@ MODULE_PARM(ircc_dma, "1i"); MODULE_PARM(ircc_irq, "1i"); -/* - * Function init_module (void) - * - * - * - */ int init_module(void) { return ircc_init(); } -/* - * Function cleanup_module (void) - * - * - * - */ void cleanup_module(void) { ircc_cleanup(); diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/uircc.c linux/drivers/net/irda/uircc.c --- v2.3.25/linux/drivers/net/irda/uircc.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/uircc.c Wed Dec 31 16:00:00 1969 @@ -1,947 +0,0 @@ -/********************************************************************* - * - * Filename: uircc.c - * Version: 0.3 - * Description: Driver for the Sharp Universal Infrared - * Communications Controller (UIRCC v 1.3) - * Status: Experimental. - * Author: Dag Brattli - * Created at: Sat Dec 26 10:59:03 1998 - * Modified at: Tue Aug 24 13:33:57 1999 - * Modified by: Dag Brattli - * - * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * 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. - * - * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is - * provided "AS-IS" and at no charge. - * - * Applicable Models : Tecra 510CDT, 500C Series, 530CDT, 520CDT, - * 740CDT, Portege 300CT, 660CDT, Satellite 220C Series, - * Satellite Pro, 440C Series, 470CDT, 460C Series, 480C Series - * - ********************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -static char *driver_name = "uircc"; - -#define CHIP_IO_EXTENT 16 - -static unsigned int io[] = { 0x300, ~0, ~0, ~0 }; -static unsigned int io2[] = { 0x3e8, 0, 0, 0}; -static unsigned int irq[] = { 11, 0, 0, 0 }; -static unsigned int dma[] = { 5, 0, 0, 0 }; - -static struct uircc_cb *dev_self[] = { NULL, NULL, NULL, NULL}; - -/* Some prototypes */ -static int uircc_open(int i, unsigned int iobase, unsigned int board_addr, - unsigned int irq, unsigned int dma); -#ifdef MODULE -static int uircc_close(struct irda_device *idev); -#endif /* MODULE */ -static int uircc_probe(int iobase, int board_addr, int irq, int dma); -static int uircc_dma_receive(struct irda_device *idev); -static int uircc_dma_receive_complete(struct irda_device *idev, int iobase); -static int uircc_hard_xmit(struct sk_buff *skb, struct net_device *dev); -static void uircc_dma_write(struct irda_device *idev, int iobase); -static void uircc_change_speed(struct irda_device *idev, __u32 baud); -static void uircc_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static void uircc_wait_until_sent(struct irda_device *idev); -static int uircc_is_receiving(struct irda_device *idev); -static int uircc_toshiba_cmd(int *retval, int arg0, int arg1, int arg2); -static int uircc_net_init(struct net_device *dev); -static int uircc_net_open(struct net_device *dev); -static int uircc_net_close(struct net_device *dev); - -/* - * Function uircc_init () - * - * Initialize chip. Just try to find out how many chips we are dealing with - * and where they are - */ -int __init uircc_init(void) -{ - int i; - - for ( i=0; (io[i] < 2000) && (i < 4); i++) { - int ioaddr = io[i]; - if (check_region(ioaddr, CHIP_IO_EXTENT) < 0) - continue; - if (uircc_open(i, io[i], io2[i], irq[i], dma[i]) == 0) - return 0; - } - return -ENODEV; -} - -/* - * Function uircc_cleanup () - * - * Close all configured chips - * - */ -#ifdef MODULE -static void uircc_cleanup(void) -{ - int i; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - for (i=0; i < 4; i++) { - if (dev_self[i]) - uircc_close(&(dev_self[i]->idev)); - } -} -#endif /* MODULE */ - -/* - * Function uircc_open (iobase, irq) - * - * Open driver instance - * - */ -static int uircc_open(int i, unsigned int iobase, unsigned int iobase2, - unsigned int irq, unsigned int dma) -{ - struct uircc_cb *self; - struct irda_device *idev; - int ret; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - if ((uircc_probe(iobase, iobase2, irq, dma)) == -1) - return -1; - - /* - * Allocate new instance of the driver - */ - self = kmalloc( sizeof(struct uircc_cb), GFP_KERNEL); - if (self == NULL) { - printk(KERN_ERR "IrDA: Can't allocate memory for " - "IrDA control block!\n"); - return -ENOMEM; - } - memset(self, 0, sizeof(struct uircc_cb)); - - /* Need to store self somewhere */ - dev_self[i] = self; - - idev = &self->idev; - - /* Initialize IO */ - idev->io.iobase = iobase; - idev->io.iobase2 = iobase2; /* Used by irport */ - idev->io.irq = irq; - idev->io.io_ext = CHIP_IO_EXTENT; - idev->io.io_ext2 = 8; /* Used by irport */ - idev->io.dma = dma; - idev->io.fifo_size = 16; - - /* Lock the port that we need */ - ret = check_region(idev->io.iobase, idev->io.io_ext); - if (ret < 0) { - IRDA_DEBUG(0, __FUNCTION__ "(), can't get iobase of 0x%03x\n", - idev->io.iobase); - /* uircc_cleanup( self->idev); */ - return -ENODEV; - } - ret = check_region(idev->io.iobase2, idev->io.io_ext2); - if (ret < 0) { - IRDA_DEBUG(0, __FUNCTION__ "(), can't get iobase of 0x%03x\n", - idev->io.iobase2); - /* uircc_cleanup( self->idev); */ - return -ENODEV; - } - request_region(idev->io.iobase, idev->io.io_ext, idev->name); - request_region(idev->io.iobase2, idev->io.io_ext2, idev->name); - - /* Initialize QoS for this device */ - irda_init_max_qos_capabilies(&idev->qos); - - /* The only value we must override it the baudrate */ - idev->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| - IR_115200/*IR_576000|IR_1152000 |(IR_4000000 << 8)*/; - - idev->qos.min_turn_time.bits = 0x0f; - irda_qos_bits_to_value(&idev->qos); - - idev->flags = IFF_FIR|IFF_SIR|IFF_DMA|IFF_PIO; - - /* Specify which buffer allocation policy we need */ - idev->rx_buff.flags = GFP_KERNEL | GFP_DMA; - idev->tx_buff.flags = GFP_KERNEL | GFP_DMA; - - /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */ - idev->rx_buff.truesize = 4000; - idev->tx_buff.truesize = 4000; - - /* Initialize callbacks */ - idev->change_speed = uircc_change_speed; - idev->wait_until_sent = uircc_wait_until_sent; - idev->is_receiving = uircc_is_receiving; - - /* Override the network functions we need to use */ - idev->netdev.init = uircc_net_init; - idev->netdev.hard_start_xmit = uircc_hard_xmit; - idev->netdev.open = uircc_net_open; - idev->netdev.stop = uircc_net_close; - - irport_start(idev, iobase2); - - /* Open the IrDA device */ - irda_device_open(idev, driver_name, self); - - return 0; -} - -/* - * Function uircc_close (idev) - * - * Close driver instance - * - */ -#ifdef MODULE -static int uircc_close(struct irda_device *idev) -{ - struct uircc_cb *self; - int iobase; - int status; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - ASSERT(idev != NULL, return -1;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return -1;); - - iobase = idev->io.iobase; - self = (struct uircc_cb *) idev->priv; - - /* Some magic to disable FIR and enable SIR */ - uircc_toshiba_cmd(&status, 0xffff, 0x001b, 0x0000); - - /* Disable modem */ - outb(0x00, iobase+UIRCC_CR10); - - irport_stop(idev, idev->io.iobase2); - - /* Release the PORT that this driver is using */ - IRDA_DEBUG(4, __FUNCTION__ "(), Releasing Region %03x\n", idev->io.iobase); - release_region(idev->io.iobase, idev->io.io_ext); - - if (idev->io.iobase2) { - IRDA_DEBUG(4, __FUNCTION__ "(), Releasing Region %03x\n", - idev->io.iobase2); - release_region(idev->io.iobase2, idev->io.io_ext2); - } - irda_device_close(idev); - - kfree(self); - - return 0; -} -#endif /* MODULE */ - -/* - * Function uircc_probe (iobase, board_addr, irq, dma) - * - * Returns non-negative on success. - * - */ -static int uircc_probe(int iobase, int iobase2, int irq, int dma) -{ - int version; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - /* read the chip version, should be 0x03 */ - version = inb(iobase+UIRCC_SR8); - - if (version != 0x03) { - IRDA_DEBUG(0, __FUNCTION__ "(), Wrong chip version"); - return -1; - } - printk(KERN_INFO "Sharp UIRCC IrDA driver loaded. Version: 0x%02x\n", - version); - - /* Reset chip */ - outb(UIRCC_CR0_SYS_RST, iobase+UIRCC_CR0); - - /* Initialize some registers */ - outb(0x03, iobase+UIRCC_CR15); - outb(0, iobase+UIRCC_CR11); - outb(0, iobase+UIRCC_CR9); - - IRDA_DEBUG(0, __FUNCTION__ "(), sr15=%#x\n", inb(iobase+UIRCC_SR15)); - - /* Enable DMA single mode */ - outb(UIRCC_CR1_RX_DMA|UIRCC_CR1_TX_DMA|UIRCC_CR1_MUST_SET, - iobase+UIRCC_CR1); - - /* Disable interrupts */ - outb(0xff, iobase+UIRCC_CR2); - - /* Set self poll address */ - - return 0; -} - -/* - * Function uircc_change_speed (idev, baud) - * - * Change the speed of the device - * - */ -static void uircc_change_speed(struct irda_device *idev, __u32 speed) -{ - struct uircc_cb *self; - int iobase; - int modem = UIRCC_CR10_SIR; - int status; - - IRDA_DEBUG(0, __FUNCTION__ "()\n"); - - /* Just test the high speed stuff */ - /*speed = 4000000;*/ - - ASSERT(idev != NULL, return;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); - - self = idev->priv; - iobase = idev->io.iobase; - - /* Update accounting for new speed */ - idev->io.baudrate = speed; - - /* Disable interrupts */ - outb(0xff, iobase+UIRCC_CR2); - - switch (speed) { - case 9600: - case 19200: - case 37600: - case 57600: - case 115200: - irport_start(idev, idev->io.iobase2); - irport_change_speed(idev, speed); - - /* Some magic to disable FIR and enable SIR */ - uircc_toshiba_cmd(&status, 0xffff, 0x001b, 0x0000); - - modem = UIRCC_CR10_SIR; - break; - case 576000: - - IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 576000\n"); - break; - case 1152000: - - IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 1152000\n"); - break; - case 4000000: - irport_stop(idev, idev->io.iobase2); - - /* Some magic to disable SIR and enable FIR */ - uircc_toshiba_cmd(&status, 0xffff, 0x001b, 0x0001); - - modem = UIRCC_CR10_FIR; - IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 4000000\n"); - - /* Set self pole address */ - //outb(0xfe, iobase+UIRCC_CR8); - - /* outb(0x10, iobase+UIRCC_CR11); */ - break; - default: - IRDA_DEBUG( 0, __FUNCTION__ "(), unknown baud rate of %d\n", speed); - break; - } - - /* Set appropriate speed mode */ - outb(modem, iobase+UIRCC_CR10); - - idev->netdev.tbusy = 0; - - /* Enable some interrupts so we can receive frames */ - if (speed > 115200) { - /* Enable DMA single mode */ - outb(UIRCC_CR1_RX_DMA|UIRCC_CR1_TX_DMA|UIRCC_CR1_MUST_SET, - iobase+UIRCC_CR1); - - /* Enable all interrupts */ - outb(0, iobase+UIRCC_CR2); - uircc_dma_receive(idev); - } -} - -/* - * Function uircc_hard_xmit (skb, dev) - * - * Transmit the frame! - * - */ -static int uircc_hard_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct irda_device *idev; - int iobase; - int mtt; - - idev = (struct irda_device *) dev->priv; - - ASSERT(idev != NULL, return 0;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return 0;); - - iobase = idev->io.iobase; - - IRDA_DEBUG(4, __FUNCTION__ "(%ld), skb->len=%d\n", jiffies, (int) skb->len); - - /* Reset carrier latch */ - /*outb(0x02, iobase+UIRCC_CR0);*/ - - /* Use irport for SIR speeds */ - if (idev->io.baudrate <= 115200) { - return irport_hard_xmit(skb, dev); - } - - IRDA_DEBUG(0, __FUNCTION__ "(), sr0=%#x, sr1=%#x, sr2=%#x, sr3=%#x, sr10=%#x, sr11=%#x\n", - inb(iobase+UIRCC_SR0), inb(iobase+UIRCC_SR3), - inb(iobase+UIRCC_SR2), inb(iobase+UIRCC_SR3), - inb(iobase+UIRCC_SR10), inb(iobase+UIRCC_SR11)); - - /* Lock transmit buffer */ - if (irda_lock((void *) &dev->tbusy) == FALSE) - return -EBUSY; - - memcpy(idev->tx_buff.data, skb->data, skb->len); - - /* Make sure that the length is a multiple of 16 bits */ - if (skb->len & 0x01) - skb->len++; - - idev->tx_buff.len = skb->len; - idev->tx_buff.data = idev->tx_buff.head; - - mtt = irda_get_mtt(skb); - - /* Use udelay for delays less than 50 us. */ - if (mtt) - udelay(mtt); - - /* Enable transmit interrupts */ - outb(0, iobase+UIRCC_CR2); - - uircc_dma_write(idev, iobase); - - dev_kfree_skb(skb); - - return 0; -} - -/* - * Function uircc_dma_write (idev, iobase) - * - * Transmit data using DMA - * - */ -static void uircc_dma_write(struct irda_device *idev, int iobase) -{ - struct uircc_cb *self; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - ASSERT(idev != NULL, return;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); - - self = idev->priv; - - /* Receiving disable */ - self->cr3 &= ~UIRCC_CR3_RECV_EN; - outb(self->cr3, iobase+UIRCC_CR3); - - /* Set modem */ - outb(0x80, iobase+UIRCC_CR10); - - /* Enable transmit DMA */ - outb(UIRCC_CR1_TX_DMA|UIRCC_CR1_MUST_SET, iobase+UIRCC_CR1); - - ASSERT((((__u32)(idev->tx_buff.data)) & 0x01) != 0x01, return;); - - setup_dma(idev->io.dma, idev->tx_buff.data, idev->tx_buff.len, - DMA_MODE_WRITE); - - idev->io.direction = IO_XMIT; - - /* Set frame length (should be the real length without padding */ - outb(idev->tx_buff.len & 0xff, iobase+UIRCC_CR4); /* Low byte */ - outb(idev->tx_buff.len >> 8, iobase+UIRCC_CR5); /* High byte */ - - /* Enable transmit and transmit CRC */ - self->cr3 |= (UIRCC_CR3_XMIT_EN|UIRCC_CR3_TX_CRC_EN); - outb(self->cr3, iobase+UIRCC_CR3); -} - -/* - * Function uircc_dma_xmit_complete (idev) - * - * The transfer of a frame in finished. This function will only be called - * by the interrupt handler - * - */ -static void uircc_dma_xmit_complete( struct irda_device *idev, int underrun) -{ - struct uircc_cb *self; - int iobase; - int len; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - ASSERT(idev != NULL, return;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); - - self = idev->priv; - - iobase = idev->io.iobase; - - /* Select TX counter */ - outb(UIRCC_CR0_CNT_SWT, iobase+UIRCC_CR0); - - /* Read TX length counter */ - len = inb(iobase+UIRCC_SR4); /* Low byte */ - len |= inb(iobase+UIRCC_SR5) << 8; /* High byte */ - - IRDA_DEBUG(4, __FUNCTION__ "(), sent %d bytes\n", len); - - /* Disable transmit */ - self->cr3 &= ~UIRCC_CR3_XMIT_EN; - outb(self->cr3, iobase+UIRCC_CR3); - - /* Transmit reset (just to be sure) */ - outb(UIRCC_CR0_XMIT_RST, iobase+UIRCC_CR0); - - /* Check for underrrun! */ - if (underrun) { - idev->stats.tx_errors++; - idev->stats.tx_fifo_errors++; - } else { - idev->stats.tx_packets++; - idev->stats.tx_bytes += idev->tx_buff.len; - } - - /* Unlock tx_buff and request another frame */ - idev->netdev.tbusy = 0; /* Unlock */ - idev->media_busy = FALSE; - - /* Tell the network layer, that we can accept more frames */ - mark_bh(NET_BH); -} - -/* - * Function uircc_dma_receive (idev) - * - * Get ready for receiving a frame. The device will initiate a DMA - * if it starts to receive a frame. - * - */ -static int uircc_dma_receive(struct irda_device *idev) -{ - struct uircc_cb *self; - int iobase; - - ASSERT(idev != NULL, return -1;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return -1;); - - IRDA_DEBUG(4, __FUNCTION__ "\n"); - - self = idev->priv; - iobase= idev->io.iobase; - - /* Transmit disable */ - /* self->cr3 &= ~UIRCC_CR3_XMIT_EN; */ - self->cr3 = 0; - outb(self->cr3, iobase+UIRCC_CR3); - - /* Transmit reset (just in case) */ - outb(UIRCC_CR0_XMIT_RST|0x17, iobase+UIRCC_CR0); - - /* Set modem */ - outb(0x08, iobase+UIRCC_CR10); - - /* Enable receiving with CRC */ - self->cr3 = (UIRCC_CR3_RECV_EN|UIRCC_CR3_RX_CRC_EN); - outb(self->cr3, iobase+UIRCC_CR3); - - /* Make sure Rx DMA is set */ - outb(UIRCC_CR1_RX_DMA|UIRCC_CR1_MUST_SET, iobase+UIRCC_CR1); - - /* Rx reset */ - /* outb(UIRCC_CR0_RECV_RST, iobase+UIRCC_CR0); */ - - setup_dma(idev->io.dma, idev->rx_buff.data, - idev->rx_buff.truesize, DMA_MODE_READ); - - /* driver->media_busy = FALSE; */ - idev->io.direction = IO_RECV; - idev->rx_buff.data = idev->rx_buff.head; - -#if 0 - /* Enable receiving with CRC */ - self->cr3 = (UIRCC_CR3_RECV_EN|UIRCC_CR3_RX_CRC_EN); - outb(self->cr3, iobase+UIRCC_CR3); -#endif - IRDA_DEBUG(4, __FUNCTION__ "(), cr3=%#x\n", self->cr3); - - /* Address check? */ - - return 0; -} - -/* - * Function uircc_dma_receive_complete (idev) - * - * Finished with receiving frames - * - * - */ -static int uircc_dma_receive_complete(struct irda_device *idev, int iobase) -{ - struct sk_buff *skb; - struct uircc_cb *self; - int len; - - self = idev->priv; - - IRDA_DEBUG(0, __FUNCTION__ "()\n"); - - /* Check for CRC or framing error */ - if (inb(iobase+UIRCC_SR0) & UIRCC_SR0_RX_CRCFRM) { - IRDA_DEBUG(0, __FUNCTION__ "(), CRC or FRAME error\n"); - return -1; - } - - /* Select receive length counter */ - outb(0x00, iobase+UIRCC_CR0); - - /* Read frame length */ - len = inb(iobase+UIRCC_SR4); /* Low byte */ - len |= inb(iobase+UIRCC_SR5) << 8; /* High byte */ - - IRDA_DEBUG(0, __FUNCTION__ "(), len=%d\n", len); - - /* Receiving disable */ - self->cr3 &= ~UIRCC_CR3_RECV_EN; - outb(self->cr3, iobase+UIRCC_CR3); - - skb = dev_alloc_skb(len+1); - if (skb == NULL) { - printk(KERN_INFO __FUNCTION__ - "(), memory squeeze, dropping frame.\n"); - /* Restore bank register */ - return FALSE; - } - - /* Make sure IP header gets aligned */ - skb_reserve(skb, 1); - - /* Copy frame without CRC */ - /* if ( idev->io.baudrate < 4000000) { */ -/* skb_put( skb, len-2); */ -/* memcpy( skb->data, idev->rx_buff.head, len-2); */ -/* } else { */ -/* skb_put( skb, len-4); */ -/* memcpy( skb->data, idev->rx_buff.head, len-4); */ -/* } */ - - skb_put(skb, len); - memcpy(skb->data, idev->rx_buff.data, len); - idev->stats.rx_packets++; - - skb->dev = &idev->netdev; - skb->mac.raw = skb->data; - skb->protocol = htons(ETH_P_IRDA); - netif_rx(skb); - - return TRUE; -} - -/* - * Function uircc_interrupt (irq, dev_id, regs) - * - * An interrupt from the chip has arrived. Time to do some work - * - */ -static void uircc_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - __u8 sr3; - int iobase; - - struct irda_device *idev = (struct irda_device *) dev_id; - - if (idev == NULL) { - printk( KERN_WARNING "%s: irq %d for unknown device.\n", - driver_name, irq); - return; - } - - if (idev->io.baudrate <= 115200) - return irport_interrupt( irq, dev_id, regs); - - iobase = idev->io.iobase; - - /* Read interrupt status */ - sr3 = inb( iobase+UIRCC_SR3); - if (!sr3) { - IRDA_DEBUG(4,"**\n"); - return; - } - idev->netdev.interrupt = 1; - - IRDA_DEBUG(4, __FUNCTION__ "(), sr3=%#x, sr2=%#x, sr10=%#x\n", - inb( iobase+UIRCC_SR3), inb( iobase+UIRCC_SR2), - inb( iobase+UIRCC_SR10)); - - /* - * Check what interrupt this is. The UIRCC will not report two - * different interrupts at the same time! - */ - switch(sr3) { - case UIRCC_SR3_RX_EOF: /* Check for end of frame */ - uircc_dma_receive_complete(idev, iobase); - break; - case UIRCC_SR3_TXUR: /* Check for transmit underrun */ - uircc_dma_xmit_complete(idev, TRUE); - uircc_dma_receive(idev); - outb(0, iobase+UIRCC_CR2); - break; - case UIRCC_SR3_TX_DONE: - uircc_dma_xmit_complete(idev, FALSE); - uircc_dma_receive(idev); - - outb(0x0d, iobase+UIRCC_CR2); - break; - case UIRCC_SR3_TMR_OUT: - /* Disable timer */ - outb(inb(iobase+UIRCC_CR11) & ~UIRCC_CR11_TMR_EN, - iobase+UIRCC_CR11); - break; - default: - IRDA_DEBUG(0, __FUNCTION__ "(), unknown interrupt status=%#x\n", - sr3); - break; - } - idev->netdev.interrupt = 0; -} - -/* - * Function uircc_wait_until_sent (idev) - * - * This function should put the current thread to sleep until all data - * have been sent, so it is safe to change the speed. - */ -static void uircc_wait_until_sent( struct irda_device *idev) -{ - /* Just delay 60 ms */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(MSECS_TO_JIFFIES(60)); -} - -/* - * Function uircc_is_receiving (idev) - * - * Return TRUE is we are currently receiving a frame - * - */ -static int uircc_is_receiving( struct irda_device *idev) -{ - int status = FALSE; - /* int iobase; */ - - ASSERT(idev != NULL, return FALSE;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return FALSE;); - - if (idev->io.baudrate > 115200) { - - } else - status = (idev->rx_buff.state != OUTSIDE_FRAME); - - return status; -} - -/* - * Function uircc_net_init (dev) - * - * Initialize network device - * - */ -static int uircc_net_init( struct net_device *dev) -{ - IRDA_DEBUG( 4, __FUNCTION__ "()\n"); - - /* Setup to be a normal IrDA network device driver */ - irda_device_setup(dev); - - /* Insert overrides below this line! */ - - return 0; -} - - -/* - * Function uircc_net_open (dev) - * - * Start the device - * - */ -static int uircc_net_open(struct net_device *dev) -{ - struct irda_device *idev; - int iobase; - - IRDA_DEBUG( 4, __FUNCTION__ "()\n"); - - ASSERT(dev != NULL, return -1;); - idev = (struct irda_device *) dev->priv; - - ASSERT(idev != NULL, return 0;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return 0;); - - iobase = idev->io.iobase; - - if (request_irq(idev->io.irq, uircc_interrupt, 0, idev->name, - (void *) idev)) { - return -EAGAIN; - } - /* - * Always allocate the DMA channel after the IRQ, - * and clean up on failure. - */ - if (request_dma(idev->io.dma, idev->name)) { - free_irq(idev->io.irq, idev); - return -EAGAIN; - } - - /* Ready to play! */ - irda_device_net_open(dev); - - /* turn on interrupts */ - - MOD_INC_USE_COUNT; - - return 0; -} - -/* - * Function uircc_net_close (dev) - * - * Stop the device - * - */ -static int uircc_net_close(struct net_device *dev) -{ - struct irda_device *idev; - int iobase; - - IRDA_DEBUG(4, __FUNCTION__ "()\n"); - - ASSERT(dev != NULL, return -1;); - idev = (struct irda_device *) dev->priv; - - ASSERT(idev != NULL, return 0;); - ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return 0;); - - iobase = idev->io.iobase; - - irda_device_net_close(dev); - - disable_dma(idev->io.dma); - - /* Disable interrupts */ - - free_irq(idev->io.irq, idev); - free_dma(idev->io.dma); - - MOD_DEC_USE_COUNT; - - return 0; -} - -/* - * Function uircc_toshiba_cmd (arg0, arg1, arg2) - * - * disable FIR: uircc_toshiba_cmd(&status, 0xffff, 0x001b, 0x0000); - * enable FIR: uircc_toshiba_cmd(&status, 0xffff, 0x001b, 0x0001); - * IRDA status: uircc_toshiba_cmd(&status, 0xfefe, 0x001b, 0x0000); - */ -static int uircc_toshiba_cmd(int *retval, int arg0, int arg1, int arg2) -{ - char return_code = 0; - - __asm__ volatile ("inb $0xb2,%%al; " - "movb %%ah,%%al; " - : /* Output */ - "=al" (return_code), - "=ecx" (*retval) - : /* Input */ - "ax" (arg0), - "bx" (arg1), - "cx" (arg2) - ); - /* - * Return - * 0x00 = OK - * 0x80 = Function not supported by system - * 0x83 = Input data error - */ - return (int) return_code; -} - -#ifdef MODULE - -/* - * Function init_module (void) - * - * - * - */ -int init_module(void) -{ - return uircc_init(); -} - -/* - * Function cleanup_module (void) - * - * - * - */ -void cleanup_module(void) -{ - uircc_cleanup(); -} -#endif /* MODULE */ - diff -u --recursive --new-file v2.3.25/linux/drivers/net/irda/w83977af_ir.c linux/drivers/net/irda/w83977af_ir.c --- v2.3.25/linux/drivers/net/irda/w83977af_ir.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/irda/w83977af_ir.c Tue Nov 2 17:07:08 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Paul VanderSpek * Created at: Wed Nov 4 11:46:16 1998 - * Modified at: Wed Oct 20 00:08:30 1999 + * Modified at: Sat Oct 30 16:24:32 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli @@ -933,7 +933,8 @@ /* Receive all characters in Rx FIFO */ do { byte = inb(iobase+RBR); - async_unwrap_char(self->netdev, &self->rx_buff, byte); + async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, + byte); } while (inb(iobase+USR) & USR_RDR); /* Data available */ } diff -u --recursive --new-file v2.3.25/linux/drivers/net/ppp_synctty.c linux/drivers/net/ppp_synctty.c --- v2.3.25/linux/drivers/net/ppp_synctty.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/net/ppp_synctty.c Tue Nov 2 17:07:08 1999 @@ -29,7 +29,7 @@ * PPP driver, written by Michael Callahan and Al Longyear, and * subsequently hacked by Paul Mackerras. * - * ==FILEVERSION 991014== + * ==FILEVERSION 991018== */ /* $Id: ppp_synctty.c,v 1.3 1999/09/02 05:30:10 paulus Exp $ */ @@ -97,6 +97,67 @@ }; /* + * Utility procedures to print a buffer in hex/ascii + */ +static void +ppp_print_hex (register __u8 * out, const __u8 * in, int count) +{ + register __u8 next_ch; + static char hex[] = "0123456789ABCDEF"; + + while (count-- > 0) { + next_ch = *in++; + *out++ = hex[(next_ch >> 4) & 0x0F]; + *out++ = hex[next_ch & 0x0F]; + ++out; + } +} + +static void +ppp_print_char (register __u8 * out, const __u8 * in, int count) +{ + register __u8 next_ch; + + while (count-- > 0) { + next_ch = *in++; + + if (next_ch < 0x20 || next_ch > 0x7e) + *out++ = '.'; + else { + *out++ = next_ch; + if (next_ch == '%') /* printk/syslogd has a bug !! */ + *out++ = '%'; + } + } + *out = '\0'; +} + +static void +ppp_print_buffer (const char *name, const __u8 *buf, int count) +{ + __u8 line[44]; + + if (name != NULL) + printk(KERN_DEBUG "ppp_synctty: %s, count = %d\n", name, count); + + while (count > 8) { + memset (line, 32, 44); + ppp_print_hex (line, buf, 8); + ppp_print_char (&line[8 * 3], buf, 8); + printk(KERN_DEBUG "%s\n", line); + count -= 8; + buf += 8; + } + + if (count > 0) { + memset (line, 32, 44); + ppp_print_hex (line, buf, count); + ppp_print_char (&line[8 * 3], buf, count); + printk(KERN_DEBUG "%s\n", line); + } +} + +/* * Routines for locking and unlocking the transmit and receive paths. */ static inline void @@ -523,6 +584,10 @@ */ islcp = proto == PPP_LCP && 1 <= data[2] && data[2] <= 7; + /* compress protocol field if option enabled */ + if (data[0] == 0 && (ap->flags & SC_COMP_PROT) && !islcp) + skb_pull(skb,1); + /* prepend address/control fields if necessary */ if ((ap->flags & SC_COMP_AC) == 0 || islcp) { if (skb_headroom(skb) < 2) { @@ -536,7 +601,7 @@ kfree_skb(skb); skb = npkt; } - skb_pull(skb,2); + skb_push(skb,2); skb->data[0] = PPP_ALLSTATIONS; skb->data[1] = PPP_UI; } @@ -545,6 +610,9 @@ break; } + if (skb && ap->flags & SC_LOG_OUTPKT) + ppp_print_buffer ("send buffer", skb->data, skb->len); + return skb; } @@ -567,7 +635,7 @@ if (test_and_set_bit(XMIT_FULL, &ap->busy)) return 0; /* already full */ - ap->tpkt = skb; + skb_queue_head(&ap->xq,skb); ppp_sync_push(ap); return 1; @@ -729,6 +797,9 @@ input_error(ap, *flags); return; } + + if (ap->flags & SC_LOG_INPKT) + ppp_print_buffer ("receive buffer", buf, count); /* stuff the chars in the skb */ if ((skb = ap->rpkt) == 0) { diff -u --recursive --new-file v2.3.25/linux/drivers/net/sis900.c linux/drivers/net/sis900.c --- v2.3.25/linux/drivers/net/sis900.c Thu Aug 26 13:05:38 1999 +++ linux/drivers/net/sis900.c Fri Nov 5 09:52:05 1999 @@ -1,58 +1,29 @@ -/*****************************************************************************/ -/* sis900.c: A SiS 900 PCI Fast Ethernet driver for Linux. */ -/* */ -/* Silicon Integrated System Corporation */ -/* Revision: 1.05 Aug 7 1999 */ -/* */ -/*****************************************************************************/ - -/* - Modified from the driver which is originally written by Donald Becker. - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - Drivers based on this skeleton fall under the GPL and must retain - the authorship (implicit copyright) notice. - - The author may be reached as becker@tidalwave.net, or - Donald Becker - 312 Severn Ave. #W302 - Annapolis MD 21403 - - Support and updates [to the original skeleton] available at - http://www.tidalwave.net/~becker/pci-skeleton.html +/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux. + Silicon Integrated System Corporation + Revision: 1.05 Aug 7 1999 + + Modified from the driver which is originally written by Donald Becker. + + This software may be used and distributed according to the terms + of the GNU Public License (GPL), incorporated herein by reference. + Drivers based on this skeleton fall under the GPL and must retain + the authorship (implicit copyright) notice. + + References: + SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, + preliminary Rev. 1.0 Jan. 14, 1998 + SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support, + preliminary Rev. 1.0 Nov. 10, 1998 + SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, + preliminary Rev. 1.0 Jan. 18, 1998 + http://www.sis.com.tw/support/databook.htm + + Rev 1.06 Nov. 4 1999 Ollie Lho (ollie@sis.com.tw) Second release + Rev 1.05.05 Oct. 29 1999 Ollie Lho (ollie@sis.com.tw) Single buffer Tx/Rx + Chin-Shan Li (lcs@sis.com.tw) Added AMD Am79c901 HomePNA PHY support + Rev 1.05 Aug. 7 1999 Jim Huang (cmhuang@sis.com.tw) Initial release */ -static const char *version = -"sis900.c:v1.05 8/07/99\n"; - -static int max_interrupt_work = 20; -#define sis900_debug debug -static int sis900_debug = 0; - -static int multicast_filter_limit = 128; - -#define MAX_UNITS 8 /* More are supported, limit only on options */ -static int speeds[MAX_UNITS] = {100, 100, 100, 100, 100, 100, 100, 100}; -static int full_duplex[MAX_UNITS] = {1, 1, 1, 1, 1, 1, 1, 1}; - -#define TX_BUF_SIZE 1536 -#define RX_BUF_SIZE 1536 - -#define TX_DMA_BURST 0 -#define RX_DMA_BURST 0 -#define TX_FIFO_THRESH 16 -#define TxDRNT_100 (1536>>5) -#define TxDRNT_10 16 -#define RxDRNT_100 8 -#define RxDRNT_10 8 -#define TRUE 1 -#define FALSE 0 - -/* Operational parameters that usually are not changed. */ -/* Time in jiffies before concluding the transmitter is hung. */ -#define TX_TIMEOUT (4*HZ) - #include #include #include @@ -65,1845 +36,1244 @@ #include #include #include + #include #include #include /* Processor type for cache alignment. */ #include #include +#include -#define RUN_AT(x) (jiffies + (x)) +#include "sis900.h" -#include +static const char *version = +"sis900.c: v1.06 11/04/99\n"; -#if LINUX_VERSION_CODE < 0x20123 -#define test_and_set_bit(val, addr) set_bit(val, addr) -#endif -#if LINUX_VERSION_CODE <= 0x20139 -#define net_device_stats enet_statistics -#else -#define NETSTATS_VER2 -#endif -#if LINUX_VERSION_CODE < 0x20155 || defined(CARDBUS) -/* Grrrr, the PCI code changed, but did not consider CardBus... */ -#include -#define PCI_SUPPORT_VER1 -#else -#define PCI_SUPPORT_VER2 -#endif -#if LINUX_VERSION_CODE < 0x20159 -#define dev_free_skb(skb) dev_kfree_skb(skb, FREE_WRITE); -#else -#define dev_free_skb(skb) dev_kfree_skb(skb); -#endif +static int max_interrupt_work = 20; +#define sis900_debug debug +static int sis900_debug = 0; -/* The I/O extent. */ -#define SIS900_TOTAL_SIZE 0x100 +static int multicast_filter_limit = 128; -/* This table drives the PCI probe routines. It's mostly boilerplate in all - of the drivers, and will likely be provided by some future kernel. - Note the matching code -- the first table entry matchs all 56** cards but - second only the 1234 card. -*/ +/* Time in jiffies before concluding the transmitter is hung. */ +#define TX_TIMEOUT (4*HZ) -enum pci_flags_bit { - PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, +struct mac_chip_info { + const char *name; + u16 vendor_id, device_id, flags; + int io_size; + struct net_device *(*probe) (struct mac_chip_info *mac, struct pci_dev * pci_dev, + struct net_device * net_dev); }; +static struct net_device * sis900_mac_probe (struct mac_chip_info * mac, struct pci_dev * pci_dev, + struct net_device * net_dev); -struct pci_id_info { - const char *name; - u16 vendor_id, device_id, device_id_mask, flags; - int io_size; - struct net_device *(*probe1)(int pci_bus, int pci_devfn, struct net_device *dev, - long ioaddr, int irq, int chip_idx, int fnd_cnt); +static struct mac_chip_info mac_chip_table[] = { + { "SiS 900 PCI Fast Ethernet", PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_900, + PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE, sis900_mac_probe}, + { "SiS 7016 PCI Fast Ethernet",PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7016, + PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE, sis900_mac_probe}, + {0,}, /* 0 terminated list. */ }; -static struct net_device * sis900_probe1(int pci_bus, int pci_devfn, - struct net_device *dev, long ioaddr, - int irq, int chp_idx, int fnd_cnt); - -static struct pci_id_info pci_tbl[] = -{{ "SiS 900 PCI Fast Ethernet", - 0x1039, 0x0900, 0xffff, PCI_USES_IO|PCI_USES_MASTER, 0x100, sis900_probe1}, - { "SiS 7016 PCI Fast Ethernet", - 0x1039, 0x7016, 0xffff, PCI_USES_IO|PCI_USES_MASTER, 0x100, sis900_probe1}, - {0,}, /* 0 terminated list. */ -}; +static void sis900_read_mode(struct net_device *net_dev, int phy_addr, int *speed, int *duplex); +static void amd79c901_read_mode(struct net_device *net_dev, int phy_addr, int *speed, int *duplex); -/* The capability table matches the chip table above. */ -enum {HAS_MII_XCVR=0x01, HAS_CHIP_XCVR=0x02, HAS_LNK_CHNG=0x04}; -static int sis_cap_tbl[] = { - HAS_MII_XCVR|HAS_CHIP_XCVR|HAS_LNK_CHNG, - HAS_MII_XCVR|HAS_CHIP_XCVR|HAS_LNK_CHNG, +static struct mii_chip_info { + const char * name; + u16 phy_id0; + u16 phy_id1; + void (*read_mode) (struct net_device *net_dev, int phy_addr, int *speed, int *duplex); +} mii_chip_table[] = { + {"SiS 900 Internal MII PHY", 0x001d, 0x8000, sis900_read_mode}, + {"SiS 7014 Physical Layer Solution", 0x0016, 0xf830,sis900_read_mode}, + {"AMD 79C901 10BASE-T PHY", 0x0000, 0x35b9, amd79c901_read_mode}, + {"AMD 79C901 HomePNA PHY", 0x0000, 0x35c8, amd79c901_read_mode}, + {0,}, }; -/* The rest of these values should never change. */ -#define NUM_TX_DESC 16 /* Number of Tx descriptor registers. */ -#define NUM_RX_DESC 8 /* Number of Rx descriptor registers. */ - -/* Symbolic offsets to registers. */ -enum SIS900_registers { - cr=0x0, //Command Register - cfg=0x4, //Configuration Register - mear=0x8, //EEPROM Access Register - ptscr=0xc, //PCI Test Control Register - isr=0x10, //Interrupt Status Register - imr=0x14, //Interrupt Mask Register - ier=0x18, //Interrupt Enable Register - epar=0x18, //Enhanced PHY Access Register - txdp=0x20, //Transmit Descriptor Pointer Register - txcfg=0x24, //Transmit Configuration Register - rxdp=0x30, //Receive Descriptor Pointer Register - rxcfg=0x34, //Receive Configuration Register - flctrl=0x38, //Flow Control Register - rxlen=0x3c, //Receive Packet Length Register - rfcr=0x48, //Receive Filter Control Register - rfdr=0x4C, //Receive Filter Data Register - pmctrl=0xB0, //Power Management Control Register - pmer=0xB4 //Power Management Wake-up Event Register +struct mii_phy { + struct mii_phy * next; + struct mii_chip_info * chip_info; + int phy_addr; + u16 status; }; -#define RESET 0x00000100 -#define SWI 0x00000080 -#define RxRESET 0x00000020 -#define TxRESET 0x00000010 -#define RxDIS 0x00000008 -#define RxENA 0x00000004 -#define TxDIS 0x00000002 -#define TxENA 0x00000001 - -#define BISE 0x80000000 -#define EUPHCOM 0x00000100 -#define REQALG 0x00000080 -#define SB 0x00000040 -#define POW 0x00000020 -#define EXD 0x00000010 -#define PESEL 0x00000008 -#define LPM 0x00000004 -#define BEM 0x00000001 - -/* Interrupt register bits, using my own meaningful names. */ -#define WKEVT 0x10000000 -#define TxPAUSEEND 0x08000000 -#define TxPAUSE 0x04000000 -#define TxRCMP 0x02000000 -#define RxRCMP 0x01000000 -#define DPERR 0x00800000 -#define SSERR 0x00400000 -#define RMABT 0x00200000 -#define RTABT 0x00100000 -#define RxSOVR 0x00010000 -#define HIBERR 0x00008000 -#define SWINT 0x00001000 -#define MIBINT 0x00000800 -#define TxURN 0x00000400 -#define TxIDLE 0x00000200 -#define TxERR 0x00000100 -#define TxDESC 0x00000080 -#define TxOK 0x00000040 -#define RxORN 0x00000020 -#define RxIDLE 0x00000010 -#define RxEARLY 0x00000008 -#define RxERR 0x00000004 -#define RxDESC 0x00000002 -#define RxOK 0x00000001 - -#define IE 0x00000001 - -#define TxCSI 0x80000000 -#define TxHBI 0x40000000 -#define TxMLB 0x20000000 -#define TxATP 0x10000000 -#define TxIFG 0x0C000000 -#define TxMXF 0x03800000 -#define TxMXF_shift 0x23 -#define TxMXDMA 0x00700000 -#define TxMXDMA_shift 20 -#define TxRTCNT 0x000F0000 -#define TxRTCNT_shift 16 -#define TxFILLT 0x00007F00 -#define TxFILLT_shift 8 -#define TxDRNT 0x0000007F - -#define RxAEP 0x80000000 -#define RxARP 0x40000000 -#define RxATP 0x10000000 -#define RxAJAB 0x08000000 -#define RxMXF 0x03800000 -#define RxMXF_shift 23 -#define RxMXDMA 0x00700000 -#define RxMXDMA_shift 20 -#define RxDRNT 0x0000007F - -#define RFEN 0x80000000 -#define RFAAB 0x40000000 -#define RFAAM 0x20000000 -#define RFAAP 0x10000000 -#define RFPromiscuous (RFAAB|RFAAM|RFAAP) -#define RFAA_shift 28 -#define RFEP 0x00070000 -#define RFEP_shift 16 - -#define RFDAT 0x0000FFFF - -#define OWN 0x80000000 -#define MORE 0x40000000 -#define INTR 0x20000000 -#define OK 0x08000000 -#define DSIZE 0x00000FFF - -#define SUPCRC 0x10000000 -#define ABORT 0x04000000 -#define UNDERRUN 0x02000000 -#define NOCARRIER 0x01000000 -#define DEFERD 0x00800000 -#define EXCDEFER 0x00400000 -#define OWCOLL 0x00200000 -#define EXCCOLL 0x00100000 -#define COLCNT 0x000F0000 - -#define INCCRC 0x10000000 -// ABORT 0x04000000 -#define OVERRUN 0x02000000 -#define DEST 0x01800000 -#define BCAST 0x01800000 -#define MCAST 0x01000000 -#define UNIMATCH 0x00800000 -#define TOOLONG 0x00400000 -#define RUNT 0x00200000 -#define RXISERR 0x00100000 -#define CRCERR 0x00080000 -#define FAERR 0x00040000 -#define LOOPBK 0x00020000 -#define RXCOL 0x00010000 - -#define EuphLiteEEMACAddr 0x08 -#define EuphLiteEEVendorID 0x02 -#define EuphLiteEEDeviceID 0x03 -#define EuphLiteEECardTypeRev 0x0b -#define EuphLiteEEPlexusRev 0x0c -#define EuphLiteEEChecksum 0x0f - -#define RXSTS_shift 18 -#define OWN 0x80000000 -#define MORE 0x40000000 -#define INTR 0x20000000 -#define OK 0x08000000 -#define DSIZE 0x00000FFF -/* MII register offsets */ -#define MII_CONTROL 0x0000 -#define MII_STATUS 0x0001 -#define MII_PHY_ID0 0x0002 -#define MII_PHY_ID1 0x0003 -#define MII_ANAR 0x0004 -#define MII_ANLPAR 0x0005 -#define MII_ANER 0x0006 -/* MII Control register bit definitions. */ -#define MIICNTL_FDX 0x0100 -#define MIICNTL_RST_AUTO 0x0200 -#define MIICNTL_ISOLATE 0x0400 -#define MIICNTL_PWRDWN 0x0800 -#define MIICNTL_AUTO 0x1000 -#define MIICNTL_SPEED 0x2000 -#define MIICNTL_LPBK 0x4000 -#define MIICNTL_RESET 0x8000 -/* MII Status register bit significance. */ -#define MIISTAT_EXT 0x0001 -#define MIISTAT_JAB 0x0002 -#define MIISTAT_LINK 0x0004 -#define MIISTAT_CAN_AUTO 0x0008 -#define MIISTAT_FAULT 0x0010 -#define MIISTAT_AUTO_DONE 0x0020 -#define MIISTAT_CAN_T 0x0800 -#define MIISTAT_CAN_T_FDX 0x1000 -#define MIISTAT_CAN_TX 0x2000 -#define MIISTAT_CAN_TX_FDX 0x4000 -#define MIISTAT_CAN_T4 0x8000 -/* MII NWAY Register Bits ... -** valid for the ANAR (Auto-Negotiation Advertisement) and -** ANLPAR (Auto-Negotiation Link Partner) registers */ -#define MII_NWAY_NODE_SEL 0x001f -#define MII_NWAY_CSMA_CD 0x0001 -#define MII_NWAY_T 0x0020 -#define MII_NWAY_T_FDX 0x0040 -#define MII_NWAY_TX 0x0080 -#define MII_NWAY_TX_FDX 0x0100 -#define MII_NWAY_T4 0x0200 -#define MII_NWAY_RF 0x2000 -#define MII_NWAY_ACK 0x4000 -#define MII_NWAY_NP 0x8000 - -/* MII Auto-Negotiation Expansion Register Bits */ -#define MII_ANER_PDF 0x0010 -#define MII_ANER_LP_NP_ABLE 0x0008 -#define MII_ANER_NP_ABLE 0x0004 -#define MII_ANER_RX_PAGE 0x0002 -#define MII_ANER_LP_AN_ABLE 0x0001 -#define HALF_DUPLEX 1 -#define FDX_CAPABLE_DUPLEX_UNKNOWN 2 -#define FDX_CAPABLE_HALF_SELECTED 3 -#define FDX_CAPABLE_FULL_SELECTED 4 -#define HW_SPEED_UNCONFIG 0 -#define HW_SPEED_10_MBPS 10 -#define HW_SPEED_100_MBPS 100 -#define HW_SPEED_DEFAULT (HW_SPEED_10_MBPS) - -#define ACCEPT_ALL_PHYS 0x01 -#define ACCEPT_ALL_MCASTS 0x02 -#define ACCEPT_ALL_BCASTS 0x04 -#define ACCEPT_ALL_ERRORS 0x08 -#define ACCEPT_CAM_QUALIFIED 0x10 -#define MAC_LOOPBACK 0x20 -//#define FDX_CAPABLE_FULL_SELECTED 4 -#define CRC_SIZE 4 -#define MAC_HEADER_SIZE 14 - -typedef struct _EuphLiteDesc { - u32 llink; - unsigned char* buf; - u32 physAddr; - /* Hardware sees the physical address of descriptor */ - u32 plink; - u32 cmdsts; - u32 bufPhys; -} EuphLiteDesc; +typedef struct _BufferDesc { + u32 link; + u32 cmdsts; + u32 bufptr; +} BufferDesc; struct sis900_private { - char devname[8]; /* Used only for kernel debugging. */ - const char *product_name; - struct net_device *next_module; - int chip_id; - int chip_revision; - unsigned char pci_bus, pci_devfn; -#if LINUX_VERSION_CODE > 0x20139 - struct net_device_stats stats; -#else - struct enet_statistics stats; -#endif - struct timer_list timer; /* Media selection timer. */ - unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */ - unsigned int cur_tx, dirty_tx, tx_flag; - - /* The saved address of a sent-in-place packet/buffer, for skfree(). */ - struct sk_buff* tx_skbuff[NUM_TX_DESC]; - EuphLiteDesc tx_buf[NUM_TX_DESC]; /* Tx bounce buffers */ - EuphLiteDesc rx_buf[NUM_RX_DESC]; - unsigned char *rx_bufs; - unsigned char *tx_bufs; /* Tx bounce buffer region. */ - char phys[4]; /* MII device addresses. */ - int phy_idx; /* Support Max 4 PHY */ - u16 pmd_status; - unsigned int tx_full; /* The Tx queue is full. */ - int MediaSpeed; /* user force speed */ - int MediaDuplex; /* user force duplex */ - int full_duplex; /* Full/Half-duplex. */ - int speeds; /* 100/10 Mbps. */ - u16 LinkOn; - u16 LinkChange; + struct net_device *next_module; + struct net_device_stats stats; + struct pci_dev * pci_dev; + + struct mac_chip_info * mac; + struct mii_phy * mii; + unsigned int cur_phy; + + struct timer_list timer; /* Link status detection timer. */ + unsigned int cur_rx, dirty_rx; + unsigned int cur_tx, dirty_tx; + + /* The saved address of a sent/receive-in-place packet buffer */ + struct sk_buff *tx_skbuff[NUM_TX_DESC]; + struct sk_buff *rx_skbuff[NUM_RX_DESC]; + BufferDesc tx_ring[NUM_TX_DESC]; + BufferDesc rx_ring[NUM_RX_DESC]; + unsigned int tx_full; /* The Tx queue is full. */ + + int LinkOn; }; #ifdef MODULE #if LINUX_VERSION_CODE > 0x20115 MODULE_AUTHOR("Jim Huang "); MODULE_DESCRIPTION("SiS 900 PCI Fast Ethernet driver"); -MODULE_PARM(speeds, "1-" __MODULE_STRING(MAX_UNITS) "i"); -MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i"); MODULE_PARM(multicast_filter_limit, "i"); MODULE_PARM(max_interrupt_work, "i"); MODULE_PARM(debug, "i"); #endif #endif -static int sis900_open(struct net_device *dev); +static int sis900_open(struct net_device *net_dev); +static int sis900_mii_probe (struct net_device * net_dev); +static void sis900_init_rxfilter (struct net_device * net_dev); static u16 read_eeprom(long ioaddr, int location); -static int mdio_read(struct net_device *dev, int phy_id, int location); -static void mdio_write(struct net_device *dev, int phy_id, int location, int val); +static u16 mdio_read(struct net_device *net_dev, int phy_id, int location); +static void mdio_write(struct net_device *net_dev, int phy_id, int location, int val); static void sis900_timer(unsigned long data); -static void sis900_tx_timeout(struct net_device *dev); -static void sis900_init_ring(struct net_device *dev); -static int sis900_start_xmit(struct sk_buff *skb, struct net_device *dev); -static int sis900_rx(struct net_device *dev); +static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_phy); +static void sis900_tx_timeout(struct net_device *net_dev); +static void sis900_init_tx_ring(struct net_device *net_dev); +static void sis900_init_rx_ring(struct net_device *net_dev); +static int sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev); +static int sis900_rx(struct net_device *net_dev); +static void sis900_finish_xmit (struct net_device *net_dev); static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs); -static int sis900_close(struct net_device *dev); -static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static struct enet_statistics *sis900_get_stats(struct net_device *dev); -static void set_rx_mode(struct net_device *dev); -static void sis900_reset(struct net_device *dev); -static u16 elAutoNegotiate(struct net_device *dev, int phy_id, int *duplex, int *speed); -static void elSetCapability(struct net_device *dev, int phy_id, int duplex, int speed); -static u16 elPMDreadMode(struct net_device *dev, int phy_id, int *speed, int *duplex); -static u16 elMIIpollBit(struct net_device *dev, int phy_id, int location, u16 mask, u16 polarity, u16 *value); -static void elSetMediaType(struct net_device *dev, int speed, int duplex); +static int sis900_close(struct net_device *net_dev); +static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd); +static struct enet_statistics *sis900_get_stats(struct net_device *net_dev); +static u16 sis900_compute_hashtable_index(u8 *addr); +static void set_rx_mode(struct net_device *net_dev); +static void sis900_reset(struct net_device *net_dev); /* A list of all installed SiS900 devices, for removing the driver module. */ static struct net_device *root_sis900_dev = NULL; -/* Ideally we would detect all network cards in slot order. That would - be best done a central PCI probe dispatch, which wouldn't work - well when dynamically adding drivers. So instead we detect just the - SiS 900 cards in slot order. */ - -int sis900_probe(struct net_device *dev) -{ - int cards_found = 0; - int pci_index = 0; - unsigned char pci_bus, pci_device_fn; - - if ( ! pcibios_present()) - return -ENODEV; - - for (;pci_index < 0xff; pci_index++) { - u16 vendor, device, pci_command, new_command; - int chip_idx, irq; - long ioaddr; - - if (pcibios_find_class (PCI_CLASS_NETWORK_ETHERNET << 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); - - for (chip_idx = 0; pci_tbl[chip_idx].vendor_id; chip_idx++) - if (vendor == pci_tbl[chip_idx].vendor_id && - (device & pci_tbl[chip_idx].device_id_mask) == - pci_tbl[chip_idx].device_id) - break; - if (pci_tbl[chip_idx].vendor_id == 0) /* Compiled out! */ - continue; - - { - struct pci_dev *pdev = pci_find_slot(pci_bus, pci_device_fn); - ioaddr = pdev->resource[0].start; - irq = pdev->irq; - } - - if ((pci_tbl[chip_idx].flags & PCI_USES_IO) && - check_region(ioaddr, pci_tbl[chip_idx].io_size)) - continue; - - /* Activate the card: fix for brain-damaged Win98 BIOSes. */ - pcibios_read_config_word(pci_bus, pci_device_fn, - PCI_COMMAND, &pci_command); - new_command = pci_command | (pci_tbl[chip_idx].flags & 7); - if (pci_command != new_command) { - printk(KERN_INFO " The PCI BIOS has not enabled the" - " device at %d/%d!" - "Updating PCI command %4.4x->%4.4x.\n", - pci_bus, pci_device_fn, - pci_command, new_command); - - pcibios_write_config_word(pci_bus, pci_device_fn, - PCI_COMMAND, new_command); - } - - dev = pci_tbl[chip_idx].probe1(pci_bus, - pci_device_fn, - dev, - ioaddr, - irq, - chip_idx, - cards_found); - - if (dev && (pci_tbl[chip_idx].flags & PCI_COMMAND_MASTER)) { - u8 pci_latency; - - pcibios_read_config_byte(pci_bus, pci_device_fn, - PCI_LATENCY_TIMER, &pci_latency); - - if (pci_latency < 32) { - printk(KERN_NOTICE " PCI latency timer (CFLT) is " - "unreasonably low at %d. Setting to 64 clocks.\n", - pci_latency); - pcibios_write_config_byte(pci_bus, pci_device_fn, - PCI_LATENCY_TIMER, 64); - } - } - dev = 0; - cards_found++; - } - return cards_found ? 0 : -ENODEV; -} - -static struct net_device * sis900_probe1( int pci_bus, - int pci_devfn, - struct net_device *dev, - long ioaddr, - int irq, - int chip_idx, - int found_cnt) -{ - static int did_version = 0; /* Already printed version info. */ - struct sis900_private *tp; - u16 status; - int duplex = found_cnt < MAX_UNITS ? full_duplex[found_cnt] : 0 ; - int speed = found_cnt < MAX_UNITS ? speeds[found_cnt] : 0 ; - int phy=0, phy_idx=0, i; - - if (did_version++ == 0) - printk(KERN_INFO "%s", version); - - dev = init_etherdev(dev, 0); - - if(dev==NULL) - return NULL; - - printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", - dev->name, pci_tbl[chip_idx].name, ioaddr, irq); - - if ((u16)read_eeprom(ioaddr, EuphLiteEEVendorID) != 0xffff) { - for (i = 0; i < 3; i++) - ((u16 *)(dev->dev_addr))[i] = - read_eeprom(ioaddr,i+EuphLiteEEMACAddr); - for (i = 0; i < 5; i++) - printk("%2.2x:", (u8)dev->dev_addr[i]); - printk("%2.2x.\n", dev->dev_addr[i]); - } else - printk(KERN_INFO "Error EEPROM read\n"); - - /* We do a request_region() to register /proc/ioports info. */ - request_region(ioaddr, pci_tbl[chip_idx].io_size, dev->name); - - dev->base_addr = ioaddr; - dev->irq = irq; - - /* Some data structures must be quadword aligned. */ - tp = kmalloc(sizeof(*tp), GFP_KERNEL | GFP_DMA); - if(tp==NULL) - { - release_region(ioaddr, pci_tbl[chip_idx].io_size); - return NULL; - } - memset(tp, 0, sizeof(*tp)); - dev->priv = tp; - - tp->next_module = root_sis900_dev; - root_sis900_dev = dev; - - tp->chip_id = chip_idx; - tp->pci_bus = pci_bus; - tp->pci_devfn = pci_devfn; - - /* Find the connected MII xcvrs. - Doing this in open() would allow detecting external xcvrs later, but - takes too much time. */ - if (sis_cap_tbl[chip_idx] & HAS_MII_XCVR) { - for (phy = 0, phy_idx = 0; - phy < 32 && phy_idx < sizeof(tp->phys); phy++) - { - int mii_status ; - mii_status = mdio_read(dev, phy, MII_STATUS); - - if (mii_status != 0xffff && mii_status != 0x0000) { - tp->phy_idx = phy_idx; - tp->phys[phy_idx++] = phy; - tp->pmd_status=mdio_read(dev, phy, MII_STATUS); - printk(KERN_INFO "%s: MII transceiver found " - "at address %d.\n", - dev->name, phy); - break; - } - } - - if (phy_idx == 0) { - printk(KERN_INFO "%s: No MII transceivers found!\n", - dev->name); - tp->phys[0] = -1; - tp->pmd_status = 0; - } - } else { - tp->phys[0] = -1; - tp->pmd_status = 0; - } - - if ((tp->pmd_status > 0) && (phy_idx > 0)) { - if (sis900_debug > 1) { - printk(KERN_INFO "duplex=%d, speed=%d\n", - duplex, speed); +/* walk through every ethernet PCI devices to see if some of them are matched with our card list*/ +int sis900_probe (struct net_device * net_dev) +{ + int found = 0; + struct pci_dev * pci_dev = NULL; + + if (!pci_present()) + return -ENODEV; + + while ((pci_dev = pci_find_class (PCI_CLASS_NETWORK_ETHERNET << 8, pci_dev)) != NULL) { + /* pci_dev contains all ethernet devices */ + u32 pci_io_base; + struct mac_chip_info * mac; + + for (mac = mac_chip_table; mac->vendor_id; mac++) { + /* try to match our card list */ + if (pci_dev->vendor == mac->vendor_id && + pci_dev->device == mac->device_id) + break; } - if (!duplex && !speed) { - // auto-config media type - // Set full capability - if (sis900_debug > 1) { - printk(KERN_INFO "Auto Config ...\n"); - } - elSetCapability(dev, tp->phys[tp->phy_idx], 1, 100); - tp->pmd_status=elAutoNegotiate(dev, - tp->phys[tp->phy_idx], - &tp->full_duplex, - &tp->speeds); - } else { - tp->MediaSpeed = speed; - tp->MediaDuplex = duplex; - elSetCapability(dev, tp->phys[tp->phy_idx], - duplex, speed); - elAutoNegotiate(dev, tp->phys[tp->phy_idx], - &tp->full_duplex, - &tp->speeds); - status = mdio_read(dev, phy, MII_ANLPAR); - if ( !(status & (MII_NWAY_T | MII_NWAY_T_FDX | - MII_NWAY_TX | MII_NWAY_TX_FDX ))) - { - u16 cmd=0; - cmd |= ( speed == 100 ? - MIICNTL_SPEED : 0 ); - cmd |= ( duplex ? MIICNTL_FDX : 0 ); - mdio_write(dev, phy, MII_CONTROL, cmd); - elSetMediaType(dev, speed==100 ? - HW_SPEED_100_MBPS : - HW_SPEED_10_MBPS, - duplex ? - FDX_CAPABLE_FULL_SELECTED: - FDX_CAPABLE_HALF_SELECTED); - elMIIpollBit(dev, phy, MII_STATUS, - MIISTAT_LINK, TRUE, &status); - } else { - status = mdio_read(dev, phy, MII_STATUS); - } + + if (mac->vendor_id == 0) + /* pci_dev does not match any of our cards */ + continue; + + /* now, pci_dev should be either 900 or 7016 */ + pci_io_base = pci_dev->resource[0].start; + if ((mac->flags & PCI_COMMAND_IO ) && + check_region(pci_io_base, mac->io_size)) + continue; + + /* setup various bits in PCI command register */ + pci_set_master(pci_dev); + + /* do the real low level jobs */ + net_dev = mac->probe(mac, pci_dev, net_dev); + + if (net_dev != NULL) { + found++; } + net_dev = NULL; + } + return found ? 0 : -ENODEV; +} + +static struct net_device * sis900_mac_probe (struct mac_chip_info * mac, struct pci_dev * pci_dev, + struct net_device * net_dev) +{ + struct sis900_private *sis_priv; + long ioaddr = pci_dev->resource[0].start; + int irq = pci_dev->irq; + static int did_version = 0; + u16 signature; + int i; + + if (did_version++ == 0) + printk(KERN_INFO "%s", version); + + /* check to see if we have sane EEPROM */ + signature = (u16) read_eeprom(ioaddr, EEPROMSignature); + if (signature == 0xffff || signature == 0x0000) { + printk (KERN_INFO "%s: Error EERPOM read %x\n", + net_dev->name, signature); + return NULL; + } + + if ((net_dev = init_etherdev(net_dev, 0)) == NULL) + return NULL; + + printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name, mac->name, + ioaddr, irq); + + /* get MAC address from EEPROM */ + for (i = 0; i < 3; i++) + ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr); + for (i = 0; i < 5; i++) + printk("%2.2x:", (u8)net_dev->dev_addr[i]); + printk("%2.2x.\n", net_dev->dev_addr[i]); + + if ((net_dev->priv = kmalloc(sizeof(struct sis900_private), GFP_KERNEL)) == NULL) { + unregister_netdevice(net_dev); + return NULL; + } + + sis_priv = net_dev->priv; + memset(sis_priv, 0, sizeof(struct sis900_private)); + + /* We do a request_region() to register /proc/ioports info. */ + request_region(ioaddr, mac->io_size, net_dev->name); + net_dev->base_addr = ioaddr; + net_dev->irq = irq; + sis_priv->pci_dev = pci_dev; + sis_priv->mac = mac; + + /* probe for mii transciver */ + if (sis900_mii_probe(net_dev) == 0) { + unregister_netdev(net_dev); + kfree(sis_priv); + release_region(ioaddr, mac->io_size); + return NULL; + } + + sis_priv->next_module = root_sis900_dev; + root_sis900_dev = net_dev; + + /* The SiS900-specific entries in the device structure. */ + net_dev->open = &sis900_open; + net_dev->hard_start_xmit = &sis900_start_xmit; + net_dev->stop = &sis900_close; + net_dev->get_stats = &sis900_get_stats; + net_dev->set_multicast_list = &set_rx_mode; + net_dev->do_ioctl = &mii_ioctl; - if (tp->pmd_status & MIISTAT_LINK) - tp->LinkOn = TRUE; - else - tp->LinkOn = FALSE; + return net_dev; +} - tp->LinkChange = FALSE; +static int sis900_mii_probe (struct net_device * net_dev) +{ + struct sis900_private * sis_priv = (struct sis900_private *)net_dev->priv; + int phy_addr; - } + sis_priv->mii = NULL; + + /* search for total of 32 possible mii phy addresses */ + for (phy_addr = 0; phy_addr < 32; phy_addr++) { + u16 mii_status; + u16 phy_id0, phy_id1; + int i; + + mii_status = mdio_read(net_dev, phy_addr, MII_STATUS); + if (mii_status == 0xffff || mii_status == 0x0000) + /* the mii is not accessable, try next one */ + continue; + + phy_id0 = mdio_read(net_dev, phy_addr, MII_PHY_ID0); + phy_id1 = mdio_read(net_dev, phy_addr, MII_PHY_ID1); + + /* search our mii table for the current mii */ + for (i = 0; mii_chip_table[i].phy_id1; i++) + if (phy_id0 == mii_chip_table[i].phy_id0) { + struct mii_phy * mii_phy; + + printk(KERN_INFO + "%s: %s transceiver found at address %d.\n", + net_dev->name, mii_chip_table[i].name, + phy_addr);; + if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) != NULL) { + mii_phy->chip_info = mii_chip_table+i; + mii_phy->phy_addr = phy_addr; + mii_phy->status = mdio_read(net_dev, phy_addr, + MII_STATUS); + mii_phy->next = sis_priv->mii; + sis_priv->mii = mii_phy; + } + /* the current mii is on our mii_info_table, + try next address */ + break; + } + } + + if (sis_priv->mii == NULL) { + printk(KERN_INFO "%s: No MII transceivers found!\n", + net_dev->name); + return 0; + } - if (sis900_debug > 1) { - if (tp->full_duplex == FDX_CAPABLE_FULL_SELECTED) { - printk(KERN_INFO "%s: Media type is Full Duplex.\n", - dev->name); - } else { - printk(KERN_INFO "%s: Media type is Half Duplex.\n", - dev->name); - } - if (tp->speeds == HW_SPEED_100_MBPS) { - printk(KERN_INFO "%s: Speed is 100mbps.\n", dev->name); - } else { - printk(KERN_INFO "%s: Speed is 10mbps.\n", dev->name); - } - } - - /* The SiS900-specific entries in the device structure. */ - dev->open = &sis900_open; - dev->hard_start_xmit = &sis900_start_xmit; - dev->stop = &sis900_close; - dev->get_stats = &sis900_get_stats; - dev->set_multicast_list = &set_rx_mode; - dev->do_ioctl = &mii_ioctl; - - return dev; -} - -/* Serial EEPROM section. */ - -/* EEPROM_Ctrl bits. */ -#define EECLK 0x00000004 /* EEPROM shift clock. */ -#define EECS 0x00000008 /* EEPROM chip select. */ -#define EEDO 0x00000002 /* EEPROM chip data out. */ -#define EEDI 0x00000001 /* EEPROM chip data in. */ + /* arbitrary choose that last PHY and current PHY */ + sis_priv->cur_phy = sis_priv->mii->phy_addr; + printk(KERN_INFO "%s: Using %s as default\n", net_dev->name, + sis_priv->mii->chip_info->name); -/* Delay between EEPROM clock transitions. - No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. - */ + if (sis_priv->mii->status & MII_STAT_LINK) + sis_priv->LinkOn = TRUE; + else + sis_priv->LinkOn = FALSE; -#define eeprom_delay() inl(ee_addr) + return 1; +} -/* The EEPROM commands include the alway-set leading bit. */ -#define EEread 0x0180 -#define EEwrite 0x0140 -#define EEerase 0x01C0 -#define EEwriteEnable 0x0130 -#define EEwriteDisable 0x0100 -#define EEeraseAll 0x0120 -#define EEwriteAll 0x0110 -#define EEaddrMask 0x013F -#define EEcmdShift 16 +/* Delay between EEPROM clock transitions. */ +#define eeprom_delay() inl(ee_addr) +/* Read Serial EEPROM through EEPROM Access Register, Note that location is + in word (16 bits) unit */ static u16 read_eeprom(long ioaddr, int location) { - int i; - u16 retval = 0; - long ee_addr = ioaddr + mear; - u32 read_cmd = location | EEread; - - outl(0, ee_addr); - eeprom_delay(); - outl(EECLK, ee_addr); - eeprom_delay(); - - /* Shift the read command bits out. */ - for (i = 8; i >= 0; i--) { - u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS; - outl(dataval, ee_addr); - eeprom_delay(); - outl(dataval | EECLK, ee_addr); - eeprom_delay(); - } - outb(EECS, ee_addr); - eeprom_delay(); - - for (i = 16; i > 0; i--) { - outl(EECS, ee_addr); - eeprom_delay(); - outl(EECS | EECLK, ee_addr); - eeprom_delay(); - retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0); - eeprom_delay(); - } - - /* Terminate the EEPROM access. */ - outl(0, ee_addr); - eeprom_delay(); - outl(EECLK, ee_addr); - return (retval); + int i; + u16 retval = 0; + long ee_addr = ioaddr + mear; + u32 read_cmd = location | EEread; + + outl(0, ee_addr); + eeprom_delay(); + outl(EECLK, ee_addr); + eeprom_delay(); + + /* Shift the read command (9) bits out. */ + for (i = 8; i >= 0; i--) { + u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS; + outl(dataval, ee_addr); + eeprom_delay(); + outl(dataval | EECLK, ee_addr); + eeprom_delay(); + } + outb(EECS, ee_addr); + eeprom_delay(); + + /* read the 16-bits data in */ + for (i = 16; i > 0; i--) { + outl(EECS, ee_addr); + eeprom_delay(); + outl(EECS | EECLK, ee_addr); + eeprom_delay(); + retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0); + eeprom_delay(); + } + + /* Terminate the EEPROM access. */ + outl(0, ee_addr); + eeprom_delay(); + outl(EECLK, ee_addr); + + return (retval); } -/* MII serial management: mostly bogus for now. */ /* Read and write the MII management registers using software-generated - serial MDIO protocol. - The maximum data clock rate is 2.5 Mhz. The minimum timing is usually - met by back-to-back PCI I/O cycles, but we insert a delay to avoid - "overclocking" issues. */ - + serial MDIO protocol. Note that the command bits and data bits are + send out seperately */ #define mdio_delay() inl(mdio_addr) -#define MIIread 0x6000 -#define MIIwrite 0x6002 -#define MIIpmdMask 0x0F80 -#define MIIpmdShift 7 -#define MIIregMask 0x007C -#define MIIregShift 2 -#define MIIturnaroundBits 2 -#define MIIcmdLen 16 -#define MIIcmdShift 16 -#define MIIreset 0xFFFFFFFF -#define MIIwrLen 32 - -#define MDC 0x00000040 -#define MDDIR 0x00000020 -#define MDIO 0x00000010 - static void mdio_idle(long mdio_addr) { - outl(MDIO | MDDIR, mdio_addr); - mdio_delay(); - outl(MDIO | MDDIR | MDC, mdio_addr); + outl(MDIO | MDDIR, mdio_addr); + mdio_delay(); + outl(MDIO | MDDIR | MDC, mdio_addr); } /* Syncronize the MII management interface by shifting 32 one bits out. */ static void mdio_reset(long mdio_addr) { - int i; + int i; - for (i = 31; i >= 0; i--) { - outl(MDDIR | MDIO, mdio_addr); - mdio_delay(); - outl(MDDIR | MDIO | MDC, mdio_addr); - mdio_delay(); - } - return; -} - -static int mdio_read(struct net_device *dev, int phy_id, int location) -{ - long mdio_addr = dev->base_addr + mear; - int mii_cmd = MIIread|(phy_id<= 0; i--) { - int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; - outl(dataval, mdio_addr); - outl(dataval | MDC, mdio_addr); - } - - /* Read the two transition, 16 data, and wire-idle bits. */ - for (i = 16; i > 0; i--) { - outl(0, mdio_addr); - //mdio_delay(); - retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0); - outl(MDC, mdio_addr); - mdio_delay(); - } - return retval; -} - -static void mdio_write(struct net_device *dev, int phy_id, int location, int value) -{ - long mdio_addr = dev->base_addr + mear; - int mii_cmd = MIIwrite|(phy_id<= 0; i--) { - int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; - outb(dataval, mdio_addr); - mdio_delay(); - outb(dataval | MDC, mdio_addr); - mdio_delay(); - } - mdio_delay(); - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - outb(0, mdio_addr); - mdio_delay(); - outb(MDC, mdio_addr); - mdio_delay(); - } - return; + for (i = 31; i >= 0; i--) { + outl(MDDIR | MDIO, mdio_addr); + mdio_delay(); + outl(MDDIR | MDIO | MDC, mdio_addr); + mdio_delay(); + } + return; +} + +static u16 mdio_read(struct net_device *net_dev, int phy_id, int location) +{ + long mdio_addr = net_dev->base_addr + mear; + int mii_cmd = MIIread|(phy_id<= 0; i--) { + int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; + outl(dataval, mdio_addr); + mdio_delay(); + outl(dataval | MDC, mdio_addr); + mdio_delay(); + } + + /* Read the 16 data bits. */ + for (i = 16; i > 0; i--) { + outl(0, mdio_addr); + mdio_delay(); + retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0); + outl(MDC, mdio_addr); + mdio_delay(); + } + return retval; +} + +static void mdio_write(struct net_device *net_dev, int phy_id, int location, int value) +{ + long mdio_addr = net_dev->base_addr + mear; + int mii_cmd = MIIwrite|(phy_id<= 0; i--) { + int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR; + outb(dataval, mdio_addr); + mdio_delay(); + outb(dataval | MDC, mdio_addr); + mdio_delay(); + } + mdio_delay(); + + /* Shift the value bits out. */ + for (i = 15; i >= 0; i--) { + int dataval = (value & (1 << i)) ? MDDIR | MDIO : MDDIR; + outl(dataval, mdio_addr); + mdio_delay(); + outl(dataval | MDC, mdio_addr); + mdio_delay(); + } + mdio_delay(); + + /* Clear out extra bits. */ + for (i = 2; i > 0; i--) { + outb(0, mdio_addr); + mdio_delay(); + outb(MDC, mdio_addr); + mdio_delay(); + } + return; } static int -sis900_open(struct net_device *dev) +sis900_open(struct net_device *net_dev) { - struct sis900_private *tp = (struct sis900_private *)dev->priv; - long ioaddr = dev->base_addr; + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; - if (sis900_debug > 0) - printk(KERN_INFO "%s sis900_open, IO Addr=%x, Irq=%x\n", - dev->name, (unsigned int)ioaddr, dev->irq); - - /* Soft reset the chip. */ - outl(0, ioaddr + imr); - outl(0, ioaddr + ier); - outl(0, ioaddr + rfcr); - outl(RESET | RxRESET | TxRESET, ioaddr + cr); - - if (request_irq(dev->irq, &sis900_interrupt, SA_SHIRQ, dev->name, dev)) - { - return -EAGAIN; - } - - MOD_INC_USE_COUNT; - - tp->tx_bufs = kmalloc(TX_BUF_SIZE * NUM_TX_DESC, GFP_KERNEL); - tp->rx_bufs = kmalloc(RX_BUF_SIZE * NUM_RX_DESC, GFP_KERNEL); - if (tp->tx_bufs == NULL || tp->rx_bufs == NULL) { - if (tp->tx_bufs) - kfree(tp->tx_bufs); - if (tp->rx_bufs) - kfree(tp->rx_bufs); - if (!tp->tx_bufs) { - printk(KERN_ERR "%s: Can't allocate a %d byte TX Bufs.\n", - dev->name, TX_BUF_SIZE * NUM_TX_DESC); - } - if (!tp->rx_bufs) { - printk(KERN_ERR "%s: Can't allocate a %d byte RX Bufs.\n", - dev->name, RX_BUF_SIZE * NUM_RX_DESC); - } - return -ENOMEM; - } + /* Soft reset the chip. */ + sis900_reset(net_dev); - { - u32 rfcrSave; - u32 w; - u32 i; - - rfcrSave = inl(rfcr); - outl(rfcrSave & ~RFEN, rfcr); - for (i=0 ; i<3 ; i++) { - w = (u16)*((u16*)(dev->dev_addr)+i); - outl((((u32) i) << RFEP_shift), ioaddr + rfcr); - outl((u32)w, ioaddr + rfdr); - if (sis900_debug > 4) { - printk(KERN_INFO "Filter Addr[%d]=%x\n", - i, inl(ioaddr + rfdr)); - } - } - outl(rfcrSave, rfcr); - } - - sis900_init_ring(dev); - outl((u32)tp->tx_buf[0].physAddr, ioaddr + txdp); - outl((u32)tp->rx_buf[0].physAddr, ioaddr + rxdp); - - if (sis900_debug > 4) - printk(KERN_INFO "txdp:%8.8x\n", inl(ioaddr + txdp)); - - /* Check that the chip has finished the reset. */ - { - u32 status; - int j=0; - status = TxRCMP | RxRCMP; - while (status && (j++ < 30000)) { - status ^= (inl(isr) & status); - } - } - - outl(PESEL, ioaddr + cfg); - - /* Must enable Tx/Rx before setting transfer thresholds! */ - /* - * #define TX_DMA_BURST 0 - * #define RX_DMA_BURST 0 - * #define TX_FIFO_THRESH 16 - * #define TxDRNT_100 (1536>>5) - * #define TxDRNT_10 (1536>>5) - * #define RxDRNT_100 (1536>>5) - * #define RxDRNT_10 (1536>>5) - */ - outl((RX_DMA_BURST<<20) | (RxDRNT_10 << 1), ioaddr+rxcfg); - outl(TxATP | (TX_DMA_BURST << 20) | (TX_FIFO_THRESH<<8) | TxDRNT_10, - ioaddr + txcfg); - if (sis900_debug > 1) - { - if (tp->LinkOn) { - printk(KERN_INFO"%s: Media Type %s%s-duplex.\n", - dev->name, - tp->speeds==HW_SPEED_100_MBPS ? - "100mbps " : "10mbps ", - tp->full_duplex== FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - } - else printk(KERN_INFO"%s: Media Link Off\n", dev->name); + if (request_irq(net_dev->irq, &sis900_interrupt, SA_SHIRQ, net_dev->name, net_dev)) { + return -EAGAIN; } - set_rx_mode(dev); - dev->tbusy = 0; - dev->interrupt = 0; - dev->start = 1; - - /* Enable all known interrupts by setting the interrupt mask. */ - outl((RxOK|RxERR|RxORN|RxSOVR|TxOK|TxERR|TxURN), ioaddr + imr); - outl(RxENA, ioaddr + cr); - outl(IE, ioaddr + ier); - - if (sis900_debug > 3) - printk(KERN_INFO "%s: sis900_open() ioaddr %#lx IRQ %d \n", - dev->name, ioaddr, dev->irq); - - /* Set the timer to switch to check for link beat and perhaps switch - to an alternate media type. */ - init_timer(&tp->timer); - tp->timer.expires = RUN_AT((24*HZ)/10); /* 2.4 sec. */ - tp->timer.data = (unsigned long)dev; - tp->timer.function = &sis900_timer; /* timer handler */ - add_timer(&tp->timer); + MOD_INC_USE_COUNT; + + sis900_init_rxfilter(net_dev); - return 0; + sis900_init_tx_ring(net_dev); + sis900_init_rx_ring(net_dev); + + set_rx_mode(net_dev); + + net_dev->tbusy = 0; + net_dev->interrupt = 0; + net_dev->start = 1; + + /* Enable all known interrupts by setting the interrupt mask. */ + outl((RxSOVR|RxORN|RxERR|RxOK|TxURN|TxERR|TxOK), ioaddr + imr); + outl(RxENA, ioaddr + cr); + outl(IE, ioaddr + ier); + + sis900_check_mode(net_dev, sis_priv->mii); + + /* Set the timer to switch to check for link beat and perhaps switch + to an alternate media type. */ + init_timer(&sis_priv->timer); + sis_priv->timer.expires = jiffies + HZ; + sis_priv->timer.data = (unsigned long)net_dev; + sis_priv->timer.function = &sis900_timer; + add_timer(&sis_priv->timer); + + return 0; } +/* set receive filter address to our MAC address */ +static void +sis900_init_rxfilter (struct net_device * net_dev) +{ + long ioaddr = net_dev->base_addr; + u32 rfcrSave; + u32 i; + + rfcrSave = inl(rfcr + ioaddr); + + /* disable packet filtering before setting filter */ + outl(rfcrSave & ~RFEN, rfcr); + + /* load MAC addr to filter data register */ + for (i = 0 ; i < 3 ; i++) { + u32 w; + + w = (u32) *((u16 *)(net_dev->dev_addr)+i); + outl((i << RFADDR_shift), ioaddr + rfcr); + outl(w, ioaddr + rfdr); + + if (sis900_debug > 2) { + printk(KERN_INFO "%s: Receive Filter Addrss[%d]=%x\n", + net_dev->name, i, inl(ioaddr + rfdr)); + } + } + + /* enable packet filitering */ + outl(rfcrSave | RFEN, rfcr + ioaddr); +} + +/* Initialize the Tx ring. */ +static void +sis900_init_tx_ring(struct net_device *net_dev) +{ + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; + int i; + + sis_priv->tx_full = 0; + sis_priv->dirty_tx = sis_priv->cur_tx = 0; + + for (i = 0; i < NUM_TX_DESC; i++) { + sis_priv->tx_skbuff[i] = NULL; + + sis_priv->tx_ring[i].link = (u32) virt_to_bus(&sis_priv->tx_ring[i+1]); + sis_priv->tx_ring[i].cmdsts = 0; + sis_priv->tx_ring[i].bufptr = 0; + } + sis_priv->tx_ring[i-1].link = (u32) virt_to_bus(&sis_priv->tx_ring[0]); + + /* load Transmit Descriptor Register */ + outl(virt_to_bus(&sis_priv->tx_ring[0]), ioaddr + txdp); + if (sis900_debug > 2) + printk(KERN_INFO "%s: TX descriptor register loaded with: %8.8x\n", + net_dev->name, inl(ioaddr + txdp)); +} + +/* Initialize the Rx descriptor ring, pre-allocate recevie buffers */ +static void +sis900_init_rx_ring(struct net_device *net_dev) +{ + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; + int i; + + sis_priv->cur_rx = 0; + sis_priv->dirty_rx = 0; + + /* init RX descriptor */ + for (i = 0; i < NUM_RX_DESC; i++) { + sis_priv->rx_skbuff[i] = NULL; + + sis_priv->rx_ring[i].link = (u32) virt_to_bus(&sis_priv->rx_ring[i+1]); + sis_priv->rx_ring[i].cmdsts = 0; + sis_priv->rx_ring[i].bufptr = 0; + } + sis_priv->rx_ring[i-1].link = (u32) virt_to_bus(&sis_priv->rx_ring[0]); + + /* allocate sock buffers */ + for (i = 0; i < NUM_RX_DESC; i++) { + struct sk_buff *skb; + + if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { + /* not enough memory for skbuff, this makes a "hole" + on the buffer ring, it is not clear how the + hardware will react to this kind of degenerated + buffer */ + break; + } + skb->dev = net_dev; + sis_priv->rx_skbuff[i] = skb; + sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; + sis_priv->rx_ring[i].bufptr = virt_to_bus(skb->tail); + } + sis_priv->dirty_rx = (unsigned int) (i - NUM_RX_DESC); + + /* load Receive Descriptor Register */ + outl(virt_to_bus(&sis_priv->rx_ring[0]), ioaddr + rxdp); + if (sis900_debug > 2) + printk(KERN_INFO "%s: RX descriptor register loaded with: %8.8x\n", + net_dev->name, inl(ioaddr + rxdp)); +} +/* on each timer ticks we check two things, Link Status (ON/OFF) and + Link Mode (10/100/Full/Half) + */ static void sis900_timer(unsigned long data) { - struct net_device *dev = (struct net_device *)data; - struct sis900_private *tp = (struct sis900_private *)dev->priv; - int next_tick = 0; - u16 status; - - if (!tp->LinkOn) { - status = mdio_read(dev, tp->phys[tp->phy_idx], MII_STATUS); - if (status & MIISTAT_LINK) { - elPMDreadMode(dev, tp->phys[tp->phy_idx], - &tp->speeds, &tp->full_duplex); - tp->LinkOn = TRUE; - printk(KERN_INFO "%s: Media Link On %s%s-duplex ", - dev->name, - tp->speeds == HW_SPEED_100_MBPS ? - "100mbps " : "10mbps ", - tp->full_duplex==FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); + struct net_device *net_dev = (struct net_device *)data; + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + struct mii_phy *mii_phy = sis_priv->mii; + static int next_tick = 5*HZ; + u16 status; + + status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); + + /* current mii phy is failed to link, try another one */ + while (!(status & MII_STAT_LINK)) { + if (mii_phy->next == NULL) { + if (sis_priv->LinkOn) { + /* link stat change from ON to OFF */ + next_tick = HZ; + sis_priv->LinkOn = FALSE; + printk(KERN_INFO "%s: Media Link Off\n", + net_dev->name); + } + sis_priv->timer.expires = jiffies + next_tick; + add_timer(&sis_priv->timer); + return; } - } else { // previous link on - status = mdio_read(dev, tp->phys[tp->phy_idx], MII_STATUS); - if (!(status & MIISTAT_LINK)) { - tp->LinkOn = FALSE; - printk(KERN_INFO "%s: Media Link Off\n", dev->name); + mii_phy = mii_phy->next; + status = mdio_read(net_dev, mii_phy->phy_addr, MII_STATUS); + } + + if (!sis_priv->LinkOn) { + /* link stat change forn OFF to ON, read and report link mode */ + sis_priv->LinkOn = TRUE; + next_tick = 5*HZ; + /* change what cur_phy means */ + if (mii_phy->phy_addr != sis_priv->cur_phy) { + printk(KERN_INFO "%s: Changing transceiver to %s\n", net_dev->name, + mii_phy->chip_info->name); + status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL); + mdio_write(net_dev, sis_priv->cur_phy, + MII_CONTROL, status | MII_CNTL_ISOLATE); + status = mdio_read(net_dev, mii_phy->phy_addr, MII_CONTROL); + mdio_write(net_dev, mii_phy->phy_addr, + MII_CONTROL, status & ~MII_CNTL_ISOLATE); + sis_priv->cur_phy = mii_phy->phy_addr; } - } - next_tick = 2*HZ; + sis900_check_mode(net_dev, mii_phy); + } - if (next_tick) { - tp->timer.expires = RUN_AT(next_tick); - add_timer(&tp->timer); - } -} - -static void sis900_tx_timeout(struct net_device *dev) -{ - struct sis900_private *tp = (struct sis900_private *)dev->priv; - long ioaddr = dev->base_addr; - int i; - - if (sis900_debug > 0) - printk(KERN_INFO "%s: Transmit timeout, status %2.2x %4.4x \n", - dev->name, inl(ioaddr + cr), inl(ioaddr + isr)); - - /* Disable interrupts by clearing the interrupt mask. */ - outl(0x0000, ioaddr + imr); - - /* Emit info to figure out what went wrong. */ - if (sis900_debug > 1) { - printk(KERN_INFO "%s:Tx queue start entry %d dirty entry %d.\n", - dev->name, tp->cur_tx, tp->dirty_tx); - for (i = 0; i < NUM_TX_DESC; i++) - printk(KERN_INFO "%s: Tx descriptor %d is %8.8x.%s\n", - dev->name, i, (unsigned int)&tp->tx_buf[i], - i == tp->dirty_tx % NUM_TX_DESC ? - " (queue head)" : ""); - } - - /* Soft reset the chip. */ - //outb(RESET, ioaddr + cr); - /* Check that the chip has finished the reset. */ - /* - for (i = 1000; i > 0; i--) - if ((inb(ioaddr + cr) & RESET) == 0) - break; - */ - - tp->cur_rx = 0; - /* Must enable Tx/Rx before setting transfer thresholds! */ - /* - set_rx_mode(dev); - */ - { /* Save the unsent Tx packets. */ - struct sk_buff *saved_skb[NUM_TX_DESC], *skb; - int j; - for (j = 0; tp->cur_tx - tp->dirty_tx > 0 ; j++, tp->dirty_tx++) - saved_skb[j]=tp->tx_skbuff[tp->dirty_tx % NUM_TX_DESC]; - tp->dirty_tx = tp->cur_tx = 0; - - for (i = 0; i < j; i++) { - skb = tp->tx_skbuff[i] = saved_skb[i]; - /* Always alignment */ - memcpy((unsigned char*)(tp->tx_buf[i].buf), - skb->data, skb->len); - tp->tx_buf[i].cmdsts = OWN | skb->len; - /* Note: the chip doesn't have auto-pad! */ - /* - outl(tp->tx_flag|(skb->len>=ETH_ZLEN?skb->len:ETH_ZLEN), - ioaddr + TxStatus0 + i*4); - */ - } - outl(TxENA, ioaddr + cr); - tp->cur_tx = i; - while (i < NUM_TX_DESC) - tp->tx_skbuff[i++] = 0; - if (tp->cur_tx - tp->dirty_tx < NUM_TX_DESC) {/* Typical path */ - dev->tbusy = 0; - tp->tx_full = 0; - } else { - tp->tx_full = 1; - } - } - - dev->trans_start = jiffies; - tp->stats.tx_errors++; - /* Enable all known interrupts by setting the interrupt mask. */ - outl((RxOK|RxERR|RxORN|RxSOVR|TxOK|TxERR|TxURN), ioaddr + imr); - return; + sis_priv->timer.expires = jiffies + next_tick; + add_timer(&sis_priv->timer); } +static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_phy) +{ + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; + int speed, duplex; + u32 tx_flags = 0, rx_flags = 0; + mii_phy->chip_info->read_mode(net_dev, sis_priv->cur_phy, &speed, &duplex); -/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ -static void -sis900_init_ring(struct net_device *dev) + tx_flags = TxATP | (TX_DMA_BURST << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift); + rx_flags = RX_DMA_BURST << RxMXDMA_shift; + + if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS ) { + rx_flags |= (RxDRNT_10 << RxDRNT_shift); + tx_flags |= (TxDRNT_10 << TxDRNT_shift); + } + else { + rx_flags |= (RxDRNT_100 << RxDRNT_shift); + tx_flags |= (TxDRNT_100 << TxDRNT_shift); + } + + if (duplex == FDX_CAPABLE_FULL_SELECTED) { + tx_flags |= (TxCSI | TxHBI); + rx_flags |= RxATX; + } + + outl (tx_flags, ioaddr + txcfg); + outl (rx_flags, ioaddr + rxcfg); +} +static void sis900_read_mode(struct net_device *net_dev, int phy_addr, int *speed, int *duplex) { - struct sis900_private *tp = (struct sis900_private *)dev->priv; - int i; + int i = 0; + u32 status; + + /* STSOUT register is Latched on Transition, read operation updates it */ + while (i++ < 2) + status = mdio_read(net_dev, phy_addr, MII_STSOUT); + + if (status & MII_STSOUT_SPD) + *speed = HW_SPEED_100_MBPS; + else + *speed = HW_SPEED_10_MBPS; + + if (status & MII_STSOUT_DPLX) + *duplex = FDX_CAPABLE_FULL_SELECTED; + else + *duplex = FDX_CAPABLE_HALF_SELECTED; + + if (status & MII_STSOUT_LINK_FAIL) + printk(KERN_INFO "%s: Media Link Off\n", net_dev->name); + else + printk(KERN_INFO "%s: Media Link On %s %s-duplex \n", + net_dev->name, + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); +} +static void amd79c901_read_mode(struct net_device *net_dev, int phy_addr, int *speed, int *duplex) +{ + int i; + u16 status; + + for (i = 0; i < 2; i++) + status = mdio_read(net_dev, phy_addr, MII_STATUS); + + if (status & MII_STAT_CAN_AUTO) { + /* 10BASE-T PHY */ + for (i = 0; i < 2; i++) + status = mdio_read(net_dev, phy_addr, MII_STATUS_SUMMARY); + if (status & MII_STSSUM_SPD) + *speed = HW_SPEED_100_MBPS; + else + *speed = HW_SPEED_10_MBPS; + if (status & MII_STSSUM_DPLX) + *duplex = FDX_CAPABLE_FULL_SELECTED; + else + *duplex = FDX_CAPABLE_HALF_SELECTED; + + if (status & MII_STSSUM_LINK) + printk(KERN_INFO "%s: Media Link On %s %s-duplex \n", + net_dev->name, + *speed == HW_SPEED_100_MBPS ? + "100mbps" : "10mbps", + *duplex == FDX_CAPABLE_FULL_SELECTED ? + "full" : "half"); + else + printk(KERN_INFO "%s: Media Link Off\n", net_dev->name); + + } + else { + /* HomePNA */ + *speed = HW_SPEED_HOME; + *duplex = FDX_CAPABLE_HALF_SELECTED; + if (status & MII_STAT_LINK) + printk(KERN_INFO "%s: Media Link On 1mbps half-duplex \n", + net_dev->name); + else + printk(KERN_INFO "%s: Media Link Off\n", net_dev->name); + } +} +static void sis900_tx_timeout(struct net_device *net_dev) +{ + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; + + printk(KERN_INFO "%s: Transmit timeout, status %8.8x %8.8x \n", + net_dev->name, inl(ioaddr + cr), inl(ioaddr + isr)); + + /* Disable interrupts by clearing the interrupt mask. */ + outl(0x0000, ioaddr + imr); - tp->tx_full = 0; - tp->cur_rx = 0; - tp->dirty_tx = tp->cur_tx = 0; - - /* Tx Buffer */ - for (i = 0; i < NUM_TX_DESC; i++) { - tp->tx_skbuff[i] = 0; - tp->tx_buf[i].buf = &tp->tx_bufs[i*TX_BUF_SIZE]; - tp->tx_buf[i].bufPhys = - virt_to_bus(&tp->tx_bufs[i*TX_BUF_SIZE]); - } - - /* Tx Descriptor */ - for (i = 0; i< NUM_TX_DESC; i++) { - tp->tx_buf[i].llink = (u32) - &(tp->tx_buf[((i+1) < NUM_TX_DESC) ? (i+1) : 0]); - tp->tx_buf[i].plink = (u32) - virt_to_bus(&(tp->tx_buf[((i+1) < NUM_TX_DESC) ? - (i+1) : 0].plink)); - tp->tx_buf[i].physAddr= - virt_to_bus(&(tp->tx_buf[i].plink)); - tp->tx_buf[i].cmdsts=0; - } - - /* Rx Buffer */ - for (i = 0; i < NUM_RX_DESC; i++) { - tp->rx_buf[i].buf = &tp->rx_bufs[i*RX_BUF_SIZE]; - tp->rx_buf[i].bufPhys = - virt_to_bus(&tp->rx_bufs[i*RX_BUF_SIZE]); - } - - /* Rx Descriptor */ - for (i = 0; i< NUM_RX_DESC; i++) { - tp->rx_buf[i].llink = (u32) - &(tp->rx_buf[((i+1) < NUM_RX_DESC) ? (i+1) : 0]); - tp->rx_buf[i].plink = (u32) - virt_to_bus(&(tp->rx_buf[((i+1) < NUM_RX_DESC) ? - (i+1) : 0].plink)); - tp->rx_buf[i].physAddr= - virt_to_bus(&(tp->rx_buf[i].plink)); - tp->rx_buf[i].cmdsts=RX_BUF_SIZE; - } + sis_priv->cur_rx = 0; + net_dev->trans_start = jiffies; + sis_priv->stats.tx_errors++; + + /* FIXME: Should we restart the transmission thread here ?? */ + + /* Enable all known interrupts by setting the interrupt mask. */ + outl((RxSOVR|RxORN|RxERR|RxOK|TxURN|TxERR|TxOK), ioaddr + imr); + return; } static int -sis900_start_xmit(struct sk_buff *skb, struct net_device *dev) +sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) { - struct sis900_private *tp = (struct sis900_private *)dev->priv; - long ioaddr = dev->base_addr; - int entry; - - /* Block a timer-based transmit from overlapping. This could better be - done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */ - if (test_and_set_bit(0, (void*)&dev->tbusy) != 0) { - if (jiffies - dev->trans_start < TX_TIMEOUT) - return 1; - sis900_tx_timeout(dev); - return 1; - } - - /* Calculate the next Tx descriptor entry. ????? */ - entry = tp->cur_tx % NUM_TX_DESC; - - tp->tx_skbuff[entry] = skb; - - if (sis900_debug > 5) { - int i; - printk(KERN_INFO "%s: SKB Tx Frame contents:(len=%d)", - dev->name,skb->len); - - for (i = 0; i < skb->len; i++) { - printk("%2.2x ", - (u8)skb->data[i]); - } - printk(".\n"); - } - - memcpy(tp->tx_buf[entry].buf, - skb->data, skb->len); - - tp->tx_buf[entry].cmdsts=(OWN | skb->len); - - //tp->tx_buf[entry].plink = 0; - outl(TxENA, ioaddr + cr); - if (++tp->cur_tx - tp->dirty_tx < NUM_TX_DESC) {/* Typical path */ - clear_bit(0, (void*)&dev->tbusy); - } else { - tp->tx_full = 1; - } - - /* Note: the chip doesn't have auto-pad! */ - - dev->trans_start = jiffies; - if (sis900_debug > 4) - printk(KERN_INFO "%s: Queued Tx packet at " - "%p size %d to slot %d.\n", - dev->name, skb->data, (int)skb->len, entry); + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; + unsigned int entry; + + /* test tbusy to see if we have timeout situation then set it */ + if (test_and_set_bit(0, (void*)&net_dev->tbusy) != 0) { + if (jiffies - net_dev->trans_start > TX_TIMEOUT) + sis900_tx_timeout(net_dev); + return 1; + } + + /* Calculate the next Tx descriptor entry. */ + entry = sis_priv->cur_tx % NUM_TX_DESC; + sis_priv->tx_skbuff[entry] = skb; + + /* set the transmit buffer descriptor and enable Transmit State Machine */ + sis_priv->tx_ring[entry].bufptr = virt_to_bus(skb->data); + sis_priv->tx_ring[entry].cmdsts = (OWN | skb->len); + outl(TxENA, ioaddr + cr); + + if (++sis_priv->cur_tx - sis_priv->dirty_tx < NUM_TX_DESC) { + /* Typical path, clear tbusy to indicate more + transmission is possible */ + clear_bit(0, (void*)&net_dev->tbusy); + } else { + /* no more transmit descriptor avaiable, tbusy remain set */ + sis_priv->tx_full = 1; + } - return 0; + net_dev->trans_start = jiffies; + + if (sis900_debug > 3) + printk(KERN_INFO "%s: Queued Tx packet at %p size %d " + "to slot %d.\n", + net_dev->name, skb->data, (int)skb->len, entry); + + return 0; } /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { - struct net_device *dev = (struct net_device *)dev_instance; - struct sis900_private *tp = (struct sis900_private *)dev->priv; - int boguscnt = max_interrupt_work; - int status; - long ioaddr = dev->base_addr; + struct net_device *net_dev = (struct net_device *)dev_instance; + int boguscnt = max_interrupt_work; + long ioaddr = net_dev->base_addr; + u32 status; #if defined(__i386__) - /* A lock to prevent simultaneous entry bug on Intel SMP machines. */ - if (test_and_set_bit(0, (void*)&dev->interrupt)) { - printk(KERN_INFO "%s: SMP simultaneous entry of " - "an interrupt handler.\n", dev->name); - dev->interrupt = 0; /* Avoid halting machine. */ - return; - } + /* A lock to prevent simultaneous entry bug on Intel SMP machines. */ + if (test_and_set_bit(0, (void*)&net_dev->interrupt)) { + printk(KERN_INFO "%s: SMP simultaneous entry of " + "an interrupt handler.\n", net_dev->name); + net_dev->interrupt = 0; /* Avoid halting machine. */ + return; + } #else - if (dev->interrupt) { - printk(KERN_INFO "%s: Re-entering the " - "interrupt handler.\n", dev->name); - return; - } - dev->interrupt = 1; -#endif - - do { - status = inl(ioaddr + isr); - /* Acknowledge all of the current interrupt sources ASAP. */ - outl(status, ioaddr + isr); // ????? - - if (sis900_debug > 4) - printk(KERN_INFO "%s: interrupt status=%#4.4x " - "new intstat=%#4.4x.\n", - dev->name, status, inl(ioaddr + isr)); - - if ((status & (TxURN|TxERR|TxOK | RxORN|RxERR|RxOK)) == 0) { - break; - } - - if (status & (RxOK|RxORN|RxERR)) /* Rx interrupt */ - sis900_rx(dev); - - if (status & (TxOK | TxERR)) { - unsigned int dirty_tx; - - if (sis900_debug > 5) { - printk(KERN_INFO "TxOK:tp->cur_tx:%d," - "tp->dirty_tx:%x\n", - tp->cur_tx, tp->dirty_tx); - } - for (dirty_tx = tp->dirty_tx; dirty_tx < tp->cur_tx; - dirty_tx++) - { - int i; - int entry = dirty_tx % NUM_TX_DESC; - int txstatus = tp->tx_buf[entry].cmdsts; - - if (sis900_debug > 4) { - printk(KERN_INFO "%s: Tx Frame contents:" - "(len=%d)", - dev->name, (txstatus & DSIZE)); - - for (i = 0; i < (txstatus & DSIZE) ; - i++) { - printk("%2.2x ", - (u8)(tp->tx_buf[entry].buf[i])); - } - printk(".\n"); - } - if ( ! (txstatus & (OK | UNDERRUN))) - { - if (sis900_debug > 1) - printk(KERN_INFO "Tx NOT (OK," - "UnderRun)\n"); - break; /* It still hasn't been Txed */ - } - - /* Note: TxCarrierLost is always asserted - at 100mbps. */ - if (txstatus & (OWCOLL | ABORT)) { - /* There was an major error, log it. */ - if (sis900_debug > 1) - printk(KERN_INFO "Tx Out of " - " Window,Abort\n"); -#ifndef final_version - if (sis900_debug > 1) - printk(KERN_INFO "%s: Transmit " - "error, Tx status %8.8x.\n", - dev->name, txstatus); -#endif - tp->stats.tx_errors++; - if (txstatus & ABORT) { - tp->stats.tx_aborted_errors++; - } - if (txstatus & NOCARRIER) - tp->stats.tx_carrier_errors++; - if (txstatus & OWCOLL) - tp->stats.tx_window_errors++; -#ifdef ETHER_STATS - if ((txstatus & COLCNT)==COLCNT) - tp->stats.collisions16++; -#endif - } else { -#ifdef ETHER_STATS - /* No count for tp->stats.tx_deferred */ -#endif - if (txstatus & UNDERRUN) { - if (sis900_debug > 2) - printk(KERN_INFO "Tx UnderRun\n"); - } - tp->stats.collisions += - (txstatus >> 16) & 0xF; -#if LINUX_VERSION_CODE > 0x20119 - tp->stats.tx_bytes += txstatus & DSIZE; -#endif - if (sis900_debug > 2) - printk(KERN_INFO "Tx Transmit OK\n"); - tp->stats.tx_packets++; - } - - /* Free the original skb. */ - if (sis900_debug > 2) - printk(KERN_INFO "Free original skb\n"); - dev_free_skb(tp->tx_skbuff[entry]); - tp->tx_skbuff[entry] = 0; - } // for dirty - -#ifndef final_version - if (tp->cur_tx - dirty_tx > NUM_TX_DESC) { - printk(KERN_INFO"%s: Out-of-sync dirty pointer," - " %d vs. %d, full=%d.\n", - dev->name, dirty_tx, - tp->cur_tx, tp->tx_full); - dirty_tx += NUM_TX_DESC; - } + if (net_dev->interrupt) { + printk(KERN_INFO "%s: Re-entering the interrupt handler.\n", + net_dev->name); + return; + } + net_dev->interrupt = 1; #endif - if (tp->tx_full && dirty_tx > tp->cur_tx-NUM_TX_DESC) { - /* The ring is no longer full, clear tbusy. */ - if (sis900_debug > 3) - printk(KERN_INFO "Tx Ring NO LONGER Full\n"); - tp->tx_full = 0; - dev->tbusy = 0; - mark_bh(NET_BH); - } - - tp->dirty_tx = dirty_tx; - if (sis900_debug > 2) - printk(KERN_INFO "TxOK,tp->cur_tx:%d,tp->dirty:%d\n", - tp->cur_tx, tp->dirty_tx); - } // if (TxOK | TxERR) - - /* Check uncommon events with one test. */ - if (status & (RxORN | TxERR | RxERR)) { - if (sis900_debug > 2) - printk(KERN_INFO "%s: Abnormal interrupt," - "status %8.8x.\n", dev->name, status); - - if (status == 0xffffffff) - break; - if (status & (RxORN | RxERR)) - tp->stats.rx_errors++; - - - if (status & RxORN) { - tp->stats.rx_over_errors++; - } - } - if (--boguscnt < 0) { - printk(KERN_INFO "%s: Too much work at interrupt, " - "IntrStatus=0x%4.4x.\n", - dev->name, status); - break; - } - } while (1); - - if (sis900_debug > 3) - printk(KERN_INFO "%s: exiting interrupt, intr_status=%#4.4x.\n", - dev->name, inl(ioaddr + isr)); - + do { + status = inl(ioaddr + isr); + + if (sis900_debug > 3) + printk(KERN_INFO "%s: entering interrupt, " + "original status = %#8.8x, " + "new status = %#8.8x.\n", + net_dev->name, status, inl(ioaddr + isr)); + + if ((status & (HIBERR|TxURN|TxERR|TxOK|RxORN|RxERR|RxOK)) == 0) + /* nothing intresting happened */ + break; + + /* why dow't we break after Tx/Rx case ?? keyword: full-duplex */ + if (status & (RxORN | RxERR | RxOK)) + /* Rx interrupt */ + sis900_rx(net_dev); + + if (status & (TxURN | TxERR | TxOK)) + /* Tx interrupt */ + sis900_finish_xmit(net_dev); + + /* something strange happened !!! */ + if (status & HIBERR) { + printk(KERN_INFO "%s: Abnormal interrupt," + "status %#8.8x.\n", net_dev->name, status); + break; + } + if (--boguscnt < 0) { + printk(KERN_INFO "%s: Too much work at interrupt, " + "interrupt status = %#8.8x.\n", + net_dev->name, status); + break; + } + } while (1); + + if (sis900_debug > 3) + printk(KERN_INFO "%s: exiting interrupt, " + "interrupt status = 0x%#8.8x.\n", + net_dev->name, inl(ioaddr + isr)); + #if defined(__i386__) - clear_bit(0, (void*)&dev->interrupt); + clear_bit(0, (void*)&net_dev->interrupt); #else - dev->interrupt = 0; + net_dev->interrupt = 0; #endif - return; + return; } -/* The data sheet doesn't describe the Rx ring at all, so I'm guessing at the - field alignments and semantics. */ -static int sis900_rx(struct net_device *dev) -{ - struct sis900_private *tp = (struct sis900_private *)dev->priv; - long ioaddr = dev->base_addr; - u16 cur_rx = tp->cur_rx % NUM_RX_DESC; - int rx_status=tp->rx_buf[cur_rx].cmdsts; - - if (sis900_debug > 4) - printk(KERN_INFO "%s: sis900_rx, current %4.4x," - " rx status=%8.8x\n", - dev->name, cur_rx, - rx_status); - - while (rx_status & OWN) { - int rx_size = rx_status & DSIZE; - rx_size -= CRC_SIZE; - - if (sis900_debug > 4) { - int i; - printk(KERN_INFO "%s: sis900_rx, rx status %8.8x," - " size %4.4x, cur %4.4x.\n", - dev->name, rx_status, rx_size, cur_rx); - printk(KERN_INFO "%s: Rx Frame contents:", dev->name); - - for (i = 0; i < rx_size; i++) { - printk("%2.2x ", - (u8)(tp->rx_buf[cur_rx].buf[i])); - } - - printk(".\n"); - } - if (rx_status & TOOLONG) { - if (sis900_debug > 1) - printk(KERN_INFO "%s: Oversized Ethernet frame," - " status %4.4x!\n", - dev->name, rx_status); - tp->stats.rx_length_errors++; - } else if (rx_status & (RXISERR | RUNT | CRCERR | FAERR)) { - if (sis900_debug > 1) - printk(KERN_INFO"%s: Ethernet frame had errors," - " status %4.4x.\n", - dev->name, rx_status); - tp->stats.rx_errors++; - if (rx_status & (RXISERR | FAERR)) - tp->stats.rx_frame_errors++; - if (rx_status & (RUNT | TOOLONG)) - tp->stats.rx_length_errors++; - if (rx_status & CRCERR) tp->stats.rx_crc_errors++; - } else { - /* Malloc up new buffer, compatible with net-2e. */ - /* Omit the four octet CRC from the length. */ - struct sk_buff *skb; - - skb = dev_alloc_skb(rx_size + 2); - if (skb == NULL) { - printk(KERN_INFO "%s: Memory squeeze," - "deferring packet.\n", - dev->name); - /* We should check that some rx space is free. - If not, - free one and mark stats->rx_dropped++. */ - tp->stats.rx_dropped++; - tp->rx_buf[cur_rx].cmdsts = RX_BUF_SIZE; - break; - } - skb->dev = dev; - skb_reserve(skb, 2); /* 16 byte align the IP fields. */ - if (rx_size+CRC_SIZE > RX_BUF_SIZE) { - /* - int semi_count = RX_BUF_LEN - ring_offset - 4; - memcpy(skb_put(skb, semi_count), - &rx_bufs[ring_offset + 4], semi_count); - memcpy(skb_put(skb, rx_size-semi_count), - rx_bufs, rx_size - semi_count); - if (sis900_debug > 4) { - int i; - printk(KERN_DEBUG"%s: Frame wrap @%d", - dev->name, semi_count); - for (i = 0; i < 16; i++) - printk(" %2.2x", rx_bufs[i]); - printk(".\n"); - memset(rx_bufs, 0xcc, 16); - } - */ - } else { -#if 0 /* USE_IP_COPYSUM */ - eth_copy_and_sum(skb, - tp->rx_buf[cur_rx].buf, rx_size, 0); - skb_put(skb, rx_size); -#else - memcpy(skb_put(skb, rx_size), - tp->rx_buf[cur_rx].buf, rx_size); -#endif - } - skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); -#if LINUX_VERSION_CODE > 0x20119 - tp->stats.rx_bytes += rx_size; -#endif - tp->stats.rx_packets++; - } - tp->rx_buf[cur_rx].cmdsts = RX_BUF_SIZE; - - cur_rx = ((cur_rx+1) % NUM_RX_DESC); - rx_status = tp->rx_buf[cur_rx].cmdsts; - } // while - if (sis900_debug > 4) - printk(KERN_INFO "%s: Done sis900_rx(), current %4.4x " - "Cmd %2.2x.\n", - dev->name, cur_rx, - inb(ioaddr + cr)); - tp->cur_rx = cur_rx; - return 0; +/* Process receive interrupt events, put buffer to higher layer and refill buffer pool + Note: This fucntion is called by interrupt handler, don't do "too much" work here */ +static int sis900_rx(struct net_device *net_dev) +{ + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + long ioaddr = net_dev->base_addr; + unsigned int entry = sis_priv->cur_rx % NUM_RX_DESC; + u32 rx_status = sis_priv->rx_ring[entry].cmdsts; + + if (sis900_debug > 3) + printk(KERN_INFO "sis900_rx, cur_rx:%4.4d, dirty_rx:%4.4d " + "status:0x%8.8x\n", + sis_priv->cur_rx, sis_priv->dirty_rx,rx_status); + + while (rx_status & OWN) { + unsigned int rx_size; + + rx_size = (rx_status & DSIZE) - CRC_SIZE; + + if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) { + /* corrupted packet received */ + if (sis900_debug > 3) + printk(KERN_INFO "%s: Corrupted packet " + "received, buffer status = 0x%8.8x.\n", + net_dev->name, rx_status); + sis_priv->stats.rx_errors++; + if (rx_status & OVERRUN) + sis_priv->stats.rx_over_errors++; + if (rx_status & (TOOLONG|RUNT)) + sis_priv->stats.rx_length_errors++; + if (rx_status & (RXISERR | FAERR)) + sis_priv->stats.rx_frame_errors++; + if (rx_status & CRCERR) + sis_priv->stats.rx_crc_errors++; + /* reset buffer descriptor state */ + sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; + } else { + struct sk_buff * skb; + + if (sis_priv->rx_skbuff[entry] == NULL) { + printk(KERN_INFO "%s: NULL pointer " + "encountered in Rx ring, skipping\n", + net_dev->name); + break; + } + skb = sis_priv->rx_skbuff[entry]; + sis_priv->rx_skbuff[entry] = NULL; + /* reset buffer descriptor state */ + sis_priv->rx_ring[entry].cmdsts = 0; + sis_priv->rx_ring[entry].bufptr = 0; + + skb_put(skb, rx_size); + skb->protocol = eth_type_trans(skb, net_dev); + netif_rx(skb); + + if ((rx_status & BCAST) == MCAST) + sis_priv->stats.multicast++; + net_dev->last_rx = jiffies; + sis_priv->stats.rx_bytes += rx_size; + sis_priv->stats.rx_packets++; + } + sis_priv->cur_rx++; + entry = sis_priv->cur_rx % NUM_RX_DESC; + rx_status = sis_priv->rx_ring[entry].cmdsts; + } // while + + /* refill the Rx buffer, what if the rate of refilling is slower than + consuming ?? */ + for (;sis_priv->cur_rx - sis_priv->dirty_rx > 0; sis_priv->dirty_rx++) { + struct sk_buff *skb; + + entry = sis_priv->dirty_rx % NUM_RX_DESC; + + if (sis_priv->rx_skbuff[entry] == NULL) { + if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { + /* not enough memory for skbuff, this makes a "hole" + on the buffer ring, it is not clear how the + hardware will react to this kind of degenerated + buffer */ + printk(KERN_INFO "%s: Memory squeeze," + "deferring packet.\n", + net_dev->name); + sis_priv->stats.rx_dropped++; + break; + } + skb->dev = net_dev; + sis_priv->rx_skbuff[entry] = skb; + sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; + sis_priv->rx_ring[entry].bufptr = virt_to_bus(skb->tail); + } + } + /* re-enable the potentially idle receive state matchine */ + outl(RxENA , ioaddr + cr ); + + return 0; } -static int -sis900_close(struct net_device *dev) +/* finish up transmission of packets, check for error condition and free skbuff etc. + Note: This fucntion is called by interrupt handler, don't do "too much" work here */ +static void sis900_finish_xmit (struct net_device *net_dev) { - long ioaddr = dev->base_addr; - struct sis900_private *tp = (struct sis900_private *)dev->priv; - int i; - - dev->start = 0; - dev->tbusy = 1; + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + + for (; sis_priv->dirty_tx < sis_priv->cur_tx; sis_priv->dirty_tx++) { + unsigned int entry; + u32 tx_status; + + entry = sis_priv->dirty_tx % NUM_TX_DESC; + tx_status = sis_priv->tx_ring[entry].cmdsts; + + if (tx_status & OWN) { + /* The packet is not transmited yet (owned by hardware) ! */ + break; + } + + if (tx_status & (ABORT | UNDERRUN | OWCOLL)) { + /* packet unsuccessfully transmited */ + if (sis900_debug > 3) + printk(KERN_INFO "%s: Transmit " + "error, Tx status %8.8x.\n", + net_dev->name, tx_status); + sis_priv->stats.tx_errors++; + if (tx_status & UNDERRUN) + sis_priv->stats.tx_fifo_errors++; + if (tx_status & ABORT) + sis_priv->stats.tx_aborted_errors++; + if (tx_status & NOCARRIER) + sis_priv->stats.tx_carrier_errors++; + if (tx_status & OWCOLL) + sis_priv->stats.tx_window_errors++; + } else { + /* packet successfully transmited */ + if (sis900_debug > 3) + printk(KERN_INFO "Tx Transmit OK\n"); + sis_priv->stats.collisions += (tx_status & COLCNT) >> 16; + sis_priv->stats.tx_bytes += tx_status & DSIZE; + sis_priv->stats.tx_packets++; + } + /* Free the original skb. */ + dev_kfree_skb(sis_priv->tx_skbuff[entry]); + sis_priv->tx_skbuff[entry] = NULL; + sis_priv->tx_ring[entry].bufptr = 0; + sis_priv->tx_ring[entry].cmdsts = 0; + } + + if (sis_priv->tx_full && net_dev->tbusy && + sis_priv->cur_tx - sis_priv->dirty_tx < NUM_TX_DESC - 4) { + /* The ring is no longer full, clear tbusy, tx_full and schedule + more transmission by marking NET_BH */ + sis_priv->tx_full = 0; + clear_bit(0, (void *)&net_dev->tbusy); + mark_bh(NET_BH); + } +} - if (sis900_debug > 1) - printk(KERN_DEBUG"%s: Shutting down ethercard, status was 0x%4.4x.\n", - dev->name, inl(ioaddr + isr)); +static int +sis900_close(struct net_device *net_dev) +{ + long ioaddr = net_dev->base_addr; + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + int i; + + net_dev->start = 0; + net_dev->tbusy = 1; - /* Disable interrupts by clearing the interrupt mask. */ - outl(0x0000, ioaddr + imr); + /* Disable interrupts by clearing the interrupt mask. */ + outl(0x0000, ioaddr + imr); + outl(0x0000, ioaddr + ier); - /* Stop the chip's Tx and Rx DMA processes. */ - outl(0x00, ioaddr + cr); + /* Stop the chip's Tx and Rx Status Machine */ + outl(RxDIS | TxDIS, ioaddr + cr); - del_timer(&tp->timer); + del_timer(&sis_priv->timer); - free_irq(dev->irq, dev); + free_irq(net_dev->irq, net_dev); - for (i = 0; i < NUM_TX_DESC; i++) { - if (tp->tx_skbuff[i]) - dev_free_skb(tp->tx_skbuff[i]); - tp->tx_skbuff[i] = 0; - } - kfree(tp->rx_bufs); - kfree(tp->tx_bufs); + /* Free Tx and RX skbuff */ + for (i = 0; i < NUM_RX_DESC; i++) { + if (sis_priv->rx_skbuff[i] != NULL) + dev_kfree_skb(sis_priv->rx_skbuff[i]); + sis_priv->rx_skbuff[i] = 0; + } + for (i = 0; i < NUM_TX_DESC; i++) { + if (sis_priv->tx_skbuff[i] != NULL) + dev_kfree_skb(sis_priv->tx_skbuff[i]); + sis_priv->tx_skbuff[i] = 0; + } - /* Green! Put the chip in low-power mode. */ + /* Green! Put the chip in low-power mode. */ - MOD_DEC_USE_COUNT; + MOD_DEC_USE_COUNT; - return 0; + return 0; } -static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) { - struct sis900_private *tp = (struct sis900_private *)dev->priv; - u16 *data = (u16 *)&rq->ifr_data; - - switch(cmd) { - case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */ - data[0] = tp->phys[tp->phy_idx]; - /* Fall Through */ - case SIOCDEVPRIVATE+1: /* Read the specified MII register. */ - data[3] = mdio_read(dev, data[0] & 0x1f, data[1] & 0x1f); - return 0; - case SIOCDEVPRIVATE+2: /* Write the specified MII register */ - if (!suser()) - return -EPERM; - mdio_write(dev, data[0] & 0x1f, data[1] & 0x1f, data[2]); - return 0; - default: - return -EOPNOTSUPP; - } + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; + u16 *data = (u16 *)&rq->ifr_data; + + switch(cmd) { + case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */ + data[0] = sis_priv->mii->phy_addr; + /* Fall Through */ + case SIOCDEVPRIVATE+1: /* Read the specified MII register. */ + data[3] = mdio_read(net_dev, data[0] & 0x1f, data[1] & 0x1f); + return 0; + case SIOCDEVPRIVATE+2: /* Write the specified MII register */ + if (!suser()) + return -EPERM; + mdio_write(net_dev, data[0] & 0x1f, data[1] & 0x1f, data[2]); + return 0; + default: + return -EOPNOTSUPP; + } } static struct enet_statistics * -sis900_get_stats(struct net_device *dev) +sis900_get_stats(struct net_device *net_dev) { - struct sis900_private *tp = (struct sis900_private *)dev->priv; + struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; - return &tp->stats; + return &sis_priv->stats; } -/* Set or clear the multicast filter for this adaptor. - This routine is not state sensitive and need not be SMP locked. */ - -static u16 elComputeHashTableIndex(u8 *addr) +/* SiS 900 uses the most sigificant 7 bits to index a 128 bits multicast hash table, which makes + this function a little bit different from other drivers */ +static u16 sis900_compute_hashtable_index(u8 *addr) { + +/* what is the correct value of the POLYNOMIAL ?? + Donald Becker use 0x04C11DB7U */ #define POLYNOMIAL 0x04C11DB6L - u32 crc = 0xffffffff, msb; - int i, j; - u8 byte; - - for( i=0; i<6; i++ ) { - byte = *addr++; - for( j=0; j<8; j++ ) { - msb = crc >> 31; - crc <<= 1; - if( msb ^ ( byte & 1 )) { - crc ^= POLYNOMIAL; - crc |= 1; - } - byte >>= 1; - } - } - // 7 bit crc for 128 bit hash table - return( (int)(crc >> 25) ); -} - -static u16 elMIIpollBit(struct net_device *dev, - int phy_id, - int location, - u16 mask, - u16 polarity, - u16 *value) -{ - u32 i; - i=0; - while (1) { - *value = mdio_read(dev, phy_id, location); - if (polarity) { - if (mask & *value) return(TRUE); - } else { - if (mask & ~(*value)) return(TRUE); - } - if (++i == 1200) break; - } - return(FALSE); -} - -static u16 elPMDreadMode(struct net_device *dev, - int phy_id, - int *speed, - int *duplex) -{ - u16 status, OurCap; - - *speed = HW_SPEED_10_MBPS; - *duplex = FDX_CAPABLE_HALF_SELECTED; - - status = mdio_read(dev, phy_id, MII_ANLPAR); - OurCap = mdio_read(dev, phy_id, MII_ANAR); - if (sis900_debug > 1) { - printk(KERN_INFO "Link Part Status %4X\n", status); - printk(KERN_INFO "Our Status %4X\n", OurCap); - printk(KERN_INFO "Status Reg %4X\n", - mdio_read(dev, phy_id, MII_STATUS)); - } - status &= OurCap; - - if ( !( status & - (MII_NWAY_T|MII_NWAY_T_FDX | MII_NWAY_TX | MII_NWAY_TX_FDX ))) { - if (sis900_debug > 1) { - printk(KERN_INFO "The other end NOT support NWAY...\n"); - } - while (( status = mdio_read(dev, phy_id, 18)) & 0x4000) ; - while (( status = mdio_read(dev, phy_id, 18)) & 0x0020) ; - if (status & 0x80) - *speed = HW_SPEED_100_MBPS; - if (status & 0x40) - *duplex = FDX_CAPABLE_FULL_SELECTED; - if (sis900_debug > 3) { - printk(KERN_INFO"%s: Setting %s%s-duplex.\n", - dev->name, - *speed == HW_SPEED_100_MBPS ? - "100mbps " : "10mbps ", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - } - } else { - if (sis900_debug > 1) { - printk(KERN_INFO "The other end support NWAY...\n"); + u32 crc = 0xffffffff, msb; + int i, j; + u8 byte; + + for (i = 0; i < 6; i++) { + byte = *addr++; + for (j = 0; j < 8; j++) { + msb = crc >> 31; + crc <<= 1; + if (msb ^ (byte & 1)) { + crc ^= POLYNOMIAL; + crc |= 1; + } + byte >>= 1; } + } + /* leave 7 most siginifant bits */ + return ((int)(crc >> 25)); +} - if (status & (MII_NWAY_TX_FDX | MII_NWAY_T_FDX)) { - *duplex = FDX_CAPABLE_FULL_SELECTED; - } - if (status & (MII_NWAY_TX_FDX | MII_NWAY_TX)) { - *speed = HW_SPEED_100_MBPS; - } - if (sis900_debug > 3) { - printk(KERN_INFO"%s: Setting %s%s-duplex based on" - " auto-negotiated partner ability.\n", - dev->name, - *speed == HW_SPEED_100_MBPS ? - "100mbps " : "10mbps ", - *duplex == FDX_CAPABLE_FULL_SELECTED ? - "full" : "half"); - } - } - return (status); -} - -static u16 elAutoNegotiate(struct net_device *dev, int phy_id, int *duplex, int *speed) -{ - u16 status, retnVal; - - if (sis900_debug > 1) { - printk(KERN_INFO "AutoNegotiate...\n"); - } - mdio_write(dev, phy_id, MII_CONTROL, 0); - mdio_write(dev, phy_id, MII_CONTROL, MIICNTL_AUTO | MIICNTL_RST_AUTO); - retnVal = elMIIpollBit(dev, phy_id, MII_CONTROL, MIICNTL_RST_AUTO, - FALSE,&status); - if (!retnVal) { - printk(KERN_INFO "Not wait for Reset Complete\n"); - } - retnVal = elMIIpollBit(dev, phy_id, MII_STATUS, MIISTAT_AUTO_DONE, - TRUE, &status); - if (!retnVal) { - printk(KERN_INFO "Not wait for AutoNego Complete\n"); - } - retnVal = elMIIpollBit(dev, phy_id, MII_STATUS, MIISTAT_LINK, - TRUE, &status); - if (!retnVal) { - printk(KERN_INFO "Not wait for Link Complete\n"); - } - if (status & MIISTAT_LINK) { - elPMDreadMode(dev, phy_id, speed, duplex); - elSetMediaType(dev, *speed, *duplex); - } - return(status); -} - -static void elSetCapability(struct net_device *dev, int phy_id, - int duplex, int speed) -{ - u16 cap = ( MII_NWAY_T | MII_NWAY_T_FDX | - MII_NWAY_TX | MII_NWAY_TX_FDX | MII_NWAY_CSMA_CD ); - - if (speed != 100) { - cap &= ~( MII_NWAY_TX | MII_NWAY_TX_FDX ); - if (sis900_debug > 1) { - printk(KERN_INFO "UNSET 100Mbps\n"); - } +static void set_rx_mode(struct net_device *net_dev) +{ + long ioaddr = net_dev->base_addr; + u16 mc_filter[8]; /* 128 bits multicast hash table */ + int i; + u32 rx_mode; + + if (net_dev->flags & IFF_PROMISC) { + /* Accept any kinds of packets */ + rx_mode = RFPromiscuous; + for (i = 0; i < 8; i++) + mc_filter[i] = 0xffff; + } else if ((net_dev->mc_count > multicast_filter_limit) || + (net_dev->flags & IFF_ALLMULTI)) { + /* too many multicast addresses or accept all multicast packet */ + rx_mode = RFAAB | RFAAM; + for (i = 0; i < 8; i++) + mc_filter[i] = 0xffff; + } else { + /* Accept Broadcast packet, destination address matchs our MAC address, + use Receive Filter to reject unwanted MCAST packet */ + struct dev_mc_list *mclist; + rx_mode = RFAAB; + for (i = 0; i < 8; i++) + mc_filter[i]=0; + for (i = 0, mclist = net_dev->mc_list; mclist && i < net_dev->mc_count; + i++, mclist = mclist->next) + set_bit(sis900_compute_hashtable_index(mclist->dmi_addr), + mc_filter); } - if (!duplex) { - cap &= ~( MII_NWAY_T_FDX | MII_NWAY_TX_FDX ); - if (sis900_debug > 1) { - printk(KERN_INFO "UNSET full-duplex\n"); - } + /* update Multicast Hash Table in Receive Filter */ + for (i = 0; i < 8; i++) { + /* why plus 0x04 ??, I don't know, UNDOCUMENT FEATURE ?? */ + outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr); + outl(mc_filter[i], ioaddr + rfdr); } - mdio_write(dev, phy_id, MII_ANAR, cap); -} + outl(RFEN | rx_mode, ioaddr + rfcr); -static void elSetMediaType(struct net_device *dev, int speed, int duplex) -{ - long ioaddr = dev->base_addr; - u32 txCfgOn = 0, txCfgOff = TxDRNT; - u32 rxCfgOn = 0, rxCfgOff = 0; - - if (speed == HW_SPEED_100_MBPS) { - txCfgOn |= (TxDRNT_100 | TxHBI); - } else { - txCfgOn |= TxDRNT_10; - } - - if (duplex == FDX_CAPABLE_FULL_SELECTED) { - txCfgOn |= (TxCSI | TxHBI); - rxCfgOn |= RxATP; - } else { - txCfgOff |= (TxCSI | TxHBI); - rxCfgOff |= RxATP; - } - outl( (inl(ioaddr + txcfg) & ~txCfgOff) | txCfgOn, ioaddr + txcfg); - outl( (inl(ioaddr + rxcfg) & ~rxCfgOff) | rxCfgOn, ioaddr + rxcfg); -} - -static void set_rx_mode(struct net_device *dev) -{ - long ioaddr = dev->base_addr; - u16 mc_filter[8]; - int i; - int rx_mode; - u32 rxCfgOn = 0, rxCfgOff = 0; - u32 txCfgOn = 0, txCfgOff = 0; - - if (sis900_debug > 3) - printk(KERN_INFO "%s: set_rx_mode (%4.4x) done--" - "RxCfg %8.8x.\n", - dev->name, dev->flags, inl(ioaddr + rxcfg)); - - /* Note: do not reorder, GCC is clever about common statements. */ - if (dev->flags & IFF_PROMISC) { - printk(KERN_NOTICE"%s: Promiscuous mode enabled.\n", dev->name); - rx_mode = ACCEPT_ALL_BCASTS | ACCEPT_ALL_MCASTS | - ACCEPT_CAM_QUALIFIED | ACCEPT_ALL_PHYS; - for (i=0 ; i<8 ; i++) - mc_filter[i]=0xffff; - } else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags & IFF_ALLMULTI)) { - rx_mode = ACCEPT_ALL_BCASTS | ACCEPT_ALL_MCASTS | - ACCEPT_CAM_QUALIFIED; - for (i=0 ; i<8 ; i++) - mc_filter[i]=0xffff; - } else { - struct dev_mc_list *mclist; - rx_mode = ACCEPT_ALL_BCASTS | ACCEPT_ALL_MCASTS | - ACCEPT_CAM_QUALIFIED; - for (i=0 ; i<8 ; i++) - mc_filter[i]=0; - for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; - i++, mclist = mclist->next) - set_bit(elComputeHashTableIndex(mclist->dmi_addr), - mc_filter); - } - - for (i=0 ; i<8 ; i++) { - outl((u32)(0x00000004+i) << 16, ioaddr + rfcr); - outl(mc_filter[i], ioaddr + rfdr); - } - /* We can safely update without stopping the chip. */ - //rx_mode = ACCEPT_CAM_QUALIFIED | ACCEPT_ALL_BCASTS | ACCEPT_ALL_PHYS; - //rx_mode = ACCEPT_CAM_QUALIFIED | ACCEPT_ALL_BCASTS; - outl(RFEN | ((rx_mode & (ACCEPT_ALL_MCASTS | ACCEPT_ALL_BCASTS | - ACCEPT_ALL_PHYS)) << RFAA_shift), ioaddr + rfcr); - - if (rx_mode & ACCEPT_ALL_ERRORS) { - rxCfgOn = RxAEP | RxARP | RxAJAB; - } else { - rxCfgOff = RxAEP | RxARP | RxAJAB; - } - if (rx_mode & MAC_LOOPBACK) { - rxCfgOn |= RxATP; - txCfgOn |= TxMLB; - } else { - if (!(( (struct sis900_private *)(dev->priv) )->full_duplex)) - rxCfgOff |= RxATP; - txCfgOff |= TxMLB; - } - - if (sis900_debug > 2) { - printk(KERN_INFO "Before Set TxCfg=%8.8x\n",inl(ioaddr+txcfg)); - printk(KERN_INFO "Before Set RxCfg=%8.8x\n",inl(ioaddr+rxcfg)); - } - - outl((inl(ioaddr + rxcfg) | rxCfgOn) & ~rxCfgOff, ioaddr + rxcfg); - outl((inl(ioaddr + txcfg) | txCfgOn) & ~txCfgOff, ioaddr + txcfg); - - if (sis900_debug > 2) { - printk(KERN_INFO "After Set TxCfg=%8.8x\n",inl(ioaddr+txcfg)); - printk(KERN_INFO "After Set RxCfg=%8.8x\n",inl(ioaddr+rxcfg)); - printk(KERN_INFO "Receive Filter Register:%8.8x\n", - inl(ioaddr + rfcr)); - } - return; -} - -static void sis900_reset(struct net_device *dev) -{ - long ioaddr = dev->base_addr; - - outl(0, ioaddr + ier); - outl(0, ioaddr + imr); - outl(0, ioaddr + rfcr); + /* sis900 is capatable of looping back packet at MAC level for debugging purpose */ + if (net_dev->flags & IFF_LOOPBACK) { + u32 cr_saved; + /* We must disable Tx/Rx before setting loopback mode */ + cr_saved = inl(ioaddr + cr); + outl(cr_saved | TxDIS | RxDIS, ioaddr + cr); + /* enable loopback */ + outl(inl(ioaddr + txcfg) | TxMLB, ioaddr + txcfg); + outl(inl(ioaddr + rxcfg) | RxATX, ioaddr + rxcfg); + /* restore cr */ + outl(cr_saved, ioaddr + cr); + } + + return; +} + +static void sis900_reset(struct net_device *net_dev) +{ + long ioaddr = net_dev->base_addr; + int i = 0; + u32 status = TxRCMP | RxRCMP; + + outl(0, ioaddr + ier); + outl(0, ioaddr + imr); + outl(0, ioaddr + rfcr); - outl(RxRESET | TxRESET | RESET, ioaddr + cr); - outl(PESEL, ioaddr + cfg); + outl(RxRESET | TxRESET | RESET, ioaddr + cr); + + /* Check that the chip has finished the reset. */ + while (status && (i++ < 1000)) { + status ^= (inl(isr + ioaddr) & status); + } - set_rx_mode(dev); + outl(PESEL, ioaddr + cfg); } #ifdef MODULE int init_module(void) { - return sis900_probe(0); + return sis900_probe(NULL); } void cleanup_module(void) { - struct net_device *next_dev; + /* No need to check MOD_IN_USE, as sys_delete_module() checks. */ + while (root_sis900_dev) { + struct sis900_private *sis_priv = + (struct sis900_private *)root_sis900_dev->priv; + struct net_device *next_dev = sis_priv->next_module; + + unregister_netdev(root_sis900_dev); + release_region(root_sis900_dev->base_addr, + sis_priv->mac->io_size); + kfree(sis_priv); + kfree(root_sis900_dev); - /* No need to check MOD_IN_USE, as sys_delete_module() checks. */ - while (root_sis900_dev) { - struct sis900_private *tp = - (struct sis900_private *)root_sis900_dev->priv; - next_dev = tp->next_module; - unregister_netdev(root_sis900_dev); - release_region(root_sis900_dev->base_addr, - pci_tbl[tp->chip_id].io_size); - kfree(tp); - kfree(root_sis900_dev); - root_sis900_dev = next_dev; - } + root_sis900_dev = next_dev; + } } #endif /* MODULE */ -/* - * Local variables: - * compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -c sis900.c `[ -f /usr/include/linux/modversions.h ] && echo -DMODVERSIONS`" - * SMP-compile-command: "gcc -D__SMP__ -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -c sis900.c `[ -f /usr/include/linux/modversions.h ] && echo -DMODVERSIONS`" - * c-indent-level: 4 - * c-basic-offset: 4 - * tab-width: 4 - * End: - */ diff -u --recursive --new-file v2.3.25/linux/drivers/net/sis900.h linux/drivers/net/sis900.h --- v2.3.25/linux/drivers/net/sis900.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/sis900.h Fri Nov 5 09:51:44 1999 @@ -0,0 +1,248 @@ +/* sis900.h Definitions for SiS ethernet controllers including 7014/7016 and 900 + * Copyright 1999 Silicon Integrated System Corporation + * References: + * SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, + * preliminary Rev. 1.0 Jan. 14, 1998 + * SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support, + * preliminary Rev. 1.0 Nov. 10, 1998 + * SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, + * preliminary Rev. 1.0 Jan. 18, 1998 + * http://www.sis.com.tw/support/databook.htm + */ + +/* MAC operationl registers of SiS 7016 and SiS 900 ehternet controller */ +/* The I/O extent, SiS 900 needs 256 bytes of io address */ +#define SIS900_TOTAL_SIZE 0x100 + +/* Symbolic offsets to registers. */ +enum sis900_registers { + cr=0x0, //Command Register + cfg=0x4, //Configuration Register + mear=0x8, //EEPROM Access Register + ptscr=0xc, //PCI Test Control Register + isr=0x10, //Interrupt Status Register + imr=0x14, //Interrupt Mask Register + ier=0x18, //Interrupt Enable Register + epar=0x18, //Enhanced PHY Access Register + txdp=0x20, //Transmit Descriptor Pointer Register + txcfg=0x24, //Transmit Configuration Register + rxdp=0x30, //Receive Descriptor Pointer Register + rxcfg=0x34, //Receive Configuration Register + flctrl=0x38, //Flow Control Register + rxlen=0x3c, //Receive Packet Length Register + rfcr=0x48, //Receive Filter Control Register + rfdr=0x4C, //Receive Filter Data Register + pmctrl=0xB0, //Power Management Control Register + pmer=0xB4 //Power Management Wake-up Event Register +}; + +/* Symbolic names for bits in various registers */ +enum sis900_command_register_bits { + RESET = 0x00000100, SWI = 0x00000080, RxRESET = 0x00000020, + TxRESET = 0x00000010, RxDIS = 0x00000008, RxENA = 0x00000004, + TxDIS = 0x00000002, TxENA = 0x00000001 +}; + +enum sis900_configuration_register_bits { + DESCRFMT = 0x00000100 /* 7016 specific */, REQALG = 0x00000080, + SB = 0x00000040, POW = 0x00000020, EXD = 0x00000010, + PESEL = 0x00000008, LPM = 0x00000004, BEM = 0x00000001 +}; + +enum sis900_eeprom_access_reigster_bits { + MDC = 0x00000040, MDDIR = 0x00000020, MDIO = 0x00000010, /* 7016 specific */ + EECS = 0x00000008, EECLK = 0x00000004, EEDO = 0x00000002, + EEDI = 0x00000001 +}; + +enum sis900_interrupt_register_bits { + WKEVT = 0x10000000, TxPAUSEEND = 0x08000000, TxPAUSE = 0x04000000, + TxRCMP = 0x02000000, RxRCMP = 0x01000000, DPERR = 0x00800000, + SSERR = 0x00400000, RMABT = 0x00200000, RTABT = 0x00100000, + RxSOVR = 0x00010000, HIBERR = 0x00008000, SWINT = 0x00001000, + MIBINT = 0x00000800, TxURN = 0x00000400, TxIDLE = 0x00000200, + TxERR = 0x00000100, TxDESC = 0x00000080, TxOK = 0x00000040, + RxORN = 0x00000020, RxIDLE = 0x00000010, RxEARLY = 0x00000008, + RxERR = 0x00000004, RxDESC = 0x00000002, RxOK = 0x00000001 +}; + +enum sis900_interrupt_enable_reigster_bits { + IE = 0x00000001 +}; + +/* maximum dma burst fro transmission and receive*/ +#define MAX_DMA_RANGE 7 /* actually 0 means MAXIMUM !! */ +#define TxMXDMA_shift 20 +#define RxMXDMA_shift 20 +#define TX_DMA_BURST 0 +#define RX_DMA_BURST 0 + +/* transmit FIFO threshholds */ +#define TX_FILL_THRESH 16 /* 1/4 FIFO size */ +#define TxFILLT_shift 8 +#define TxDRNT_shift 0 +#define TxDRNT_100 48 /* 3/4 FIFO size */ +#define TxDRNT_10 16 /* 1/2 FIFO size */ + +enum sis900_transmit_config_register_bits { + TxCSI = 0x80000000, TxHBI = 0x40000000, TxMLB = 0x20000000, + TxATP = 0x10000000, TxIFG = 0x0C000000, TxFILLT = 0x00003F00, + TxDRNT = 0x0000003F +}; + +/* recevie FIFO thresholds */ +#define RxDRNT_shift 1 +#define RxDRNT_100 24 /* 3/4 FIFO size */ +#define RxDRNT_10 16 /* 1/2 FIFO size */ + +enum sis900_reveive_config_register_bits { + RxAEP = 0x80000000, RxARP = 0x40000000, RxATX = 0x10000000, + RxAJAB = 0x08000000, RxDRNT = 0x0000007F +}; + +#define RFAA_shift 28 +#define RFADDR_shift 16 + +enum sis900_receive_filter_control_register_bits { + RFEN = 0x80000000, RFAAB = 0x40000000, RFAAM = 0x20000000, + RFAAP = 0x10000000, RFPromiscuous = (RFAAB|RFAAM|RFAAP) +}; + +enum sis900_reveive_filter_data_mask { + RFDAT = 0x0000FFFF +}; + +/* EEPROM Addresses */ +enum sis900_eeprom_address { + EEPROMSignature = 0x00, EEPROMVendorID = 0x02, EEPROMDeviceID = 0x03, + EEPROMMACAddr = 0x08, EEPROMChecksum = 0x0b +}; + +/* The EEPROM commands include the alway-set leading bit. Refer to NM93Cxx datasheet */ +enum sis900_eeprom_command { + EEread = 0x0180, EEwrite = 0x0140, EEerase = 0x01C0, + EEwriteEnable = 0x0130, EEwriteDisable = 0x0100, + EEeraseAll = 0x0120, EEwriteAll = 0x0110, + EEaddrMask = 0x013F, EEcmdShift = 16 +}; + +/* Manamgement Data I/O (mdio) frame */ +#define MIIread 0x6000 +#define MIIwrite 0x5002 +#define MIIpmdShift 7 +#define MIIregShift 2 +#define MIIcmdLen 16 +#define MIIcmdShift 16 + +/* Buffer Descriptor Status*/ +enum sis900_buffer_status { + OWN = 0x80000000, MORE = 0x40000000, INTR = 0x20000000, + SUPCRC = 0x10000000, INCCRC = 0x10000000, + OK = 0x08000000, DSIZE = 0x00000FFF +}; +/* Status for TX Buffers */ +enum sis900_tx_buffer_status { + ABORT = 0x04000000, UNDERRUN = 0x02000000, NOCARRIER = 0x01000000, + DEFERD = 0x00800000, EXCDEFER = 0x00400000, OWCOLL = 0x00200000, + EXCCOLL = 0x00100000, COLCNT = 0x000F0000 +}; + +enum sis900_rx_bufer_status { + OVERRUN = 0x02000000, DEST = 0x00800000, BCAST = 0x01800000, + MCAST = 0x01000000, UNIMATCH = 0x00800000, TOOLONG = 0x00400000, + RUNT = 0x00200000, RXISERR = 0x00100000, CRCERR = 0x00080000, + FAERR = 0x00040000, LOOPBK = 0x00020000, RXCOL = 0x00010000 +}; + +/* MII register offsets */ +enum mii_registers { + MII_CONTROL = 0x0000, MII_STATUS = 0x0001, MII_PHY_ID0 = 0x0002, + MII_PHY_ID1 = 0x0003, MII_ANADV = 0x0004, MII_ANLPAR = 0x0005, + MII_ANEXT = 0x0006 +}; + +/* mii registers specific to SiS 900 */ +enum sis_mii_registers { + MII_CONFIG1 = 0x0010, MII_CONFIG2 = 0x0011, MII_STSOUT = 0x0012, + MII_MASK = 0x0013 +}; + +/* mii registers specific to AMD 79C901 */ +enum amd_mii_registers { + MII_STATUS_SUMMARY = 0x0018 +}; + +/* MII Control register bit definitions. */ +enum mii_control_register_bits { + MII_CNTL_FDX = 0x0100, MII_CNTL_RST_AUTO = 0x0200, + MII_CNTL_ISOLATE = 0x0400, MII_CNTL_PWRDWN = 0x0800, + MII_CNTL_AUTO = 0x1000, MII_CNTL_SPEED = 0x2000, + MII_CNTL_LPBK = 0x4000, MII_CNTL_RESET = 0x8000 +}; + +/* MII Status register bit */ +enum mii_status_register_bits { + MII_STAT_EXT = 0x0001, MII_STAT_JAB = 0x0002, + MII_STAT_LINK = 0x0004, MII_STAT_CAN_AUTO = 0x0008, + MII_STAT_FAULT = 0x0010, MII_STAT_AUTO_DONE = 0x0020, + MII_STAT_CAN_T = 0x0800, MII_STAT_CAN_T_FDX = 0x1000, + MII_STAT_CAN_TX = 0x2000, MII_STAT_CAN_TX_FDX = 0x4000, + MII_STAT_CAN_T4 = 0x8000 +}; + +#define MII_ID1_OUI_LO 0xFC00 /* low bits of OUI mask */ +#define MII_ID1_MODEL 0x03F0 /* model number */ +#define MII_ID1_REV 0x000F /* model number */ + +/* MII NWAY Register Bits ... + valid for the ANAR (Auto-Negotiation Advertisement) and + ANLPAR (Auto-Negotiation Link Partner) registers */ +enum mii_nway_register_bits { + MII_NWAY_NODE_SEL = 0x001f, MII_NWAY_CSMA_CD = 0x0001, + MII_NWAY_T = 0x0020, MII_NWAY_T_FDX = 0x0040, + MII_NWAY_TX = 0x0080, MII_NWAY_TX_FDX = 0x0100, + MII_NWAY_T4 = 0x0200, MII_NWAY_PAUSE = 0x0400, + MII_NWAY_RF = 0x2000, MII_NWAY_ACK = 0x4000, + MII_NWAY_NP = 0x8000 +}; + +enum mii_stsout_register_bits { + MII_STSOUT_LINK_FAIL = 0x4000, + MII_STSOUT_SPD = 0x0080, MII_STSOUT_DPLX = 0x0040 +}; + +enum mii_stssum_register_bits { + MII_STSSUM_LINK = 0x0008, MII_STSSUM_DPLX = 0x0004, + MII_STSSUM_AUTO = 0x0002, MII_STSSUM_SPD = 0x0001 +}; + +#define FDX_CAPABLE_DUPLEX_UNKNOWN 0 +#define FDX_CAPABLE_HALF_SELECTED 1 +#define FDX_CAPABLE_FULL_SELECTED 2 + +#define HW_SPEED_UNCONFIG 0 +#define HW_SPEED_HOME 1 +#define HW_SPEED_10_MBPS 10 +#define HW_SPEED_100_MBPS 100 +#define HW_SPEED_DEFAULT (HW_SPEED_100_MBPS) + +#define CRC_SIZE 4 +#define MAC_HEADER_SIZE 14 + +#define TX_BUF_SIZE 1536 +#define RX_BUF_SIZE 1536 + +#define NUM_TX_DESC 16 /* Number of Tx descriptor registers. */ +#define NUM_RX_DESC 16 /* Number of Rx descriptor registers. */ + +#define TRUE 1 +#define FALSE 0 + +/* PCI stuff, should be move to pic.h */ +#define PCI_DEVICE_ID_SI_900 0x900 +#define PCI_DEVICE_ID_SI_7016 0x7016 + +/* ioctl for accessing MII transveiver */ +#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Get the PHY in use. */ +#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read a PHY register. */ +#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write a PHY register */ diff -u --recursive --new-file v2.3.25/linux/drivers/net/tokenring/tms380tr.c linux/drivers/net/tokenring/tms380tr.c --- v2.3.25/linux/drivers/net/tokenring/tms380tr.c Fri Oct 15 15:25:13 1999 +++ linux/drivers/net/tokenring/tms380tr.c Tue Nov 2 17:07:08 1999 @@ -16,6 +16,7 @@ * - SysKonnect TR4/16 PCI (SK-4591) * - Compaq TR 4/16 PCI * - Thomas-Conrad TC4048 4/16 PCI + * - 3Com 3C339 Token Link Velocity * - Any ISA or PCI adapter using only the TMS380 chipset * * Sources: @@ -123,6 +124,8 @@ "SK NET TR 4/16 PCI"}, { TMS_PCI, PCI_VENDOR_ID_TCONRAD, PCI_DEVICE_ID_TCONRAD_TOKENRING, "Thomas-Conrad TC4048 PCI 4/16"}, + { TMS_PCI, PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C339, + "3Com Token Link Velocity"}, { 0, 0, 0, NULL} }; diff -u --recursive --new-file v2.3.25/linux/drivers/parport/Config.in linux/drivers/parport/Config.in --- v2.3.25/linux/drivers/parport/Config.in Fri Oct 15 15:25:13 1999 +++ linux/drivers/parport/Config.in Wed Nov 3 14:43:54 1999 @@ -27,18 +27,18 @@ dep_tristate ' Multiface III parallel port' CONFIG_PARPORT_MFC3 $CONFIG_PARPORT fi else - define_bool CONFIG_PARPORT_AMIGA n - define_bool CONFIG_PARPORT_MFC3 n + define_tristate CONFIG_PARPORT_AMIGA n + define_tristate CONFIG_PARPORT_MFC3 n fi if [ "$CONFIG_ATARI" = "y" ]; then dep_tristate ' Atari hardware' CONFIG_PARPORT_ATARI $CONFIG_PARPORT else - define_bool CONFIG_PARPORT_ATARI n + define_tristate CONFIG_PARPORT_ATARI n fi if [ "$CONFIG_SBUS" = "y" ]; then dep_tristate ' Sparc hardware (EXPERIMENTAL)' CONFIG_PARPORT_SUNBPP $CONFIG_PARPORT else - define_bool CONFIG_PARPORT_SUNBPP n + define_tristate CONFIG_PARPORT_SUNBPP n fi # If exactly one hardware type is selected then parport will optimise away diff -u --recursive --new-file v2.3.25/linux/drivers/parport/share.c linux/drivers/parport/share.c --- v2.3.25/linux/drivers/parport/share.c Sat Oct 9 11:47:50 1999 +++ linux/drivers/parport/share.c Sat Nov 6 10:38:40 1999 @@ -137,7 +137,7 @@ request_module ("parport_lowlevel"); if (portlist) /* The user has a parport_lowlevel alias in - * conf.modules. Warn them that it won't work + * modules.conf. Warn them that it won't work * for long. */ printk (KERN_WARNING "parport: 'parport_lowlevel' is deprecated; " diff -u --recursive --new-file v2.3.25/linux/drivers/sbus/char/flash.c linux/drivers/sbus/char/flash.c --- v2.3.25/linux/drivers/sbus/char/flash.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/sbus/char/flash.c Tue Nov 2 17:40:11 1999 @@ -55,12 +55,13 @@ return -ENXIO; } - if (vma->vm_offset > size) + if (vma->vm_pgoff > (size >> PAGE_SHIFT)) return -ENXIO; - addr += vma->vm_offset; + off = vma->vm_pgoff << PAGE_SHIFT; + addr += off; - if (vma->vm_end - (vma->vm_start + vma->vm_offset) > size) - size = vma->vm_end - (vma->vm_start + vma->vm_offset); + if (vma->vm_end - (vma->vm_start + off) > size) + size = vma->vm_end - (vma->vm_start + off); pgprot_val(vma->vm_page_prot) &= ~(_PAGE_CACHE); pgprot_val(vma->vm_page_prot) |= _PAGE_E; diff -u --recursive --new-file v2.3.25/linux/drivers/sbus/char/vfc_dev.c linux/drivers/sbus/char/vfc_dev.c --- v2.3.25/linux/drivers/sbus/char/vfc_dev.c Wed Jun 9 14:44:25 1999 +++ linux/drivers/sbus/char/vfc_dev.c Tue Nov 2 17:40:11 1999 @@ -572,8 +572,6 @@ if(map_size > sizeof(struct vfc_regs)) map_size=sizeof(struct vfc_regs); - - if(vma->vm_offset & ~PAGE_MASK) return -ENXIO; vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO | VM_MAYREAD | VM_MAYWRITE | VM_MAYSHARE; map_offset=(unsigned int)dev->phys_regs; ret = io_remap_page_range(vma->vm_start,map_offset,map_size, diff -u --recursive --new-file v2.3.25/linux/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c --- v2.3.25/linux/drivers/scsi/ide-scsi.c Fri Oct 22 13:21:50 1999 +++ linux/drivers/scsi/ide-scsi.c Fri Nov 5 10:40:23 1999 @@ -299,6 +299,11 @@ scsi->pc = NULL; } +static inline unsigned long get_timeout(idescsi_pc_t *pc) +{ + return IDE_MAX(WAIT_CMD, pc->timeout - jiffies); +} + /* * Our interrupt handler. */ @@ -359,8 +364,7 @@ pc->actually_transferred += temp; pc->current_position += temp; idescsi_discard_data (drive,bcount - temp); - drive->timeout = IDE_MAX(WAIT_CMD, pc->timeout - jiffies); - ide_set_handler(drive, &idescsi_pc_intr); + ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); return; } #if IDESCSI_DEBUG_LOG @@ -384,8 +388,7 @@ pc->actually_transferred+=bcount; /* Update the current position */ pc->current_position+=bcount; - drive->timeout = IDE_MAX(WAIT_CMD, pc->timeout - jiffies); - ide_set_handler(drive, &idescsi_pc_intr); /* And set the interrupt handler again */ + ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); /* And set the interrupt handler again */ } static void idescsi_transfer_pc (ide_drive_t *drive) @@ -404,8 +407,7 @@ ide_do_reset (drive); return; } - drive->timeout = IDE_MAX(WAIT_CMD, pc->timeout - jiffies); - ide_set_handler(drive, &idescsi_pc_intr); /* Set the interrupt routine */ + ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); /* Set the interrupt routine */ atapi_output_bytes (drive, scsi->pc->c, 12); /* Send the actual packet */ } @@ -439,8 +441,7 @@ (void) (HWIF(drive)->dmaproc(ide_dma_begin, drive)); } if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { - drive->timeout = IDE_MAX(WAIT_CMD, pc->timeout - jiffies); - ide_set_handler (drive, &idescsi_transfer_pc); + ide_set_handler (drive, &idescsi_transfer_pc, get_timeout(pc), NULL); OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */ } else { OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); diff -u --recursive --new-file v2.3.25/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v2.3.25/linux/drivers/scsi/scsi.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/scsi/scsi.c Sat Nov 6 10:38:40 1999 @@ -21,7 +21,7 @@ * support added by Michael Neuffer * * Added request_module("scsi_hostadapter") for kerneld: - * (Put an "alias scsi_hostadapter your_hostadapter" in /etc/conf.modules) + * (Put an "alias scsi_hostadapter your_hostadapter" in /etc/modules.conf) * Bjorn Ekwall * (changed to kmod) * diff -u --recursive --new-file v2.3.25/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c --- v2.3.25/linux/drivers/scsi/sr.c Fri Oct 15 15:25:14 1999 +++ linux/drivers/scsi/sr.c Wed Nov 3 14:01:48 1999 @@ -862,8 +862,10 @@ int the_result, retries; Scsi_Cmnd *SCpnt; + spin_lock_irq(&io_request_lock); buffer = (unsigned char *) scsi_malloc(512); SCpnt = scsi_allocate_device(NULL, scsi_CDs[i].device, 1); + spin_unlock_irq(&io_request_lock); retries = 3; do { @@ -957,7 +959,9 @@ "" }; + spin_lock_irq(&io_request_lock); buffer = (unsigned char *) scsi_malloc(512); + spin_unlock_irq(&io_request_lock); cmd[0] = MODE_SENSE; cmd[1] = (scsi_CDs[i].device->lun << 5) & 0xe0; cmd[2] = 0x2a; @@ -1030,6 +1034,8 @@ { Scsi_Cmnd *SCpnt; Scsi_Device *device = scsi_CDs[MINOR(cdi->dev)].device; + unsigned char *buffer = cgc->buffer; + int buflen; int stat; /* get the device */ @@ -1037,6 +1043,20 @@ if (SCpnt == NULL) return -ENODEV; /* this just doesn't seem right /axboe */ + /* use buffer for ISA DMA */ + buflen = (cgc->buflen + 511) & ~511; + if (cgc->buffer && SCpnt->host->unchecked_isa_dma && + (virt_to_phys(cgc->buffer) + cgc->buflen - 1 > ISA_DMA_THRESHOLD)) { + spin_lock_irq(&io_request_lock); + buffer = scsi_malloc(buflen); + spin_unlock_irq(&io_request_lock); + if (buffer == NULL) { + printk("sr: SCSI DMA pool exhausted."); + return -ENOMEM; + } + memcpy(buffer, cgc->buffer, cgc->buflen); + } + /* set the LUN */ cgc->cmd[1] |= device->lun << 5; @@ -1044,8 +1064,8 @@ SCpnt->request.rq_dev = cdi->dev; /* scsi_do_cmd sets the command length */ SCpnt->cmd_len = 0; - - scsi_wait_cmd (SCpnt, (void *)cgc->cmd, (void *)cgc->buffer, cgc->buflen, + + scsi_wait_cmd (SCpnt, (void *)cgc->cmd, (void *)buffer, cgc->buflen, sr_init_done, SR_TIMEOUT, MAX_RETRIES); stat = SCpnt->result; @@ -1054,6 +1074,12 @@ SCpnt->request.rq_dev = MKDEV(0, 0); scsi_release_command(SCpnt); SCpnt = NULL; + + /* write DMA buffer back if used */ + if (buffer && (buffer != cgc->buffer)) { + memcpy(cgc->buffer, buffer, cgc->buflen); + scsi_free(buffer, buflen); + } return stat; } diff -u --recursive --new-file v2.3.25/linux/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c --- v2.3.25/linux/drivers/scsi/sr_ioctl.c Mon Oct 4 15:49:30 1999 +++ linux/drivers/scsi/sr_ioctl.c Wed Nov 3 14:01:48 1999 @@ -36,6 +36,12 @@ req = &SCpnt->request; req->rq_status = RQ_SCSI_DONE; /* Busy, but indicate request done */ + + if (SCpnt->buffer && req->buffer && SCpnt->buffer != req->buffer) { + memcpy(req->buffer, SCpnt->buffer, SCpnt->bufflen); + scsi_free(SCpnt->buffer, (SCpnt->bufflen + 511) & ~511); + SCpnt->buffer = req->buffer; + } if (req->sem != NULL) { up(req->sem); @@ -52,27 +58,33 @@ Scsi_Device * SDev; int result, err = 0, retries = 0; unsigned long flags; + char * bounce_buffer; spin_lock_irqsave(&io_request_lock, flags); SDev = scsi_CDs[target].device; SCpnt = scsi_allocate_device(NULL, scsi_CDs[target].device, 1); spin_unlock_irqrestore(&io_request_lock, flags); + /* use ISA DMA buffer if necessary */ + SCpnt->request.buffer=buffer; + if (buffer && SCpnt->host->unchecked_isa_dma && + (virt_to_phys(buffer) + buflength - 1 > ISA_DMA_THRESHOLD)) { + bounce_buffer = (char *)scsi_malloc((buflength + 511) & ~511); + if (bounce_buffer == NULL) { + printk("SCSI DMA pool exhausted."); + return -ENOMEM; + } + memcpy(bounce_buffer, (char *)buffer, buflength); + buffer = bounce_buffer; + } + retry: if( !scsi_block_when_processing_errors(SDev) ) return -ENODEV; - { - DECLARE_MUTEX_LOCKED(sem); - SCpnt->request.sem = &sem; - spin_lock_irqsave(&io_request_lock, flags); - scsi_do_cmd(SCpnt, - (void *) sr_cmd, buffer, buflength, sr_ioctl_done, - IOCTL_TIMEOUT, IOCTL_RETRIES); - spin_unlock_irqrestore(&io_request_lock, flags); - down(&sem); - SCpnt->request.sem = NULL; - } - + + scsi_wait_cmd(SCpnt, (void *)sr_cmd, (void *)buffer, buflength, + sr_ioctl_done, IOCTL_TIMEOUT, IOCTL_RETRIES); + result = SCpnt->result; /* Minimal error checking. Ignore cases we know about, and report the rest. */ diff -u --recursive --new-file v2.3.25/linux/drivers/scsi/sr_vendor.c linux/drivers/scsi/sr_vendor.c --- v2.3.25/linux/drivers/scsi/sr_vendor.c Tue Sep 7 12:14:06 1999 +++ linux/drivers/scsi/sr_vendor.c Wed Nov 3 14:01:48 1999 @@ -158,7 +158,9 @@ if (scsi_CDs[minor].cdi.mask & CDC_MULTI_SESSION) return 0; + spin_lock_irq(&io_request_lock); buffer = (unsigned char *) scsi_malloc(512); + spin_unlock_irq(&io_request_lock); if(!buffer) return -ENOMEM; sector = 0; /* the multisession sector offset goes here */ diff -u --recursive --new-file v2.3.25/linux/drivers/sgi/char/graphics.c linux/drivers/sgi/char/graphics.c --- v2.3.25/linux/drivers/sgi/char/graphics.c Tue Aug 31 17:29:14 1999 +++ linux/drivers/sgi/char/graphics.c Tue Nov 2 17:40:11 1999 @@ -271,8 +271,6 @@ uint size; size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; /* 1. Set our special graphic virtualizer */ vma->vm_ops = &graphics_mmap; diff -u --recursive --new-file v2.3.25/linux/drivers/sgi/char/shmiq.c linux/drivers/sgi/char/shmiq.c --- v2.3.25/linux/drivers/sgi/char/shmiq.c Mon Oct 11 15:38:15 1999 +++ linux/drivers/sgi/char/shmiq.c Tue Nov 2 17:40:11 1999 @@ -318,7 +318,7 @@ if (minor-- == 0) return -EINVAL; - if (vma->vm_offset != 0) + if (vma->vm_pgoff) return -EINVAL; size = vma->vm_end - vma->vm_start; diff -u --recursive --new-file v2.3.25/linux/drivers/sound/maestro.c linux/drivers/sound/maestro.c --- v2.3.25/linux/drivers/sound/maestro.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/sound/maestro.c Tue Nov 2 17:07:08 1999 @@ -24,9 +24,8 @@ * Heavily modified by Zach Brown based on lunch * with ESS engineers. Many thanks to Howard Kim for providing * contacts and hardware. Honorable mention goes to Eric - * Brombaugh for the BOB routines and great record code hacking. - * Best regards to the proprietors of Hack Central for fine - * lodging. + * Brombaugh for all sorts of things. Best regards to the + * proprietors of Hack Central for fine lodging. * * Supported devices: * /dev/dsp0-7 standard /dev/dsp device, (mostly) OSS compatible @@ -79,12 +78,12 @@ * The wavecache makes our life even more fun. First off, it can * only address the first 28 bits of PCI address space, making it * useless on quite a few architectures. Secondly, its insane. - * It claims to only fetch from 4 regions of PCI space, each 4 meg in length. + * It claims to fetch from 4 regions of PCI space, each 4 meg in length. * But that doesn't really work. You can only use 1 region. So all our * allocations have to be in 4meg of each other. Booo. Hiss. * So we have a module parameter, dsps_order, that is the order of * the number of dsps to provide. All their buffer space is allocated - * on open time. The sonicvibes oss routines we inherited really want + * on open time. The sonicvibes OSS routines we inherited really want * power of 2 buffers, so we have all those next to each other, then * 512 byte regions for the recording wavecaches. This ends up * wasting quite a bit of memory. The only fixes I can see would be @@ -103,8 +102,31 @@ * get at some of them :(. The mixer interface doesn't, however. * We also have an OSS state lock that is thrown around in a few * places. + * + * This driver has brute force APM suspend support. We catch suspend + * notifications and stop all work being done on the chip. Any people + * that try between this shutdown and the real suspend operation will + * be put to sleep. When we resume we restore our software state on + * the chip and wake up the people that were using it. The code thats + * being used now is quite dirty and assumes we're on a uni-processor + * machine. Much of it will need to be cleaned up for SMP ACPI or + * similar. * * History + * v0.10 - Oct 28 1999 - Zach Brown + * aha, so, sometimes the WP writes a status word to offset 0 + * from one of the PCMBARs. rearrange allocation accordingly.. + * Jeroen Hoogervorst submits 7500 fix out of nowhere. yay. :) + * v0.09 - Oct 23 1999 - Zach Brown + * added APM support. + * re-order something such that some 2Es now work. Magic! + * new codec reset routine. made some codecs come to life. + * fix clear_advance, sync some control with ESS. + * now write to all base regs to be paranoid. + * v0.08 - Oct 20 1999 - Zach Brown + * Fix initial buflen bug. I am so smart. also smp compiling.. + * I owe Eric yet another beer: fixed recmask, igain, + * muting, and adc sync consistency. Go Team. * v0.07 - Oct 4 1999 - Zach Brown * tweak adc/dac, formating, and stuff to allow full duplex * allocate dsps memory at open() so we can fit in the wavecache window @@ -140,32 +162,41 @@ * anyone have a pt101 codec? * mmap(), but beware stereo encoding nastiness. * actually post pci writes - * look really hard at the apu/bob/dma buffer code paths. * fix bob frequency * do smart things with ac97 2.0 bits. - * test different sized writes - * fixup latencies ? - * get apm save/restore working? + * ugh.. non aligned writes in the middle of a data stream.. ugh * sort out 0x34->0x36 crap in init + * docking and dual codecs and 978? + * pcm_sync? + * actually use LRLR * - * apm is kind of a mess. I doubt we can rely on the machine keeping - * power to the maestro/codecs when we suspend. This means we have - * to keep full mixer/wavecache/apu state. bother. if we could rely - * on the chips being powered we would simply turn down the apus and - * bob and it would all just work out. That last bit I've implemented - * before I realized how much it was all going to suck :). - * * it also would be fun to have a mode that would not use pci dma at all * but would copy into the wavecache on board memory and use that - * on architectures that don't like the maestro's pci dma ickiness - * throughout. + * on architectures that don't like the maestro's pci dma ickiness. */ /*****************************************************************************/ - -#include #include +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) + + #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL} + #define wait_queue_head_t struct wait_queue * + #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->base_address[0] & PCI_BASE_ADDRESS_IO_MASK) + #define SILLY_INIT_SEM(SEM) SEM=MUTEX; + #define init_waitqueue_head init_waitqueue + #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC) + +#else + + #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->resource[0].start) + #define SILLY_INIT_SEM(SEM) init_MUTEX(&SEM) + #define SILLY_MAKE_INIT(FUNC) __init FUNC + +#endif + #include #include #include @@ -175,16 +206,23 @@ #include #include #include +#include #include #include #include #include -#include #include #include #ifdef CONFIG_APM #include +static int maestro_apm_callback(apm_event_t ae); +static int in_suspend=0; +wait_queue_head_t suspend_queue; +static void check_suspend(void); +#define CHECK_SUSPEND check_suspend(); +#else +#define CHECK_SUSPEND #endif #include "maestro.h" @@ -202,7 +240,7 @@ #endif /* --------------------------------------------------------------------- */ -#define DRIVER_VERSION "0.07" +#define DRIVER_VERSION "0.10" #ifndef PCI_VENDOR_ESS #define PCI_VENDOR_ESS 0x125D @@ -235,9 +273,13 @@ #define MAX_DSP_ORDER 3 #define MAX_DSPS (1<<3) #define NR_DSPS (1< 100 in bytes */ - {SOUND_MIXER_VOLUME, 0x3232}, - {SOUND_MIXER_BASS, 0x3232}, - {SOUND_MIXER_TREBLE, 0x3232}, - {SOUND_MIXER_SPEAKER, 0x3232}, - {SOUND_MIXER_MIC, 0x3232}, - {SOUND_MIXER_LINE, 0x3232}, - {SOUND_MIXER_CD, 0x3232}, - {SOUND_MIXER_VIDEO, 0x3232}, - {SOUND_MIXER_LINE1, 0x3232}, - {SOUND_MIXER_PCM, 0x3232}, - {SOUND_MIXER_IGAIN, 0x3232}, - {-1,0} + unsigned int mixer_defaults[SOUND_MIXER_NRDEVICES] = { + [SOUND_MIXER_VOLUME] = 0x3232, + [SOUND_MIXER_BASS] = 0x3232, + [SOUND_MIXER_TREBLE] = 0x3232, + [SOUND_MIXER_SPEAKER] = 0x3232, + [SOUND_MIXER_MIC] = 0x3232, + [SOUND_MIXER_LINE] = 0x3232, + [SOUND_MIXER_CD] = 0x3232, + [SOUND_MIXER_VIDEO] = 0x3232, + [SOUND_MIXER_LINE1] = 0x3232, + [SOUND_MIXER_PCM] = 0x3232, + [SOUND_MIXER_IGAIN] = 0x3232 }; static struct ac97_mixer_hw { @@ -500,7 +543,7 @@ [SOUND_MIXER_VIDEO] = {0x14,31}, [SOUND_MIXER_LINE1] = {0x16,31}, [SOUND_MIXER_PCM] = {0x18,31}, - [SOUND_MIXER_IGAIN] = {0x1c,31} + [SOUND_MIXER_IGAIN] = {0x1c,15} }; #if 0 /* *shrug* removed simply because we never used it. @@ -563,18 +606,22 @@ M_printk("wrote mixer %d (0x%x) %d,%d",mixer,mh->offset,left,right); if(AC97_STEREO_MASK & (1<scale) / 100; left = (left * mh->scale) / 100; + if ((left == 0) && (right == 0)) + val |= 0x8000; } else { right = ((100 - right) * mh->scale) / 100; left = ((100 - left) * mh->scale) / 100; + if((left == mh->scale) && (right == mh->scale)) + val |= 0x8000; } - val = (left << 8) | right; + val |= (left << 8) | right; } else if (mixer == SOUND_MIXER_SPEAKER) { val = (((100 - left) * mh->scale) / 100) << 1; @@ -610,13 +657,13 @@ AC97_REC_PHONE }; -static unsigned int ac97_rm2oss[] = { - [AC97_REC_MIC] = SOUND_MIXER_MIC, - [AC97_REC_CD] = SOUND_MIXER_CD, - [AC97_REC_VIDEO] = SOUND_MIXER_VIDEO, - [AC97_REC_AUX] = SOUND_MIXER_LINE1, - [AC97_REC_LINE] = SOUND_MIXER_LINE, - [AC97_REC_PHONE] = SOUND_MIXER_PHONEIN +static unsigned int ac97_oss_mask[] = { + [AC97_REC_MIC] = SOUND_MASK_MIC, + [AC97_REC_CD] = SOUND_MASK_CD, + [AC97_REC_VIDEO] = SOUND_MASK_VIDEO, + [AC97_REC_AUX] = SOUND_MASK_LINE1, + [AC97_REC_LINE] = SOUND_MASK_LINE, + [AC97_REC_PHONE] = SOUND_MASK_PHONEIN }; /* indexed by bit position */ @@ -635,21 +682,20 @@ want us to express that to the user. the caller guarantees that we have a supported bit set, and they must be holding the card's spinlock */ -static int ac97_recmask_io(struct ess_card *card, int rw, int mask) +static int +ac97_recmask_io(struct ess_card *card, int read, int mask) { - unsigned int val; + unsigned int val = ac97_oss_mask[ maestro_ac97_get(card->iobase, 0x1a) & 0x7 ]; - if (rw) { - /* read it from the card */ - val = maestro_ac97_get(card->iobase, 0x1a) & 0x7; - return ac97_rm2oss[val]; - } + if (read) return val; + + /* oss can have many inputs, maestro cant. try + to pick the 'new' one */ - /* else, write the first set in the mask as the - output */ + if (mask != val) mask &= ~val; - val = ffs(mask); - val = ac97_oss_rm[val-1]; + val = ffs(mask) - 1; + val = ac97_oss_rm[val]; val |= val << 8; /* set both channels */ M_printk("maestro: setting ac97 recmask to 0x%x\n",val); @@ -678,33 +724,6 @@ card->mix.write_mixer = ac97_write_mixer; card->mix.recmask_io = ac97_recmask_io; -#if 0 /* this needs to be thought about harder */ - /* aim at the second codec */ - outw(0x21, iobase+0x38); - outw(0x5555, iobase+0x3a); - outw(0x5555, iobase+0x3c); - udelay(1); - vend1 = maestro_ac97_get(iobase, 0x7c); - vend2 = maestro_ac97_get(iobase, 0x7e); - if(vend1 != 0xffff || vend2 != 0xffff) { - printk("maestro: second codec 0x%4x%4x found, enabling both. please report this.\n", - vend1,vend2); - /* enable them both */ - outw(0x00, iobase+0x38); - outw(0xFFFC, iobase+0x3a); - outw(0x000C, iobase+0x3c); - } else { - /* back to the first only */ - outw(0x0, iobase+0x38); - outw(0x0, iobase+0x3a); - outw(0x0, iobase+0x3c); - } - udelay(1); -#endif - - /* perform codec reset */ - maestro_ac97_set(iobase, 0x00, 0xFFFF); - vend1 = maestro_ac97_get(iobase, 0x7c); vend2 = maestro_ac97_get(iobase, 0x7e); @@ -773,49 +792,75 @@ return 0; } -static void maestro_ac97_reset(int ioaddr) +/* this is very magic, and very slow.. */ +static void +maestro_ac97_reset(int ioaddr, struct pci_dev *pcidev) { -/* outw(0x2000, ioaddr+0x36); - inb(ioaddr); - mdelay(1); - outw(0x0000, ioaddr+0x36); - inb(ioaddr); - mdelay(1);*/ + u16 save_68; + u16 w; - /* well this seems to work a little - better on my pci board.. probably - because gpio is wired to ac97 reset */ + outw( inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); + outw( inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); + outw( inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); - /* this screws around with the gpio - mask/input/direction.. */ + /* reset the first codec */ outw(0x0000, ioaddr+0x36); + save_68 = inw(ioaddr+0x68); + pci_read_config_word(pcidev, 0x58, &w); /* something magical with gpio and bus arb. */ + if( w & 0x1) + save_68 |= 0x10; + outw(0xfffe, ioaddr + 0x64); /* tickly gpio 0.. */ + outw(0x0001, ioaddr + 0x68); + outw(0x0000, ioaddr + 0x60); udelay(20); - outw(0xFFFE, ioaddr+0x64); - outw(0x1, ioaddr+0x68); - outw(0x0, ioaddr+0x60); - udelay(20); - outw(0x1, ioaddr+0x60); - udelay(20); /* other source says 500ms.. INSANE */ - outw(0x2000, ioaddr+0x36); - udelay(20); - outw(0x3000, ioaddr+0x36); - udelay(200); - outw(0x0001, ioaddr+0x68); - outw(0xFFFF, ioaddr+0x64); + outw(0x0001, ioaddr + 0x60); + mdelay(20); - /* strange strange reset tickling the ring bus */ - outw(0x0, ioaddr+0x36); - udelay(20); - outw(0x200, ioaddr+0x36); /* first codec only */ - udelay(20); - outw(0x0, ioaddr+0x36); - udelay(20); - outw(0x2000, ioaddr+0x36); - udelay(20); - outw(0x3000, ioaddr+0x36); + outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */ + outw( (inw(ioaddr + 0x38) & 0xfffc)|0x1, ioaddr + 0x38); + outw( (inw(ioaddr + 0x3a) & 0xfffc)|0x1, ioaddr + 0x3a); + outw( (inw(ioaddr + 0x3c) & 0xfffc)|0x1, ioaddr + 0x3c); + + /* now the second codec */ + outw(0x0000, ioaddr+0x36); + outw(0xfff7, ioaddr + 0x64); + save_68 = inw(ioaddr+0x68); + outw(0x0009, ioaddr + 0x68); + outw(0x0001, ioaddr + 0x60); udelay(20); + outw(0x0009, ioaddr + 0x60); + mdelay(500); /* .. ouch.. */ + outw( inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); + outw( inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); + outw( inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); + +#if 0 /* the loop here needs to be much better if we want it.. */ + M_printk("trying software reset\n"); + /* try and do a software reset */ + outb(0x80|0x7c, ioaddr + 0x30); + for (w=0; ; w++) { + if ((inw(ioaddr+ 0x30) & 1) == 0) { + if(inb(ioaddr + 0x32) !=0) break; + + outb(0x80|0x7d, ioaddr + 0x30); + if (((inw(ioaddr+ 0x30) & 1) == 0) && (inb(ioaddr + 0x32) !=0)) break; + outb(0x80|0x7f, ioaddr + 0x30); + if (((inw(ioaddr+ 0x30) & 1) == 0) && (inb(ioaddr + 0x32) !=0)) break; + } + + if( w > 10000) { + outb( inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */ + mdelay(500); /* oh my.. */ + outb( inb(ioaddr + 0x37) & ~0x08, ioaddr + 0x37); + udelay(1); + outw( 0x80, ioaddr+0x30); + for(w = 0 ; w < 10000; w++) { + if((inw(ioaddr + 0x30) & 1) ==0) break; + } + } + } +#endif } - /* * Indirect register access. Not all registers are readable so we * need to keep register state ourselves @@ -835,19 +880,21 @@ outw(reg, ioaddr+0x02); outw(data, ioaddr+0x00); - card->maestro_map[reg]=data; + if( reg >= NR_IDRS) printk("maestro: IDR %d out of bounds!\n",reg); + else card->maestro_map[reg]=data; } -static void maestro_write(struct ess_state *ess, u16 reg, u16 data) +static void maestro_write(struct ess_state *s, u16 reg, u16 data) { unsigned long flags; - spin_lock_irqsave(&ess->card->lock,flags); + CHECK_SUSPEND; + spin_lock_irqsave(&s->card->lock,flags); - __maestro_write(ess->card,reg,data); + __maestro_write(s->card,reg,data); - spin_unlock_irqrestore(&ess->card->lock,flags); + spin_unlock_irqrestore(&s->card->lock,flags); } static u16 __maestro_read(struct ess_card *card, u16 reg) @@ -858,18 +905,19 @@ return card->maestro_map[reg]=inw(ioaddr+0x00); } -static u16 maestro_read(struct ess_state *ess, u16 reg) +static u16 maestro_read(struct ess_state *s, u16 reg) { if(READABLE_MAP & (1<card->lock,flags); + CHECK_SUSPEND; + spin_lock_irqsave(&s->card->lock,flags); - __maestro_read(ess->card,reg); + __maestro_read(s->card,reg); - spin_unlock_irqrestore(&ess->card->lock,flags); + spin_unlock_irqrestore(&s->card->lock,flags); } - return ess->card->maestro_map[reg]; + return s->card->maestro_map[reg]; } /* @@ -917,10 +965,12 @@ * directly with the stuff above. */ -static void apu_set_register(struct ess_state *ess, u16 channel, u8 reg, u16 data) +static void apu_set_register(struct ess_state *s, u16 channel, u8 reg, u16 data) { unsigned long flags; + CHECK_SUSPEND; + if(channel&ESS_CHAN_HARD) channel&=~ESS_CHAN_HARD; else @@ -928,41 +978,43 @@ if(channel>5) printk("BAD CHANNEL %d.\n",channel); else - channel = ess->apu[channel]; - } + channel = s->apu[channel]; #ifdef CONFIG_APM - /* store based on real hardware apu/reg */ - ess->card->apu_map[channel][reg]=data; + /* store based on real hardware apu/reg */ + s->card->apu_map[channel][reg]=data; #endif + } reg|=(channel<<4); /* hooray for double indirection!! */ - spin_lock_irqsave(&ess->card->lock,flags); + spin_lock_irqsave(&s->card->lock,flags); - apu_index_set(ess->card, reg); - apu_data_set(ess->card, data); + apu_index_set(s->card, reg); + apu_data_set(s->card, data); - spin_unlock_irqrestore(&ess->card->lock,flags); + spin_unlock_irqrestore(&s->card->lock,flags); } -static u16 apu_get_register(struct ess_state *ess, u16 channel, u8 reg) +static u16 apu_get_register(struct ess_state *s, u16 channel, u8 reg) { unsigned long flags; u16 v; + CHECK_SUSPEND; + if(channel&ESS_CHAN_HARD) channel&=~ESS_CHAN_HARD; else - channel = ess->apu[channel]; + channel = s->apu[channel]; reg|=(channel<<4); - spin_lock_irqsave(&ess->card->lock,flags); + spin_lock_irqsave(&s->card->lock,flags); - apu_index_set(ess->card, reg); - v=__maestro_read(ess->card, IDR0_DATA_PORT); + apu_index_set(s->card, reg); + v=__maestro_read(s->card, IDR0_DATA_PORT); - spin_unlock_irqrestore(&ess->card->lock,flags); + spin_unlock_irqrestore(&s->card->lock,flags); return v; } @@ -972,29 +1024,31 @@ * pci bus mastering */ -static void wave_set_register(struct ess_state *ess, u16 reg, u16 value) +static void wave_set_register(struct ess_state *s, u16 reg, u16 value) { - long ioaddr = ess->card->iobase; + long ioaddr = s->card->iobase; unsigned long flags; + CHECK_SUSPEND; - spin_lock_irqsave(&ess->card->lock,flags); + spin_lock_irqsave(&s->card->lock,flags); outw(reg, ioaddr+0x10); outw(value, ioaddr+0x12); - spin_unlock_irqrestore(&ess->card->lock,flags); + spin_unlock_irqrestore(&s->card->lock,flags); } -static u16 wave_get_register(struct ess_state *ess, u16 reg) +static u16 wave_get_register(struct ess_state *s, u16 reg) { - long ioaddr = ess->card->iobase; + long ioaddr = s->card->iobase; unsigned long flags; u16 value; + CHECK_SUSPEND; - spin_lock_irqsave(&ess->card->lock,flags); + spin_lock_irqsave(&s->card->lock,flags); outw(reg, ioaddr+0x10); value=inw(ioaddr+0x12); - spin_unlock_irqrestore(&ess->card->lock,flags); + spin_unlock_irqrestore(&s->card->lock,flags); return value; } @@ -1165,7 +1219,8 @@ */ /* the mode passed should be already shifted and masked */ -static void ess_play_setup(struct ess_state *ess, int mode, u32 rate, void *buffer, int size) +static void +ess_play_setup(struct ess_state *ess, int mode, u32 rate, void *buffer, int size) { u32 pa; u32 tmpval; @@ -1198,23 +1253,17 @@ /* set the wavecache control reg */ tmpval = (pa - 0x10) & 0xFFF8; -#if 0 - if(mode & 1) tmpval |= 2; /* stereo */ -#endif if(!(mode & 2)) tmpval |= 4; /* 8bit */ + ess->apu_base[channel]=tmpval; wave_set_register(ess, ess->apu[channel]<<3, tmpval); - pa&=0x1FFFFF; /* Low 21 bits */ + pa -= virt_to_bus(ess->card->dmapages); pa>>=1; /* words */ /* base offset of dma calcs when reading the pointer on this left one */ if(!channel) ess->dma_dac.base = pa&0xFFFF; -#if 0 - if(mode&ESS_FMT_STEREO) /* Enable stereo */ - pa|=0x00800000; -#endif pa|=0x00400000; /* System RAM */ /* Begin loading the APU */ @@ -1232,14 +1281,12 @@ /* clear effects/env.. */ apu_set_register(ess, channel, 8, 0x0000); - /* aplitudeNow to 0xd0? */ + /* set amp now to 0xd0 (?), low byte is 'amplitude dest'? */ apu_set_register(ess, channel, 9, 0xD000); - /* set the panning reg of the apu to left/right/mid.. */ - /* clear routing stuff */ apu_set_register(ess, channel, 11, 0x0000); - /* mark dma and turn on filter stuff? */ + /* dma on, no envelopes, filter to all 1s) */ apu_set_register(ess, channel, 0, 0x400F); if(mode&ESS_FMT_STEREO) @@ -1341,9 +1388,10 @@ /* set the wavecache control reg */ tmpval = (pa - 0x10) & 0xFFF8; + ess->apu_base[channel]=tmpval; wave_set_register(ess, ess->apu[channel]<<3, tmpval); - pa&=0x1FFFFF; /* Low 21 bits*/ + pa -= virt_to_bus(ess->card->dmapages); pa>>=1; /* words */ /* base offset of dma calcs when reading the pointer @@ -1409,18 +1457,9 @@ /* Playback pointer */ extern __inline__ unsigned get_dmaa(struct ess_state *s) { - long ioport = s->card->iobase; int offset; - unsigned long flags; - - spin_lock_irqsave(&s->card->lock,flags); - - outw(1, ioport+2); - outw(s->apu[0]<<4|5, ioport); - outw(0, ioport+2); - offset=inw(ioport); - spin_unlock_irqrestore(&s->card->lock,flags); + offset = apu_get_register(s,0,5); /* M_printk("dmaa: offset: %d, base: %d\n",offset,s->dma_dac.base); */ @@ -1432,18 +1471,9 @@ /* Record pointer */ extern __inline__ unsigned get_dmac(struct ess_state *s) { - long ioport = s->card->iobase; int offset; - unsigned long flags; - spin_lock_irqsave(&s->card->lock,flags); - - outw(1, ioport+2); - outw(s->apu[2]<<4|5, ioport); - outw(0, ioport+2); - offset=inw(ioport); - - spin_unlock_irqrestore(&s->card->lock,flags); + offset = apu_get_register(s,2,5); /* M_printk("dmac: offset: %d, base: %d\n",offset,s->dma_adc.base); */ @@ -1592,11 +1622,7 @@ else db->fragshift = db->ossfragshift; } else { - /* lets hand out reasonable big ass buffers by default */ - db->fragshift = (db->buforder - 2); -#if 0 db->fragshift = ld2(bytepersec/100/(db->subdivision ? db->subdivision : 1)); -#endif if (db->fragshift < 3) db->fragshift = 3; } @@ -1629,25 +1655,33 @@ return 0; } -/* XXX haha, way broken with our split stereo setup. giggle. */ -/* only called by ess_write (dac ness ) */ static __inline__ void clear_advance(struct ess_state *s) { unsigned char c = ((s->fmt >> ESS_DAC_SHIFT) & ESS_FMT_16BIT) ? 0 : 0x80; unsigned char *buf = s->dma_dac.rawbuf; unsigned bsize = s->dma_dac.dmasize; + /* swptr is always in bytes as read from an apu.. */ unsigned bptr = s->dma_dac.swptr; unsigned len = s->dma_dac.fragsize; + int i=1; - if (bptr + len > bsize) { - unsigned x = bsize - bptr; - memset(buf + bptr, c, x); - /* account for wrapping? */ - bptr = 0; - len -= x; + if((s->fmt >> ESS_DAC_SHIFT) & ESS_FMT_STEREO) { + i++; + bsize >>=1; + } + + for ( ;i; i-- , buf += bsize) { + + if (bptr + len > bsize) { + unsigned x = bsize - bptr; + memset(buf + bptr, c, x); + /* account for wrapping? */ + bptr = 0; + len -= x; + } + memset(buf + bptr, c, len); } - memset(buf + bptr, c, len); } /* call with spinlock held! */ @@ -1680,6 +1714,10 @@ /* FILL ME wrindir(s, SV_CIENABLE, s->enable); */ stop_adc(s); + /* brute force everyone back in sync, sigh */ + s->dma_adc.count = 0; + s->dma_adc.swptr = 0; + s->dma_adc.hwptr = 0; s->dma_adc.error++; } } @@ -1721,7 +1759,8 @@ } } -static void ess_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static void +ess_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct ess_state *s; struct ess_card *c = (struct ess_card *)dev_id; @@ -1791,6 +1830,17 @@ card->mix.write_mixer(card,mixer,left,right); } +static void +mixer_push_state(struct ess_card *card) +{ + int i; + for(i = 0 ; i < SOUND_MIXER_NRDEVICES ; i++) { + if( ! supported_mixer(card,i)) continue; + + set_mixer(card,i,card->mix.mixer_state[i]); + } +} + static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long arg) { int i, val=0; @@ -1878,6 +1928,7 @@ case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ if (!card->mix.recmask_io) return -EINVAL; + if(!val) return 0; if(! (val &= card->mix.record_sources)) return -EINVAL; spin_lock(&card->lock); @@ -2036,7 +2087,8 @@ /* in this loop, dma_adc.count signifies the amount of data thats waiting to be copied to the user's buffer. it is filled by the interrupt handler and drained by this loop. */ -static ssize_t ess_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t +ess_read(struct file *file, char *buffer, size_t count, loff_t *ppos) { struct ess_state *s = (struct ess_state *)file->private_data; ssize_t ret; @@ -2083,6 +2135,9 @@ goto rec_return_free; } if (!interruptible_sleep_on_timeout(&s->dma_adc.wait, HZ)) { +#ifdef CONFIG_APM + if(! in_suspend) +#endif printk(KERN_DEBUG "maestro: read: chip lockup? dmasz %u fragsz %u count %i hwptr %u swptr %u\n", s->dma_adc.dmasize, s->dma_adc.fragsize, s->dma_adc.count, s->dma_adc.hwptr, s->dma_adc.swptr); @@ -2151,8 +2206,6 @@ left = real_buffer + offset; right = real_buffer + bufsize/2 + offset; -/* M_printk("writing %d to %p and %p from %p:%d bufs: %d\n",count/2, left,right,real_buffer,offset,bufsize);*/ - if(mode & ESS_FMT_16BIT) { for(i=count/4; i ; i--) { *(right++) = (*(so+2)); @@ -2172,7 +2225,8 @@ return 0; } -static ssize_t ess_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t +ess_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) { struct ess_state *s = (struct ess_state *)file->private_data; ssize_t ret; @@ -2181,8 +2235,6 @@ unsigned char *splitbuf = NULL; int cnt; int mode = (s->fmt >> ESS_DAC_SHIFT) & ESS_FMT_MASK; - -/* printk("maestro: ess_write: count %d\n", count);*/ VALIDATE_STATE(s); if (ppos != &file->f_pos) @@ -2228,13 +2280,15 @@ cnt &= ~3; if (cnt <= 0) { - /* buffer is full, wait for it to be played */ start_dac(s); if (file->f_flags & O_NONBLOCK) { if(!ret) ret = -EAGAIN; goto return_free; } if (!interruptible_sleep_on_timeout(&s->dma_dac.wait, HZ)) { +#ifdef CONFIG_APM + if(! in_suspend) +#endif printk(KERN_DEBUG "maestro: write: chip lockup? dmasz %u fragsz %u count %i hwptr %u swptr %u\n", s->dma_dac.dmasize, s->dma_dac.fragsize, s->dma_dac.count, s->dma_dac.hwptr, s->dma_dac.swptr); @@ -2269,7 +2323,7 @@ } if(mode & ESS_FMT_STEREO) { - /* again with the weird pointer magic*/ + /* again with the weird pointer magic */ swptr = (swptr + (cnt/2)) % (s->dma_dac.dmasize/2); } else { swptr = (swptr + cnt) % s->dma_dac.dmasize; @@ -2339,7 +2393,7 @@ db = &s->dma_adc; } else return -EINVAL; - if (vma->vm_pgoff != 0) + if (vma->vm_pgofft != 0) return -EINVAL; size = vma->vm_end - vma->vm_start; if (size > (PAGE_SIZE << db->buforder)) @@ -2661,6 +2715,20 @@ return -EINVAL; } +static void +set_base_registers(struct ess_state *s,void *vaddr) +{ + unsigned long packed_phys = virt_to_bus(vaddr)>>12; + wave_set_register(s, 0x01FC , packed_phys); + wave_set_register(s, 0x01FD , packed_phys); + wave_set_register(s, 0x01FE , packed_phys); + wave_set_register(s, 0x01FF , packed_phys); +} + +/* we allocate a large power of two for all our memory. + this is cut up into (not to scale :): + |silly fifo word | 512byte mixbuf per adc | dac/adc * channels | +*/ static int allocate_buffers(struct ess_state *s) { @@ -2678,18 +2746,18 @@ M_printk("maestro: allocated %ld (%d) bytes at %p\n",PAGE_SIZE< (1<<22)) - printk(KERN_DEBUG "maestro: %ld byte DMA buffer longer than APU can express!\n",PAGE_SIZE<card->dmapages = rawbuf; s->card->dmaorder = order; /* play bufs are in the same first region as record bufs */ - wave_set_register(s, 0x01FC , ((virt_to_bus(rawbuf))&0xFFE00000)>>12); + set_base_registers(s,rawbuf); M_printk("maestro: writing %lx (%lx) to the wp\n",virt_to_bus(rawbuf), ((virt_to_bus(rawbuf))&0xFFE00000)>>12); @@ -2703,9 +2771,14 @@ ess->dma_dac.ready = s->dma_dac.mapped = 0; ess->dma_adc.ready = s->dma_adc.mapped = 0; ess->dma_adc.buforder = ess->dma_dac.buforder = order - 1 - dsps_order - 1; - ess->dma_dac.rawbuf = rawbuf + (i * ( PAGE_SIZE << (ess->dma_dac.buforder + 1 ))); + + /* offset dac and adc buffers starting half way through and then at each [da][ad]c's + order's intervals.. */ + ess->dma_dac.rawbuf = rawbuf + (PAGE_SIZE<<(order-1)) + (i * ( PAGE_SIZE << (ess->dma_dac.buforder + 1 ))); ess->dma_adc.rawbuf = ess->dma_dac.rawbuf + ( PAGE_SIZE << ess->dma_dac.buforder); - ess->mixbuf = rawbuf + (PAGE_SIZE<mixbuf = rawbuf + (512 * (i+1)); M_printk("maestro: setup apu %d: %p %p %p\n",i,ess->dma_dac.rawbuf, ess->dma_adc.rawbuf, ess->mixbuf); @@ -2875,147 +2948,14 @@ NULL, /* lock */ }; -#ifdef CONFIG_APM -int maestro_apm_callback(apm_event_t ae) { - - struct ess_card *s; - - if(ae != APM_USER_SUSPEND) - return 0; - - printk("suspending.. blowing away apus\n"); - - while ((s = devs)) { - int i; - devs = devs->next; - - for(i=0;ichannels[i]; - int j; - - if(ess->dev_audio == -1) - continue; - - for(j=0;j<6;j++) { - apu_set_register(ess, ess->apu[j], 0, - (apu_get_register(ess, ess->apu[j], 0)&0xFF0F)); - } - - } - } - if(devs) { - printk("suspending.. stopping bob\n"); - stop_bob(devs); - } - - return 0; -} -#endif - -/* --------------------------------------------------------------------- */ - -static int -maestro_install(struct pci_dev *pcidev, int card_type) +static int +maestro_config(struct ess_card *card) { + struct pci_dev *pcidev = &card->pcidev; + struct ess_state *ess = &card->channels[0]; + int apu,iobase = card->iobase; u16 w; u32 n; - int iobase; - int i; - struct ess_card *card; - struct ess_state *ess; - int apu; - int num = 0; - - /* don't pick up weird modem maestros */ - if(((pcidev->class >> 8) & 0xffff) != PCI_CLASS_MULTIMEDIA_AUDIO) - return 0; - - iobase = pcidev->resource[0].start; - - if(check_region(iobase, 256)) - { - printk(KERN_WARNING "maestro: can't allocate 256 bytes I/O at 0x%4.4x\n", iobase); - return 0; - } - - /* this was tripping up some machines */ - if(pcidev->irq == 0) - { - printk(KERN_WARNING "maestro: pci subsystem reports irq 0, this might not be correct.\n"); - } - - /* just to be sure */ - pci_set_master(pcidev); - - card = kmalloc(sizeof(struct ess_card), GFP_KERNEL); - if(card == NULL) - { - printk(KERN_WARNING "maestro: out of memory\n"); - return 0; - } - - memset(card, 0, sizeof(*card)); - -#ifdef CONFIG_APM - printk("reg_callback: %d\n",apm_register_callback(maestro_apm_callback)); -#endif - - card->iobase = iobase; - card->card_type = card_type; - card->irq = pcidev->irq; - card->next = devs; - card->magic = ESS_CARD_MAGIC; - spin_lock_init(&card->lock); - devs = card; - - /* init our groups of 6 apus */ - for(i=0;ichannels[i]; - - s->index = i; - - s->card = card; - init_waitqueue_head(&s->dma_adc.wait); - init_waitqueue_head(&s->dma_dac.wait); - init_waitqueue_head(&s->open_wait); - spin_lock_init(&ess->lock); - init_MUTEX(&s->open_sem); - s->magic = ESS_STATE_MAGIC; - - s->apu[0] = 6*i; - s->apu[1] = (6*i)+1; - s->apu[2] = (6*i)+2; - s->apu[3] = (6*i)+3; - s->apu[4] = (6*i)+4; - s->apu[5] = (6*i)+5; - - if(s->dma_adc.ready || s->dma_dac.ready || s->dma_adc.rawbuf) - printk("maestro: BOTCH!\n"); - /* register devices */ - if ((s->dev_audio = register_sound_dsp(&ess_audio_fops, -1)) < 0) - break; - } - - num = i; - - /* clear the rest if we ran out of slots to register */ - for(;ichannels[i]; - s->dev_audio = -1; - } - - ess = &card->channels[0]; - - /* - * Ok card ready. Begin setup proper - */ - - printk(KERN_INFO "maestro: Configuring %s found at IO 0x%04X IRQ %d\n", - card_names[card_type],iobase,card->irq); - pci_read_config_dword(pcidev, PCI_SUBSYSTEM_VENDOR_ID, &n); - printk(KERN_INFO "maestro: subvendor id: 0x%08x\n",n); /* * Disable ACPI @@ -3035,31 +2975,9 @@ w&=~(1<<10|1<<9|1<<8); /* TDMA on */ - w|=(1<<8); - -/* XXX do we care about these two ? */ - /* - * MPU at 330 - */ - - w&=~((1<<4)|(1<<3)); - - /* - * SB at 0x220 - */ - - w&=~(1<<2); - -#if 0 /* huh? its sub decode.. */ + w|= (1<<8); /* - * Reserved write as 0 - */ - - w&=~(1<<1); -#endif - - /* * Some of these are undocumented bits */ @@ -3067,9 +2985,9 @@ w&=~(1<<11); /* Safeguard off */ w|= (1<<7); /* Posted write */ w|= (1<<6); /* ISA timing on */ - w&=~(1<<1); /* Subtractive decode off */ /* XXX huh? claims to be reserved.. */ w&=~(1<<5); /* Don't swap left/right */ + w&=~(1<<1); /* Subtractive decode off */ pci_write_config_word(pcidev, 0x50, w); @@ -3081,7 +2999,7 @@ w&=~(1<<7); /* HWV off */ w&=~(1<<6); /* Debounce off */ w&=~(1<<5); /* GPIO 4:5 */ - w&=~(1<<4); /* Disconnect from the CHI */ + w|= (1<<4); /* Disconnect from the CHI. Enabling this in made a dell 7500 work. */ w&=~(1<<3); /* IDMA off (undocumented) */ w&=~(1<<2); /* MIDI fix off (undoc) */ w&=~(1<<1); /* reserved, always write 0 */ @@ -3108,7 +3026,7 @@ pci_write_config_word(pcidev, 0x40, w); /* stake our claim on the iospace */ - request_region(iobase, 256, card_names[card_type]); + request_region(iobase, 256, card_names[card->card_type]); sound_reset(iobase); @@ -3127,7 +3045,7 @@ * Reset the CODEC */ - maestro_ac97_reset(iobase); + maestro_ac97_reset(iobase,pcidev); /* * Ring Bus Setup @@ -3155,7 +3073,6 @@ n|=(1<<29); /* Enable ring bus */ outl(n, iobase+0x34); - n=inl(iobase+0x34); n|=(1<<28); /* Enable serial bus */ outl(n, iobase+0x34); @@ -3168,6 +3085,7 @@ n&=~0x000F0000; /* I2S off */ outl(n, iobase+0x34); + w=inw(iobase+0x18); w&=~(1<<7); /* ClkRun off */ outw(w, iobase+0x18); @@ -3196,11 +3114,12 @@ w|=(1<<0); /* SB IRQ on */ outw(w, iobase+0x18); -#if 0 /* asp crap */ + /* it appears some maestros (dell 7500) only work if these are set, + regardless of wether we use the assp or not. */ + outb(0, iobase+0xA4); outb(3, iobase+0xA2); outb(0, iobase+0xA6); -#endif for(apu=0;apu<16;apu++) { @@ -3255,13 +3174,132 @@ /* Wave cache control on - test off, sg off, enable, enable extra chans 1Mb */ - + outw(inw(0x14+iobase)|(1<<8),0x14+iobase); outw(inw(0x14+iobase)&0xFE03,0x14+iobase); outw((inw(0x14+iobase)&0xFFFC), 0x14+iobase); outw(inw(0x14+iobase)|(1<<7),0x14+iobase); - outw(0xA1A0, 0x14+iobase); /* 0300 ? */ + outw(0xA1A0, 0x14+iobase); /* 0300 ? */ + + /* Now clear the APU control ram */ + for(apu=0;apuclass >> 8) & 0xffff) != PCI_CLASS_MULTIMEDIA_AUDIO) + return 0; + + iobase = SILLY_PCI_BASE_ADDRESS(pcidev); + + if(check_region(iobase, 256)) + { + printk(KERN_WARNING "maestro: can't allocate 256 bytes I/O at 0x%4.4x\n", iobase); + return 0; + } + + /* this was tripping up some machines */ + if(pcidev->irq == 0) + { + printk(KERN_WARNING "maestro: pci subsystem reports irq 0, this might not be correct.\n"); + } + + /* just to be sure */ + pci_set_master(pcidev); + + card = kmalloc(sizeof(struct ess_card), GFP_KERNEL); + if(card == NULL) + { + printk(KERN_WARNING "maestro: out of memory\n"); + return 0; + } + + memset(card, 0, sizeof(*card)); + memcpy(&card->pcidev,pcidev,sizeof(card->pcidev)); + +#ifdef CONFIG_APM + if (apm_register_callback(maestro_apm_callback)) { + printk(KERN_WARNING "maestro: apm suspend might not work.\n"); + } +#endif + + card->iobase = iobase; + card->card_type = card_type; + card->irq = pcidev->irq; + card->next = devs; + card->magic = ESS_CARD_MAGIC; + spin_lock_init(&card->lock); + devs = card; + + /* init our groups of 6 apus */ + for(i=0;ichannels[i]; + + s->index = i; + + s->card = card; + init_waitqueue_head(&s->dma_adc.wait); + init_waitqueue_head(&s->dma_dac.wait); + init_waitqueue_head(&s->open_wait); + spin_lock_init(&s->lock); + SILLY_INIT_SEM(s->open_sem); + s->magic = ESS_STATE_MAGIC; + + s->apu[0] = 6*i; + s->apu[1] = (6*i)+1; + s->apu[2] = (6*i)+2; + s->apu[3] = (6*i)+3; + s->apu[4] = (6*i)+4; + s->apu[5] = (6*i)+5; + + if(s->dma_adc.ready || s->dma_dac.ready || s->dma_adc.rawbuf) + printk("maestro: BOTCH!\n"); + /* register devices */ + if ((s->dev_audio = register_sound_dsp(&ess_audio_fops, -1)) < 0) + break; + } + + num = i; + + /* clear the rest if we ran out of slots to register */ + for(;ichannels[i]; + s->dev_audio = -1; + } + + ess = &card->channels[0]; + + /* + * Ok card ready. Begin setup proper + */ + + printk(KERN_INFO "maestro: Configuring %s found at IO 0x%04X IRQ %d\n", + card_names[card_type],iobase,card->irq); + pci_read_config_dword(pcidev, PCI_SUBSYSTEM_VENDOR_ID, &n); + printk(KERN_INFO "maestro: subvendor id: 0x%08x\n",n); + + maestro_config(card); if(maestro_ac97_get(iobase, 0x00)==0x0080) { maestro_pt101_init(card,iobase); @@ -3272,21 +3310,8 @@ if ((card->dev_mixer = register_sound_mixer(&ess_mixer_fops, -1)) < 0) { printk("maestro: couldn't register mixer!\n"); } else { - int i; - for(i = 0 ; i < SOUND_MIXER_NRDEVICES ; i++) { - struct mixer_defaults *md = &mixer_defaults[i]; - - if(md->mixer == -1) break; - if( ! supported_mixer(card,md->mixer)) continue; - set_mixer(card,md->mixer,md->value); - } - } - - /* Now clear the channel data */ - for(apu=0;apu<64;apu++) - { - for(w=0;w<0x0E;w++) - apu_set_register(ess, apu|ESS_CHAN_HARD, w, 0); + memcpy(card->mix.mixer_state,mixer_defaults,sizeof(card->mix.mixer_state)); + mixer_push_state(card); } if(request_irq(card->irq, ess_interrupt, SA_SHIRQ, card_names[card_type], card)) @@ -3304,15 +3329,14 @@ return 0; } - printk("maestro: %d channels configured.\n", num); + printk(KERN_INFO "maestro: %d channels configured.\n", num); return 1; } -/* XXX __init ? */ #ifdef MODULE int init_module(void) #else -int __init init_maestro(void) +int SILLY_MAKE_INIT(init_maestro(void)) #endif { struct pci_dev *pcidev = NULL; @@ -3333,6 +3357,10 @@ printk(KERN_WARNING "maestro: clipping dsps_order to %d\n",dsps_order); } +#ifdef CONFIG_APM + init_waitqueue_head(&suspend_queue); +#endif + /* * Find the ESS Maestro 2. */ @@ -3373,8 +3401,8 @@ MODULE_DESCRIPTION("ESS Maestro Driver"); #ifdef M_DEBUG MODULE_PARM(debug,"i"); -MODULE_PARM(dsps_order,"i"); #endif +MODULE_PARM(dsps_order,"i"); void cleanup_module(void) { @@ -3404,3 +3432,146 @@ } #endif /* MODULE */ +#ifdef CONFIG_APM + +void +check_suspend(void) +{ + DECLARE_WAITQUEUE(wait, current); + + if(!in_suspend) return; + + in_suspend++; + add_wait_queue(&suspend_queue, &wait); + current->state = TASK_UNINTERRUPTIBLE; + schedule(); + remove_wait_queue(&suspend_queue, &wait); + current->state = TASK_RUNNING; +} + +static int +maestro_apm_suspend(void) +{ + struct ess_card *card; + unsigned long flags; + + save_flags(flags); + cli(); + + for (card = devs; card ; card = card->next) { + int i,j; + + M_printk("maestro: apm in dev %p\n",card); + + for(i=0;ichannels[i]; + + if(s->dev_audio == -1) + continue; + + M_printk("maestro: stopping apus for device %d\n",i); + stop_dac(s); + stop_adc(s); + for(j=0;j<6;j++) + card->apu_map[s->apu[i]][5]=apu_get_register(s,i,5); + + } + + /* get rid of interrupts? */ + if( card->dsps_open > 0) + stop_bob(&card->channels[0]); + } + in_suspend=1; + + restore_flags(flags); + + /* we'll let the bios do the rest of the power down.. */ + + return 0; +} +static int +maestro_apm_resume(void) +{ + struct ess_card *card; + unsigned long flags; + + save_flags(flags); + cli(); + in_suspend=0; + M_printk("maestro: resuming\n"); + + /* first lets just bring everything back. .*/ + for (card = devs; card ; card = card->next) { + int i; + + M_printk("maestro: apm in dev %p\n",card); + + maestro_config(card); + /* need to restore the base pointers.. */ + if(card->dmapages) + set_base_registers(&card->channels[0],card->dmapages); + + mixer_push_state(card); + + for(i=0;ichannels[i]; + int chan,reg; + + if(s->dev_audio == -1) + continue; + + for(chan = 0 ; chan < 6 ; chan++) { + wave_set_register(s,s->apu[chan]<<3,s->apu_base[chan]); + for(reg = 1 ; reg < NR_APU_REGS ; reg++) + apu_set_register(s,chan,reg,s->card->apu_map[s->apu[chan]][reg]); + } + for(chan = 0 ; chan < 6 ; chan++) + apu_set_register(s,chan,0,s->card->apu_map[s->apu[chan]][0] & 0xFF0F); + } + } + + /* now we flip on the music */ + for (card = devs; card ; card = card->next) { + int i; + + M_printk("maestro: apm in dev %p\n",card); + + for(i=0;ichannels[i]; + + /* these use the apu_mode, and can handle + spurious calls */ + start_dac(s); + start_adc(s); + } + if( card->dsps_open > 0) + start_bob(&card->channels[0]); + } + + restore_flags(flags); + + wake_up(&suspend_queue); + + return 0; +} + +int +maestro_apm_callback(apm_event_t ae) { + + M_printk("maestro: apm event received: 0x%x\n",ae); + + switch(ae) { + case APM_SYS_SUSPEND: + case APM_CRITICAL_SUSPEND: + case APM_USER_SUSPEND: + maestro_apm_suspend();break; + case APM_NORMAL_RESUME: + case APM_CRITICAL_RESUME: + case APM_STANDBY_RESUME: + maestro_apm_resume();break; + default: break; + } + + return 0; +} +#endif diff -u --recursive --new-file v2.3.25/linux/drivers/usb/CREDITS linux/drivers/usb/CREDITS --- v2.3.25/linux/drivers/usb/CREDITS Tue Sep 7 12:14:07 1999 +++ linux/drivers/usb/CREDITS Fri Nov 5 10:01:50 1999 @@ -10,7 +10,7 @@ Bradley M Keryan Paul Mackerras David E. Nelson - Vojtech Pavlik + Vojtech Pavlik Gregory P. Smith Linus Torvalds Roman Weissgaerber diff -u --recursive --new-file v2.3.25/linux/drivers/usb/Config.in linux/drivers/usb/Config.in --- v2.3.25/linux/drivers/usb/Config.in Sat Oct 9 11:47:50 1999 +++ linux/drivers/usb/Config.in Wed Nov 3 09:17:45 1999 @@ -37,11 +37,12 @@ dep_tristate ' USB mouse support' CONFIG_USB_MOUSE $CONFIG_USB dep_tristate ' USB HP scanner support' CONFIG_USB_HP_SCANNER $CONFIG_USB dep_tristate ' USB keyboard support' CONFIG_USB_KBD $CONFIG_USB - dep_tristate ' USB audio parsing support' CONFIG_USB_AUDIO $CONFIG_USB + dep_tristate ' USB Audio support' CONFIG_USB_AUDIO $CONFIG_USB dep_tristate ' USB Communications Device Class (ACM) support' CONFIG_USB_ACM $CONFIG_USB dep_tristate ' USB Printer support' CONFIG_USB_PRINTER $CONFIG_USB dep_tristate ' USB Belkin and Peracom serial support' CONFIG_USB_SERIAL $CONFIG_USB dep_tristate ' USB CPiA Camera support' CONFIG_USB_CPIA $CONFIG_USB + dep_tristate ' USB Kodak DC-2xx Camera support' CONFIG_USB_DC2XX $CONFIG_USB dep_tristate ' USB SCSI Support' CONFIG_USB_SCSI $CONFIG_USB if [ "$CONFIG_USB_SCSI" != "n" ]; then bool ' USB SCSI verbose debug' CONFIG_USB_SCSI_DEBUG diff -u --recursive --new-file v2.3.25/linux/drivers/usb/Makefile linux/drivers/usb/Makefile --- v2.3.25/linux/drivers/usb/Makefile Fri Oct 15 15:25:14 1999 +++ linux/drivers/usb/Makefile Tue Nov 2 08:17:27 1999 @@ -139,6 +139,14 @@ MIX_OBJS += cpia.o endif +ifeq ($(CONFIG_USB_DC2XX),y) + L_OBJS += dc2xx.o +endif +ifeq ($(CONFIG_USB_DC2XX),m) + M_OBJS += dc2xx.o + MIX_OBJS += dc2xx.o +endif + ifeq ($(CONFIG_USB_SCSI),y) L_OBJS += usb_scsi.o ifeq ($(CONFIG_USB_SCSI_DEBUG),y) diff -u --recursive --new-file v2.3.25/linux/drivers/usb/README.dc2xx linux/drivers/usb/README.dc2xx --- v2.3.25/linux/drivers/usb/README.dc2xx Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/README.dc2xx Fri Nov 5 15:54:01 1999 @@ -0,0 +1,105 @@ +3 November 1999 +david-b@pacbell.net + +This is an overview of how to use the "dc2xx" USB driver with certain +digital still cameras from Kodak and other vendors. + + +CAMERAS + +This driver will mostly be used with Kodak DC-2xx series digital still +cameras, but it should be trivial to tell it about several non-Kodak +USB-enabled cameras. + +You'll most likely want to hook it up to recent versions of "gPhoto" +(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. + +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 +most currently known USB still camera protocols treat USB like a faster +packet-carrying connection than a serial line, which is exactly how this +driver looks to an application. + + +USB HARDWARE + +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. + +As yet, no reports have come from Linux users on non-Intel hardware. +(You could color coordinate your iMac with a DC-240i ... :-) + + +SETUP + +Configure in the DC2XX USB driver, and have it in your kernel. Recently I +compile it right in, but I've done it as a module in the past. + +Create a device, perhaps like this (both read and write): + + # mknod -m 0666 /dev/kodak c 10 170 + +That "170" is not formally assigned, and this command may change. If you're +using a non-Kodak camera, you may prefer another name. + +Don't plug in more than one compatible camera at this time. One of them +will be ignored, but I'd not be sure which one! + + +SANITY TESTING + +First: if you've got /proc support, make sure that the driver has hooked +itself up correctly. + + - you should see an entry in /proc/misc for the a Kodak DC-2xx + minor device number + + - you should see an entry in /proc/bus/usb/drivers for "dc2xx", + if you also enabled USB /proc support. + +Second: when you connect your camera to the computer, does it get recognized +by the driver? + + - if you've got /proc/bus/usb/devices, you should see an entry + something like this. The "ProdID" may be different if you didn't + plug in a DC-240, but the "Driver=dc2xx" had better be there. + + T: Lev=01 Prnt=00 Port=00 Cnt=01 Dev#= 1 Spd=12 MxCh= 0 + D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 + P: Vendor=040a ProdID=0120 Rev= 1.08 + C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=100mA + I: If#= 0 Alt= 0 #EPs= 2 Cls=00(>ifc ) Sub=00 Prot=00 Driver=dc2xx + E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl= 0ms + E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl= 0ms + + - if you don't have /proc support for USB, see if "dmesg" output + tells you that you plugged in your camera. + + 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 + usbcore: dc2xx driver claimed interface c3a68600 + ohci-control thread sleeping + +Third: (optional) can you use gPhoto to talk to the camera? + + - When you configure your camera, tell it to use "/dev/kodak" (or + whatever name you used). Right now, gPhoto emits a diagnostic + message (non-GUI) saying that it since it didn't act like a TTY, + it's assuming it's got a USB connection. + + - With the camera turned on, get the "camera summary". It'll + talk to the camera -- and tell you you're using USB. + +If you got that far, you should be able to use everything fine. diff -u --recursive --new-file v2.3.25/linux/drivers/usb/acm.c linux/drivers/usb/acm.c --- v2.3.25/linux/drivers/usb/acm.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/acm.c Fri Nov 5 10:43:06 1999 @@ -1,7 +1,9 @@ /* - * USB Abstract Control Model based on Brad Keryan's USB busmouse driver + * USB Abstract Control Model based on Brad Keryan's USB busmouse driver * - * Armin Fuerst 5/8/1999 + * (C) Copyright 1999 Armin Fuerst + * (C) Copyright 1999 Pavel Machek + * (C) Copyright 1999 Johannes Erdfelt * * version 0.8: Fixed endianity bug, some cleanups. I really hate to have * half of driver in form if (...) { info("x"); return y; } @@ -11,7 +13,7 @@ * wrote this code? ...Oops that was me). Fixed module cleanup. Did some * testing at 3Com => zmodem uload+download works, pppd had trouble but * seems to work now. Changed Menuconfig texts "Communications Device - * Class (ACM)" might be a bit more intuitive. Ported to 2.3.13-1 prepatch. + * Class (ACM)" might be a bit more intuitive. Ported to 2.3.13-1 prepatch. * (2/8/99) * * version 0.6: Modularized driver, added disconnect code, improved @@ -23,8 +25,8 @@ * in uhci_td_allocate. Commenetd out getstringtable which causes crash. * (13/7/99) * - * version 0.4: Small fixes in the FIFO, cleanup. Updated Bulk transfer in - * uhci.c. Should have the correct interface now. + * version 0.4: Small fixes in the FIFO, cleanup. Updated Bulk transfer in + * uhci.c. Should have the correct interface now. * (6/6/99) * * version 0.3: Major changes. Changed Bulk transfer to interrupt based @@ -60,15 +62,14 @@ #include #include #include -#include #include "usb.h" #define NR_PORTS 3 #define ACM_MAJOR 166 /* Wow, major is now officially allocated */ -//#define info(message...); printk(message); -#define info(message...); +//#define info(message...) printk(KERN_DEBUG message) +#define info(message...) #define CTRL_STAT_DTR 1 #define CTRL_STAT_RTS 2 @@ -88,7 +89,7 @@ int cfgnum; //configuration number on this device struct tty_struct *tty; //the coresponding tty char present; //a device for this struct was detected => this tty is used - char active; //someone has this acm's device open + char active; //someone has this acm's device open unsigned int ctrlstate; //Status of the serial control lines (handshake,...) unsigned int linecoding; //Status of the line coding (Bits, Stop, Parity) int writesize, readsize; //size of the usb buffers @@ -105,56 +106,56 @@ //functions for various ACM requests -void Set_Control_Line_Status (unsigned int status,struct acm_state *acm) +void Set_Control_Line_Status(unsigned int status, struct acm_state *acm) { - devrequest dr; + struct usb_device *dev = acm->dev; + int ret; info("Set_control_Line_Status\n"); - dr.requesttype = 0x22; - dr.request = 0x22; - dr.value = status; - dr.index = 0; - dr.length = 0; - acm->dev->bus->op->control_msg(acm->dev, usb_sndctrlpipe(acm->dev,0), &dr, NULL, 0, HZ); + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0x22, 0x22, + status, 0, NULL, 0, HZ); + if (ret < 0) + printk(KERN_ERR "acm: Set_Control_Line_Status failed\n"); - acm->ctrlstate=status; + acm->ctrlstate = status; } -void Set_Line_Coding (unsigned int coding,struct acm_state *acm) +void Set_Line_Coding(unsigned int coding, struct acm_state *acm) { - devrequest dr; + struct usb_device *dev = acm->dev; + int ret; info("Set_Line_Coding\n"); - dr.requesttype = 0x22; - dr.request = 0x30; - dr.value = coding; - dr.index = 0; - dr.length = 0; - acm->dev->bus->op->control_msg(acm->dev, usb_sndctrlpipe(acm->dev,0), &dr, NULL, 0, HZ); - - acm->linecoding=coding; + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0x30, 0x22, + coding, 0, NULL, 0, HZ); + + acm->linecoding = coding; } //Interrupt handler for various usb events static int acm_irq(int state, void *__buffer, int count, void *dev_id) { - unsigned char *data; - struct acm_state *acm = (struct acm_state *) dev_id; + struct acm_state *acm = (struct acm_state *)dev_id; devrequest *dr; - + info("ACM_USB_IRQ\n"); + if (state) { + printk(KERN_DEBUG "acm_irq: strange state received: %x\n", state); + return 0; + } + if (!acm->present) return 0; if (!acm->active) return 1; - - dr=__buffer; - data=__buffer; - data+=sizeof(dr); + + dr = __buffer; + data = __buffer; + data += sizeof(dr); #if 0 printk("reqtype: %02X\n",dr->requesttype); @@ -163,23 +164,23 @@ printk("wIndex: %02X\n",dr->index); printk("wLength: %02X\n",dr->length); #endif - + switch(dr->request) { case 0x00: /* Network connection */ - printk("Network connection: "); - if (dr->request==0) printk("disconnected\n"); - if (dr->request==1) printk("connected\n"); + printk(KERN_DEBUG "Network connection: "); + if (dr->request==0) printk(KERN_DEBUG "disconnected\n"); + if (dr->request==1) printk(KERN_DEBUG "connected\n"); break; - + case 0x01: /* Response available */ - printk("Response available\n"); + printk(KERN_DEBUG "Response available\n"); break; - + case 0x20: /* Set serial line state */ - printk("acm.c: Set serial control line state\n"); - if ((dr->index==1)&&(dr->length==2)) { + printk(KERN_DEBUG "acm.c: Set serial control line state\n"); + if ((dr->index==1) && (dr->length==2)) { acm->ctrlstate= data[0] || (data[1] << 16); - printk("Serstate: %02X\n",acm->ctrlstate); + printk(KERN_DEBUG "Serstate: %02X\n",acm->ctrlstate); } break; } @@ -197,7 +198,7 @@ info("ACM_READ_IRQ: state %d, %d bytes\n", state, count); if (state) { printk( "acm_read_irq: strange state received: %x\n", state ); - return 0; + return 1; } if (!ACM_READY) @@ -207,13 +208,13 @@ tty_insert_flip_char(tty,data[i],0); tty_flip_buffer_push(tty); - return 0; /* Never return 1 from this routine. It makes uhci do bad things. */ + return 1; } static int acm_write_irq(int state, void *__buffer, int count, void *dev_id) { - struct acm_state *acm = (struct acm_state *) dev_id; - struct tty_struct *tty = acm->tty; + struct acm_state *acm = (struct acm_state *) dev_id; + struct tty_struct *tty = acm->tty; info("ACM_WRITE_IRQ\n"); @@ -221,24 +222,25 @@ return 0; /* stop transfer */ usb_terminate_bulk(acm->dev, acm->writetransfer); - acm->writing=0; + acm->writing = 0; if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); - + return 0; /* stop tranfer */ } /*TTY STUFF*/ -static int rs_open(struct tty_struct *tty, struct file * filp) +static int rs_open(struct tty_struct *tty, struct file *filp) { struct acm_state *acm; int ret; - + info("USB_FILE_OPEN\n"); - tty->driver_data=acm=&acm_state_table[MINOR(tty->device)-tty->driver.minor_start]; - acm->tty=tty; + tty->driver_data = acm = + &acm_state_table[MINOR(tty->device) - tty->driver.minor_start]; + acm->tty = tty; if (!acm->present) return -EINVAL; @@ -246,139 +248,147 @@ if (acm->active++) return 0; + MOD_INC_USE_COUNT; + /* Start reading from the device */ - ret = usb_request_irq(acm->dev,acm->ctrlpipe, acm_irq, acm->ctrlinterval, acm, &acm->ctrltransfer); + ret = usb_request_irq(acm->dev, acm->ctrlpipe, acm_irq, + acm->ctrlinterval, acm, &acm->ctrltransfer); if (ret) - printk (KERN_WARNING "usb-acm: usb_request_irq failed (0x%x)\n", ret); - acm->reading=1; - acm->readtransfer=usb_request_bulk(acm->dev,acm->readpipe, acm_read_irq, acm->readbuffer, acm->readsize, acm); - - Set_Control_Line_Status (CTRL_STAT_DTR | CTRL_STAT_RTS, acm); - + printk(KERN_ERR "usb-acm: usb_request_irq failed (0x%x)\n", ret); + acm->reading = 1; + acm->readtransfer = usb_request_bulk(acm->dev, acm->readpipe, + acm_read_irq, acm->readbuffer, acm->readsize, acm); + + Set_Control_Line_Status(CTRL_STAT_DTR | CTRL_STAT_RTS, acm); + return 0; } -static void rs_close(struct tty_struct *tty, struct file * filp) +static void rs_close(struct tty_struct *tty, struct file *filp) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; + struct acm_state *acm = (struct acm_state *) tty->driver_data; + info("rs_close\n"); - + if (!acm->present) return; if (--acm->active) return; - Set_Control_Line_Status (0, acm); - - if (acm->writing){ + Set_Control_Line_Status(0, acm); + + if (acm->writing) { usb_terminate_bulk(acm->dev, acm->writetransfer); - acm->writing=0; + acm->writing = 0; } - if (acm->reading){ + if (acm->reading) { usb_terminate_bulk(acm->dev, acm->readtransfer); - acm->reading=0; + acm->reading = 0; } -// usb_release_irq(acm->dev,acm->ctrltransfer, acm->ctrlpipe); +// usb_release_irq(acm->dev, acm->ctrltransfer, acm->ctrlpipe); + + MOD_DEC_USE_COUNT; } -static int rs_write(struct tty_struct * tty, int from_user, +static int rs_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; + struct acm_state *acm = (struct acm_state *)tty->driver_data; int written; - + info("rs_write\n"); if (!ACM_READY) return -EINVAL; - + if (acm->writing) { - info ("already writing\n"); + info("already writing\n"); return 0; } - written=(count>acm->writesize) ? acm->writesize : count; - - if (from_user) copy_from_user(acm->writebuffer,buf,written); - else memcpy(acm->writebuffer,buf,written); + written = (count>acm->writesize) ? acm->writesize : count; + + if (from_user) + copy_from_user(acm->writebuffer, buf, written); + else + memcpy(acm->writebuffer, buf, written); //start the transfer - acm->writing=1; - acm->writetransfer=usb_request_bulk(acm->dev,acm->writepipe, acm_write_irq, acm->writebuffer, written, acm); + acm->writing = 1; + acm->writetransfer = usb_request_bulk(acm->dev, acm->writepipe, + acm_write_irq, acm->writebuffer, written, acm); return written; } static void rs_put_char(struct tty_struct *tty, unsigned char ch) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; - - printk( "acm: rs_put_char: Who called this unsupported routine?\n" ); + printk(KERN_DEBUG "acm: rs_put_char: Who called this unsupported routine?\n"); BUG(); -} +} -static int rs_write_room(struct tty_struct *tty) +static int rs_write_room(struct tty_struct *tty) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; + struct acm_state *acm = (struct acm_state *) tty->driver_data; info("rs_write_room\n"); - + if (!ACM_READY) return -EINVAL; - + return acm->writing ? 0 : acm->writesize; } -static int rs_chars_in_buffer(struct tty_struct *tty) +static int rs_chars_in_buffer(struct tty_struct *tty) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; + struct acm_state *acm = (struct acm_state *) tty->driver_data; // info("rs_chars_in_buffer\n"); - + if (!ACM_READY) return -EINVAL; - - return acm->writing ? acm->writesize : 0; + + return acm->writing ? acm->writesize : 0; } -static void rs_throttle(struct tty_struct * tty) +static void rs_throttle(struct tty_struct *tty) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; - + struct acm_state *acm = (struct acm_state *) tty->driver_data; + info("rs_throttle\n"); - + if (!ACM_READY) return; -/* +/* if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty)); -*/ +*/ if (tty->termios->c_cflag & CRTSCTS) - Set_Control_Line_Status (acm->ctrlstate & ~CTRL_STAT_RTS, acm); + Set_Control_Line_Status(acm->ctrlstate & ~CTRL_STAT_RTS, acm); } -static void rs_unthrottle(struct tty_struct * tty) +static void rs_unthrottle(struct tty_struct *tty) { - struct acm_state *acm = (struct acm_state *) tty->driver_data; - + struct acm_state *acm = (struct acm_state *) tty->driver_data; + info("rs_unthrottle\n"); - + if (!ACM_READY) return; -/* +/* if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty)); -*/ +*/ if (tty->termios->c_cflag & CRTSCTS) - Set_Control_Line_Status (acm->ctrlstate | CTRL_STAT_RTS, acm); + Set_Control_Line_Status(acm->ctrlstate | CTRL_STAT_RTS, acm); } static int get_free_acm(void) { int i; - for (i=0;idescriptor.bNumConfigurations;cfgnum++) { /* The first one should be Communications interface? */ interface = &dev->config[cfgnum].interface[0].altsetting[0]; if (IFCLASS(interface) != 0x02020101) continue; - /*Which uses an interrupt input */ + /* Which uses an interrupt input */ endpoint = &interface->endpoint[0]; if ((endpoint->bEndpointAddress & 0x80) != 0x80 || (endpoint->bmAttributes & 3) != 3) @@ -540,13 +550,12 @@ int usb_acm_init(void) { int cnt; - + info("usb_acm_init\n"); - + //INITIALIZE GLOBAL DATA STRUCTURES - for (cnt=0;cnt but please Philips start with your * own stuff!!!! + * 1999-11-02: It takes the Philips boxes several seconds to acquire synchronisation + * that means they won't play short sounds. Should probably maintain + * the ISO datastream even if there's nothing to play. + * Fix counting the total_bytes counter, RealPlayer G2 depends on it. * * */ @@ -455,6 +459,7 @@ { unsigned int pgrem, rem; + db->total_bytes += size; for (;;) { if (size <= 0) return; @@ -477,6 +482,7 @@ { unsigned int pgrem, rem; + db->total_bytes += size; for (;;) { if (size <= 0) return; @@ -3285,7 +3291,9 @@ prepmixch(state); } } +#if 0 /* if there are mute controls, unmute them */ + /* does not seem to be necessary, and the Dallas chip does not seem to support the "all" channel (255) */ if ((chftr & 1) || (mchftr & 1)) { printk(KERN_DEBUG "usbaudio: unmuting feature unit %u interface %u\n", ftr[3], state->ctrlif); data[0] = 0; @@ -3293,6 +3301,7 @@ (MUTE_CONTROL << 8) | 0xff, state->ctrlif | (ftr[3] << 8), data, 1, HZ) < 0) printk(KERN_WARNING "usbaudio: failure to unmute feature unit %u interface %u\n", ftr[3], state->ctrlif); } +#endif } static void usb_audio_recurseunit(struct consmixstate *state, unsigned char unitid) @@ -3612,8 +3621,7 @@ int usb_audio_init(void) { - usb_register(&usb_audio_driver); - return 0; + return usb_register(&usb_audio_driver); } #ifdef MODULE diff -u --recursive --new-file v2.3.25/linux/drivers/usb/cpia.c linux/drivers/usb/cpia.c --- v2.3.25/linux/drivers/usb/cpia.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/cpia.c Fri Nov 5 10:42:15 1999 @@ -1309,9 +1309,7 @@ int usb_cpia_init(void) { - usb_register(&cpia_driver); - - return 0; + return usb_register(&cpia_driver); } void usb_cpia_cleanup(void) diff -u --recursive --new-file v2.3.25/linux/drivers/usb/dc2xx.c linux/drivers/usb/dc2xx.c --- v2.3.25/linux/drivers/usb/dc2xx.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/dc2xx.c Fri Nov 5 15:54:01 1999 @@ -0,0 +1,497 @@ +/* + * Copyright (C) 1999 by David Brownell + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * USB driver for Kodak DC-2XX series digital still cameras + * + * The protocol here is the same as the one going over a serial line, but + * it uses USB for speed. Set up /dev/kodak, get gphoto (www.gphoto.org), + * and have fun! + * + * This should also work for a number of other digital (non-Kodak) cameras, + * by adding the vendor and product IDs to the table below. + */ + +/* + * HISTORY + * + * 26 August, 1999 -- first release (0.1), works with my DC-240. + * The DC-280 (2Mpixel) should also work, but isn't tested. + * If you use gphoto, make sure you have the USB updates. + * Lives in a 2.3.14 or so Linux kernel, in drivers/usb. + * 31 August, 1999 -- minor update to recognize DC-260 and handle + * its endpoints being in a different order. Note that as + * of gPhoto 0.36pre, the USB updates are integrated. + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "usb.h" + + +// #define CAMERA_DEBUG + + +/* XXX need to get registered minor number, cdev 10/MINOR */ +/* XXX or: cdev USB_MAJOR(180)/USB_CAMERA_MINOR */ +#define USB_CAMERA_MINOR 170 + + +/* Application protocol limit is 0x8002; USB has disliked that limit! */ +#define MAX_PACKET_SIZE 0x2000 /* e.g. image downloading */ + +#define MAX_READ_RETRY 5 /* times to retry reads */ +#define MAX_WRITE_RETRY 5 /* times to retry writes */ +#define RETRY_TIMEOUT (HZ) /* sleep between retries */ + + +/* table of cameras that work through this driver */ +static struct camera { + short idVendor; + short idProduct; + + /* should get this name from the USB subsystem */ + const char *nameProduct; +} cameras [] = { + { 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. + */ +/* { 0x040a, 0x0100, "Kodak DC-220" }, */ + { 0x040a, 0x0110, "Kodak DC-260" }, +/* { 0x040a, 0x0115, "Kodak DC-265" }, */ +/* { 0x040a, 0x0140, "Kodak DC-290" }, */ + +/* { 0xffff, 0xffff, "Minolta Dimage EX 1500" }, */ +/* { 0x03f0, 0xffff, "HP PhotoSmart C500" }, */ + + /* Other USB cameras may well work here too, so long as they + * just stick to half duplex packet exchanges. + */ +}; + + +struct camera_state { + /* these fields valid (dev != 0) iff camera connected */ + struct usb_device *dev; /* USB device handle */ + char inEP; /* read endpoint */ + char outEP; /* write endpoint */ + struct camera *info; /* DC-240, etc */ + + /* valid iff isOpen */ + int isOpen; /* device opened? */ + int isActive; /* I/O taking place? */ + char *buf; /* buffer for I/O */ + + /* always valid */ + wait_queue_head_t wait; /* for timed waits */ +}; + + +/* For now, we only support one camera at a time: there's one + * application-visible device (e.g. /dev/kodak) and the second + * (to Nth) camera detected on the bus is ignored. + */ +static struct camera_state static_camera_state; + + +static ssize_t camera_read (struct file *file, + char *buf, size_t len, loff_t *ppos) +{ + struct camera_state *camera; + int retries; + + camera = (struct camera_state *) file->private_data; + if (len > MAX_PACKET_SIZE) + return -EINVAL; + if (camera->isActive++) + return -EBUSY; + + /* Big reads are common, for image downloading. Smaller ones + * are also common (even "directory listing" commands don't + * send very much data). We preserve packet boundaries here, + * they matter in the application protocol. + */ + for (retries = 0; retries < MAX_READ_RETRY; retries++) { + unsigned long count; + int result; + + if (signal_pending (current)) { + camera->isActive = 0; + return -EINTR; + } + if (!camera->dev) { + camera->isActive = 0; + return -ENODEV; + } + + result = camera->dev->bus->op->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 + if (!result) { + if (copy_to_user (buf, camera->buf, count)) + return -EFAULT; + camera->isActive = 0; + return count; + } + if (result != USB_ST_TIMEOUT) + break; + interruptible_sleep_on_timeout (&camera->wait, RETRY_TIMEOUT); +#ifdef CAMERA_DEBUG + printk ("camera.r (%d) - retry\n", len); +#endif + } + camera->isActive = 0; + return -EIO; +} + +static ssize_t camera_write (struct file *file, + const char *buf, size_t len, loff_t *ppos) +{ + struct camera_state *camera; + ssize_t bytes_written = 0; + + camera = (struct camera_state *) file->private_data; + if (len > MAX_PACKET_SIZE) + return -EINVAL; + if (camera->isActive++) + return -EBUSY; + + /* most writes will be small: simple commands, sometimes with + * parameters. putting images (like borders) into the camera + * would be the main use of big writes. + */ + while (len > 0) { + char *obuf = camera->buf; + int maxretry = MAX_WRITE_RETRY; + unsigned long copy_size, thistime; + + /* 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)) { + bytes_written = -EFAULT; + break; + } + while (thistime) { + int result; + unsigned long count; + + if (signal_pending (current)) { + if (!bytes_written) + bytes_written = -EINTR; + goto done; + } + if (!camera->dev) { + if (!bytes_written) + bytes_written = -ENODEV; + goto done; + } + + result = camera->dev->bus->op->bulk_msg (camera->dev, + usb_sndbulkpipe (camera->dev, camera->outEP), + obuf, thistime, &count, HZ*10); +#ifdef CAMERA_DEBUG + if (result) + printk ("camera.w USB err - %x\n", result); +#endif + if (count) { + obuf += count; + thistime -= count; + maxretry = MAX_WRITE_RETRY; + continue; + } else if (!result) + break; + + if (result == USB_ST_TIMEOUT) { /* NAK - delay a bit */ + if (!maxretry--) { + if (!bytes_written) + bytes_written = -ETIME; + goto done; + } + interruptible_sleep_on_timeout (&camera->wait, + RETRY_TIMEOUT); + continue; + } + if (!bytes_written) + bytes_written = -EIO; + goto done; + } + bytes_written += copy_size; + len -= copy_size; + buf += copy_size; + } +done: + camera->isActive = 0; +#ifdef CAMERA_DEBUG + printk ("camera.w %d\n", bytes_written); +#endif + return bytes_written; +} + +static int camera_open (struct inode *inode, struct file *file) +{ + struct camera_state *camera = &static_camera_state; + + /* ignore camera->dev so it can be turned on "late" */ + + if (camera->isOpen++) + return -EBUSY; + if (!(camera->buf = (char *) kmalloc (MAX_PACKET_SIZE, GFP_KERNEL))) { + camera->isOpen = 0; + return -ENOMEM; + } +#ifdef CAMERA_DEBUG + printk ("camera.open\n"); +#endif + + /* Keep driver from being unloaded while it's in use */ + MOD_INC_USE_COUNT; + + camera->isActive = 0; + file->private_data = camera; + return 0; +} + +static int camera_release (struct inode *inode, struct file *file) +{ + struct camera_state *camera; + + camera = (struct camera_state *) file->private_data; + kfree (camera->buf); + camera->isOpen = 0; + MOD_DEC_USE_COUNT; +#ifdef CAMERA_DEBUG + printk ("camera.close\n"); +#endif + + return 0; +} + + /* XXX should define some ioctls to expose camera type + * to applications ... what USB exposes should suffice. + * apps should be able to see the camera type. + */ +static struct file_operations usb_camera_fops = { + NULL, /* llseek */ + camera_read, + camera_write, + NULL, /* readdir */ + NULL, /* poll */ + NULL, /* ioctl */ + NULL, /* mmap */ + camera_open, + NULL, /* flush */ + camera_release, + NULL, /* async */ + NULL, /* fasync */ + NULL, /* check_media_change */ + NULL, /* revalidate */ + NULL, /* lock */ +}; + +static struct miscdevice usb_camera = { + USB_CAMERA_MINOR, + "USB camera (Kodak DC-2xx)", + &usb_camera_fops +}; + + + +static void * camera_probe(struct usb_device *dev, unsigned int ifnum) +{ + int i; + struct camera *camera_info = NULL; + struct usb_interface_descriptor *interface; + struct usb_endpoint_descriptor *endpoint; + + struct camera_state *camera = &static_camera_state; + + /* Is it a supported camera? */ + for (i = 0; i < sizeof (cameras) / sizeof (struct camera); i++) { + if (cameras [i].idVendor != dev->descriptor.idVendor) + continue; + if (cameras [i].idProduct != dev->descriptor.idProduct) + continue; + camera_info = &cameras [i]; + break; + } + if (camera_info == NULL) + return NULL; + + /* these have one config, one interface */ + if (dev->descriptor.bNumConfigurations != 1 + || dev->config[0].bNumInterfaces != 1) { + printk (KERN_INFO "Bogus camera config info\n"); + 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]; + interface = &dev->actconfig->interface[ifnum].altsetting[0]; + if ((interface->bInterfaceClass != 0 + && interface->bInterfaceClass != 0xff) + || interface->bInterfaceSubClass != 0 + || interface->bInterfaceProtocol != 0 + || interface->bNumEndpoints != 2 + ) { + printk (KERN_INFO "Bogus camera interface info\n"); + return NULL; + } + + /* 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); + } else { + printk(KERN_INFO "Ignoring additional USB Camera (%s)\n", + camera_info->nameProduct); + 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; + else + camera->outEP = endpoint [0].bEndpointAddress; + + if ((endpoint [1].bEndpointAddress & 0x80) == 0x80) + camera->inEP = endpoint [1].bEndpointAddress & 0x7f; + else + camera->outEP = endpoint [1].bEndpointAddress; + if (camera->outEP == -1 || camera->inEP == -1 + || endpoint [0].bmAttributes != 0x02 + || endpoint [1].bmAttributes != 0x02 + ) { + printk (KERN_INFO "Bogus camera endpoints\n"); + camera->dev = NULL; + return NULL; + } + + + if (usb_set_configuration (dev, dev->config[0].bConfigurationValue)) { + printk (KERN_INFO "Failed usb_set_configuration: camera\n"); + camera->dev = NULL; + return NULL; + } + + camera->info = camera_info; + return camera; +} + +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; + + /* Currently not reflecting this up to userland; at one point + * it got called on bus reconfig, which we clearly don't want. + * A good consequence is the ability to remove camera for + * a while without apps needing to do much more than ignore + * some particular error returns. On the bad side, if one + * camera is swapped for another one, we won't be telling. + */ + camera->info = NULL; + camera->dev = NULL; + + printk (KERN_INFO "USB Camera (%s) disconnected\n", info->nameProduct); +} + +static struct usb_driver camera_driver = { + "dc2xx", + camera_probe, + camera_disconnect, + { NULL, NULL }, + + NULL, /* &usb_camera_fops, */ + 0 /* USB_CAMERA_MINOR */ +}; + + +#ifdef MODULE +static __init +#endif +int usb_dc2xx_init(void) +{ + struct camera_state *camera = &static_camera_state; + + camera->dev = NULL; + camera->isOpen = 0; + camera->isActive = 0; + init_waitqueue_head (&camera->wait); + + if (usb_register (&camera_driver) < 0) + return -1; + misc_register (&usb_camera); + + return 0; +} + +#ifdef MODULE +static __exit +#endif +void usb_dc2xx_cleanup(void) +{ + usb_deregister (&camera_driver); + misc_deregister (&usb_camera); +} + + +#ifdef MODULE + +MODULE_AUTHOR("David Brownell, david-b@pacbell.net"); +MODULE_DESCRIPTION("USB Camera Driver for Kodak DC-2xx series cameras"); + +module_init (usb_dc2xx_init); +module_exit (usb_dc2xx_cleanup); + +#endif /* MODULE */ diff -u --recursive --new-file v2.3.25/linux/drivers/usb/ezusb.c linux/drivers/usb/ezusb.c --- v2.3.25/linux/drivers/usb/ezusb.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/ezusb.c Fri Nov 5 10:42:15 1999 @@ -311,7 +311,7 @@ if (pos + len > 0x10000) len = 0x10000 - pos; i = usb_control_msg(ez->usbdev, usb_rcvctrlpipe(ez->usbdev, 0), 0xa0, 0xc0, pos, 0, b, len, HZ); - if (i) { + if (i < 0) { up(&ez->mutex); printk(KERN_WARNING "ezusb: upload failed pos %u len %u ret %d\n", pos, len, i); *ppos = pos; @@ -366,7 +366,7 @@ return -EFAULT; } i = usb_control_msg(ez->usbdev, usb_sndctrlpipe(ez->usbdev, 0), 0xa0, 0x40, pos, 0, b, len, HZ); - if (i) { + if (i < 0) { up(&ez->mutex); printk(KERN_WARNING "ezusb: download failed pos %u len %u ret %d\n", pos, len, i); *ppos = pos; @@ -1052,7 +1052,9 @@ init_waitqueue_head(&ezusb[u].wait); spin_lock_init(&ezusb[u].lock); } - usb_register(&ezusb_driver); + if (usb_register(&ezusb_driver) < 0) + return -1; + printk(KERN_INFO "ezusb: Anchorchip firmware download driver registered\n"); return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/usb/hp_scanner.c linux/drivers/usb/hp_scanner.c --- v2.3.25/linux/drivers/usb/hp_scanner.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/hp_scanner.c Fri Nov 5 10:42:15 1999 @@ -299,7 +299,9 @@ int usb_hp_scanner_init(void) { - usb_register(&scanner_driver); + if (usb_register(&scanner_driver) < 0) + return -1; + printk(KERN_DEBUG "USB Scanner support registered.\n"); return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/usb/hub.c linux/drivers/usb/hub.c --- v2.3.25/linux/drivers/usb/hub.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/hub.c Fri Nov 5 10:42:15 1999 @@ -105,7 +105,7 @@ int i; /* Get the length first */ - if (usb_get_hub_descriptor(dev, buffer, 4)) + if (usb_get_hub_descriptor(dev, buffer, 4) < 0) return -1; header = (struct usb_descriptor_header *)buffer; @@ -113,7 +113,7 @@ if (!bitmap) return -1; - if (usb_get_hub_descriptor(dev, bitmap, header->bLength)) + if (usb_get_hub_descriptor(dev, bitmap, header->bLength) < 0) return -1; descriptor = (struct usb_hub_descriptor *)bitmap; @@ -166,7 +166,7 @@ kfree(bitmap); - if (usb_get_hub_status(dev, buffer)) + if (usb_get_hub_status(dev, buffer) < 0) return -1; hubsts = (struct usb_hub_status *)buffer; @@ -305,7 +305,7 @@ wait_ms(50); /* FIXME: This is from the *BSD stack, thanks! :) */ /* Check status */ - if (usb_get_port_status(hub, port + 1, &portsts)) { + if (usb_get_port_status(hub, port + 1, &portsts) < 0) { printk(KERN_ERR "get_port_status failed\n"); return; } @@ -377,7 +377,7 @@ struct usb_port_status portsts; unsigned short portstatus, portchange; - if (usb_get_port_status(dev, i + 1, &portsts)) { + if (usb_get_port_status(dev, i + 1, &portsts) < 0) { printk(KERN_ERR "get_port_status failed\n"); continue; } @@ -474,7 +474,8 @@ { int pid; - usb_register(&hub_driver); + if (usb_register(&hub_driver) < 0) + return -1; pid = kernel_thread(usb_hub_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); @@ -487,7 +488,7 @@ /* Fall through if kernel_thread failed */ usb_deregister(&hub_driver); - return 1; + return -1; } void usb_hub_cleanup(void) diff -u --recursive --new-file v2.3.25/linux/drivers/usb/keyboard.c linux/drivers/usb/keyboard.c --- v2.3.25/linux/drivers/usb/keyboard.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/keyboard.c Fri Nov 5 10:42:15 1999 @@ -256,8 +256,7 @@ int usb_kbd_init(void) { - usb_register(&usb_kbd_driver); - return 0; + return usb_register(&usb_kbd_driver); } void usb_kbd_cleanup(void) diff -u --recursive --new-file v2.3.25/linux/drivers/usb/mouse.c linux/drivers/usb/mouse.c --- v2.3.25/linux/drivers/usb/mouse.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/mouse.c Fri Nov 5 10:42:15 1999 @@ -410,7 +410,9 @@ init_waitqueue_head(&mouse->wait); mouse->fasync = NULL; - usb_register(&mouse_driver); + if (usb_register(&mouse_driver) < 0) + return -1; + printk(KERN_INFO "USB HID boot protocol mouse driver registered.\n"); return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/usb/printer.c linux/drivers/usb/printer.c --- v2.3.25/linux/drivers/usb/printer.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/printer.c Fri Nov 5 10:42:15 1999 @@ -419,12 +419,8 @@ int usb_printer_init(void) { - if (usb_register(&printer_driver)) { - printk(KERN_ERR "USB Printer driver cannot register: " - "minor number %d already in use\n", - printer_driver.minor); - return 1; - } + if (usb_register(&printer_driver)) + return -1; printk(KERN_INFO "USB Printer support registered.\n"); return 0; @@ -433,7 +429,6 @@ #ifdef MODULE int init_module(void) { - return usb_printer_init(); } diff -u --recursive --new-file v2.3.25/linux/drivers/usb/proc_usb.c linux/drivers/usb/proc_usb.c --- v2.3.25/linux/drivers/usb/proc_usb.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/proc_usb.c Thu Nov 4 19:51:28 1999 @@ -968,27 +968,16 @@ NULL /* revalidate */ }; -#define PROCUSB_MAXBUSSES 64 - -static unsigned long busnumbermap[(PROCUSB_MAXBUSSES+8 * sizeof(unsigned long)-1) / (8 * sizeof(unsigned long))] = { 0, }; - void proc_usb_add_bus(struct usb_bus *bus) { - int bnum; char buf[16]; - bus->proc_busnum = -1; bus->proc_entry = NULL; if (!usbdir) return; - bnum = find_first_zero_bit(busnumbermap, PROCUSB_MAXBUSSES); - if (bnum >= PROCUSB_MAXBUSSES) - return; - sprintf(buf, "%03d", bnum); + sprintf(buf, "%03d", bus->busnum); if (!(bus->proc_entry = create_proc_entry(buf, S_IFDIR, usbdir))) return; - set_bit(bnum, busnumbermap); - bus->proc_busnum = bnum; bus->proc_entry->data = bus; } @@ -998,7 +987,6 @@ if (!bus->proc_entry) return; remove_proc_entry(bus->proc_entry->name, usbdir); - clear_bit(bus->proc_busnum, busnumbermap); } void proc_usb_add_device(struct usb_device *dev) diff -u --recursive --new-file v2.3.25/linux/drivers/usb/uhci.c linux/drivers/usb/uhci.c --- v2.3.25/linux/drivers/usb/uhci.c Wed Oct 27 16:34:12 1999 +++ linux/drivers/usb/uhci.c Thu Nov 4 19:51:28 1999 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -73,20 +74,20 @@ * function prototypes */ -static int uhci_get_current_frame_number (struct usb_device *usb_dev); +static int uhci_get_current_frame_number(struct usb_device *usb_dev); -static int uhci_init_isoc (struct usb_device *usb_dev, +static int uhci_init_isoc(struct usb_device *usb_dev, unsigned int pipe, int frame_count, void *context, struct usb_isoc_desc **isocdesc); -static void uhci_free_isoc (struct usb_isoc_desc *isocdesc); +static void uhci_free_isoc(struct usb_isoc_desc *isocdesc); -static int uhci_run_isoc (struct usb_isoc_desc *isocdesc, +static int uhci_run_isoc(struct usb_isoc_desc *isocdesc, struct usb_isoc_desc *pr_isocdesc); -static int uhci_kill_isoc (struct usb_isoc_desc *isocdesc); +static int uhci_kill_isoc(struct usb_isoc_desc *isocdesc); /* * Map status to standard result codes @@ -123,15 +124,12 @@ /* * Return the result of a TD.. */ -static int uhci_td_result(struct uhci_device *dev, struct uhci_td *td, unsigned long *rval, int debug) +static int uhci_td_result(struct uhci_device *dev, struct uhci_td *td, unsigned long *rval) { unsigned int status; struct uhci_td *tmp; int count = 1000, actlength, explength; - if (rval) - *rval = 0; - /* Start at the TD first in the chain, if possible */ if (td->qh && td->qh->first) tmp = td->qh->first; @@ -141,6 +139,9 @@ if (!tmp) return USB_ST_INTERNALERROR; + if (rval) + *rval = 0; + /* Locate the first failing td, if any */ do { status = uhci_status_bits(tmp->status); @@ -154,12 +155,12 @@ actlength = uhci_actual_length(tmp->status); if (rval) *rval += actlength; - /* This check is bogus, at least for acm. It - always expects 64, but gets as many bytes - as available (typically 1) -- pavel */ - if (0 && (explength != actlength)) { - /* Reset the data toggle on error. */ - if (debug || uhci_debug) + + if (explength != actlength) { + /* If the packet is short, none of the */ + /* packets after this were processed, so */ + /* fix the DT accordingly */ + if (in_interrupt() || uhci_debug) printk(KERN_DEBUG "Set toggle from %p rval %ld%c for status=%x to %d, exp=%d, act=%d\n", tmp, rval ? *rval : 0, rval ? '*' : '/', tmp->status, @@ -168,12 +169,11 @@ usb_settoggle(dev->usb, uhci_endpoint(tmp->info), uhci_packetout(tmp->info), uhci_toggle(tmp->info) ^ 1); - break; // Short packet + break; /* Short packet */ } } - if ((tmp->link & UHCI_PTR_TERM) || - (tmp->link & UHCI_PTR_QH)) + if ((tmp->link & UHCI_PTR_TERM) || (tmp->link & UHCI_PTR_QH)) break; tmp = uhci_ptr_to_virt(tmp->link); @@ -181,8 +181,6 @@ if (!count) { printk(KERN_ERR "runaway td's in uhci_td_result!\n"); - /* Force debugging on */ - debug = 1; } else { /* If we got to the last TD */ @@ -200,7 +198,7 @@ return USB_ST_NOERROR; /* We got to an error, but the controller hasn't finished */ - /* with it yet. */ + /* with it yet */ if (tmp->status & TD_CTRL_ACTIVE) return USB_ST_NOCHANGE; @@ -212,7 +210,7 @@ } /* Some debugging code */ - if (debug && uhci_debug) { + if (!count || (!in_interrupt() && uhci_debug)) { printk(KERN_DEBUG "uhci_td_result() failed with status %x\n", status); @@ -296,7 +294,7 @@ if (lqh->link & UHCI_PTR_TERM) break; - lqh = uhci_ptr_to_virt(lqh->link); + lqh = (struct uhci_qh *)uhci_ptr_to_virt(lqh->link); } if (lqh->link & UHCI_PTR_TERM) { @@ -561,13 +559,17 @@ * udelay(1000) doesn't sound nice, and schedule() * can't be used as this is called from within interrupt context. */ + /* + * we should do the same thing as we do with the QH's + * see uhci_insert_tds_in_qh and uhci_remove_td --jerdfelt + */ /* for now warn if there's a possible problem */ if (td->status & TD_CTRL_ACTIVE) { unsigned frn = inw(uhci->io_addr + USBFRNUM); __u32 link = uhci->fl->frame[frn % UHCI_NUMFRAMES]; if (!(link & (UHCI_PTR_TERM | UHCI_PTR_QH))) { struct uhci_td *tdl = (struct uhci_td *)uhci_ptr_to_virt(link); - for (;;) { + for (;tdl;) { if (tdl == td) { printk(KERN_WARNING "uhci_remove_frame_list: td possibly still in use!!\n"); break; @@ -589,7 +591,7 @@ */ static void uhci_remove_transfer(struct uhci_td *td, char removeirq) { - int maxcount = 1000; + int count = 1000; struct uhci_td *curtd; unsigned int nextlink; @@ -598,7 +600,7 @@ else curtd = td; - /* Remove it from the skeleton */ + /* Remove the QH from the skeleton and then free it */ uhci_remove_qh(td->qh->skel, td->qh); uhci_qh_free(td->qh); @@ -606,21 +608,24 @@ nextlink = curtd->link; /* IOC? => remove handler */ - if (removeirq && (td->status & TD_CTRL_IOC)) + /* HACK: Don't remove if already removed. Prevents deadlock */ + /* in uhci_interrupt_notify and callbacks */ + if (removeirq && (td->status & TD_CTRL_IOC) && + td->irq_list.next != &td->irq_list) uhci_remove_irq_list(td); + /* Remove the TD and then free it */ uhci_remove_td(curtd); uhci_td_free(curtd); if (nextlink & UHCI_PTR_TERM) /* Tail? */ break; - curtd = (struct uhci_td *)uhci_ptr_to_virt(nextlink); - if (!--maxcount) { - printk(KERN_ERR "runaway td's!?\n"); - break; - } - } while (1); + curtd = (struct uhci_td *)uhci_ptr_to_virt(nextlink & ~UHCI_PTR_BITS); + } while (count--); + + if (!count) + printk(KERN_ERR "runaway td's!?\n"); } /* @@ -644,17 +649,18 @@ uhci_td_free(td); if (qh) uhci_qh_free(qh); - return (-ENOMEM); + return USB_ST_INTERNALERROR; } /* Destination: pipe destination with INPUT */ destination = (pipe & PIPE_DEVEP_MASK) | usb_packetid(pipe); /* Infinite errors is 0, so no bits */ - status = (pipe & TD_CTRL_LS) | TD_CTRL_IOC | TD_CTRL_ACTIVE | TD_CTRL_SPD; + status = (pipe & TD_CTRL_LS) | TD_CTRL_IOC | TD_CTRL_ACTIVE | + TD_CTRL_SPD; td->link = UHCI_PTR_TERM; /* Terminate */ - td->status = status; + td->status = status; /* In */ td->info = destination | ((usb_maxpacket(usb_dev, pipe, usb_pipeout(pipe)) - 1) << 21) | (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) << TD_TOKEN_TOGGLE); @@ -678,6 +684,7 @@ uhci_insert_qh(qh->skel, qh); *handle = (void *)td; + return 0; } @@ -742,7 +749,7 @@ * Returns 0 for success or negative value for error. * Sets isocdesc before successful return. */ -static int uhci_init_isoc (struct usb_device *usb_dev, +static int uhci_init_isoc(struct usb_device *usb_dev, unsigned int pipe, int frame_count, /* bandwidth % = 100 * this / 1024 */ void *context, @@ -948,7 +955,6 @@ * frame_desc array, but this way won't take less bandwidth * allocation into account. */ - if (isocdesc->frame_spacing <= 0) isocdesc->frame_spacing = 1; @@ -1038,7 +1044,7 @@ return 0; } /* end uhci_kill_isoc */ -static void uhci_free_isoc (struct usb_isoc_desc *isocdesc) +static void uhci_free_isoc(struct usb_isoc_desc *isocdesc) { int i; @@ -1083,9 +1089,11 @@ { DECLARE_WAITQUEUE(wait, current); struct uhci_qh *qh = uhci_qh_alloc(dev); + unsigned long rval; + int ret; if (!qh) - return -1; + return USB_ST_INTERNALERROR; current->state = TASK_UNINTERRUPTIBLE; add_wait_queue(&qh->wakeup, &wait); @@ -1108,9 +1116,12 @@ /* Remove it from the skeleton */ uhci_remove_qh(&dev->uhci->skel_control_qh, qh); + /* Need to check result before free'ing the qh */ + ret = uhci_td_result(dev, last, &rval); + uhci_qh_free(qh); - return uhci_td_result(dev, last, NULL, 1); + return (ret < 0) ? ret : rval; } /* @@ -1149,14 +1160,10 @@ int maxsze = usb_maxpacket(usb_dev, pipe, usb_pipeout(pipe)); __u32 nextlink; unsigned long bytesrequested = len; - unsigned long bytesread = 0; -#ifdef DUMP_RAW - unsigned char *orig_data = (unsigned char *) data; -#endif first = td = uhci_td_alloc(dev); if (!td) - return -ENOMEM; + return USB_ST_INTERNALERROR; /* The "pipe" thing contains the destination in bits 8--18 */ destination = (pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP; @@ -1184,7 +1191,7 @@ td = uhci_td_alloc(dev); if (!td) { uhci_td_free(prevtd); - return -ENOMEM; + return USB_ST_INTERNALERROR; } prevtd->link = virt_to_bus(td) | UHCI_PTR_DEPTH; @@ -1214,16 +1221,18 @@ prevtd = td; td = uhci_td_alloc(dev); if (!td) - return -ENOMEM; + return USB_ST_INTERNALERROR; prevtd->link = virt_to_bus(td) | UHCI_PTR_DEPTH; /* Update previous TD */ } /* * Build the final TD for control status + * + * It's IN if the pipe is an output pipe or we're not expecting + * data back. */ - /* It's only IN if the pipe is out AND we aren't expecting data */ destination &= ~0xFF; - if (usb_pipeout(pipe) | (bytesrequested == 0)) + if (usb_pipeout(pipe) || !bytesrequested) destination |= USB_PID_IN; else destination |= USB_PID_OUT; @@ -1243,10 +1252,6 @@ count = 1000; td = first; do { - if (!uhci_status_bits(td->status) && ((td->info & 0xFF) == - USB_PID_IN)) - bytesread += uhci_actual_length(td->status); - nextlink = td->link; uhci_remove_td(td); uhci_td_free(td); @@ -1260,36 +1265,9 @@ if (!count) printk(KERN_ERR "runaway td's!?\n"); - if (ret && (bytesread >= bytesrequested)) { - printk(KERN_DEBUG "Recovered sufficient data (asked for %ld, got %ld) from failed cmd\n", - bytesrequested, bytesread); - ret = 0; - } - - if (uhci_debug && ret) { - __u8 *p = (__u8 *)cmd; - - printk("dev %d, pipe %X requested %ld bytes, got %ld, status=%d:\n", - usb_dev->devnum, pipe, bytesrequested, bytesread, ret); - printk(KERN_DEBUG "Failed cmd - %02X %02X %02X %02X %02X %02X %02X %02X\n", - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); - } - -#ifdef DUMP_RAW - if (!ret && usb_pipein(pipe)) { /* good Input control msg */ - int i; - - printk (KERN_CRIT "ctrl msg [%02x %02x %04x %04x %04x] on pipe %x returned:\n", - cmd->requesttype, cmd->request, - cmd->value, cmd->index, cmd->length, pipe); - for (i = 0; i < bytesrequested; ) { - printk(" %02x", orig_data[i]); - if (++i % 16 == 0) - printk("\n"); - } - if (i % 16 != 0) - printk("\n"); - } +#ifdef UHCI_DEBUG + if (ret >= 0 && ret != bytesrequested && bytesrequested) + printk("requested %ld bytes, got %d\n", bytesrequested, ret); #endif return ret; @@ -1309,9 +1287,10 @@ { DECLARE_WAITQUEUE(wait, current); struct uhci_qh *qh = uhci_qh_alloc(dev); + int ret; if (!qh) - return -ENOMEM; + return USB_ST_INTERNALERROR; current->state = TASK_UNINTERRUPTIBLE; add_wait_queue(&qh->wakeup, &wait); @@ -1333,9 +1312,11 @@ uhci_remove_qh(&dev->uhci->skel_bulk_qh, qh); + ret = uhci_td_result(dev, last, rval); + uhci_qh_free(qh); - return uhci_td_result(dev, last, rval, 1); + return ret; } /* @@ -1350,9 +1331,10 @@ static int uhci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *rval, int timeout) { struct uhci_device *dev = usb_to_uhci(usb_dev); - struct uhci_td *first, *td, *prevtd; + struct uhci_td *first, *td, *prevtd, *curtd; unsigned long destination, status; - int ret; + unsigned int nextlink; + int ret, count; int maxsze = usb_maxpacket(usb_dev, pipe, usb_pipeout(pipe)); if (usb_endpoint_halted(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) && @@ -1370,7 +1352,7 @@ */ first = td = uhci_td_alloc(dev); if (!td) - return -ENOMEM; + return USB_ST_INTERNALERROR; prevtd = first; // This is fake, but at least it's not NULL while (len > 0) { @@ -1395,7 +1377,7 @@ prevtd = td; td = uhci_td_alloc(dev); if (!td) - return -ENOMEM; + return USB_ST_INTERNALERROR; prevtd->link = virt_to_bus(td) | UHCI_PTR_DEPTH;/* Update previous TD */ } @@ -1412,30 +1394,28 @@ /* Start it up.. */ ret = uhci_run_bulk(dev, first, td, rval, timeout); - { - int count = 100; - struct uhci_td *curtd = first; - unsigned int nextlink; + count = 1000; + curtd = first; - do { - nextlink = curtd->link; - uhci_remove_td(curtd); - uhci_td_free(curtd); + do { + nextlink = curtd->link; + uhci_remove_td(curtd); + uhci_td_free(curtd); - if (nextlink & UHCI_PTR_TERM) /* Tail? */ - break; + if (nextlink & UHCI_PTR_TERM) /* Tail? */ + break; - curtd = uhci_ptr_to_virt(nextlink); - } while (--count); + curtd = uhci_ptr_to_virt(nextlink); + } while (--count); - if (!count) - printk(KERN_DEBUG "runaway td's!?\n"); - } + if (!count) + printk(KERN_DEBUG "uhci: runaway td's!?\n"); - return ret; + return ret < 0; } -static void * uhci_request_bulk(struct usb_device *usb_dev, unsigned int pipe, usb_device_irq handler, void *data, int len, void *dev_id) +static void *uhci_request_bulk(struct usb_device *usb_dev, unsigned int pipe, + usb_device_irq handler, void *data, int len, void *dev_id) { struct uhci_device *dev = usb_to_uhci(usb_dev); struct uhci *uhci = dev->uhci; @@ -1460,7 +1440,7 @@ if (pktsze > maxsze) pktsze = maxsze; - td->status = status; + td->status = status; /* Status */ td->info = destination | ((pktsze-1) << 21) | (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) << TD_TOKEN_TOGGLE); /* pktsze bytes of data */ td->buffer = virt_to_bus(data); @@ -1468,6 +1448,7 @@ td->qh = bulk_qh; td->dev = dev; td->pipetype = PIPE_BULK; + data += pktsze; len -= pktsze; @@ -1619,9 +1600,9 @@ if (usb_new_device(usb_dev)) { unsigned short status = inw(port); - printk(KERN_INFO "uhci: disabling malfunctioning port %d\n", + printk(KERN_INFO "uhci: disabling port %d\n", nr + 1); - outw(status | USBPORTSC_PE, port); + outw(status & ~USBPORTSC_PE, port); } } @@ -1699,7 +1680,7 @@ return 0; } -int uhci_isoc_callback(struct uhci *uhci, struct uhci_td *td, int status, unsigned long rval) +static int uhci_isoc_callback(struct uhci *uhci, struct uhci_td *td, int status, unsigned long rval) { struct usb_isoc_desc *isocdesc = td->dev_id; int ret; @@ -1732,6 +1713,7 @@ /* TBD */ /* usb_dev = td->dev->usb; */ + /* Safe since uhci_interrupt_notify holds the lock */ list_add(&td->irq_list, &uhci->interrupt_list); td->status = (td->status & (TD_CTRL_SPD | TD_CTRL_C_ERR_MASK | @@ -1766,20 +1748,49 @@ return 0; } -int uhci_callback(struct uhci *uhci, struct uhci_td *td, int status, unsigned long rval) +static int uhci_bulk_callback(struct uhci *uhci, struct uhci_td *td, int status, unsigned long rval) { if (td->completed(status, bus_to_virt(td->buffer), rval, td->dev_id)) { struct usb_device *usb_dev = td->dev->usb; + /* This is safe since uhci_interrupt_notify holds the lock */ + list_add(&td->irq_list, &uhci->interrupt_list); + + /* Reset the status */ + td->status = (td->status & TD_CTRL_LS) | TD_CTRL_ACTIVE | TD_CTRL_IOC | TD_CTRL_SPD; + + /* Reset the info */ + td->info = (td->info & (PIPE_DEVEP_MASK | 0xFF | (TD_CTRL_ACTLEN_MASK << 21))) | + (usb_gettoggle(usb_dev, uhci_endpoint(td->info), uhci_packetout(td->info)) << TD_TOKEN_TOGGLE); /* pktsze bytes of data */ + + usb_dotoggle(usb_dev, uhci_endpoint(td->info), uhci_packetout(td->info)); + /* The HC only removes it when it completed */ + /* successfully, so force remove and re-add it */ + uhci_remove_td(td); + uhci_insert_td_in_qh(td->qh, td); + } + + return 0; +} + +static int uhci_callback(struct uhci *uhci, struct uhci_td *td, int status, unsigned long rval) +{ + if (td->completed(status, bus_to_virt(td->buffer), rval, td->dev_id)) { + struct usb_device *usb_dev = td->dev->usb; + + if (td->pipetype != PIPE_INTERRUPT) + return 0; + + /* This is safe since uhci_interrupt_notify holds the lock */ list_add(&td->irq_list, &uhci->interrupt_list); usb_dotoggle(usb_dev, uhci_endpoint(td->info), uhci_packetout(td->info)); td->info &= ~(1 << TD_TOKEN_TOGGLE); /* clear data toggle */ td->info |= usb_gettoggle(usb_dev, uhci_endpoint(td->info), - uhci_packetout(td->info)) << TD_TOKEN_TOGGLE; /* toggle between data0 and data1 */ + uhci_packetout(td->info)) << TD_TOKEN_TOGGLE; /* toggle between data0 and data1 */ td->status = (td->status & 0x2F000000) | TD_CTRL_ACTIVE | TD_CTRL_IOC; /* The HC only removes it when it completed */ - /* successfully, so force remove and re-add it. */ + /* successfully, so force remove and re-add it */ uhci_remove_td(td); uhci_insert_td_in_qh(td->qh, td); } else if (td->flags & UHCI_TD_REMOVE) { @@ -1797,7 +1808,7 @@ return 0; } - + static void uhci_interrupt_notify(struct uhci *uhci) { struct list_head *tmp, *head = &uhci->interrupt_list; @@ -1813,8 +1824,7 @@ /* We're interested if there was an error or if the chain of */ /* TD's completed successfully */ - status = uhci_td_result(td->dev, td, &rval, 0); - + status = uhci_td_result(td->dev, td, &rval); if (status == USB_ST_NOCHANGE) continue; @@ -1822,10 +1832,14 @@ list_del(&td->irq_list); INIT_LIST_HEAD(&td->irq_list); - if (td->pipetype == PIPE_ISOCHRONOUS) { + switch (td->pipetype) { + case PIPE_ISOCHRONOUS: uhci_isoc_callback(uhci, td, status, rval); - } - else { + break; + case PIPE_BULK: + uhci_bulk_callback(uhci, td, status, rval); + break; + default: uhci_callback(uhci, td, status, rval); } @@ -1904,8 +1918,8 @@ td->link = uhci->fl->frame[0]; td->backptr = &uhci->fl->frame[0]; td->status = TD_CTRL_IOC; - td->info = (15 << 21) | (0x7f << 8) | USB_PID_IN; - /* (ignored) input packet, 16 bytes, device 127 */ + /* (ignored) input packet, 0 bytes, device 127 */ + td->info = (UHCI_NULL_DATA_SIZE << 21) | (0x7f << 8) | USB_PID_IN; td->buffer = 0; td->qh = NULL; td->pipetype = -1; @@ -2272,8 +2286,8 @@ if (check_region(io_addr, io_size)) break; - /* disable legacy emulation */ - pci_write_config_word(dev, USBLEGSUP, USBLEGSUP_DEFAULT); + /* disable legacy emulation */ + pci_write_config_word(dev, USBLEGSUP, USBLEGSUP_DEFAULT); pci_enable_device(dev); diff -u --recursive --new-file v2.3.25/linux/drivers/usb/uhci.h linux/drivers/usb/uhci.h --- v2.3.25/linux/drivers/usb/uhci.h Fri Oct 22 13:21:51 1999 +++ linux/drivers/usb/uhci.h Thu Nov 4 19:51:28 1999 @@ -125,7 +125,7 @@ #define TD_TOKEN_TOGGLE 19 #define uhci_maxlen(token) ((token) >> 21) -#define uhci_expected_length(info) (((info >> 21) + 1) & TD_CTRL_ACTLEN_MASK) /* 1-based */ +#define uhci_expected_length(info) (((info >> 21) + 1) & TD_CTRL_ACTLEN_MASK) /* 1-based */ #define uhci_toggle(token) (((token) >> TD_TOKEN_TOGGLE) & 1) #define uhci_endpoint(token) (((token) >> 15) & 0xf) #define uhci_devaddr(token) (((token) >> 8) & 0x7f) @@ -134,7 +134,6 @@ #define uhci_packetout(token) (uhci_packetid(token) != USB_PID_IN) #define uhci_packetin(token) (uhci_packetid(token) == USB_PID_IN) - /* * The documentation says "4 words for hardware, 4 words for software". * @@ -163,16 +162,16 @@ void *dev_id; atomic_t refcnt; /* Reference counting */ + struct uhci_device *dev; /* The owning device */ struct uhci_qh *qh; /* QH this TD is a part of (ignored for Isochronous) */ + unsigned char pipetype; /* Control, Bulk, Interrupt, Isoc */ int flags; /* Remove, etc */ int isoc_td_number; /* 0-relative number within a usb_isoc_desc. */ - int pipetype; /* Control, Bulk, Interrupt, or Isoc */ - int bandwidth_alloc; /* in microsecs; used only for Interrupt + int bandwidth_alloc; /* in microsecs; used only for Interrupt * transfers, to return its bandwidth */ } __attribute__((aligned(16))); - /* * Note the alignment requirements of the entries * @@ -233,6 +232,7 @@ * other than that, that is what we're doing now * * And now we don't put Iso transfers in QH's, so we don't waste one on it + * --jerdfelt * * To keep with Linus' nomenclature, this is called the QH skeleton. These * labels (below) are only signficant to the root hub's QH's @@ -281,7 +281,7 @@ if (interval < 8) { return 2; /* int4 for 4-7 ms */ } - return 3; /* int 8 for 8-15 ms */ + return 3; /* int8 for 8-15 ms */ } if (interval < 64) { if (interval < 32) { diff -u --recursive --new-file v2.3.25/linux/drivers/usb/usb-core.c linux/drivers/usb/usb-core.c --- v2.3.25/linux/drivers/usb/usb-core.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/usb-core.c Thu Nov 4 19:51:28 1999 @@ -9,7 +9,6 @@ * library, while this file handles starting drivers, etc. * */ - #include #include @@ -32,7 +31,7 @@ { usb_major_init(); #ifdef CONFIG_USB_PROC - proc_usb_init (); + proc_usb_init(); #endif #ifndef CONFIG_USB_MODULE # ifdef CONFIG_USB_UHCI @@ -67,6 +66,9 @@ # endif # ifdef CONFIG_USB_CPIA usb_cpia_init(); +# endif +# ifdef CONFIG_USB_DC2XX + usb_dc2xx_init(); # endif # ifdef CONFIG_USB_HUB usb_hub_init(); diff -u --recursive --new-file v2.3.25/linux/drivers/usb/usb-serial.c linux/drivers/usb/usb-serial.c --- v2.3.25/linux/drivers/usb/usb-serial.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/usb-serial.c Fri Nov 5 10:42:15 1999 @@ -665,7 +665,11 @@ } /* register the USB driver */ - usb_register(&usb_serial_driver); + if (usb_register(&usb_serial_driver) < 0) { + tty_unregister_driver(&serial_tty_driver); + return -1; + } + printk(KERN_INFO "USB Serial support registered.\n"); return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/usb/usb.c linux/drivers/usb/usb.c --- v2.3.25/linux/drivers/usb/usb.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/usb.c Fri Nov 5 10:42:15 1999 @@ -36,6 +36,8 @@ static int usb_find_interface_driver(struct usb_device *, unsigned int); static void usb_check_support(struct usb_device *); +static int usb_debug = 1; + /* * We have a per-interface "registered driver" list. */ @@ -50,13 +52,17 @@ { struct list_head *tmp; - printk("usbcore: Registering new driver %s\n", new_driver->name); if (new_driver->fops != NULL) { - if (usb_minors[new_driver->minor/16]) - BUG(); + if (usb_minors[new_driver->minor/16]) { + printk(KERN_ERR "Error registering %s driver\n", + new_driver->name); + return USB_ST_NOTSUPPORTED; + } usb_minors[new_driver->minor/16] = new_driver; } + printk("usbcore: Registered new driver %s\n", new_driver->name); + /* Add it to the list of known drivers */ list_add(&new_driver->driver_list, &usb_driver_list); @@ -259,7 +265,7 @@ set_bit(busnum, busmap.busmap); bus->busnum = busnum; } else - printk(KERN_INFO "usb: too many bus'\n"); + printk(KERN_INFO "usb: too many buses\n"); proc_usb_add_bus(bus); @@ -461,7 +467,8 @@ static int usb_parse_endpoint(struct usb_device *dev, struct usb_endpoint_descriptor *endpoint, unsigned char *buffer, int size) { struct usb_descriptor_header *header; - int parsed = 0; + unsigned char *begin; + int parsed = 0, len, numskipped; header = (struct usb_descriptor_header *)buffer; @@ -473,8 +480,8 @@ } if (header->bDescriptorType != USB_DT_ENDPOINT) { - printk(KERN_INFO "usb: unexpected descriptor 0x%X\n", - endpoint->bDescriptorType); + printk(KERN_INFO "usb: unexpected descriptor 0x%X, expecting endpoint descriptor, type 0x%X\n", + endpoint->bDescriptorType, USB_DT_ENDPOINT); return parsed; } @@ -487,6 +494,8 @@ /* Skip over the rest of the Class Specific or Vendor Specific */ /* descriptors */ + begin = buffer; + numskipped = 0; while (size >= sizeof(struct usb_descriptor_header)) { header = (struct usb_descriptor_header *)buffer; @@ -496,67 +505,90 @@ } /* If we find another descriptor which is at or below us */ - /* in the descriptor heirarchy then return */ + /* in the descriptor heirarchy then we're done */ if ((header->bDescriptorType == USB_DT_ENDPOINT) || (header->bDescriptorType == USB_DT_INTERFACE) || (header->bDescriptorType == USB_DT_CONFIG) || (header->bDescriptorType == USB_DT_DEVICE)) - return parsed; + break; - printk(KERN_INFO "usb: skipping descriptor 0x%X\n", - header->bDescriptorType); + numskipped++; buffer += header->bLength; size -= header->bLength; parsed += header->bLength; } - return parsed; -} + if (numskipped) + printk(KERN_INFO "usb: skipped %d class/vendor specific endpoint descriptors\n", numskipped); -#if 0 -static int usb_parse_hid(struct usb_device *dev, struct usb_hid_descriptor *hid, unsigned char *ptr, int len) -{ - int parsed = usb_expect_descriptor(ptr, len, USB_DT_HID, ptr[0]); - int i; - - if (parsed < 0) + /* Copy any unknown descriptors into a storage area for drivers */ + /* to later parse */ + len = (int)(buffer - begin); + if (!len) { + endpoint->extra = NULL; + endpoint->extralen = 0; return parsed; + } - memcpy(hid, ptr + parsed, ptr[parsed]); - le16_to_cpus(&hid->bcdHID); + endpoint->extra = kmalloc(len, GFP_KERNEL); + if (!endpoint->extra) { + printk(KERN_ERR "Couldn't allocate memory for endpoint extra descriptors\n"); + endpoint->extralen = 0; + return parsed; + } - for (i=0; ibNumDescriptors; i++) - le16_to_cpus(&(hid->desc[i].wDescriptorLength)); + memcpy(endpoint->extra, begin, len); + endpoint->extralen = len; - return parsed + ptr[parsed]; + return parsed; } -#endif static int usb_parse_interface(struct usb_device *dev, struct usb_interface *interface, unsigned char *buffer, int size) { - int i; - int retval, parsed = 0; + int i, len, numskipped, retval, parsed = 0; struct usb_descriptor_header *header; struct usb_interface_descriptor *ifp; + unsigned char *begin; interface->act_altsetting = 0; interface->num_altsetting = 0; + interface->max_altsetting = USB_ALTSETTINGALLOC; - interface->altsetting = kmalloc(sizeof(struct usb_interface_descriptor) * USB_MAXALTSETTING, GFP_KERNEL); + interface->altsetting = kmalloc(sizeof(struct usb_interface_descriptor) * interface->max_altsetting, GFP_KERNEL); if (!interface->altsetting) { - printk("couldn't kmalloc interface->altsetting\n"); + printk(KERN_ERR "couldn't kmalloc interface->altsetting\n"); return -1; } while (size > 0) { + if (interface->num_altsetting >= interface->max_altsetting) { + void *ptr; + int oldmas; + + oldmas = interface->max_altsetting; + interface->max_altsetting += USB_ALTSETTINGALLOC; + if (interface->max_altsetting > USB_MAXALTSETTING) { + printk(KERN_WARNING "usb: too many alternate settings (max %d)\n", + USB_MAXALTSETTING); + return -1; + } + + ptr = interface->altsetting; + interface->altsetting = kmalloc(sizeof(struct usb_interface_descriptor) * interface->max_altsetting, GFP_KERNEL); + if (!interface->altsetting) { + printk("couldn't kmalloc interface->altsetting\n"); + interface->altsetting = ptr; + return -1; + } + memcpy(interface->altsetting, ptr, sizeof(struct usb_interface_descriptor) * oldmas); + + kfree(ptr); + } + ifp = interface->altsetting + interface->num_altsetting; interface->num_altsetting++; - if (interface->num_altsetting >= USB_MAXALTSETTING) { - printk(KERN_WARNING "usb: too many alternate settings\n"); - return -1; - } memcpy(ifp, buffer, USB_DT_INTERFACE_SIZE); /* Skip over the interface */ @@ -564,6 +596,9 @@ parsed += ifp->bLength; size -= ifp->bLength; + begin = buffer; + numskipped = 0; + /* Skip over at Interface class or vendor descriptors */ while (size >= sizeof(struct usb_descriptor_header)) { header = (struct usb_descriptor_header *)buffer; @@ -573,27 +608,48 @@ return -1; } - /* If we find another descriptor which is at or below us */ - /* in the descriptor heirarchy then return */ + /* If we find another descriptor which is at or below */ + /* us in the descriptor heirarchy then return */ if ((header->bDescriptorType == USB_DT_INTERFACE) || - (header->bDescriptorType == USB_DT_ENDPOINT)) - break; - - if ((header->bDescriptorType == USB_DT_CONFIG) || + (header->bDescriptorType == USB_DT_ENDPOINT) || + (header->bDescriptorType == USB_DT_CONFIG) || (header->bDescriptorType == USB_DT_DEVICE)) - return parsed; + break; - if (header->bDescriptorType == USB_DT_HID) - printk(KERN_INFO "usb: skipping HID descriptor\n"); - else - printk(KERN_INFO "usb: unexpected descriptor 0x%X\n", - header->bDescriptorType); + numskipped++; buffer += header->bLength; parsed += header->bLength; size -= header->bLength; } + if (numskipped) + printk(KERN_INFO "usb: skipped %d class/vendor specific interface descriptors\n", numskipped); + + /* Copy any unknown descriptors into a storage area for */ + /* drivers to later parse */ + len = (int)(buffer - begin); + if (!len) { + ifp->extra = NULL; + ifp->extralen = 0; + } else { + ifp->extra = kmalloc(len, GFP_KERNEL); + if (!ifp->extra) { + printk(KERN_ERR "couldn't allocate memory for interface extra descriptors\n"); + ifp->extralen = 0; + return -1; + } + memcpy(ifp->extra, begin, len); + ifp->extralen = len; + } + + /* Did we hit an unexpected descriptor? */ + header = (struct usb_descriptor_header *)buffer; + if ((size >= sizeof(struct usb_descriptor_header)) && + ((header->bDescriptorType == USB_DT_CONFIG) || + (header->bDescriptorType == USB_DT_DEVICE))) + return parsed; + if (ifp->bNumEndpoints > USB_MAXENDPOINTS) { printk(KERN_WARNING "usb: too many endpoints\n"); return -1; @@ -796,7 +852,7 @@ { int devnum; - dev->descriptor.bMaxPacketSize0 = 8; /* XXX fixed 8 bytes for now */ + dev->descriptor.bMaxPacketSize0 = 8; /* Start off at 8 bytes */ devnum = find_next_zero_bit(dev->bus->devmap.devicemap, 128, 1); if (devnum < 128) { @@ -811,32 +867,20 @@ */ int usb_set_address(struct usb_device *dev) { - devrequest dr; - - dr.requesttype = 0; - dr.request = USB_REQ_SET_ADDRESS; - dr.value = dev->devnum; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_snddefctrl(dev), &dr, NULL, 0, HZ); + return usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS, + 0, dev->devnum, 0, NULL, 0, HZ); } int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size) { - devrequest dr; int i = 5; int result; - dr.requesttype = USB_DIR_IN; - dr.request = USB_REQ_GET_DESCRIPTOR; - dr.value = (type << 8) + index; - dr.index = 0; - dr.length = size; - while (i--) { - if (!(result = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, size, HZ)) - || result == USB_ST_STALL) + if ((result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, + (type << 8) + index, 0, buf, size, HZ)) >= 0 || + result == USB_ST_STALL) break; } return result; @@ -844,22 +888,16 @@ int usb_get_string(struct usb_device *dev, unsigned short langid, unsigned char index, void *buf, int size) { - devrequest dr; - - dr.requesttype = USB_DIR_IN; - dr.request = USB_REQ_GET_DESCRIPTOR; - dr.value = (USB_DT_STRING << 8) + index; - dr.index = langid; - dr.length = size; - - return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, size, HZ); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, + (USB_DT_STRING << 8) + index, langid, buf, size, HZ); } int usb_get_device_descriptor(struct usb_device *dev) { int ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, sizeof(dev->descriptor)); - if (ret == 0) { + if (ret >= 0) { le16_to_cpus(&dev->descriptor.bcdUSB); le16_to_cpus(&dev->descriptor.idVendor); le16_to_cpus(&dev->descriptor.idProduct); @@ -868,62 +906,37 @@ return ret; } -int usb_get_status (struct usb_device *dev, int type, int target, void *data) +int usb_get_status(struct usb_device *dev, int type, int target, void *data) { - devrequest dr; - - dr.requesttype = USB_DIR_IN | type; /* USB_RECIP_DEVICE, _INTERFACE, or _ENDPOINT */ - dr.request = USB_REQ_GET_STATUS; - dr.value = 0; - dr.index = target; - dr.length = 2; - - return dev->bus->op->control_msg (dev, usb_rcvctrlpipe (dev,0), &dr, data, 2, HZ); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, data, 2, HZ); } int usb_get_protocol(struct usb_device *dev) { - unsigned char buf[8]; - devrequest dr; - - dr.requesttype = USB_RT_HIDD | USB_DIR_IN; - dr.request = USB_REQ_GET_PROTOCOL; - dr.value = 0; - dr.index = 1; - dr.length = 1; + unsigned char type; + int ret; - if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), &dr, buf, 1, HZ)) - return -1; + if ((ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_PROTOCOL, USB_DIR_IN | USB_RT_HIDD, + 0, 1, &type, 1, HZ)) < 0) + return ret; - return buf[0]; + return type; } int usb_set_protocol(struct usb_device *dev, int protocol) { - devrequest dr; - - dr.requesttype = USB_RT_HIDD; - dr.request = USB_REQ_SET_PROTOCOL; - dr.value = protocol; - dr.index = 1; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_SET_PROTOCOL, USB_RT_HIDD, protocol, 1, NULL, 0, HZ); } /* keyboards want a nonzero duration according to HID spec, but mice should use infinity (0) -keryan */ int usb_set_idle(struct usb_device *dev, int duration, int report_id) { - devrequest dr; - - dr.requesttype = USB_RT_HIDD; - dr.request = USB_REQ_SET_IDLE; - dr.value = (duration << 8) | report_id; - dr.index = 1; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_IDLE, + USB_RT_HIDD, (duration << 8) | report_id, 1, NULL, 0, HZ); } static void usb_set_maxpacket(struct usb_device *dev) @@ -957,38 +970,30 @@ */ int usb_clear_halt(struct usb_device *dev, int endp) { - devrequest dr; int result; __u16 status; - //if (!usb_endpoint_halted(dev, endp & 0x0f, usb_endpoint_out(endp))) - // return 0; - - dr.requesttype = USB_RT_ENDPOINT; - dr.request = USB_REQ_CLEAR_FEATURE; - dr.value = 0; - dr.index = endp; - dr.length = 0; +/* + if (!usb_endpoint_halted(dev, endp & 0x0f, usb_endpoint_out(endp))) + return 0; +*/ - result = dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0, HZ); + result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CLEAR_FEATURE, USB_RT_ENDPOINT, 0, endp, NULL, 0, HZ); /* don't clear if failed */ - if (result) - return result; + if (result < 0) + return result; + + result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_ENDPOINT, 0, endp, + &status, sizeof(status), HZ); + if (result < 0) + return result; + + if (status & 1) + return USB_ST_STALL; /* still halted */ -#if 1 /* let's be really tough */ - dr.requesttype = USB_DIR_IN | USB_RT_ENDPOINT; - dr.request = USB_REQ_GET_STATUS; - dr.length = 2; - status = 0xffff; - - result = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, &status, 2, HZ); - - if (result) - return result; - if (status & 1) /* endpoint status is Halted */ - return USB_ST_STALL; /* still halted */ -#endif usb_endpoint_running(dev, endp & 0x0f, usb_endpoint_out(endp)); /* toggle is reset on clear */ @@ -1000,18 +1005,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) { - devrequest dr; - int err; + int ret; - dr.requesttype = 1; - dr.request = USB_REQ_SET_INTERFACE; - dr.value = alternate; - dr.index = interface; - dr.length = 0; - - err = dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ); - if (err) - return err; + if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_SET_INTERFACE, USB_RT_INTERFACE, alternate, + interface, NULL, 0, HZ)) < 0) + return ret; dev->actconfig->interface[interface].act_altsetting = alternate; usb_set_maxpacket(dev); @@ -1020,16 +1019,9 @@ int usb_set_configuration(struct usb_device *dev, int configuration) { - devrequest dr; - int i; + int i, ret; struct usb_config_descriptor *cp = NULL; - dr.requesttype = 0; - dr.request = USB_REQ_SET_CONFIGURATION; - dr.value = configuration; - dr.index = 0; - dr.length = 0; - for (i=0; idescriptor.bNumConfigurations; i++) { if (dev->config[i].bConfigurationValue == configuration) { cp = &dev->config[i]; @@ -1040,27 +1032,24 @@ printk(KERN_INFO "usb: selecting invalid configuration %d\n", configuration); return -1; } - if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ)) - return -1; + + if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_SET_CONFIGURATION, 0, configuration, 0, NULL, 0, HZ)) < 0) + return ret; dev->actconfig = cp; dev->toggle[0] = 0; dev->toggle[1] = 0; usb_set_maxpacket(dev); + return 0; } int usb_get_report(struct usb_device *dev, unsigned char type, unsigned char id, unsigned char index, void *buf, int size) { - devrequest dr; - - dr.requesttype = USB_RT_HIDD | USB_DIR_IN; - dr.request = USB_REQ_GET_REPORT; - dr.value = (type << 8) + id; - dr.index = index; - dr.length = size; - - return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), &dr, buf, size, HZ); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_REPORT, USB_DIR_IN | USB_RT_HIDD, + (type << 8) + id, index, buf, size, HZ); } int usb_get_configuration(struct usb_device *dev) @@ -1092,21 +1081,26 @@ /* We grab the first 8 bytes so we know how long the whole */ /* configuration is */ result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, 8); - if (result < 0) - return -1; - + if (result < 0) { + printk(KERN_ERR "usb: unable to get descriptor\n"); + return result; + } + /* Get the full buffer */ le16_to_cpus(&desc->wTotalLength); bigbuffer = kmalloc(desc->wTotalLength, GFP_KERNEL); - if (!bigbuffer) - return -1; + if (!bigbuffer) { + printk(KERN_ERR "unable to allocate memory for configuration descriptors\n"); + return USB_ST_INTERNALERROR; + } /* Now that we know the length, get the whole thing */ result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, bigbuffer, desc->wTotalLength); - if (result) { + if (result < 0) { + printk(KERN_ERR "couldn't get all of config descriptors\n"); kfree(bigbuffer); - return -1; + return result; } result = usb_parse_configuration(dev, &dev->config[cfgno], bigbuffer); @@ -1123,7 +1117,7 @@ char *usb_string(struct usb_device *dev, int index) { - int len, i; + int i, len, ret; char *ptr; union { unsigned char buffer[256]; @@ -1137,23 +1131,28 @@ if (dev->string_langid == 0) { /* read string descriptor 0 */ - if (usb_get_string(dev, 0, 0, u.buffer, 2) == 0 - && u.desc.bLength >= 4 - && usb_get_string(dev, 0, 0, u.buffer, 4) == 0) + ret = usb_get_string(dev, 0, 0, u.buffer, 4); + if (ret >= 0 && u.desc.bLength >= 4) dev->string_langid = le16_to_cpup(&u.desc.wData[0]); + else + printk(KERN_ERR "usb: error getting string!\n"); dev->string_langid |= 0x10000; /* so it's non-zero */ } - if (usb_get_string(dev, dev->string_langid, index, u.buffer, 2) || + if (usb_get_string(dev, dev->string_langid, index, u.buffer, 4) < 0 || usb_get_string(dev, dev->string_langid, index, u.buffer, - u.desc.bLength)) - return 0; + u.desc.bLength) < 0) { + printk(KERN_ERR "usb: error retrieving string\n"); + return NULL; + } len = u.desc.bLength / 2; /* includes terminating null */ ptr = kmalloc(len, GFP_KERNEL); - if (!ptr) - return 0; + if (!ptr) { + printk(KERN_ERR "usb: couldn't allocate memory for string\n"); + return NULL; + } for (i = 0; i < len - 1; ++i) ptr[i] = le16_to_cpup(&u.desc.wData[i]); @@ -1172,8 +1171,7 @@ */ int usb_new_device(struct usb_device *dev) { - int addr; - int err; + int addr, err; printk(KERN_INFO "USB new device connect, assigned device number %d\n", dev->devnum); @@ -1186,11 +1184,9 @@ addr = dev->devnum; dev->devnum = 0; - /* Slow devices */ err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8); - if (err) { - printk(KERN_ERR "usbcore: USB device not responding, giving up (error=%d)\n", - err); + if (err < 0) { + printk(KERN_ERR "usbcore: USB device not responding, giving up (error=%d)\n", err); dev->devnum = -1; return 1; } @@ -1207,9 +1203,8 @@ dev->devnum = addr; err = usb_set_address(dev); - if (err) { - printk(KERN_ERR "usbcore: USB device not accepting new address (error=%d)\n", - err); + if (err < 0) { + printk(KERN_ERR "usbcore: USB device not accepting new address (error=%d)\n", err); dev->devnum = -1; return 1; } @@ -1217,15 +1212,15 @@ wait_ms(10); /* Let the SET_ADDRESS settle */ err = usb_get_device_descriptor(dev); - if (err) { - printk(KERN_ERR "usbcore: unable to get device descriptor (error=%d)\n", - err); + if (err < 0) { + printk(KERN_ERR "usbcore: unable to get device descriptor (error=%d)\n", err); dev->devnum = -1; return 1; } - if (usb_get_configuration(dev)) { - printk(KERN_ERR "usbcore: unable to get configuration\n"); + err = usb_get_configuration(dev); + if (err < 0) { + printk(KERN_ERR "usbcore: unable to get configuration (error=%d)\n", err); dev->devnum = -1; return 1; } @@ -1255,14 +1250,26 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout) { devrequest dr; + int ret; dr.requesttype = requesttype; dr.request = request; - dr.value = value; - dr.index = index; - dr.length = size; + dr.value = cpu_to_le16p(&value); + dr.index = cpu_to_le16p(&index); + dr.length = cpu_to_le16p(&size); + + ret = dev->bus->op->control_msg(dev, pipe, &dr, data, size, timeout); + + if (ret < 0 && usb_debug) { + unsigned char *p = (unsigned char *)&dr; + + printk(KERN_DEBUG "Failed control msg - r:%02X rt:%02X v:%04X i:%04X s:%04X - ret: %d\n", + request, requesttype, value, index, size, ret); + printk(KERN_DEBUG " %02X %02X %02X %02X %02X %02X %02X %02X\n", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + } - return dev->bus->op->control_msg(dev, pipe, &dr, data, size, timeout); + return ret; } int usb_request_irq(struct usb_device *dev, unsigned int pipe, usb_device_irq handler, int period, void *dev_id, void **handle) @@ -1383,7 +1390,7 @@ return err; } -void usb_free_isoc (struct usb_isoc_desc *isocdesc) +void usb_free_isoc(struct usb_isoc_desc *isocdesc) { long bustime; @@ -1402,13 +1409,13 @@ isocdesc->usb_dev->bus->op->free_isoc (isocdesc); } -int usb_run_isoc (struct usb_isoc_desc *isocdesc, +int usb_run_isoc(struct usb_isoc_desc *isocdesc, struct usb_isoc_desc *pr_isocdesc) { return isocdesc->usb_dev->bus->op->run_isoc (isocdesc, pr_isocdesc); } -int usb_kill_isoc (struct usb_isoc_desc *isocdesc) +int usb_kill_isoc(struct usb_isoc_desc *isocdesc) { return isocdesc->usb_dev->bus->op->kill_isoc (isocdesc); } @@ -1417,6 +1424,7 @@ { int minor = MINOR(inode->i_rdev); struct usb_driver *c = usb_minors[minor/16]; + file->f_op = NULL; if (c && (file->f_op = c->fops) && file->f_op->open) @@ -1479,6 +1487,10 @@ EXPORT_SYMBOL(usb_alloc_dev); EXPORT_SYMBOL(usb_free_dev); EXPORT_SYMBOL(usb_inc_dev_use); + +EXPORT_SYMBOL(usb_driver_claim_interface); +EXPORT_SYMBOL(usb_interface_claimed); +EXPORT_SYMBOL(usb_driver_release_interface); EXPORT_SYMBOL(usb_init_root_hub); EXPORT_SYMBOL(usb_new_device); diff -u --recursive --new-file v2.3.25/linux/drivers/usb/usb.h linux/drivers/usb/usb.h --- v2.3.25/linux/drivers/usb/usb.h Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/usb.h Fri Nov 5 15:54:01 1999 @@ -126,15 +126,15 @@ __u16 value; __u16 index; __u16 length; - __u32 timeout; /* in milliseconds */ - void *data; + __u32 timeout; /* in milliseconds */ + void *data; }; struct usb_proc_bulktransfer { - unsigned int ep; - unsigned int len; - unsigned int timeout; /* in milliseconds */ - void *data; + unsigned int ep; + unsigned int len; + unsigned int timeout; /* in milliseconds */ + void *data; }; struct usb_proc_old_ctrltransfer { @@ -143,31 +143,28 @@ __u16 value; __u16 index; __u16 length; - /* pointer to data */ - void *data; + /* pointer to data */ + void *data; }; struct usb_proc_old_bulktransfer { - unsigned int ep; - unsigned int len; - void *data; + unsigned int ep; + unsigned int len; + void *data; }; struct usb_proc_setinterface { - unsigned int interface; - unsigned int altsetting; + unsigned int interface; + unsigned int altsetting; }; -#define USB_PROC_CONTROL _IOWR('U', 0, struct usb_proc_ctrltransfer) -#define USB_PROC_BULK _IOWR('U', 2, struct usb_proc_bulktransfer) -#define USB_PROC_OLD_CONTROL _IOWR('U', 0, struct usb_proc_old_ctrltransfer) -#define USB_PROC_OLD_BULK _IOWR('U', 2, struct usb_proc_old_bulktransfer) -#define USB_PROC_RESETEP _IOR('U', 3, unsigned int) -#define USB_PROC_SETINTERFACE _IOR('U', 4, struct usb_proc_setinterface) -#define USB_PROC_SETCONFIGURATION _IOR('U', 5, unsigned int) - - - +#define USB_PROC_CONTROL _IOWR('U', 0, struct usb_proc_ctrltransfer) +#define USB_PROC_BULK _IOWR('U', 2, struct usb_proc_bulktransfer) +#define USB_PROC_OLD_CONTROL _IOWR('U', 0, struct usb_proc_old_ctrltransfer) +#define USB_PROC_OLD_BULK _IOWR('U', 2, struct usb_proc_old_bulktransfer) +#define USB_PROC_RESETEP _IOR('U', 3, unsigned int) +#define USB_PROC_SETINTERFACE _IOR('U', 4, struct usb_proc_setinterface) +#define USB_PROC_SETCONFIGURATION _IOR('U', 5, unsigned int) #ifdef __KERNEL__ @@ -180,6 +177,7 @@ extern int usb_hub_init(void); extern int usb_kbd_init(void); extern int usb_cpia_init(void); +extern int usb_dc2xx_init(void); extern int usb_mouse_init(void); extern int usb_printer_init(void); @@ -251,7 +249,8 @@ /* Everything but the endpoint maximums are aribtrary */ #define USB_MAXCONFIG 8 -#define USB_MAXALTSETTING 16 +#define USB_ALTSETTINGALLOC 4 +#define USB_MAXALTSETTING 128 /* Hard limit */ #define USB_MAXINTERFACES 32 #define USB_MAXENDPOINTS 32 @@ -289,6 +288,9 @@ __u8 bInterval; __u8 bRefresh; __u8 bSynchAddress; + + unsigned char *extra; /* Extra descriptors */ + int extralen; } __attribute__ ((packed)); /* HID descriptor */ @@ -319,8 +321,10 @@ __u8 bInterfaceProtocol; __u8 iInterface; - struct usb_hid_descriptor *hid; struct usb_endpoint_descriptor *endpoint; + + unsigned char *extra; + int extralen; } __attribute__ ((packed)); struct usb_interface { @@ -328,6 +332,7 @@ int act_altsetting; /* active alternate setting */ int num_altsetting; /* number of alternate settings */ + int max_altsetting; /* total memory allocated */ struct usb_driver *driver; /* driver */ void *private_data; @@ -407,13 +412,13 @@ * with the completed frames (TDs). */ enum { - CB_CONTINUE = 0, /* OK, remove all TDs; + CB_CONTINUE = 0, /* OK, remove all TDs; needs to be 0 to be consistent with current callback function ret. values */ - CB_REUSE, /* leave descriptors as NULL, not active */ - CB_RESTART, /* leave descriptors as they are, alive */ - CB_ABORT, /* kill this USB transfer request */ - CB_CONT_RUN /* append the isoc_desc at the end of all active isoc_desc */ + CB_REUSE, /* leave descriptors as NULL, not active */ + CB_RESTART, /* leave descriptors as they are, alive */ + CB_ABORT, /* kill this USB transfer request */ + CB_CONT_RUN /* append the isoc_desc at the end of all active isoc_desc */ }; struct isoc_frame_desc { @@ -448,6 +453,7 @@ void *data; int buf_size; struct usb_isoc_desc *prev_isocdesc; /* previous isoc_desc, for CB_CONT_RUN */ + /* * The following fields are set by the usb_run_isoc() call. */ @@ -504,7 +510,6 @@ int bandwidth_isoc_reqs; /* number of Isoc. requesters */ /* procfs entry */ - int proc_busnum; struct proc_dir_entry *proc_entry; }; @@ -534,7 +539,7 @@ int string_langid; /* language ID for strings */ void *hcpriv; /* Host Controller private data */ - void *audiopriv; /* May be both audio and HID */ + /* procfs entry */ struct proc_dir_entry *proc_entry; diff -u --recursive --new-file v2.3.25/linux/drivers/usb/usb_scsi.c linux/drivers/usb/usb_scsi.c --- v2.3.25/linux/drivers/usb/usb_scsi.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/usb_scsi.c Fri Nov 5 10:42:15 1999 @@ -1365,7 +1365,9 @@ usb_zip_init(); #endif - usb_register(&scsi_driver); + if (usb_register(&scsi_driver) < 0) + return -1; + printk(KERN_INFO "USB SCSI support registered.\n"); return 0; } diff -u --recursive --new-file v2.3.25/linux/drivers/usb/uss720.c linux/drivers/usb/uss720.c --- v2.3.25/linux/drivers/usb/uss720.c Mon Nov 1 13:56:26 1999 +++ linux/drivers/usb/uss720.c Fri Nov 5 10:42:16 1999 @@ -640,7 +640,9 @@ static int __init uss720_init(void) { - usb_register(&uss720_driver); + if (usb_register(&uss720_driver) < 0) + return -1; + printk(KERN_INFO "uss720: USB<->IEEE1284 cable driver v0.4 registered.\n" KERN_INFO "uss720: (C) 1999 by Thomas Sailer, \n"); return 0; diff -u --recursive --new-file v2.3.25/linux/drivers/video/Config.in linux/drivers/video/Config.in --- v2.3.25/linux/drivers/video/Config.in Fri Oct 22 13:21:51 1999 +++ linux/drivers/video/Config.in Wed Nov 3 14:43:54 1999 @@ -10,6 +10,9 @@ if [ "$CONFIG_FB" = "y" ]; then define_bool CONFIG_DUMMY_CONSOLE y if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + if [ "$CONFIG_PCI" = "y" ]; then + bool ' nVidia Riva support (EXPERIMENTAL)' CONFIG_FB_RIVA + fi if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_PCI" = "y" ]; then tristate ' Cirrus Logic suport (EXPERIMENTAL)' CONFIG_FB_CLGEN tristate ' Permedia2 support (EXPERIMENTAL)' CONFIG_FB_PM2 @@ -162,25 +165,25 @@ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \ "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then - define_bool CONFIG_FBCON_MFB y + define_tristate CONFIG_FBCON_MFB y else if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \ "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then - define_bool CONFIG_FBCON_MFB m + define_tristate CONFIG_FBCON_MFB m fi fi if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ "$CONFIG_FB_VIRTUAL" = "y" ]; then - define_bool CONFIG_FBCON_CFB2 y - define_bool CONFIG_FBCON_CFB4 y + define_tristate CONFIG_FBCON_CFB2 y + define_tristate CONFIG_FBCON_CFB4 y else if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ "$CONFIG_FB_VIRTUAL" = "m" ]; then - define_bool CONFIG_FBCON_CFB2 m - define_bool CONFIG_FBCON_CFB4 m + define_tristate CONFIG_FBCON_CFB2 m + define_tristate CONFIG_FBCON_CFB4 m fi fi if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \ @@ -195,9 +198,10 @@ "$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ "$CONFIG_FB_P9100" = "y" -o \ + "$CONFIG_FB_RIVA" = "y" -o \ "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \ "$CONFIG_FB_3DFX" = "y" ]; then - define_bool CONFIG_FBCON_CFB8 y + define_tristate CONFIG_FBCON_CFB8 y else if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ @@ -212,7 +216,7 @@ "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_P9100" = "m" -o \ "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" ]; then - define_bool CONFIG_FBCON_CFB8 m + define_tristate CONFIG_FBCON_CFB8 m fi fi if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ @@ -224,8 +228,9 @@ "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \ + "$CONFIG_FB_RIVA" = "y" -o \ "$CONFIG_FB_CYBER2000" = "y" -o "$CONFIG_FB_3DFX" = "y" ]; then - define_bool CONFIG_FBCON_CFB16 y + define_tristate CONFIG_FBCON_CFB16 y else if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ @@ -237,20 +242,20 @@ "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "m" -o \ "$CONFIG_FB_CYBER2000" = "m" ]; then - define_bool CONFIG_FBCON_CFB16 m + define_tristate CONFIG_FBCON_CFB16 m fi fi if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ "$CONFIG_FB_CYBER2000" = "y" ]; then - define_bool CONFIG_FBCON_CFB24 y + define_tristate CONFIG_FBCON_CFB24 y else if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_CYBER2000" = "m" ]; then - define_bool CONFIG_FBCON_CFB24 m + define_tristate CONFIG_FBCON_CFB24 m fi fi if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ @@ -258,9 +263,10 @@ "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ + "$CONFIG_FB_RIVA" = "y" -o \ "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \ "$CONFIG_FB_3DFX" = "y" ]; then - define_bool CONFIG_FBCON_CFB32 y + define_tristate CONFIG_FBCON_CFB32 y else if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ @@ -268,50 +274,50 @@ "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_SGIVW" = "m" ]; then - define_bool CONFIG_FBCON_CFB32 m + define_tristate CONFIG_FBCON_CFB32 m fi fi if [ "$CONFIG_FB_AMIGA" = "y" ]; then - define_bool CONFIG_FBCON_AFB y - define_bool CONFIG_FBCON_ILBM y + define_tristate CONFIG_FBCON_AFB y + define_tristate CONFIG_FBCON_ILBM y else if [ "$CONFIG_FB_AMIGA" = "m" ]; then - define_bool CONFIG_FBCON_AFB m - define_bool CONFIG_FBCON_ILBM m + define_tristate CONFIG_FBCON_AFB m + define_tristate CONFIG_FBCON_ILBM m fi fi if [ "$CONFIG_FB_ATARI" = "y" ]; then - define_bool CONFIG_FBCON_IPLAN2P2 y - define_bool CONFIG_FBCON_IPLAN2P4 y - define_bool CONFIG_FBCON_IPLAN2P8 y -# define_bool CONFIG_FBCON_IPLAN2P16 y + define_tristate CONFIG_FBCON_IPLAN2P2 y + define_tristate CONFIG_FBCON_IPLAN2P4 y + define_tristate CONFIG_FBCON_IPLAN2P8 y +# define_tristate CONFIG_FBCON_IPLAN2P16 y else if [ "$CONFIG_FB_ATARI" = "m" ]; then - define_bool CONFIG_FBCON_IPLAN2P2 m - define_bool CONFIG_FBCON_IPLAN2P4 m - define_bool CONFIG_FBCON_IPLAN2P8 m -# define_bool CONFIG_FBCON_IPLAN2P16 m + define_tristate CONFIG_FBCON_IPLAN2P2 m + define_tristate CONFIG_FBCON_IPLAN2P4 m + define_tristate CONFIG_FBCON_IPLAN2P8 m +# define_tristate CONFIG_FBCON_IPLAN2P16 m fi fi if [ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then - define_bool CONFIG_FBCON_MAC y + define_tristate CONFIG_FBCON_MAC y else if [ "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then - define_bool CONFIG_FBCON_MAC m + define_tristate CONFIG_FBCON_MAC m fi fi if [ "$CONFIG_FB_VGA16" = "y" ]; then - define_bool CONFIG_FBCON_VGA_PLANES y + define_tristate CONFIG_FBCON_VGA_PLANES y else if [ "$CONFIG_FB_VGA16" = "m" ]; then - define_bool CONFIG_FBCON_VGA_PLANES m + define_tristate CONFIG_FBCON_VGA_PLANES m fi fi if [ "$CONFIG_FB_MDA" = "y" -o "$CONFIG_FB_VGA" = "y" ]; then - define_bool CONFIG_FBCON_VGA y + define_tristate CONFIG_FBCON_VGA y else if [ "$CONFIG_FB_MDA" = "m" -o "$CONFIG_FB_VGA" = "m" ]; then - define_bool CONFIG_FBCON_VGA m + define_tristate CONFIG_FBCON_VGA m fi fi fi diff -u --recursive --new-file v2.3.25/linux/drivers/video/Makefile linux/drivers/video/Makefile --- v2.3.25/linux/drivers/video/Makefile Fri Oct 22 13:21:51 1999 +++ linux/drivers/video/Makefile Tue Nov 2 08:15:05 1999 @@ -161,6 +161,10 @@ 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 diff -u --recursive --new-file v2.3.25/linux/drivers/video/atyfb.c linux/drivers/video/atyfb.c --- v2.3.25/linux/drivers/video/atyfb.c Fri Oct 22 13:21:51 1999 +++ linux/drivers/video/atyfb.c Tue Nov 2 17:40:11 1999 @@ -3048,21 +3048,26 @@ struct fb_info_aty *fb = (struct fb_info_aty *)info; unsigned int size, page, map_size = 0; unsigned long map_offset = 0; + unsigned long off; int i; if (!fb->mmap_map) return -ENXIO; + if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) + return -EINVAL; + + off = vma->vm_pgoff << PAGE_SHIFT; size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; /* To stop the swapper from even considering these pages. */ vma->vm_flags |= (VM_SHM | VM_LOCKED); - if (((vma->vm_offset == 0) && (size == fb->total_vram)) || - ((vma->vm_offset == fb->total_vram) && (size == PAGE_SIZE))) - vma->vm_offset += 0x8000000000000000UL; + if (((vma->vm_pgoff == 0) && (size == fb->total_vram)) || + ((off == fb->total_vram) && (size == PAGE_SIZE))) + off += 0x8000000000000000UL; + + vma->vm_pgoff = off >> PAGE_SHIFT; /* propagate off changes */ #ifdef __sparc_v9__ /* Align it as much as desirable */ @@ -3070,9 +3075,9 @@ unsigned long j, align; int max = -1; - map_offset = vma->vm_offset+size; + map_offset = off + size; for (i = 0; fb->mmap_map[i].size; i++) { - if (fb->mmap_map[i].voff < vma->vm_offset) + if (fb->mmap_map[i].voff < off) continue; if (fb->mmap_map[i].voff >= map_offset) break; @@ -3092,7 +3097,7 @@ j = align; align = j - ((vma->vm_start + fb->mmap_map[max].voff - - vma->vm_offset) & (j - 1)); + - off) & (j - 1)); if (align != j) { struct vm_area_struct *vmm; @@ -3115,7 +3120,7 @@ for (i = 0; fb->mmap_map[i].size; i++) { unsigned long start = fb->mmap_map[i].voff; unsigned long end = start + fb->mmap_map[i].size; - unsigned long offset = vma->vm_offset + page; + unsigned long offset = off + page; if (start > offset) continue; diff -u --recursive --new-file v2.3.25/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c --- v2.3.25/linux/drivers/video/fbmem.c Mon Nov 1 13:56:27 1999 +++ linux/drivers/video/fbmem.c Fri Nov 5 14:23:25 1999 @@ -102,6 +102,8 @@ extern int q40fb_init(void); extern int sgivwfb_init(void); extern int sgivwfb_setup(char*); +extern int rivafb_init(void); +extern int rivafb_setup(char*); extern int tdfxfb_init(void); extern int tdfxfb_setup(char*); @@ -176,6 +178,9 @@ #ifdef CONFIG_FB_VIRGE { "virge", virgefb_init, virgefb_setup }, #endif +#ifdef CONFIG_FB_RIVA + { "riva", rivafb_init, rivafb_setup }, +#endif #ifdef CONFIG_FB_VESA { "vesa", vesafb_init, vesafb_setup }, #endif @@ -483,9 +488,12 @@ struct fb_ops *fb = info->fbops; struct fb_fix_screeninfo fix; struct fb_var_screeninfo var; - unsigned long start; + unsigned long start, off; u32 len; + if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) + return -EINVAL; + off = vma->vm_pgoff << PAGE_SHIFT; if (!fb) return -ENODEV; if (fb->fb_mmap) @@ -504,10 +512,10 @@ start = fix.smem_start; len = (start & ~PAGE_MASK)+fix.smem_len; start &= PAGE_MASK; - len = (len+~PAGE_MASK) & PAGE_MASK; - if (vma->vm_offset >= len) { + len = (len+~PAGE_MASK) & PAGE_MASK; /* someone's on crack. */ + if (off >= len) { /* memory mapped io */ - vma->vm_offset -= len; + off -= len; fb->fb_get_var(&var, PROC_CONSOLE(info), info); if (var.accel_flags) return -EINVAL; @@ -516,11 +524,10 @@ start &= PAGE_MASK; len = (len+~PAGE_MASK) & PAGE_MASK; } - if ((vma->vm_end - vma->vm_start + vma->vm_offset) > len) + if ((vma->vm_end - vma->vm_start + off) > len) return -EINVAL; - vma->vm_offset += start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; + off += start; + vma->vm_pgoff = off >> PAGE_SHIFT; #if defined(__mc68000__) if (CPU_IS_020_OR_030) pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030; @@ -549,7 +556,7 @@ #else #warning What do we have to do here?? #endif - if (io_remap_page_range(vma->vm_start, vma->vm_offset, + if (io_remap_page_range(vma->vm_start, off, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; return 0; diff -u --recursive --new-file v2.3.25/linux/drivers/video/igafb.c linux/drivers/video/igafb.c --- v2.3.25/linux/drivers/video/igafb.c Thu Aug 26 13:05:40 1999 +++ linux/drivers/video/igafb.c Tue Nov 2 17:40:11 1999 @@ -261,8 +261,6 @@ return -ENXIO; size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; /* To stop the swapper from even considering these pages. */ vma->vm_flags |= (VM_SHM | VM_LOCKED); @@ -271,17 +269,17 @@ for (page = 0; page < size; ) { map_size = 0; for (i = 0; fb->mmap_map[i].size; i++) { - unsigned long start = fb->mmap_map[i].voff; - unsigned long end = start + fb->mmap_map[i].size; - unsigned long offset = vma->vm_offset + page; + unsigned long start = (fb->mmap_map[i].voff) >> PAGE_SHIFT; + unsigned long end = start + (fb->mmap_map[i].size) >> PAGE_SHIFT; + unsigned long offset = vma->vm_pgoff + (page >> PAGE_SHIFT); if (start > offset) continue; if (offset >= end) continue; - map_size = fb->mmap_map[i].size - (offset - start); - map_offset = fb->mmap_map[i].poff + (offset - start); + map_size = fb->mmap_map[i].size - ((offset - start) << PAGE_SHIFT); + map_offset = fb->mmap_map[i].poff + ((offset - start) << PAGE_SHIFT); break; } if (!map_size) { diff -u --recursive --new-file v2.3.25/linux/drivers/video/nv4ref.h linux/drivers/video/nv4ref.h --- v2.3.25/linux/drivers/video/nv4ref.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/nv4ref.h Tue Nov 2 08:15:05 1999 @@ -0,0 +1,2445 @@ + /***************************************************************************\ +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: The source code is copyrighted under U.S. and *| +|* international laws. Users and possessors of this source code are *| +|* hereby granted a nonexclusive, royalty-free copyright license to *| +|* use this code in individual and commercial software. *| +|* *| +|* Any use of this source code must include, in the user documenta- *| +|* tion and internal comments to the code, notices to the end user *| +|* as follows: *| +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *| +|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *| +|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *| +|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *| +|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *| +|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *| +|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *| +|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *| +|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *| +|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial *| +|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial *| +|* computer software documentation," as such terms are used in *| +|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *| +|* ment only as a commercial end item. Consistent with 48 C.F.R. *| +|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the source code with only *| +|* those rights set forth herein. *| +|* *| + \***************************************************************************/ + +/* + * GPL licensing note -- nVidia is allowing a liberal interpretation of + * the documentation restriction above, to merely say that this nVidia's + * copyright and disclaimer should be included with all code derived + * from this source. -- Jeff Garzik , 01/Nov/99 + */ + + /***************************************************************************\ +|* Modified 1999 by Fredrik Reite (fredrik@reite.com) *| + \***************************************************************************/ + + +#ifndef __NV4REF_H__ +#define __NV4REF_H__ + +/* Magic values to lock/unlock extended regs */ +#define NV_CIO_SR_LOCK_INDEX 0x0000001F /* */ +#define NV_CIO_SR_UNLOCK_RW_VALUE 0x00000057 /* */ +#define NV_CIO_SR_UNLOCK_RO_VALUE 0x00000075 /* */ +#define NV_CIO_SR_LOCK_VALUE 0x00000099 /* */ + +#define UNLOCK_EXT_MAGIC 0x57 +#define LOCK_EXT_MAGIC 0x99 /* Any value other than 0x57 will do */ + +#define LOCK_EXT_INDEX 0x6 + +#define NV_PCRTC_HORIZ_TOTAL 0x00 +#define NV_PCRTC_HORIZ_DISPLAY_END 0x01 +#define NV_PCRTC_HORIZ_BLANK_START 0x02 + +#define NV_PCRTC_HORIZ_BLANK_END 0x03 +#define NV_PCRTC_HORIZ_BLANK_END_EVRA 7:7 +#define NV_PCRTC_HORIZ_BLANK_END_DISPLAY_END_SKEW 6:5 +#define NV_PCRTC_HORIZ_BLANK_END_HORIZ_BLANK_END 4:0 + +#define NV_PCRTC_HORIZ_RETRACE_START 0x04 + +#define NV_PCRTC_HORIZ_RETRACE_END 0x05 +#define NV_PCRTC_HORIZ_RETRACE_END_HORIZ_BLANK_END_5 7:7 +#define NV_PCRTC_HORIZ_RETRACE_END_HORIZ_RETRACE_SKEW 6:5 +#define NV_PCRTC_HORIZ_RETRACE_END_HORIZ_RETRACE_END 4:0 + +#define NV_PCRTC_VERT_TOTAL 0x06 + +#define NV_PCRTC_OVERFLOW 0x07 +#define NV_PCRTC_OVERFLOW_VERT_RETRACE_START_9 7:7 +#define NV_PCRTC_OVERFLOW_VERT_DISPLAY_END_9 6:6 +#define NV_PCRTC_OVERFLOW_VERT_TOTAL_9 5:5 +#define NV_PCRTC_OVERFLOW_LINE_COMPARE_8 4:4 +#define NV_PCRTC_OVERFLOW_VERT_BLANK_START_8 3:3 +#define NV_PCRTC_OVERFLOW_VERT_RETRACE_START_8 2:2 +#define NV_PCRTC_OVERFLOW_VERT_DISPLAY_END_8 1:1 +#define NV_PCRTC_OVERFLOW_VERT_TOTAL_8 0:0 + +#define NV_PCRTC_PRESET_ROW_SCAN 0x08 + +#define NV_PCRTC_MAX_SCAN_LINE 0x09 +#define NV_PCRTC_MAX_SCAN_LINE_DOUBLE_SCAN 7:7 +#define NV_PCRTC_MAX_SCAN_LINE_LINE_COMPARE_9 6:6 +#define NV_PCRTC_MAX_SCAN_LINE_VERT_BLANK_START_9 5:5 +#define NV_PCRTC_MAX_SCAN_LINE_MAX_SCAN_LINE 4:0 + +#define NV_PCRTC_CURSOR_START 0x0A +#define NV_PCRTC_CURSOR_END 0x0B +#define NV_PCRTC_START_ADDR_HIGH 0x0C +#define NV_PCRTC_START_ADDR_LOW 0x0D +#define NV_PCRTC_CURSOR_LOCATION_HIGH 0x0E +#define NV_PCRTC_CURSOR_LOCATION_LOW 0x0F + +#define NV_PCRTC_VERT_RETRACE_START 0x10 +#define NV_PCRTC_VERT_RETRACE_END 0x11 +#define NV_PCRTC_VERT_DISPLAY_END 0x12 +#define NV_PCRTC_OFFSET 0x13 +#define NV_PCRTC_UNDERLINE_LOCATION 0x14 +#define NV_PCRTC_VERT_BLANK_START 0x15 +#define NV_PCRTC_VERT_BLANK_END 0x16 +#define NV_PCRTC_MODE_CONTROL 0x17 +#define NV_PCRTC_LINE_COMPARE 0x18 + +/* Extended offset and start address */ +#define NV_PCRTC_REPAINT0 0x19 +#define NV_PCRTC_REPAINT0_OFFSET_10_8 7:5 +#define NV_PCRTC_REPAINT0_START_ADDR_20_16 4:0 + +/* Horizonal extended bits */ +#define NV_PCRTC_HORIZ_EXTRA 0x2d +#define NV_PCRTC_HORIZ_EXTRA_INTER_HALF_START_8 4:4 +#define NV_PCRTC_HORIZ_EXTRA_HORIZ_RETRACE_START_8 3:3 +#define NV_PCRTC_HORIZ_EXTRA_HORIZ_BLANK_START_8 2:2 +#define NV_PCRTC_HORIZ_EXTRA_DISPLAY_END_8 1:1 +#define NV_PCRTC_HORIZ_EXTRA_DISPLAY_TOTAL_8 0:0 + +/* Assorted extra bits */ +#define NV_PCRTC_EXTRA 0x25 +#define NV_PCRTC_EXTRA_OFFSET_11 5:5 +#define NV_PCRTC_EXTRA_HORIZ_BLANK_END_6 4:4 +#define NV_PCRTC_EXTRA_VERT_BLANK_START_10 3:3 +#define NV_PCRTC_EXTRA_VERT_RETRACE_START_10 2:2 +#define NV_PCRTC_EXTRA_VERT_DISPLAY_END_10 1:1 +#define NV_PCRTC_EXTRA_VERT_TOTAL_10 0:0 + +/* Controls how much data the refresh fifo requests */ +#define NV_PCRTC_FIFO_CONTROL 0x1b +#define NV_PCRTC_FIFO_CONTROL_UNDERFLOW_WARN 7:7 +#define NV_PCRTC_FIFO_CONTROL_BURST_LENGTH 2:0 +#define NV_PCRTC_FIFO_CONTROL_BURST_LENGTH_8 0x0 +#define NV_PCRTC_FIFO_CONTROL_BURST_LENGTH_32 0x1 +#define NV_PCRTC_FIFO_CONTROL_BURST_LENGTH_64 0x2 +#define NV_PCRTC_FIFO_CONTROL_BURST_LENGTH_128 0x3 +#define NV_PCRTC_FIFO_CONTROL_BURST_LENGTH_256 0x4 + +/* When the fifo occupancy falls below *twice* the watermark, + * the refresh fifo will start to be refilled. If this value is + * too low, you will get junk on the screen. Too high, and performance + * will suffer. Watermark in units of 8 bytes + */ +#define NV_PCRTC_FIFO 0x20 +#define NV_PCRTC_FIFO_RESET 7:7 +#define NV_PCRTC_FIFO_WATERMARK 5:0 + +/* Various flags */ +#define NV_PCRTC_REPAINT1 0x1a +#define NV_PCRTC_REPAINT1_HSYNC 7:7 +#define NV_PCRTC_REPAINT1_HYSNC_DISABLE 0x01 +#define NV_PCRTC_REPAINT1_HYSNC_ENABLE 0x00 +#define NV_PCRTC_REPAINT1_VSYNC 6:6 +#define NV_PCRTC_REPAINT1_VYSNC_DISABLE 0x01 +#define NV_PCRTC_REPAINT1_VYSNC_ENABLE 0x00 +#define NV_PCRTC_REPAINT1_COMPATIBLE_TEXT 4:4 +#define NV_PCRTC_REPAINT1_COMPATIBLE_TEXT_ENABLE 0x01 +#define NV_PCRTC_REPAINT1_COMPATIBLE_TEXT_DISABLE 0x00 +#define NV_PCRTC_REPAINT1_LARGE_SCREEN 2:2 +#define NV_PCRTC_REPAINT1_LARGE_SCREEN_DISABLE 0x01 +#define NV_PCRTC_REPAINT1_LARGE_SCREEN_ENABLE 0x00 /* >=1280 */ +#define NV_PCRTC_REPAINT1_PALETTE_WIDTH 1:1 +#define NV_PCRTC_REPAINT1_PALETTE_WIDTH_8BITS 0x00 +#define NV_PCRTC_REPAINT1_PALETTE_WIDTH_6BITS 0x01 + +#define NV_PCRTC_GRCURSOR0 0x30 +#define NV_PCRTC_GRCURSOR0_START_ADDR_21_16 5:0 + +#define NV_PCRTC_GRCURSOR1 0x31 +#define NV_PCRTC_GRCURSOR1_START_ADDR_15_11 7:3 +#define NV_PCRTC_GRCURSOR1_SCAN_DBL 1:1 +#define NV_PCRTC_GRCURSOR1_SCAN_DBL_DISABLE 0 +#define NV_PCRTC_GRCURSOR1_SCAN_DBL_ENABLE 1 +#define NV_PCRTC_GRCURSOR1_CURSOR 0:0 +#define NV_PCRTC_GRCURSOR1_CURSOR_DISABLE 0 +#define NV_PCRTC_GRCURSOR1_CURSOR_ENABLE 1 + +/* Controls what the format of the framebuffer is */ +#define NV_PCRTC_PIXEL 0x28 +#define NV_PCRTC_PIXEL_MODE 7:7 +#define NV_PCRTC_PIXEL_MODE_TV 0x01 +#define NV_PCRTC_PIXEL_MODE_VGA 0x00 +#define NV_PCRTC_PIXEL_TV_MODE 6:6 +#define NV_PCRTC_PIXEL_TV_MODE_NTSC 0x00 +#define NV_PCRTC_PIXEL_TV_MODE_PAL 0x01 +#define NV_PCRTC_PIXEL_TV_HORIZ_ADJUST 5:3 +#define NV_PCRTC_PIXEL_FORMAT 1:0 +#define NV_PCRTC_PIXEL_FORMAT_VGA 0x00 +#define NV_PCRTC_PIXEL_FORMAT_8BPP 0x01 +#define NV_PCRTC_PIXEL_FORMAT_16BPP 0x02 +#define NV_PCRTC_PIXEL_FORMAT_32BPP 0x03 + +/* RAMDAC registers and fields */ +#define NV_PRAMDAC 0x00680FFF:0x00680000 /* RW--D */ +#define NV_PRAMDAC_GRCURSOR_START_POS 0x00680300 /* RW-4R */ +#define NV_PRAMDAC_GRCURSOR_START_POS_X 11:0 /* RWXSF */ +#define NV_PRAMDAC_GRCURSOR_START_POS_Y 27:16 /* RWXSF */ +#define NV_PRAMDAC_NVPLL_COEFF 0x00680500 /* RW-4R */ +#define NV_PRAMDAC_NVPLL_COEFF_MDIV 7:0 /* RWIUF */ +#define NV_PRAMDAC_NVPLL_COEFF_NDIV 15:8 /* RWIUF */ +#define NV_PRAMDAC_NVPLL_COEFF_PDIV 18:16 /* RWIVF */ +#define NV_PRAMDAC_MPLL_COEFF 0x00680504 /* RW-4R */ +#define NV_PRAMDAC_MPLL_COEFF_MDIV 7:0 /* RWIUF */ +#define NV_PRAMDAC_MPLL_COEFF_NDIV 15:8 /* RWIUF */ +#define NV_PRAMDAC_MPLL_COEFF_PDIV 18:16 /* RWIVF */ +#define NV_PRAMDAC_VPLL_COEFF 0x00680508 /* RW-4R */ +#define NV_PRAMDAC_VPLL_COEFF_MDIV 7:0 /* RWIUF */ +#define NV_PRAMDAC_VPLL_COEFF_NDIV 15:8 /* RWIUF */ +#define NV_PRAMDAC_VPLL_COEFF_PDIV 18:16 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT 0x0068050C /* RW-4R */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_DLL_BYPASS 4:4 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_DLL_BYPASS_FALSE 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_DLL_BYPASS_TRUE 0x00000001 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_MPLL_SOURCE 8:8 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_MPLL_SOURCE_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_MPLL_SOURCE_PROG 0x00000001 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_MPLL_BYPASS 12:12 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_MPLL_BYPASS_FALSE 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_MPLL_BYPASS_TRUE 0x00000001 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VPLL_SOURCE 16:16 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VPLL_SOURCE_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VPLL_SOURCE_PROG 0x00000001 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VPLL_BYPASS 20:20 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VPLL_BYPASS_FALSE 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VPLL_BYPASS_TRUE 0x00000001 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_PCLK_SOURCE 25:24 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_PCLK_SOURCE_VPLL 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_PCLK_SOURCE_VIP 0x00000001 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_PCLK_SOURCE_XTALOSC 0x00000002 /* RW--V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VCLK_RATIO 28:28 /* RWIVF */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VCLK_RATIO_DB1 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_PLL_COEFF_SELECT_VCLK_RATIO_DB2 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL 0x00680600 /* RW-4R */ +#define NV_PRAMDAC_GENERAL_CONTROL_FF_COEFF 1:0 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_FF_COEFF_DEF 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_IDC_MODE 4:4 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_IDC_MODE_GAMMA 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_IDC_MODE_INDEX 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_VGA_STATE 8:8 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_VGA_STATE_NOTSE 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_VGA_STATE_SEL 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_565_MODE 12:12 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_565_MODE_NOTSEL 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_565_MODE_SEL 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_BLK_PEDSTL 16:16 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_BLK_PEDSTL_OFF 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_BLK_PEDSTL_ON 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_TERMINATION 17:17 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_TERMINATION_37OHM 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_TERMINATION_75OHM 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_BPC 20:20 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_BPC_6BITS 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_BPC_8BITS 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_DAC_SLEEP 24:24 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_DAC_SLEEP_DIS 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_DAC_SLEEP_EN 0x00000001 /* RW--V */ +#define NV_PRAMDAC_GENERAL_CONTROL_PALETTE_CLK 28:28 /* RWIVF */ +#define NV_PRAMDAC_GENERAL_CONTROL_PALETTE_CLK_EN 0x00000000 /* RWI-V */ +#define NV_PRAMDAC_GENERAL_CONTROL_PALETTE_CLK_DIS 0x00000001 /* RW--V */ + +/* Master Control */ +#define NV_PMC 0x00000FFF:0x00000000 /* RW--D */ +#define NV_PMC_BOOT_0 0x00000000 /* R--4R */ +#define NV_PMC_BOOT_0_MINOR_REVISION 3:0 /* C--VF */ +#define NV_PMC_BOOT_0_MINOR_REVISION_0 0x00000000 /* C---V */ +#define NV_PMC_BOOT_0_MAJOR_REVISION 7:4 /* C--VF */ +#define NV_PMC_BOOT_0_MAJOR_REVISION_A 0x00000000 /* C---V */ +#define NV_PMC_BOOT_0_MAJOR_REVISION_B 0x00000001 /* ----V */ +#define NV_PMC_BOOT_0_IMPLEMENTATION 11:8 /* C--VF */ +#define NV_PMC_BOOT_0_IMPLEMENTATION_NV4_0 0x00000000 /* C---V */ +#define NV_PMC_BOOT_0_ARCHITECTURE 15:12 /* C--VF */ +#define NV_PMC_BOOT_0_ARCHITECTURE_NV0 0x00000000 /* ----V */ +#define NV_PMC_BOOT_0_ARCHITECTURE_NV1 0x00000001 /* ----V */ +#define NV_PMC_BOOT_0_ARCHITECTURE_NV2 0x00000002 /* ----V */ +#define NV_PMC_BOOT_0_ARCHITECTURE_NV3 0x00000003 /* ----V */ +#define NV_PMC_BOOT_0_ARCHITECTURE_NV4 0x00000004 /* C---V */ +#define NV_PMC_BOOT_0_FIB_REVISION 19:16 /* C--VF */ +#define NV_PMC_BOOT_0_FIB_REVISION_0 0x00000000 /* C---V */ +#define NV_PMC_BOOT_0_MASK_REVISION 23:20 /* C--VF */ +#define NV_PMC_BOOT_0_MASK_REVISION_A 0x00000000 /* C---V */ +#define NV_PMC_BOOT_0_MASK_REVISION_B 0x00000001 /* ----V */ +#define NV_PMC_BOOT_0_MANUFACTURER 27:24 /* C--UF */ +#define NV_PMC_BOOT_0_MANUFACTURER_NVIDIA 0x00000000 /* C---V */ +#define NV_PMC_BOOT_0_FOUNDRY 31:28 /* C--VF */ +#define NV_PMC_BOOT_0_FOUNDRY_SGS 0x00000000 /* ----V */ +#define NV_PMC_BOOT_0_FOUNDRY_HELIOS 0x00000001 /* ----V */ +#define NV_PMC_BOOT_0_FOUNDRY_TSMC 0x00000002 /* C---V */ +#define NV_PMC_INTR_0 0x00000100 /* RW-4R */ +#define NV_PMC_INTR_0_PMEDIA 4:4 /* R--VF */ +#define NV_PMC_INTR_0_PMEDIA_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PMEDIA_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_PFIFO 8:8 /* R--VF */ +#define NV_PMC_INTR_0_PFIFO_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PFIFO_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_PGRAPH 12:12 /* R--VF */ +#define NV_PMC_INTR_0_PGRAPH_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PGRAPH_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_PVIDEO 16:16 /* R--VF */ +#define NV_PMC_INTR_0_PVIDEO_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PVIDEO_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_PTIMER 20:20 /* R--VF */ +#define NV_PMC_INTR_0_PTIMER_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PTIMER_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_PCRTC 24:24 /* R--VF */ +#define NV_PMC_INTR_0_PCRTC_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PCRTC_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_PBUS 28:28 /* R--VF */ +#define NV_PMC_INTR_0_PBUS_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PMC_INTR_0_PBUS_PENDING 0x00000001 /* R---V */ +#define NV_PMC_INTR_0_SOFTWARE 31:31 /* RWIVF */ +#define NV_PMC_INTR_0_SOFTWARE_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PMC_INTR_0_SOFTWARE_PENDING 0x00000001 /* RW--V */ +#define NV_PMC_INTR_EN_0 0x00000140 /* RW-4R */ +#define NV_PMC_INTR_EN_0_INTA 1:0 /* RWIVF */ +#define NV_PMC_INTR_EN_0_INTA_DISABLED 0x00000000 /* RWI-V */ +#define NV_PMC_INTR_EN_0_INTA_HARDWARE 0x00000001 /* RW--V */ +#define NV_PMC_INTR_EN_0_INTA_SOFTWARE 0x00000002 /* RW--V */ +#define NV_PMC_INTR_READ_0 0x00000160 /* R--4R */ +#define NV_PMC_INTR_READ_0_INTA 0:0 /* R--VF */ +#define NV_PMC_INTR_READ_0_INTA_LOW 0x00000000 /* R---V */ +#define NV_PMC_INTR_READ_0_INTA_HIGH 0x00000001 /* R---V */ +#define NV_PMC_ENABLE 0x00000200 /* RW-4R */ +#define NV_PMC_ENABLE_PMEDIA 4:4 /* RWIVF */ +#define NV_PMC_ENABLE_PMEDIA_DISABLED 0x00000000 /* RWI-V */ +#define NV_PMC_ENABLE_PMEDIA_ENABLED 0x00000001 /* RW--V */ +#define NV_PMC_ENABLE_PFIFO 8:8 /* RWIVF */ +#define NV_PMC_ENABLE_PFIFO_DISABLED 0x00000000 /* RWI-V */ +#define NV_PMC_ENABLE_PFIFO_ENABLED 0x00000001 /* RW--V */ +#define NV_PMC_ENABLE_PGRAPH 12:12 /* RWIVF */ +#define NV_PMC_ENABLE_PGRAPH_DISABLED 0x00000000 /* RWI-V */ +#define NV_PMC_ENABLE_PGRAPH_ENABLED 0x00000001 /* RW--V */ +#define NV_PMC_ENABLE_PPMI 16:16 /* RWIVF */ +#define NV_PMC_ENABLE_PPMI_DISABLED 0x00000000 /* RWI-V */ +#define NV_PMC_ENABLE_PPMI_ENABLED 0x00000001 /* RW--V */ +#define NV_PMC_ENABLE_PFB 20:20 /* RWIVF */ +#define NV_PMC_ENABLE_PFB_DISABLED 0x00000000 /* RW--V */ +#define NV_PMC_ENABLE_PFB_ENABLED 0x00000001 /* RWI-V */ +#define NV_PMC_ENABLE_PCRTC 24:24 /* RWIVF */ +#define NV_PMC_ENABLE_PCRTC_DISABLED 0x00000000 /* RW--V */ +#define NV_PMC_ENABLE_PCRTC_ENABLED 0x00000001 /* RWI-V */ +#define NV_PMC_ENABLE_PVIDEO 28:28 /* RWIVF */ +#define NV_PMC_ENABLE_PVIDEO_DISABLED 0x00000000 /* RWI-V */ +#define NV_PMC_ENABLE_PVIDEO_ENABLED 0x00000001 /* RW--V */ + +/* dev_timer.ref */ +#define NV_PTIMER 0x00009FFF:0x00009000 /* RW--D */ +#define NV_PTIMER_INTR_0 0x00009100 /* RW-4R */ +#define NV_PTIMER_INTR_0_ALARM 0:0 /* RWXVF */ +#define NV_PTIMER_INTR_0_ALARM_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PTIMER_INTR_0_ALARM_PENDING 0x00000001 /* R---V */ +#define NV_PTIMER_INTR_0_ALARM_RESET 0x00000001 /* -W--V */ +#define NV_PTIMER_INTR_EN_0 0x00009140 /* RW-4R */ +#define NV_PTIMER_INTR_EN_0_ALARM 0:0 /* RWIVF */ +#define NV_PTIMER_INTR_EN_0_ALARM_DISABLED 0x00000000 /* RWI-V */ +#define NV_PTIMER_INTR_EN_0_ALARM_ENABLED 0x00000001 /* RW--V */ +#define NV_PTIMER_NUMERATOR 0x00009200 /* RW-4R */ +#define NV_PTIMER_NUMERATOR_VALUE 15:0 /* RWIUF */ +#define NV_PTIMER_NUMERATOR_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PTIMER_DENOMINATOR 0x00009210 /* RW-4R */ +#define NV_PTIMER_DENOMINATOR_VALUE 15:0 /* RWIUF */ +#define NV_PTIMER_DENOMINATOR_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PTIMER_TIME_0 0x00009400 /* RW-4R */ +#define NV_PTIMER_TIME_0_NSEC 31:5 /* RWXUF */ +#define NV_PTIMER_TIME_1 0x00009410 /* RW-4R */ +#define NV_PTIMER_TIME_1_NSEC 28:0 /* RWXUF */ +#define NV_PTIMER_ALARM_0 0x00009420 /* RW-4R */ +#define NV_PTIMER_ALARM_0_NSEC 31:5 /* RWXUF */ + +/* dev_fifo.ref */ +#define NV_PFIFO 0x00003FFF:0x00002000 /* RW--D */ +#define NV_PFIFO_DELAY_0 0x00002040 /* RW-4R */ +#define NV_PFIFO_DELAY_0_WAIT_RETRY 9:0 /* RWIUF */ +#define NV_PFIFO_DELAY_0_WAIT_RETRY_0 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_TIMESLICE 0x00002044 /* RW-4R */ +#define NV_PFIFO_DMA_TIMESLICE_SELECT 16:0 /* RWIUF */ +#define NV_PFIFO_DMA_TIMESLICE_SELECT_1 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_TIMESLICE_SELECT_16K 0x00003fff /* RW--V */ +#define NV_PFIFO_DMA_TIMESLICE_SELECT_32K 0x00007fff /* RW--V */ +#define NV_PFIFO_DMA_TIMESLICE_SELECT_64K 0x0000ffff /* RW--V */ +#define NV_PFIFO_DMA_TIMESLICE_SELECT_128K 0x0001ffff /* RW--V */ +#define NV_PFIFO_DMA_TIMESLICE_TIMEOUT 24:24 /* RWIUF */ +#define NV_PFIFO_DMA_TIMESLICE_TIMEOUT_DISABLED 0x00000000 /* RW--V */ +#define NV_PFIFO_DMA_TIMESLICE_TIMEOUT_ENABLED 0x00000001 /* RWI-V */ +#define NV_PFIFO_PIO_TIMESLICE 0x00002048 /* RW-4R */ +#define NV_PFIFO_PIO_TIMESLICE_SELECT 16:0 /* RWIUF */ +#define NV_PFIFO_PIO_TIMESLICE_SELECT_1 0x00000000 /* RWI-V */ +#define NV_PFIFO_PIO_TIMESLICE_SELECT_16K 0x00003fff /* RW--V */ +#define NV_PFIFO_PIO_TIMESLICE_SELECT_32K 0x00007fff /* RW--V */ +#define NV_PFIFO_PIO_TIMESLICE_SELECT_64K 0x0000ffff /* RW--V */ +#define NV_PFIFO_PIO_TIMESLICE_SELECT_128K 0x0001ffff /* RW--V */ +#define NV_PFIFO_PIO_TIMESLICE_TIMEOUT 24:24 /* RWIUF */ +#define NV_PFIFO_PIO_TIMESLICE_TIMEOUT_DISABLED 0x00000000 /* RW--V */ +#define NV_PFIFO_PIO_TIMESLICE_TIMEOUT_ENABLED 0x00000001 /* RWI-V */ +#define NV_PFIFO_TIMESLICE 0x0000204C /* RW-4R */ +#define NV_PFIFO_TIMESLICE_TIMER 17:0 /* RWIUF */ +#define NV_PFIFO_TIMESLICE_TIMER_EXPIRED 0x0003FFFF /* RWI-V */ +#define NV_PFIFO_NEXT_CHANNEL 0x00002050 /* RW-4R */ +#define NV_PFIFO_NEXT_CHANNEL_CHID 3:0 /* RWXUF */ +#define NV_PFIFO_NEXT_CHANNEL_MODE 8:8 /* RWXVF */ +#define NV_PFIFO_NEXT_CHANNEL_MODE_PIO 0x00000000 /* RW--V */ +#define NV_PFIFO_NEXT_CHANNEL_MODE_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_NEXT_CHANNEL_SWITCH 12:12 /* RWIVF */ +#define NV_PFIFO_NEXT_CHANNEL_SWITCH_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_NEXT_CHANNEL_SWITCH_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DEBUG_0 0x00002080 /* R--4R */ +#define NV_PFIFO_DEBUG_0_CACHE_ERROR0 0:0 /* R-XVF */ +#define NV_PFIFO_DEBUG_0_CACHE_ERROR0_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_DEBUG_0_CACHE_ERROR0_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_DEBUG_0_CACHE_ERROR1 4:4 /* R-XVF */ +#define NV_PFIFO_DEBUG_0_CACHE_ERROR1_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_DEBUG_0_CACHE_ERROR1_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_INTR_0 0x00002100 /* RW-4R */ +#define NV_PFIFO_INTR_0_CACHE_ERROR 0:0 /* RWXVF */ +#define NV_PFIFO_INTR_0_CACHE_ERROR_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_INTR_0_CACHE_ERROR_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_INTR_0_CACHE_ERROR_RESET 0x00000001 /* -W--V */ +#define NV_PFIFO_INTR_0_RUNOUT 4:4 /* RWXVF */ +#define NV_PFIFO_INTR_0_RUNOUT_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_INTR_0_RUNOUT_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_INTR_0_RUNOUT_RESET 0x00000001 /* -W--V */ +#define NV_PFIFO_INTR_0_RUNOUT_OVERFLOW 8:8 /* RWXVF */ +#define NV_PFIFO_INTR_0_RUNOUT_OVERFLOW_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_INTR_0_RUNOUT_OVERFLOW_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_INTR_0_RUNOUT_OVERFLOW_RESET 0x00000001 /* -W--V */ +#define NV_PFIFO_INTR_0_DMA_PUSHER 12:12 /* RWXVF */ +#define NV_PFIFO_INTR_0_DMA_PUSHER_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_INTR_0_DMA_PUSHER_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_INTR_0_DMA_PUSHER_RESET 0x00000001 /* -W--V */ +#define NV_PFIFO_INTR_0_DMA_PT 16:16 /* RWXVF */ +#define NV_PFIFO_INTR_0_DMA_PT_NOT_PENDING 0x00000000 /* R---V */ +#define NV_PFIFO_INTR_0_DMA_PT_PENDING 0x00000001 /* R---V */ +#define NV_PFIFO_INTR_0_DMA_PT_RESET 0x00000001 /* -W--V */ +#define NV_PFIFO_INTR_EN_0 0x00002140 /* RW-4R */ +#define NV_PFIFO_INTR_EN_0_CACHE_ERROR 0:0 /* RWIVF */ +#define NV_PFIFO_INTR_EN_0_CACHE_ERROR_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_INTR_EN_0_CACHE_ERROR_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_INTR_EN_0_RUNOUT 4:4 /* RWIVF */ +#define NV_PFIFO_INTR_EN_0_RUNOUT_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_INTR_EN_0_RUNOUT_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_INTR_EN_0_RUNOUT_OVERFLOW 8:8 /* RWIVF */ +#define NV_PFIFO_INTR_EN_0_RUNOUT_OVERFLOW_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_INTR_EN_0_RUNOUT_OVERFLOW_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_INTR_EN_0_DMA_PUSHER 12:12 /* RWIVF */ +#define NV_PFIFO_INTR_EN_0_DMA_PUSHER_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_INTR_EN_0_DMA_PUSHER_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_INTR_EN_0_DMA_PT 16:16 /* RWIVF */ +#define NV_PFIFO_INTR_EN_0_DMA_PT_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_INTR_EN_0_DMA_PT_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_RAMHT 0x00002210 /* RW-4R */ +#define NV_PFIFO_RAMHT_BASE_ADDRESS 8:4 /* RWIUF */ +#define NV_PFIFO_RAMHT_BASE_ADDRESS_10000 0x00000010 /* RWI-V */ +#define NV_PFIFO_RAMHT_SIZE 17:16 /* RWIUF */ +#define NV_PFIFO_RAMHT_SIZE_4K 0x00000000 /* RWI-V */ +#define NV_PFIFO_RAMHT_SIZE_8K 0x00000001 /* RW--V */ +#define NV_PFIFO_RAMHT_SIZE_16K 0x00000002 /* RW--V */ +#define NV_PFIFO_RAMHT_SIZE_32K 0x00000003 /* RW--V */ +#define NV_PFIFO_RAMHT_SEARCH 25:24 /* RWIUF */ +#define NV_PFIFO_RAMHT_SEARCH_16 0x00000000 /* RWI-V */ +#define NV_PFIFO_RAMHT_SEARCH_32 0x00000001 /* RW--V */ +#define NV_PFIFO_RAMHT_SEARCH_64 0x00000002 /* RW--V */ +#define NV_PFIFO_RAMHT_SEARCH_128 0x00000003 /* RW--V */ +#define NV_PFIFO_RAMFC 0x00002214 /* RW-4R */ +#define NV_PFIFO_RAMFC_BASE_ADDRESS 8:1 /* RWIUF */ +#define NV_PFIFO_RAMFC_BASE_ADDRESS_11000 0x00000088 /* RWI-V */ +#define NV_PFIFO_RAMRO 0x00002218 /* RW-4R */ +#define NV_PFIFO_RAMRO_BASE_ADDRESS 8:1 /* RWIUF */ +#define NV_PFIFO_RAMRO_BASE_ADDRESS_11200 0x00000089 /* RWI-V */ +#define NV_PFIFO_RAMRO_BASE_ADDRESS_12000 0x00000090 /* RW--V */ +#define NV_PFIFO_RAMRO_SIZE 16:16 /* RWIVF */ +#define NV_PFIFO_RAMRO_SIZE_512 0x00000000 /* RWI-V */ +#define NV_PFIFO_RAMRO_SIZE_8K 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHES 0x00002500 /* RW-4R */ +#define NV_PFIFO_CACHES_REASSIGN 0:0 /* RWIVF */ +#define NV_PFIFO_CACHES_REASSIGN_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHES_REASSIGN_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHES_DMA_SUSPEND 4:4 /* R--VF */ +#define NV_PFIFO_CACHES_DMA_SUSPEND_IDLE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHES_DMA_SUSPEND_BUSY 0x00000001 /* R---V */ +#define NV_PFIFO_MODE 0x00002504 /* RW-4R */ +#define NV_PFIFO_MODE_CHANNEL_0 0:0 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_0_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_0_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_1 1:1 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_1_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_1_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_2 2:2 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_2_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_2_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_3 3:3 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_3_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_3_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_4 4:4 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_4_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_4_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_5 5:5 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_5_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_5_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_6 6:6 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_6_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_6_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_7 7:7 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_7_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_7_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_8 8:8 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_8_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_8_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_9 9:9 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_9_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_9_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_10 10:10 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_10_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_10_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_11 11:11 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_11_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_11_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_12 12:12 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_12_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_12_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_13 13:13 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_13_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_13_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_14 14:14 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_14_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_14_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_MODE_CHANNEL_15 15:15 /* RWIVF */ +#define NV_PFIFO_MODE_CHANNEL_15_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_MODE_CHANNEL_15_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA 0x00002508 /* RW-4R */ +#define NV_PFIFO_DMA_CHANNEL_0 0:0 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_0_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_0_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_1 1:1 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_1_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_1_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_2 2:2 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_2_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_2_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_3 3:3 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_3_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_3_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_4 4:4 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_4_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_4_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_5 5:5 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_5_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_5_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_6 6:6 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_6_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_6_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_7 7:7 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_7_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_7_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_8 8:8 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_8_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_8_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_9 9:9 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_9_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_9_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_10 10:10 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_10_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_10_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_11 11:11 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_11_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_11_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_12 12:12 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_12_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_12_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_13 13:13 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_13_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_13_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_14 14:14 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_14_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_14_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_DMA_CHANNEL_15 15:15 /* RWIVF */ +#define NV_PFIFO_DMA_CHANNEL_15_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PFIFO_DMA_CHANNEL_15_PENDING 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE 0x0000250C /* RW-4R */ +#define NV_PFIFO_SIZE_CHANNEL_0 0:0 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_0_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_0_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_1 1:1 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_1_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_1_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_2 2:2 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_2_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_2_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_3 3:3 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_3_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_3_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_4 4:4 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_4_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_4_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_5 5:5 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_5_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_5_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_6 6:6 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_6_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_6_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_7 7:7 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_7_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_7_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_8 8:8 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_8_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_8_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_9 9:9 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_9_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_9_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_10 10:10 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_10_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_10_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_11 11:11 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_11_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_11_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_12 12:12 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_12_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_12_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_13 13:13 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_13_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_13_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_14 14:14 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_14_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_14_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_SIZE_CHANNEL_15 15:15 /* RWIVF */ +#define NV_PFIFO_SIZE_CHANNEL_15_124_BYTES 0x00000000 /* RWI-V */ +#define NV_PFIFO_SIZE_CHANNEL_15_512_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_PUSH0 0x00003000 /* RW-4R */ +#define NV_PFIFO_CACHE0_PUSH0_ACCESS 0:0 /* RWIVF */ +#define NV_PFIFO_CACHE0_PUSH0_ACCESS_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE0_PUSH0_ACCESS_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_PUSH0 0x00003200 /* RW-4R */ +#define NV_PFIFO_CACHE1_PUSH0_ACCESS 0:0 /* RWIVF */ +#define NV_PFIFO_CACHE1_PUSH0_ACCESS_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_PUSH0_ACCESS_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_PUSH1 0x00003004 /* RW-4R */ +#define NV_PFIFO_CACHE0_PUSH1_CHID 3:0 /* RWXUF */ +#define NV_PFIFO_CACHE1_PUSH1 0x00003204 /* RW-4R */ +#define NV_PFIFO_CACHE1_PUSH1_CHID 3:0 /* RWXUF */ +#define NV_PFIFO_CACHE1_PUSH1_MODE 8:8 /* RWIVF */ +#define NV_PFIFO_CACHE1_PUSH1_MODE_PIO 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_PUSH1_MODE_DMA 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_PUSH 0x00003220 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_PUSH_ACCESS 0:0 /* RWIVF */ +#define NV_PFIFO_CACHE1_DMA_PUSH_ACCESS_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_ACCESS_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_STATE 4:4 /* R--VF */ +#define NV_PFIFO_CACHE1_DMA_PUSH_STATE_IDLE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_STATE_BUSY 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_BUFFER 8:8 /* R--VF */ +#define NV_PFIFO_CACHE1_DMA_PUSH_BUFFER_NOT_EMPTY 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_BUFFER_EMPTY 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_STATUS 12:12 /* RWIVF */ +#define NV_PFIFO_CACHE1_DMA_PUSH_STATUS_RUNNING 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_PUSH_STATUS_SUSPENDED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH 0x00003224 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG 7:3 /* RWIUF */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_8_BYTES 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_16_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_24_BYTES 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_32_BYTES 0x00000003 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_40_BYTES 0x00000004 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_48_BYTES 0x00000005 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_56_BYTES 0x00000006 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_64_BYTES 0x00000007 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_72_BYTES 0x00000008 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_80_BYTES 0x00000009 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_88_BYTES 0x0000000A /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_96_BYTES 0x0000000B /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_104_BYTES 0x0000000C /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_112_BYTES 0x0000000D /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_120_BYTES 0x0000000E /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES 0x0000000F /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_136_BYTES 0x00000010 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_144_BYTES 0x00000011 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_152_BYTES 0x00000012 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_160_BYTES 0x00000013 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_168_BYTES 0x00000014 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_176_BYTES 0x00000015 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_184_BYTES 0x00000016 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_192_BYTES 0x00000017 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_200_BYTES 0x00000018 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_208_BYTES 0x00000019 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_216_BYTES 0x0000001A /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_224_BYTES 0x0000001B /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_232_BYTES 0x0000001C /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_240_BYTES 0x0000001D /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_248_BYTES 0x0000001E /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_TRIG_256_BYTES 0x0000001F /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE 15:13 /* RWIUF */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_32_BYTES 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_64_BYTES 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_96_BYTES 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES 0x00000003 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_160_BYTES 0x00000004 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_192_BYTES 0x00000005 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_224_BYTES 0x00000006 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_SIZE_256_BYTES 0x00000007 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS 19:16 /* RWIUF */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_0 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_1 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_2 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_3 0x00000003 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_4 0x00000004 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_5 0x00000005 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_6 0x00000006 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_7 0x00000007 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8 0x00000008 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_9 0x00000009 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_10 0x0000000A /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_11 0x0000000B /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_12 0x0000000C /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_13 0x0000000D /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_14 0x0000000E /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_15 0x0000000F /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_PUT 0x00003240 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_PUT_OFFSET 28:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_GET 0x00003244 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_GET_OFFSET 28:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_STATE 0x00003228 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_STATE_METHOD 12:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_STATE_SUBCHANNEL 15:13 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_STATE_METHOD_COUNT 28:18 /* RWIUF */ +#define NV_PFIFO_CACHE1_DMA_STATE_METHOD_COUNT_0 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_STATE_ERROR 31:30 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_STATE_ERROR_NONE 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_STATE_ERROR_NON_CACHE 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_STATE_ERROR_RESERVED_CMD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_STATE_ERROR_PROTECTION 0x00000003 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_INSTANCE 0x0000322C /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_INSTANCE_ADDRESS 15:0 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_CTL 0x00003230 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_CTL_ADJUST 11:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_CTL_PAGE_TABLE 12:12 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_CTL_PAGE_TABLE_NOT_PRESENT 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_PAGE_TABLE_PRESENT 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_PAGE_ENTRY 13:13 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_CTL_PAGE_ENTRY_NOT_LINEAR 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_PAGE_ENTRY_LINEAR 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_TARGET_NODE 17:16 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_CTL_TARGET_NODE_PCI 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_TARGET_NODE_AGP 0x00000003 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_AT_INFO 31:31 /* RWIUF */ +#define NV_PFIFO_CACHE1_DMA_CTL_AT_INFO_INVALID 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_CTL_AT_INFO_VALID 0x00000001 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_LIMIT 0x00003234 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_LIMIT_OFFSET 28:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_TLB_TAG 0x00003238 /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_TLB_TAG_ADDRESS 28:12 /* RWXUF */ +#define NV_PFIFO_CACHE1_DMA_TLB_TAG_STATE 0:0 /* RWIUF */ +#define NV_PFIFO_CACHE1_DMA_TLB_TAG_STATE_INVALID 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_DMA_TLB_TAG_STATE_VALID 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_DMA_TLB_PTE 0x0000323C /* RW-4R */ +#define NV_PFIFO_CACHE1_DMA_TLB_PTE_FRAME_ADDRESS 31:12 /* RWXUF */ +#define NV_PFIFO_CACHE0_PULL0 0x00003050 /* RW-4R */ +#define NV_PFIFO_CACHE0_PULL0_ACCESS 0:0 /* RWIVF */ +#define NV_PFIFO_CACHE0_PULL0_ACCESS_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE0_PULL0_ACCESS_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_PULL0_HASH 4:4 /* R-XVF */ +#define NV_PFIFO_CACHE0_PULL0_HASH_SUCCEEDED 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE0_PULL0_HASH_FAILED 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE0_PULL0_DEVICE 8:8 /* R-XVF */ +#define NV_PFIFO_CACHE0_PULL0_DEVICE_HARDWARE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE0_PULL0_DEVICE_SOFTWARE 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE0_PULL0_HASH_STATE 12:12 /* R-XVF */ +#define NV_PFIFO_CACHE0_PULL0_HASH_STATE_IDLE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE0_PULL0_HASH_STATE_BUSY 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_PULL0 0x00003250 /* RW-4R */ +#define NV_PFIFO_CACHE1_PULL0_ACCESS 0:0 /* RWIVF */ +#define NV_PFIFO_CACHE1_PULL0_ACCESS_DISABLED 0x00000000 /* RWI-V */ +#define NV_PFIFO_CACHE1_PULL0_ACCESS_ENABLED 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_PULL0_HASH 4:4 /* R-XVF */ +#define NV_PFIFO_CACHE1_PULL0_HASH_SUCCEEDED 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_PULL0_HASH_FAILED 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_PULL0_DEVICE 8:8 /* R-XVF */ +#define NV_PFIFO_CACHE1_PULL0_DEVICE_HARDWARE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_PULL0_DEVICE_SOFTWARE 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_PULL0_HASH_STATE 12:12 /* R-XVF */ +#define NV_PFIFO_CACHE1_PULL0_HASH_STATE_IDLE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_PULL0_HASH_STATE_BUSY 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE0_PULL1 0x00003054 /* RW-4R */ +#define NV_PFIFO_CACHE0_PULL1_ENGINE 1:0 /* RWXUF */ +#define NV_PFIFO_CACHE0_PULL1_ENGINE_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_PULL1_ENGINE_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_PULL1_ENGINE_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_PULL1 0x00003254 /* RW-4R */ +#define NV_PFIFO_CACHE1_PULL1_ENGINE 1:0 /* RWXUF */ +#define NV_PFIFO_CACHE1_PULL1_ENGINE_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_PULL1_ENGINE_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_PULL1_ENGINE_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_HASH 0x00003058 /* RW-4R */ +#define NV_PFIFO_CACHE0_HASH_INSTANCE 15:0 /* RWXUF */ +#define NV_PFIFO_CACHE0_HASH_VALID 16:16 /* RWXVF */ +#define NV_PFIFO_CACHE1_HASH 0x00003258 /* RW-4R */ +#define NV_PFIFO_CACHE1_HASH_INSTANCE 15:0 /* RWXUF */ +#define NV_PFIFO_CACHE1_HASH_VALID 16:16 /* RWXVF */ +#define NV_PFIFO_CACHE0_STATUS 0x00003014 /* R--4R */ +#define NV_PFIFO_CACHE0_STATUS_LOW_MARK 4:4 /* R--VF */ +#define NV_PFIFO_CACHE0_STATUS_LOW_MARK_NOT_EMPTY 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE0_STATUS_LOW_MARK_EMPTY 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE0_STATUS_HIGH_MARK 8:8 /* R--VF */ +#define NV_PFIFO_CACHE0_STATUS_HIGH_MARK_NOT_FULL 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE0_STATUS_HIGH_MARK_FULL 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_STATUS 0x00003214 /* R--4R */ +#define NV_PFIFO_CACHE1_STATUS_LOW_MARK 4:4 /* R--VF */ +#define NV_PFIFO_CACHE1_STATUS_LOW_MARK_NOT_EMPTY 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_STATUS_LOW_MARK_EMPTY 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_STATUS_HIGH_MARK 8:8 /* R--VF */ +#define NV_PFIFO_CACHE1_STATUS_HIGH_MARK_NOT_FULL 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_STATUS_HIGH_MARK_FULL 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE1_STATUS1 0x00003218 /* R--4R */ +#define NV_PFIFO_CACHE1_STATUS1_RANOUT 0:0 /* R-XVF */ +#define NV_PFIFO_CACHE1_STATUS1_RANOUT_FALSE 0x00000000 /* R---V */ +#define NV_PFIFO_CACHE1_STATUS1_RANOUT_TRUE 0x00000001 /* R---V */ +#define NV_PFIFO_CACHE0_PUT 0x00003010 /* RW-4R */ +#define NV_PFIFO_CACHE0_PUT_ADDRESS 2:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_PUT 0x00003210 /* RW-4R */ +#define NV_PFIFO_CACHE1_PUT_ADDRESS 9:2 /* RWXUF */ +#define NV_PFIFO_CACHE0_GET 0x00003070 /* RW-4R */ +#define NV_PFIFO_CACHE0_GET_ADDRESS 2:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_GET 0x00003270 /* RW-4R */ +#define NV_PFIFO_CACHE1_GET_ADDRESS 9:2 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE 0x00003080 /* RW-4R */ +#define NV_PFIFO_CACHE0_ENGINE_0 1:0 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_0_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_0_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_0_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_1 5:4 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_1_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_1_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_1_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_2 9:8 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_2_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_2_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_2_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_3 13:12 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_3_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_3_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_3_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_4 17:16 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_4_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_4_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_4_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_5 21:20 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_5_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_5_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_5_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_6 25:24 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_6_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_6_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_6_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_7 29:28 /* RWXUF */ +#define NV_PFIFO_CACHE0_ENGINE_7_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_7_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE0_ENGINE_7_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE 0x00003280 /* RW-4R */ +#define NV_PFIFO_CACHE1_ENGINE_0 1:0 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_0_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_0_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_0_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_1 5:4 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_1_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_1_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_1_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_2 9:8 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_2_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_2_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_2_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_3 13:12 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_3_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_3_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_3_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_4 17:16 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_4_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_4_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_4_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_5 21:20 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_5_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_5_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_5_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_6 25:24 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_6_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_6_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_6_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_7 29:28 /* RWXUF */ +#define NV_PFIFO_CACHE1_ENGINE_7_SW 0x00000000 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_7_GRAPHICS 0x00000001 /* RW--V */ +#define NV_PFIFO_CACHE1_ENGINE_7_DVD 0x00000002 /* RW--V */ +#define NV_PFIFO_CACHE0_METHOD(i) (0x00003100+(i)*8) /* RW-4A */ +#define NV_PFIFO_CACHE0_METHOD__SIZE_1 1 /* */ +#define NV_PFIFO_CACHE0_METHOD_ADDRESS 12:2 /* RWXUF */ +#define NV_PFIFO_CACHE0_METHOD_SUBCHANNEL 15:13 /* RWXUF */ +#define NV_PFIFO_CACHE1_METHOD(i) (0x00003800+(i)*8) /* RW-4A */ +#define NV_PFIFO_CACHE1_METHOD__SIZE_1 128 /* */ +#define NV_PFIFO_CACHE1_METHOD_ADDRESS 12:2 /* RWXUF */ +#define NV_PFIFO_CACHE1_METHOD_SUBCHANNEL 15:13 /* RWXUF */ +#define NV_PFIFO_CACHE1_METHOD_ALIAS(i) (0x00003C00+(i)*8) /* RW-4A */ +#define NV_PFIFO_CACHE1_METHOD_ALIAS__SIZE_1 128 /* */ +#define NV_PFIFO_CACHE0_DATA(i) (0x00003104+(i)*8) /* RW-4A */ +#define NV_PFIFO_CACHE0_DATA__SIZE_1 1 /* */ +#define NV_PFIFO_CACHE0_DATA_VALUE 31:0 /* RWXVF */ +#define NV_PFIFO_CACHE1_DATA(i) (0x00003804+(i)*8) /* RW-4A */ +#define NV_PFIFO_CACHE1_DATA__SIZE_1 128 /* */ +#define NV_PFIFO_CACHE1_DATA_VALUE 31:0 /* RWXVF */ +#define NV_PFIFO_CACHE1_DATA_ALIAS(i) (0x00003C04+(i)*8) /* RW-4A */ +#define NV_PFIFO_CACHE1_DATA_ALIAS__SIZE_1 128 /* */ +#define NV_PFIFO_DEVICE(i) (0x00002800+(i)*4) /* R--4A */ +#define NV_PFIFO_DEVICE__SIZE_1 128 /* */ +#define NV_PFIFO_DEVICE_CHID 3:0 /* R--UF */ +#define NV_PFIFO_DEVICE_SWITCH 24:24 /* R--VF */ +#define NV_PFIFO_DEVICE_SWITCH_UNAVAILABLE 0x00000000 /* R---V */ +#define NV_PFIFO_DEVICE_SWITCH_AVAILABLE 0x00000001 /* R---V */ +#define NV_PFIFO_RUNOUT_STATUS 0x00002400 /* R--4R */ +#define NV_PFIFO_RUNOUT_STATUS_RANOUT 0:0 /* R--VF */ +#define NV_PFIFO_RUNOUT_STATUS_RANOUT_FALSE 0x00000000 /* R---V */ +#define NV_PFIFO_RUNOUT_STATUS_RANOUT_TRUE 0x00000001 /* R---V */ +#define NV_PFIFO_RUNOUT_STATUS_LOW_MARK 4:4 /* R--VF */ +#define NV_PFIFO_RUNOUT_STATUS_LOW_MARK_NOT_EMPTY 0x00000000 /* R---V */ +#define NV_PFIFO_RUNOUT_STATUS_LOW_MARK_EMPTY 0x00000001 /* R---V */ +#define NV_PFIFO_RUNOUT_STATUS_HIGH_MARK 8:8 /* R--VF */ +#define NV_PFIFO_RUNOUT_STATUS_HIGH_MARK_NOT_FULL 0x00000000 /* R---V */ +#define NV_PFIFO_RUNOUT_STATUS_HIGH_MARK_FULL 0x00000001 /* R---V */ +#define NV_PFIFO_RUNOUT_PUT 0x00002410 /* RW-4R */ +#define NV_PFIFO_RUNOUT_PUT_ADDRESS 12:3 /* RWXUF */ +#define NV_PFIFO_RUNOUT_PUT_ADDRESS__SIZE_0 8:3 /* RWXUF */ +#define NV_PFIFO_RUNOUT_PUT_ADDRESS__SIZE_1 12:3 /* RWXUF */ +#define NV_PFIFO_RUNOUT_GET 0x00002420 /* RW-4R */ +#define NV_PFIFO_RUNOUT_GET_ADDRESS 13:3 /* RWXUF */ +/* dev_graphics.ref */ +#define NV_PGRAPH 0x00401FFF:0x00400000 /* RW--D */ +#define NV_PGRAPH_DEBUG_0 0x00400080 /* RW-4R */ +#define NV_PGRAPH_DEBUG_1 0x00400084 /* RW-4R */ +#define NV_PGRAPH_DEBUG_2 0x00400088 /* RW-4R */ +#define NV_PGRAPH_DEBUG_3 0x0040008C /* RW-4R */ +#define NV_PGRAPH_INTR 0x00400100 /* RW-4R */ +#define NV_PGRAPH_INTR_NOTIFY 0:0 /* RWIVF */ +#define NV_PGRAPH_INTR_NOTIFY_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_INTR_NOTIFY_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_NOTIFY_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_INTR_MISSING_HW 4:4 /* RWIVF */ +#define NV_PGRAPH_INTR_MISSING_HW_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_INTR_MISSING_HW_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_MISSING_HW_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_INTR_TLB_PRESENT_A 8:8 /* RWIVF */ +#define NV_PGRAPH_INTR_TLB_PRESENT_A_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_INTR_TLB_PRESENT_A_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_TLB_PRESENT_A_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_INTR_TLB_PRESENT_B 9:9 /* RWIVF */ +#define NV_PGRAPH_INTR_TLB_PRESENT_B_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_INTR_TLB_PRESENT_B_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_TLB_PRESENT_B_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_INTR_CONTEXT_SWITCH 12:12 /* RWIVF */ +#define NV_PGRAPH_INTR_CONTEXT_SWITCH_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_INTR_CONTEXT_SWITCH_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_CONTEXT_SWITCH_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_INTR_BUFFER_NOTIFY 16:16 /* RWIVF */ +#define NV_PGRAPH_INTR_BUFFER_NOTIFY_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_INTR_BUFFER_NOTIFY_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_BUFFER_NOTIFY_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_NSTATUS 0x00400104 /* RW-4R */ +#define NV_PGRAPH_NSTATUS_STATE_IN_USE 11:11 /* RWIVF */ +#define NV_PGRAPH_NSTATUS_STATE_IN_USE_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NSTATUS_STATE_IN_USE_PENDING 0x00000001 /* RW--V */ +#define NV_PGRAPH_NSTATUS_INVALID_STATE 12:12 /* RWIVF */ +#define NV_PGRAPH_NSTATUS_INVALID_STATE_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NSTATUS_INVALID_STATE_PENDING 0x00000001 /* RW--V */ +#define NV_PGRAPH_NSTATUS_BAD_ARGUMENT 13:13 /* RWIVF */ +#define NV_PGRAPH_NSTATUS_BAD_ARGUMENT_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NSTATUS_BAD_ARGUMENT_PENDING 0x00000001 /* RW--V */ +#define NV_PGRAPH_NSTATUS_PROTECTION_FAULT 14:14 /* RWIVF */ +#define NV_PGRAPH_NSTATUS_PROTECTION_FAULT_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NSTATUS_PROTECTION_FAULT_PENDING 0x00000001 /* RW--V */ +#define NV_PGRAPH_NSOURCE 0x00400108 /* R--4R */ +#define NV_PGRAPH_NSOURCE_NOTIFICATION 0:0 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_NOTIFICATION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_NOTIFICATION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_DATA_ERROR 1:1 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_DATA_ERROR_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_DATA_ERROR_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_PROTECTION_ERROR 2:2 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_PROTECTION_ERROR_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_PROTECTION_ERROR_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_RANGE_EXCEPTION 3:3 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_RANGE_EXCEPTION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_RANGE_EXCEPTION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_LIMIT_COLOR 4:4 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_LIMIT_COLOR_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_LIMIT_COLOR_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_LIMIT_ZETA_ 5:5 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_LIMIT_ZETA_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_LIMIT_ZETA_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_ILLEGAL_MTHD 6:6 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_ILLEGAL_MTHD_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_ILLEGAL_MTHD_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_DMA_R_PROTECTION 7:7 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_DMA_R_PROTECTION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_DMA_R_PROTECTION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_DMA_W_PROTECTION 8:8 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_DMA_W_PROTECTION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_DMA_W_PROTECTION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_FORMAT_EXCEPTION 9:9 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_FORMAT_EXCEPTION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_FORMAT_EXCEPTION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_PATCH_EXCEPTION 10:10 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_PATCH_EXCEPTION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_PATCH_EXCEPTION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_STATE_INVALID 11:11 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_STATE_INVALID_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_STATE_INVALID_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_DOUBLE_NOTIFY 12:12 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_DOUBLE_NOTIFY_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_DOUBLE_NOTIFY_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_NOTIFY_IN_USE 13:13 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_NOTIFY_IN_USE_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_NOTIFY_IN_USE_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_METHOD_CNT 14:14 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_METHOD_CNT_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_METHOD_CNT_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_NSOURCE_BFR_NOTIFICATION 15:15 /* R-IVF */ +#define NV_PGRAPH_NSOURCE_BFR_NOTIFICATION_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_NSOURCE_BFR_NOTIFICATION_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_INTR_EN 0x00400140 /* RW-4R */ +#define NV_PGRAPH_INTR_EN_NOTIFY 0:0 /* RWIVF */ +#define NV_PGRAPH_INTR_EN_NOTIFY_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_INTR_EN_NOTIFY_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_INTR_EN_MISSING_HW 4:4 /* RWIVF */ +#define NV_PGRAPH_INTR_EN_MISSING_HW_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_INTR_EN_MISSING_HW_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_INTR_EN_TLB_PRESENT_A 8:8 /* RWIVF */ +#define NV_PGRAPH_INTR_EN_TLB_PRESENT_A_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_INTR_EN_TLB_PRESENT_A_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_INTR_EN_TLB_PRESENT_B 9:9 /* RWIVF */ +#define NV_PGRAPH_INTR_EN_TLB_PRESENT_B_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_INTR_EN_TLB_PRESENT_B_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_INTR_EN_CONTEXT_SWITCH 12:12 /* RWIVF */ +#define NV_PGRAPH_INTR_EN_CONTEXT_SWITCH_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_INTR_EN_CONTEXT_SWITCH_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_INTR_EN_BUFFER_NOTIFY 16:16 /* RWIVF */ +#define NV_PGRAPH_INTR_EN_BUFFER_NOTIFY_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_INTR_EN_BUFFER_NOTIFY_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1 0x00400160 /* RW-4R */ +#define NV_PGRAPH_CTX_SWITCH1_GRCLASS 7:0 /* RWXVF */ +#define NV_PGRAPH_CTX_SWITCH1_CHROMA_KEY 12:12 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH1_CHROMA_KEY_DISABLE 0x00000000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_CHROMA_KEY_ENABLE 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_USER_CLIP 13:13 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH1_USER_CLIP_DISABLE 0x00000000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_USER_CLIP_ENABLE 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_SWIZZLE 14:14 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH1_SWIZZLE_DISABLE 0x00000000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_SWIZZLE_ENABLE 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG 17:15 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG_SRCCOPY_AND 0x00000000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG_ROP_AND 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG_BLEND_AND 0x00000002 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG_SRCCOPY 0x00000003 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG_SRCCOPY_PRE 0x00000004 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG_BLEND_PRE 0x00000005 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_STATUS 24:24 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_STATUS_INVALID 0x00000000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_PATCH_STATUS_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_CONTEXT_SURFACE 25:25 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH1_CONTEXT_SURFACE_INVALID 0x00000000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_CONTEXT_SURFACE_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH1_VOLATILE_RESET 31:31 /* CWIVF */ +#define NV_PGRAPH_CTX_SWITCH1_VOLATILE_RESET_IGNORE 0x00000000 /* CWI-V */ +#define NV_PGRAPH_CTX_SWITCH1_VOLATILE_RESET_ENABLED 0x00000001 /* -W--T */ +#define NV_PGRAPH_CTX_SWITCH2 0x00400164 /* RW-4R */ +#define NV_PGRAPH_CTX_SWITCH2_MONO_FORMAT 1:0 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH2_MONO_FORMAT_INVALID 0x00 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_MONO_FORMAT_CGA6_M1 0x01 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_MONO_FORMAT_LE_M1 0x02 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT 13:8 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_INVALID 0x00 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_Y8 0x01 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X16A8Y8 0x02 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X24Y8 0x03 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_A1R5G5B5 0x06 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X1R5G5B5 0x07 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X16A1R5G5B5 0x08 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X17R5G5B5 0x09 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_R5G6B5 0x0A /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_A16R5G6B5 0x0B /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X16R5G6B5 0x0C /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_A8R8G8B8 0x0D /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X8R8G8B8 0x0E /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_Y16 0x0F /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_A16Y16 0x10 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_X16Y16 0x11 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_V8YB8U8YA8 0x12 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_YB8V8YA8U8 0x13 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_COLOR_FORMAT_LE_Y32 0x14 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH2_NOTIFY_INSTANCE 31:16 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH2_NOTIFY_INSTANCE_INVALID 0x0000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH3 0x00400168 /* RW-4R */ +#define NV_PGRAPH_CTX_SWITCH3_DMA_INSTANCE_0 15:0 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH3_DMA_INSTANCE_0_INVALID 0x0000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH3_DMA_INSTANCE_1 31:16 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH3_DMA_INSTANCE_1_INVALID 0x0000 /* RW--V */ +#define NV_PGRAPH_CTX_SWITCH4 0x0040016C /* RW-4R */ +#define NV_PGRAPH_CTX_SWITCH4_USER_INSTANCE 15:0 /* RWXUF */ +#define NV_PGRAPH_CTX_SWITCH4_USER_INSTANCE_INVALID 0x0000 /* RW--V */ +#define NV_PGRAPH_CTX_CACHE1(i) (0x00400180+(i)*4) /* RW-4A */ +#define NV_PGRAPH_CTX_CACHE1__SIZE_1 8 /* */ +#define NV_PGRAPH_CTX_CACHE1_GRCLASS 7:0 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_CHROMA_KEY 12:12 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_USER_CLIP 13:13 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_SWIZZLE 14:14 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_PATCH_CONFIG 19:15 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_SPARE1 20:20 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_PATCH_STATUS 24:24 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE1_CONTEXT_SURFACE 25:25 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE2(i) (0x004001a0+(i)*4) /* RW-4A */ +#define NV_PGRAPH_CTX_CACHE2__SIZE_1 8 /* */ +#define NV_PGRAPH_CTX_CACHE2_MONO_FORMAT 1:0 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE2_COLOR_FORMAT 13:8 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE2_NOTIFY_INSTANCE 31:16 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE3(i) (0x004001c0+(i)*4) /* RW-4A */ +#define NV_PGRAPH_CTX_CACHE3__SIZE_1 8 /* */ +#define NV_PGRAPH_CTX_CACHE3_DMA_INSTANCE_0 15:0 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE3_DMA_INSTANCE_1 31:16 /* RWXVF */ +#define NV_PGRAPH_CTX_CACHE4(i) (0x004001e0+(i)*4) /* RW-4A */ +#define NV_PGRAPH_CTX_CACHE4__SIZE_1 8 /* */ +#define NV_PGRAPH_CTX_CACHE4_USER_INSTANCE 15:0 /* RWXVF */ +#define NV_PGRAPH_CTX_CONTROL 0x00400170 /* RW-4R */ +#define NV_PGRAPH_CTX_CONTROL_MINIMUM_TIME 1:0 /* RWIVF */ +#define NV_PGRAPH_CTX_CONTROL_MINIMUM_TIME_33US 0x00000000 /* RWI-V */ +#define NV_PGRAPH_CTX_CONTROL_MINIMUM_TIME_262US 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_CONTROL_MINIMUM_TIME_2MS 0x00000002 /* RW--V */ +#define NV_PGRAPH_CTX_CONTROL_MINIMUM_TIME_17MS 0x00000003 /* RW--V */ +#define NV_PGRAPH_CTX_CONTROL_TIME 8:8 /* RWIVF */ +#define NV_PGRAPH_CTX_CONTROL_TIME_EXPIRED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_CTX_CONTROL_TIME_NOT_EXPIRED 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_CONTROL_CHID 16:16 /* RWIVF */ +#define NV_PGRAPH_CTX_CONTROL_CHID_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_CTX_CONTROL_CHID_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_CONTROL_CHANGE 20:20 /* R--VF */ +#define NV_PGRAPH_CTX_CONTROL_CHANGE_UNAVAILABLE 0x00000000 /* R---V */ +#define NV_PGRAPH_CTX_CONTROL_CHANGE_AVAILABLE 0x00000001 /* R---V */ +#define NV_PGRAPH_CTX_CONTROL_SWITCHING 24:24 /* RWIVF */ +#define NV_PGRAPH_CTX_CONTROL_SWITCHING_IDLE 0x00000000 /* RWI-V */ +#define NV_PGRAPH_CTX_CONTROL_SWITCHING_BUSY 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_CONTROL_DEVICE 28:28 /* RWIVF */ +#define NV_PGRAPH_CTX_CONTROL_DEVICE_DISABLED 0x00000000 /* RWI-V */ +#define NV_PGRAPH_CTX_CONTROL_DEVICE_ENABLED 0x00000001 /* RW--V */ +#define NV_PGRAPH_CTX_USER 0x00400174 /* RW-4R */ +#define NV_PGRAPH_CTX_USER_SUBCH 15:13 /* RWIVF */ +#define NV_PGRAPH_CTX_USER_SUBCH_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_CTX_USER_CHID 27:24 /* RWIVF */ +#define NV_PGRAPH_CTX_USER_CHID_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FIFO 0x00400720 /* RW-4R */ +#define NV_PGRAPH_FIFO_ACCESS 0:0 /* RWIVF */ +#define NV_PGRAPH_FIFO_ACCESS_DISABLED 0x00000000 /* RW--V */ +#define NV_PGRAPH_FIFO_ACCESS_ENABLED 0x00000001 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_FIFO_0(i) (0x00400730+(i)*4) /* RW-4A */ +#define NV_PGRAPH_FFINTFC_FIFO_0__SIZE_1 4 /* */ +#define NV_PGRAPH_FFINTFC_FIFO_0_TAG 0:0 /* RWXVF */ +#define NV_PGRAPH_FFINTFC_FIFO_0_TAG_MTHD 0x00000000 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_TAG_CHSW 0x00000001 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH 3:1 /* RWXVF */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_0 0x00000000 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_1 0x00000001 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_2 0x00000002 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_3 0x00000003 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_4 0x00000004 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_5 0x00000005 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_6 0x00000006 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_SUBCH_7 0x00000007 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_0_MTHD 14:4 /* RWXVF */ +#define NV_PGRAPH_FFINTFC_FIFO_0_MTHD_CTX_SWITCH 0x00000000 /* RW--V */ +#define NV_PGRAPH_FFINTFC_FIFO_1(i) (0x00400740+(i)*4) /* RW-4A */ +#define NV_PGRAPH_FFINTFC_FIFO_1__SIZE_1 4 /* */ +#define NV_PGRAPH_FFINTFC_FIFO_1_ARGUMENT 31:0 /* RWXVF */ +#define NV_PGRAPH_FFINTFC_FIFO_PTR 0x00400750 /* RW-4R */ +#define NV_PGRAPH_FFINTFC_FIFO_PTR_WRITE 2:0 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_FIFO_PTR_WRITE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_FIFO_PTR_READ 6:4 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_FIFO_PTR_READ_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_ST2 0x00400754 /* RW-4R */ +#define NV_PGRAPH_FFINTFC_ST2_STATUS 0:0 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_ST2_STATUS_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_ST2_STATUS_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_MTHD 11:1 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_ST2_MTHD_CTX_SWITCH 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH 14:12 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_1 0x00000001 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_2 0x00000002 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_3 0x00000003 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_4 0x00000004 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_5 0x00000005 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_6 0x00000006 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_SUBCH_7 0x00000007 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID 18:15 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_1 0x00000001 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_2 0x00000002 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_3 0x00000003 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_4 0x00000004 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_5 0x00000005 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_6 0x00000006 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_7 0x00000007 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_8 0x00000008 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_9 0x00000009 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_10 0x0000000A /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_11 0x0000000B /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_12 0x0000000C /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_13 0x0000000D /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_14 0x0000000E /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_15 0x0000000F /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_STATUS 19:19 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_STATUS_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FFINTFC_ST2_CHID_STATUS_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_FFINTFC_ST2_D 0x00400758 /* RW-4R */ +#define NV_PGRAPH_FFINTFC_ST2_D_ARGUMENT 31:0 /* RWIVF */ +#define NV_PGRAPH_FFINTFC_ST2_D_ARGUMENT_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATUS 0x00400700 /* R--4R */ +#define NV_PGRAPH_STATUS_STATE 0:0 /* R-IVF */ +#define NV_PGRAPH_STATUS_STATE_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_STATE_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_XY_LOGIC 4:4 /* R-IVF */ +#define NV_PGRAPH_STATUS_XY_LOGIC_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_XY_LOGIC_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_FE 5:5 /* R-IVF */ +#define NV_PGRAPH_STATUS_FE_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_FE_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_RASTERIZER 6:6 /* R-IVF */ +#define NV_PGRAPH_STATUS_RASTERIZER_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_RASTERIZER_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_PORT_NOTIFY 8:8 /* R-IVF */ +#define NV_PGRAPH_STATUS_PORT_NOTIFY_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_PORT_NOTIFY_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_PORT_REGISTER 12:12 /* R-IVF */ +#define NV_PGRAPH_STATUS_PORT_REGISTER_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_PORT_REGISTER_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_PORT_DMA 16:16 /* R-IVF */ +#define NV_PGRAPH_STATUS_PORT_DMA_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_PORT_DMA_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_DMA_ENGINE 17:17 /* R-IVF */ +#define NV_PGRAPH_STATUS_DMA_ENGINE_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_DMA_ENGINE_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_DMA_NOTIFY 20:20 /* R-IVF */ +#define NV_PGRAPH_STATUS_DMA_NOTIFY_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_DMA_NOTIFY_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_DMA_BUFFER_NOTIFY 21:21 /* R-IVF */ +#define NV_PGRAPH_STATUS_DMA_BUFFER_NOTIFY_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_DMA_BUFFER_NOTIFY_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_D3D 24:24 /* R-IVF */ +#define NV_PGRAPH_STATUS_D3D_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_D3D_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_CACHE 25:25 /* R-IVF */ +#define NV_PGRAPH_STATUS_CACHE_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_CACHE_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_LIGHTING 26:26 /* R-IVF */ +#define NV_PGRAPH_STATUS_LIGHTING_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_LIGHTING_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_PREROP 27:27 /* R-IVF */ +#define NV_PGRAPH_STATUS_PREROP_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_PREROP_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_ROP 28:28 /* R-IVF */ +#define NV_PGRAPH_STATUS_ROP_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_ROP_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_STATUS_PORT_USER 29:29 /* R-IVF */ +#define NV_PGRAPH_STATUS_PORT_USER_IDLE 0x00000000 /* R-I-V */ +#define NV_PGRAPH_STATUS_PORT_USER_BUSY 0x00000001 /* R---V */ +#define NV_PGRAPH_TRAPPED_ADDR 0x00400704 /* R--4R */ +#define NV_PGRAPH_TRAPPED_ADDR_MTHD 12:2 /* R-XUF */ +#define NV_PGRAPH_TRAPPED_ADDR_SUBCH 15:13 /* R-XUF */ +#define NV_PGRAPH_TRAPPED_ADDR_CHID 27:24 /* R-XUF */ +#define NV_PGRAPH_TRAPPED_DATA 0x00400708 /* R--4R */ +#define NV_PGRAPH_TRAPPED_DATA_VALUE 31:0 /* R-XVF */ +#define NV_PGRAPH_SURFACE 0x0040070C /* RW-4R */ +#define NV_PGRAPH_SURFACE_TYPE 1:0 /* RWIVF */ +#define NV_PGRAPH_SURFACE_TYPE_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_SURFACE_TYPE_NON_SWIZZLE 0x00000001 /* RW--V */ +#define NV_PGRAPH_SURFACE_TYPE_SWIZZLE 0x00000002 /* RW--V */ +#define NV_PGRAPH_NOTIFY 0x00400714 /* RW-4R */ +#define NV_PGRAPH_NOTIFY_BUFFER_REQ 0:0 /* RWIVF */ +#define NV_PGRAPH_NOTIFY_BUFFER_REQ_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NOTIFY_BUFFER_REQ_PENDING 0x00000001 /* RW--V */ +#define NV_PGRAPH_NOTIFY_BUFFER_STYLE 8:8 /* RWIVF */ +#define NV_PGRAPH_NOTIFY_BUFFER_STYLE_WRITE_ONLY 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NOTIFY_BUFFER_STYLE_WRITE_THEN_AWAKEN 0x00000001 /* RW--V */ +#define NV_PGRAPH_NOTIFY_REQ 16:16 /* RWIVF */ +#define NV_PGRAPH_NOTIFY_REQ_NOT_PENDING 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NOTIFY_REQ_PENDING 0x00000001 /* RW--V */ +#define NV_PGRAPH_NOTIFY_STYLE 20:20 /* RWIVF */ +#define NV_PGRAPH_NOTIFY_STYLE_WRITE_ONLY 0x00000000 /* RWI-V */ +#define NV_PGRAPH_NOTIFY_STYLE_WRITE_THEN_AWAKEN 0x00000001 /* RW--V */ +#define NV_PGRAPH_BOFFSET(i) (0x00400640+(i)*4) /* RW-4A */ +#define NV_PGRAPH_BOFFSET__SIZE_1 6 /* */ +#define NV_PGRAPH_BOFFSET_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BOFFSET0 0x00400640 /* RW-4R */ +#define NV_PGRAPH_BOFFSET0__ALIAS_1 NV_PGRAPH_BOFFSET(0) /* */ +#define NV_PGRAPH_BOFFSET0_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET0_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BOFFSET1 0x00400644 /* RW-4R */ +#define NV_PGRAPH_BOFFSET1__ALIAS_1 NV_PGRAPH_BOFFSET(1) /* */ +#define NV_PGRAPH_BOFFSET1_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET1_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BOFFSET2 0x00400648 /* RW-4R */ +#define NV_PGRAPH_BOFFSET2__ALIAS_1 NV_PGRAPH_BOFFSET(2) /* */ +#define NV_PGRAPH_BOFFSET2_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET2_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BOFFSET3 0x0040064C /* RW-4R */ +#define NV_PGRAPH_BOFFSET3__ALIAS_1 NV_PGRAPH_BOFFSET(3) /* */ +#define NV_PGRAPH_BOFFSET3_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET3_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BOFFSET4 0x00400650 /* RW-4R */ +#define NV_PGRAPH_BOFFSET4__ALIAS_1 NV_PGRAPH_BOFFSET(4) /* */ +#define NV_PGRAPH_BOFFSET4_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET4_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BOFFSET5 0x00400654 /* RW-4R */ +#define NV_PGRAPH_BOFFSET5__ALIAS_1 NV_PGRAPH_BOFFSET(5) /* */ +#define NV_PGRAPH_BOFFSET5_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BOFFSET5_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE(i) (0x00400658+(i)*4) /* RW-4A */ +#define NV_PGRAPH_BBASE__SIZE_1 6 /* */ +#define NV_PGRAPH_BBASE_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE0 0x00400658 /* RW-4R */ +#define NV_PGRAPH_BBASE0__ALIAS_1 NV_PGRAPH_BBASE(0) /* */ +#define NV_PGRAPH_BBASE0_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE0_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE1 0x0040065c /* RW-4R */ +#define NV_PGRAPH_BBASE1__ALIAS_1 NV_PGRAPH_BBASE(1) /* */ +#define NV_PGRAPH_BBASE1_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE1_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE2 0x00400660 /* RW-4R */ +#define NV_PGRAPH_BBASE2__ALIAS_1 NV_PGRAPH_BBASE(2) /* */ +#define NV_PGRAPH_BBASE2_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE2_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE3 0x00400664 /* RW-4R */ +#define NV_PGRAPH_BBASE3__ALIAS_1 NV_PGRAPH_BBASE(3) /* */ +#define NV_PGRAPH_BBASE3_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE3_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE4 0x00400668 /* RW-4R */ +#define NV_PGRAPH_BBASE4__ALIAS_1 NV_PGRAPH_BBASE(4) /* */ +#define NV_PGRAPH_BBASE4_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE4_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BBASE5 0x0040066C /* RW-4R */ +#define NV_PGRAPH_BBASE5__ALIAS_1 NV_PGRAPH_BBASE(5) /* */ +#define NV_PGRAPH_BBASE5_LINADRS 23:0 /* RWIUF */ +#define NV_PGRAPH_BBASE5_LINADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPITCH(i) (0x00400670+(i)*4) /* RW-4A */ +#define NV_PGRAPH_BPITCH__SIZE_1 5 /* */ +#define NV_PGRAPH_BPITCH_VALUE 12:0 /* RWIUF */ +#define NV_PGRAPH_BPITCH_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPITCH0 0x00400670 /* RW-4R */ +#define NV_PGRAPH_BPITCH0__ALIAS_1 NV_PGRAPH_BPITCH(0) /* */ +#define NV_PGRAPH_BPITCH0_VALUE 12:0 /* RWIUF */ +#define NV_PGRAPH_BPITCH0_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPITCH1 0x00400674 /* RW-4R */ +#define NV_PGRAPH_BPITCH1__ALIAS_1 NV_PGRAPH_BPITCH(1) /* */ +#define NV_PGRAPH_BPITCH1_VALUE 12:0 /* RWIUF */ +#define NV_PGRAPH_BPITCH1_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPITCH2 0x00400678 /* RW-4R */ +#define NV_PGRAPH_BPITCH2__ALIAS_1 NV_PGRAPH_BPITCH(2) /* */ +#define NV_PGRAPH_BPITCH2_VALUE 12:0 /* RWIUF */ +#define NV_PGRAPH_BPITCH2_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPITCH3 0x0040067C /* RW-4R */ +#define NV_PGRAPH_BPITCH3__ALIAS_1 NV_PGRAPH_BPITCH(3) /* */ +#define NV_PGRAPH_BPITCH3_VALUE 12:0 /* RWIUF */ +#define NV_PGRAPH_BPITCH3_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPITCH4 0x00400680 /* RW-4R */ +#define NV_PGRAPH_BPITCH4__ALIAS_1 NV_PGRAPH_BPITCH(4) /* */ +#define NV_PGRAPH_BPITCH4_VALUE 12:0 /* RWIUF */ +#define NV_PGRAPH_BPITCH4_VALUE_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BLIMIT(i) (0x00400684+(i)*4) /* RW-4A */ +#define NV_PGRAPH_BLIMIT__SIZE_1 6 /* */ +#define NV_PGRAPH_BLIMIT_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BLIMIT0 0x00400684 /* RW-4R */ +#define NV_PGRAPH_BLIMIT0__ALIAS_1 NV_PGRAPH_BLIMIT(0) /* */ +#define NV_PGRAPH_BLIMIT0_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT0_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT0_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT0_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BLIMIT1 0x00400688 /* RW-4R */ +#define NV_PGRAPH_BLIMIT1__ALIAS_1 NV_PGRAPH_BLIMIT(1) /* */ +#define NV_PGRAPH_BLIMIT1_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT1_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT1_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT1_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BLIMIT2 0x0040068c /* RW-4R */ +#define NV_PGRAPH_BLIMIT2__ALIAS_1 NV_PGRAPH_BLIMIT(2) /* */ +#define NV_PGRAPH_BLIMIT2_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT2_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT2_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT2_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BLIMIT3 0x00400690 /* RW-4R */ +#define NV_PGRAPH_BLIMIT3__ALIAS_1 NV_PGRAPH_BLIMIT(3) /* */ +#define NV_PGRAPH_BLIMIT3_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT3_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT3_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT3_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BLIMIT4 0x00400694 /* RW-4R */ +#define NV_PGRAPH_BLIMIT4__ALIAS_1 NV_PGRAPH_BLIMIT(4) /* */ +#define NV_PGRAPH_BLIMIT4_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT4_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT4_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT4_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BLIMIT5 0x00400698 /* RW-4R */ +#define NV_PGRAPH_BLIMIT5__ALIAS_1 NV_PGRAPH_BLIMIT(5) /* */ +#define NV_PGRAPH_BLIMIT5_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_BLIMIT5_TYPE 31:31 /* RWIVF */ +#define NV_PGRAPH_BLIMIT5_TYPE_IN_MEMORY 0x00000000 /* RW--V */ +#define NV_PGRAPH_BLIMIT5_TYPE_NULL 0x00000001 /* RWI-V */ +#define NV_PGRAPH_BSWIZZLE2 0x0040069c /* RW-4R */ +#define NV_PGRAPH_BSWIZZLE2_WIDTH 19:16 /* RWIUF */ +#define NV_PGRAPH_BSWIZZLE2_WIDTH_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BSWIZZLE2_HEIGHT 27:24 /* RWIUF */ +#define NV_PGRAPH_BSWIZZLE2_HEIGHT_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BSWIZZLE5 0x004006a0 /* RW-4R */ +#define NV_PGRAPH_BSWIZZLE5_WIDTH 19:16 /* RWIUF */ +#define NV_PGRAPH_BSWIZZLE5_WIDTH_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BSWIZZLE5_HEIGHT 27:24 /* RWIUF */ +#define NV_PGRAPH_BSWIZZLE5_HEIGHT_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL 0x00400724 /* RW-4R */ +#define NV_PGRAPH_BPIXEL_DEPTH0 3:0 /* RWIVF */ +#define NV_PGRAPH_BPIXEL_DEPTH0_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH0_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1 7:4 /* RWIVF */ +#define NV_PGRAPH_BPIXEL_DEPTH1_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH1_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2 11:8 /* RWIVF */ +#define NV_PGRAPH_BPIXEL_DEPTH2_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH2_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3 15:12 /* RWIVF */ +#define NV_PGRAPH_BPIXEL_DEPTH3_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH3_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4 19:16 /* RWIVF */ +#define NV_PGRAPH_BPIXEL_DEPTH4_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH4_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5 23:20 /* RWIVF */ +#define NV_PGRAPH_BPIXEL_DEPTH5_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_BPIXEL_DEPTH5_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX 0x00400610 /* RW-4R */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_ADRS 23:0 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_ADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_BLIT 29:29 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_BLIT_NO_VIOL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_BLIT_VIOL 0x00000001 /* RW--V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_LIMIT 30:30 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_LIMIT_NO_VIOL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_LIMIT_VIOL 0x00000001 /* RW--V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_OVRFLW 31:31 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_OVRFLW_NO_VIOL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_PIX_OVRFLW_VIOL 0x00000001 /* RW--V */ +#define NV_PGRAPH_LIMIT_VIOL_Z 0x00400614 /* RW-4R */ +#define NV_PGRAPH_LIMIT_VIOL_Z_ADRS 23:0 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_Z_ADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_Z_LIMIT 30:30 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_Z_LIMIT_NO_VIOL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_Z_LIMIT_VIOL 0x00000001 /* RW--V */ +#define NV_PGRAPH_LIMIT_VIOL_Z_OVRFLW 31:31 /* RWIVF */ +#define NV_PGRAPH_LIMIT_VIOL_Z_OVRFLW_NO_VIOL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_LIMIT_VIOL_Z_OVRFLW_VIOL 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE 0x00400710 /* RW-4R */ +#define NV_PGRAPH_STATE_BUFFER_0 0:0 /* RWIVF */ +#define NV_PGRAPH_STATE_BUFFER_0_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_BUFFER_0_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_BUFFER_1 1:1 /* RWIVF */ +#define NV_PGRAPH_STATE_BUFFER_1_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_BUFFER_1_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_BUFFER_2 2:2 /* RWIVF */ +#define NV_PGRAPH_STATE_BUFFER_2_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_BUFFER_2_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_BUFFER_3 3:3 /* RWIVF */ +#define NV_PGRAPH_STATE_BUFFER_3_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_BUFFER_3_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_BUFFER_4 4:4 /* RWIVF */ +#define NV_PGRAPH_STATE_BUFFER_4_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_BUFFER_4_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_BUFFER_5 5:5 /* RWIVF */ +#define NV_PGRAPH_STATE_BUFFER_5_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_BUFFER_5_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PITCH_0 8:8 /* RWIVF */ +#define NV_PGRAPH_STATE_PITCH_0_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PITCH_0_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PITCH_1 9:9 /* RWIVF */ +#define NV_PGRAPH_STATE_PITCH_1_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PITCH_1_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PITCH_2 10:10 /* RWIVF */ +#define NV_PGRAPH_STATE_PITCH_2_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PITCH_2_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PITCH_3 11:11 /* RWIVF */ +#define NV_PGRAPH_STATE_PITCH_3_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PITCH_3_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PITCH_4 12:12 /* RWIVF */ +#define NV_PGRAPH_STATE_PITCH_4_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PITCH_4_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_CHROMA_COLOR 16:16 /* RWIVF */ +#define NV_PGRAPH_STATE_CHROMA_COLOR_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_CHROMA_COLOR_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_CHROMA_COLORFMT 17:17 /* RWIVF */ +#define NV_PGRAPH_STATE_CHROMA_COLORFMT_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_CHROMA_COLORFMT_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_CPATTERN_COLORFMT 20:20 /* RWIVF */ +#define NV_PGRAPH_STATE_CPATTERN_COLORFMT_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_CPATTERN_COLORFMT_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_CPATTERN_MONOFMT 21:21 /* RWIVF */ +#define NV_PGRAPH_STATE_CPATTERN_MONOFMT_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_CPATTERN_MONOFMT_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_CPATTERN_SELECT 22:22 /* RWIVF */ +#define NV_PGRAPH_STATE_CPATTERN_SELECT_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_CPATTERN_SELECT_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PATTERN_COLOR0 24:24 /* RWIVF */ +#define NV_PGRAPH_STATE_PATTERN_COLOR0_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PATTERN_COLOR0_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PATTERN_COLOR1 25:25 /* RWIVF */ +#define NV_PGRAPH_STATE_PATTERN_COLOR1_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PATTERN_COLOR1_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PATTERN_PATT0 26:26 /* RWIVF */ +#define NV_PGRAPH_STATE_PATTERN_PATT0_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PATTERN_PATT0_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_STATE_PATTERN_PATT1 27:27 /* RWIVF */ +#define NV_PGRAPH_STATE_PATTERN_PATT1_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_STATE_PATTERN_PATT1_VALID 0x00000001 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX 0x00400728 /* RW-4R */ +#define NV_PGRAPH_CACHE_INDEX_BANK 2:2 /* RWXVF */ +#define NV_PGRAPH_CACHE_INDEX_BANK_10 0x00000000 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX_BANK_32 0x00000001 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX_ADRS 12:3 /* RWXVF */ +#define NV_PGRAPH_CACHE_INDEX_ADRS_0 0x00000000 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX_ADRS_1024 0x00000400 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX_OP 14:13 /* RWXVF */ +#define NV_PGRAPH_CACHE_INDEX_OP_WR_CACHE 0x00000000 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX_OP_RD_CACHE 0x00000001 /* RW--V */ +#define NV_PGRAPH_CACHE_INDEX_OP_RD_INDEX 0x00000002 /* RW--V */ +#define NV_PGRAPH_CACHE_RAM 0x0040072c /* RW-4R */ +#define NV_PGRAPH_CACHE_RAM_VALUE 31:0 /* RWXVF */ +#define NV_PGRAPH_DMA_PITCH 0x00400760 /* RW-4R */ +#define NV_PGRAPH_DMA_PITCH_S0 15:0 /* RWXSF */ +#define NV_PGRAPH_DMA_PITCH_S1 31:16 /* RWXSF */ +#define NV_PGRAPH_DVD_COLORFMT 0x00400764 /* RW-4R */ +#define NV_PGRAPH_DVD_COLORFMT_IMAGE 5:0 /* RWNVF */ +#define NV_PGRAPH_DVD_COLORFMT_IMAGE_FORMAT_INVALID 0x00 /* RWN-V */ +#define NV_PGRAPH_DVD_COLORFMT_IMAGE_FORMAT_LE_V8YB8U8YA8 0x12 /* RW--V */ +#define NV_PGRAPH_DVD_COLORFMT_IMAGE_FORMAT_LE_YB8V8YA8U8 0x13 /* RW--V */ +#define NV_PGRAPH_DVD_COLORFMT_OVLY 9:8 /* RWNVF */ +#define NV_PGRAPH_DVD_COLORFMT_OVLY_FORMAT_INVALID 0x00 /* RWN-V */ +#define NV_PGRAPH_DVD_COLORFMT_OVLY_FORMAT_LE_A8Y8U8V8 0x01 /* RW--V */ +#define NV_PGRAPH_DVD_COLORFMT_OVLY_FORMAT_LE_A4V6YB6A4U6YA6 0x02 /* RW--V */ +#define NV_PGRAPH_DVD_COLORFMT_OVLY_FORMAT_TRANSPARENT 0x03 /* RW--V */ +#define NV_PGRAPH_SCALED_FORMAT 0x00400768 /* RW-4R */ +#define NV_PGRAPH_SCALED_FORMAT_ORIGIN 17:16 /* RWIVF */ +#define NV_PGRAPH_SCALED_FORMAT_ORIGIN_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_SCALED_FORMAT_ORIGIN_CENTER 0x00000001 /* RW--V */ +#define NV_PGRAPH_SCALED_FORMAT_ORIGIN_CORNER 0x00000002 /* RW--V */ +#define NV_PGRAPH_SCALED_FORMAT_INTERPOLATOR 24:24 /* RWIVF */ +#define NV_PGRAPH_SCALED_FORMAT_INTERPOLATOR_ZOH 0x00000000 /* RWI-V */ +#define NV_PGRAPH_SCALED_FORMAT_INTERPOLATOR_FOH 0x00000001 /* RW--V */ +#define NV_PGRAPH_PATT_COLOR0 0x00400800 /* RW-4R */ +#define NV_PGRAPH_PATT_COLOR0_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_PATT_COLOR1 0x00400804 /* RW-4R */ +#define NV_PGRAPH_PATT_COLOR1_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_PATT_COLORRAM(i) (0x00400900+(i)*4) /* R--4A */ +#define NV_PGRAPH_PATT_COLORRAM__SIZE_1 64 /* */ +#define NV_PGRAPH_PATT_COLORRAM_VALUE 23:0 /* R--UF */ +#define NV_PGRAPH_PATTERN(i) (0x00400808+(i)*4) /* RW-4A */ +#define NV_PGRAPH_PATTERN__SIZE_1 2 /* */ +#define NV_PGRAPH_PATTERN_BITMAP 31:0 /* RWXVF */ +#define NV_PGRAPH_PATTERN_SHAPE 0x00400810 /* RW-4R */ +#define NV_PGRAPH_PATTERN_SHAPE_VALUE 1:0 /* RWXVF */ +#define NV_PGRAPH_PATTERN_SHAPE_VALUE_8X_8Y 0x00000000 /* RW--V */ +#define NV_PGRAPH_PATTERN_SHAPE_VALUE_64X_1Y 0x00000001 /* RW--V */ +#define NV_PGRAPH_PATTERN_SHAPE_VALUE_1X_64Y 0x00000002 /* RW--V */ +#define NV_PGRAPH_PATTERN_SHAPE_SELECT 4:4 /* RWXVF */ +#define NV_PGRAPH_PATTERN_SHAPE_SELECT_2COLOR 0x00000000 /* RW--V */ +#define NV_PGRAPH_PATTERN_SHAPE_SELECT_FULLCOLOR 0x00000001 /* RW--V */ +#define NV_PGRAPH_MONO_COLOR0 0x00400600 /* RW-4R */ +#define NV_PGRAPH_MONO_COLOR0_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_ROP3 0x00400604 /* RW-4R */ +#define NV_PGRAPH_ROP3_VALUE 7:0 /* RWXVF */ +#define NV_PGRAPH_CHROMA 0x00400814 /* RW-4R */ +#define NV_PGRAPH_CHROMA_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_BETA_AND 0x00400608 /* RW-4R */ +#define NV_PGRAPH_BETA_AND_VALUE_FRACTION 30:23 /* RWXUF */ +#define NV_PGRAPH_BETA_PREMULT 0x0040060c /* RW-4R */ +#define NV_PGRAPH_BETA_PREMULT_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_CONTROL0 0x00400818 /* RW-4R */ +#define NV_PGRAPH_CONTROL1 0x0040081c /* RW-4R */ +#define NV_PGRAPH_CONTROL2 0x00400820 /* RW-4R */ +#define NV_PGRAPH_BLEND 0x00400824 /* RW-4R */ +#define NV_PGRAPH_DPRAM_INDEX 0x00400828 /* RW-4R */ +#define NV_PGRAPH_DPRAM_INDEX_ADRS 6:0 /* RWIVF */ +#define NV_PGRAPH_DPRAM_INDEX_ADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT 10:8 /* RWIVF */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_ADRS_0 0x00000000 /* RWI-V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_ADRS_1 0x00000001 /* RW--V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_DATA_0 0x00000002 /* RW--V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_DATA_1 0x00000003 /* RW--V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_WE_0 0x00000004 /* RW--V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_WE_1 0x00000005 /* RW--V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_ALPHA_0 0x00000006 /* RW--V */ +#define NV_PGRAPH_DPRAM_INDEX_SELECT_ALPHA_1 0x00000007 /* RW--V */ +#define NV_PGRAPH_DPRAM_DATA 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_DATA_VALUE 31:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_ADRS_0 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_ADRS_0__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_ADRS_0_VALUE 19:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_ADRS_1 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_ADRS_1__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_ADRS_1_VALUE 19:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_DATA_0 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_DATA_0__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_DATA_0_VALUE 31:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_DATA_1 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_DATA_1__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_DATA_1_VALUE 31:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_WE_0 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_WE_0__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_WE_0_VALUE 23:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_WE_1 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_WE_1__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_WE_1_VALUE 23:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_ALPHA_0 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_ALPHA_0__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_ALPHA_0_VALUE 31:0 /* RWXVF */ +#define NV_PGRAPH_DPRAM_ALPHA_1 0x0040082c /* RW-4R */ +#define NV_PGRAPH_DPRAM_ALPHA_1__ALIAS_1 NV_PGRAPH_DPRAM_DATA /* */ +#define NV_PGRAPH_DPRAM_ALPHA_1_VALUE 31:0 /* RWXVF */ +#define NV_PGRAPH_STORED_FMT 0x00400830 /* RW-4R */ +#define NV_PGRAPH_STORED_FMT_MONO0 5:0 /* RWXVF */ +#define NV_PGRAPH_STORED_FMT_PATT0 13:8 /* RWXVF */ +#define NV_PGRAPH_STORED_FMT_PATT1 21:16 /* RWXVF */ +#define NV_PGRAPH_STORED_FMT_CHROMA 29:24 /* RWXVF */ +#define NV_PGRAPH_FORMATS 0x00400618 /* RW-4R */ +#define NV_PGRAPH_FORMATS_ROP 2:0 /* R-XVF */ +#define NV_PGRAPH_FORMATS_ROP_Y8 0x00000000 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_RGB15 0x00000001 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_RGB16 0x00000002 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_Y16 0x00000003 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_INVALID 0x00000004 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_RGB24 0x00000005 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_RGB30 0x00000006 /* -W--V */ +#define NV_PGRAPH_FORMATS_ROP_Y32 0x00000007 /* -W--V */ +#define NV_PGRAPH_FORMATS_SRC 9:4 /* R-XVF */ +#define NV_PGRAPH_FORMATS_SRC_INVALID 0x00000000 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X16A8Y8 0x00000002 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X24Y8 0x00000003 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_A1R5G5B5 0x00000006 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X1R5G5B5 0x00000007 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X16A1R5G5B5 0x00000008 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X17R5G5B5 0x00000009 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_R5G6B5 0x0000000A /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_A16R5G6B5 0x0000000B /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X16R5G6B5 0x0000000C /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_A8R8G8B8 0x0000000D /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X8R8G8B8 0x0000000E /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_Y16 0x0000000F /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_A16Y16 0x00000010 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_X16Y16 0x00000011 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_V8YB8U8YA8 0x00000012 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_YB8V8YA8U8 0x00000013 /* RW--V */ +#define NV_PGRAPH_FORMATS_SRC_LE_Y32 0x00000014 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB 15:12 /* R-XVF */ +#define NV_PGRAPH_FORMATS_FB_INVALID 0x00000000 /* RWI-V */ +#define NV_PGRAPH_FORMATS_FB_Y8 0x00000001 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X1R5G5B5_Z1R5G5B5 0x00000002 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X1R5G5B5_O1R5G5B5 0x00000003 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_A1R5G5B5 0x00000004 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_R5G6B5 0x00000005 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_Y16 0x00000006 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X8R8G8B8_Z8R8G8B8 0x00000007 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X8R8G8B8_O1Z7R8G8B8 0x00000008 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X1A7R8G8B8_Z1A7R8G8B8 0x00000009 /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X1A7R8G8B8_O1A7R8G8B8 0x0000000a /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_X8R8G8B8_O8R8G8B8 0x0000000b /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_A8R8G8B8 0x0000000c /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_Y32 0x0000000d /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_V8YB8U8YA8 0x0000000e /* RW--V */ +#define NV_PGRAPH_FORMATS_FB_YB8V8YA8U8 0x0000000f /* RW--V */ +#define NV_PGRAPH_ABS_X_RAM(i) (0x00400400+(i)*4) /* RW-4A */ +#define NV_PGRAPH_ABS_X_RAM__SIZE_1 32 /* */ +#define NV_PGRAPH_ABS_X_RAM_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_X_RAM_BPORT(i) (0x00400c00+(i)*4) /* R--4A */ +#define NV_PGRAPH_X_RAM_BPORT__SIZE_1 32 /* */ +#define NV_PGRAPH_X_RAM_BPORT_VALUE 31:0 /* R--UF */ +#define NV_PGRAPH_ABS_Y_RAM(i) (0x00400480+(i)*4) /* RW-4A */ +#define NV_PGRAPH_ABS_Y_RAM__SIZE_1 32 /* */ +#define NV_PGRAPH_ABS_Y_RAM_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_Y_RAM_BPORT(i) (0x00400c80+(i)*4) /* R--4A */ +#define NV_PGRAPH_Y_RAM_BPORT__SIZE_1 32 /* */ +#define NV_PGRAPH_Y_RAM_BPORT_VALUE 31:0 /* R--UF */ +#define NV_PGRAPH_XY_LOGIC_MISC0 0x00400514 /* RW-4R */ +#define NV_PGRAPH_XY_LOGIC_MISC0_COUNTER 17:0 /* RWBUF */ +#define NV_PGRAPH_XY_LOGIC_MISC0_COUNTER_0 0x00000000 /* RWB-V */ +#define NV_PGRAPH_XY_LOGIC_MISC0_DIMENSION 20:20 /* RWVVF */ +#define NV_PGRAPH_XY_LOGIC_MISC0_DIMENSION_NONZERO 0x00000000 /* RWV-V */ +#define NV_PGRAPH_XY_LOGIC_MISC0_DIMENSION_ZERO 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC0_INDEX 31:28 /* RWBUF */ +#define NV_PGRAPH_XY_LOGIC_MISC0_INDEX_0 0x00000000 /* RWB-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1 0x00400518 /* RW-4R */ +#define NV_PGRAPH_XY_LOGIC_MISC1_INITIAL 0:0 /* RWNVF */ +#define NV_PGRAPH_XY_LOGIC_MISC1_INITIAL_NEEDED 0x00000000 /* RWN-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_INITIAL_DONE 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_XTRACLIPX 4:4 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC1_XTRACLIPX_NOTNULL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_XTRACLIPX_NULL 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_XTRACLIPY 5:5 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC1_XTRACLIPY_NOTNULL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_XTRACLIPY_NULL 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_XIMAX 12:12 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_XIMAX_UUMAX 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_XIMAX_IMAGEMAX 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_YIMAX 16:16 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_YIMAX_UUMAX 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_YIMAX_IMAGEMAX 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_XXTRA 20:20 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_XXTRA_CLIPMAX 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC1_SEL_XXTRA_IMAGEMAX 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC2 0x0040051C /* RW-4R */ +#define NV_PGRAPH_XY_LOGIC_MISC2_HANDOFF 0:0 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC2_HANDOFF_DISABLE 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_HANDOFF_ENABLE 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_XTRACLIPX 4:4 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC2_XTRACLIPX_NOTNULL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_XTRACLIPX_NULL 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_XTRACLIPY 5:5 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC2_XTRACLIPY_NOTNULL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_XTRACLIPY_NULL 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_XIMAX 12:12 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_XIMAX_UCMAX 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_XIMAX_IMAGEMAX 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_YIMAX 16:16 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_YIMAX_UCMAX 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_YIMAX_IMAGEMAX 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_XXTRA 20:20 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_XXTRA_CLIPMAX 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC2_SEL_XXTRA_IMAGEMAX 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3 0x00400520 /* RW-4R */ +#define NV_PGRAPH_XY_LOGIC_MISC3_WDIMY_EQ_0 0:0 /* RWXVF */ +#define NV_PGRAPH_XY_LOGIC_MISC3_WDIMY_EQ_0_NULL 0x00000000 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_WDIMY_EQ_0_TRUE 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_RELOAD_WDIMY 4:4 /* RWXVF */ +#define NV_PGRAPH_XY_LOGIC_MISC3_RELOAD_WDIMY_NULL 0x00000000 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_RELOAD_WDIMY_TRUE 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_RELOAD_WX 8:8 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC3_RELOAD_WX_NULL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_RELOAD_WX_TRUE 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_ALG 12:12 /* RWIVF */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_ALG_NULL 0x00000000 /* RWI-V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_ALG_TRUE 0x00000001 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_DIMX 22:16 /* RWXUF */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_DIMX_0 0x00000000 /* RW--V */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_WDIMX 30:24 /* RWXUF */ +#define NV_PGRAPH_XY_LOGIC_MISC3_TEXT_WDIMX_0 0x00000000 /* RW--V */ +#define NV_PGRAPH_X_MISC 0x00400500 /* RW-4R */ +#define NV_PGRAPH_X_MISC_BIT33_0 0:0 /* RWNVF */ +#define NV_PGRAPH_X_MISC_BIT33_0_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_BIT33_1 1:1 /* RWNVF */ +#define NV_PGRAPH_X_MISC_BIT33_1_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_BIT33_2 2:2 /* RWNVF */ +#define NV_PGRAPH_X_MISC_BIT33_2_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_BIT33_3 3:3 /* RWNVF */ +#define NV_PGRAPH_X_MISC_BIT33_3_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_RANGE_0 4:4 /* RWNVF */ +#define NV_PGRAPH_X_MISC_RANGE_0_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_RANGE_1 5:5 /* RWNVF */ +#define NV_PGRAPH_X_MISC_RANGE_1_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_RANGE_2 6:6 /* RWNVF */ +#define NV_PGRAPH_X_MISC_RANGE_2_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_RANGE_3 7:7 /* RWNVF */ +#define NV_PGRAPH_X_MISC_RANGE_3_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_X_MISC_ADDER_OUTPUT 29:28 /* RWXVF */ +#define NV_PGRAPH_X_MISC_ADDER_OUTPUT_EQ_0 0x00000000 /* RW--V */ +#define NV_PGRAPH_X_MISC_ADDER_OUTPUT_LT_0 0x00000001 /* RW--V */ +#define NV_PGRAPH_X_MISC_ADDER_OUTPUT_GT_0 0x00000002 /* RW--V */ +#define NV_PGRAPH_Y_MISC 0x00400504 /* RW-4R */ +#define NV_PGRAPH_Y_MISC_BIT33_0 0:0 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_BIT33_0_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_BIT33_1 1:1 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_BIT33_1_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_BIT33_2 2:2 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_BIT33_2_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_BIT33_3 3:3 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_BIT33_3_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_RANGE_0 4:4 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_RANGE_0_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_RANGE_1 5:5 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_RANGE_1_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_RANGE_2 6:6 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_RANGE_2_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_RANGE_3 7:7 /* RWNVF */ +#define NV_PGRAPH_Y_MISC_RANGE_3_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_Y_MISC_ADDER_OUTPUT 29:28 /* RWXVF */ +#define NV_PGRAPH_Y_MISC_ADDER_OUTPUT_EQ_0 0x00000000 /* RW--V */ +#define NV_PGRAPH_Y_MISC_ADDER_OUTPUT_LT_0 0x00000001 /* RW--V */ +#define NV_PGRAPH_Y_MISC_ADDER_OUTPUT_GT_0 0x00000002 /* RW--V */ +#define NV_PGRAPH_ABS_UCLIP_XMIN 0x0040053C /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIP_XMIN_VALUE 15:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIP_XMAX 0x00400544 /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIP_XMAX_VALUE 17:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIP_YMIN 0x00400540 /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIP_YMIN_VALUE 15:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIP_YMAX 0x00400548 /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIP_YMAX_VALUE 17:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIPA_XMIN 0x00400560 /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIPA_XMIN_VALUE 15:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIPA_XMAX 0x00400568 /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIPA_XMAX_VALUE 17:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIPA_YMIN 0x00400564 /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIPA_YMIN_VALUE 15:0 /* RWXSF */ +#define NV_PGRAPH_ABS_UCLIPA_YMAX 0x0040056C /* RW-4R */ +#define NV_PGRAPH_ABS_UCLIPA_YMAX_VALUE 17:0 /* RWXSF */ +#define NV_PGRAPH_SOURCE_COLOR 0x0040050C /* RW-4R */ +#define NV_PGRAPH_SOURCE_COLOR_VALUE 31:0 /* RWNVF */ +#define NV_PGRAPH_SOURCE_COLOR_VALUE_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_VALID1 0x00400508 /* RW-4R */ +#define NV_PGRAPH_VALID1_VLD 22:0 /* RWNVF */ +#define NV_PGRAPH_VALID1_VLD_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_VALID1_CLIP_MIN 28:28 /* RWIVF */ +#define NV_PGRAPH_VALID1_CLIP_MIN_NO_ERROR 0x00000000 /* RWI-V */ +#define NV_PGRAPH_VALID1_CLIP_MIN_ONLY 0x00000001 /* RW--V */ +#define NV_PGRAPH_VALID1_CLIPA_MIN 29:29 /* RWIVF */ +#define NV_PGRAPH_VALID1_CLIPA_MIN_NO_ERROR 0x00000000 /* RWI-V */ +#define NV_PGRAPH_VALID1_CLIPA_MIN_ONLY 0x00000001 /* RW--V */ +#define NV_PGRAPH_VALID1_CLIP_MAX 30:30 /* RWIVF */ +#define NV_PGRAPH_VALID1_CLIP_MAX_NO_ERROR 0x00000000 /* RWI-V */ +#define NV_PGRAPH_VALID1_CLIP_MAX_ONLY 0x00000001 /* RW--V */ +#define NV_PGRAPH_VALID1_CLIPA_MAX 31:31 /* RWIVF */ +#define NV_PGRAPH_VALID1_CLIPA_MAX_NO_ERROR 0x00000000 /* RWI-V */ +#define NV_PGRAPH_VALID1_CLIPA_MAX_ONLY 0x00000001 /* RW--V */ +#define NV_PGRAPH_VALID2 0x00400578 /* RW-4R */ +#define NV_PGRAPH_VALID2_VLD2 28:0 /* RWNVF */ +#define NV_PGRAPH_VALID2_VLD2_0 0x00000000 /* RWN-V */ +#define NV_PGRAPH_ABS_ICLIP_XMAX 0x00400534 /* RW-4R */ +#define NV_PGRAPH_ABS_ICLIP_XMAX_VALUE 17:0 /* RWXSF */ +#define NV_PGRAPH_ABS_ICLIP_YMAX 0x00400538 /* RW-4R */ +#define NV_PGRAPH_ABS_ICLIP_YMAX_VALUE 17:0 /* RWXSF */ +#define NV_PGRAPH_CLIPX_0 0x00400524 /* RW-4R */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MIN 1:0 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MAX 3:2 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP0_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MIN 5:4 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MAX 7:6 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP1_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MIN 9:8 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MAX 11:10 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP2_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MIN 13:12 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MAX 15:14 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP3_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MIN 17:16 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MAX 19:18 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP4_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MIN 21:20 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MAX 23:22 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP5_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MIN 25:24 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MAX 27:26 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP6_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MIN 29:28 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MAX 31:30 /* RWNVF */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_0_CLIP7_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1 0x00400528 /* RW-4R */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MIN 1:0 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MAX 3:2 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP8_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MIN 5:4 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MAX 7:6 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP9_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MIN 9:8 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MAX 11:10 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP10_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MIN 13:12 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP11MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MAX 15:14 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP11_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MIN 17:16 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MAX 19:18 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP12_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MIN 21:20 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MAX 23:22 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP13_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MIN 25:24 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MAX 27:26 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP14_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MIN 29:28 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MAX 31:30 /* RWNVF */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPX_1_CLIP15_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0 0x0040052c /* RW-4R */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MIN 1:0 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MAX 3:2 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP0_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MIN 5:4 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MAX 7:6 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP1_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MIN 9:8 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MAX 11:10 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP2_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MIN 13:12 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MAX 15:14 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP3_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MIN 17:16 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MAX 19:18 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP4_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MIN 21:20 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MAX 23:22 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP5_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MIN 25:24 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MAX 27:26 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP6_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MIN 29:28 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MAX 31:30 /* RWNVF */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_0_CLIP7_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1 0x00400530 /* RW-4R */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MIN 1:0 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MAX 3:2 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP8_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MIN 5:4 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MAX 7:6 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP9_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MIN 9:8 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MAX 11:10 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP10_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MIN 13:12 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP11MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MAX 15:14 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP11_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MIN 17:16 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MAX 19:18 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP12_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MIN 21:20 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MAX 23:22 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP13_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MIN 25:24 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MAX 27:26 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP14_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MIN 29:28 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MIN_GT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MIN_LT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MIN_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MAX 31:30 /* RWNVF */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MAX_LT 0x00000000 /* RW--V */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MAX_GT 0x00000001 /* RWN-V */ +#define NV_PGRAPH_CLIPY_1_CLIP15_MAX_EQ 0x00000002 /* RW--V */ +#define NV_PGRAPH_MISC24_0 0x00400510 /* RW-4R */ +#define NV_PGRAPH_MISC24_0_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_MISC24_1 0x00400570 /* RW-4R */ +#define NV_PGRAPH_MISC24_1_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_MISC24_2 0x00400574 /* RW-4R */ +#define NV_PGRAPH_MISC24_2_VALUE 23:0 /* RWXUF */ +#define NV_PGRAPH_PASSTHRU_0 0x0040057C /* RW-4R */ +#define NV_PGRAPH_PASSTHRU_0_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_PASSTHRU_1 0x00400580 /* RW-4R */ +#define NV_PGRAPH_PASSTHRU_1_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_PASSTHRU_2 0x00400584 /* RW-4R */ +#define NV_PGRAPH_PASSTHRU_2_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_U_RAM(i) (0x00400d00+(i)*4) /* RW-4A */ +#define NV_PGRAPH_U_RAM__SIZE_1 16 /* */ +#define NV_PGRAPH_U_RAM_VALUE 31:6 /* RWXFF */ +#define NV_PGRAPH_V_RAM(i) (0x00400d40+(i)*4) /* RW-4A */ +#define NV_PGRAPH_V_RAM__SIZE_1 16 /* */ +#define NV_PGRAPH_V_RAM_VALUE 31:6 /* RWXFF */ +#define NV_PGRAPH_M_RAM(i) (0x00400d80+(i)*4) /* RW-4A */ +#define NV_PGRAPH_M_RAM__SIZE_1 16 /* */ +#define NV_PGRAPH_M_RAM_VALUE 31:6 /* RWXFF */ +#define NV_PGRAPH_DMA_START_0 0x00401000 /* RW-4R */ +#define NV_PGRAPH_DMA_START_0_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_START_1 0x00401004 /* RW-4R */ +#define NV_PGRAPH_DMA_START_1_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_LENGTH 0x00401008 /* RW-4R */ +#define NV_PGRAPH_DMA_LENGTH_VALUE 21:0 /* RWXUF */ +#define NV_PGRAPH_DMA_MISC 0x0040100C /* RW-4R */ +#define NV_PGRAPH_DMA_MISC_COUNT 15:0 /* RWXUF */ +#define NV_PGRAPH_DMA_MISC_FMT_SRC 18:16 /* RWXVF */ +#define NV_PGRAPH_DMA_MISC_FMT_DST 22:20 /* RWXVF */ +#define NV_PGRAPH_DMA_DATA_0 0x00401020 /* RW-4R */ +#define NV_PGRAPH_DMA_DATA_0_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_DATA_1 0x00401024 /* RW-4R */ +#define NV_PGRAPH_DMA_DATA_1_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_RM 0x00401030 /* RW-4R */ +#define NV_PGRAPH_DMA_RM_ASSIST_A 0:0 /* RWIVF */ +#define NV_PGRAPH_DMA_RM_ASSIST_A_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_DMA_RM_ASSIST_A_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_DMA_RM_ASSIST_A_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_DMA_RM_ASSIST_B 1:1 /* RWIVF */ +#define NV_PGRAPH_DMA_RM_ASSIST_B_NOT_PENDING 0x00000000 /* R-I-V */ +#define NV_PGRAPH_DMA_RM_ASSIST_B_PENDING 0x00000001 /* R---V */ +#define NV_PGRAPH_DMA_RM_ASSIST_B_RESET 0x00000001 /* -W--C */ +#define NV_PGRAPH_DMA_RM_WRITE_REQ 4:4 /* CWIVF */ +#define NV_PGRAPH_DMA_RM_WRITE_REQ_NOT_PENDING 0x00000000 /* CWI-V */ +#define NV_PGRAPH_DMA_RM_WRITE_REQ_PENDING 0x00000001 /* -W--T */ +#define NV_PGRAPH_DMA_A_XLATE_INST 0x00401040 /* RW-4R */ +#define NV_PGRAPH_DMA_A_XLATE_INST_VALUE 15:0 /* RWXUF */ +#define NV_PGRAPH_DMA_A_CONTROL 0x00401044 /* RW-4R */ +#define NV_PGRAPH_DMA_A_CONTROL_PAGE_TABLE 12:12 /* RWIVF */ +#define NV_PGRAPH_DMA_A_CONTROL_PAGE_TABLE_NOT_PRESENT 0x00000000 /* RWI-V */ +#define NV_PGRAPH_DMA_A_CONTROL_PAGE_TABLE_PRESENT 0x00000001 /* RW--V */ +#define NV_PGRAPH_DMA_A_CONTROL_PAGE_ENTRY 13:13 /* RWXVF */ +#define NV_PGRAPH_DMA_A_CONTROL_PAGE_ENTRY_NOT_LINEAR 0x00000000 /* RW--V */ +#define NV_PGRAPH_DMA_A_CONTROL_PAGE_ENTRY_LINEAR 0x00000001 /* RW--V */ +#define NV_PGRAPH_DMA_A_CONTROL_TARGET_NODE 17:16 /* RWXUF */ +#define NV_PGRAPH_DMA_A_CONTROL_TARGET_NODE_NVM 0x00000000 /* RW--V */ +#define NV_PGRAPH_DMA_A_CONTROL_TARGET_NODE_PCI 0x00000002 /* RW--V */ +#define NV_PGRAPH_DMA_A_CONTROL_TARGET_NODE_AGP 0x00000003 /* RW--V */ +#define NV_PGRAPH_DMA_A_CONTROL_ADJUST 31:20 /* RWXUF */ +#define NV_PGRAPH_DMA_A_LIMIT 0x00401048 /* RW-4R */ +#define NV_PGRAPH_DMA_A_LIMIT_OFFSET 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_A_TLB_PTE 0x0040104C /* RW-4R */ +#define NV_PGRAPH_DMA_A_TLB_PTE_ACCESS 1:1 /* RWXVF */ +#define NV_PGRAPH_DMA_A_TLB_PTE_ACCESS_READ_ONLY 0x00000000 /* RW--V */ +#define NV_PGRAPH_DMA_A_TLB_PTE_ACCESS_READ_WRITE 0x00000001 /* RW--V */ +#define NV_PGRAPH_DMA_A_TLB_PTE_FRAME_ADDRESS 31:12 /* RWXUF */ +#define NV_PGRAPH_DMA_A_TLB_TAG 0x00401050 /* RW-4R */ +#define NV_PGRAPH_DMA_A_TLB_TAG_ADDRESS 31:12 /* RWXUF */ +#define NV_PGRAPH_DMA_A_ADJ_OFFSET 0x00401054 /* RW-4R */ +#define NV_PGRAPH_DMA_A_ADJ_OFFSET_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_A_OFFSET 0x00401058 /* RW-4R */ +#define NV_PGRAPH_DMA_A_OFFSET_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_A_SIZE 0x0040105C /* RW-4R */ +#define NV_PGRAPH_DMA_A_SIZE_VALUE 24:0 /* RWXUF */ +#define NV_PGRAPH_DMA_A_Y_SIZE 0x00401060 /* RW-4R */ +#define NV_PGRAPH_DMA_A_Y_SIZE_VALUE 10:0 /* RWXUF */ +#define NV_PGRAPH_DMA_B_XLATE_INST 0x00401080 /* RW-4R */ +#define NV_PGRAPH_DMA_B_XLATE_INST_VALUE 15:0 /* RWXUF */ +#define NV_PGRAPH_DMA_B_CONTROL 0x00401084 /* RW-4R */ +#define NV_PGRAPH_DMA_B_CONTROL_PAGE_TABLE 12:12 /* RWIVF */ +#define NV_PGRAPH_DMA_B_CONTROL_PAGE_TABLE_NOT_PRESENT 0x00000000 /* RWI-V */ +#define NV_PGRAPH_DMA_B_CONTROL_PAGE_TABLE_PRESENT 0x00000001 /* RW--V */ +#define NV_PGRAPH_DMA_B_CONTROL_PAGE_ENTRY 13:13 /* RWXVF */ +#define NV_PGRAPH_DMA_B_CONTROL_PAGE_ENTRY_NOT_LINEAR 0x00000000 /* RW--V */ +#define NV_PGRAPH_DMA_B_CONTROL_PAGE_ENTRY_LINEAR 0x00000001 /* RW--V */ +#define NV_PGRAPH_DMA_B_CONTROL_TARGET_NODE 17:16 /* RWXUF */ +#define NV_PGRAPH_DMA_B_CONTROL_TARGET_NODE_NVM 0x00000000 /* RW--V */ +#define NV_PGRAPH_DMA_B_CONTROL_TARGET_NODE_PCI 0x00000002 /* RW--V */ +#define NV_PGRAPH_DMA_B_CONTROL_TARGET_NODE_AGP 0x00000003 /* RW--V */ +#define NV_PGRAPH_DMA_B_CONTROL_ADJUST 31:20 /* RWXUF */ +#define NV_PGRAPH_DMA_B_LIMIT 0x00401088 /* RW-4R */ +#define NV_PGRAPH_DMA_B_LIMIT_OFFSET 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_B_TLB_PTE 0x0040108C /* RW-4R */ +#define NV_PGRAPH_DMA_B_TLB_PTE_ACCESS 1:1 /* RWXVF */ +#define NV_PGRAPH_DMA_B_TLB_PTE_ACCESS_READ_ONLY 0x00000000 /* RW--V */ +#define NV_PGRAPH_DMA_B_TLB_PTE_ACCESS_READ_WRITE 0x00000001 /* RW--V */ +#define NV_PGRAPH_DMA_B_TLB_PTE_FRAME_ADDRESS 31:12 /* RWXUF */ +#define NV_PGRAPH_DMA_B_TLB_TAG 0x00401090 /* RW-4R */ +#define NV_PGRAPH_DMA_B_TLB_TAG_ADDRESS 31:12 /* RWXUF */ +#define NV_PGRAPH_DMA_B_ADJ_OFFSET 0x00401094 /* RW-4R */ +#define NV_PGRAPH_DMA_B_ADJ_OFFSET_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_B_OFFSET 0x00401098 /* RW-4R */ +#define NV_PGRAPH_DMA_B_OFFSET_VALUE 31:0 /* RWXUF */ +#define NV_PGRAPH_DMA_B_SIZE 0x0040109C /* RW-4R */ +#define NV_PGRAPH_DMA_B_SIZE_VALUE 24:0 /* RWXUF */ +#define NV_PGRAPH_DMA_B_Y_SIZE 0x004010A0 /* RW-4R */ +#define NV_PGRAPH_DMA_B_Y_SIZE_VALUE 10:0 /* RWXUF */ + +/* Framebuffer registers */ +#define NV_PFB 0x00100FFF:0x00100000 /* RW--D */ +#define NV_PFB_BOOT_0 0x00100000 /* RW-4R */ +#define NV_PFB_BOOT_0_RAM_AMOUNT 1:0 /* RW-VF */ +#define NV_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_WIDTH_128 2:2 /* RW-VF */ +#define NV_PFB_BOOT_0_RAM_WIDTH_128_OFF 0x00000000 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_WIDTH_128_ON 0x00000001 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_TYPE 4:3 /* RW-VF */ +#define NV_PFB_BOOT_0_RAM_TYPE_256K 0x00000000 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_TYPE_512K_2BANK 0x00000001 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_TYPE_512K_4BANK 0x00000002 /* RW--V */ +#define NV_PFB_BOOT_0_RAM_TYPE_1024K_2BANK 0x00000003 /* RW--V */ +#define NV_PFB_CONFIG_0 0x00100200 /* RW-4R */ +#define NV_PFB_CONFIG_0_TYPE 14:0 /* RWIVF */ +#define NV_PFB_CONFIG_0_TYPE_OLD1024_FIXED_8BPP 0x00000120 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_OLD1024_FIXED_16BPP 0x00000220 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_OLD1024_FIXED_32BPP 0x00000320 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_OLD1024_VAR_8BPP 0x00004120 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_OLD1024_VAR_16BPP 0x00004220 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_OLD1024_VAR_32BPP 0x00004320 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_TETRIS 0x00002000 /* RW--V */ +#define NV_PFB_CONFIG_0_TYPE_NOTILING 0x00001114 /* RWI-V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE 17:15 /* RWI-F */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_PASS 0x00000000 /* RWI-V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_1 0x00000001 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_2 0x00000002 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_3 0x00000003 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_4 0x00000004 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_5 0x00000005 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_6 0x00000006 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_MODE_7 0x00000007 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_SHIFT 19:18 /* RWI-F */ +#define NV_PFB_CONFIG_0_TETRIS_SHIFT_0 0x00000000 /* RWI-V */ +#define NV_PFB_CONFIG_0_TETRIS_SHIFT_1 0x00000001 /* RW--V */ +#define NV_PFB_CONFIG_0_TETRIS_SHIFT_2 0x00000002 /* RW--V */ +#define NV_PFB_CONFIG_0_BANK_SWAP 22:20 /* RWI-F */ +#define NV_PFB_CONFIG_0_BANK_SWAP_OFF 0x00000000 /* RWI-V */ +#define NV_PFB_CONFIG_0_BANK_SWAP_1M 0x00000001 /* RW--V */ +#define NV_PFB_CONFIG_0_BANK_SWAP_2M 0x00000005 /* RW--V */ +#define NV_PFB_CONFIG_0_BANK_SWAP_4M 0x00000007 /* RW--V */ +#define NV_PFB_CONFIG_0_UNUSED 23:23 /* RW-VF */ +#define NV_PFB_CONFIG_0_SCRAMBLE_EN 29:29 /* RWIVF */ +#define NV_PFB_CONFIG_0_SCRAMBLE_EN_INIT 0x00000000 /* RW--V */ +#define NV_PFB_CONFIG_0_SCRAMBLE_ACTIVE 0x00000001 /* RW--V */ +#define NV_PFB_CONFIG_0_PRAMIN_WR 28:28 /* RWIVF */ +#define NV_PFB_CONFIG_0_PRAMIN_WR_INIT 0x00000000 /* RW--V */ +#define NV_PFB_CONFIG_0_PRAMIN_WR_DISABLED 0x00000001 /* RW--V */ +#define NV_PFB_CONFIG_0_PRAMIN_WR_MASK 27:24 /* RWIVF */ +#define NV_PFB_CONFIG_0_PRAMIN_WR_MASK_INIT 0x00000000 /* RWI-V */ +#define NV_PFB_CONFIG_0_PRAMIN_WR_MASK_CLEAR 0x0000000f /* RWI-V */ +#define NV_PFB_CONFIG_1 0x00100204 /* RW-4R */ +#define NV_PFB_RTL 0x00100300 /* RW-4R */ +#define NV_PFB_RTL_H 0:0 /* RWIUF */ +#define NV_PFB_RTL_H_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PFB_RTL_MC 1:1 /* RWIUF */ +#define NV_PFB_RTL_MC_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PFB_RTL_V 2:2 /* RWIUF */ +#define NV_PFB_RTL_V_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PFB_RTL_G 3:3 /* RWIUF */ +#define NV_PFB_RTL_G_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PFB_RTL_GB 4:4 /* RWIUF */ +#define NV_PFB_RTL_GB_DEFAULT 0x00000000 /* RWI-V */ +#define NV_PFB_CONFIG_0_RESOLUTION 5:0 /* RWIVF */ +#define NV_PFB_CONFIG_0_RESOLUTION_320_PIXELS 0x0000000a /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_400_PIXELS 0x0000000d /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_480_PIXELS 0x0000000f /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_512_PIXELS 0x00000010 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_640_PIXELS 0x00000014 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_800_PIXELS 0x00000019 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_960_PIXELS 0x0000001e /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_1024_PIXELS 0x00000020 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_1152_PIXELS 0x00000024 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_1280_PIXELS 0x00000028 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_1600_PIXELS 0x00000032 /* RW--V */ +#define NV_PFB_CONFIG_0_RESOLUTION_DEFAULT 0x00000014 /* RWI-V */ +#define NV_PFB_CONFIG_0_PIXEL_DEPTH 9:8 /* RWIVF */ +#define NV_PFB_CONFIG_0_PIXEL_DEPTH_8_BITS 0x00000001 /* RW--V */ +#define NV_PFB_CONFIG_0_PIXEL_DEPTH_16_BITS 0x00000002 /* RW--V */ +#define NV_PFB_CONFIG_0_PIXEL_DEPTH_32_BITS 0x00000003 /* RW--V */ +#define NV_PFB_CONFIG_0_PIXEL_DEPTH_DEFAULT 0x00000001 /* RWI-V */ +#define NV_PFB_CONFIG_0_TILING 12:12 /* RWIVF */ +#define NV_PFB_CONFIG_0_TILING_ENABLED 0x00000000 /* RW--V */ +#define NV_PFB_CONFIG_0_TILING_DISABLED 0x00000001 /* RWI-V */ +#define NV_PFB_CONFIG_1_SGRAM100 3:3 /* RWIVF */ +#define NV_PFB_CONFIG_1_SGRAM100_ENABLED 0x00000000 /* RWI-V */ +#define NV_PFB_CONFIG_1_SGRAM100_DISABLED 0x00000001 /* RW--V */ +#define NV_PFB_DEBUG_0_CKE_ALWAYSON 29:29 /* RWIVF */ +#define NV_PFB_DEBUG_0_CKE_ALWAYSON_OFF 0x00000000 /* RW--V */ +#define NV_PFB_DEBUG_0_CKE_ALWAYSON_ON 0x00000001 /* RWI-V */ + +#define NV_PEXTDEV 0x00101FFF:0x00101000 /* RW--D */ +#define NV_PEXTDEV_BOOT_0 0x00101000 /* R--4R */ +#define NV_PEXTDEV_BOOT_0_STRAP_BUS_SPEED 0:0 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_BUS_SPEED_33MHZ 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_BUS_SPEED_66MHZ 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_SUB_VENDOR 1:1 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_SUB_VENDOR_NO_BIOS 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_SUB_VENDOR_BIOS 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_TYPE 3:2 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_TYPE_SGRAM_256K 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_TYPE_SGRAM_512K_2BANK 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_TYPE_SGRAM_512K_4BANK 0x00000002 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_TYPE_1024K_2BANK 0x00000003 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_WIDTH 4:4 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_WIDTH_64 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_RAM_WIDTH_128 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_BUS_TYPE 5:5 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_BUS_TYPE_PCI 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_BUS_TYPE_AGP 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_CRYSTAL 6:6 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_CRYSTAL_13500K 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_CRYSTAL_14318180 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_TVMODE 8:7 /* R-XVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_TVMODE_SECAM 0x00000000 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_TVMODE_NTSC 0x00000001 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_TVMODE_PAL 0x00000002 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_TVMODE_DISABLED 0x00000003 /* R---V */ +#define NV_PEXTDEV_BOOT_0_STRAP_OVERWRITE 11:11 /* RWIVF */ +#define NV_PEXTDEV_BOOT_0_STRAP_OVERWRITE_DISABLED 0x00000000 /* RWI-V */ +#define NV_PEXTDEV_BOOT_0_STRAP_OVERWRITE_ENABLED 0x00000001 /* RW--V */ + +/* Extras */ +#define NV_PRAMIN 0x007FFFFF:0x00700000 /* RW--M */ +/*#define NV_PRAMIN 0x00FFFFFF:0x00C00000*/ +#define NV_PNVM 0x01FFFFFF:0x01000000 /* RW--M */ +/*#define NV_PNVM 0x00BFFFFF:0x00800000*/ +#define NV_CHAN0 0x0080ffff:0x00800000 + +/* FIFO subchannels */ +#define NV_UROP 0x43 +#define NV_UCHROMA 0x57 +#define NV_UCLIP 0x19 +#define NV_UPATT 0x18 +#define NV_ULIN 0x5C +#define NV_UTRI 0x5D +#define NV_URECT 0x5E +#define NV_UBLIT 0x5F +#define NV_UGLYPH 0x4B + +#endif /*__NV4REF_H__*/ + diff -u --recursive --new-file v2.3.25/linux/drivers/video/nvreg.h linux/drivers/video/nvreg.h --- v2.3.25/linux/drivers/video/nvreg.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/nvreg.h Tue Nov 2 08:15:05 1999 @@ -0,0 +1,188 @@ +/* $XConsortium: nvreg.h /main/2 1996/10/28 05:13:41 kaleb $ */ +/* + * Copyright 1996-1997 David J. McKay + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * DAVID J. MCKAY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/nv/nvreg.h,v 3.2.2.1 1998/01/18 10:35:36 hohndel Exp $ */ + +#ifndef __NVREG_H_ +#define __NVREG_H_ + +/* Little macro to construct bitmask for contiguous ranges of bits */ +#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) +#define MASKEXPAND(mask) BITMASK(1?mask,0?mask) + +/* Macro to set specific bitfields (mask has to be a macro x:y) ! */ +#define SetBF(mask,value) ((value) << (0?mask)) +#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) + +#define MaskAndSetBF(var,mask,value) (var)=(((var)&(~MASKEXPAND(mask)) \ + | SetBF(mask,value))) + +#define DEVICE_BASE(device) (0?NV##_##device) +#define DEVICE_SIZE(device) ((1?NV##_##device) - DEVICE_BASE(device)+1) + +/* This is where we will have to have conditional compilation */ +#define DEVICE_ACCESS(device,reg) \ + nvCONTROL[(NV_##device##_##reg)/4] + +#define DEVICE_WRITE(device,reg,value) DEVICE_ACCESS(device,reg)=(value) +#define DEVICE_READ(device,reg) DEVICE_ACCESS(device,reg) +#define DEVICE_PRINT(device,reg) \ + ErrorF("NV_"#device"_"#reg"=#%08lx\n",DEVICE_ACCESS(device,reg)) +#define DEVICE_DEF(device,mask,value) \ + SetBF(NV_##device##_##mask,NV_##device##_##mask##_##value) +#define DEVICE_VALUE(device,mask,value) SetBF(NV_##device##_##mask,value) +#define DEVICE_MASK(device,mask) MASKEXPAND(NV_##device##_##mask) + +#define PDAC_Write(reg,value) DEVICE_WRITE(PDAC,reg,value) +#define PDAC_Read(reg) DEVICE_READ(PDAC,reg) +#define PDAC_Print(reg) DEVICE_PRINT(PDAC,reg) +#define PDAC_Def(mask,value) DEVICE_DEF(PDAC,mask,value) +#define PDAC_Val(mask,value) DEVICE_VALUE(PDAC,mask,value) +#define PDAC_Mask(mask) DEVICE_MASK(PDAC,mask) + +#define PFB_Write(reg,value) DEVICE_WRITE(PFB,reg,value) +#define PFB_Read(reg) DEVICE_READ(PFB,reg) +#define PFB_Print(reg) DEVICE_PRINT(PFB,reg) +#define PFB_Def(mask,value) DEVICE_DEF(PFB,mask,value) +#define PFB_Val(mask,value) DEVICE_VALUE(PFB,mask,value) +#define PFB_Mask(mask) DEVICE_MASK(PFB,mask) + +#define PRM_Write(reg,value) DEVICE_WRITE(PRM,reg,value) +#define PRM_Read(reg) DEVICE_READ(PRM,reg) +#define PRM_Print(reg) DEVICE_PRINT(PRM,reg) +#define PRM_Def(mask,value) DEVICE_DEF(PRM,mask,value) +#define PRM_Val(mask,value) DEVICE_VALUE(PRM,mask,value) +#define PRM_Mask(mask) DEVICE_MASK(PRM,mask) + +#define PGRAPH_Write(reg,value) DEVICE_WRITE(PGRAPH,reg,value) +#define PGRAPH_Read(reg) DEVICE_READ(PGRAPH,reg) +#define PGRAPH_Print(reg) DEVICE_PRINT(PGRAPH,reg) +#define PGRAPH_Def(mask,value) DEVICE_DEF(PGRAPH,mask,value) +#define PGRAPH_Val(mask,value) DEVICE_VALUE(PGRAPH,mask,value) +#define PGRAPH_Mask(mask) DEVICE_MASK(PGRAPH,mask) + +#define PDMA_Write(reg,value) DEVICE_WRITE(PDMA,reg,value) +#define PDMA_Read(reg) DEVICE_READ(PDMA,reg) +#define PDMA_Print(reg) DEVICE_PRINT(PDMA,reg) +#define PDMA_Def(mask,value) DEVICE_DEF(PDMA,mask,value) +#define PDMA_Val(mask,value) DEVICE_VALUE(PDMA,mask,value) +#define PDMA_Mask(mask) DEVICE_MASK(PDMA,mask) + +#define PTIMER_Write(reg,value) DEVICE_WRITE(PTIMER,reg,value) +#define PTIMER_Read(reg) DEVICE_READ(PTIMER,reg) +#define PTIMER_Print(reg) DEVICE_PRINT(PTIMER,reg) +#define PTIMER_Def(mask,value) DEVICE_DEF(PTIMER,mask,value) +#define PTIMER_Val(mask,value) DEVICE_VALUE(PTIEMR,mask,value) +#define PTIMER_Mask(mask) DEVICE_MASK(PTIMER,mask) + +#define PEXTDEV_Write(reg,value) DEVICE_WRITE(PEXTDEV,reg,value) +#define PEXTDEV_Read(reg) DEVICE_READ(PEXTDEV,reg) +#define PEXTDEV_Print(reg) DEVICE_PRINT(PEXTDEV,reg) +#define PEXTDEV_Def(mask,value) DEVICE_DEF(PEXTDEV,mask,value) +#define PEXTDEV_Val(mask,value) DEVICE_VALUE(PEXTDEV,mask,value) +#define PEXTDEV_Mask(mask) DEVICE_MASK(PEXTDEV,mask) + +#define PFIFO_Write(reg,value) DEVICE_WRITE(PFIFO,reg,value) +#define PFIFO_Read(reg) DEVICE_READ(PFIFO,reg) +#define PFIFO_Print(reg) DEVICE_PRINT(PFIFO,reg) +#define PFIFO_Def(mask,value) DEVICE_DEF(PFIFO,mask,value) +#define PFIFO_Val(mask,value) DEVICE_VALUE(PFIFO,mask,value) +#define PFIFO_Mask(mask) DEVICE_MASK(PFIFO,mask) + +#define PRAM_Write(reg,value) DEVICE_WRITE(PRAM,reg,value) +#define PRAM_Read(reg) DEVICE_READ(PRAM,reg) +#define PRAM_Print(reg) DEVICE_PRINT(PRAM,reg) +#define PRAM_Def(mask,value) DEVICE_DEF(PRAM,mask,value) +#define PRAM_Val(mask,value) DEVICE_VALUE(PRAM,mask,value) +#define PRAM_Mask(mask) DEVICE_MASK(PRAM,mask) + +#define PRAMFC_Write(reg,value) DEVICE_WRITE(PRAMFC,reg,value) +#define PRAMFC_Read(reg) DEVICE_READ(PRAMFC,reg) +#define PRAMFC_Print(reg) DEVICE_PRINT(PRAMFC,reg) +#define PRAMFC_Def(mask,value) DEVICE_DEF(PRAMFC,mask,value) +#define PRAMFC_Val(mask,value) DEVICE_VALUE(PRAMFC,mask,value) +#define PRAMFC_Mask(mask) DEVICE_MASK(PRAMFC,mask) + +#define PMC_Write(reg,value) DEVICE_WRITE(PMC,reg,value) +#define PMC_Read(reg) DEVICE_READ(PMC,reg) +#define PMC_Print(reg) DEVICE_PRINT(PMC,reg) +#define PMC_Def(mask,value) DEVICE_DEF(PMC,mask,value) +#define PMC_Val(mask,value) DEVICE_VALUE(PMC,mask,value) +#define PMC_Mask(mask) DEVICE_MASK(PMC,mask) + +#define PMC_Write(reg,value) DEVICE_WRITE(PMC,reg,value) +#define PMC_Read(reg) DEVICE_READ(PMC,reg) +#define PMC_Print(reg) DEVICE_PRINT(PMC,reg) +#define PMC_Def(mask,value) DEVICE_DEF(PMC,mask,value) +#define PMC_Val(mask,value) DEVICE_VALUE(PMC,mask,value) +#define PMC_Mask(mask) DEVICE_MASK(PMC,mask) + + +#define PBUS_Write(reg,value) DEVICE_WRITE(PBUS,reg,value) +#define PBUS_Read(reg) DEVICE_READ(PBUS,reg) +#define PBUS_Print(reg) DEVICE_PRINT(PBUS,reg) +#define PBUS_Def(mask,value) DEVICE_DEF(PBUS,mask,value) +#define PBUS_Val(mask,value) DEVICE_VALUE(PBUS,mask,value) +#define PBUS_Mask(mask) DEVICE_MASK(PBUS,mask) + + +#define PRAMDAC_Write(reg,value) DEVICE_WRITE(PRAMDAC,reg,value) +#define PRAMDAC_Read(reg) DEVICE_READ(PRAMDAC,reg) +#define PRAMDAC_Print(reg) DEVICE_PRINT(PRAMDAC,reg) +#define PRAMDAC_Def(mask,value) DEVICE_DEF(PRAMDAC,mask,value) +#define PRAMDAC_Val(mask,value) DEVICE_VALUE(PRAMDAC,mask,value) +#define PRAMDAC_Mask(mask) DEVICE_MASK(PRAMDAC,mask) + + +#define PDAC_ReadExt(reg) \ + ((PDAC_Write(INDEX_LO,(NV_PDAC_EXT_##reg) & 0xff)),\ + (PDAC_Write(INDEX_HI,((NV_PDAC_EXT_##reg) >> 8) & 0xff)),\ + (PDAC_Read(INDEX_DATA))) + +#define PDAC_WriteExt(reg,value)\ + ((PDAC_Write(INDEX_LO,(NV_PDAC_EXT_##reg) & 0xff)),\ + (PDAC_Write(INDEX_HI,((NV_PDAC_EXT_##reg) >> 8) & 0xff)),\ + (PDAC_Write(INDEX_DATA,(value)))) + +#define CRTC_Write(index,value) outb((index), 0x3d4); outb(value, 0x3d5) +#define CRTC_Read(index) (outb(index, 0x3d4),inb(0x3d5)) + +#define PCRTC_Write(index,value) CRTC_Write(NV_PCRTC_##index,value) +#define PCRTC_Read(index) CRTC_Read(NV_PCRTC_##index) + +#define PCRTC_Def(mask,value) DEVICE_DEF(PCRTC,mask,value) +#define PCRTC_Val(mask,value) DEVICE_VALUE(PCRTC,mask,value) +#define PCRTC_Mask(mask) DEVICE_MASK(PCRTC,mask) + +#define SR_Write(index,value) outb(0x3c4,(index));outb(0x3c5,value) +#define SR_Read(index) (outb(0x3c4,index),inb(0x3c5)) + +extern volatile unsigned *nvCONTROL; + +typedef enum {NV1,NV3,NV4,NumNVChips} NVChipType; + +NVChipType GetChipType(void); + +#endif + + diff -u --recursive --new-file v2.3.25/linux/drivers/video/riva_hw.c linux/drivers/video/riva_hw.c --- v2.3.25/linux/drivers/video/riva_hw.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/riva_hw.c Tue Nov 2 08:15:05 1999 @@ -0,0 +1,1429 @@ + /***************************************************************************\ +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: The source code is copyrighted under U.S. and *| +|* international laws. Users and possessors of this source code are *| +|* hereby granted a nonexclusive, royalty-free copyright license to *| +|* use this code in individual and commercial software. *| +|* *| +|* Any use of this source code must include, in the user documenta- *| +|* tion and internal comments to the code, notices to the end user *| +|* as follows: *| +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *| +|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *| +|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *| +|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *| +|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *| +|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *| +|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *| +|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *| +|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *| +|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial *| +|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial *| +|* computer software documentation," as such terms are used in *| +|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *| +|* ment only as a commercial end item. Consistent with 48 C.F.R. *| +|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the source code with only *| +|* those rights set forth herein. *| +|* *| + \***************************************************************************/ +/* + * GPL licensing note -- nVidia is allowing a liberal interpretation of + * the documentation restriction above, to merely say that this nVidia's + * copyright and disclaimer should be included with all code derived + * from this source. -- Jeff Garzik , 01/Nov/99 + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/nv/riva_hw.c,v 1.1.2.3 1998/12/26 00:12:39 dawes Exp $ */ + +#include +#include +#include +#include "riva_hw.h" +#include "riva_tbl.h" + + +/* + * This file is an OS-agnostic file used to make RIVA 128 and RIVA TNT + * operate identically (except TNT has more memory and better 3D quality. + */ + +static int nv3Busy +( + RIVA_HW_INST *chip +) +{ + return ((!(chip->PFIFO[0x00001214/4] & 0x10)) | (chip->PGRAPH[0x000006B0/4] & 0x01)); +} +static int nv4Busy +( + RIVA_HW_INST *chip +) +{ + return ((!(chip->PFIFO[0x00001214/4] & 0x10)) | (chip->PGRAPH[0x00000700/4] & 0x01)); +} +static int ShowHideCursor +( + RIVA_HW_INST *chip, + int ShowHide +) +{ + int xcurrent; + xcurrent = chip->CurrentState->cursor1; + chip->CurrentState->cursor1 = (chip->CurrentState->cursor1 & 0xFE) | (ShowHide & 0x01); + outb(0x31, 0x3D4); + outb(chip->CurrentState->cursor1, 0x3D5); + return (xcurrent & 0x01); +} + +/****************************************************************************\ +* * +* The video arbitration routines calculate some "magic" numbers. Fixes * +* the snow seen when accessing the framebuffer without it. * +* It just works (I hope). * +* * +\****************************************************************************/ + +#define DEFAULT_GR_LWM 100 +#define DEFAULT_VID_LWM 100 +#define DEFAULT_GR_BURST_SIZE 256 +#define DEFAULT_VID_BURST_SIZE 128 +#define VIDEO 0 +#define GRAPHICS 1 +#define MPORT 2 +#define ENGINE 3 +#define GFIFO_SIZE 320 +#define GFIFO_SIZE_128 256 +#define MFIFO_SIZE 120 +#define VFIFO_SIZE 256 +#define ABS(a) (a>0?a:-a) +typedef struct { + int gdrain_rate; + int vdrain_rate; + int mdrain_rate; + int gburst_size; + int vburst_size; + char vid_en; + char gr_en; + int wcmocc, wcgocc, wcvocc, wcvlwm, wcglwm; + int by_gfacc; + char vid_only_once; + char gr_only_once; + char first_vacc; + char first_gacc; + char first_macc; + int vocc; + int gocc; + int mocc; + char cur; + char engine_en; + char converged; + int priority; +} nv3_arb_info; +typedef struct { + int graphics_lwm; + int video_lwm; + int graphics_burst_size; + int video_burst_size; + int graphics_hi_priority; + int media_hi_priority; + int rtl_values; + int valid; +} nv3_fifo_info; +typedef struct { + char pix_bpp; + char enable_video; + char gr_during_vid; + char enable_mp; + int memory_width; + int video_scale; + int pclk_khz; + int mclk_khz; + int mem_page_miss; + int mem_latency; + char mem_aligned; +} nv3_sim_state; +typedef struct { + int graphics_lwm; + int video_lwm; + int graphics_burst_size; + int video_burst_size; + int valid; +} nv4_fifo_info; +typedef struct { + int pclk_khz; + int mclk_khz; + int nvclk_khz; + char mem_page_miss; + char mem_latency; + int memory_width; + char enable_video; + char gr_during_vid; + char pix_bpp; + char mem_aligned; + char enable_mp; +} nv4_sim_state; +static int nv3_iterate(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_arb_info *ainfo) +{ + int iter = 0; + int tmp, t; + int vfsize, mfsize, gfsize; + int mburst_size = 32; + int mmisses, gmisses, vmisses; + int misses; + int vlwm, glwm, mlwm; + int last, next, cur; + int max_gfsize ; + long ns; + + vlwm = 0; + glwm = 0; + mlwm = 0; + vfsize = 0; + gfsize = 0; + cur = ainfo->cur; + mmisses = 2; + gmisses = 2; + vmisses = 2; + if (ainfo->gburst_size == 128) max_gfsize = GFIFO_SIZE_128; + else max_gfsize = GFIFO_SIZE; + max_gfsize = GFIFO_SIZE; + while (1) + { + if (ainfo->vid_en) + { + if (ainfo->wcvocc > ainfo->vocc) ainfo->wcvocc = ainfo->vocc; + if (ainfo->wcvlwm > vlwm) ainfo->wcvlwm = vlwm ; + ns = 1000000 * ainfo->vburst_size/(state->memory_width/8)/state->mclk_khz; + vfsize = ns * ainfo->vdrain_rate / 1000000; + vfsize = ainfo->wcvlwm - ainfo->vburst_size + vfsize; + } + if (state->enable_mp) + { + if (ainfo->wcmocc > ainfo->mocc) ainfo->wcmocc = ainfo->mocc; + } + if (ainfo->gr_en) + { + if (ainfo->wcglwm > glwm) ainfo->wcglwm = glwm ; + if (ainfo->wcgocc > ainfo->gocc) ainfo->wcgocc = ainfo->gocc; + ns = 1000000 * (ainfo->gburst_size/(state->memory_width/8))/state->mclk_khz; + gfsize = ns *ainfo->gdrain_rate/1000000; + gfsize = ainfo->wcglwm - ainfo->gburst_size + gfsize; + } + mfsize = 0; + if (!state->gr_during_vid && ainfo->vid_en) + if (ainfo->vid_en && (ainfo->vocc < 0) && !ainfo->vid_only_once) + next = VIDEO; + else if (ainfo->mocc < 0) + next = MPORT; + else if (ainfo->gocc< ainfo->by_gfacc) + next = GRAPHICS; + else return (0); + else switch (ainfo->priority) + { + case VIDEO: + if (ainfo->vid_en && ainfo->vocc<0 && !ainfo->vid_only_once) + next = VIDEO; + else if (ainfo->gr_en && ainfo->gocc<0 && !ainfo->gr_only_once) + next = GRAPHICS; + else if (ainfo->mocc<0) + next = MPORT; + else return (0); + break; + case GRAPHICS: + if (ainfo->gr_en && ainfo->gocc<0 && !ainfo->gr_only_once) + next = GRAPHICS; + else if (ainfo->vid_en && ainfo->vocc<0 && !ainfo->vid_only_once) + next = VIDEO; + else if (ainfo->mocc<0) + next = MPORT; + else return (0); + break; + default: + if (ainfo->mocc<0) + next = MPORT; + else if (ainfo->gr_en && ainfo->gocc<0 && !ainfo->gr_only_once) + next = GRAPHICS; + else if (ainfo->vid_en && ainfo->vocc<0 && !ainfo->vid_only_once) + next = VIDEO; + else return (0); + break; + } + last = cur; + cur = next; + iter++; + switch (cur) + { + case VIDEO: + if (last==cur) misses = 0; + else if (ainfo->first_vacc) misses = vmisses; + else misses = 1; + ainfo->first_vacc = 0; + if (last!=cur) + { + ns = 1000000 * (vmisses*state->mem_page_miss + state->mem_latency)/state->mclk_khz; + vlwm = ns * ainfo->vdrain_rate/ 1000000; + vlwm = ainfo->vocc - vlwm; + } + ns = 1000000*(misses*state->mem_page_miss + ainfo->vburst_size)/(state->memory_width/8)/state->mclk_khz; + ainfo->vocc = ainfo->vocc + ainfo->vburst_size - ns*ainfo->vdrain_rate/1000000; + ainfo->gocc = ainfo->gocc - ns*ainfo->gdrain_rate/1000000; + ainfo->mocc = ainfo->mocc - ns*ainfo->mdrain_rate/1000000; + break; + case GRAPHICS: + if (last==cur) misses = 0; + else if (ainfo->first_gacc) misses = gmisses; + else misses = 1; + ainfo->first_gacc = 0; + if (last!=cur) + { + ns = 1000000*(gmisses*state->mem_page_miss + state->mem_latency)/state->mclk_khz ; + glwm = ns * ainfo->gdrain_rate/1000000; + glwm = ainfo->gocc - glwm; + } + ns = 1000000*(misses*state->mem_page_miss + ainfo->gburst_size/(state->memory_width/8))/state->mclk_khz; + ainfo->vocc = ainfo->vocc + 0 - ns*ainfo->vdrain_rate/1000000; + ainfo->gocc = ainfo->gocc + ainfo->gburst_size - ns*ainfo->gdrain_rate/1000000; + ainfo->mocc = ainfo->mocc + 0 - ns*ainfo->mdrain_rate/1000000; + break; + default: + if (last==cur) misses = 0; + else if (ainfo->first_macc) misses = mmisses; + else misses = 1; + ainfo->first_macc = 0; + ns = 1000000*(misses*state->mem_page_miss + mburst_size/(state->memory_width/8))/state->mclk_khz; + ainfo->vocc = ainfo->vocc + 0 - ns*ainfo->vdrain_rate/1000000; + ainfo->gocc = ainfo->gocc + 0 - ns*ainfo->gdrain_rate/1000000; + ainfo->mocc = ainfo->mocc + mburst_size - ns*ainfo->mdrain_rate/1000000; + break; + } + if (iter>100) + { + ainfo->converged = 0; + return (1); + } + ns = 1000000*ainfo->gburst_size/(state->memory_width/8)/state->mclk_khz; + tmp = ns * ainfo->gdrain_rate/1000000; + if (ABS(ainfo->gburst_size) + ((ABS(ainfo->wcglwm) + 16 ) & ~0x7) - tmp > max_gfsize) + { + ainfo->converged = 0; + return (1); + } + ns = 1000000*ainfo->vburst_size/(state->memory_width/8)/state->mclk_khz; + tmp = ns * ainfo->vdrain_rate/1000000; + if (ABS(ainfo->vburst_size) + (ABS(ainfo->wcvlwm + 32) & ~0xf) - tmp> VFIFO_SIZE) + { + ainfo->converged = 0; + return (1); + } + if (ABS(ainfo->gocc) > max_gfsize) + { + ainfo->converged = 0; + return (1); + } + if (ABS(ainfo->vocc) > VFIFO_SIZE) + { + ainfo->converged = 0; + return (1); + } + if (ABS(ainfo->mocc) > MFIFO_SIZE) + { + ainfo->converged = 0; + return (1); + } + if (ABS(vfsize) > VFIFO_SIZE) + { + ainfo->converged = 0; + return (1); + } + if (ABS(gfsize) > max_gfsize) + { + ainfo->converged = 0; + return (1); + } + if (ABS(mfsize) > MFIFO_SIZE) + { + ainfo->converged = 0; + return (1); + } + } +} +static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state, nv3_arb_info *ainfo) +{ + int g, v, not_done; + long ens, vns, mns, gns; + int mmisses, gmisses, vmisses, eburst_size, mburst_size; + int refresh_cycle; + + refresh_cycle = 0; + refresh_cycle = 2*(state->mclk_khz/state->pclk_khz) + 5; + mmisses = 2; + if (state->mem_aligned) gmisses = 2; + else gmisses = 3; + vmisses = 2; + eburst_size = state->memory_width * 1; + mburst_size = 32; + gns = 1000000 * (gmisses*state->mem_page_miss + state->mem_latency)/state->mclk_khz; + ainfo->by_gfacc = gns*ainfo->gdrain_rate/1000000; + ainfo->wcmocc = 0; + ainfo->wcgocc = 0; + ainfo->wcvocc = 0; + ainfo->wcvlwm = 0; + ainfo->wcglwm = 0; + ainfo->engine_en = 1; + ainfo->converged = 1; + if (ainfo->engine_en) + { + ens = 1000000*(state->mem_page_miss + eburst_size/(state->memory_width/8) +refresh_cycle)/state->mclk_khz; + ainfo->mocc = state->enable_mp ? 0-ens*ainfo->mdrain_rate/1000000 : 0; + ainfo->vocc = ainfo->vid_en ? 0-ens*ainfo->vdrain_rate/1000000 : 0; + ainfo->gocc = ainfo->gr_en ? 0-ens*ainfo->gdrain_rate/1000000 : 0; + ainfo->cur = ENGINE; + ainfo->first_vacc = 1; + ainfo->first_gacc = 1; + ainfo->first_macc = 1; + nv3_iterate(res_info, state,ainfo); + } + if (state->enable_mp) + { + mns = 1000000 * (mmisses*state->mem_page_miss + mburst_size/(state->memory_width/8) + refresh_cycle)/state->mclk_khz; + ainfo->mocc = state->enable_mp ? 0 : mburst_size - mns*ainfo->mdrain_rate/1000000; + ainfo->vocc = ainfo->vid_en ? 0 : 0- mns*ainfo->vdrain_rate/1000000; + ainfo->gocc = ainfo->gr_en ? 0: 0- mns*ainfo->gdrain_rate/1000000; + ainfo->cur = MPORT; + ainfo->first_vacc = 1; + ainfo->first_gacc = 1; + ainfo->first_macc = 0; + nv3_iterate(res_info, state,ainfo); + } + if (ainfo->gr_en) + { + ainfo->first_vacc = 1; + ainfo->first_gacc = 0; + ainfo->first_macc = 1; + gns = 1000000*(gmisses*state->mem_page_miss + ainfo->gburst_size/(state->memory_width/8) + refresh_cycle)/state->mclk_khz; + ainfo->gocc = ainfo->gburst_size - gns*ainfo->gdrain_rate/1000000; + ainfo->vocc = ainfo->vid_en? 0-gns*ainfo->vdrain_rate/1000000 : 0; + ainfo->mocc = state->enable_mp ? 0-gns*ainfo->mdrain_rate/1000000: 0; + ainfo->cur = GRAPHICS; + nv3_iterate(res_info, state,ainfo); + } + if (ainfo->vid_en) + { + ainfo->first_vacc = 0; + ainfo->first_gacc = 1; + ainfo->first_macc = 1; + vns = 1000000*(vmisses*state->mem_page_miss + ainfo->vburst_size/(state->memory_width/8) + refresh_cycle)/state->mclk_khz; + ainfo->vocc = ainfo->vburst_size - vns*ainfo->vdrain_rate/1000000; + ainfo->gocc = ainfo->gr_en? (0-vns*ainfo->gdrain_rate/1000000) : 0; + ainfo->mocc = state->enable_mp? 0-vns*ainfo->mdrain_rate/1000000 :0 ; + ainfo->cur = VIDEO; + nv3_iterate(res_info, state, ainfo); + } + if (ainfo->converged) + { + res_info->graphics_lwm = (int)ABS(ainfo->wcglwm) + 16; + res_info->video_lwm = (int)ABS(ainfo->wcvlwm) + 32; + res_info->graphics_burst_size = ainfo->gburst_size; + res_info->video_burst_size = ainfo->vburst_size; + res_info->graphics_hi_priority = (ainfo->priority == GRAPHICS); + res_info->media_hi_priority = (ainfo->priority == MPORT); + if (res_info->video_lwm > 160) + { + res_info->graphics_lwm = 256; + res_info->video_lwm = 128; + res_info->graphics_burst_size = 64; + res_info->video_burst_size = 64; + res_info->graphics_hi_priority = 0; + res_info->media_hi_priority = 0; + ainfo->converged = 0; + return (0); + } + if (res_info->video_lwm > 128) + { + res_info->video_lwm = 128; + } + return (1); + } + else + { + res_info->graphics_lwm = 256; + res_info->video_lwm = 128; + res_info->graphics_burst_size = 64; + res_info->video_burst_size = 64; + res_info->graphics_hi_priority = 0; + res_info->media_hi_priority = 0; + return (0); + } +} +static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_arb_info *ainfo) +{ + int done, g,v, p; + int priority, gburst_size, vburst_size, iter; + + done = 0; + if (state->gr_during_vid && ainfo->vid_en) + ainfo->priority = MPORT; + else + ainfo->priority = ainfo->gdrain_rate < ainfo->vdrain_rate ? VIDEO: GRAPHICS; + for (p=0; p < 2 && done != 1; p++) + { + for (g=128 ; (g > 32) && (done != 1); g= g>> 1) + { + for (v=128; (v >=32) && (done !=1); v = v>> 1) + { + ainfo->priority = p; + ainfo->gburst_size = g; + ainfo->vburst_size = v; + done = nv3_arb(res_info, state,ainfo); + if (g==128) + { + if ((res_info->graphics_lwm + g) > 256) + done = 0; + } + } + } + } + if (!done) + return (0); + else + return (1); +} +static void nv3CalcArbitration +( + nv3_fifo_info * res_info, + nv3_sim_state * state +) +{ + nv3_fifo_info save_info; + nv3_arb_info ainfo; + char res_gr, res_vid; + + ainfo.gr_en = 1; + ainfo.vid_en = state->enable_video; + ainfo.vid_only_once = 0; + ainfo.gr_only_once = 0; + ainfo.gdrain_rate = (int) state->pclk_khz * state -> pix_bpp/8; + ainfo.vdrain_rate = (int) state->pclk_khz * 2; + if (state->video_scale != 0) + ainfo.vdrain_rate = ainfo.vdrain_rate/state->video_scale; + ainfo.mdrain_rate = 33000; + res_info->rtl_values = 0; + if (!state->gr_during_vid && state->enable_video) + { + ainfo.gr_only_once = 1; + ainfo.gr_en = 1; + ainfo.gdrain_rate = 0; + res_vid = nv3_get_param(res_info, state, &ainfo); + res_vid = ainfo.converged; + save_info.video_lwm = res_info->video_lwm; + save_info.video_burst_size = res_info->video_burst_size; + ainfo.vid_en = 1; + ainfo.vid_only_once = 1; + ainfo.gr_en = 1; + ainfo.gdrain_rate = (int) state->pclk_khz * state -> pix_bpp/8; + ainfo.vdrain_rate = 0; + res_gr = nv3_get_param(res_info, state, &ainfo); + res_gr = ainfo.converged; + res_info->video_lwm = save_info.video_lwm; + res_info->video_burst_size = save_info.video_burst_size; + res_info->valid = res_gr & res_vid; + } + else + { + if (!ainfo.gr_en) ainfo.gdrain_rate = 0; + if (!ainfo.vid_en) ainfo.vdrain_rate = 0; + res_gr = nv3_get_param(res_info, state, &ainfo); + res_info->valid = ainfo.converged; + } +} +void nv3UpdateArbitrationSettings +( + unsigned VClk, + unsigned pixelDepth, + unsigned *burst, + unsigned *lwm, + RIVA_HW_INST *chip +) +{ + nv3_fifo_info fifo_data; + nv3_sim_state sim_data; + unsigned int M, N, P, pll, MClk; + + pll = chip->PRAMDAC[0x00000504/4]; + M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; + MClk = (N * chip->CrystalFreqKHz / M) >> P; + sim_data.pix_bpp = (char)pixelDepth; + sim_data.enable_video = 0; + sim_data.enable_mp = 0; + sim_data.video_scale = 1; + sim_data.memory_width = (chip->PEXTDEV[0x00000000/4] & 0x10) ? 128 : 64; + sim_data.memory_width = 128; + sim_data.mem_latency = 11; + sim_data.mem_aligned = 1; + sim_data.mem_page_miss = 9; + sim_data.gr_during_vid = 0; + sim_data.pclk_khz = VClk; + sim_data.mclk_khz = MClk; + nv3CalcArbitration(&fifo_data, &sim_data); + if (fifo_data.valid) + { + int b = fifo_data.graphics_burst_size >> 4; + *burst = 0; + while (b >>= 1) (*burst)++; + *lwm = fifo_data.graphics_lwm >> 3; + } + else + { + *lwm = 0x24; + *burst = 0x02; + } +} +static void nv4CalcArbitration +( + nv4_fifo_info *fifo, + nv4_sim_state *arb +) +{ + int data, m,n,p, pagemiss, cas,width, video_enable, color_key_enable, bpp, align; + int nvclks, mclks, pclks, vpagemiss, crtpagemiss, vbs; + int found, mclk_extra, mclk_loop, cbs, m1, p1; + int xtal_freq, mclk_freq, pclk_freq, nvclk_freq, mp_enable; + int us_m, us_n, us_p, video_drain_rate, crtc_drain_rate; + int vpm_us, us_video, vlwm, video_fill_us, cpm_us, us_crt,clwm; + int craw, vraw; + + fifo->valid = 1; + pclk_freq = arb->pclk_khz; + mclk_freq = arb->mclk_khz; + nvclk_freq = arb->nvclk_khz; + pagemiss = arb->mem_page_miss; + cas = arb->mem_latency; + width = arb->memory_width >> 6; + video_enable = arb->enable_video; + color_key_enable = arb->gr_during_vid; + bpp = arb->pix_bpp; + align = arb->mem_aligned; + mp_enable = arb->enable_mp; + clwm = 0; + vlwm = 0; + cbs = 128; + pclks = 2; + nvclks = 2; + nvclks += 2; + nvclks += 1; + mclks = 5; + mclks += 3; + mclks += 1; + mclks += cas; + mclks += 1; + mclks += 1; + mclks += 1; + mclks += 1; + mclk_extra = 3; + nvclks += 2; + nvclks += 1; + nvclks += 1; + nvclks += 1; + if (mp_enable) + mclks+=4; + nvclks += 0; + pclks += 0; + found = 0; + while (found != 1) + { + fifo->valid = 1; + found = 1; + mclk_loop = mclks+mclk_extra; + us_m = mclk_loop *1000*1000 / mclk_freq; + us_n = nvclks*1000*1000 / nvclk_freq; + us_p = nvclks*1000*1000 / pclk_freq; + if (video_enable) + { + video_drain_rate = pclk_freq * 2; + crtc_drain_rate = pclk_freq * bpp/8; + vpagemiss = 2; + vpagemiss += 1; + crtpagemiss = 2; + vpm_us = (vpagemiss * pagemiss)*1000*1000/mclk_freq; + if (nvclk_freq * 2 > mclk_freq * width) + video_fill_us = cbs*1000*1000 / 16 / nvclk_freq ; + else + video_fill_us = cbs*1000*1000 / (8 * width) / mclk_freq; + us_video = vpm_us + us_m + us_n + us_p + video_fill_us; + vlwm = us_video * video_drain_rate/(1000*1000); + vlwm++; + vbs = 128; + if (vlwm > 128) vbs = 64; + if (vlwm > (256-64)) vbs = 32; + if (nvclk_freq * 2 > mclk_freq * width) + video_fill_us = vbs *1000*1000/ 16 / nvclk_freq ; + else + video_fill_us = vbs*1000*1000 / (8 * width) / mclk_freq; + cpm_us = crtpagemiss * pagemiss *1000*1000/ mclk_freq; + us_crt = + us_video + +video_fill_us + +cpm_us + +us_m + us_n +us_p + ; + clwm = us_crt * crtc_drain_rate/(1000*1000); + clwm++; + } + else + { + crtc_drain_rate = pclk_freq * bpp/8; + crtpagemiss = 2; + crtpagemiss += 1; + cpm_us = crtpagemiss * pagemiss *1000*1000/ mclk_freq; + us_crt = cpm_us + us_m + us_n + us_p ; + clwm = us_crt * crtc_drain_rate/(1000*1000); + clwm++; + } + m1 = clwm + cbs - 512; + p1 = m1 * pclk_freq / mclk_freq; + p1 = p1 * bpp / 8; + if ((p1 < m1) && (m1 > 0)) + { + fifo->valid = 0; + found = 0; + if (mclk_extra ==0) found = 1; + mclk_extra--; + } + else if (video_enable) + { + if ((clwm > 511) || (vlwm > 255)) + { + fifo->valid = 0; + found = 0; + if (mclk_extra ==0) found = 1; + mclk_extra--; + } + } + else + { + if (clwm > 519) + { + fifo->valid = 0; + found = 0; + if (mclk_extra ==0) found = 1; + mclk_extra--; + } + } + craw = clwm; + vraw = vlwm; + if (clwm < 384) clwm = 384; + if (vlwm < 128) vlwm = 128; + data = (int)(clwm); + fifo->graphics_lwm = data; + fifo->graphics_burst_size = 128; + data = (int)((vlwm+15)); + fifo->video_lwm = data; + fifo->video_burst_size = vbs; + } +} +static void nv4UpdateArbitrationSettings +( + unsigned VClk, + unsigned pixelDepth, + unsigned *burst, + unsigned *lwm, + RIVA_HW_INST *chip +) +{ + nv4_fifo_info fifo_data; + nv4_sim_state sim_data; + unsigned int M, N, P, pll, MClk, NVClk, cfg1; + + pll = chip->PRAMDAC[0x00000504/4]; + M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; + MClk = (N * chip->CrystalFreqKHz / M) >> P; + pll = chip->PRAMDAC[0x00000500/4]; + M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F; + NVClk = (N * chip->CrystalFreqKHz / M) >> P; + cfg1 = chip->PFB[0x00000204/4]; + sim_data.pix_bpp = (char)pixelDepth; + sim_data.enable_video = 0; + sim_data.enable_mp = 0; + sim_data.memory_width = (chip->PEXTDEV[0x00000000/4] & 0x10) ? 128 : 64; + sim_data.mem_latency = (char)cfg1 & 0x0F; + sim_data.mem_aligned = 1; + sim_data.mem_page_miss = (char)(((cfg1 >> 4) &0x0F) + ((cfg1 >> 31) & 0x01)); + sim_data.gr_during_vid = 0; + sim_data.pclk_khz = VClk; + sim_data.mclk_khz = MClk; + sim_data.nvclk_khz = NVClk; + nv4CalcArbitration(&fifo_data, &sim_data); + if (fifo_data.valid) + { + int b = fifo_data.graphics_burst_size >> 4; + *burst = 0; + while (b >>= 1) (*burst)++; + *lwm = fifo_data.graphics_lwm >> 3; + } +} + +/****************************************************************************\ +* * +* RIVA Mode State Routines * +* * +\****************************************************************************/ + +/* + * Calculate the Video Clock parameters for the PLL. + */ +static int CalcVClock +( + int clockIn, + int *clockOut, + int *mOut, + int *nOut, + int *pOut, + RIVA_HW_INST *chip +) +{ + unsigned lowM, highM, highP; + unsigned DeltaNew, DeltaOld; + unsigned VClk, Freq; + unsigned M, N, O, P; + + DeltaOld = 0xFFFFFFFF; + VClk = (unsigned)clockIn; + if (chip->CrystalFreqKHz == 14318) + { + lowM = 8; + highM = 14 - (chip->Architecture == 3); + } + else + { + lowM = 7; + highM = 13 - (chip->Architecture == 3); + } + highP = 4 - (chip->Architecture == 3); + for (P = 0; P <= highP; P ++) + { + Freq = VClk << P; + if ((Freq >= 128000) && (Freq <= chip->MaxVClockFreqKHz)) + { + for (M = lowM; M <= highM; M++) + { + N = (VClk * M / chip->CrystalFreqKHz) << P; + Freq = (chip->CrystalFreqKHz * N / M) >> P; + if (Freq > VClk) + DeltaNew = Freq - VClk; + else + DeltaNew = VClk - Freq; + if (DeltaNew < DeltaOld) + { + *mOut = M; + *nOut = N; + *pOut = P; + *clockOut = Freq; + DeltaOld = DeltaNew; + } + } + } + } + return (DeltaOld != 0xFFFFFFFF); +} +/* + * Calculate extended mode parameters (SVGA) and save in a + * mode state structure. + */ +static void CalcStateExt +( + RIVA_HW_INST *chip, + RIVA_HW_STATE *state, + int bpp, + int width, + int hDisplaySize, + int hDisplay, + int hStart, + int hEnd, + int hTotal, + int height, + int vDisplay, + int vStart, + int vEnd, + int vTotal, + int dotClock +) +{ + int pixelDepth, VClk, m, n, p; + /* + * Save mode parameters. + */ + state->bpp = bpp; + state->width = width; + state->height = height; + /* + * Extended RIVA registers. + */ + pixelDepth = (bpp + 1)/8; + CalcVClock(dotClock, &VClk, &m, &n, &p, chip); + switch (chip->Architecture) + { + case 3: + nv3UpdateArbitrationSettings(VClk, + pixelDepth * 8, + &(state->arbitration0), + &(state->arbitration1), + chip); + state->cursor0 = 0x00; + state->cursor1 = 0x78; + state->cursor2 = 0x00000000; + state->pllsel = 0x10010100; + state->config = ((width + 31)/32) + | (((pixelDepth > 2) ? 3 : pixelDepth) << 8) + | 0x1000; + state->general = 0x00000100; + state->repaint1 = hDisplaySize < 1280 ? 0x06 : 0x02; + break; + case 4: + case 5: + nv4UpdateArbitrationSettings(VClk, + pixelDepth * 8, + &(state->arbitration0), + &(state->arbitration1), + chip); + state->cursor0 = 0x00; + state->cursor1 = 0xFC; + state->cursor2 = 0x00000000; + state->pllsel = 0x10000700; + state->config = 0x00001114; + state->general = bpp == 16 ? 0x00101100 : 0x00100100; + state->repaint1 = hDisplaySize < 1280 ? 0x04 : 0x00; + break; + } + state->vpll = (p << 16) | (n << 8) | m; + state->screen = ((hTotal & 0x040) >> 2) + | ((vDisplay & 0x400) >> 7) + | ((vStart & 0x400) >> 8) + | ((vDisplay & 0x400) >> 9) + | ((vTotal & 0x400) >> 10); + state->repaint0 = (((width/8)*pixelDepth) & 0x700) >> 3; + state->horiz = hTotal < 260 ? 0x00 : 0x01; + state->pixel = (pixelDepth > 2 ? 3 : pixelDepth) | 0x40; + state->offset0 = + state->offset1 = + state->offset2 = + state->offset3 = 0; + state->pitch0 = + state->pitch1 = + state->pitch2 = + state->pitch3 = pixelDepth * width; +} +/* + * Load fixed function state and pre-calculated/stored state. + */ +#define LOAD_FIXED_STATE(tbl,dev) \ + for (i = 0; i < sizeof(tbl##Table##dev)/8; i++) \ + chip->dev[tbl##Table##dev[i][0]] = tbl##Table##dev[i][1] +#define LOAD_FIXED_STATE_8BPP(tbl,dev) \ + for (i = 0; i < sizeof(tbl##Table##dev##_8BPP)/8; i++) \ + chip->dev[tbl##Table##dev##_8BPP[i][0]] = tbl##Table##dev##_8BPP[i][1] +#define LOAD_FIXED_STATE_15BPP(tbl,dev) \ + for (i = 0; i < sizeof(tbl##Table##dev##_15BPP)/8; i++) \ + chip->dev[tbl##Table##dev##_15BPP[i][0]] = tbl##Table##dev##_15BPP[i][1] +#define LOAD_FIXED_STATE_16BPP(tbl,dev) \ + for (i = 0; i < sizeof(tbl##Table##dev##_16BPP)/8; i++) \ + chip->dev[tbl##Table##dev##_16BPP[i][0]] = tbl##Table##dev##_16BPP[i][1] +#define LOAD_FIXED_STATE_32BPP(tbl,dev) \ + for (i = 0; i < sizeof(tbl##Table##dev##_32BPP)/8; i++) \ + chip->dev[tbl##Table##dev##_32BPP[i][0]] = tbl##Table##dev##_32BPP[i][1] +static void LoadStateExt +( + RIVA_HW_INST *chip, + RIVA_HW_STATE *state +) +{ + int i; + /* + * Load HW fixed function state. + */ + LOAD_FIXED_STATE(Riva,PMC); + LOAD_FIXED_STATE(Riva,PTIMER); + /* + * Make sure frame buffer config gets set before loading PRAMIN. + */ + chip->PFB[0x00000200/4] = state->config; + switch (chip->Architecture) + { + case 3: + LOAD_FIXED_STATE(nv3,PFIFO); + LOAD_FIXED_STATE(nv3,PRAMIN); + LOAD_FIXED_STATE(nv3,PGRAPH); + switch (state->bpp) + { + case 15: + case 16: + LOAD_FIXED_STATE_15BPP(nv3,PRAMIN); + LOAD_FIXED_STATE_15BPP(nv3,PGRAPH); + chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); + break; + case 24: + case 32: + LOAD_FIXED_STATE_32BPP(nv3,PRAMIN); + LOAD_FIXED_STATE_32BPP(nv3,PGRAPH); + chip->Tri03 = 0L; + break; + case 8: + default: + LOAD_FIXED_STATE_8BPP(nv3,PRAMIN); + LOAD_FIXED_STATE_8BPP(nv3,PGRAPH); + chip->Tri03 = 0L; + break; + } + for (i = 0x00000; i < 0x00800; i++) + chip->PRAMIN[0x00000502 + i] = (i << 12) | 0x03; + chip->PGRAPH[0x00000630/4] = state->offset0; + chip->PGRAPH[0x00000634/4] = state->offset1; + chip->PGRAPH[0x00000638/4] = state->offset2; + chip->PGRAPH[0x0000063C/4] = state->offset3; + chip->PGRAPH[0x00000650/4] = state->pitch0; + chip->PGRAPH[0x00000654/4] = state->pitch1; + chip->PGRAPH[0x00000658/4] = state->pitch2; + chip->PGRAPH[0x0000065C/4] = state->pitch3; + break; + case 4: + case 5: + LOAD_FIXED_STATE(nv4,PFIFO); + LOAD_FIXED_STATE(nv4,PRAMIN); + LOAD_FIXED_STATE(nv4,PGRAPH); + switch (state->bpp) + { + case 15: + LOAD_FIXED_STATE_15BPP(nv4,PRAMIN); + LOAD_FIXED_STATE_15BPP(nv4,PGRAPH); + chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); + break; + case 16: + LOAD_FIXED_STATE_16BPP(nv4,PRAMIN); + LOAD_FIXED_STATE_16BPP(nv4,PGRAPH); + chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); + break; + case 24: + case 32: + LOAD_FIXED_STATE_32BPP(nv4,PRAMIN); + LOAD_FIXED_STATE_32BPP(nv4,PGRAPH); + chip->Tri03 = 0L; + break; + case 8: + default: + LOAD_FIXED_STATE_8BPP(nv4,PRAMIN); + LOAD_FIXED_STATE_8BPP(nv4,PGRAPH); + chip->Tri03 = 0L; + break; + } + chip->PGRAPH[0x00000640/4] = state->offset0; + chip->PGRAPH[0x00000644/4] = state->offset1; + chip->PGRAPH[0x00000648/4] = state->offset2; + chip->PGRAPH[0x0000064C/4] = state->offset3; + chip->PGRAPH[0x00000670/4] = state->pitch0; + chip->PGRAPH[0x00000674/4] = state->pitch1; + chip->PGRAPH[0x00000678/4] = state->pitch2; + chip->PGRAPH[0x0000067C/4] = state->pitch3; + break; + } +//NOTICE("8"); +// LOAD_FIXED_STATE(Riva,FIFO); /* FIX ME*/ +//NOTICE("9"); + /* + * Load HW mode state. + */ + outb(0x19, 0x3D4); outb(state->repaint0, 0x3D5); + outb(0x1A, 0x3D4); outb(state->repaint1, 0x3D5); + outb(0x25, 0x3D4); outb(state->screen, 0x3D5); + outb(0x28, 0x3D4); outb(state->pixel, 0x3D5); + outb(0x2D, 0x3D4); outb(state->horiz, 0x3D5); + outb(0x1B, 0x3D4); outb(state->arbitration0, 0x3D5); + outb(0x20, 0x3D4); outb(state->arbitration1, 0x3D5); + outb(0x30, 0x3D4); outb(state->cursor0, 0x3D5); + outb(0x31, 0x3D4); outb(state->cursor1, 0x3D5); + chip->PRAMDAC[0x00000300/4] = state->cursor2; + chip->PRAMDAC[0x00000508/4] = state->vpll; + chip->PRAMDAC[0x0000050C/4] = state->pllsel; + chip->PRAMDAC[0x00000600/4] = state->general; + /* + * Turn off VBlank enable and reset. + */ +// *(chip->VBLANKENABLE) = 0; /* FIXME*/ +// *(chip->VBLANK) = chip->VBlankBit; /*FIXME*/ + /* + * Set interrupt enable. + */ + chip->PMC[0x00000140/4] = chip->EnableIRQ & 0x01; + /* + * Set current state pointer. + */ + chip->CurrentState = state; + /* + * Reset FIFO free count. + */ + chip->FifoFreeCount = 0; +} +static void UnloadStateExt +( + RIVA_HW_INST *chip, + RIVA_HW_STATE *state +) +{ + /* + * Save current HW state. + */ + outb(0x19, 0x3D4); state->repaint0 = inb(0x3D5); + outb(0x1A, 0x3D4); state->repaint1 = inb(0x3D5); + outb(0x25, 0x3D4); state->screen = inb(0x3D5); + outb(0x28, 0x3D4); state->pixel = inb(0x3D5); + outb(0x2D, 0x3D4); state->horiz = inb(0x3D5); + outb(0x1B, 0x3D4); state->arbitration0 = inb(0x3D5); + outb(0x20, 0x3D4); state->arbitration1 = inb(0x3D5); + outb(0x30, 0x3D4); state->cursor0 = inb(0x3D5); + outb(0x31, 0x3D4); state->cursor1 = inb(0x3D5); + state->cursor2 = chip->PRAMDAC[0x00000300/4]; + state->vpll = chip->PRAMDAC[0x00000508/4]; + state->pllsel = chip->PRAMDAC[0x0000050C/4]; + state->general = chip->PRAMDAC[0x00000600/4]; + state->config = chip->PFB[0x00000200/4]; + switch (chip->Architecture) + { + case 3: + state->offset0 = chip->PGRAPH[0x00000630/4]; + state->offset1 = chip->PGRAPH[0x00000634/4]; + state->offset2 = chip->PGRAPH[0x00000638/4]; + state->offset3 = chip->PGRAPH[0x0000063C/4]; + state->pitch0 = chip->PGRAPH[0x00000650/4]; + state->pitch1 = chip->PGRAPH[0x00000654/4]; + state->pitch2 = chip->PGRAPH[0x00000658/4]; + state->pitch3 = chip->PGRAPH[0x0000065C/4]; + break; + case 4: + case 5: + state->offset0 = chip->PGRAPH[0x00000640/4]; + state->offset1 = chip->PGRAPH[0x00000644/4]; + state->offset2 = chip->PGRAPH[0x00000648/4]; + state->offset3 = chip->PGRAPH[0x0000064C/4]; + state->pitch0 = chip->PGRAPH[0x00000670/4]; + state->pitch1 = chip->PGRAPH[0x00000674/4]; + state->pitch2 = chip->PGRAPH[0x00000678/4]; + state->pitch3 = chip->PGRAPH[0x0000067C/4]; + break; + } +} +static void SetStartAddress +( + RIVA_HW_INST *chip, + unsigned start +) +{ + int offset = start >> 2; + int pan = (start & 3) << 1; + unsigned char tmp; + + /* + * Unlock extended registers. + */ + outb(chip->LockUnlockIndex, chip->LockUnlockIO); + outb(0x57, chip->LockUnlockIO + 1); + /* + * Set start address. + */ + outb(0x0D, 0x3D4); + outb(offset, 0x3D5); + outb(0x0C, 0x3D4); + outb(offset >> 8, 0x3D5); + outb(0x19, 0x3D4); + tmp = inb(0x3D5); + outb(((offset >> 16) & 0x0F) | (tmp & 0xF0), 0x3D5); + /* + * 4 pixel pan register. + */ + offset = inb(chip->IO + 0x0A); + outb(0x13, 0x3C0); + outb(pan, 0x3C0); +} +static void nv3SetSurfaces2D +( + RIVA_HW_INST *chip, + unsigned surf0, + unsigned surf1 +) +{ + while (nv3Busy(chip)); + chip->PGRAPH[0x00000630/4] = surf0; + chip->PGRAPH[0x00000634/4] = surf1; +} +static void nv4SetSurfaces2D +( + RIVA_HW_INST *chip, + unsigned surf0, + unsigned surf1 +) +{ + while (nv4Busy(chip)); + chip->PGRAPH[0x00000640/4] = surf0; + chip->PGRAPH[0x00000644/4] = surf1; +} +static void nv3SetSurfaces3D +( + RIVA_HW_INST *chip, + unsigned surf0, + unsigned surf1 +) +{ + while (nv3Busy(chip)); + chip->PGRAPH[0x00000638/4] = surf0; + chip->PGRAPH[0x0000063C/4] = surf1; +} +static void nv4SetSurfaces3D +( + RIVA_HW_INST *chip, + unsigned surf0, + unsigned surf1 +) +{ + while (nv4Busy(chip)); + chip->PGRAPH[0x00000648/4] = surf0; + chip->PGRAPH[0x0000064C/4] = surf1; +} + +/****************************************************************************\ +* * +* Probe RIVA Chip Configuration * +* * +\****************************************************************************/ + +void nv3GetConfig +( + RIVA_HW_INST *chip +) +{ + /* + * Fill in chip configuration. + */ + if (chip->PFB[0x00000000/4] & 0x00000020) + { + if (((chip->PMC[0x00000000/4] & 0xF0) == 0x20) + && ((chip->PMC[0x00000000/4] & 0x0F) >= 0x02)) + { + /* + * SDRAM 128 ZX. + */ + chip->RamBandwidthKBytesPerSec = 800000; + switch (chip->PFB[0x00000000/4] & 0x03) + { + case 2: + chip->RamAmountKBytes = 1024 * 4 - 32; + break; + case 1: + chip->RamAmountKBytes = 1024 * 2 - 32; + break; + default: + chip->RamAmountKBytes = 1024 * 8 - 32; + break; + } + } + else + { + chip->RamBandwidthKBytesPerSec = 1000000; + chip->RamAmountKBytes = 1024 * 8 - 32; + } + } + else + { + /* + * SGRAM 128. + */ + chip->RamBandwidthKBytesPerSec = 1000000; + switch (chip->PFB[0x00000000/4] & 0x00000003) + { + case 0: + chip->RamAmountKBytes = 1024 * 8 - 32; + break; + case 2: + chip->RamAmountKBytes = 1024 * 4 - 32; + break; + default: + chip->RamAmountKBytes = 1024 * 2 - 32; + break; + } + } + chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000020) ? 14318 : 13500; + chip->CURSOR = &(chip->PRAMIN[0x00008000/4 - 0x0800/4]); + chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); + chip->VBLANKENABLE = &(chip->PGRAPH[0x0140/4]); + chip->VBLANK = &(chip->PGRAPH[0x0100/4]); + chip->VBlankBit = 0x00000100; + chip->MaxVClockFreqKHz = 230000; + chip->LockUnlockIO = 0x3C4; + chip->LockUnlockIndex = 0x06; + /* + * Set chip functions. + */ + chip->Busy = nv3Busy; + chip->ShowHideCursor = ShowHideCursor; + chip->CalcStateExt = CalcStateExt; + chip->LoadStateExt = LoadStateExt; + chip->UnloadStateExt = UnloadStateExt; + chip->SetStartAddress = SetStartAddress; + chip->SetSurfaces2D = nv3SetSurfaces2D; + chip->SetSurfaces3D = nv3SetSurfaces3D; +} + +void nv4GetConfig +( + RIVA_HW_INST *chip +) +{ + /* + * Fill in chip configuration. + */ + switch (chip->PFB[0x00000000/4] & 0x00000003) + { + case 0: + chip->RamAmountKBytes = 1024 * 32 - 128; + break; + case 1: + chip->RamAmountKBytes = 1024 * 4 - 128; + break; + case 2: + chip->RamAmountKBytes = 1024 * 8 - 128; + break; + case 3: + default: + chip->RamAmountKBytes = 1024 * 16 - 128; + break; + } + switch ((chip->PFB[0x00000000/4] >> 3) & 0x00000003) + { + case 3: + chip->RamBandwidthKBytesPerSec = 800000; + break; + default: + chip->RamBandwidthKBytesPerSec = 1000000; + break; + } + chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500; + chip->CURSOR = &(chip->PRAMIN[0x00010000/4 - 0x0800/4]); + chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); + chip->VBLANKENABLE = &(chip->PCRTC[0x0140/4]); + chip->VBLANK = &(chip->PCRTC[0x0100/4]); + chip->VBlankBit = 0x00000001; + chip->MaxVClockFreqKHz = 250000; + chip->LockUnlockIO = 0x3D4; + chip->LockUnlockIndex = 0x1F; + /* + * Set chip functions. + */ + chip->Busy = nv4Busy; + chip->ShowHideCursor = ShowHideCursor; + chip->CalcStateExt = CalcStateExt; + chip->LoadStateExt = LoadStateExt; + chip->UnloadStateExt = UnloadStateExt; + chip->SetStartAddress = SetStartAddress; + chip->SetSurfaces2D = nv4SetSurfaces2D; + chip->SetSurfaces3D = nv4SetSurfaces3D; +} + +void nv5GetConfig +( + RIVA_HW_INST *chip +) +{ + /* + * Fill in chip configuration. + */ + switch (chip->PFB[0x00000000/4] & 0x00000003) + { + case 0: + chip->RamAmountKBytes = 1024 * 32 - 128; + break; + case 1: + chip->RamAmountKBytes = 1024 * 4 - 128; + break; + case 2: + chip->RamAmountKBytes = 1024 * 8 - 128; + break; + case 3: + default: + chip->RamAmountKBytes = 1024 * 16 - 128; + break; + } + switch ((chip->PFB[0x00000000/4] >> 3) & 0x00000003) + { + case 3: + chip->RamBandwidthKBytesPerSec = 800000; + break; + default: + chip->RamBandwidthKBytesPerSec = 1000000; + break; + } + chip->CrystalFreqKHz = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500; + chip->CURSOR = &(chip->PRAMIN[0x00010000/4 - 0x0800/4]); + chip->CURSORPOS = &(chip->PRAMDAC[0x0300/4]); + chip->VBLANKENABLE = &(chip->PCRTC[0x0140/4]); + chip->VBLANK = &(chip->PCRTC[0x0100/4]); + chip->VBlankBit = 0x00000001; + chip->MaxVClockFreqKHz = 250000; + chip->LockUnlockIO = 0x3D4; + chip->LockUnlockIndex = 0x1F; + /* + * Set chip functions. + */ + chip->Busy = nv4Busy; + chip->ShowHideCursor = ShowHideCursor; + chip->CalcStateExt = CalcStateExt; + chip->LoadStateExt = LoadStateExt; + chip->UnloadStateExt = UnloadStateExt; + chip->SetStartAddress = SetStartAddress; + chip->SetSurfaces2D = nv4SetSurfaces2D; + chip->SetSurfaces3D = nv4SetSurfaces3D; +} + +int RivaGetConfig +( + RIVA_HW_INST *chip +) +{ + /* + * Save this so future SW know whats it's dealing with. + */ + chip->Version = RIVA_SW_VERSION; + /* + * Chip specific configuration. + */ + switch (chip->Architecture) + { + case 3: + nv3GetConfig(chip); + break; + case 4: + nv4GetConfig(chip); + break; + case 5: + nv5GetConfig(chip); + default: + return (-1); + } + /* + * Fill in FIFO pointers. + */ + chip->Rop = (RivaRop *)&(chip->FIFO[0x00000000/4]); + chip->Clip = (RivaClip *)&(chip->FIFO[0x00002000/4]); + chip->Patt = (RivaPattern *)&(chip->FIFO[0x00004000/4]); + chip->Pixmap = (RivaPixmap *)&(chip->FIFO[0x00006000/4]); + chip->Blt = (RivaScreenBlt *)&(chip->FIFO[0x00008000/4]); + chip->Bitmap = (RivaBitmap *)&(chip->FIFO[0x0000A000/4]); + chip->Tri03 = (RivaTexturedTriangle03 *)&(chip->FIFO[0x0000E000/4]); + return (0); +} + diff -u --recursive --new-file v2.3.25/linux/drivers/video/riva_hw.h linux/drivers/video/riva_hw.h --- v2.3.25/linux/drivers/video/riva_hw.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/riva_hw.h Tue Nov 2 08:15:05 1999 @@ -0,0 +1,343 @@ +/***************************************************************************\ +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: The source code is copyrighted under U.S. and *| +|* international laws. Users and possessors of this source code are *| +|* hereby granted a nonexclusive, royalty-free copyright license to *| +|* use this code in individual and commercial software. *| +|* *| +|* Any use of this source code must include, in the user documenta- *| +|* tion and internal comments to the code, notices to the end user *| +|* as follows: *| +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *| +|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *| +|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *| +|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *| +|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *| +|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *| +|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *| +|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *| +|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *| +|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial *| +|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial *| +|* computer software documentation," as such terms are used in *| +|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *| +|* ment only as a commercial end item. Consistent with 48 C.F.R. *| +|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the source code with only *| +|* those rights set forth herein. *| +|* *| +\***************************************************************************/ +/* + * GPL licensing note -- nVidia is allowing a liberal interpretation of + * the documentation restriction above, to merely say that this nVidia's + * copyright and disclaimer should be included with all code derived + * from this source. -- Jeff Garzik , 01/Nov/99 + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/nv/riva_hw.h,v 1.1.2.2 1998/12/22 16:33:19 hohndel Exp $ */ +#ifndef __RIVA_HW_H__ +#define __RIVA_HW_H__ +#define RIVA_SW_VERSION 0x00010000 + +/***************************************************************************\ +* * +* FIFO registers. * +* * +\***************************************************************************/ + +/* + * Raster OPeration. Windows style ROP3. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop; + unsigned reserved01[0x0BB]; + unsigned Rop3; +} RivaRop; +/* + * 8X8 Monochrome pattern. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop; + unsigned reserved01[0x0BD]; + unsigned Shape; + unsigned reserved03[0x001]; + unsigned Color0; + unsigned Color1; + unsigned Monochrome[2]; +} RivaPattern; +/* + * Scissor clip rectangle. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop; + unsigned reserved01[0x0BB]; + unsigned TopLeft; + unsigned WidthHeight; +} RivaClip; +/* + * 2D filled rectangle. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop[1]; + unsigned reserved01[0x0BC]; + unsigned Color; + unsigned reserved03[0x03E]; + unsigned TopLeft; + unsigned WidthHeight; +} RivaRectangle; +/* + * 2D screen-screen BLT. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop; + unsigned reserved01[0x0BB]; + unsigned TopLeftSrc; + unsigned TopLeftDst; + unsigned WidthHeight; +} RivaScreenBlt; +/* + * 2D pixel BLT. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop[1]; + unsigned reserved01[0x0BC]; + unsigned TopLeft; + unsigned WidthHeight; + unsigned WidthHeightIn; + unsigned reserved02[0x03C]; + unsigned Pixels; +} RivaPixmap; +/* + * Filled rectangle combined with monochrome expand. Useful for glyphs. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop; + unsigned reserved01[0x0BB]; + unsigned reserved03[(0x040)-1]; + unsigned Color1A; + struct + { + unsigned TopLeft; + unsigned WidthHeight; + } UnclippedRectangle[64]; + unsigned reserved04[(0x080)-3]; + struct + { + unsigned TopLeft; + unsigned BottomRight; + } ClipB; + unsigned Color1B; + struct + { + unsigned TopLeft; + unsigned BottomRight; + } ClippedRectangle[64]; + unsigned reserved05[(0x080)-5]; + struct + { + unsigned TopLeft; + unsigned BottomRight; + } ClipC; + unsigned Color1C; + unsigned WidthHeightC; + unsigned PointC; + unsigned MonochromeData1C; + unsigned reserved06[(0x080)+121]; + struct + { + unsigned TopLeft; + unsigned BottomRight; + } ClipD; + unsigned Color1D; + unsigned WidthHeightInD; + unsigned WidthHeightOutD; + unsigned PointD; + unsigned MonochromeData1D; + unsigned reserved07[(0x080)+120]; + struct + { + unsigned TopLeft; + unsigned BottomRight; + } ClipE; + unsigned Color0E; + unsigned Color1E; + unsigned WidthHeightInE; + unsigned WidthHeightOutE; + unsigned PointE; + unsigned MonochromeData01E; +} RivaBitmap; +/* + * 3D textured, Z buffered triangle. + */ +typedef volatile struct +{ + unsigned reserved00[4]; + unsigned short FifoFree; + unsigned short Nop; + unsigned reserved01[0x0BC]; + unsigned TextureOffset; + unsigned TextureFormat; + unsigned TextureFilter; + unsigned FogColor; + unsigned Control; + unsigned AlphaTest; + unsigned reserved02[0x339]; + unsigned FogAndIndex; + unsigned Color; + float ScreenX; + float ScreenY; + float ScreenZ; + float EyeM; + float TextureS; + float TextureT; +} RivaTexturedTriangle03; + +/***************************************************************************\ +* * +* Virtualized RIVA H/W interface. * +* * +\***************************************************************************/ + +struct _riva_hw_inst; +struct _riva_hw_state; +/* + * Virtialized chip interface. Makes RIVA 128 and TNT look alike. + */ +typedef struct _riva_hw_inst +{ + /* + * Chip specific settings. + */ + unsigned Architecture; + unsigned Version; + unsigned CrystalFreqKHz; + unsigned RamAmountKBytes; + unsigned MaxVClockFreqKHz; + unsigned RamBandwidthKBytesPerSec; + unsigned EnableIRQ; + unsigned IO; + unsigned LockUnlockIO; + unsigned LockUnlockIndex; + unsigned VBlankBit; + unsigned FifoFreeCount; + /* + * Non-FIFO registers. + */ + volatile unsigned *PCRTC; + volatile unsigned *PRAMDAC; + volatile unsigned *PFB; + volatile unsigned *PFIFO; + volatile unsigned *PGRAPH; + volatile unsigned *PEXTDEV; + volatile unsigned *PTIMER; + volatile unsigned *PMC; + volatile unsigned *PRAMIN; + volatile unsigned *FIFO; + volatile unsigned *CURSOR; + volatile unsigned *CURSORPOS; + volatile unsigned *VBLANKENABLE; + volatile unsigned *VBLANK; + /* + * Common chip functions. + */ + int (*Busy)(struct _riva_hw_inst *); + void (*CalcStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *,int,int,int,int,int,int,int,int,int,int,int,int,int); + void (*LoadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); + void (*UnloadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); + void (*SetStartAddress)(struct _riva_hw_inst *,unsigned); + void (*SetSurfaces2D)(struct _riva_hw_inst *,unsigned,unsigned); + void (*SetSurfaces3D)(struct _riva_hw_inst *,unsigned,unsigned); + int (*ShowHideCursor)(struct _riva_hw_inst *,int); + /* + * Current extended mode settings. + */ + struct _riva_hw_state *CurrentState; + /* + * FIFO registers. + */ + RivaRop *Rop; + RivaPattern *Patt; + RivaClip *Clip; + RivaPixmap *Pixmap; + RivaScreenBlt *Blt; + RivaBitmap *Bitmap; + RivaTexturedTriangle03 *Tri03; +} RIVA_HW_INST; +/* + * Extended mode state information. + */ +typedef struct _riva_hw_state +{ + unsigned bpp; + unsigned width; + unsigned height; + unsigned repaint0; + unsigned repaint1; + unsigned screen; + unsigned pixel; + unsigned horiz; + unsigned arbitration0; + unsigned arbitration1; + unsigned vpll; + unsigned pllsel; + unsigned general; + unsigned config; + unsigned cursor0; + unsigned cursor1; + unsigned cursor2; + unsigned offset0; + unsigned offset1; + unsigned offset2; + unsigned offset3; + unsigned pitch0; + unsigned pitch1; + unsigned pitch2; + unsigned pitch3; +} RIVA_HW_STATE; +/* + * External routines. + */ +int RivaGetConfig(RIVA_HW_INST *); +/* + * FIFO Free Count. Should attempt to yield processor if RIVA is busy. + */ +#define RIVA_FIFO_FREE(hwinst,hwptr,cnt) \ +{ \ +while ((hwinst).FifoFreeCount < (cnt)) \ +{ \ + (hwinst).FifoFreeCount = (hwinst).hwptr->FifoFree >> 2; \ +} \ +(hwinst).FifoFreeCount -= (cnt); \ +} +#endif /* __RIVA_HW_H__ */ + diff -u --recursive --new-file v2.3.25/linux/drivers/video/riva_tbl.h linux/drivers/video/riva_tbl.h --- v2.3.25/linux/drivers/video/riva_tbl.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/riva_tbl.h Tue Nov 2 08:15:05 1999 @@ -0,0 +1,402 @@ + /***************************************************************************\ +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: The source code is copyrighted under U.S. and *| +|* international laws. Users and possessors of this source code are *| +|* hereby granted a nonexclusive, royalty-free copyright license to *| +|* use this code in individual and commercial software. *| +|* *| +|* Any use of this source code must include, in the user documenta- *| +|* tion and internal comments to the code, notices to the end user *| +|* as follows: *| +|* *| +|* Copyright 1993-1998 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *| +|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *| +|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *| +|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *| +|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *| +|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *| +|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *| +|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *| +|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *| +|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial *| +|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial *| +|* computer software documentation," as such terms are used in *| +|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *| +|* ment only as a commercial end item. Consistent with 48 C.F.R. *| +|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the source code with only *| +|* those rights set forth herein. *| +|* *| + \***************************************************************************/ +/* + * GPL licensing note -- nVidia is allowing a liberal interpretation of + * the documentation restriction above, to merely say that this nVidia's + * copyright and disclaimer should be included with all code derived + * from this source. -- Jeff Garzik , 01/Nov/99 + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/nv/riva_tbl.h,v 1.1.2.2 1998/12/22 16:33:20 hohndel Exp $ */ +/* + * RIVA Fixed Functionality Init Tables. + */ +static unsigned RivaTablePMC[][2] = +{ + {0x00000050, 0x00000000}, + {0x00000080, 0xFFFF00FF}, + {0x00000080, 0xFFFFFFFF} +}; +static unsigned RivaTablePTIMER[][2] = +{ + {0x00000080, 0x00000008}, + {0x00000084, 0x00000003}, + {0x00000050, 0x00000000}, + {0x00000040, 0xFFFFFFFF} +}; +static unsigned RivaTableFIFO[][2] = +{ + {0x00000000, 0x80000000}, + {0x00000800, 0x80000001}, + {0x00001000, 0x80000002}, + {0x00001800, 0x80000010}, + {0x00002000, 0x80000011}, + {0x00002800, 0x80000012}, + {0x00003800, 0x80000013} +}; +static unsigned nv3TablePFIFO[][2] = +{ + {0x00000140, 0x00000000}, + {0x00000480, 0x00000000}, + {0x00000490, 0x00000000}, + {0x00000494, 0x00000000}, + {0x00000481, 0x00000000}, + {0x00000084, 0x00000000}, + {0x00000086, 0x00002000}, + {0x00000085, 0x00002200}, + {0x00000484, 0x00000000}, + {0x0000049C, 0x00000000}, + {0x00000104, 0x00000000}, + {0x00000108, 0x00000000}, + {0x00000100, 0x00000000}, + {0x000004A0, 0x00000000}, + {0x000004A4, 0x00000000}, + {0x000004A8, 0x00000000}, + {0x000004AC, 0x00000000}, + {0x000004B0, 0x00000000}, + {0x000004B4, 0x00000000}, + {0x000004B8, 0x00000000}, + {0x000004BC, 0x00000000}, + {0x00000050, 0x00000000}, + {0x00000040, 0xFFFFFFFF}, + {0x00000480, 0x00000001}, + {0x00000490, 0x00000001}, + {0x00000140, 0x00000001} +}; +static unsigned nv3TablePGRAPH[][2] = +{ + {0x00000020, 0x1230001F}, + {0x00000021, 0x10113000}, + {0x00000022, 0x1131F101}, + {0x00000023, 0x0100F531}, + {0x00000060, 0x00000000}, + {0x00000065, 0x00000000}, + {0x00000068, 0x00000000}, + {0x00000069, 0x00000000}, + {0x0000006A, 0x00000000}, + {0x0000006B, 0x00000000}, + {0x0000006C, 0x00000000}, + {0x0000006D, 0x00000000}, + {0x0000006E, 0x00000000}, + {0x0000006F, 0x00000000}, + {0x000001A8, 0x00000000}, + {0x00000440, 0xFFFFFFFF}, + {0x00000480, 0x00000001}, + {0x000001A0, 0x00000000}, + {0x000001A2, 0x00000000}, + {0x0000018A, 0xFFFFFFFF}, + {0x00000190, 0x00000000}, + {0x00000142, 0x00000000}, + {0x00000154, 0x00000000}, + {0x00000155, 0xFFFFFFFF}, + {0x00000156, 0x00000000}, + {0x00000157, 0xFFFFFFFF}, + {0x00000064, 0x10010002}, + {0x00000050, 0x00000000}, + {0x00000051, 0x00000000}, + {0x00000040, 0xFFFFFFFF}, + {0x00000041, 0xFFFFFFFF}, + {0x00000440, 0xFFFFFFFF}, + {0x000001A9, 0x00000001} +}; +static unsigned nv3TablePGRAPH_8BPP[][2] = +{ + {0x000001AA, 0x00001111} +}; +static unsigned nv3TablePGRAPH_15BPP[][2] = +{ + {0x000001AA, 0x00002222} +}; +static unsigned nv3TablePGRAPH_32BPP[][2] = +{ + {0x000001AA, 0x00003333} +}; +static unsigned nv3TablePRAMIN[][2] = +{ + {0x00000500, 0x00010000}, + {0x00000501, 0x007FFFFF}, + {0x00000200, 0x80000000}, + {0x00000201, 0x00C20341}, + {0x00000204, 0x80000001}, + {0x00000205, 0x00C50342}, + {0x00000208, 0x80000002}, + {0x00000209, 0x00C60343}, + {0x00000240, 0x80000010}, + {0x00000241, 0x00D10344}, + {0x00000244, 0x80000011}, + {0x00000245, 0x00D00345}, + {0x00000248, 0x80000012}, + {0x00000249, 0x00CC0346}, + {0x0000024C, 0x80000013}, + {0x0000024D, 0x00D70347}, + {0x00000D05, 0x00000000}, + {0x00000D06, 0x00000000}, + {0x00000D07, 0x00000000}, + {0x00000D09, 0x00000000}, + {0x00000D0A, 0x00000000}, + {0x00000D0B, 0x00000000}, + {0x00000D0D, 0x00000000}, + {0x00000D0E, 0x00000000}, + {0x00000D0F, 0x00000000}, + {0x00000D11, 0x00000000}, + {0x00000D12, 0x00000000}, + {0x00000D13, 0x00000000}, + {0x00000D15, 0x00000000}, + {0x00000D16, 0x00000000}, + {0x00000D17, 0x00000000}, + {0x00000D19, 0x00000000}, + {0x00000D1A, 0x00000000}, + {0x00000D1B, 0x00000000}, + {0x00000D1D, 0x00000140}, + {0x00000D1E, 0x00000000}, + {0x00000D1F, 0x00000000} +}; +static unsigned nv3TablePRAMIN_8BPP[][2] = +{ + {0x00000D04, 0x10110203}, + {0x00000D08, 0x10110203}, + {0x00000D0C, 0x10110203}, + {0x00000D10, 0x10118203}, + {0x00000D14, 0x10110203}, + {0x00000D18, 0x10110203}, + {0x00000D1C, 0x10419208} +}; +static unsigned nv3TablePRAMIN_15BPP[][2] = +{ + {0x00000D04, 0x10110200}, + {0x00000D08, 0x10110200}, + {0x00000D0C, 0x10110200}, + {0x00000D10, 0x10118200}, + {0x00000D14, 0x10110200}, + {0x00000D18, 0x10110200}, + {0x00000D1C, 0x10419208} +}; +static unsigned nv3TablePRAMIN_32BPP[][2] = +{ + {0x00000D04, 0x10110201}, + {0x00000D08, 0x10110201}, + {0x00000D0C, 0x10110201}, + {0x00000D10, 0x10118201}, + {0x00000D14, 0x10110201}, + {0x00000D18, 0x10110201}, + {0x00000D1C, 0x10419208} +}; +static unsigned nv4TablePFIFO[][2] = +{ + {0x00000140, 0x00000000}, + {0x00000480, 0x00000000}, + {0x00000494, 0x00000000}, + {0x00000400, 0x00000000}, + {0x00000414, 0x00000000}, + {0x00000084, 0x03000100}, + {0x00000085, 0x00000110}, + {0x00000086, 0x00000112}, + {0x00000143, 0x0000FFFF}, + {0x00000496, 0x0000FFFF}, + {0x00000050, 0x00000000}, + {0x00000040, 0xFFFFFFFF}, + {0x00000415, 0x00000001}, + {0x00000480, 0x00000001}, + {0x00000494, 0x00000001}, + {0x00000495, 0x00000001}, + {0x00000140, 0x00000001} +}; +static unsigned nv4TablePGRAPH[][2] = +{ + {0x00000020, 0x1231C001}, + {0x00000021, 0x72111101}, + {0x00000022, 0x11D5F071}, + {0x00000023, 0x10D4FF31}, + {0x00000060, 0x00000000}, + {0x00000068, 0x00000000}, + {0x00000070, 0x00000000}, + {0x00000078, 0x00000000}, + {0x00000061, 0x00000000}, + {0x00000069, 0x00000000}, + {0x00000071, 0x00000000}, + {0x00000079, 0x00000000}, + {0x00000062, 0x00000000}, + {0x0000006A, 0x00000000}, + {0x00000072, 0x00000000}, + {0x0000007A, 0x00000000}, + {0x00000063, 0x00000000}, + {0x0000006B, 0x00000000}, + {0x00000073, 0x00000000}, + {0x0000007B, 0x00000000}, + {0x00000064, 0x00000000}, + {0x0000006C, 0x00000000}, + {0x00000074, 0x00000000}, + {0x0000007C, 0x00000000}, + {0x00000065, 0x00000000}, + {0x0000006D, 0x00000000}, + {0x00000075, 0x00000000}, + {0x0000007D, 0x00000000}, + {0x00000066, 0x00000000}, + {0x0000006E, 0x00000000}, + {0x00000076, 0x00000000}, + {0x0000007E, 0x00000000}, + {0x00000067, 0x00000000}, + {0x0000006F, 0x00000000}, + {0x00000077, 0x00000000}, + {0x0000007F, 0x00000000}, + {0x00000058, 0x00000000}, + {0x00000059, 0x00000000}, + {0x0000005A, 0x00000000}, + {0x0000005B, 0x00000000}, + {0x00000196, 0x00000000}, + {0x000001A1, 0x00FFFFFF}, + {0x00000197, 0x00000000}, + {0x000001A2, 0x00FFFFFF}, + {0x00000198, 0x00000000}, + {0x000001A3, 0x00FFFFFF}, + {0x00000199, 0x00000000}, + {0x000001A4, 0x00FFFFFF}, + {0x00000050, 0x00000000}, + {0x00000040, 0xFFFFFFFF}, + {0x0000005C, 0x10010100}, + {0x000001C8, 0x00000001} +}; +static unsigned nv4TablePGRAPH_8BPP[][2] = +{ + {0x000001C4, 0xFFFFFFFF}, + {0x000001C9, 0x00111111}, + {0x00000186, 0x00001010}, + {0x0000020C, 0x01010101} +}; +static unsigned nv4TablePGRAPH_15BPP[][2] = +{ + {0x000001C4, 0xFFFFFFFF}, + {0x000001C9, 0x00226222}, + {0x00000186, 0x00002071}, + {0x0000020C, 0x09090909} +}; +static unsigned nv4TablePGRAPH_16BPP[][2] = +{ + {0x000001C4, 0xFFFFFFFF}, + {0x000001C9, 0x00556555}, + {0x00000186, 0x000050C2}, + {0x0000020C, 0x0C0C0C0C} +}; +static unsigned nv4TablePGRAPH_32BPP[][2] = +{ + {0x000001C4, 0xFFFFFFFF}, + {0x000001C9, 0x0077D777}, + {0x00000186, 0x000070E5}, + {0x0000020C, 0x07070707} +}; +static unsigned nv4TablePRAMIN[][2] = +{ + {0x00000000, 0x80000010}, + {0x00000001, 0x80011145}, + {0x00000002, 0x80000011}, + {0x00000003, 0x80011146}, + {0x00000004, 0x80000012}, + {0x00000005, 0x80011147}, + {0x00000006, 0x80000013}, + {0x00000007, 0x80011148}, + {0x00000020, 0x80000000}, + {0x00000021, 0x80011142}, + {0x00000022, 0x80000001}, + {0x00000023, 0x80011143}, + {0x00000024, 0x80000002}, + {0x00000025, 0x80011144}, + {0x00000500, 0x00003000}, + {0x00000501, 0x02FFFFFF}, + {0x00000502, 0x00000002}, + {0x00000503, 0x00000002}, + {0x00000508, 0x01008043}, + {0x0000050A, 0x00000000}, + {0x0000050B, 0x00000000}, + {0x0000050C, 0x01008019}, + {0x0000050E, 0x00000000}, + {0x0000050F, 0x00000000}, + {0x00000510, 0x01008018}, + {0x00000512, 0x00000000}, + {0x00000513, 0x00000000}, + {0x00000514, 0x0100A033}, + {0x00000516, 0x00000000}, + {0x00000517, 0x00000000}, + {0x00000518, 0x0100805F}, + {0x0000051A, 0x00000000}, + {0x0000051B, 0x00000000}, + {0x0000051C, 0x0100804B}, + {0x0000051E, 0x00000000}, + {0x0000051F, 0x00000000}, + {0x00000520, 0x0100A048}, + {0x00000521, 0x00000D01}, + {0x00000522, 0x11401140}, + {0x00000523, 0x00000000} +}; +static unsigned nv4TablePRAMIN_8BPP[][2] = +{ + {0x00000509, 0x00000301}, + {0x0000050D, 0x00000301}, + {0x00000511, 0x00000301}, + {0x00000515, 0x00000301}, + {0x00000519, 0x00000301}, + {0x0000051D, 0x00000301} +}; +static unsigned nv4TablePRAMIN_15BPP[][2] = +{ + {0x00000509, 0x00000901}, + {0x0000050D, 0x00000901}, + {0x00000511, 0x00000901}, + {0x00000515, 0x00000901}, + {0x00000519, 0x00000901}, + {0x0000051D, 0x00000901} +}; +static unsigned nv4TablePRAMIN_16BPP[][2] = +{ + {0x00000509, 0x00000C01}, + {0x0000050D, 0x00000C01}, + {0x00000511, 0x00000C01}, + {0x00000515, 0x00000C01}, + {0x00000519, 0x00000C01}, + {0x0000051D, 0x00000C01} +}; +static unsigned nv4TablePRAMIN_32BPP[][2] = +{ + {0x00000509, 0x00000E01}, + {0x0000050D, 0x00000E01}, + {0x00000511, 0x00000E01}, + {0x00000515, 0x00000E01}, + {0x00000519, 0x00000E01}, + {0x0000051D, 0x00000E01} +}; + diff -u --recursive --new-file v2.3.25/linux/drivers/video/rivafb.c linux/drivers/video/rivafb.c --- v2.3.25/linux/drivers/video/rivafb.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/video/rivafb.c Tue Nov 2 08:15:05 1999 @@ -0,0 +1,1890 @@ +/* + * linux/drivers/video/rivafb.c - nVidia RIVA 128/TNT/TNT2 fb driver + * + * Copyright 1999 Jeff Garzik + * + * Contributors: + * + * ani joshi: Lots of debugging and cleanup work, really helped + * get the driver going + * + * Initial template from skeletonfb.c, created 28 Dec 1997 by Geert Uytterhoeven + * Includes riva_hw.c from nVidia, see copyright below. + * KGI code provided the basis for state storage, init, and mode switching. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file README.legal in the main directory of this archive + * for more details. + */ + +/* version number of this driver */ +#define RIVAFB_VERSION "0.6.5" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include