diff -u --recursive --new-file v2.3.48/linux/CREDITS linux/CREDITS
--- v2.3.48/linux/CREDITS	Sat Feb 26 22:31:37 2000
+++ linux/CREDITS	Thu Mar  2 11:17:32 2000
@@ -701,6 +701,14 @@
 S: 1131 Budapest
 S: Hungary
 
+N: Ben Fennema
+E: bfennema@falcon.csc.calpoly.edu
+W: http://www.csc.calpoly.edu/~bfennema
+D: UDF filesystem
+S: 21760 Irma Lyle Drive
+S: Los Gatos, CA 95033-8942
+S: USA
+
 N: Jürgen Fischer
 E: fischer@norbit.de (=?iso-8859-1?q?J=FCrgen?= Fischer)
 D: Author of Adaptec AHA-152x SCSI driver
@@ -1194,8 +1202,9 @@
 S: USA
 
 N: Russell King
-E: rmk@arm.uk.linux.org
+E: rmk@arm.linux.org.uk
 D: Linux/arm integrator, maintainer & hacker
+D: Acornfb, Cyber2000fb author
 S: Burgh Heath, Tadworth, Surrey.
 S: England
 
diff -u --recursive --new-file v2.3.48/linux/Documentation/Configure.help linux/Documentation/Configure.help
--- v2.3.48/linux/Documentation/Configure.help	Sat Feb 26 22:31:37 2000
+++ linux/Documentation/Configure.help	Thu Mar  2 10:10:24 2000
@@ -339,10 +339,6 @@
   performance, look for the hdparm package at
   ftp://metalab.unc.edu/pub/Linux/kernel/patches/diskdrives/ .
 
-  To fine-tune ATA/IDE drive/interface parameters for improved
-  performance, look for the hdparm package at
-  ftp://metalab.unc.edu/pub/Linux/kernel/patches/diskdrives/ .
-
   If you want to compile this driver as a module ( = code which can be
   inserted in and removed from the running kernel whenever you want),
   say M here and read Documentation/modules.txt and
@@ -8478,12 +8474,11 @@
   USB mouse and prefer to use the mouse in its limited Boot Protocol
   mode. This driver is much smaller than the HID one.
 
-Wacom Graphire tablet support
-CONFIG_USB_GRAPHIRE
+Wacom Intuos/Graphire tablet support
+CONFIG_USB_WACOM
   Say Y here if you want to use the USB version of the Wacom
-  Graphire tablet. Make sure you select Mouse and Event support,
-  don't select HID support, because this driver collides with it.
-  Use HIDBP support for keyboards and mice instead if you need it.
+  Intuos or Graphire tablet. Make sure you select Mouse and Event
+  support as well.
 
 Logitech WingMan Force joystick support
 CONFIG_USB_WMFORCE
@@ -8656,6 +8651,18 @@
   The module will be called ov511.o. If you want to compile it as a
   module, say M here and read Documentation/modules.txt.
 
+USB ADMtek's Pegasus based ethernet devices support
+CONFIG_USB_PEGASUS
+  Say Y if you want to use your usb ethernet device. Note that
+  the code is still experimental. If you have devices with other
+  vendor IDs than ADMtek's you should change/add them in the
+  driver code and send a message to me (petkan@spct.net) for 
+  update.
+  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 ov511.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
@@ -8740,7 +8747,18 @@
   5Mbit/s.  Configure this driver after connecting the USB cable via
   ifconfig plusb0 10.0.0.1 pointopoint 10.0.0.2 
   (and vice versa on the other host).
- 
+
+USB Diamond Rio500 support
+CONFIG_USB_RIO500
+  Say Y here if you want to connect a USB rio500 to your
+  computer's USB port. Please read Documentation/usb/rio.txt
+  for more information.
+
+  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 rio500.o. If you want to compile it as
+  a module, say M here and read Documentation/modules.txt.
+  
 ACPI support
 CONFIG_ACPI
   Advanced Configuration and Power Interface (ACPI) is an interface
@@ -11113,13 +11131,15 @@
   Intel processors in P6 family, e.g.  Pentium Pro, Pentium II, 
   Pentium III, Xeon etc. You will obviously need the actual microcode
   binary data itself which is not shipped with the Linux kernel. 
-  Contact Intel to obtain the latest revision of microcode for 
-  your CPU(s). With this support compiled you can use dd(1) to write
-  microcode, for example:
+  With this support compiled you can use dd(1) to write microcode,
+  for example:
+
+     # dd if=/etc/microcode of=/dev/cpu/microcode bs=98304 count=1
 
-     # dd if=/etc/microcode of=/proc/driver/microcode bs=98304 count=1
+  You need to be superuser to do that. For latest news and information
+  on obtaining all the required ingredients for this driver, check:
 
-  You need to be superuser to do that.
+     http://www.ocston.org/~tigran/patches/microcode
 
   This driver is also available as a module ( = code which can be
   inserted in and removed from the running kernel whenever you want).
diff -u --recursive --new-file v2.3.48/linux/Documentation/filesystems/udf.txt linux/Documentation/filesystems/udf.txt
--- v2.3.48/linux/Documentation/filesystems/udf.txt	Fri Jan 28 15:09:06 2000
+++ linux/Documentation/filesystems/udf.txt	Thu Mar  2 11:17:32 2000
@@ -1,7 +1,7 @@
 *
 * ./Documentation/filesystems/udf.txt
 *
-UDF Filesystem version 0.9.0
+UDF Filesystem version 0.9.1
 
 If you encounter problems with reading UDF discs using this driver,
 please report them to linux_udf@hootie.lvld.hp.com, which is the
@@ -16,13 +16,17 @@
 	gid=		Set the default group.
 	umask=		Set the default umask.
 	uid=		Set the default user.
+	bs=			Set the block size. 
 	unhide		Show otherwise hidden files.
 	undelete	Show deleted files in lists.
+	adinicb		Embed data in the inode (default)
+	noadinicb	Don't embed data in the inode
+	shortad		Use short ad's
+	longad		Use long ad's (default)
 	strict		Set strict conformance (unused)
 
 The remaining are for debugging and disaster recovery:
 
-	bs=			Set the block size. (may not work unless 2048)
 	novrs		Skip volume sequence recognition 
 
 The following expect a offset from 0.
@@ -46,7 +50,8 @@
 	http://www.trylinux.com/projects/udf/index.html
 
 For the latest version and toolset see:
-	 http://www.csc.calpoly.edu/~bfennema/udf.html
+	http://www.csc.calpoly.edu/~bfennema/udf.html
+	http://linux-udf.sourceforge.net/
 
 Documentation on UDF and ECMA 167 is available FREE from:
     http://www.osta.org/
diff -u --recursive --new-file v2.3.48/linux/Documentation/usb/ibmcam.txt linux/Documentation/usb/ibmcam.txt
--- v2.3.48/linux/Documentation/usb/ibmcam.txt	Thu Feb 10 17:11:02 2000
+++ linux/Documentation/usb/ibmcam.txt	Mon Feb 28 14:21:15 2000
@@ -10,7 +10,12 @@
 I did not have any input from Xirlink. Some people asked about
 data sheets, but nothing came out of that. I didn't try.
 
-Video formats: 128x96, 176x144, 352x288
+Video formats:
+      128x96  [model 1]
+      176x144
+      320x240 [model 2]
+      352x240 [model 2]
+      352x288
 Frame rate: 3 - 30 frames per second (FPS)
 External interface: USB
 Internal interface: Video For Linux (V4L)
@@ -28,11 +33,11 @@
 
 The Linux driver was developed with camera with following
 model number (or FCC ID): KSX-XVP510. This camera has three
-interfaces, each with one endpoint (control, iso, iso).
+interfaces, each with one endpoint (control, iso, iso). This
+type of cameras is referred to as "model 1".
 
 It appears that Xirlink made some changes in their cameras recently.
-In particular, following models [FCC ID] are suspect; one with
-with FCC ID KSX-X9903 is known to be one of them:
+In particular, following models [FCC ID] belong to that category:
 
 XVP300 [KSX-X9903]
 XVP600 [KSX-X9902]
@@ -41,12 +46,57 @@
 (see http://www.xirlink.com/ibmpccamera/ for updates, they refer
 to these new cameras by Windows driver dated 12-27-99, v3005 BETA)
 These cameras have two interfaces, one endpoint in each (iso, bulk).
-Attempts to remotely debug one of these cameras weren't successful.
-I'd need to have a camera to figure out how to use it.
+Such type of cameras is referred to as "model 2". They are supported.
+
+Quirks of Model 2 cameras:
+-------------------------
+
+These cameras apparently produce only 176x144 native video stream;
+the 352x288 formats are produced from 176x144 RGB stream. In fact,
+Xirlink broke perfectly good Model 1 (which used I420 on all sizes)
+and instead switched to color-separated RGB which is a terrible waste
+of bandwidth and resolution. However it probably allowed to simplify
+the camera and use less RAM. Model 2 camera works visibly worse than
+model 1 even using Xirlink's own driver on Windows. The image quality
+is better on Linux than on Windows, partly thanks to _absence_ of
+annoying automatic color corrections which Windows driver feeds into
+the camera several times per second.
+
+Model 2 does not have hardware contrast control. Corresponding V4L
+control is not used at the moment. It may be possible to implement
+contrast control in software, at cost of extra processor cycles.
+
+The bandwidth demand imposed by RGB quasi-352x288 mode (800 Kbits per
+frame) essentially limits this mode to 10 frames per second or less, in
+ideal conditions on the bus (USB is shared, after all). The frame rate
+has to be programmed very conservatively. Additional concern is that
+frame rate depends on brightness setting; therefore the picture can
+be good at one brightness and broken at another! I did not want to fix
+the frame rate at slowest setting, but I had to move it pretty much down
+the scale (so that framerate option barely matters). I also noticed that
+camera after first powering up produces frames slightly faster than during
+consecutive uses. All this means that if you use videosize=2 (which is
+default), be warned - you may encounter broken picture on first connect;
+try to adjust brightness - brighter image is slower, so USB will be able
+to send all data. However if you regularly use Model 2 cameras you may
+prefer videosize=1 which makes perfectly good I420, with no scaling and
+lesser demands on USB (300 Kbits per second, or 26 frames per second).
+Remember that model 2 cameras never produce images with resolution
+better than "true" 176x144 - or so it seems.
+
+The camera that I had also has a hardware quirk: if disconnected,
+it needs few minutes to "relax" before it can be plugged in again
+(poorly designed USB processor reset circuit?)
+
+Finally, to say something good about Model 2: it is much simpler to program
+than Model 1. Commands are few, and they all are straightforward. This camera
+can be programmed for very high sensitivity (starlight may be enough), this
+makes it convenient for tinkering with. The driver code has enough comments
+to help a programmer to tweak the camera as s/he feels necessary.
 
 WHAT YOU NEED:
 
-- A supported IBM PC (C-it) camera (see above)
+- A supported IBM PC (C-it) camera (model 1 or 2)
 
 - A Linux box with USB support (2.3/2.4 or 2.2 w/backport)
 
@@ -85,7 +135,7 @@
 
 The driver can have options, though some defaults are provided.
 
-Driver options:
+Driver options: (* indicates that option is model-dependent)
 
 Name            Type            Range [default] Example
 --------------  --------------  --------------  ------------------
@@ -97,9 +147,18 @@
 init_contrast   Integer         0-255 [192]     init_contrast=200
 init_color      Integer         0-255 [128]     init_color=130
 init_hue        Integer         0-255 [128]     init_hue=115
-lighting        Integer         0-2 [1]         lighting=2
-sharpness       Integer         0-6 [4]         sharpness=3
-videosize       Integer         0-2 [2]         videosize=1
+lighting        Integer         0-2* [1]        lighting=2
+sharpness       Integer         0-6* [4]        sharpness=3
+videosize       Integer         0-2* [2]        videosize=1
+
+Options for Model 2 only:
+
+Name            Type            Range [default] Example
+--------------  --------------  --------------  ------------------
+init_model2_rg  Integer         0..255 [0x70]   init_model2_rg=128
+init_model2_rg2 Integer         0..255 [0x2f]   init_model2_rg2=50
+init_model2_sat Integer         0..255 [0x34]   init_model2_sat=65
+init_model2_yb  Integer         0..255 [0xa0]   init_model2_yb=200
 
 debug           You don't need this option unless you are a developer.
                 If you are a developer then you will see in the code
@@ -145,49 +204,80 @@
                 preconfigure the camera when it gets connected, before
                 any V4L application connects to it. Good for webcams.
 
+init_model2_rg  These initial settings alter color balance of the
+init_model2_rg2 camera on hardware level. All four settings may be used
+init_model2_sat to tune the camera to specific lighting conditions. These
+init_model2_yb  settings only apply to Model 2 cameras.
+
 lighting        This option selects one of three hardware-defined
                 photosensitivity settings of the camera. 0=bright light,
                 1=Medium (default), 2=Low light. This setting affects
                 frame rate: the dimmer the lighting the lower the frame
-                rate (because longer exposition time is needed).
+                rate (because longer exposition time is needed). The
+                Model 2 cameras allow values more than 2 for this option,
+                thus enabling extremely high sensitivity at cost of frame
+                rate, color saturation and imaging sensor noise.
 
 sharpness       This option controls smoothing (noise reduction)
                 made by camera. Setting 0 is most smooth, setting 6
                 is most sharp. Be aware that CMOS sensor used in the
                 camera is pretty noisy, so if you choose 6 you will
-                be greeted with "snowy" image. Default is 4.
+                be greeted with "snowy" image. Default is 4. Model 2
+                cameras do not support this feature.
 
 videosize       This setting chooses one if three image sizes that are
                 supported by this driver. Camera supports more, but
                 it's difficult to reverse-engineer all formats.
                 Following video sizes are supported:
 
-                videosize=0     128x96
+                videosize=0     128x96  (Model 1 only)
                 videosize=1     176x144
                 videosize=2     352x288
+                videosize=3     320x240 (Model 2 only)
+                videosize=4     352x240 (Model 2 only)
 
                 The last one (352x288) is the native size of the sensor
-                array, so it's the best resolution camera can yield.
+                array, so it's the best resolution camera (Model 1) can
+                yield. The best resolution of Model 2 is 176x144, and
+                larger images are produced by stretching the bitmap.
                 Choose the image size you need. The smaller image can
                 support faster frame rate. Default is 352x288.
 
 WHAT NEEDS TO BE DONE:
 
 - The box freezes if camera is unplugged after being used (OHCI).
-  Workaround: don't do that :)
-- Some USB frames are lost on high frame rates, though they shouldn't
-- ViCE compression (Xirlink proprietary) may improve frame rate
-- On occasion camera does not start properly; xawtv reports errors.
-  Workaround: reload the driver module. Reason: [1].
-- On occasion camera produces negative image (funny colors.)
+  Workaround: remove usb-ohci module first.
+- On occasion camera (model 1) does not start properly (xawtv reports
+  errors), or camera produces negative image (funny colors.)
   Workaround: reload the driver module. Reason: [1].
 - The button on the camera is not used. I don't know how to get to it.
+  I know now how to read button on Model 2, but what to do with it?
 
 [1]
 - Camera reports its status back to the driver; however I don't know
   what returned data means. If camera fails at some initialization
   stage then something should be done, and I don't do that because
-  I don't even know that some command failed.
+  I don't even know that some command failed. This is mostly Model 1
+  concern because Model 2 uses different commands which do not return
+  status (and seem to complete successfully every time).
+
+VIDEO SIZE AND IMAGE SIZE
+
+Camera produces picture X by Y pixels. This is camera-specific and can be
+altered by programming the camera accordingly. This image is placed onto
+larger (or equal) area W by H, this is V4L image. At this time the driver
+uses V4L image size (W by H) 352x288 pixels because many programs (such
+as xawtv) expect quite specific sizes and don't want to deal with arbitrary,
+camera-specific sizes. However this approach "hides" real image size, and
+application always sees the camera as producing only 352x288 image. It is
+possible to change the V4L image size to 128x96, and then if camera is
+switched to 128x96 mode then xawtv will correctly accept this image size. But
+many other popular sizes (such as 176x144) will not be welcomed. This is the
+reason why all camera images are at this time placed onto 352x288 "canvas",
+and size of that canvas (V4L) is reported to applications. It will be easy
+to add options to control the canvas size, but it will be application-
+specific because not all applications are ready to work with variety of
+camera-specific sizes.
 
 CREDITS:
 
diff -u --recursive --new-file v2.3.48/linux/Documentation/usb/rio.txt linux/Documentation/usb/rio.txt
--- v2.3.48/linux/Documentation/usb/rio.txt	Wed Dec 31 16:00:00 1969
+++ linux/Documentation/usb/rio.txt	Thu Mar  2 10:10:24 2000
@@ -0,0 +1,138 @@
+Copyright (C) 1999, 2000 Bruce Tenison
+Portions Copyright (C) 1999, 2000 David Nelson
+Thanks to David Nelson for guidance and the usage of the scanner.txt
+and scanner.c files to model our driver and this informative file.
+
+Mar. 2, 2000
+
+CHANGES
+
+- Initial Revision
+
+
+OVERVIEW
+
+This README will address issues regarding how to configure the kernel
+to access a RIO 500 mp3 player.  
+Before I explain how to use this to access the Rio500 please be warned:
+
+W A R N I N G:
+--------------
+
+Please note that this software is still under development.  The authors
+are in no way responsible for any damage that may occur, no matter how
+inconsequential.
+
+It seems that the Rio has a problem when sending .mp3 with low batteries.
+I suggest when the batteries are low and want to transfer stuff that you
+replace it with a fresh one. In my case, what happened is I lost two 16kb
+blocks (they are no longer usable to store information to it). But I don't
+know if thats normal or not. It could simply be a problem with the flash 
+memory.
+
+In an extreme case, I left my Rio playing overnight and the batteries wore 
+down to nothing and appear to have corrupted the flash memory. My RIO 
+needed to be replaced as a result.  Diamond tech support is aware of the 
+problem.  Do NOT allow your batteries to wear down to nothing before 
+changing them.  It appears RIO 500 firmware does not handle low battery 
+power well at all. 
+
+On systems with OHCI controllers, the kernel OHCI code appears to have 
+power on problems with some chipsets.  If you are having problems 
+connecting to your RIO 500, try turning it on first and then plugging it 
+into the USB cable.  
+
+Contact information:
+--------------------
+
+   The main page for the project is hosted at sourceforge.net in the following
+   address: http://rio500.sourceforge.net You can also go to the sourceforge
+   project page at: http://sourceforge.net/project/?group_id=1944 There is 
+   also a mailing list: rio500-users@lists.sourceforge.net
+
+Authors:
+-------
+
+Most of the code was written by Cesar Miquel <miquel@df.uba.ar>. Keith 
+Clayton <kclayton@jps.net> is incharge of the PPC port and making sure
+things work there. Bruce Tenison <btenison@dibbs.net> is adding support
+for .fon files and also does testing. The program will mostly sure be
+re-written and Pete Ikusz along with the rest will re-design it. I would
+also like to thank Tri Nguyen <tmn_3022000@hotmail.com> who provided use 
+with some important information regarding the communication with the Rio.
+
+ADDITIONAL INFORMATION and Userspace tools
+
+http://rio500.sourceforge.net/
+
+
+REQUIREMENTS
+
+A host with a USB port.  Ideally, either a UHCI (Intel) or OHCI
+(Compaq and others) hardware port should work.
+
+A Linux development kernel (2.3.x) with USB support enabled or a
+backported version to linux-2.2.x.  See http://www.linux-usb.org for
+more information on accomplishing this.
+
+A Linux kernel with RIO 500 support enabled.
+
+'lspci' which is only needed to determine the type of USB hardware
+available in your machine.
+
+CONFIGURATION
+
+Using `lspci -v`, determine the type of USB hardware available.
+
+  If you see something like:
+
+    USB Controller: ......
+    Flags: .....
+    I/O ports at ....
+
+  Then you have a UHCI based controller.
+
+  If you see something like:
+
+     USB Controller: .....
+     Flags: ....
+     Memory at .....
+
+  Then you have a OHCI based controller.
+
+Using `make menuconfig` or your preferred method for configuring the
+kernel, select 'Support for USB', 'OHCI/UHCI' depending on your
+hardware (determined from the steps above), 'USB Diamond Rio500 support', and
+'Preliminary USB device filesystem'.  Compile and install the modules
+(you may need to execute `depmod -a` to update the module
+dependencies).
+
+Add a device for the USB rio500:
+  `mknod /dev/usb/rio500 c 180 64`
+
+Set appropriate permissions for /dev/usb/rio500 (don't forget about
+group and world permissions).  Both read and write permissions are
+required for proper operation.
+
+Load the appropriate modules (if compiled as modules):
+
+  OHCI:
+    modprobe usbcore
+    modprobe usb-ohci
+    modprobe rio500
+
+  UHCI:
+    modprobe usbcore
+    modprobe usb-uhci  (or uhci)
+    modprobe rio500
+
+That's it.  The Rio500 Utils at: http://rio500.sourceforge.net should
+be able to access the rio500.
+
+BUGS
+
+If you encounter any problems feel free to drop me an email.
+
+Bruce Tenison
+btenison@dibbs.net
+
diff -u --recursive --new-file v2.3.48/linux/MAINTAINERS linux/MAINTAINERS
--- v2.3.48/linux/MAINTAINERS	Sat Feb 26 22:31:38 2000
+++ linux/MAINTAINERS	Thu Mar  2 10:10:24 2000
@@ -148,7 +148,7 @@
 P:	Russell King
 M:	linux@arm.linux.org.uk
 L:	linux-arm@vger.rutgers.edu
-W:	http://www.arm.linux.org.uk/~rmk/armlinux.html
+W:	http://www.arm.linux.org.uk/
 S:	Maintained
 
 ARPD SUPPORT
@@ -234,6 +234,12 @@
 M:	jam@acm.org
 S:	Maintained
 
+CYBERPRO FB DRIVER
+P:	Russell King
+M:	linux@arm.linux.org.uk
+W:	http://www.arm.linux.org.uk/
+S:	Maintained
+
 CYCLADES 2X SYNC CARD DRIVER
 P:	Arnaldo Carvalho de Melo
 M:	acme@conectiva.com.br
@@ -1125,6 +1131,13 @@
 P:	Jeff Garzik
 M:	jgarzik@mandrakesoft.com
 L:	linux-via@gtf.org
+S:	Maintained
+
+USB DIAMOND RIO500 DRIVER
+P:	Cesar Miquel
+M:	miquel@df.uba.ar
+L:	rio500-users@lists.sourceforge.net
+W:	http://rio500.sourceforge.net
 S:	Maintained
 
 VIDEO FOR LINUX
diff -u --recursive --new-file v2.3.48/linux/Makefile linux/Makefile
--- v2.3.48/linux/Makefile	Sat Feb 26 22:31:38 2000
+++ linux/Makefile	Sat Feb 26 22:32:57 2000
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 3
-SUBLEVEL = 48
+SUBLEVEL = 49
 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.48/linux/arch/alpha/kernel/Makefile linux/arch/alpha/kernel/Makefile
--- v2.3.48/linux/arch/alpha/kernel/Makefile	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/Makefile	Mon Feb 28 14:52:42 2000
@@ -13,10 +13,21 @@
 	$(CC) -D__ASSEMBLY__ $(AFLAGS) -c -o $*.o $<
 
 O_TARGET := kernel.o
-O_OBJS   := entry.o traps.o process.o osf_sys.o irq.o signal.o setup.o \
-	    ptrace.o time.o semaphore.o i8259.o
+O_OBJS   := entry.o traps.o process.o osf_sys.o irq.o irq_alpha.o \
+	    signal.o setup.o ptrace.o time.o semaphore.o
 OX_OBJS  := alpha_ksyms.o
 
+L_TARGET := rest.a
+L_OBJS	 := irq_i8259.o irq_srm.o \
+	    es1888.o smc37c669.o smc37c93x.o ns87312.o
+
+ifdef CONFIG_SMP
+O_OBJS   += smp.o irq_smp.o
+endif
+
+ifdef CONFIG_PCI
+L_OBJS   += pci.o pci_iommu.o
+endif
 
 ifdef CONFIG_ALPHA_GENERIC
 
@@ -25,13 +36,9 @@
 	    sys_alcor.o sys_cabriolet.o sys_dp264.o sys_eb64p.o sys_eiger.o \
 	    sys_jensen.o sys_miata.o sys_mikasa.o sys_nautilus.o \
 	    sys_noritake.o sys_rawhide.o sys_ruffian.o sys_rx164.o \
-	    sys_sable.o sys_sio.o sys_sx164.o sys_takara.o sys_rx164.o \
-	    es1888.o smc37c669.o smc37c93x.o ns87312.o pci.o pci_iommu.o
-else
+	    sys_sable.o sys_sio.o sys_sx164.o sys_takara.o sys_rx164.o
 
-ifdef CONFIG_PCI
-O_OBJS   += pci.o pci_iommu.o
-endif
+else
 
 # Core logic support
 ifdef CONFIG_ALPHA_APECS
@@ -67,10 +74,10 @@
 O_OBJS   += sys_alcor.o
 endif
 ifneq ($(CONFIG_ALPHA_CABRIOLET)$(CONFIG_ALPHA_EB164)$(CONFIG_ALPHA_EB66P)$(CONFIG_ALPHA_LX164)$(CONFIG_ALPHA_PC164),)
-O_OBJS   += sys_cabriolet.o ns87312.o
+O_OBJS   += sys_cabriolet.o
 endif
 ifdef CONFIG_ALPHA_DP264
-O_OBJS   += sys_dp264.o es1888.o smc37c669.o
+O_OBJS   += sys_dp264.o
 endif
 ifneq ($(CONFIG_ALPHA_EB64P)$(CONFIG_ALPHA_EB66),)
 O_OBJS   += sys_eb64p.o
@@ -82,7 +89,7 @@
 O_OBJS   += sys_jensen.o
 endif
 ifdef CONFIG_ALPHA_MIATA
-O_OBJS   += sys_miata.o es1888.o smc37c669.o
+O_OBJS   += sys_miata.o
 endif
 ifdef CONFIG_ALPHA_MIKASA
 O_OBJS   += sys_mikasa.o
@@ -106,25 +113,18 @@
 O_OBJS   += sys_sable.o
 endif
 ifneq ($(CONFIG_ALPHA_BOOK1)$(CONFIG_ALPHA_AVANTI)$(CONFIG_ALPHA_NONAME)$(CONFIG_ALPHA_P2K)$(CONFIG_ALPHA_XL),)
-O_OBJS   += sys_sio.o ns87312.o
+O_OBJS   += sys_sio.o
 endif
 ifdef CONFIG_ALPHA_SX164
-O_OBJS   += sys_sx164.o smc37c669.o
+O_OBJS   += sys_sx164.o
 endif
 ifdef CONFIG_ALPHA_TAKARA
-O_OBJS   += sys_takara.o ns87312.o
-endif
-
-# Device support
-ifneq ($(CONFIG_ALPHA_PC164)$(CONFIG_ALPHA_LX164),)
-O_OBJS   += smc37c93x.o
+O_OBJS   += sys_takara.o
 endif
 
 endif # GENERIC
 
-ifdef CONFIG_SMP
-O_OBJS   += smp.o
-endif
+O_OBJS	+= $(L_TARGET)
 
 all: kernel.o head.o
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/core_apecs.c linux/arch/alpha/kernel/core_apecs.c
--- v2.3.48/linux/arch/alpha/kernel/core_apecs.c	Thu Feb 10 17:11:02 2000
+++ linux/arch/alpha/kernel/core_apecs.c	Thu Mar  2 11:35:12 2000
@@ -385,7 +385,7 @@
 	 * Window 1 is direct access 1GB at 1GB
 	 * Window 2 is scatter-gather 8MB at 8MB (for isa)
 	 */
-	hose->sg_isa = iommu_arena_new(0x00800000, 0x00800000, PAGE_SIZE);
+	hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
 	hose->sg_pci = NULL;
 	__direct_map_base = 0x40000000;
 	__direct_map_size = 0x40000000;
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/core_cia.c linux/arch/alpha/kernel/core_cia.c
--- v2.3.48/linux/arch/alpha/kernel/core_cia.c	Thu Feb 10 17:11:02 2000
+++ linux/arch/alpha/kernel/core_cia.c	Thu Mar  2 11:35:12 2000
@@ -405,10 +405,12 @@
 	 * ??? We ought to scale window 1 with memory.
 	 */
 
-	/* NetBSD hints that page tables must be aligned to 32K due
-	   to a hardware bug.  No description of what models affected.  */
-	hose->sg_isa = iommu_arena_new(0x00800000, 0x00800000, 32768);
-	hose->sg_pci = iommu_arena_new(0x40000000, 0x08000000, 32768);
+	/* ??? NetBSD hints that page tables must be aligned to 32K,
+	   possibly due to a hardware bug.  This is over-aligned
+	   from the 8K alignment one would expect for an 8MB window. 
+	   No description of what CIA revisions affected.  */
+	hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0x8000);
+	hose->sg_pci = iommu_arena_new(hose, 0x40000000, 0x08000000, 0);
 	__direct_map_base = 0x80000000;
 	__direct_map_size = 0x80000000;
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/core_lca.c linux/arch/alpha/kernel/core_lca.c
--- v2.3.48/linux/arch/alpha/kernel/core_lca.c	Thu Feb 10 17:11:02 2000
+++ linux/arch/alpha/kernel/core_lca.c	Thu Mar  2 11:35:12 2000
@@ -307,7 +307,7 @@
 	 * Window 0 is direct access 1GB at 1GB
 	 * Window 1 is scatter-gather 8MB at 8MB (for isa)
 	 */
-	hose->sg_isa = iommu_arena_new(0x00800000, 0x00800000, PAGE_SIZE);
+	hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
 	hose->sg_pci = NULL;
 	__direct_map_base = 0x40000000;
 	__direct_map_size = 0x40000000;
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/core_mcpcia.c linux/arch/alpha/kernel/core_mcpcia.c
--- v2.3.48/linux/arch/alpha/kernel/core_mcpcia.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/core_mcpcia.c	Thu Mar  2 11:35:12 2000
@@ -404,8 +404,8 @@
 	 * ??? We ought to scale window 1 with memory.
 	 */
 
-	hose->sg_isa = iommu_arena_new(0x00800000, 0x00800000, PAGE_SIZE);
-	hose->sg_pci = iommu_arena_new(0x40000000, 0x08000000, PAGE_SIZE);
+	hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
+	hose->sg_pci = iommu_arena_new(hose, 0x40000000, 0x08000000, 0);
 	__direct_map_base = 0x80000000;
 	__direct_map_size = 0x80000000;
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/core_pyxis.c linux/arch/alpha/kernel/core_pyxis.c
--- v2.3.48/linux/arch/alpha/kernel/core_pyxis.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/core_pyxis.c	Thu Mar  2 11:35:12 2000
@@ -36,7 +36,6 @@
  */
 
 #define DEBUG_CONFIG 0
-
 #if DEBUG_CONFIG
 # define DBG_CNF(args)	printk args
 #else
@@ -304,7 +303,7 @@
 	pyxis_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16));
 }
 
-static inline void
+static void
 pyxis_disable_irq(unsigned int irq)
 {
 	pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16)));
@@ -318,6 +317,13 @@
 }
 
 static void
+pyxis_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		pyxis_enable_irq(irq);
+}
+
+static void
 pyxis_mask_and_ack_irq(unsigned int irq)
 {
 	unsigned long bit = 1UL << (irq - 16);
@@ -340,7 +346,7 @@
 	enable:		pyxis_enable_irq,
 	disable:	pyxis_disable_irq,
 	ack:		pyxis_mask_and_ack_irq,
-	end:		pyxis_enable_irq,
+	end:		pyxis_end_irq,
 };
 
 void 
@@ -382,7 +388,7 @@
 	for (i = 16; i < 48; ++i) {
 		if ((ignore_mask >> i) & 1)
 			continue;
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &pyxis_irq_type;
 	}
 
@@ -427,6 +433,8 @@
 	ctrl = *(vuip)PYXIS_CTRL;
 	*(vuip)PYXIS_CTRL = ctrl | 4;
 	mb();
+	*(vuip)PYXIS_CTRL;
+	mb();
 
 	/* Read from PCI dense memory space at TBI_ADDR, skipping 64k
 	   on each read.  This forces SG TLB misses.  It appears that
@@ -441,6 +449,8 @@
 	mb();
 	*(vuip)PYXIS_CTRL = ctrl;
 	mb();
+	*(vuip)PYXIS_CTRL;
+	mb();
 
 	__restore_flags(flags);
 }
@@ -473,31 +483,31 @@
 	struct pci_controler *hose;
 	unsigned int temp;
 
-#if 0
-	printk("pyxis_init: PYXIS_ERR_MASK 0x%x\n", *(vuip)PYXIS_ERR_MASK);
-	printk("pyxis_init: PYXIS_ERR 0x%x\n", *(vuip)PYXIS_ERR);
-	printk("pyxis_init: PYXIS_INT_REQ 0x%lx\n", *(vulp)PYXIS_INT_REQ);
-	printk("pyxis_init: PYXIS_INT_MASK 0x%lx\n", *(vulp)PYXIS_INT_MASK);
-	printk("pyxis_init: PYXIS_INT_ROUTE 0x%lx\n", *(vulp)PYXIS_INT_ROUTE);
-	printk("pyxis_init: PYXIS_INT_HILO 0x%lx\n", *(vulp)PYXIS_INT_HILO);
-	printk("pyxis_init: PYXIS_INT_CNFG 0x%x\n", *(vuip)PYXIS_INT_CNFG);
-	printk("pyxis_init: PYXIS_RT_COUNT 0x%lx\n", *(vulp)PYXIS_RT_COUNT);
-#endif
-
-	/* 
-	 * Set up error reporting. Make sure CPU_PE is OFF in the mask.
-	 */
+	/* Set up error reporting. Make sure CPU_PE is OFF in the mask.  */
 	temp = *(vuip)PYXIS_ERR_MASK;
-	temp &= ~4;   
-	*(vuip)PYXIS_ERR_MASK = temp;
-	mb();
-	*(vuip)PYXIS_ERR_MASK;	/* re-read to force write */
+	*(vuip)PYXIS_ERR_MASK = temp & ~4;
 
+	/* Enable master/target abort.  */
 	temp = *(vuip)PYXIS_ERR;
-	temp |= 0x180;		/* master/target abort */
-	*(vuip)PYXIS_ERR = temp;
+	*(vuip)PYXIS_ERR = temp | 0x180;
+
+	/* Clear the PYXIS_CFG register, which gets used  for PCI Config
+	   Space accesses.  That is the way we want to use it, and we do
+	   not want to depend on what ARC or SRM might have left behind.  */
+	*(vuip)PYXIS_CFG = 0;
+ 
+	/* Zero the HAEs.  */
+	*(vuip)PYXIS_HAE_MEM = 0;
+	*(vuip)PYXIS_HAE_IO = 0;
+
+	/* Finally, check that the PYXIS_CTRL1 has IOA_BEN set for
+	   enabling byte/word PCI bus space(s) access.  */
+	temp = *(vuip)PYXIS_CTRL1;
+	*(vuip)PYXIS_CTRL1 = temp | 1;
+
+	/* Syncronize with all previous changes.  */
 	mb();
-	*(vuip)PYXIS_ERR;	/* re-read to force write */
+	*(vuip)PYXIS_REV;
 
  	/*
 	 * Create our single hose.
@@ -524,10 +534,41 @@
 	 * address range.
 	 */
 
-	/* NetBSD hints that page tables must be aligned to 32K due
-	   to a hardware bug.  No description of what models affected.  */
-	hose->sg_isa = iommu_arena_new(0x00800000, 0x00800000, 32768);
-	hose->sg_pci = iommu_arena_new(0xc0000000, 0x08000000, 32768);
+#if 1
+	/* ??? There's some bit of syncronization wrt writing new tlb
+	   entries that's missing.  Sometimes it works, sometimes invalid
+	   tlb machine checks, sometimes hard lockup.  And this just within
+	   the boot sequence.
+
+	   I've tried extra memory barriers, extra alignment, pyxis
+	   register reads, tlb flushes, and loopback tlb accesses.
+
+	   I guess the pyxis revision in the sx164 is just too buggy...  */
+
+	hose->sg_isa = hose->sg_pci = NULL;
+	__direct_map_base = 0x40000000;
+	__direct_map_size = 0x80000000;
+
+	*(vuip)PYXIS_W0_BASE = 0x40000000 | 1;
+	*(vuip)PYXIS_W0_MASK = (0x40000000 - 1) & 0xfff00000;
+	*(vuip)PYXIS_T0_BASE = 0;
+
+	*(vuip)PYXIS_W1_BASE = 0x80000000 | 1;
+	*(vuip)PYXIS_W1_MASK = (0x40000000 - 1) & 0xfff00000;
+	*(vuip)PYXIS_T1_BASE = 0;
+
+	*(vuip)PYXIS_W2_BASE = 0;
+	*(vuip)PYXIS_W3_BASE = 0;
+
+	alpha_mv.mv_pci_tbi = NULL;
+	mb();
+#else
+	/* ??? NetBSD hints that page tables must be aligned to 32K,
+	   possibly due to a hardware bug.  This is over-aligned
+	   from the 8K alignment one would expect for an 8MB window. 
+	   No description of what CIA revisions affected.  */
+	hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0x08000);
+	hose->sg_pci = iommu_arena_new(hose, 0xc0000000, 0x08000000, 0x20000);
 	__direct_map_base = 0x40000000;
 	__direct_map_size = 0x80000000;
 
@@ -553,36 +594,7 @@
 		pyxis_enable_broken_tbi(hose->sg_pci);
 
 	alpha_mv.mv_pci_tbi(hose, 0, -1);
-
-	/*
-	 * Next, clear the PYXIS_CFG register, which gets used
-	 *  for PCI Config Space accesses. That is the way
-	 *  we want to use it, and we do not want to depend on
-	 *  what ARC or SRM might have left behind...
-	 */
-	temp = *(vuip)PYXIS_CFG;
-	if (temp != 0) {
-		*(vuip)PYXIS_CFG = 0;
-		mb();
-		*(vuip)PYXIS_CFG; /* re-read to force write */
-	}
- 
-	/* Zero the HAE.  */
-	*(vuip)PYXIS_HAE_MEM = 0U; mb();
-	*(vuip)PYXIS_HAE_MEM;	/* re-read to force write */
-	*(vuip)PYXIS_HAE_IO = 0; mb();
-	*(vuip)PYXIS_HAE_IO;	/* re-read to force write */
-
-	/*
-	 * Finally, check that the PYXIS_CTRL1 has IOA_BEN set for
-	 * enabling byte/word PCI bus space(s) access.
-	 */
-	temp = *(vuip) PYXIS_CTRL1;
-	if (!(temp & 1)) {
-		*(vuip)PYXIS_CTRL1 = temp | 1;
-		mb();
-		*(vuip)PYXIS_CTRL1; /* re-read */
-	}
+#endif
 }
 
 static inline void
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/core_tsunami.c linux/arch/alpha/kernel/core_tsunami.c
--- v2.3.48/linux/arch/alpha/kernel/core_tsunami.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/core_tsunami.c	Thu Mar  2 11:35:12 2000
@@ -343,13 +343,9 @@
 	 * because of an idiot-syncrasy of the CYPRESS chip.  It may
 	 * respond to a PCI bus address in the last 1MB of the 4GB
 	 * address range.
-	 *
-	 * Note that the TLB lookup logic uses bitwise concatenation,
-	 * not addition, so the required arena alignment is based on
-	 * the size of the window.
 	 */
-	hose->sg_isa = iommu_arena_new(0x00800000, 0x00800000, 0x00800000>>10);
-	hose->sg_pci = iommu_arena_new(0xc0000000, 0x08000000, 0x08000000>>10);
+	hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
+	hose->sg_pci = iommu_arena_new(hose, 0xc0000000, 0x08000000, 0);
 	__direct_map_base = 0x40000000;
 	__direct_map_size = 0x80000000;
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/i8259.c linux/arch/alpha/kernel/i8259.c
--- v2.3.48/linux/arch/alpha/kernel/i8259.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/i8259.c	Wed Dec 31 16:00:00 1969
@@ -1,95 +0,0 @@
-/*
- *      linux/arch/alpha/kernel/i8259.c
- *
- * This is the 'legacy' 8259A Programmable Interrupt Controller,
- * present in the majority of PC/AT boxes.
- *
- * Started hacking from linux-2.3.30pre6/arch/i386/kernel/i8259.c.
- */
-
-#include <linux/init.h>
-#include <linux/cache.h>
-#include <linux/sched.h>
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-
-#include <asm/io.h>
-
-#include "proto.h"
-#include "irq_impl.h"
-
-
-/* Note mask bit is true for DISABLED irqs.  */
-static unsigned int cached_irq_mask = 0xffff;
-
-static inline void
-i8259_update_irq_hw(unsigned int irq, unsigned long mask)
-{
-	int port = 0x21;
-	if (irq & 8) mask >>= 8;
-	if (irq & 8) port = 0xA1;
-	outb(mask, port);
-}
-
-inline void
-i8259a_enable_irq(unsigned int irq)
-{
-	i8259_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq));
-}
-
-inline void
-i8259a_disable_irq(unsigned int irq)
-{
-	i8259_update_irq_hw(irq, cached_irq_mask |= 1 << irq);
-}
-
-void
-i8259a_mask_and_ack_irq(unsigned int irq)
-{
-	i8259a_disable_irq(irq);
-
-	/* Ack the interrupt making it the lowest priority.  */
-	if (irq >= 8) {
-		outb(0xE0 | (irq - 8), 0xa0);   /* ack the slave */
-		irq = 2;
-	}
-	outb(0xE0 | irq, 0x20);			/* ack the master */
-}
-
-unsigned int
-i8259a_startup_irq(unsigned int irq)
-{
-	i8259a_enable_irq(irq);
-	return 0; /* never anything pending */
-}
-
-struct hw_interrupt_type i8259a_irq_type = {
-	typename:	"XT-PIC",
-	startup:	i8259a_startup_irq,
-	shutdown:	i8259a_disable_irq,
-	enable:		i8259a_enable_irq,
-	disable:	i8259a_disable_irq,
-	ack:		i8259a_mask_and_ack_irq,
-	end:		i8259a_enable_irq,
-};
-
-void __init
-init_i8259a_irqs(void)
-{
-	static struct irqaction cascade = {
-		handler:	no_action,
-		name:		"cascade",
-	};
-
-	long i;
-
-	outb(0xff, 0x21);	/* mask all of 8259A-1 */
-	outb(0xff, 0xA1);	/* mask all of 8259A-2 */
-
-	for (i = 0; i < 16; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].handler = &i8259a_irq_type;
-	}
-
-	setup_irq(2, &cascade);
-}
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/irq.c linux/arch/alpha/kernel/irq.c
--- v2.3.48/linux/arch/alpha/kernel/irq.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/irq.c	Mon Feb 28 14:54:30 2000
@@ -17,304 +17,85 @@
 #include <linux/kernel_stat.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
+#include <linux/interrupt.h>
 #include <linux/malloc.h>
 #include <linux/random.h>
 #include <linux/init.h>
-#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/proc_fs.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
-#include <asm/dma.h>
 #include <asm/bitops.h>
-#include <asm/machvec.h>
-
-#include "proto.h"
-#include "irq_impl.h"
-
-#define vulp	volatile unsigned long *
-#define vuip	volatile unsigned int *
-
-/* Only uniprocessor needs this IRQ/BH locking depth, on SMP it lives
-   in the per-cpu structure for cache reasons.  */
-#ifndef CONFIG_SMP
-int __local_irq_count;
-int __local_bh_count;
-unsigned long __irq_attempt[NR_IRQS];
-#endif
-
-#ifdef CONFIG_ALPHA_GENERIC
-#define ACTUAL_NR_IRQS	alpha_mv.nr_irqs
-#else
-#define ACTUAL_NR_IRQS	NR_IRQS
-#endif
-
-/* Hack minimum IPL during interupt processing for broken hardware.  */
-
-#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
-int __min_ipl;
-#endif
+#include <asm/uaccess.h>
 
 /*
- * Performance counter hook.  A module can override this to
- * do something useful.
+ * Controller mappings for all interrupt sources:
  */
+irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
+	[0 ... NR_IRQS-1] = { 0, &no_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}
+};
 
-static void
-dummy_perf(unsigned long vector, struct pt_regs *regs)
-{
-        printk(KERN_CRIT "Performance counter interrupt!\n");
-}
-
-void (*perf_irq)(unsigned long, struct pt_regs *) = dummy_perf;
-
-/*
- * Dispatch device interrupts.
- */
-
-/*
- * Handle ISA interrupt via the PICs.
- */
-
-#if defined(CONFIG_ALPHA_GENERIC)
-# define IACK_SC	alpha_mv.iack_sc
-#elif defined(CONFIG_ALPHA_APECS)
-# define IACK_SC	APECS_IACK_SC
-#elif defined(CONFIG_ALPHA_LCA)
-# define IACK_SC	LCA_IACK_SC
-#elif defined(CONFIG_ALPHA_CIA)
-# define IACK_SC	CIA_IACK_SC
-#elif defined(CONFIG_ALPHA_PYXIS)
-# define IACK_SC	PYXIS_IACK_SC
-#elif defined(CONFIG_ALPHA_TSUNAMI)
-# define IACK_SC	TSUNAMI_IACK_SC
-#elif defined(CONFIG_ALPHA_POLARIS)
-# define IACK_SC	POLARIS_IACK_SC
-#elif defined(CONFIG_ALPHA_IRONGATE)
-# define IACK_SC        IRONGATE_IACK_SC
-#endif
-
-#if defined(IACK_SC)
-void
-isa_device_interrupt(unsigned long vector, struct pt_regs *regs)
-{
-	/*
-	 * Generate a PCI interrupt acknowledge cycle.  The PIC will
-	 * respond with the interrupt vector of the highest priority
-	 * interrupt that is pending.  The PALcode sets up the
-	 * interrupts vectors such that irq level L generates vector L.
-	 */
-	int j = *(vuip) IACK_SC;
-	j &= 0xff;
-	if (j == 7) {
-		if (!(inb(0x20) & 0x80)) {
-			/* It's only a passive release... */
-			return;
-		}
-	}
-	handle_irq(j, regs);
-}
-#endif
-#if defined(CONFIG_ALPHA_GENERIC) || !defined(IACK_SC)
-void
-isa_no_iack_sc_device_interrupt(unsigned long vector, struct pt_regs *regs)
-{
-	unsigned long pic;
-
-	/*
-	 * It seems to me that the probability of two or more *device*
-	 * interrupts occurring at almost exactly the same time is
-	 * pretty low.  So why pay the price of checking for
-	 * additional interrupts here if the common case can be
-	 * handled so much easier?
-	 */
-	/* 
-	 *  The first read of gives you *all* interrupting lines.
-	 *  Therefore, read the mask register and and out those lines
-	 *  not enabled.  Note that some documentation has 21 and a1 
-	 *  write only.  This is not true.
-	 */
-	pic = inb(0x20) | (inb(0xA0) << 8);	/* read isr */
-	pic &= 0xFFFB;				/* mask out cascade & hibits */
+static void register_irq_proc(unsigned int irq);
 
-	while (pic) {
-		int j = ffz(~pic);
-		pic &= pic - 1;
-		handle_irq(j, regs);
-	}
-}
-#endif
+unsigned long irq_err_count;
 
 /*
- * Handle interrupts from the SRM, assuming no additional weirdness.
+ * Special irq handlers.
  */
 
-static inline void
-srm_enable_irq(unsigned int irq)
-{
-	cserve_ena(irq - 16);
-}
-
-static void
-srm_disable_irq(unsigned int irq)
-{
-	cserve_dis(irq - 16);
-}
-
-static unsigned int
-srm_startup_irq(unsigned int irq)
-{
-	srm_enable_irq(irq);
-	return 0;
-}
-
-static struct hw_interrupt_type srm_irq_type = {
-	typename:	"SRM",
-	startup:	srm_startup_irq,
-	shutdown:	srm_disable_irq,
-	enable:		srm_enable_irq,
-	disable:	srm_disable_irq,
-	ack:		srm_disable_irq,
-	end:		srm_enable_irq,
-};
-
-void 
-srm_device_interrupt(unsigned long vector, struct pt_regs * regs)
-{
-	int irq = (vector - 0x800) >> 4;
-	handle_irq(irq, regs);
-}
-
-void __init
-init_srm_irqs(long max, unsigned long ignore_mask)
-{
-	long i;
-
-	for (i = 16; i < max; ++i) {
-		if (i < 64 && ((ignore_mask >> i) & 1))
-			continue;
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].handler = &srm_irq_type;
-	}
-}
+void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
 
 /*
- * The not-handled irq handler.
+ * Generic no controller code
  */
 
-static void
-noirq_enable_disable(unsigned int irq)
-{
-}
-
-static unsigned int
-noirq_startup(unsigned int irq)
-{
-	return 0;
-}
+static void no_irq_enable_disable(unsigned int irq) { }
+static unsigned int no_irq_startup(unsigned int irq) { return 0; }
 
 static void
-noirq_ack(unsigned int irq)
+no_irq_ack(unsigned int irq)
 {
-	printk(KERN_CRIT "Unexpected IRQ %u\n", irq);
+	irq_err_count++;
+	printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", irq);
 }
 
-static struct hw_interrupt_type no_irq_type = {
+struct hw_interrupt_type no_irq_type = {
 	typename:	"none",
-	startup:	noirq_startup,
-	shutdown:	noirq_enable_disable,
-	enable:		noirq_enable_disable,
-	disable:	noirq_enable_disable,
-	ack:		noirq_ack,
-	end:		noirq_enable_disable,
-};
-
-/*
- * The special RTC interrupt type.  The interrupt itself was
- * processed by PALcode, and comes in via entInt vector 1.
- */
-
-static struct hw_interrupt_type rtc_irq_type = {
-	typename:	"RTC",
-	startup:	noirq_startup,
-	shutdown:	noirq_enable_disable,
-	enable:		noirq_enable_disable,
-	disable:	noirq_enable_disable,
-	ack:		noirq_enable_disable,
-	end:		noirq_enable_disable,
-};
-
-void __init
-init_rtc_irq(void)
-{
-	irq_desc[RTC_IRQ].status = IRQ_DISABLED;
-	irq_desc[RTC_IRQ].handler = &rtc_irq_type;
-}
-
-/*
- * Special irq handlers.
- */
-
-void
-no_action(int cpl, void *dev_id, struct pt_regs *regs)
-{
-}
-
-/* 
- * Common irq handlers.
- */
-
-struct irqaction isa_cascade_irqaction = {
-	handler:	no_action,
-	name:		"isa-cascade"
-};
-
-struct irqaction timer_cascade_irqaction = {
-	handler:	no_action,
-	name:		"timer-cascade"
-};
-
-struct irqaction halt_switch_irqaction = {
-	handler:	no_action,
-	name:		"halt-switch"
-};
-
-
-spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
-irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
-	[0 ... NR_IRQS-1] = { 0, &no_irq_type, }
+	startup:	no_irq_startup,
+	shutdown:	no_irq_enable_disable,
+	enable:		no_irq_enable_disable,
+	disable:	no_irq_enable_disable,
+	ack:		no_irq_ack,
+	end:		no_irq_enable_disable,
 };
 
 int
 handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
 		 struct irqaction *action)
 {
-	int status, cpu = smp_processor_id();
-	int old_ipl, ipl;
+	int status;
+	int cpu = smp_processor_id();
 
 	kstat.irqs[cpu][irq]++;
 	irq_enter(cpu, irq);
 
 	status = 1;	/* Force the "do bottom halves" bit */
 
-	old_ipl = ipl = getipl();
 	do {
-		int new_ipl = IPL_MIN;
-		if (action->flags & SA_INTERRUPT)
-			new_ipl = IPL_MAX;
-		if (new_ipl != ipl) {
-			setipl(new_ipl);
-			ipl = new_ipl;
-		}
+		if (!(action->flags & SA_INTERRUPT))
+			__sti();
+		else
+			__cli();
 
 		status |= action->flags;
 		action->handler(irq, action->dev_id, regs);
 		action = action->next;
 	} while (action);
-	if (ipl != old_ipl)
-		setipl(old_ipl);
-
 	if (status & SA_SAMPLE_RANDOM)
 		add_interrupt_randomness(irq);
+	__cli();
+
 	irq_exit(cpu, irq);
 
 	return status;
@@ -326,17 +107,18 @@
  * hardware disable after having gotten the irq
  * controller lock. 
  */
-void
+void inline
 disable_irq_nosync(unsigned int irq)
 {
+	irq_desc_t *desc = irq_desc + irq;
 	unsigned long flags;
 
-	spin_lock_irqsave(&irq_controller_lock, flags);
-	if (!irq_desc[irq].depth++) {
-		irq_desc[irq].status |= IRQ_DISABLED | IRQ_MASKED;
-		irq_desc[irq].handler->disable(irq);
+	spin_lock_irqsave(&desc->lock, flags);
+	if (!desc->depth++) {
+		desc->status |= IRQ_DISABLED;
+		desc->handler->disable(irq);
 	}
-	spin_unlock_irqrestore(&irq_controller_lock, flags);
+	spin_unlock_irqrestore(&desc->lock, flags);
 }
 
 /*
@@ -358,32 +140,29 @@
 void
 enable_irq(unsigned int irq)
 {
+	irq_desc_t *desc = irq_desc + irq;
 	unsigned long flags;
 
-	spin_lock_irqsave(&irq_controller_lock, flags);
-	switch (irq_desc[irq].depth) {
-	case 1:
-	  {
-		unsigned int status = irq_desc[irq].status;
-
-		status &= ~(IRQ_DISABLED | IRQ_MASKED);
+	spin_lock_irqsave(&desc->lock, flags);
+	switch (desc->depth) {
+	case 1: {
+		unsigned int status = desc->status & ~IRQ_DISABLED;
+		desc->status = status;
 		if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
-			status |= IRQ_REPLAY;
-			/* ??? We can't re-send on (most?) alpha hw.
-			   hw_resend_irq(irq_desc[irq].handler,irq); */
+			desc->status = status | IRQ_REPLAY;
+			hw_resend_irq(desc->handler,irq);
 		}
-		irq_desc[irq].status = status;
-		irq_desc[irq].handler->enable(irq);
+		desc->handler->enable(irq);
 		/* fall-through */
-	  }
+	}
 	default:
-		irq_desc[irq].depth--;
+		desc->depth--;
 		break;
 	case 0:
 		printk(KERN_ERR "enable_irq() unbalanced from %p\n",
 		       __builtin_return_address(0));
 	}
-	spin_unlock_irqrestore(&irq_controller_lock, flags);
+	spin_unlock_irqrestore(&desc->lock, flags);
 }
 
 int
@@ -392,6 +171,7 @@
 	int shared = 0;
 	struct irqaction *old, **p;
 	unsigned long flags;
+	irq_desc_t *desc = irq_desc + irq;
 
 	/*
 	 * Some drivers like serial.c use request_irq() heavily,
@@ -413,12 +193,12 @@
 	/*
 	 * The following block of code has to be executed atomically
 	 */
-	spin_lock_irqsave(&irq_controller_lock,flags);
-	p = &irq_desc[irq].action;
+	spin_lock_irqsave(&desc->lock,flags);
+	p = &desc->action;
 	if ((old = *p) != NULL) {
 		/* Can't share interrupts unless both agree to */
 		if (!(old->flags & new->flags & SA_SHIRQ)) {
-			spin_unlock_irqrestore(&irq_controller_lock,flags);
+			spin_unlock_irqrestore(&desc->lock,flags);
 			return -EBUSY;
 		}
 
@@ -433,14 +213,181 @@
 	*p = new;
 
 	if (!shared) {
-		irq_desc[irq].depth = 0;
-		irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_MASKED);
-		irq_desc[irq].handler->startup(irq);
+		desc->depth = 0;
+		desc->status &= ~IRQ_DISABLED;
+		desc->handler->startup(irq);
 	}
-	spin_unlock_irqrestore(&irq_controller_lock,flags);
+	spin_unlock_irqrestore(&desc->lock,flags);
+
+	register_irq_proc(irq);
 	return 0;
 }
 
+static struct proc_dir_entry * root_irq_dir;
+static struct proc_dir_entry * irq_dir [NR_IRQS];
+static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
+
+static unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
+
+#define HEX_DIGITS 16
+
+static int
+irq_affinity_read_proc (char *page, char **start, off_t off,
+			int count, int *eof, void *data)
+{
+	if (count < HEX_DIGITS+1)
+		return -EINVAL;
+	return sprintf (page, "%016lx\n", irq_affinity[(long)data]);
+}
+
+static unsigned int
+parse_hex_value (const char *buffer,
+		 unsigned long count, unsigned long *ret)
+{
+	unsigned char hexnum [HEX_DIGITS];
+	unsigned long value;
+	int i;
+
+	if (!count)
+		return -EINVAL;
+	if (count > HEX_DIGITS)
+		count = HEX_DIGITS;
+	if (copy_from_user(hexnum, buffer, count))
+		return -EFAULT;
+
+	/*
+	 * Parse the first 8 characters as a hex string, any non-hex char
+	 * is end-of-string. '00e1', 'e1', '00E1', 'E1' are all the same.
+	 */
+	value = 0;
+
+	for (i = 0; i < count; i++) {
+		unsigned int c = hexnum[i];
+
+		switch (c) {
+			case '0' ... '9': c -= '0'; break;
+			case 'a' ... 'f': c -= 'a'-10; break;
+			case 'A' ... 'F': c -= 'A'-10; break;
+		default:
+			goto out;
+		}
+		value = (value << 4) | c;
+	}
+out:
+	*ret = value;
+	return 0;
+}
+
+static int
+irq_affinity_write_proc(struct file *file, const char *buffer,
+			unsigned long count, void *data)
+{
+	int irq = (long) data, full_count = count, err;
+	unsigned long new_value;
+
+	if (!irq_desc[irq].handler->set_affinity)
+		return -EIO;
+
+	err = parse_hex_value(buffer, count, &new_value);
+
+#if CONFIG_SMP
+	/*
+	 * Do not allow disabling IRQs completely - it's a too easy
+	 * way to make the system unusable accidentally :-) At least
+	 * one online CPU still has to be targeted.
+	 */
+	if (!(new_value & cpu_present_mask))
+		return -EINVAL;
+#endif
+
+	irq_affinity[irq] = new_value;
+	irq_desc[irq].handler->set_affinity(irq, new_value);
+
+	return full_count;
+}
+
+static int
+prof_cpu_mask_read_proc(char *page, char **start, off_t off,
+			int count, int *eof, void *data)
+{
+	unsigned long *mask = (unsigned long *) data;
+	if (count < HEX_DIGITS+1)
+		return -EINVAL;
+	return sprintf (page, "%08lx\n", *mask);
+}
+
+static int
+prof_cpu_mask_write_proc(struct file *file, const char *buffer,
+			 unsigned long count, void *data)
+{
+	unsigned long *mask = (unsigned long *) data, full_count = count, err;
+	unsigned long new_value;
+
+	err = parse_hex_value(buffer, count, &new_value);
+	if (err)
+		return err;
+
+	*mask = new_value;
+	return full_count;
+}
+
+#define MAX_NAMELEN 10
+
+static void
+register_irq_proc (unsigned int irq)
+{
+	struct proc_dir_entry *entry;
+	char name [MAX_NAMELEN];
+
+	if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type))
+		return;
+
+	memset(name, 0, MAX_NAMELEN);
+	sprintf(name, "%d", irq);
+
+	/* create /proc/irq/1234 */
+	irq_dir[irq] = proc_mkdir(name, root_irq_dir);
+
+	/* create /proc/irq/1234/smp_affinity */
+	entry = create_proc_entry("smp_affinity", 0700, irq_dir[irq]);
+
+	entry->nlink = 1;
+	entry->data = (void *)(long)irq;
+	entry->read_proc = irq_affinity_read_proc;
+	entry->write_proc = irq_affinity_write_proc;
+
+	smp_affinity_entry[irq] = entry;
+}
+
+unsigned long prof_cpu_mask = ~0UL;
+
+void
+init_irq_proc (void)
+{
+	struct proc_dir_entry *entry;
+	int i;
+
+	/* create /proc/irq */
+	root_irq_dir = proc_mkdir("irq", 0);
+
+	/* create /proc/irq/prof_cpu_mask */
+	entry = create_proc_entry("prof_cpu_mask", 0700, root_irq_dir);
+
+	entry->nlink = 1;
+	entry->data = (void *)&prof_cpu_mask;
+	entry->read_proc = prof_cpu_mask_read_proc;
+	entry->write_proc = prof_cpu_mask_write_proc;
+
+	/*
+	 * Create entries for all existing IRQs.
+	 */
+	for (i = 0; i < NR_IRQS; i++) {
+		if (irq_desc[i].handler == &no_irq_type)
+			continue;
+		register_irq_proc(i);
+	}
+}
+
 int
 request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
 	    unsigned long irqflags, const char * devname, void *dev_id)
@@ -488,6 +435,7 @@
 void
 free_irq(unsigned int irq, void *dev_id)
 {
+	irq_desc_t *desc;
 	struct irqaction **p;
 	unsigned long flags;
 
@@ -496,8 +444,9 @@
 		return;
 	}
 
-	spin_lock_irqsave(&irq_controller_lock,flags);
-	p = &irq_desc[irq].action;
+	desc = irq_desc + irq;
+	spin_lock_irqsave(&desc->lock,flags);
+	p = &desc->action;
 	for (;;) {
 		struct irqaction * action = *p;
 		if (action) {
@@ -508,26 +457,29 @@
 
 			/* Found - now remove it from the list of entries.  */
 			*pp = action->next;
-			if (!irq_desc[irq].action) {
-				irq_desc[irq].status |= IRQ_DISABLED|IRQ_MASKED;
-				irq_desc[irq].handler->shutdown(irq);
+			if (!desc->action) {
+				desc->status |= IRQ_DISABLED;
+				desc->handler->shutdown(irq);
 			}
-			spin_unlock_irqrestore(&irq_controller_lock,flags);
+			spin_unlock_irqrestore(&desc->lock,flags);
 
+#ifdef CONFIG_SMP
 			/* Wait to make sure it's not being used on
 			   another CPU.  */
-			while (irq_desc[irq].status & IRQ_INPROGRESS)
+			while (desc->status & IRQ_INPROGRESS)
 				barrier();
+#endif
 			kfree(action);
 			return;
 		}
 		printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
-		spin_unlock_irqrestore(&irq_controller_lock,flags);
+		spin_unlock_irqrestore(&desc->lock,flags);
 		return;
 	}
 }
 
-int get_irq_list(char *buf)
+int
+get_irq_list(char *buf)
 {
 	int i, j;
 	struct irqaction * action;
@@ -576,246 +528,10 @@
 			     cpu_data[cpu_logical_map(j)].smp_local_irq_count);
 	p += sprintf(p, "\n");
 #endif
+	p += sprintf(p, "ERR: %10lu\n", irq_err_count);
 	return p - buf;
 }
 
-#ifdef CONFIG_SMP
-/* Who has global_irq_lock. */
-int global_irq_holder = NO_PROC_ID;
-
-/* This protects IRQ's. */
-spinlock_t global_irq_lock = SPIN_LOCK_UNLOCKED;
-
-/* Global IRQ locking depth. */
-atomic_t global_irq_count = ATOMIC_INIT(0);
-
-static void *previous_irqholder = NULL;
-
-#define MAXCOUNT 100000000
-
-static void show(char * str, void *where);
-
-static inline void
-wait_on_irq(int cpu, void *where)
-{
-	int count = MAXCOUNT;
-
-	for (;;) {
-
-		/*
-		 * Wait until all interrupts are gone. Wait
-		 * for bottom half handlers unless we're
-		 * already executing in one..
-		 */
-		if (!atomic_read(&global_irq_count)) {
-			if (local_bh_count(cpu)
-			    || !spin_is_locked(&global_bh_lock))
-				break;
-		}
-
-		/* Duh, we have to loop. Release the lock to avoid deadlocks */
-		spin_unlock(&global_irq_lock);
-
-		for (;;) {
-			if (!--count) {
-				show("wait_on_irq", where);
-				count = MAXCOUNT;
-			}
-			__sti();
-			udelay(1); /* make sure to run pending irqs */
-			__cli();
-
-			if (atomic_read(&global_irq_count))
-				continue;
-			if (spin_is_locked(&global_irq_lock))
-				continue;
-			if (!local_bh_count(cpu)
-			    && spin_is_locked(&global_bh_lock))
-				continue;
-			if (spin_trylock(&global_irq_lock))
-				break;
-		}
-	}
-}
-
-static inline void
-get_irqlock(int cpu, void* where)
-{
-	if (!spin_trylock(&global_irq_lock)) {
-		/* Do we already hold the lock?  */
-		if (cpu == global_irq_holder)
-			return;
-		/* Uhhuh.. Somebody else got it.  Wait.  */
-		spin_lock(&global_irq_lock);
-	}
-
-	/*
-	 * Ok, we got the lock bit.
-	 * But that's actually just the easy part.. Now
-	 * we need to make sure that nobody else is running
-	 * in an interrupt context. 
-	 */
-	wait_on_irq(cpu, where);
-
-	/*
-	 * Finally.
-	 */
-#if DEBUG_SPINLOCK
-	global_irq_lock.task = current;
-	global_irq_lock.previous = where;
-#endif
-	global_irq_holder = cpu;
-	previous_irqholder = where;
-}
-
-void
-__global_cli(void)
-{
-	int cpu = smp_processor_id();
-	void *where = __builtin_return_address(0);
-
-	/*
-	 * Maximize ipl.  If ipl was previously 0 and if this thread
-	 * is not in an irq, then take global_irq_lock.
-	 */
-	if (swpipl(IPL_MAX) == IPL_MIN && !local_irq_count(cpu))
-		get_irqlock(cpu, where);
-}
-
-void
-__global_sti(void)
-{
-        int cpu = smp_processor_id();
-
-        if (!local_irq_count(cpu))
-		release_irqlock(cpu);
-	__sti();
-}
-
-/*
- * SMP flags value to restore to:
- * 0 - global cli
- * 1 - global sti
- * 2 - local cli
- * 3 - local sti
- */
-unsigned long
-__global_save_flags(void)
-{
-        int retval;
-        int local_enabled;
-        unsigned long flags;
-	int cpu = smp_processor_id();
-
-        __save_flags(flags);
-        local_enabled = (!(flags & 7));
-        /* default to local */
-        retval = 2 + local_enabled;
-
-        /* Check for global flags if we're not in an interrupt.  */
-        if (!local_irq_count(cpu)) {
-                if (local_enabled)
-                        retval = 1;
-                if (global_irq_holder == cpu)
-                        retval = 0;
-	}
-	return retval;
-}
-
-void
-__global_restore_flags(unsigned long flags)
-{
-        switch (flags) {
-        case 0:
-                __global_cli();
-                break;
-        case 1:
-                __global_sti();
-                break;
-        case 2:
-                __cli();
-                break;
-        case 3:
-                __sti();
-                break;
-        default:
-                printk(KERN_ERR "global_restore_flags: %08lx (%p)\n",
-                        flags, __builtin_return_address(0));
-        }
-}
-
-static void
-show(char * str, void *where)
-{
-#if 0
-	int i;
-        unsigned long *stack;
-#endif
-        int cpu = smp_processor_id();
-
-        printk("\n%s, CPU %d: %p\n", str, cpu, where);
-        printk("irq:  %d [%d %d]\n",
-	       atomic_read(&global_irq_count),
-               cpu_data[0].irq_count,
-	       cpu_data[1].irq_count);
-
-        printk("bh:   %d [%d %d]\n",
-	       spin_is_locked(&global_bh_lock) ? 1 : 0,
-	       cpu_data[0].bh_count,
-	       cpu_data[1].bh_count);
-#if 0
-        stack = (unsigned long *) &str;
-        for (i = 40; i ; i--) {
-		unsigned long x = *++stack;
-                if (x > (unsigned long) &init_task_union &&
-		    x < (unsigned long) &vsprintf) {
-			printk("<[%08lx]> ", x);
-                }
-        }
-#endif
-}
-        
-/*
- * From its use, I infer that synchronize_irq() stalls a thread until
- * the effects of a command to an external device are known to have
- * taken hold.  Typically, the command is to stop sending interrupts.
- * The strategy here is wait until there is at most one processor
- * (this one) in an irq.  The memory barrier serializes the write to
- * the device and the subsequent accesses of global_irq_count.
- * --jmartin
- */
-#define DEBUG_SYNCHRONIZE_IRQ 0
-
-void
-synchronize_irq(void)
-{
-#if 0
-	/* Joe's version.  */
-	int cpu = smp_processor_id();
-	int local_count;
-	int global_count;
-	int countdown = 1<<24;
-	void *where = __builtin_return_address(0);
-
-	mb();
-	do {
-		local_count = local_irq_count(cpu);
-		global_count = atomic_read(&global_irq_count);
-		if (DEBUG_SYNCHRONIZE_IRQ && (--countdown == 0)) {
-			printk("%d:%d/%d\n", cpu, local_count, global_count);
-			show("synchronize_irq", where);
-			break;
-		}
-	} while (global_count != local_count);
-#else
-	/* Jay's version.  */
-	if (atomic_read(&global_irq_count)) {
-		cli();
-		sti();
-	}
-#endif
-}
-#endif /* CONFIG_SMP */
 
 /*
  * do_IRQ handles all normal device IRQ's (the special
@@ -836,39 +552,26 @@
 	 * handled by some other CPU. (or is disabled)
 	 */
 	int cpu = smp_processor_id();
-	irq_desc_t *desc;
+	irq_desc_t *desc = irq_desc + irq;
 	struct irqaction * action;
 	unsigned int status;
 
 	if ((unsigned) irq > ACTUAL_NR_IRQS) {
+		irq_err_count++;
 		printk(KERN_CRIT "device_interrupt: illegal interrupt %d\n",
 		       irq);
 		return;
 	}
 
 	irq_attempt(cpu, irq)++;
-	desc = irq_desc + irq;
-	spin_lock_irq(&irq_controller_lock); /* mask also the RTC */
+	spin_lock_irq(&desc->lock); /* mask also the higher prio events */
 	desc->handler->ack(irq);
-	status = desc->status;
-
-#ifndef CONFIG_SMP
-	/* Look for broken irq masking.  */
-	if (status & IRQ_MASKED) {
-		static unsigned long last_printed;
-		if (time_after(jiffies, last_printed+HZ)) {
-			printk(KERN_CRIT "Mask didn't work for irq %d!\n", irq);
-			last_printed = jiffies;
-		}
-	}
-#endif
-
 	/*
 	 * REPLAY is when Linux resends an IRQ that was dropped earlier.
 	 * WAITING is used by probe to mark irqs that are being tested.
 	 */
-	status &= ~(IRQ_REPLAY | IRQ_WAITING);
-	status |= IRQ_PENDING | IRQ_MASKED; /* we _want_ to handle it */
+	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
+	status |= IRQ_PENDING; /* we _want_ to handle it */
 
 	/*
 	 * If the IRQ is disabled for whatever reason, we cannot
@@ -881,7 +584,6 @@
 		status |= IRQ_INPROGRESS; /* we are handling it */
 	}
 	desc->status = status;
-	spin_unlock(&irq_controller_lock);
 
 	/*
 	 * If there is no IRQ handler or it was disabled, exit early.
@@ -890,7 +592,7 @@
 	 * will take care of it.
 	 */
 	if (!action)
-		return;
+		goto out;
 
 	/*
 	 * Edge triggered interrupts need to remember pending events.
@@ -902,22 +604,23 @@
 	 * SMP environment.
 	 */
 	for (;;) {
+		spin_unlock(&desc->lock);
 		handle_IRQ_event(irq, regs, action);
-		spin_lock(&irq_controller_lock);
+		spin_lock(&desc->lock);
 		
 		if (!(desc->status & IRQ_PENDING)
 		    || (desc->status & IRQ_LEVEL))
 			break;
 		desc->status &= ~IRQ_PENDING;
-		spin_unlock(&irq_controller_lock);
-	}
-	status = desc->status & ~IRQ_INPROGRESS;
-	if (!(status & IRQ_DISABLED)) {
-		status &= ~IRQ_MASKED;
-		desc->handler->end(irq);
 	}
-	desc->status = status;
-	spin_unlock(&irq_controller_lock);
+	desc->status &= ~IRQ_INPROGRESS;
+out:
+	/*
+	 * The ->end() handler has to deal with interrupts which got
+	 * disabled while the handler was running.
+	 */
+	desc->handler->end(irq);
+	spin_unlock(&desc->lock);
 }
 
 /*
@@ -932,17 +635,20 @@
 probe_irq_on(void)
 {
 	int i;
+	irq_desc_t *desc;
 	unsigned long delay;
 	unsigned long val;
 
 	/* Something may have generated an irq long ago and we want to
 	   flush such a longstanding irq before considering it as spurious. */
-	spin_lock_irq(&irq_controller_lock);
-	for (i = NR_IRQS-1; i >= 0; i--)
+	for (i = NR_IRQS-1; i >= 0; i--) {
+		desc = irq_desc + i;
+
+		spin_lock_irq(&desc->lock);
 		if (!irq_desc[i].action) 
-			if(irq_desc[i].handler->startup(i))
-				irq_desc[i].status |= IRQ_PENDING;
-	spin_unlock_irq(&irq_controller_lock);
+			irq_desc[i].handler->startup(i);
+		spin_unlock_irq(&desc->lock);
+	}
 
 	/* Wait for longstanding interrupts to trigger. */
 	for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
@@ -951,15 +657,17 @@
 	/* enable any unassigned irqs (we must startup again here because
 	   if a longstanding irq happened in the previous stage, it may have
 	   masked itself) first, enable any unassigned irqs. */
-	spin_lock_irq(&irq_controller_lock);
 	for (i = NR_IRQS-1; i >= 0; i--) {
-		if (!irq_desc[i].action) {
-			irq_desc[i].status |= IRQ_AUTODETECT | IRQ_WAITING;
-			if(irq_desc[i].handler->startup(i))
-				irq_desc[i].status |= IRQ_PENDING;
+		desc = irq_desc + i;
+
+		spin_lock_irq(&desc->lock);
+		if (!desc->action) {
+			desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
+			if (desc->handler->startup(i))
+				desc->status |= IRQ_PENDING;
 		}
+		spin_unlock_irq(&desc->lock);
 	}
-	spin_unlock_irq(&irq_controller_lock);
 
 	/*
 	 * Wait for spurious interrupts to trigger
@@ -971,24 +679,24 @@
 	 * Now filter out any obviously spurious interrupts
 	 */
 	val = 0;
-	spin_lock_irq(&irq_controller_lock);
 	for (i=0; i<NR_IRQS; i++) {
-		unsigned int status = irq_desc[i].status;
+		irq_desc_t *desc = irq_desc + i;
+		unsigned int status;
 
-		if (!(status & IRQ_AUTODETECT))
-			continue;
-		
-		/* It triggered already - consider it spurious. */
-		if (!(status & IRQ_WAITING)) {
-			irq_desc[i].status = status & ~IRQ_AUTODETECT;
-			irq_desc[i].handler->shutdown(i);
-			continue;
-		}
+		spin_lock_irq(&desc->lock);
+		status = desc->status;
 
-		if (i < 64)
-			val |= 1 << i;
+		if (status & IRQ_AUTODETECT) {
+			/* It triggered already - consider it spurious. */
+			if (!(status & IRQ_WAITING)) {
+				desc->status = status & ~IRQ_AUTODETECT;
+				desc->handler->shutdown(i);
+			} else
+				if (i < 32)
+					val |= 1 << i;
+		}
+		spin_unlock_irq(&desc->lock);
 	}
-	spin_unlock_irq(&irq_controller_lock);
 
 	return val;
 }
@@ -997,26 +705,29 @@
  * Return a mask of triggered interrupts (this
  * can handle only legacy ISA interrupts).
  */
-unsigned int probe_irq_mask(unsigned long val)
+unsigned int
+probe_irq_mask(unsigned long val)
 {
 	int i;
 	unsigned int mask;
 
 	mask = 0;
-	spin_lock_irq(&irq_controller_lock);
 	for (i = 0; i < 16; i++) {
-		unsigned int status = irq_desc[i].status;
+		irq_desc_t *desc = irq_desc + i;
+		unsigned int status;
 
-		if (!(status & IRQ_AUTODETECT))
-			continue;
+		spin_lock_irq(&desc->lock);
+		status = desc->status;
 
-		if (!(status & IRQ_WAITING))
-			mask |= 1 << i;
+		if (status & IRQ_AUTODETECT) {
+			if (!(status & IRQ_WAITING))
+				mask |= 1 << i;
 
-		irq_desc[i].status = status & ~IRQ_AUTODETECT;
-		irq_desc[i].handler->shutdown(i);
+			desc->status = status & ~IRQ_AUTODETECT;
+			desc->handler->shutdown(i);
+		}
+		spin_unlock_irq(&desc->lock);
 	}
-	spin_unlock_irq(&irq_controller_lock);
 
 	return mask & val;
 }
@@ -1034,183 +745,26 @@
 
 	nr_irqs = 0;
 	irq_found = 0;
-	spin_lock_irq(&irq_controller_lock);
 	for (i=0; i<NR_IRQS; i++) {
-		unsigned int status = irq_desc[i].status;
+		irq_desc_t *desc = irq_desc + i;
+		unsigned int status;
 
-		if (!(status & IRQ_AUTODETECT))
-			continue;
+		spin_lock_irq(&desc->lock);
+		status = desc->status;
 
-		if (!(status & IRQ_WAITING)) {
-			if (!nr_irqs)
-				irq_found = i;
-			nr_irqs++;
+		if (status & IRQ_AUTODETECT) {
+			if (!(status & IRQ_WAITING)) {
+				if (!nr_irqs)
+					irq_found = i;
+				nr_irqs++;
+			}
+			desc->status = status & ~IRQ_AUTODETECT;
+			desc->handler->shutdown(i);
 		}
-		irq_desc[i].status = status & ~IRQ_AUTODETECT;
-		irq_desc[i].handler->shutdown(i);
+		spin_unlock_irq(&desc->lock);
 	}
-	spin_unlock_irq(&irq_controller_lock);
 
 	if (nr_irqs > 1)
 		irq_found = -irq_found;
 	return irq_found;
-}
-
-
-/*
- * The main interrupt entry point.
- */
-
-asmlinkage void 
-do_entInt(unsigned long type, unsigned long vector, unsigned long la_ptr,
-	  unsigned long a3, unsigned long a4, unsigned long a5,
-	  struct pt_regs regs)
-{
-	switch (type) {
-	case 0:
-#ifdef CONFIG_SMP
-		handle_ipi(&regs);
-		return;
-#else
-		printk(KERN_CRIT "Interprocessor interrupt? "
-		       "You must be kidding!\n");
-#endif
-		break;
-	case 1:
-#ifdef CONFIG_SMP
-		cpu_data[smp_processor_id()].smp_local_irq_count++;
-		smp_percpu_timer_interrupt(&regs);
-		if (smp_processor_id() == boot_cpuid)
-#endif
-			handle_irq(RTC_IRQ, &regs);
-		return;
-	case 2:
-		alpha_mv.machine_check(vector, la_ptr, &regs);
-		return;
-	case 3:
-		alpha_mv.device_interrupt(vector, &regs);
-		return;
-	case 4:
-		perf_irq(vector, &regs);
-		return;
-	default:
-		printk(KERN_CRIT "Hardware intr %ld %lx? Huh?\n",
-		       type, vector);
-	}
-	printk("PC = %016lx PS=%04lx\n", regs.pc, regs.ps);
-}
-
-void __init
-common_init_isa_dma(void)
-{
-	outb(0, DMA1_RESET_REG);
-	outb(0, DMA2_RESET_REG);
-	outb(0, DMA1_CLR_MASK_REG);
-	outb(0, DMA2_CLR_MASK_REG);
-}
-
-void __init
-init_IRQ(void)
-{
-	wrent(entInt, 0);
-	alpha_mv.init_irq();
-}
-
-
-/*
- */
-#define MCHK_K_TPERR           0x0080
-#define MCHK_K_TCPERR          0x0082
-#define MCHK_K_HERR            0x0084
-#define MCHK_K_ECC_C           0x0086
-#define MCHK_K_ECC_NC          0x0088
-#define MCHK_K_OS_BUGCHECK     0x008A
-#define MCHK_K_PAL_BUGCHECK    0x0090
-
-#ifndef CONFIG_SMP
-struct mcheck_info __mcheck_info;
-#endif
-
-void
-process_mcheck_info(unsigned long vector, unsigned long la_ptr,
-		    struct pt_regs *regs, const char *machine,
-		    int expected)
-{
-	struct el_common *mchk_header;
-	const char *reason;
-
-	/*
-	 * See if the machine check is due to a badaddr() and if so,
-	 * ignore it.
-	 */
-
-#if DEBUG_MCHECK > 0
-	 printk(KERN_CRIT "%s machine check %s\n", machine,
-	        expected ? "expected." : "NOT expected!!!");
-#endif
-
-	if (expected) {
-		int cpu = smp_processor_id();
-		mcheck_expected(cpu) = 0;
-		mcheck_taken(cpu) = 1;
-		return;
-	}
-
-	mchk_header = (struct el_common *)la_ptr;
-
-	printk(KERN_CRIT "%s machine check: vector=0x%lx pc=0x%lx code=0x%lx\n",
-	       machine, vector, regs->pc, mchk_header->code);
-
-	switch ((unsigned int) mchk_header->code) {
-	/* Machine check reasons.  Defined according to PALcode sources.  */
-	case 0x80: reason = "tag parity error"; break;
-	case 0x82: reason = "tag control parity error"; break;
-	case 0x84: reason = "generic hard error"; break;
-	case 0x86: reason = "correctable ECC error"; break;
-	case 0x88: reason = "uncorrectable ECC error"; break;
-	case 0x8A: reason = "OS-specific PAL bugcheck"; break;
-	case 0x90: reason = "callsys in kernel mode"; break;
-	case 0x96: reason = "i-cache read retryable error"; break;
-	case 0x98: reason = "processor detected hard error"; break;
-	
-	/* System specific (these are for Alcor, at least): */
-	case 0x202: reason = "system detected hard error"; break;
-	case 0x203: reason = "system detected uncorrectable ECC error"; break;
-	case 0x204: reason = "SIO SERR occurred on PCI bus"; break;
-	case 0x205: reason = "parity error detected by CIA"; break;
-	case 0x206: reason = "SIO IOCHK occurred on ISA bus"; break;
-	case 0x207: reason = "non-existent memory error"; break;
-	case 0x208: reason = "MCHK_K_DCSR"; break;
-	case 0x209: reason = "PCI SERR detected"; break;
-	case 0x20b: reason = "PCI data parity error detected"; break;
-	case 0x20d: reason = "PCI address parity error detected"; break;
-	case 0x20f: reason = "PCI master abort error"; break;
-	case 0x211: reason = "PCI target abort error"; break;
-	case 0x213: reason = "scatter/gather PTE invalid error"; break;
-	case 0x215: reason = "flash ROM write error"; break;
-	case 0x217: reason = "IOA timeout detected"; break;
-	case 0x219: reason = "IOCHK#, EISA add-in board parity or other catastrophic error"; break;
-	case 0x21b: reason = "EISA fail-safe timer timeout"; break;
-	case 0x21d: reason = "EISA bus time-out"; break;
-	case 0x21f: reason = "EISA software generated NMI"; break;
-	case 0x221: reason = "unexpected ev5 IRQ[3] interrupt"; break;
-	default: reason = "unknown"; break;
-	}
-
-	printk(KERN_CRIT "machine check type: %s%s\n",
-	       reason, mchk_header->retry ? " (retryable)" : "");
-
-	dik_show_regs(regs, NULL);
-
-#if DEBUG_MCHECK > 1
-	{
-		/* Dump the logout area to give all info.  */
-		unsigned long *ptr = (unsigned long *)la_ptr;
-		long i;
-		for (i = 0; i < mchk_header->size / sizeof(long); i += 2) {
-			printk(KERN_CRIT "   +%8lx %016lx %016lx\n",
-			       i*sizeof(long), ptr[i], ptr[i+1]);
-		}
-	}
-#endif
 }
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/irq_alpha.c linux/arch/alpha/kernel/irq_alpha.c
--- v2.3.48/linux/arch/alpha/kernel/irq_alpha.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/alpha/kernel/irq_alpha.c	Thu Mar  2 11:35:12 2000
@@ -0,0 +1,248 @@
+/*
+ * Alpha specific irq code.
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/irq.h>
+
+#include <asm/machvec.h>
+#include <asm/dma.h>
+
+#include "proto.h"
+#include "irq_impl.h"
+
+/* Only uniprocessor needs this IRQ/BH locking depth, on SMP it lives
+   in the per-cpu structure for cache reasons.  */
+#ifndef CONFIG_SMP
+int __local_irq_count;
+int __local_bh_count;
+unsigned long __irq_attempt[NR_IRQS];
+#endif
+
+/* Hack minimum IPL during interupt processing for broken hardware.  */
+#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
+int __min_ipl;
+#endif
+
+/*
+ * Performance counter hook.  A module can override this to
+ * do something useful.
+ */
+static void
+dummy_perf(unsigned long vector, struct pt_regs *regs)
+{
+	irq_err_count++;
+	printk(KERN_CRIT "Performance counter interrupt!\n");
+}
+
+void (*perf_irq)(unsigned long, struct pt_regs *) = dummy_perf;
+
+/*
+ * The main interrupt entry point.
+ */
+
+asmlinkage void 
+do_entInt(unsigned long type, unsigned long vector, unsigned long la_ptr,
+	  unsigned long a3, unsigned long a4, unsigned long a5,
+	  struct pt_regs regs)
+{
+	switch (type) {
+	case 0:
+#ifdef CONFIG_SMP
+		handle_ipi(&regs);
+		return;
+#else
+		irq_err_count++;
+		printk(KERN_CRIT "Interprocessor interrupt? "
+		       "You must be kidding!\n");
+#endif
+		break;
+	case 1:
+#ifdef CONFIG_SMP
+		cpu_data[smp_processor_id()].smp_local_irq_count++;
+		smp_percpu_timer_interrupt(&regs);
+		if (smp_processor_id() == boot_cpuid)
+#endif
+			handle_irq(RTC_IRQ, &regs);
+		return;
+	case 2:
+		irq_err_count++;
+		alpha_mv.machine_check(vector, la_ptr, &regs);
+		return;
+	case 3:
+		alpha_mv.device_interrupt(vector, &regs);
+		return;
+	case 4:
+		perf_irq(vector, &regs);
+		return;
+	default:
+		printk(KERN_CRIT "Hardware intr %ld %lx? Huh?\n",
+		       type, vector);
+	}
+	printk("PC = %016lx PS=%04lx\n", regs.pc, regs.ps);
+}
+
+void __init
+common_init_isa_dma(void)
+{
+	outb(0, DMA1_RESET_REG);
+	outb(0, DMA2_RESET_REG);
+	outb(0, DMA1_CLR_MASK_REG);
+	outb(0, DMA2_CLR_MASK_REG);
+}
+
+void __init
+init_IRQ(void)
+{
+	alpha_mv.init_irq();
+	wrent(entInt, 0);
+}
+
+/*
+ * machine error checks
+ */
+#define MCHK_K_TPERR           0x0080
+#define MCHK_K_TCPERR          0x0082
+#define MCHK_K_HERR            0x0084
+#define MCHK_K_ECC_C           0x0086
+#define MCHK_K_ECC_NC          0x0088
+#define MCHK_K_OS_BUGCHECK     0x008A
+#define MCHK_K_PAL_BUGCHECK    0x0090
+
+#ifndef CONFIG_SMP
+struct mcheck_info __mcheck_info;
+#endif
+
+void
+process_mcheck_info(unsigned long vector, unsigned long la_ptr,
+		    struct pt_regs *regs, const char *machine,
+		    int expected)
+{
+	struct el_common *mchk_header;
+	const char *reason;
+
+	/*
+	 * See if the machine check is due to a badaddr() and if so,
+	 * ignore it.
+	 */
+
+#if DEBUG_MCHECK > 0
+	 printk(KERN_CRIT "%s machine check %s\n", machine,
+	        expected ? "expected." : "NOT expected!!!");
+#endif
+
+	if (expected) {
+		int cpu = smp_processor_id();
+		mcheck_expected(cpu) = 0;
+		mcheck_taken(cpu) = 1;
+		return;
+	}
+
+	mchk_header = (struct el_common *)la_ptr;
+
+	printk(KERN_CRIT "%s machine check: vector=0x%lx pc=0x%lx code=0x%lx\n",
+	       machine, vector, regs->pc, mchk_header->code);
+
+	switch ((unsigned int) mchk_header->code) {
+	/* Machine check reasons.  Defined according to PALcode sources.  */
+	case 0x80: reason = "tag parity error"; break;
+	case 0x82: reason = "tag control parity error"; break;
+	case 0x84: reason = "generic hard error"; break;
+	case 0x86: reason = "correctable ECC error"; break;
+	case 0x88: reason = "uncorrectable ECC error"; break;
+	case 0x8A: reason = "OS-specific PAL bugcheck"; break;
+	case 0x90: reason = "callsys in kernel mode"; break;
+	case 0x96: reason = "i-cache read retryable error"; break;
+	case 0x98: reason = "processor detected hard error"; break;
+	
+	/* System specific (these are for Alcor, at least): */
+	case 0x202: reason = "system detected hard error"; break;
+	case 0x203: reason = "system detected uncorrectable ECC error"; break;
+	case 0x204: reason = "SIO SERR occurred on PCI bus"; break;
+	case 0x205: reason = "parity error detected by CIA"; break;
+	case 0x206: reason = "SIO IOCHK occurred on ISA bus"; break;
+	case 0x207: reason = "non-existent memory error"; break;
+	case 0x208: reason = "MCHK_K_DCSR"; break;
+	case 0x209: reason = "PCI SERR detected"; break;
+	case 0x20b: reason = "PCI data parity error detected"; break;
+	case 0x20d: reason = "PCI address parity error detected"; break;
+	case 0x20f: reason = "PCI master abort error"; break;
+	case 0x211: reason = "PCI target abort error"; break;
+	case 0x213: reason = "scatter/gather PTE invalid error"; break;
+	case 0x215: reason = "flash ROM write error"; break;
+	case 0x217: reason = "IOA timeout detected"; break;
+	case 0x219: reason = "IOCHK#, EISA add-in board parity or other catastrophic error"; break;
+	case 0x21b: reason = "EISA fail-safe timer timeout"; break;
+	case 0x21d: reason = "EISA bus time-out"; break;
+	case 0x21f: reason = "EISA software generated NMI"; break;
+	case 0x221: reason = "unexpected ev5 IRQ[3] interrupt"; break;
+	default: reason = "unknown"; break;
+	}
+
+	printk(KERN_CRIT "machine check type: %s%s\n",
+	       reason, mchk_header->retry ? " (retryable)" : "");
+
+	dik_show_regs(regs, NULL);
+
+#if DEBUG_MCHECK > 1
+	{
+		/* Dump the logout area to give all info.  */
+		unsigned long *ptr = (unsigned long *)la_ptr;
+		long i;
+		for (i = 0; i < mchk_header->size / sizeof(long); i += 2) {
+			printk(KERN_CRIT "   +%8lx %016lx %016lx\n",
+			       i*sizeof(long), ptr[i], ptr[i+1]);
+		}
+	}
+#endif
+}
+
+/*
+ * The special RTC interrupt type.  The interrupt itself was
+ * processed by PALcode, and comes in via entInt vector 1.
+ */
+
+static void rtc_enable_disable(unsigned int irq) { }
+static unsigned int rtc_startup(unsigned int irq) { return 0; }
+
+struct irqaction timer_irqaction = {
+	handler:	timer_interrupt,
+	flags:		SA_INTERRUPT,
+	name:		"timer",
+};
+
+static struct hw_interrupt_type rtc_irq_type = {
+	typename:	"RTC",
+	startup:	rtc_startup,
+	shutdown:	rtc_enable_disable,
+	enable:		rtc_enable_disable,
+	disable:	rtc_enable_disable,
+	ack:		rtc_enable_disable,
+	end:		rtc_enable_disable,
+};
+
+void __init
+init_rtc_irq(void)
+{
+	irq_desc[RTC_IRQ].status = IRQ_DISABLED;
+	irq_desc[RTC_IRQ].handler = &rtc_irq_type;
+	setup_irq(RTC_IRQ, &timer_irqaction);
+}
+
+/* Dummy irqactions.  */
+struct irqaction isa_cascade_irqaction = {
+	handler:	no_action,
+	name:		"isa-cascade"
+};
+
+struct irqaction timer_cascade_irqaction = {
+	handler:	no_action,
+	name:		"timer-cascade"
+};
+
+struct irqaction halt_switch_irqaction = {
+	handler:	no_action,
+	name:		"halt-switch"
+};
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/irq_i8259.c linux/arch/alpha/kernel/irq_i8259.c
--- v2.3.48/linux/arch/alpha/kernel/irq_i8259.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/alpha/kernel/irq_i8259.c	Thu Mar  2 11:35:12 2000
@@ -0,0 +1,187 @@
+/*
+ *      linux/arch/alpha/kernel/irq_i8259.c
+ *
+ * This is the 'legacy' 8259A Programmable Interrupt Controller,
+ * present in the majority of PC/AT boxes.
+ *
+ * Started hacking from linux-2.3.30pre6/arch/i386/kernel/i8259.c.
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/cache.h>
+#include <linux/sched.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+
+#include <asm/io.h>
+
+#include "proto.h"
+#include "irq_impl.h"
+
+
+/* Note mask bit is true for DISABLED irqs.  */
+static unsigned int cached_irq_mask = 0xffff;
+spinlock_t i8259_irq_lock = SPIN_LOCK_UNLOCKED;
+
+static inline void
+i8259_update_irq_hw(unsigned int irq, unsigned long mask)
+{
+	int port = 0x21;
+	if (irq & 8) mask >>= 8;
+	if (irq & 8) port = 0xA1;
+	outb(mask, port);
+}
+
+inline void
+i8259a_enable_irq(unsigned int irq)
+{
+	spin_lock(&i8259_irq_lock);
+	i8259_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq));
+	spin_unlock(&i8259_irq_lock);
+}
+
+static inline void
+__i8259a_disable_irq(unsigned int irq)
+{
+	i8259_update_irq_hw(irq, cached_irq_mask |= 1 << irq);
+}
+
+void
+i8259a_disable_irq(unsigned int irq)
+{
+	spin_lock(&i8259_irq_lock);
+	__i8259a_disable_irq(irq);
+	spin_unlock(&i8259_irq_lock);
+}
+
+void
+i8259a_mask_and_ack_irq(unsigned int irq)
+{
+	spin_lock(&i8259_irq_lock);
+	__i8259a_disable_irq(irq);
+
+	/* Ack the interrupt making it the lowest priority.  */
+	if (irq >= 8) {
+		outb(0xE0 | (irq - 8), 0xa0);   /* ack the slave */
+		irq = 2;
+	}
+	outb(0xE0 | irq, 0x20);			/* ack the master */
+	spin_unlock(&i8259_irq_lock);
+}
+
+unsigned int
+i8259a_startup_irq(unsigned int irq)
+{
+	i8259a_enable_irq(irq);
+	return 0; /* never anything pending */
+}
+
+void
+i8259a_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		i8259a_enable_irq(irq);
+}
+
+struct hw_interrupt_type i8259a_irq_type = {
+	typename:	"XT-PIC",
+	startup:	i8259a_startup_irq,
+	shutdown:	i8259a_disable_irq,
+	enable:		i8259a_enable_irq,
+	disable:	i8259a_disable_irq,
+	ack:		i8259a_mask_and_ack_irq,
+	end:		i8259a_end_irq,
+};
+
+void __init
+init_i8259a_irqs(void)
+{
+	static struct irqaction cascade = {
+		handler:	no_action,
+		name:		"cascade",
+	};
+
+	long i;
+
+	outb(0xff, 0x21);	/* mask all of 8259A-1 */
+	outb(0xff, 0xA1);	/* mask all of 8259A-2 */
+
+	for (i = 0; i < 16; i++) {
+		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].handler = &i8259a_irq_type;
+	}
+
+	setup_irq(2, &cascade);
+}
+
+
+#if defined(CONFIG_ALPHA_GENERIC)
+# define IACK_SC	alpha_mv.iack_sc
+#elif defined(CONFIG_ALPHA_APECS)
+# define IACK_SC	APECS_IACK_SC
+#elif defined(CONFIG_ALPHA_LCA)
+# define IACK_SC	LCA_IACK_SC
+#elif defined(CONFIG_ALPHA_CIA)
+# define IACK_SC	CIA_IACK_SC
+#elif defined(CONFIG_ALPHA_PYXIS)
+# define IACK_SC	PYXIS_IACK_SC
+#elif defined(CONFIG_ALPHA_TSUNAMI)
+# define IACK_SC	TSUNAMI_IACK_SC
+#elif defined(CONFIG_ALPHA_POLARIS)
+# define IACK_SC	POLARIS_IACK_SC
+#elif defined(CONFIG_ALPHA_IRONGATE)
+# define IACK_SC        IRONGATE_IACK_SC
+#endif
+
+#if defined(IACK_SC)
+void
+isa_device_interrupt(unsigned long vector, struct pt_regs *regs)
+{
+	/*
+	 * Generate a PCI interrupt acknowledge cycle.  The PIC will
+	 * respond with the interrupt vector of the highest priority
+	 * interrupt that is pending.  The PALcode sets up the
+	 * interrupts vectors such that irq level L generates vector L.
+	 */
+	int j = *(vuip) IACK_SC;
+	j &= 0xff;
+	if (j == 7) {
+		if (!(inb(0x20) & 0x80)) {
+			/* It's only a passive release... */
+			return;
+		}
+	}
+	handle_irq(j, regs);
+}
+#endif
+
+#if defined(CONFIG_ALPHA_GENERIC) || !defined(IACK_SC)
+void
+isa_no_iack_sc_device_interrupt(unsigned long vector, struct pt_regs *regs)
+{
+	unsigned long pic;
+
+	/*
+	 * It seems to me that the probability of two or more *device*
+	 * interrupts occurring at almost exactly the same time is
+	 * pretty low.  So why pay the price of checking for
+	 * additional interrupts here if the common case can be
+	 * handled so much easier?
+	 */
+	/* 
+	 *  The first read of gives you *all* interrupting lines.
+	 *  Therefore, read the mask register and and out those lines
+	 *  not enabled.  Note that some documentation has 21 and a1 
+	 *  write only.  This is not true.
+	 */
+	pic = inb(0x20) | (inb(0xA0) << 8);	/* read isr */
+	pic &= 0xFFFB;				/* mask out cascade & hibits */
+
+	while (pic) {
+		int j = ffz(~pic);
+		pic &= pic - 1;
+		handle_irq(j, regs);
+	}
+}
+#endif
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/irq_impl.h linux/arch/alpha/kernel/irq_impl.h
--- v2.3.48/linux/arch/alpha/kernel/irq_impl.h	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/irq_impl.h	Sun Feb 27 13:28:01 2000
@@ -19,6 +19,7 @@
 extern void srm_device_interrupt(unsigned long, struct pt_regs *);
 extern void pyxis_device_interrupt(unsigned long, struct pt_regs *);
 
+extern struct irqaction timer_irqaction;
 extern struct irqaction isa_cascade_irqaction;
 extern struct irqaction timer_cascade_irqaction;
 extern struct irqaction halt_switch_irqaction;
@@ -33,27 +34,37 @@
 extern void i8259a_disable_irq(unsigned int);
 extern void i8259a_mask_and_ack_irq(unsigned int);
 extern unsigned int i8259a_startup_irq(unsigned int);
+extern void i8259a_end_irq(unsigned int);
 extern struct hw_interrupt_type i8259a_irq_type;
 extern void init_i8259a_irqs(void);
 
-extern void no_action(int cpl, void *dev_id, struct pt_regs *regs);
 extern void handle_irq(int irq, struct pt_regs * regs);
 
+extern unsigned long prof_cpu_mask;
+
 static inline void
 alpha_do_profile(unsigned long pc)
 {
-	if (prof_buffer && current->pid) {
-		extern char _stext;
+	extern char _stext;
+
+	if (!prof_buffer)
+		return;
 
-		pc -= (unsigned long) &_stext;
-		pc >>= prof_shift;
-		/*
-		 * Don't ignore out-of-bounds PC values silently,
-		 * put them into the last histogram slot, so if
-		 * present, they will show up as a sharp peak.
-		 */
-		if (pc > prof_len - 1)
-			pc = prof_len - 1;
-		atomic_inc((atomic_t *)&prof_buffer[pc]);
-	}
+	/*
+	 * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
+	 * (default is all CPUs.)
+	 */
+	if (!((1<<smp_processor_id()) & prof_cpu_mask))
+		return;
+
+	pc -= (unsigned long) &_stext;
+	pc >>= prof_shift;
+	/*
+	 * Don't ignore out-of-bounds PC values silently,
+	 * put them into the last histogram slot, so if
+	 * present, they will show up as a sharp peak.
+	 */
+	if (pc > prof_len - 1)
+		pc = prof_len - 1;
+	atomic_inc((atomic_t *)&prof_buffer[pc]);
 }
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/irq_smp.c linux/arch/alpha/kernel/irq_smp.c
--- v2.3.48/linux/arch/alpha/kernel/irq_smp.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/alpha/kernel/irq_smp.c	Mon Feb 28 14:54:30 2000
@@ -0,0 +1,250 @@
+/*
+ *	linux/arch/alpha/kernel/irq_smp.c
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/random.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+
+#include <asm/system.h>
+#include <asm/io.h>
+
+
+/* Who has global_irq_lock. */
+int global_irq_holder = NO_PROC_ID;
+
+/* This protects IRQ's. */
+spinlock_t global_irq_lock = SPIN_LOCK_UNLOCKED;
+
+/* Global IRQ locking depth. */
+static void *previous_irqholder = NULL;
+
+#define MAXCOUNT 100000000
+
+
+static void
+show(char * str, void *where)
+{
+#if 0
+	int i;
+        unsigned long *stack;
+#endif
+        int cpu = smp_processor_id();
+
+        printk("\n%s, CPU %d: %p\n", str, cpu, where);
+        printk("irq:  %d [%d %d]\n",
+	       irqs_running(),
+               cpu_data[0].irq_count,
+	       cpu_data[1].irq_count);
+
+        printk("bh:   %d [%d %d]\n",
+	       spin_is_locked(&global_bh_lock) ? 1 : 0,
+	       cpu_data[0].bh_count,
+	       cpu_data[1].bh_count);
+#if 0
+        stack = (unsigned long *) &str;
+        for (i = 40; i ; i--) {
+		unsigned long x = *++stack;
+                if (x > (unsigned long) &init_task_union &&
+		    x < (unsigned long) &vsprintf) {
+			printk("<[%08lx]> ", x);
+                }
+        }
+#endif
+}
+
+static inline void
+wait_on_irq(int cpu, void *where)
+{
+	int count = MAXCOUNT;
+
+	for (;;) {
+
+		/*
+		 * Wait until all interrupts are gone. Wait
+		 * for bottom half handlers unless we're
+		 * already executing in one..
+		 */
+		if (!irqs_running()) {
+			if (local_bh_count(cpu)
+			    || !spin_is_locked(&global_bh_lock))
+				break;
+		}
+
+		/* Duh, we have to loop. Release the lock to avoid deadlocks */
+		spin_unlock(&global_irq_lock);
+
+		for (;;) {
+			if (!--count) {
+				show("wait_on_irq", where);
+				count = MAXCOUNT;
+			}
+			__sti();
+			udelay(1); /* make sure to run pending irqs */
+			__cli();
+
+			if (irqs_running())
+				continue;
+			if (spin_is_locked(&global_irq_lock))
+				continue;
+			if (!local_bh_count(cpu)
+			    && spin_is_locked(&global_bh_lock))
+				continue;
+			if (spin_trylock(&global_irq_lock))
+				break;
+		}
+	}
+}
+
+static inline void
+get_irqlock(int cpu, void* where)
+{
+	if (!spin_trylock(&global_irq_lock)) {
+		/* Do we already hold the lock?  */
+		if (cpu == global_irq_holder)
+			return;
+		/* Uhhuh.. Somebody else got it.  Wait.  */
+		spin_lock(&global_irq_lock);
+	}
+
+	/*
+	 * Ok, we got the lock bit.
+	 * But that's actually just the easy part.. Now
+	 * we need to make sure that nobody else is running
+	 * in an interrupt context. 
+	 */
+	wait_on_irq(cpu, where);
+
+	/*
+	 * Finally.
+	 */
+#if DEBUG_SPINLOCK
+	global_irq_lock.task = current;
+	global_irq_lock.previous = where;
+#endif
+	global_irq_holder = cpu;
+	previous_irqholder = where;
+}
+
+void
+__global_cli(void)
+{
+	int cpu = smp_processor_id();
+	void *where = __builtin_return_address(0);
+
+	/*
+	 * Maximize ipl.  If ipl was previously 0 and if this thread
+	 * is not in an irq, then take global_irq_lock.
+	 */
+	if (swpipl(IPL_MAX) == IPL_MIN && !local_irq_count(cpu))
+		get_irqlock(cpu, where);
+}
+
+void
+__global_sti(void)
+{
+        int cpu = smp_processor_id();
+
+        if (!local_irq_count(cpu))
+		release_irqlock(cpu);
+	__sti();
+}
+
+/*
+ * SMP flags value to restore to:
+ * 0 - global cli
+ * 1 - global sti
+ * 2 - local cli
+ * 3 - local sti
+ */
+unsigned long
+__global_save_flags(void)
+{
+        int retval;
+        int local_enabled;
+        unsigned long flags;
+	int cpu = smp_processor_id();
+
+        __save_flags(flags);
+        local_enabled = (!(flags & 7));
+        /* default to local */
+        retval = 2 + local_enabled;
+
+        /* Check for global flags if we're not in an interrupt.  */
+        if (!local_irq_count(cpu)) {
+                if (local_enabled)
+                        retval = 1;
+                if (global_irq_holder == cpu)
+                        retval = 0;
+	}
+	return retval;
+}
+
+void
+__global_restore_flags(unsigned long flags)
+{
+        switch (flags) {
+        case 0:
+                __global_cli();
+                break;
+        case 1:
+                __global_sti();
+                break;
+        case 2:
+                __cli();
+                break;
+        case 3:
+                __sti();
+                break;
+        default:
+                printk(KERN_ERR "global_restore_flags: %08lx (%p)\n",
+                        flags, __builtin_return_address(0));
+        }
+}
+
+/*
+ * From its use, I infer that synchronize_irq() stalls a thread until
+ * the effects of a command to an external device are known to have
+ * taken hold.  Typically, the command is to stop sending interrupts.
+ * The strategy here is wait until there is at most one processor
+ * (this one) in an irq.  The memory barrier serializes the write to
+ * the device and the subsequent accesses of global_irq_count.
+ * --jmartin
+ */
+#define DEBUG_SYNCHRONIZE_IRQ 0
+
+void
+synchronize_irq(void)
+{
+#if 0
+	/* Joe's version.  */
+	int cpu = smp_processor_id();
+	int local_count;
+	int global_count;
+	int countdown = 1<<24;
+	void *where = __builtin_return_address(0);
+
+	mb();
+	do {
+		local_count = local_irq_count(cpu);
+		global_count = atomic_read(&global_irq_count);
+		if (DEBUG_SYNCHRONIZE_IRQ && (--countdown == 0)) {
+			printk("%d:%d/%d\n", cpu, local_count, global_count);
+			show("synchronize_irq", where);
+			break;
+		}
+	} while (global_count != local_count);
+#else
+	/* Jay's version.  */
+	if (irqs_running()) {
+		cli();
+		sti();
+	}
+#endif
+}
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/irq_srm.c linux/arch/alpha/kernel/irq_srm.c
--- v2.3.48/linux/arch/alpha/kernel/irq_srm.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/alpha/kernel/irq_srm.c	Mon Feb 28 14:54:30 2000
@@ -0,0 +1,82 @@
+/*
+ * Handle interrupts from the SRM, assuming no additional weirdness.
+ */
+
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/irq.h>
+
+#include <asm/machvec.h>
+#include <asm/dma.h>
+
+#include "proto.h"
+#include "irq_impl.h"
+
+
+/*
+ * Is the palcode SMP safe? In other words: can we call cserve_ena/dis
+ * at the same time in multiple CPUs? To be safe I added a spinlock
+ * but it can be removed trivially if the palcode is robust against smp.
+ */
+spinlock_t srm_irq_lock = SPIN_LOCK_UNLOCKED;
+
+static inline void
+srm_enable_irq(unsigned int irq)
+{
+	spin_lock(&srm_irq_lock);
+	cserve_ena(irq - 16);
+	spin_unlock(&srm_irq_lock);
+}
+
+static void
+srm_disable_irq(unsigned int irq)
+{
+	spin_lock(&srm_irq_lock);
+	cserve_dis(irq - 16);
+	spin_unlock(&srm_irq_lock);
+}
+
+static unsigned int
+srm_startup_irq(unsigned int irq)
+{
+	srm_enable_irq(irq);
+	return 0;
+}
+
+static void
+srm_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		srm_enable_irq(irq);
+}
+
+/* Handle interrupts from the SRM, assuming no additional weirdness.  */
+static struct hw_interrupt_type srm_irq_type = {
+	typename:	"SRM",
+	startup:	srm_startup_irq,
+	shutdown:	srm_disable_irq,
+	enable:		srm_enable_irq,
+	disable:	srm_disable_irq,
+	ack:		srm_disable_irq,
+	end:		srm_end_irq,
+};
+
+void __init
+init_srm_irqs(long max, unsigned long ignore_mask)
+{
+	long i;
+
+	for (i = 16; i < max; ++i) {
+		if (i < 64 && ((ignore_mask >> i) & 1))
+			continue;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
+		irq_desc[i].handler = &srm_irq_type;
+	}
+}
+
+void 
+srm_device_interrupt(unsigned long vector, struct pt_regs * regs)
+{
+	int irq = (vector - 0x800) >> 4;
+	handle_irq(irq, regs);
+}
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/machvec_impl.h linux/arch/alpha/kernel/machvec_impl.h
--- v2.3.48/linux/arch/alpha/kernel/machvec_impl.h	Thu Feb 10 17:11:02 2000
+++ linux/arch/alpha/kernel/machvec_impl.h	Thu Mar  2 11:35:17 2000
@@ -44,7 +44,6 @@
 	mv_switch_mm:			ev4_switch_mm,			\
 	mv_activate_mm:			ev4_activate_mm,		\
 	mv_flush_tlb_current:		ev4_flush_tlb_current,		\
-	mv_flush_tlb_other:		ev4_flush_tlb_other,		\
 	mv_flush_tlb_current_page:	ev4_flush_tlb_current_page
 
 #define DO_EV5_MMU							\
@@ -52,7 +51,6 @@
 	mv_switch_mm:			ev5_switch_mm,			\
 	mv_activate_mm:			ev5_activate_mm,		\
 	mv_flush_tlb_current:		ev5_flush_tlb_current,		\
-	mv_flush_tlb_other:		ev5_flush_tlb_other,		\
 	mv_flush_tlb_current_page:	ev5_flush_tlb_current_page
 
 #define DO_EV6_MMU							\
@@ -60,7 +58,6 @@
 	mv_switch_mm:			ev5_switch_mm,			\
 	mv_activate_mm:			ev5_activate_mm,		\
 	mv_flush_tlb_current:		ev5_flush_tlb_current,		\
-	mv_flush_tlb_other:		ev5_flush_tlb_other,		\
 	mv_flush_tlb_current_page:	ev5_flush_tlb_current_page
 
 #define IO_LITE(UP,low)							\
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/pci_impl.h linux/arch/alpha/kernel/pci_impl.h
--- v2.3.48/linux/arch/alpha/kernel/pci_impl.h	Thu Feb 10 17:11:02 2000
+++ linux/arch/alpha/kernel/pci_impl.h	Thu Mar  2 11:35:12 2000
@@ -123,6 +123,24 @@
    _ctl_; })
 
 
+/* A PCI IOMMU allocation arena.  There are typically two of these
+   regions per bus.  */
+/* ??? The 8400 has a 32-byte pte entry, and the entire table apparently
+   lives directly on the host bridge (no tlb?).  We don't support this
+   machine, but if we ever did, we'd need to parameterize all this quite
+   a bit further.  Probably with per-bus operation tables.  */
+
+struct pci_iommu_arena
+{
+	spinlock_t lock;
+	struct pci_controler *hose;
+	unsigned long *ptes;
+	dma_addr_t dma_base;
+	unsigned int size;
+	unsigned int next_entry;
+};
+
+
 /* The hose list.  */
 extern struct pci_controler *hose_head, **hose_tail;
 extern struct pci_controler *pci_isa_hose;
@@ -132,8 +150,9 @@
 extern struct pci_controler *alloc_pci_controler(void);
 extern struct resource *alloc_resource(void);
 
-extern struct pci_iommu_arena *iommu_arena_new(dma_addr_t, unsigned long,
-					   unsigned long);
+extern struct pci_iommu_arena *iommu_arena_new(struct pci_controler *,
+					       dma_addr_t, unsigned long,
+					       unsigned long);
 extern long iommu_arena_alloc(struct pci_iommu_arena *arena, long n);
 
 extern const char *const pci_io_names[];
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/pci_iommu.c linux/arch/alpha/kernel/pci_iommu.c
--- v2.3.48/linux/arch/alpha/kernel/pci_iommu.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/pci_iommu.c	Thu Mar  2 11:35:12 2000
@@ -27,6 +27,8 @@
 # define DBGA2(args...)
 #endif
 
+#define DEBUG_NODIRECT 0
+
 
 static inline unsigned long
 mk_iommu_pte(unsigned long paddr)
@@ -41,23 +43,29 @@
 }
 
 struct pci_iommu_arena *
-iommu_arena_new(dma_addr_t base, unsigned long window_size,
-		unsigned long align)
+iommu_arena_new(struct pci_controler *hose, dma_addr_t base,
+		unsigned long window_size, unsigned long align)
 {
-	unsigned long entries, mem_size, mem_pages;
+	unsigned long mem_size;
 	struct pci_iommu_arena *arena;
 
-	entries = window_size >> PAGE_SHIFT;
-	mem_size = entries * sizeof(unsigned long);
-	mem_pages = calc_npages(mem_size);
+	mem_size = window_size / (PAGE_SIZE / sizeof(unsigned long));
+
+	/* Note that the TLB lookup logic uses bitwise concatenation,
+	   not addition, so the required arena alignment is based on
+	   the size of the window.  Retain the align parameter so that
+	   particular systems can over-align the arena.  */
+	if (align < mem_size)
+		align = mem_size;
 
 	arena = alloc_bootmem(sizeof(*arena));
-	arena->ptes = __alloc_bootmem(mem_pages * PAGE_SIZE, align, 0);
+	arena->ptes = __alloc_bootmem(mem_size, align, 0);
 
 	spin_lock_init(&arena->lock);
+	arena->hose = hose;
 	arena->dma_base = base;
 	arena->size = window_size;
-	arena->alloc_hint = 0;
+	arena->next_entry = 0;
 
 	return arena;
 }
@@ -74,20 +82,22 @@
 	/* Search forward for the first sequence of N empty ptes.  */
 	beg = arena->ptes;
 	end = beg + (arena->size >> PAGE_SHIFT);
-	p = beg + arena->alloc_hint;
+	p = beg + arena->next_entry;
 	i = 0;
 	while (i < n && p < end)
 		i = (*p++ == 0 ? i + 1 : 0);
 
-	if (p >= end) {
-		/* Failure.  Assume the hint was wrong and go back to
+	if (i < n) {
+		/* Reached the end.  Flush the TLB and restart the
 		   search from the beginning.  */
+		alpha_mv.mv_pci_tbi(arena->hose, 0, -1);
+
 		p = beg;
 		i = 0;
 		while (i < n && p < end)
 			i = (*p++ == 0 ? i + 1 : 0);
 
-		if (p >= end) {
+		if (i < n) {
 			spin_unlock_irqrestore(&arena->lock, flags);
 			return -1;
 		}
@@ -100,7 +110,7 @@
 	for (p = p - n, i = 0; i < n; ++i)
 		p[i] = ~1UL;
 
-	arena->alloc_hint = p - beg + n;
+	arena->next_entry = p - beg + n;
 	spin_unlock_irqrestore(&arena->lock, flags);
 
 	return p - beg;
@@ -115,7 +125,6 @@
 	p = arena->ptes + ofs;
 	for (i = 0; i < n; ++i)
 		p[i] = 0;
-	arena->alloc_hint = ofs;
 }
 
 /* Map a single buffer of the indicate size for PCI DMA in streaming
@@ -138,6 +147,7 @@
 
 	paddr = virt_to_phys(cpu_addr);
 
+#if !DEBUG_NODIRECT
 	/* First check to see if we can use the direct map window.  */
 	if (paddr + size + __direct_map_base - 1 <= max_dma
 	    && paddr + size <= __direct_map_size) {
@@ -148,6 +158,7 @@
 
 		return ret;
 	}
+#endif
 
 	/* If the machine doesn't define a pci_tbi routine, we have to
 	   assume it doesn't support sg mapping.  */
@@ -199,6 +210,7 @@
 	if (direction == PCI_DMA_NONE)
 		BUG();
 
+#if !DEBUG_NODIRECT
 	if (dma_addr >= __direct_map_base
 	    && dma_addr < __direct_map_base + __direct_map_size) {
 		/* Nothing to do.  */
@@ -208,6 +220,7 @@
 
 		return;
 	}
+#endif
 
 	arena = hose->sg_pci;
 	if (!arena || dma_addr < arena->dma_base)
@@ -224,10 +237,9 @@
 
 	npages = calc_npages((dma_addr & ~PAGE_MASK) + size);
 	iommu_arena_free(arena, dma_ofs, npages);
-	alpha_mv.mv_pci_tbi(hose, dma_addr, dma_addr + size - 1);
 
-	DBGA2("pci_unmap_single: sg [%x,%lx] np %ld from %p\n",
-	      dma_addr, size, npages, __builtin_return_address(0));
+	DBGA("pci_unmap_single: sg [%x,%lx] np %ld from %p\n",
+	     dma_addr, size, npages, __builtin_return_address(0));
 }
 
 
@@ -347,6 +359,7 @@
 	unsigned long *ptes;
 	long npages, dma_ofs, i;
 
+#if !DEBUG_NODIRECT
 	/* If everything is physically contiguous, and the addresses
 	   fall into the direct-map window, use it.  */
 	if (leader->dma_address == 0
@@ -360,6 +373,7 @@
 
 		return 0;
 	}
+#endif
 
 	/* Otherwise, we'll use the iommu to make the pages virtually
 	   contiguous.  */
@@ -376,56 +390,38 @@
 	DBGA("    sg_fill: [%p,%lx] -> sg %x np %ld\n",
 	     leader->address, size, out->dma_address, npages);
 
+	/* All virtually contiguous.  We need to find the length of each
+	   physically contiguous subsegment to fill in the ptes.  */
 	ptes = &arena->ptes[dma_ofs];
 	sg = leader;
-	if (0 && leader->dma_address == 0) {
-		/* All physically contiguous.  We already have the
-		   length, all we need is to fill in the ptes.  */
+	do {
+		struct scatterlist *last_sg = sg;
+
+		size = sg->length;
+		paddr = virt_to_phys(sg->address);
 
-		paddr = virt_to_phys(sg->address) & PAGE_MASK;
+		while (sg+1 < end && (int) sg[1].dma_address == -1) {
+			size += sg[1].length;
+			sg++;
+		}
+
+		npages = calc_npages((paddr & ~PAGE_MASK) + size);
+
+		paddr &= PAGE_MASK;
 		for (i = 0; i < npages; ++i, paddr += PAGE_SIZE)
 			*ptes++ = mk_iommu_pte(paddr);
 
 #if DEBUG_ALLOC > 0
-		DBGA("    (0) [%p,%x] np %ld\n",
-		     sg->address, sg->length, npages);
-		for (++sg; sg < end && (int) sg->dma_address < 0; ++sg)
+		DBGA("    (%ld) [%p,%x] np %ld\n",
+		     last_sg - leader, last_sg->address,
+		     last_sg->length, npages);
+		while (++last_sg <= sg) {
 			DBGA("        (%ld) [%p,%x] cont\n",
-			     sg - leader, sg->address, sg->length);
-#endif
-	} else {
-		/* All virtually contiguous.  We need to find the
-		   length of each physically contiguous subsegment
-		   to fill in the ptes.  */
-		do {
-			struct scatterlist *last_sg = sg;
-
-			size = sg->length;
-			paddr = virt_to_phys(sg->address);
-
-			while (sg+1 < end && (int) sg[1].dma_address == -1) {
-				size += sg[1].length;
-				sg++;
-			}
-
-			npages = calc_npages((paddr & ~PAGE_MASK) + size);
-
-			paddr &= PAGE_MASK;
-			for (i = 0; i < npages; ++i, paddr += PAGE_SIZE)
-				*ptes++ = mk_iommu_pte(paddr);
-
-#if DEBUG_ALLOC > 0
-			DBGA("    (%ld) [%p,%x] np %ld\n",
 			     last_sg - leader, last_sg->address,
-			     last_sg->length, npages);
-			while (++last_sg <= sg) {
-				DBGA("        (%ld) [%p,%x] cont\n",
-				     last_sg - leader, last_sg->address,
-				     last_sg->length);
-			}
+			     last_sg->length);
+		}
 #endif
-		} while (++sg < end && (int) sg->dma_address < 0);
-	}
+	} while (++sg < end && (int) sg->dma_address < 0);
 
 	return 1;
 }
@@ -472,13 +468,9 @@
 	/* Third, iterate over the scatterlist leaders and allocate
 	   dma space as needed.  */
 	for (out = sg; sg < end; ++sg) {
-		int ret;
-
 		if ((int) sg->dma_address < 0)
 			continue;
-
-		ret = sg_fill(sg, end, out, arena, max_dma);
-		if (ret < 0)
+		if (sg_fill(sg, end, out, arena, max_dma) < 0)
 			goto error;
 		out++;
 	}
@@ -517,7 +509,6 @@
 	struct pci_iommu_arena *arena;
 	struct scatterlist *end;
 	dma_addr_t max_dma;
-	dma_addr_t fstart, fend;
 
 	if (direction == PCI_DMA_NONE)
 		BUG();
@@ -531,42 +522,32 @@
 	if (!arena || arena->dma_base + arena->size > max_dma)
 		arena = hose->sg_isa;
 
-	fstart = -1;
-	fend = 0;
 	for (end = sg + nents; sg < end; ++sg) {
 		unsigned long addr, size;
+		long npages, ofs;
 
 		addr = sg->dma_address;
 		size = sg->dma_length;
-
 		if (!size)
 			break;
 
+#if !DEBUG_NODIRECT
 		if (addr >= __direct_map_base
 		    && addr < __direct_map_base + __direct_map_size) {
 			/* Nothing to do.  */
 			DBGA("    (%ld) direct [%lx,%lx]\n",
 			      sg - end + nents, addr, size);
-		} else {
-			long npages, ofs;
-			dma_addr_t tend;
+			continue;
+		}
+#endif
 
-			DBGA("    (%ld) sg [%lx,%lx]\n",
-			      sg - end + nents, addr, size);
+		DBGA("    (%ld) sg [%lx,%lx]\n",
+		     sg - end + nents, addr, size);
 
-			npages = calc_npages((addr & ~PAGE_MASK) + size);
-			ofs = (addr - arena->dma_base) >> PAGE_SHIFT;
-			iommu_arena_free(arena, ofs, npages);
-
-			tend = addr + size - 1;
-			if (fstart > addr)
-				fstart = addr;
-			if (fend < tend)
-				fend = tend;
-		}
+		npages = calc_npages((addr & ~PAGE_MASK) + size);
+		ofs = (addr - arena->dma_base) >> PAGE_SHIFT;
+		iommu_arena_free(arena, ofs, npages);
 	}
-	if (fend)
-		alpha_mv.mv_pci_tbi(hose, fstart, fend);
 
 	DBGA("pci_unmap_sg: %d entries\n", nents - (end - sg));
 }
@@ -580,6 +561,7 @@
 	struct pci_controler *hose;
 	struct pci_iommu_arena *arena;
 
+#if !DEBUG_NODIRECT
 	/* If there exists a direct map, and the mask fits either
 	   MAX_DMA_ADDRESS defined such that GFP_DMA does something
 	   useful, or the total system memory as shifted by the
@@ -588,6 +570,7 @@
 	    && (__direct_map_base + MAX_DMA_ADDRESS-IDENT_ADDR-1 <= mask
 		|| __direct_map_base + (max_low_pfn<<PAGE_SHIFT)-1 <= mask))
 		return 1;
+#endif
 
 	/* Check that we have a scatter-gather arena that fits.  */
 	hose = pdev ? pdev->sysdata : pci_isa_hose;
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/proto.h linux/arch/alpha/kernel/proto.h
--- v2.3.48/linux/arch/alpha/kernel/proto.h	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/proto.h	Sun Feb 27 13:28:01 2000
@@ -10,7 +10,6 @@
 struct task_struct;
 struct pci_dev;
 struct pci_controler;
-struct irqaction;
 
 /* core_apecs.c */
 extern struct pci_ops apecs_pci_ops;
@@ -81,14 +80,13 @@
 extern int smp_info(char *buffer);
 extern void handle_ipi(struct pt_regs *);
 extern void smp_percpu_timer_interrupt(struct pt_regs *);
-extern unsigned long cpu_present_mask;
 
 /* bios32.c */
 /* extern void reset_for_srm(void); */
 
 /* time.c */
 extern void timer_interrupt(int irq, void *dev, struct pt_regs * regs);
-extern void common_init_rtc(struct irqaction *);
+extern void common_init_rtc(void);
 extern unsigned long est_cycle_freq;
 
 /* smc37c93x.c */
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c
--- v2.3.48/linux/arch/alpha/kernel/setup.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/setup.c	Sun Feb 27 13:28:01 2000
@@ -487,6 +487,7 @@
 #ifdef __SMP__
 	setup_smp();
 #endif
+	paging_init();
 }
 
 static char sys_unknown[] = "Unknown";
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/signal.c linux/arch/alpha/kernel/signal.c
--- v2.3.48/linux/arch/alpha/kernel/signal.c	Tue Nov 23 22:42:20 1999
+++ linux/arch/alpha/kernel/signal.c	Mon Feb 28 07:50:08 2000
@@ -437,6 +437,8 @@
 		err |= __copy_to_user(frame->extramask, &set->sig[1], 
 				      sizeof(frame->extramask));
 	}
+	if (err)
+		goto give_sigsegv;
 
 	/* Set up to return from userspace.  If provided, use a stub
 	   already in userspace.  */
@@ -499,6 +501,8 @@
 	err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, sw,
 				set->sig[0], oldsp);
 	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
+	if (err)
+		goto give_sigsegv;
 
 	/* Set up to return from userspace.  If provided, use a stub
 	   already in userspace.  */
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/smp.c linux/arch/alpha/kernel/smp.c
--- v2.3.48/linux/arch/alpha/kernel/smp.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/smp.c	Thu Mar  2 11:35:17 2000
@@ -972,6 +972,33 @@
 	flush_tlb_mm(mm);
 }
 
+static void
+ipi_flush_icache_page(void *x)
+{
+	struct mm_struct *mm = (struct mm_struct *) x;
+	if (mm == current->active_mm)
+		__load_new_mm_context(mm);
+}
+
+void
+flush_icache_page(struct vm_area_struct *vma, struct page *page)
+{
+	struct mm_struct *mm = vma->vm_mm;
+
+	if ((vma->vm_flags & VM_EXEC) == 0)
+		return;
+
+	mm->context = 0;
+	if (mm == current->active_mm) {
+		__load_new_mm_context(mm);
+		if (atomic_read(&mm->mm_users) <= 1)
+			return;
+	}
+
+	if (smp_call_function(ipi_flush_icache_page, mm, 1, 1)) {
+		printk(KERN_CRIT "flush_icache_page: timed out\n");
+	}
+}
 
 int
 smp_info(char *buffer)
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_alcor.c linux/arch/alpha/kernel/sys_alcor.c
--- v2.3.48/linux/arch/alpha/kernel/sys_alcor.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_alcor.c	Mon Feb 28 14:54:30 2000
@@ -48,7 +48,7 @@
 	alcor_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16));
 }
 
-static inline void
+static void
 alcor_disable_irq(unsigned int irq)
 {
 	alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16)));
@@ -81,6 +81,13 @@
 	*(vuip)GRU_INT_CLEAR = 0; mb();
 }
 
+static void
+alcor_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		alcor_enable_irq(irq);
+}
+
 static struct hw_interrupt_type alcor_irq_type = {
 	typename:	"ALCOR",
 	startup:	alcor_startup_irq,
@@ -88,7 +95,7 @@
 	enable:		alcor_enable_irq,
 	disable:	alcor_disable_irq,
 	ack:		alcor_mask_and_ack_irq,
-	end:		alcor_enable_irq,
+	end:		alcor_end_irq,
 };
 
 static void
@@ -134,13 +141,12 @@
 		   on while IRQ probing.  */
 		if (i >= 16+20 && i <= 16+30)
 			continue;
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &alcor_irq_type;
 	}
 	i8259a_irq_type.ack = alcor_isa_mask_and_ack_irq;
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 
 	setup_irq(16+31, &isa_cascade_irqaction);
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_cabriolet.c linux/arch/alpha/kernel/sys_cabriolet.c
--- v2.3.48/linux/arch/alpha/kernel/sys_cabriolet.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/sys_cabriolet.c	Mon Feb 28 14:54:30 2000
@@ -65,6 +65,13 @@
 	return 0; /* never anything pending */
 }
 
+static void
+cabriolet_end_irq(unsigned int irq)
+{ 
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		cabriolet_enable_irq(irq);
+}
+
 static struct hw_interrupt_type cabriolet_irq_type = {
 	typename:	"CABRIOLET",
 	startup:	cabriolet_startup_irq,
@@ -72,7 +79,7 @@
 	enable:		cabriolet_enable_irq,
 	disable:	cabriolet_disable_irq,
 	ack:		cabriolet_disable_irq,
-	end:		cabriolet_enable_irq,
+	end:		cabriolet_end_irq,
 };
 
 static void 
@@ -103,7 +110,6 @@
 cabriolet_init_irq(void)
 {
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	if (alpha_using_srm) {
 		alpha_mv.device_interrupt = srm_device_interrupt;
@@ -117,7 +123,7 @@
 		outb(0xff, 0x806);
 
 		for (i = 16; i < 35; ++i) {
-			irq_desc[i].status = IRQ_DISABLED;
+			irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 			irq_desc[i].handler = &cabriolet_irq_type;
 		}
 	}
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_dp264.c linux/arch/alpha/kernel/sys_dp264.c
--- v2.3.48/linux/arch/alpha/kernel/sys_dp264.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/sys_dp264.c	Mon Feb 28 14:54:30 2000
@@ -35,6 +35,10 @@
 
 /* Note mask bit is true for ENABLED irqs.  */
 static unsigned long cached_irq_mask;
+/* dp264 boards handle at max four CPUs */
+static unsigned long cpu_irq_affinity[4];
+
+spinlock_t dp264_irq_lock = SPIN_LOCK_UNLOCKED;
 
 static void
 tsunami_update_irq_hw(unsigned long mask, unsigned long isa_enable)
@@ -50,9 +54,14 @@
 	mask0 = mask1 = mask2 = mask3 = mask;
 	maskB = mask | isa_enable;
 	if (bcpu == 0) mask0 = maskB;
-	if (bcpu == 1) mask1 = maskB;
-	if (bcpu == 2) mask2 = maskB;
-	if (bcpu == 3) mask3 = maskB;
+	else if (bcpu == 1) mask1 = maskB;
+	else if (bcpu == 2) mask2 = maskB;
+	else if (bcpu == 3) mask3 = maskB;
+
+	mask0 &= cpu_irq_affinity[0];
+	mask1 &= cpu_irq_affinity[1];
+	mask2 &= cpu_irq_affinity[2];
+	mask3 &= cpu_irq_affinity[3];
 
 	dim0 = &cchip->dim0.csr;
 	dim1 = &cchip->dim1.csr;
@@ -73,10 +82,12 @@
 	*dim2;
 	*dim3;
 #else
-	volatile unsigned long *dimB = &cchip->dim1.csr;
+	volatile unsigned long *dimB;
 	if (bcpu == 0) dimB = &cchip->dim0.csr;
-	if (bcpu == 2) dimB = &cchip->dim2.csr;
-	if (bcpu == 3) dimB = &cchip->dim3.csr;
+	else if (bcpu == 1) dimB = &cchip->dim1.csr;
+	else if (bcpu == 2) dimB = &cchip->dim2.csr;
+	else if (bcpu == 3) dimB = &cchip->dim3.csr;
+
 	*dimB = mask | isa_enable;
 	mb();
 	*dimB;
@@ -95,18 +106,22 @@
 	tsunami_update_irq_hw(mask, 1UL << 55);
 }
 
-static inline void
+static void
 dp264_enable_irq(unsigned int irq)
 {
+	spin_lock(&dp264_irq_lock);
 	cached_irq_mask |= 1UL << irq;
 	dp264_update_irq_hw(cached_irq_mask);
+	spin_unlock(&dp264_irq_lock);
 }
 
 static void
 dp264_disable_irq(unsigned int irq)
 {
+	spin_lock(&dp264_irq_lock);
 	cached_irq_mask &= ~(1UL << irq);
 	dp264_update_irq_hw(cached_irq_mask);
+	spin_unlock(&dp264_irq_lock);
 }
 
 static unsigned int
@@ -116,18 +131,29 @@
 	return 0; /* never anything pending */
 }
 
-static inline void
+static void
+dp264_end_irq(unsigned int irq)
+{ 
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		dp264_enable_irq(irq);
+}
+
+static void
 clipper_enable_irq(unsigned int irq)
 {
+	spin_lock(&dp264_irq_lock);
 	cached_irq_mask |= 1UL << irq;
 	clipper_update_irq_hw(cached_irq_mask);
+	spin_unlock(&dp264_irq_lock);
 }
 
 static void
 clipper_disable_irq(unsigned int irq)
 {
+	spin_lock(&dp264_irq_lock);
 	cached_irq_mask &= ~(1UL << irq);
 	clipper_update_irq_hw(cached_irq_mask);
+	spin_unlock(&dp264_irq_lock);
 }
 
 static unsigned int
@@ -137,6 +163,47 @@
 	return 0; /* never anything pending */
 }
 
+static void
+clipper_end_irq(unsigned int irq)
+{ 
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		clipper_enable_irq(irq);
+}
+
+static void
+cpu_set_irq_affinity(unsigned int irq, unsigned long affinity)
+{
+	int cpu;
+
+	for (cpu = 0; cpu < 4; cpu++) {
+		unsigned long aff = cpu_irq_affinity[cpu];
+		if (affinity & (1UL << cpu))
+			aff |= 1UL << irq;
+		else
+			aff &= ~(1UL << irq);
+		cpu_irq_affinity[cpu] = aff;
+	}
+
+}
+
+static void
+dp264_set_affinity(unsigned int irq, unsigned long affinity)
+{ 
+	spin_lock(&dp264_irq_lock);
+	cpu_set_irq_affinity(irq, affinity);
+	dp264_update_irq_hw(cached_irq_mask);
+	spin_unlock(&dp264_irq_lock);
+}
+
+static void
+clipper_set_affinity(unsigned int irq, unsigned long affinity)
+{ 
+	spin_lock(&dp264_irq_lock);
+	cpu_set_irq_affinity(irq, affinity);
+	clipper_update_irq_hw(cached_irq_mask);
+	spin_unlock(&dp264_irq_lock);
+}
+
 static struct hw_interrupt_type dp264_irq_type = {
 	typename:	"DP264",
 	startup:	dp264_startup_irq,
@@ -144,7 +211,8 @@
 	enable:		dp264_enable_irq,
 	disable:	dp264_disable_irq,
 	ack:		dp264_disable_irq,
-	end:		dp264_enable_irq,
+	end:		dp264_end_irq,
+	set_affinity:	dp264_set_affinity,
 };
 
 static struct hw_interrupt_type clipper_irq_type = {
@@ -154,7 +222,8 @@
 	enable:		clipper_enable_irq,
 	disable:	clipper_disable_irq,
 	ack:		clipper_disable_irq,
-	end:		clipper_enable_irq,
+	end:		clipper_end_irq,
+	set_affinity:	clipper_set_affinity,
 };
 
 static void
@@ -249,6 +318,8 @@
 static void __init
 dp264_init_irq(void)
 {
+	int cpu;
+
 	outb(0, DMA1_RESET_REG);
 	outb(0, DMA2_RESET_REG);
 	outb(DMA_MODE_CASCADE, DMA2_MODE_REG);
@@ -257,10 +328,12 @@
 	if (alpha_using_srm)
 		alpha_mv.device_interrupt = dp264_srm_device_interrupt;
 
+	/* this is single threaded by design so no need of any smp lock */
+	for (cpu = 0; cpu < 4; cpu++)
+		cpu_irq_affinity[cpu] = ~0UL;
 	dp264_update_irq_hw(0UL);
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	init_tsunami_irqs(&dp264_irq_type);
 }
 
@@ -278,7 +351,6 @@
 	clipper_update_irq_hw(0UL);
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	init_tsunami_irqs(&clipper_irq_type);
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_eb64p.c linux/arch/alpha/kernel/sys_eb64p.c
--- v2.3.48/linux/arch/alpha/kernel/sys_eb64p.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_eb64p.c	Mon Feb 28 14:54:30 2000
@@ -48,7 +48,7 @@
 	eb64p_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq));
 }
 
-static inline void
+static void
 eb64p_disable_irq(unsigned int irq)
 {
 	eb64p_update_irq_hw(irq, cached_irq_mask |= 1 << irq);
@@ -61,6 +61,13 @@
 	return 0; /* never anything pending */
 }
 
+static void
+eb64p_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		eb64p_enable_irq(irq);
+}
+
 static struct hw_interrupt_type eb64p_irq_type = {
 	typename:	"EB64P",
 	startup:	eb64p_startup_irq,
@@ -68,7 +75,7 @@
 	enable:		eb64p_enable_irq,
 	disable:	eb64p_disable_irq,
 	ack:		eb64p_disable_irq,
-	end:		eb64p_enable_irq,
+	end:		eb64p_end_irq,
 };
 
 static void 
@@ -119,10 +126,9 @@
 	outb(0xff, 0x27);
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	for (i = 16; i < 32; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &eb64p_irq_type;
 	}		
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_eiger.c linux/arch/alpha/kernel/sys_eiger.c
--- v2.3.48/linux/arch/alpha/kernel/sys_eiger.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_eiger.c	Mon Feb 28 14:54:30 2000
@@ -76,6 +76,13 @@
 	return 0; /* never anything pending */
 }
 
+static void
+eiger_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		eiger_enable_irq(irq);
+}
+
 static struct hw_interrupt_type eiger_irq_type = {
 	typename:	"EIGER",
 	startup:	eiger_startup_irq,
@@ -83,7 +90,7 @@
 	enable:		eiger_enable_irq,
 	disable:	eiger_disable_irq,
 	ack:		eiger_disable_irq,
-	end:		eiger_enable_irq,
+	end:		eiger_end_irq,
 };
 
 static void
@@ -147,10 +154,9 @@
 		eiger_update_irq_hw(i, -1);
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	for (i = 16; i < 128; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &eiger_irq_type;
 	}
 }
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_jensen.c linux/arch/alpha/kernel/sys_jensen.c
--- v2.3.48/linux/arch/alpha/kernel/sys_jensen.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_jensen.c	Sun Feb 27 13:28:01 2000
@@ -71,7 +71,7 @@
 	enable:		i8259a_enable_irq,
 	disable:	i8259a_disable_irq,
 	ack:		jensen_local_ack,
-	end:		i8259a_enable_irq,
+	end:		i8259a_end_irq,
 };
 
 static void 
@@ -110,7 +110,6 @@
 jensen_init_irq(void)
 {
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	irq_desc[1].handler = &jensen_local_irq_type;
 	irq_desc[4].handler = &jensen_local_irq_type;
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_miata.c linux/arch/alpha/kernel/sys_miata.c
--- v2.3.48/linux/arch/alpha/kernel/sys_miata.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_miata.c	Sun Feb 27 13:28:01 2000
@@ -70,7 +70,6 @@
 #endif
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	/* Not interested in the bogus interrupts (3,10), Fan Fault (0),
            NMI (1), or EIDE (9).
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_mikasa.c linux/arch/alpha/kernel/sys_mikasa.c
--- v2.3.48/linux/arch/alpha/kernel/sys_mikasa.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_mikasa.c	Mon Feb 28 14:54:30 2000
@@ -48,7 +48,7 @@
 	mikasa_update_irq_hw(cached_irq_mask |= 1 << (irq - 16));
 }
 
-static inline void
+static void
 mikasa_disable_irq(unsigned int irq)
 {
 	mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (irq - 16)));
@@ -61,6 +61,13 @@
 	return 0;
 }
 
+static void
+mikasa_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		mikasa_enable_irq(irq);
+}
+
 static struct hw_interrupt_type mikasa_irq_type = {
 	typename:	"MIKASA",
 	startup:	mikasa_startup_irq,
@@ -68,7 +75,7 @@
 	enable:		mikasa_enable_irq,
 	disable:	mikasa_disable_irq,
 	ack:		mikasa_disable_irq,
-	end:		mikasa_enable_irq,
+	end:		mikasa_end_irq,
 };
 
 static void 
@@ -108,12 +115,11 @@
 	mikasa_update_irq_hw(0);
 
 	for (i = 16; i < 32; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &mikasa_irq_type;
 	}
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_nautilus.c linux/arch/alpha/kernel/sys_nautilus.c
--- v2.3.48/linux/arch/alpha/kernel/sys_nautilus.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_nautilus.c	Sun Feb 27 13:28:01 2000
@@ -54,7 +54,6 @@
 nautilus_init_irq(void)
 {
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_noritake.c linux/arch/alpha/kernel/sys_noritake.c
--- v2.3.48/linux/arch/alpha/kernel/sys_noritake.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_noritake.c	Mon Feb 28 14:54:30 2000
@@ -45,13 +45,13 @@
 	outw(mask, port);
 }
 
-static inline void
+static void
 noritake_enable_irq(unsigned int irq)
 {
 	noritake_update_irq_hw(irq, cached_irq_mask |= 1 << (irq - 16));
 }
 
-static inline void
+static void
 noritake_disable_irq(unsigned int irq)
 {
 	noritake_update_irq_hw(irq, cached_irq_mask &= ~(1 << (irq - 16)));
@@ -135,12 +135,11 @@
 	outw(0, 0x54c);
 
 	for (i = 16; i < 48; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &noritake_irq_type;
 	}
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_rawhide.c linux/arch/alpha/kernel/sys_rawhide.c
--- v2.3.48/linux/arch/alpha/kernel/sys_rawhide.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_rawhide.c	Mon Feb 28 14:54:30 2000
@@ -41,6 +41,7 @@
 	0xff0000, 0xfe0000, 0xff0000, 0xff0000
 };
 static unsigned int cached_irq_masks[4];
+spinlock_t rawhide_irq_lock = SPIN_LOCK_UNLOCKED;
 
 static inline void
 rawhide_update_irq_hw(int hose, int mask)
@@ -50,7 +51,7 @@
 	*(vuip)MCPCIA_INT_MASK0(MCPCIA_HOSE2MID(hose));
 }
 
-static void 
+static inline void 
 rawhide_enable_irq(unsigned int irq)
 {
 	unsigned int mask, hose;
@@ -59,9 +60,11 @@
 	hose = irq / 24;
 	irq -= hose * 24;
 
+	spin_lock(&rawhide_irq_lock);
 	mask = cached_irq_masks[hose] |= 1 << irq;
 	mask |= hose_irq_masks[hose];
 	rawhide_update_irq_hw(hose, mask);
+	spin_unlock(&rawhide_irq_lock);
 }
 
 static void 
@@ -73,9 +76,11 @@
 	hose = irq / 24;
 	irq -= hose * 24;
 
+	spin_lock(&rawhide_irq_lock);
 	mask = cached_irq_masks[hose] &= ~(1 << irq);
 	mask |= hose_irq_masks[hose];
 	rawhide_update_irq_hw(hose, mask);
+	spin_unlock(&rawhide_irq_lock);
 }
 
 
@@ -86,6 +91,13 @@
 	return 0;
 }
 
+static void
+rawhide_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		rawhide_enable_irq(irq);
+}
+
 static struct hw_interrupt_type rawhide_irq_type = {
 	typename:	"RAWHIDE",
 	startup:	rawhide_startup_irq,
@@ -93,7 +105,7 @@
 	enable:		rawhide_enable_irq,
 	disable:	rawhide_disable_irq,
 	ack:		rawhide_disable_irq,
-	end:		rawhide_enable_irq,
+	end:		rawhide_end_irq,
 };
 
 static void 
@@ -138,12 +150,11 @@
 	}
 
 	for (i = 16; i < 128; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &rawhide_irq_type;
 	}
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_ruffian.c linux/arch/alpha/kernel/sys_ruffian.c
--- v2.3.48/linux/arch/alpha/kernel/sys_ruffian.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_ruffian.c	Sun Feb 27 13:28:01 2000
@@ -64,7 +64,7 @@
 }
 
 static void __init
-ruffian_init_rtc(struct irqaction *action)
+ruffian_init_rtc(void)
 {
 	/* Ruffian does not have the RTC connected to the CPU timer
 	   interrupt.  Instead, it uses the PIT connected to IRQ 0.  */
@@ -78,7 +78,7 @@
 	outb(0x31, 0x42);
 	outb(0x13, 0x42);
 
-	setup_irq(0, action);
+	setup_irq(0, &timer_irqaction);
 }
 
 static void
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_rx164.c linux/arch/alpha/kernel/sys_rx164.c
--- v2.3.48/linux/arch/alpha/kernel/sys_rx164.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_rx164.c	Mon Feb 28 14:54:30 2000
@@ -65,6 +65,13 @@
 	return 0;
 }
 
+static void
+rx164_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		rx164_enable_irq(irq);
+}
+
 static struct hw_interrupt_type rx164_irq_type = {
 	typename:	"RX164",
 	startup:	rx164_startup_irq,
@@ -72,7 +79,7 @@
 	enable:		rx164_enable_irq,
 	disable:	rx164_disable_irq,
 	ack:		rx164_disable_irq,
-	end:		rx164_enable_irq,
+	end:		rx164_end_irq,
 };
 
 static void 
@@ -109,12 +116,11 @@
 
 	rx164_update_irq_hw(0);
 	for (i = 16; i < 40; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &rx164_irq_type;
 	}
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 
 	setup_irq(16+20, &isa_cascade_irqaction);
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_sable.c linux/arch/alpha/kernel/sys_sable.c
--- v2.3.48/linux/arch/alpha/kernel/sys_sable.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_sable.c	Mon Feb 28 14:54:30 2000
@@ -30,6 +30,7 @@
 #include "pci_impl.h"
 #include "machvec_impl.h"
 
+spinlock_t sable_irq_lock = SPIN_LOCK_UNLOCKED;
 
 /*
  *   For SABLE, which is really baroque, we manage 40 IRQ's, but the
@@ -137,8 +138,10 @@
 	unsigned long bit, mask;
 
 	bit = sable_irq_swizzle.irq_to_mask[irq];
+	spin_lock(&sable_irq_lock);
 	mask = sable_irq_swizzle.shadow_mask &= ~(1UL << bit);
 	sable_update_irq_hw(bit, mask);
+	spin_unlock(&sable_irq_lock);
 }
 
 static void
@@ -147,8 +150,10 @@
 	unsigned long bit, mask;
 
 	bit = sable_irq_swizzle.irq_to_mask[irq];
+	spin_lock(&sable_irq_lock);
 	mask = sable_irq_swizzle.shadow_mask |= 1UL << bit;
 	sable_update_irq_hw(bit, mask);
+	spin_unlock(&sable_irq_lock);
 }
 
 static unsigned int
@@ -159,14 +164,23 @@
 }
 
 static void
+sable_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		sable_enable_irq(irq);
+}
+
+static void
 sable_mask_and_ack_irq(unsigned int irq)
 {
 	unsigned long bit, mask;
 
 	bit = sable_irq_swizzle.irq_to_mask[irq];
+	spin_lock(&sable_irq_lock);
 	mask = sable_irq_swizzle.shadow_mask |= 1UL << bit;
 	sable_update_irq_hw(bit, mask);
 	sable_ack_irq_hw(bit);
+	spin_unlock(&sable_irq_lock);
 }
 
 static struct hw_interrupt_type sable_irq_type = {
@@ -176,7 +190,7 @@
 	enable:		sable_enable_irq,
 	disable:	sable_disable_irq,
 	ack:		sable_mask_and_ack_irq,
-	end:		sable_enable_irq,
+	end:		sable_end_irq,
 };
 
 static void 
@@ -204,11 +218,10 @@
 	outb(0x44, 0x535);	/* enable cascades in master */
 
 	for (i = 0; i < 40; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &sable_irq_type;
 	}
 	
-	init_rtc_irq();
 	common_init_isa_dma();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_sio.c linux/arch/alpha/kernel/sys_sio.c
--- v2.3.48/linux/arch/alpha/kernel/sys_sio.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/sys_sio.c	Sun Feb 27 13:28:01 2000
@@ -42,7 +42,6 @@
 		alpha_mv.device_interrupt = srm_device_interrupt;
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 	common_init_isa_dma();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_sx164.c linux/arch/alpha/kernel/sys_sx164.c
--- v2.3.48/linux/arch/alpha/kernel/sys_sx164.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_sx164.c	Sun Feb 27 13:28:01 2000
@@ -43,7 +43,6 @@
 		alpha_mv.device_interrupt = srm_device_interrupt;
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	/* Not interested in the bogus interrupts (0,3,4,5,40-47),
 	   NMI (1), or HALT (2).  */
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/sys_takara.c linux/arch/alpha/kernel/sys_takara.c
--- v2.3.48/linux/arch/alpha/kernel/sys_takara.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/alpha/kernel/sys_takara.c	Mon Feb 28 14:54:30 2000
@@ -66,6 +66,13 @@
 	return 0; /* never anything pending */
 }
 
+static void
+takara_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		takara_enable_irq(irq);
+}
+
 static struct hw_interrupt_type takara_irq_type = {
 	typename:	"TAKARA",
 	startup:	takara_startup_irq,
@@ -73,7 +80,7 @@
 	enable:		takara_enable_irq,
 	disable:	takara_disable_irq,
 	ack:		takara_disable_irq,
-	end:		takara_enable_irq,
+	end:		takara_end_irq,
 };
 
 static void
@@ -126,7 +133,6 @@
 	long i;
 
 	init_i8259a_irqs();
-	init_rtc_irq();
 
 	if (alpha_using_srm) {
 		alpha_mv.device_interrupt = takara_srm_device_interrupt;
@@ -146,7 +152,7 @@
 		takara_update_irq_hw(i, -1);
 
 	for (i = 16; i < 128; ++i) {
-		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
 		irq_desc[i].handler = &takara_irq_type;
 	}
 
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/kernel/time.c linux/arch/alpha/kernel/time.c
--- v2.3.48/linux/arch/alpha/kernel/time.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/alpha/kernel/time.c	Sun Feb 27 13:28:01 2000
@@ -163,7 +163,7 @@
 }
 
 void
-common_init_rtc(struct irqaction *action)
+common_init_rtc()
 {
 	unsigned char x;
 
@@ -192,18 +192,12 @@
 	outb(0x31, 0x42);
 	outb(0x13, 0x42);
 
-	setup_irq(RTC_IRQ, action);
+	init_rtc_irq();
 }
 
 void
 time_init(void)
 {
-	static struct irqaction timer_irqaction = {
-		handler:	timer_interrupt,
-		flags:		SA_INTERRUPT,
-		name:		"timer",
-	};
-
 	unsigned int year, mon, day, hour, min, sec, cc1, cc2;
 	unsigned long cycle_freq, one_percent;
 	long diff;
@@ -292,7 +286,9 @@
 	state.partial_tick = 0L;
 
 	/* Startup the timer source. */
-	alpha_mv.init_rtc(&timer_irqaction);
+	alpha_mv.init_rtc();
+
+	do_get_fast_time = do_gettimeofday;
 }
 
 /*
diff -u --recursive --new-file v2.3.48/linux/arch/alpha/mm/fault.c linux/arch/alpha/mm/fault.c
--- v2.3.48/linux/arch/alpha/mm/fault.c	Tue Nov 23 22:42:20 1999
+++ linux/arch/alpha/mm/fault.c	Thu Mar  2 11:35:17 2000
@@ -38,9 +38,18 @@
 unsigned long last_asn = ASN_FIRST_VERSION;
 #endif
 
-void ev5_flush_tlb_current(struct mm_struct *mm)
+extern void
+__load_new_mm_context(struct mm_struct *next_mm)
 {
-	ev5_activate_mm(NULL, mm, smp_processor_id());
+	unsigned long mmc;
+
+	mmc = __get_new_mm_context(next_mm, smp_processor_id());
+	next_mm->context = mmc;
+	current->thread.asn = mmc & HARDWARE_ASN_MASK;
+        current->thread.ptbr
+	  = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
+
+	__reload_thread(&current->thread);
 }
 
 
diff -u --recursive --new-file v2.3.48/linux/arch/arm/boot/compressed/Makefile linux/arch/arm/boot/compressed/Makefile
--- v2.3.48/linux/arch/arm/boot/compressed/Makefile	Fri Jan 21 18:19:15 2000
+++ linux/arch/arm/boot/compressed/Makefile	Mon Feb 28 14:16:37 2000
@@ -46,13 +46,12 @@
 
 ifeq ($(CONFIG_ARCH_SA1100),y)
 OBJS		+= head-sa1100.o
-ifeq ($(CONFIG_SA1100_VICTOR),y)
-ZTEXTADDR	 = 0x00002000
-ZBSSADDR	 = 0xc0100000
-else
 ZTEXTADDR	 = 0xc0008000
-endif
 ZRELADDR	 = 0xc0008000
+ifeq ($(CONFIG_SA1100_VICTOR),y)
+  ZTEXTADDR	 = 0x00002000
+  ZBSSADDR	 = 0xc0100000
+endif
 endif
 
 #
diff -u --recursive --new-file v2.3.48/linux/arch/arm/boot/compressed/head-sa1100.S linux/arch/arm/boot/compressed/head-sa1100.S
--- v2.3.48/linux/arch/arm/boot/compressed/head-sa1100.S	Fri Jan 21 18:19:15 2000
+++ linux/arch/arm/boot/compressed/head-sa1100.S	Mon Feb 28 14:16:37 2000
@@ -11,6 +11,8 @@
 
 		.section        ".start", #alloc, #execinstr
 
+__SA1100_start:
+
 #ifndef CONFIG_ARCH_SA1100
 #error What am I doing here...
 #endif
@@ -57,6 +59,65 @@
 		bic	r0, r0, #0x0d		@ clear WB, DC, MMU
 		orr	r0, r0, #0x1000		@ set Icache
 		mcr	p15, 0, r0, c1, c0, 0
+
+#ifdef CONFIG_SA1100_BRUTUS
+		@ Initialize UART1 for early serial communication
+		@ since UART3 is used by angelboot.  It is routed to
+		@ alternate GPIO functions on Brutus.
+		b	1f
+
+GPIO_BASE:	.long	0x90040000
+#define GPDR	0x04
+#define GAFR	0x1c
+
+PPC_BASE:	.long	0x90060000
+#define PPAR	0x08
+
+UART1_BASE:	.long	0x80010000
+#define UTCR0           0x00
+#define UTCR1           0x04
+#define UTCR2           0x08
+#define UTCR3           0x0c
+#define UTSR0           0x1c
+#define UTSR1           0x20
+
+#define BAUD_DIV_230400	0x000
+#define BAUD_DIV_115200	0x001
+#define BAUD_DIV_57600	0x003
+#define BAUD_DIV_38400	0x005
+#define BAUD_DIV_19200	0x00b
+#define BAUD_DIV_9600	0x017
+#define BAUD_DIV	BAUD_DIV_9600
+
+1:		ldr	r0, GPIO_BASE
+		ldr	r1, [r0, #GPDR]
+		bic	r1, r1, #1<<15
+		orr	r1, r1, #1<<14
+		str	r1, [r0, #GPDR]
+		ldr	r1, [r0, #GAFR]
+		orr	r1, r1, #(1<<15)|(1<<14)
+		str	r1, [r0, #GAFR]
+		ldr	r0, PPC_BASE
+		ldr	r1, [r0, #PPAR]
+		orr	r1, r1, #1<<12
+		str	r1, [r0, #PPAR]
+		ldr	r0, UART1_BASE
+1:		ldr	r1, [r0, #UTSR1]
+		tst	r1, #1<<0	@ TBY
+		bne	1b
+		mov	r1, #0
+		str	r1, [r0, #UTCR3]
+		mov	r1, #0x08	@ 8N1
+		str	r1, [r0, #UTCR0]
+		mov	r1, #BAUD_DIV
+		str	r1, [r0, #UTCR2]
+		mov	r1, r1, lsr #8
+		str	r1, [r0, #UTCR1]
+		mov	r1, #0x03	@ RXE + TXE
+		str	r1, [r0, #UTCR3]
+		mov	r1, #0xff	@ flush status reg
+		str	r1, [r0, #UTSR0]
+#endif
 
 		@ set registers for entry
 		mov	r0, #0
diff -u --recursive --new-file v2.3.48/linux/arch/arm/config.in linux/arch/arm/config.in
--- v2.3.48/linux/arch/arm/config.in	Fri Jan 21 18:19:15 2000
+++ linux/arch/arm/config.in	Mon Feb 28 14:16:37 2000
@@ -92,6 +92,8 @@
    if [ "$CONFIG_ARCH_EBSA110" = "y" -o \
         "$CONFIG_ARCH_SA1100" = "y" -o \
         "$CONFIG_FOOTBRIDGE" = "y" -o \
+	"$CONFIG_ARCH_TBOX" = "y" -o \
+	"$CONFIG_ARCH_SHARK" = "y" -o \
         "$CONFIG_ARCH_NEXUSPCI" = "y" ]; then
       define_bool CONFIG_CPU_32v4 y
       if [ "$CONFIG_ARCH_SA1100" = "y" ]; then
@@ -122,6 +124,7 @@
 # These machines have ISA-DMA
 #
 if [ "$CONFIG_CATS" = "y" -o \
+     "$CONFIG_ARCH_SHARK" = "y" -o \
      "$CONFIG_ARCH_NETWINDER" = "y" ]; then
    define_bool CONFIG_ISA_DMA y
 else
@@ -186,6 +189,8 @@
 fi
 endmenu
 
+source drivers/ieee1394/Config.in
+
 source drivers/i2o/Config.in
 
 source drivers/pnp/Config.in
@@ -209,6 +214,8 @@
 
 source drivers/usb/Config.in
 
+source drivers/misc/Config.in
+
 if [ "$CONFIG_VT" = "y" ]; then
    mainmenu_option next_comment
    comment 'Console drivers'
@@ -256,7 +263,10 @@
 fi
 endmenu
 
-if [ "$CONFIG_ARCH_ACORN" = "y" -o "$CONFIG_PCI" = "y" ]; then
+if [ "$CONFIG_ARCH_ACORN" = "y" -o \
+     "$CONFIG_ARCH_CLPS7500" = "y" -o \
+     "$CONFIG_ARCH_SHARK" = "y" -o \
+     "$CONFIG_PCI" = "y" ]; then
    mainmenu_option next_comment
    comment 'Sound'
 
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/arthur.c linux/arch/arm/kernel/arthur.c
--- v2.3.48/linux/arch/arm/kernel/arthur.c	Thu Jun 17 01:11:35 1999
+++ linux/arch/arm/kernel/arthur.c	Mon Feb 28 14:16:37 2000
@@ -1,6 +1,6 @@
 /*
  * Arthur personality
- * Copyright (C) 1998 Philip Blundell
+ * Copyright (C) 1998-1999 Philip Blundell
  */
 
 #include <linux/personality.h>
@@ -8,35 +8,36 @@
 #include <linux/stddef.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
+#include <linux/init.h>
 
 #include <asm/ptrace.h>
 
-/* RISC OS doesn't have many signals, and a lot of those that it does
+/* Arthur doesn't have many signals, and a lot of those that it does
    have don't map easily to any Linux equivalent.  Never mind.  */
 
-#define RISCOS_SIGABRT		1
-#define RISCOS_SIGFPE		2
-#define RISCOS_SIGILL		3
-#define RISCOS_SIGINT		4
-#define RISCOS_SIGSEGV		5
-#define RISCOS_SIGTERM		6
-#define RISCOS_SIGSTAK		7
-#define RISCOS_SIGUSR1		8
-#define RISCOS_SIGUSR2		9
-#define RISCOS_SIGOSERROR	10
+#define ARTHUR_SIGABRT		1
+#define ARTHUR_SIGFPE		2
+#define ARTHUR_SIGILL		3
+#define ARTHUR_SIGINT		4
+#define ARTHUR_SIGSEGV		5
+#define ARTHUR_SIGTERM		6
+#define ARTHUR_SIGSTAK		7
+#define ARTHUR_SIGUSR1		8
+#define ARTHUR_SIGUSR2		9
+#define ARTHUR_SIGOSERROR	10
 
-static unsigned long riscos_to_linux_signals[32] = {
+static unsigned long arthur_to_linux_signals[32] = {
 	0,	1,	2,	3,	4,	5,	6,	7,
 	8,	9,	10,	11,	12,	13,	14,	15,
 	16,	17,	18,	19,	20,	21,	22,	23,
 	24,	25,	26,	27,	28,	29,	30,	31
 };
 
-static unsigned long linux_to_riscos_signals[32] = {
-	0,		-1,		RISCOS_SIGINT,	-1,
-       	RISCOS_SIGILL,	5,		RISCOS_SIGABRT,	7,
-	RISCOS_SIGFPE,	9,		RISCOS_SIGUSR1,	RISCOS_SIGSEGV,	
-	RISCOS_SIGUSR2,	13,		14,		RISCOS_SIGTERM,
+static unsigned long linux_to_arthur_signals[32] = {
+	0,		-1,		ARTHUR_SIGINT,	-1,
+       	ARTHUR_SIGILL,	5,		ARTHUR_SIGABRT,	7,
+	ARTHUR_SIGFPE,	9,		ARTHUR_SIGUSR1,	ARTHUR_SIGSEGV,	
+	ARTHUR_SIGUSR2,	13,		14,		ARTHUR_SIGTERM,
 	16,		17,		18,		19,
 	20,		21,		22,		23,
 	24,		25,		26,		27,
@@ -52,12 +53,12 @@
 	send_sig_info(SIGSWI, &info, current);
 }
 
-static struct exec_domain riscos_exec_domain = {
+static struct exec_domain arthur_exec_domain = {
 	"Arthur",	/* name */
 	(lcall7_func)arthur_lcall7,
 	PER_RISCOS, PER_RISCOS,
-	riscos_to_linux_signals,
-	linux_to_riscos_signals,
+	arthur_to_linux_signals,
+	linux_to_arthur_signals,
 #ifdef MODULE
 	&__this_module,	/* No usage counter. */
 #else
@@ -71,18 +72,15 @@
  * processes are using it.
  */
 
-#ifdef MODULE
-int init_module(void)
-#else
-int initialise_arthur(void)
-#endif
+int __init arthur_init(void)
 {
-	return register_exec_domain(&riscos_exec_domain);
+	return register_exec_domain(&arthur_exec_domain);
 }
 
-#ifdef MODULE
-void cleanup_module(void)
+void __exit arthur_exit(void)
 {
-	unregister_exec_domain(&riscos_exec_domain);
+	unregister_exec_domain(&arthur_exec_domain);
 }
-#endif
+
+module_init(arthur_init);
+module_exit(arthur_exit);
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/entry-armo.S linux/arch/arm/kernel/entry-armo.S
--- v2.3.48/linux/arch/arm/kernel/entry-armo.S	Fri Jan 21 18:19:15 2000
+++ linux/arch/arm/kernel/entry-armo.S	Mon Feb 28 14:16:37 2000
@@ -22,6 +22,7 @@
  * adhering to the above criteria.
  */
 #include <linux/linkage.h>
+#include <linux/config.h>
 
 #include <asm/assembler.h>
 #include <asm/errno.h>
@@ -29,6 +30,12 @@
 
 #include "../lib/constants.h"
 
+		.macro	zero_fp
+#ifdef CONFIG_FRAME_POINTER
+		mov	fp, #0
+#endif
+		.endm
+
 		.text
 
 @ Offsets into task structure
@@ -213,7 +220,7 @@
 		stmfd	sp!, {r0 - r12}		;\
 		mov	r0, #-1			;\
 		str	r0, [sp, #S_OLD_R0]	;\
-		mov	fp, #0
+		zero_fp
 
 #define SVC_IRQ_SAVE_ALL			\
 		str	sp, [sp, #-16]!		;\
@@ -224,7 +231,7 @@
 		stmfd	sp!, {r0 - r12}		;\
 		mov	r0, #-1			;\
 		str	r0, [sp, #S_OLD_R0]	;\
-		mov	fp, #0
+		zero_fp
 
 #define SVC_RESTORE_ALL				\
 		ldmfd	sp, {r0 - pc}^
@@ -261,7 +268,7 @@
 		tst	lr,#3
 		bne	__und_svc
 		save_user_regs
-		mov	fp, #0
+		zero_fp
 		teqp	pc, #I_BIT | MODE_SVC
 .Lbug_undef:
 		ldr	r4, .LC2
@@ -283,6 +290,10 @@
 		bl	SYMBOL_NAME(do_undefinstr)
 		SVC_RESTORE_ALL
 
+#ifdef CONFIG_NWFPE
+		/* The FPE is always present */
+		.equ	fpe_not_present, 0
+#else
 /* We get here if an undefined instruction happens and the floating
  * point emulator is not present.  If the offending instruction was
  * a WFS, we just perform a normal return as if we had emulated the
@@ -319,6 +330,7 @@
 		.word	0x0d0d0100			@ LDF [sp]/STF [sp]
 		.word	0x0d0b0100			@ LDF [fp]/STF [fp]
 		.word	0x0f0f0f00
+#endif
 
 .LC2:		.word	SYMBOL_NAME(fp_enter)
 
@@ -686,7 +698,7 @@
 /*
  * initialise the trap system
  */
-ENTRY(trap_init)
+ENTRY(__trap_init)
 		stmfd	sp!, {r4 - r7, lr}
 		adr	r1, .Ljump_addresses
 		ldmia	r1, {r1 - r7, ip, lr}
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/entry-armv.S linux/arch/arm/kernel/entry-armv.S
--- v2.3.48/linux/arch/arm/kernel/entry-armv.S	Fri Jan 21 18:19:15 2000
+++ linux/arch/arm/kernel/entry-armv.S	Mon Feb 28 14:16:37 2000
@@ -24,6 +24,12 @@
 #define MODE_SVC 0x13
 #endif
 
+		.macro	zero_fp
+#ifdef CONFIG_FRAME_POINTER
+		mov	fp, #0
+#endif
+		.endm
+
 		.text
 
 #define PF_TRACESYS	0x20
@@ -421,7 +427,7 @@
 		ldr	r4, .LCund
 		mov	r1, #BAD_UNDEFINSTR		@ int reason
 
-1:		mov	fp, #0
+1:		zero_fp
 		ldmia	r4, {r5 - r7}			@ Get XXX pc, cpsr, old_r0
 		add	r4, sp, #S_PC
 		stmia	r4, {r5 - r7}			@ Save XXX pc, cpsr, old_r0
@@ -573,7 +579,7 @@
 		stmia	r3, {r0 - r2}			@ Save USR pc, cpsr, old_r0
 		stmdb	r3, {sp, lr}^
 		alignment_trap r4, r7, __temp_abt
-		mov	fp, #0
+		zero_fp
 #ifdef MULTI_CPU
 		ldr	r2, .LCprocfns
 		mov	lr, pc
@@ -595,7 +601,7 @@
 		stmia	r8, {r5 - r7}			@ save pc, psr, old_r0
 		stmdb	r8, {sp, lr}^
 		alignment_trap r4, r7, __temp_irq
-		mov	fp, #0
+		zero_fp
 1:		get_irqnr_and_base r0, r6, r5
 		movne	r1, sp
 		adrsvc	ne, lr, 1b
@@ -615,7 +621,7 @@
 		stmia	r8, {r5 - r7}			@ Save USR pc, cpsr, old_r0
 		stmdb	r8, {sp, lr}^			@ Save user r0 - r12
 		alignment_trap r4, r7, __temp_und
-		mov	fp, #0
+		zero_fp
 		adrsvc	al, r9, ret_from_sys_call	@ r9  = normal FP return
 		adrsvc	al, lr, fpundefinstr		@ lr  = undefined instr return
 
@@ -641,7 +647,7 @@
 		stmia	r8, {r5 - r7}			@ Save USR pc, cpsr, old_r0
 		stmdb	r8, {sp, lr}^			@ Save sp_usr lr_usr
 		alignment_trap r4, r7, __temp_abt
-		mov	fp, #0
+		zero_fp
 		msr	cpsr_c, #MODE_SVC		@ Enable interrupts
 		mov	r0, r5				@ address (pc)
 		mov	r1, sp				@ regs
@@ -688,11 +694,11 @@
 ENTRY(__switch_to)
 		stmfd	sp!, {r4 - sl, fp, lr}		@ Store most regs on stack
 		mrs	ip, cpsr
-		stmfd	sp!, {ip}			@ Save cpsr_SVC
+		str	ip, [sp, #-4]!			@ Save cpsr_SVC
 		str	sp, [r0, #TSS_SAVE]		@ Save sp_SVC
 		ldr	sp, [r1, #TSS_SAVE]		@ Get saved sp_SVC
 		ldr	r2, [r1, #TSS_DOMAIN]
-		ldmfd	sp!, {ip}
+		ldr	ip, [sp], #4
 		mcr	p15, 0, r2, c3, c0		@ Set domain register
 		msr	spsr, ip			@ Save tasks CPSR into SPSR for this return
 		ldmfd	sp!, {r4 - sl, fp, pc}^		@ Load all regs saved previously
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/entry-common.S linux/arch/arm/kernel/entry-common.S
--- v2.3.48/linux/arch/arm/kernel/entry-common.S	Sun Feb 13 19:29:03 2000
+++ linux/arch/arm/kernel/entry-common.S	Mon Feb 28 14:16:37 2000
@@ -4,16 +4,6 @@
  */
 
 #define S_OFF		8
-#define SYSCALL_REGS	r4, r5
-
-/*
- * Define to favour ARM8, ARM9 and StrongARM cpus.  This says that it is
- * cheaper to use two LDR instructions than a two-register LDM, if the
- * latter would entail calculating an address specially.
- */
-#if defined(CONFIG_CPU_SA110)
-#define HARVARD_CACHE
-#endif
 
 		.macro	get_softirq, rd
 #ifdef __SMP__
@@ -85,7 +75,7 @@
 		.align	5
 vector_swi:	save_user_regs
 		mask_pc	lr, lr
-		mov	fp, #0
+		zero_fp
 		ldr	scno, [lr, #-4]		@ get SWI instruction
 		arm700_bug_check scno, ip
 #ifdef CONFIG_ALIGNMENT_TRAP
@@ -95,9 +85,7 @@
 #endif
 		enable_irqs ip
 
-		stmdb	sp!, {SYSCALL_REGS}	@ new style: (r0 = arg1, r4 = arg5, r5 = arg6)
-						@ Note that we dont have to handle
-						@ sys_syscalls arg7 here
+		str	r4, [sp, #-S_OFF]!	@ push fifth arg
 		adrsvc	al, lr, fast_syscall_return
 
 		bic	scno, scno, #0xff000000	@ mask off SWI op-code
@@ -141,10 +129,11 @@
 		b	SYMBOL_NAME(deferred)
 
 		.align	5
-
+		.type	__softirq_state, #object
 __softirq_state:
 		.word	SYMBOL_NAME(softirq_state)
 
+		.type	sys_call_table, #object
 ENTRY(sys_call_table)
 #include "calls.S"
 
@@ -153,15 +142,18 @@
  */
 @ r0 = syscall number
 @ r5 = syscall table
+		.type	sys_syscall, #function
 SYMBOL_NAME(sys_syscall):
 		eor	scno, r0, #OS_NUMBER << 20
 		cmp	scno, #NR_syscalls	@ check range
 		add	ip, sp, #S_OFF
-		ldmleib	ip, {r0 - r3, SYSCALL_REGS}	@ get our args
-		stmleia	sp, {SYSCALL_REGS}	@ Put our arg on the stack
+		stmleia	sp, {r5, r6}		@ shuffle args
+		movle	r0, r1
+		movle	r1, r2
+		movle	r2, r3
+		movle	r3, r4
 		ldrle	pc, [tbl, scno, lsl #2]
-		mov	r0, #-ENOSYS
-		RETINSTR(mov,pc,lr)
+		b	sys_ni_syscall
 
 sys_fork_wrapper:
 		add	r0, sp, #S_OFF
@@ -198,6 +190,23 @@
 sys_sigaltstack_wrapper:
 		ldr	r2, [sp, #S_OFF + S_SP]
 		b	do_sigaltstack
+
+/*
+ * Note: off_4k (r5) is always units of 4K.  If we can't do the requested
+ * offset, we return EINVAL.
+ */
+sys_mmap2:
+#if PAGE_SHIFT > 12
+		tst	r5, #PGOFF_MASK
+		moveq	r5, r5, lsr #PGOFF_SHIFT
+		streq	r5, [sp, #4]
+		beq	do_mmap2
+		mov	r0, #-EINVAL
+		RETINSTR(mov,pc, lr)
+#else
+		str	r5, [sp, #4]
+		b	do_mmap2
+#endif
 
 		.data
 
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/hw-footbridge.c linux/arch/arm/kernel/hw-footbridge.c
--- v2.3.48/linux/arch/arm/kernel/hw-footbridge.c	Tue Dec 14 01:27:23 1999
+++ linux/arch/arm/kernel/hw-footbridge.c	Sun Feb 27 08:51:11 2000
@@ -68,13 +68,13 @@
 /*
  * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
  */
-spinlock_t __netwinder_data gpio_lock = SPIN_LOCK_UNLOCKED;
+spinlock_t gpio_lock = SPIN_LOCK_UNLOCKED;
 
-static unsigned int __netwinder_data current_gpio_op = 0;
-static unsigned int __netwinder_data current_gpio_io = 0;
-static unsigned int __netwinder_data current_cpld = 0;
+static unsigned int current_gpio_op = 0;
+static unsigned int current_gpio_io = 0;
+static unsigned int current_cpld = 0;
 
-void __netwinder_text gpio_modify_op(int mask, int set)
+void gpio_modify_op(int mask, int set)
 {
 	unsigned int new_gpio, changed;
 
@@ -119,7 +119,7 @@
 	}
 }
 
-void __netwinder_text gpio_modify_io(int mask, int in)
+void gpio_modify_io(int mask, int in)
 {
 	/* Open up the SuperIO chip */
 	wb977_open();
@@ -130,7 +130,7 @@
 	wb977_close();
 }
 
-int __netwinder_text gpio_read(void)
+int gpio_read(void)
 {
 	return inb(GP1_IO_BASE) | inb(GP2_IO_BASE) << 8;
 }
@@ -360,7 +360,7 @@
 	wb977_close();
 }
 
-void __netwinder_text cpld_modify(int mask, int set)
+void cpld_modify(int mask, int set)
 {
 	int msk;
 
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/irq.c linux/arch/arm/kernel/irq.c
--- v2.3.48/linux/arch/arm/kernel/irq.c	Sun Feb 13 19:29:03 2000
+++ linux/arch/arm/kernel/irq.c	Sun Feb 27 08:51:11 2000
@@ -471,6 +471,10 @@
 	return irq_found;
 }
 
+void __init init_irq_proc(void)
+{
+}
+
 void __init init_IRQ(void)
 {
 	extern void init_dma(void);
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/leds-footbridge.c linux/arch/arm/kernel/leds-footbridge.c
--- v2.3.48/linux/arch/arm/kernel/leds-footbridge.c	Fri Oct 22 13:21:44 1999
+++ linux/arch/arm/kernel/leds-footbridge.c	Sun Feb 27 08:51:11 2000
@@ -37,7 +37,7 @@
 
 #ifdef CONFIG_FOOTBRIDGE
 
-static void __ebsa285_text ebsa285_leds_event(led_event_t evt)
+static void ebsa285_leds_event(led_event_t evt)
 {
 	unsigned long flags;
 
@@ -129,7 +129,7 @@
 
 #ifdef CONFIG_ARCH_NETWINDER
 
-static void __netwinder_text netwinder_leds_event(led_event_t evt)
+static void netwinder_leds_event(led_event_t evt)
 {
 	unsigned long flags;
 
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/setup.c linux/arch/arm/kernel/setup.c
--- v2.3.48/linux/arch/arm/kernel/setup.c	Fri Jan 21 18:19:15 2000
+++ linux/arch/arm/kernel/setup.c	Sun Feb 27 08:51:11 2000
@@ -767,6 +767,8 @@
 	setup_bootmem();
 	request_standard_resources(mdesc);
 
+	paging_init();
+
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
 	conswitchp = &vga_con;
diff -u --recursive --new-file v2.3.48/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c
--- v2.3.48/linux/arch/arm/kernel/sys_arm.c	Fri Jan 28 15:09:06 2000
+++ linux/arch/arm/kernel/sys_arm.c	Mon Feb 28 14:16:37 2000
@@ -50,7 +50,7 @@
 }
 
 /* common code for old and new mmaps */
-static inline long do_mmap2(
+inline long do_mmap2(
 	unsigned long addr, unsigned long len,
 	unsigned long prot, unsigned long flags,
 	unsigned long fd, unsigned long pgoff)
@@ -77,27 +77,6 @@
 		fput(file);
 out:
 	return error;
-}
-
-#define PGOFF_SHIFT (PAGE_SHIFT - 12)
-#define PGOFF_MASK  (~((1 << PGOFF_SHIFT) - 1))
-
-/*
- * Note: off_4k is always units of 4K.  If we can't do the requested
- * offset, we return EINVAL.
- */
-asmlinkage long
-sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
-	  unsigned long flags, unsigned long fd, unsigned long off_4k)
-{
-	unsigned long pgoff;
-
-	if (off_4k & ~PGOFF_MASK)
-		return -EINVAL;
-
-	pgoff = off_4k >> PGOFF_SHIFT;
-
-	return do_mmap2(addr, len, prot, flags, fd, pgoff);
 }
 
 struct mmap_arg_struct {
diff -u --recursive --new-file v2.3.48/linux/arch/arm/lib/findbit.S linux/arch/arm/lib/findbit.S
--- v2.3.48/linux/arch/arm/lib/findbit.S	Fri Jan 21 18:19:16 2000
+++ linux/arch/arm/lib/findbit.S	Mon Feb 28 14:16:37 2000
@@ -53,10 +53,10 @@
 		beq	Lfindzbit1lp		@ If new byte, goto old routine
 		ldrb	r3, [r0, r2, lsr#3]
 		orr	r3, r3, #0xFF00		@ Set top bits so we wont get confused
-		stmfd	sp!, {r4}
+		str	r4, [sp, #-4]!
 		and	r4, r2, #7
 		mov	r3, r3, lsr r4		@ Shift right by no. of bits
-		ldmfd	sp!, {r4}
+		ldr	r4, [sp], #4
 		and	r3, r3, #0xFF
 		teq	r3, #0xFF
 		orreq	r2, r2, #7
diff -u --recursive --new-file v2.3.48/linux/arch/arm/lib/getconsdata.c linux/arch/arm/lib/getconsdata.c
--- v2.3.48/linux/arch/arm/lib/getconsdata.c	Fri Jan 21 18:19:16 2000
+++ linux/arch/arm/lib/getconsdata.c	Mon Feb 28 14:16:37 2000
@@ -91,3 +91,5 @@
 unsigned long KSWI_BASE = 0x900000;
 unsigned long KSWI_SYS_BASE = 0x9f0000;
 unsigned long SYS_ERROR0 = 0x9f0000;
+unsigned long PGOFF_SHIFT = PAGE_SHIFT - 12;
+unsigned long PGOFF_MASK = (1 << (PAGE_SHIFT - 12)) - 1;
diff -u --recursive --new-file v2.3.48/linux/arch/arm/lib/strrchr.S linux/arch/arm/lib/strrchr.S
--- v2.3.48/linux/arch/arm/lib/strrchr.S	Fri Jan 21 18:19:16 2000
+++ linux/arch/arm/lib/strrchr.S	Mon Feb 28 14:16:37 2000
@@ -12,7 +12,7 @@
 
 		.text
 ENTRY(strrchr)
-		stmfd	sp!, {lr}
+		str	lr, [sp, #-4]!
 		mov	r3, #0
 1:		ldrb	r2, [r0], #1
 		teq	r2, r1
diff -u --recursive --new-file v2.3.48/linux/arch/arm/mm/consistent.c linux/arch/arm/mm/consistent.c
--- v2.3.48/linux/arch/arm/mm/consistent.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/arm/mm/consistent.c	Mon Feb 28 14:16:37 2000
@@ -1,13 +1,14 @@
 /*
  * Dynamic DMA mapping support.
  */
-
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/vmalloc.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
+#include <linux/pci.h>
 
 #include <asm/io.h>
 #include <asm/pgalloc.h>
@@ -47,6 +48,22 @@
 no_page:
 	BUG();
 	return NULL;
+}
+
+void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *handle)
+{
+	void *__ret;
+	int __gfp = GFP_KERNEL;
+
+#ifdef CONFIG_PCI
+	if ((hwdev) == NULL ||
+	    (hwdev)->dma_mask != 0xffffffff)
+#endif
+		__gfp |= GFP_DMA;
+
+	__ret = consistent_alloc(__gfp, (size),
+				 (handle));
+	return __ret;
 }
 
 /*
diff -u --recursive --new-file v2.3.48/linux/arch/arm/mm/fault-armv.c linux/arch/arm/mm/fault-armv.c
--- v2.3.48/linux/arch/arm/mm/fault-armv.c	Fri Jan 21 18:19:16 2000
+++ linux/arch/arm/mm/fault-armv.c	Mon Feb 28 14:16:37 2000
@@ -351,7 +351,7 @@
 
 #endif
 
-static struct fsr_info {
+static const struct fsr_info {
 	int	(*fn)(unsigned long addr, int error_code, struct pt_regs *regs);
 	int	sig;
 	char	*name;
@@ -384,7 +384,7 @@
 asmlinkage void
 do_DataAbort(unsigned long addr, int fsr, int error_code, struct pt_regs *regs)
 {
-	struct fsr_info *inf;
+	const struct fsr_info *inf;
 
 	if (user_mode(regs) && addr == regs->ARM_pc) {
 		static int first = 1;
diff -u --recursive --new-file v2.3.48/linux/arch/arm/mm/fault-common.c linux/arch/arm/mm/fault-common.c
--- v2.3.48/linux/arch/arm/mm/fault-common.c	Fri Jan 21 18:19:16 2000
+++ linux/arch/arm/mm/fault-common.c	Mon Feb 28 14:16:37 2000
@@ -6,7 +6,7 @@
  */
 #include <linux/config.h>
 
-extern void die(const char *msg, struct pt_regs *regs, unsigned int err);
+extern void die(const char *msg, struct pt_regs *regs, int err);
 
 /*
  * This is useful to dump out the page tables associated with
diff -u --recursive --new-file v2.3.48/linux/arch/arm/mm/mm-armv.c linux/arch/arm/mm/mm-armv.c
--- v2.3.48/linux/arch/arm/mm/mm-armv.c	Thu Feb 10 17:11:03 2000
+++ linux/arch/arm/mm/mm-armv.c	Sun Feb 27 08:51:11 2000
@@ -60,6 +60,8 @@
 __setup("nocache", nocache_setup);
 __setup("nowb", nowrite_setup);
 
+#define FIRST_KERNEL_PGD_NR	(FIRST_USER_PGD_NR + USER_PTRS_PER_PGD)
+
 /*
  * need to get a 16k page for level 1
  */
@@ -71,9 +73,9 @@
 	if (pgd) {
 		pgd_t *init = pgd_offset_k(0);
 		
-		memzero(pgd, USER_PTRS_PER_PGD * sizeof(pgd_t));
-		memcpy(pgd + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
-			(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+		memzero(pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t));
+		memcpy(pgd  + FIRST_KERNEL_PGD_NR, init + FIRST_KERNEL_PGD_NR,
+		       (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
 		clean_cache_area(pgd, PTRS_PER_PGD * sizeof(pgd_t));
 
 		/*
diff -u --recursive --new-file v2.3.48/linux/arch/arm/mm/mm-clps7500.c linux/arch/arm/mm/mm-clps7500.c
--- v2.3.48/linux/arch/arm/mm/mm-clps7500.c	Wed Dec 31 16:00:00 1969
+++ linux/arch/arm/mm/mm-clps7500.c	Mon Feb 28 14:16:37 2000
@@ -0,0 +1,28 @@
+/*
+ * arch/arm/mm/mm-cl7500.c
+ *
+ * Extra MM routines for CL7500 architecture
+ *
+ * Copyright (C) 1998 Russell King
+ * Copyright (C) 1999 Nexus Electronics Ltd
+ */
+
+#include <linux/init.h>
+
+#include <asm/hardware.h>
+#include <asm/page.h>
+#include <asm/proc/domain.h>
+#include <asm/setup.h>
+
+#include "map.h"
+
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
+
+struct map_desc io_desc[] __initdata = {
+	{ IO_BASE,	IO_START,	IO_SIZE	 , DOMAIN_IO, 0, 1 },	/* IO space	*/
+	{ ISA_BASE,	ISA_START,	ISA_SIZE , DOMAIN_IO, 0, 1 },	/* ISA space	*/
+	{ FLASH_BASE,	FLASH_START,	FLASH_SIZE, DOMAIN_IO, 0, 1 },	/* Flash	*/
+	{ LED_BASE,	LED_START,	LED_SIZE , DOMAIN_IO, 0, 1 }	/* LED		*/
+};
+
+unsigned int __initdata io_desc_size = SIZE(io_desc);
diff -u --recursive --new-file v2.3.48/linux/arch/arm/mm/mm-nexuspci.c linux/arch/arm/mm/mm-nexuspci.c
--- v2.3.48/linux/arch/arm/mm/mm-nexuspci.c	Mon Nov  1 13:56:26 1999
+++ linux/arch/arm/mm/mm-nexuspci.c	Mon Feb 28 14:16:37 2000
@@ -2,9 +2,9 @@
  * arch/arm/mm/mm-nexuspci.c
  *  from arch/arm/mm/mm-ebsa110.c
  *
- * Extra MM routines for the NexusPCI architecture
+ * Extra MM routines for the FTV/PCI architecture
  *
- * Copyright (C) 1998 Phil Blundell
+ * Copyright (C) 1998-1999 Phil Blundell
  * Copyright (C) 1998-1999 Russell King
  */
 
@@ -18,14 +18,14 @@
 
 #include "map.h"
  
-#define SIZE(x) (sizeof(x) / sizeof(x[0]))
-
-const struct map_desc io_desc[] __initdata = {
- 	{ 0xfff00000, 0x10000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
- 	{ 0xffe00000, 0x20000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
- 	{ 0xffc00000, 0x60000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
- 	{ 0xfe000000, 0x80000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 },
- 	{ 0xfd000000, 0x88000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }
+struct map_desc io_desc[] __initdata = {
+ 	{ INTCONT_BASE,	INTCONT_START,	0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
+ 	{ PLX_BASE,	PLX_START,	0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
+ 	{ PCIO_BASE,	PLX_IO_START,	0x00100000, DOMAIN_IO, 0, 1, 0, 0 },
+ 	{ DUART_BASE,	DUART_START,	0x00001000, DOMAIN_IO, 0, 1, 0, 0 },
+	{ STATUS_BASE,	STATUS_START,	0x00001000, DOMAIN_IO, 0, 1, 0, 0 }
 };
+
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 unsigned int __initdata io_desc_size = SIZE(io_desc);
diff -u --recursive --new-file v2.3.48/linux/arch/arm/vmlinux-armo.lds.in linux/arch/arm/vmlinux-armo.lds.in
--- v2.3.48/linux/arch/arm/vmlinux-armo.lds.in	Mon Nov  1 13:56:26 1999
+++ linux/arch/arm/vmlinux-armo.lds.in	Mon Feb 28 14:16:37 2000
@@ -28,6 +28,11 @@
 	*(.init.task)
   }
 
+  /DISCARD/ : {			/* Exit code and data		*/
+	*(.text.exit)
+	*(.data.exit)
+  }
+
   _text = .;			/* Text and read-only data	*/
   .text : {
 	*(.text)
diff -u --recursive --new-file v2.3.48/linux/arch/arm/vmlinux-armv.lds.in linux/arch/arm/vmlinux-armv.lds.in
--- v2.3.48/linux/arch/arm/vmlinux-armv.lds.in	Fri Jan 21 18:19:16 2000
+++ linux/arch/arm/vmlinux-armv.lds.in	Sun Feb 27 08:51:11 2000
@@ -25,22 +25,6 @@
 		__init_end = .;
 	}
 
-	.ebsa285 : {
-		__ebsa285_begin = .;
-			*(.text.ebsa285)
-			*(.data.ebsa285)
-		. = ALIGN(4096);
-		__ebsa285_end = .;
-	}
-
-	.netwinder : {
-		__netwinder_begin = .;
-	  		*(.text.netwinder)
-			*(.data.netwinder)
-		. = ALIGN(4096);
-		__netwinder_end = .;
-	}
-
 	.text : {			/* Real text segment		*/
 		_text = .;		/* Text and read-only data	*/
 			*(.text)
@@ -65,11 +49,26 @@
 
 	. = ALIGN(8192);
 
-	.data : {			/* Data				*/
+	.data : {
+		/*
+		 * first, the init task union, aligned
+		 * to an 8192 byte boundary.
+		 */
 		*(.init.task)
+
+		/*
+		 * then the cacheline aligned data
+		 */
+		. = ALIGN(32);
+		*(.data.cacheline_aligned)
+
+		/*
+		 * and the usual data section
+		 */
 		*(.data)
 		CONSTRUCTORS
-		_edata = .;		/* End of data section		*/
+
+		_edata = .;
 	}
 
 	.bss : {
diff -u --recursive --new-file v2.3.48/linux/arch/i386/config.in linux/arch/i386/config.in
--- v2.3.48/linux/arch/i386/config.in	Sun Feb 20 21:12:38 2000
+++ linux/arch/i386/config.in	Thu Mar  2 10:10:24 2000
@@ -49,8 +49,8 @@
    define_bool CONFIG_X86_USE_3DNOW y
 fi
 
-if [ "$CONFIG_PROC_FS" = "y" ]; then
-   tristate '/proc/driver/microcode - Intel P6 CPU microcode support' CONFIG_MICROCODE
+if [ "$CONFIG_DEVFS_FS" = "y" ]; then
+   tristate '/dev/cpu/microcode - Intel P6 CPU microcode support' CONFIG_MICROCODE
 fi
 
 choice 'High Memory Support' \
@@ -139,30 +139,31 @@
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 
-source drivers/parport/Config.in
+bool 'Power Management support' CONFIG_PM
 
-bool 'ACPI support' CONFIG_ACPI
+dep_bool '  ACPI support' CONFIG_ACPI $CONFIG_PM
 if [ "$CONFIG_ACPI" != "n" ]; then
    if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-      bool '  Enter S1 for sleep (EXPERIMENTAL)' CONFIG_ACPI_S1_SLEEP
+      bool '    Enter S1 for sleep (EXPERIMENTAL)' CONFIG_ACPI_S1_SLEEP
    fi
 fi
 
-tristate 'Advanced Power Management BIOS support' CONFIG_APM
+dep_tristate '  Advanced Power Management BIOS support' CONFIG_APM $CONFIG_PM
 if [ "$CONFIG_APM" != "n" ]; then
-   bool '  Ignore USER SUSPEND' CONFIG_APM_IGNORE_USER_SUSPEND
-   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 '  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
-   bool '  Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS
-   bool '  Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF
+   bool '    Ignore USER SUSPEND' CONFIG_APM_IGNORE_USER_SUSPEND
+   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 '    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
+   bool '    Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS
+   bool '    Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF
 fi
 
 endmenu
 
+source drivers/parport/Config.in
 
 source drivers/pnp/Config.in
 
diff -u --recursive --new-file v2.3.48/linux/arch/i386/defconfig linux/arch/i386/defconfig
--- v2.3.48/linux/arch/i386/defconfig	Sat Feb 26 22:31:38 2000
+++ linux/arch/i386/defconfig	Thu Mar  2 13:29:23 2000
@@ -27,7 +27,6 @@
 CONFIG_X86_TSC=y
 CONFIG_X86_GOOD_APIC=y
 CONFIG_X86_PGE=y
-# CONFIG_MICROCODE is not set
 CONFIG_NOHIGHMEM=y
 # CONFIG_HIGHMEM4G is not set
 # CONFIG_HIGHMEM64G is not set
@@ -74,9 +73,10 @@
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
-# CONFIG_PARPORT is not set
+CONFIG_PM=y
 CONFIG_ACPI=y
 # CONFIG_APM is not set
+# CONFIG_PARPORT is not set
 
 #
 # Plug and Play configuration
@@ -96,6 +96,7 @@
 # CONFIG_BLK_DEV_HD_IDE is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
+# CONFIG_BLK_DEV_IDECS is not set
 CONFIG_BLK_DEV_IDECD=y
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
@@ -264,6 +265,7 @@
 #
 # CONFIG_ARCNET is not set
 CONFIG_DUMMY=m
+# CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_NET_SB1000 is not set
 
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile
--- v2.3.48/linux/arch/i386/kernel/Makefile	Wed Feb 16 17:03:51 2000
+++ linux/arch/i386/kernel/Makefile	Thu Mar  2 10:10:24 2000
@@ -40,14 +40,12 @@
   endif
 endif
 
-ifeq ($(CONFIG_PROC_FS),y)
 ifeq ($(CONFIG_MICROCODE),y)
 OX_OBJS += microcode.o
 else
   ifeq ($(CONFIG_MICROCODE),m)
   MX_OBJS += microcode.o
   endif
-endif
 endif
 
 ifeq ($(CONFIG_ACPI),y)
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/acpi.c linux/arch/i386/kernel/acpi.c
--- v2.3.48/linux/arch/i386/kernel/acpi.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/i386/kernel/acpi.c	Mon Feb 28 12:10:06 2000
@@ -977,11 +977,9 @@
 		typa = ((typa << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK);
 		typb = ((typb << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK);
 
-		if (state != ACPI_S0) {
-			acpi_sleep_start = get_cmos_time();
-			acpi_enter_dx(ACPI_D3);
-			acpi_sleep_state = state;
-		}
+		acpi_sleep_start = get_cmos_time();
+		acpi_enter_dx(ACPI_D3);
+		acpi_sleep_state = state;
 
 		// clear wake status
 		acpi_write_pm1_status(acpi_facp, ACPI_WAK);
@@ -996,17 +994,11 @@
 			outw(value | typb | ACPI_SLP_EN, acpi_facp->pm1b_cnt);
 		}
 
-		if (state == ACPI_S0) {
-			acpi_sleep_state = state;
-			acpi_enter_dx(ACPI_D0);
-			acpi_sleep_start = 0;
-		}
-		else if (state == ACPI_S1) {
-			// wait until S1 is entered
-			while (!(acpi_read_pm1_status(acpi_facp) & ACPI_WAK)) ;
-			// finished sleeping, update system time
-			acpi_update_clock();
-		}
+		// wait until S1 is entered
+		while (!(acpi_read_pm1_status(acpi_facp) & ACPI_WAK)) ;
+		// finished sleeping, update system time
+		acpi_update_clock();
+		acpi_enter_dx(ACPI_D0);
 	}
 }
 
@@ -1292,7 +1284,6 @@
 	{
 #ifdef CONFIG_ACPI_S1_SLEEP
 		acpi_enter_sx(ACPI_S1);
-		acpi_enter_sx(ACPI_S0);
 #endif
 	}
 	file->f_pos += *len;
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/i8259.c linux/arch/i386/kernel/i8259.c
--- v2.3.48/linux/arch/i386/kernel/i8259.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/i386/kernel/i8259.c	Sun Feb 27 13:28:01 2000
@@ -131,7 +131,7 @@
 
 static void end_8259A_irq (unsigned int irq)
 {
-	if (!(irq_desc[irq].status & IRQ_DISABLED))
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
 		enable_8259A_irq(irq);
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/io_apic.c linux/arch/i386/kernel/io_apic.c
--- v2.3.48/linux/arch/i386/kernel/io_apic.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/i386/kernel/io_apic.c	Tue Feb 29 12:06:17 2000
@@ -18,6 +18,7 @@
 
 #include <linux/mm.h>
 #include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
@@ -1160,7 +1161,7 @@
 
 static void mask_and_ack_level_ioapic_irq (unsigned int i) { /* nothing */ }
 
-static void set_ioapic_affinity (unsigned int irq, unsigned int mask)
+static void set_ioapic_affinity (unsigned int irq, unsigned long mask)
 {
 	unsigned long flags;
 	/*
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c
--- v2.3.48/linux/arch/i386/kernel/irq.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/i386/kernel/irq.c	Mon Feb 28 07:44:22 2000
@@ -32,7 +32,6 @@
 #include <linux/kernel_stat.h>
 #include <linux/irq.h>
 #include <linux/proc_fs.h>
-#include <linux/irq.h>
 
 #include <asm/io.h>
 #include <asm/smp.h>
@@ -184,24 +183,43 @@
 unsigned char global_irq_holder = NO_PROC_ID;
 unsigned volatile int global_irq_lock;
 
+extern void show_stack(unsigned long* esp);
+
 static void show(char * str)
 {
 	int i;
-	unsigned long *stack;
 	int cpu = smp_processor_id();
 
 	printk("\n%s, CPU %d:\n", str, cpu);
-	printk("irq:  %d [%d %d]\n",
-		irqs_running(), local_irq_count(0), local_irq_count(1));
-	printk("bh:   %d [%d %d]\n",
-		spin_is_locked(&global_bh_lock) ? 1 : 0, local_bh_count(0), local_bh_count(1));
-	stack = (unsigned long *) &stack;
-	for (i = 40; i ; i--) {
-		unsigned long x = *++stack;
-		if (x > (unsigned long) &get_option && x < (unsigned long) &vsprintf) {
-			printk("<[%08lx]> ", x);
+	printk("irq:  %d [",irqs_running());
+	for(i=0;i < smp_num_cpus;i++)
+		printk(" %d",local_irq_count(i));
+	printk(" ]\nbh:   %d [",spin_is_locked(&global_bh_lock) ? 1 : 0);
+	for(i=0;i < smp_num_cpus;i++)
+		printk(" %d",local_bh_count(i));
+
+	printk(" ]\nStack dumps:");
+	for(i=0;i< smp_num_cpus;i++) {
+		unsigned long esp;
+		if(i==cpu)
+			continue;
+		printk("\nCPU %d:",i);
+		esp = init_tss[i].esp0;
+		if(esp==NULL) {
+			/* tss->esp0 is set to NULL in cpu_init(),
+			 * it's initialized when the cpu returns to user
+			 * space. -- manfreds
+			 */
+			printk(" <unknown> ");
+			continue;
 		}
-	}
+		esp &= ~(THREAD_SIZE-1);
+		esp += sizeof(struct task_struct);
+		show_stack((void*)esp);
+ 	}
+	printk("\nCPU %d:",cpu);
+	show_stack(NULL);
+	printk("\n");
 }
 	
 #define MAXCOUNT 100000000
@@ -874,7 +892,7 @@
 static struct proc_dir_entry * irq_dir [NR_IRQS];
 static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
 
-unsigned int irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = 0xffffffff};
+static unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
 
 #define HEX_DIGITS 8
 
@@ -883,7 +901,7 @@
 {
 	if (count < HEX_DIGITS+1)
 		return -EINVAL;
-	return sprintf (page, "%08x\n", irq_affinity[(int)data]);
+	return sprintf (page, "%08lx\n", irq_affinity[(long)data]);
 }
 
 static unsigned int parse_hex_value (const char *buffer,
@@ -926,7 +944,7 @@
 static int irq_affinity_write_proc (struct file *file, const char *buffer,
 					unsigned long count, void *data)
 {
-	int irq = (int) data, full_count = count, err;
+	int irq = (long) data, full_count = count, err;
 	unsigned long new_value;
 
 	if (!irq_desc[irq].handler->set_affinity)
@@ -993,7 +1011,7 @@
 	entry = create_proc_entry("smp_affinity", 0700, irq_dir[irq]);
 
 	entry->nlink = 1;
-	entry->data = (void *)irq;
+	entry->data = (void *)(long)irq;
 	entry->read_proc = irq_affinity_read_proc;
 	entry->write_proc = irq_affinity_write_proc;
 
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/microcode.c linux/arch/i386/kernel/microcode.c
--- v2.3.48/linux/arch/i386/kernel/microcode.c	Sat Feb 26 22:31:38 2000
+++ linux/arch/i386/kernel/microcode.c	Thu Mar  2 10:10:24 2000
@@ -23,20 +23,23 @@
  *	1.02	21 February 2000, Tigran Aivazian <tigran@sco.com>
  *		Added 'device trimming' support. open(O_WRONLY) zeroes
  *		and frees the saved copy of applied microcode.
+ *	1.03	29 February 2000, Tigran Aivazian <tigran@sco.com>
+ *		Made to use devfs (/dev/cpu/microcode) + cleanups.
  */
 
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/smp_lock.h>
-#include <linux/proc_fs.h>
+#include <linux/devfs_fs_kernel.h>
 
 #include <asm/msr.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
 
-#define MICROCODE_VERSION 	"1.02"
+#define MICROCODE_VERSION 	"1.03"
 
 MODULE_DESCRIPTION("CPU (P6) microcode update driver");
 MODULE_AUTHOR("Tigran Aivazian <tigran@ocston.org>");
@@ -60,9 +63,10 @@
 static unsigned long microcode_status = 0;
 
 /* the actual array of microcode blocks, each 2048 bytes */
-static struct microcode * microcode = NULL;
+static struct microcode *microcode = NULL;
 static unsigned int microcode_num = 0;
 static char *mc_applied = NULL; /* holds an array of applied microcode blocks */
+static unsigned int mc_fsize;   /* used often, so compute once at microcode_init() */
 
 static struct file_operations microcode_fops = {
 	read:		microcode_read,
@@ -71,23 +75,25 @@
 	release:	microcode_release,
 };
 
-static struct proc_dir_entry *proc_microcode;
+static devfs_handle_t devfs_handle;
 
 static int __init microcode_init(void)
 {
-	proc_microcode = create_proc_entry("microcode", S_IWUSR|S_IRUSR, proc_root_driver);
-	if (!proc_microcode) {
-		printk(KERN_ERR "microcode: can't create /proc/driver/microcode\n");
-		return -ENOMEM;
-	}
-	proc_microcode->proc_fops = &microcode_fops;
+	devfs_handle = devfs_register(NULL, "cpu/microcode", 0, DEVFS_FL_DEFAULT, 0, 0,
+				   S_IFREG | S_IRUSR | S_IWUSR, 0, 0, &microcode_fops, NULL);
+	if (!devfs_handle) {
+		printk(KERN_ERR "microcode: can't create /dev/cpu/microcode\n");
+ 		return -ENOMEM;
+ 	}
+	/* XXX assume no hotplug CPUs so smp_num_cpus does not change */
+	mc_fsize = smp_num_cpus * sizeof(struct microcode);
 	printk(KERN_INFO "P6 Microcode Update Driver v%s registered\n", MICROCODE_VERSION);
 	return 0;
 }
 
 static void __exit microcode_exit(void)
 {
-	remove_proc_entry("microcode", proc_root_driver);
+	devfs_unregister(devfs_handle);
 	if (mc_applied)
 		kfree(mc_applied);
 	printk(KERN_INFO "P6 Microcode Update Driver v%s unregistered\n", MICROCODE_VERSION);
@@ -108,25 +114,21 @@
 	if (test_and_set_bit(MICROCODE_IS_OPEN, &microcode_status))
 		return -EBUSY;
 
-	if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
-		proc_microcode->size = 0;
-		if (mc_applied) {
-			memset(mc_applied, 0, smp_num_cpus * sizeof(struct microcode));
-			kfree(mc_applied);
-			mc_applied = NULL;
-		}
+	if ((file->f_flags & O_ACCMODE) == O_WRONLY && mc_applied) {
+		devfs_set_file_size(devfs_handle, 0);
+		memset(mc_applied, 0, mc_fsize);
+		kfree(mc_applied);
+		mc_applied = NULL;
 	}
 
 	MOD_INC_USE_COUNT;
-
 	return 0;
 }
 
 static int microcode_release(struct inode *inode, struct file *file)
 {
-	MOD_DEC_USE_COUNT;
-
 	clear_bit(MICROCODE_IS_OPEN, &microcode_status);
+	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -156,19 +158,17 @@
 			memcpy(m, &microcode[update_req[i].slot], sizeof(struct microcode));
 		}
 	}
-	return error ? -EIO : 0;
+	return error;
 }
 
 static void do_update_one(void *arg)
 {
-	struct update_req *req;
-	struct cpuinfo_x86 * c;
+	int cpu_num = smp_processor_id();
+	struct cpuinfo_x86 *c = cpu_data + cpu_num;
+	struct update_req *req = (struct update_req *)arg + cpu_num;
 	unsigned int pf = 0, val[2], rev, sig;
-	int i, cpu_num;
+	int i;
 
-	cpu_num = smp_processor_id();
-	c = cpu_data + cpu_num;
-	req = (struct update_req *)arg + cpu_num;
 	req->err = 1; /* be pessimistic */
 
 	if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6)
@@ -210,8 +210,8 @@
 
 				req->err = 0;
 				req->slot = i;
-				printk(KERN_ERR "microcode: CPU%d microcode updated "
-						"from revision %d to %d, date=%08x\n", 
+				printk(KERN_ERR "microcode: CPU%d updated from revision "
+						"%d to %d, date=%08x\n", 
 						cpu_num, rev, val[1], m->date);
 			}
 			break;
@@ -220,12 +220,10 @@
 
 static ssize_t microcode_read(struct file *file, char *buf, size_t len, loff_t *ppos)
 {
-	size_t fsize = smp_num_cpus * sizeof(struct microcode);
-
-	if (!proc_microcode->size || *ppos >= fsize)
-		return 0; /* EOF */
-	if (*ppos + len > fsize)
-		len = fsize - *ppos;
+	if (*ppos >= mc_fsize)
+		return 0;
+	if (*ppos + len > mc_fsize)
+		len = mc_fsize - *ppos;
 	if (copy_to_user(buf, mc_applied + *ppos, len))
 		return -EFAULT;
 	*ppos += len;
@@ -242,33 +240,34 @@
 		return -EINVAL;
 	}
 	if (!mc_applied) {
-		int size = smp_num_cpus * sizeof(struct microcode);
-		mc_applied = kmalloc(size, GFP_KERNEL);
+		mc_applied = kmalloc(mc_fsize, GFP_KERNEL);
 		if (!mc_applied) {
-			printk(KERN_ERR "microcode: can't allocate memory for saved microcode\n");
+			printk(KERN_ERR "microcode: out of memory for saved microcode\n");
 			return -ENOMEM;
 		}
-		memset(mc_applied, 0, size);
+		memset(mc_applied, 0, mc_fsize);
 	}
 	
 	lock_kernel();
 	microcode_num = len/sizeof(struct microcode);
 	microcode = vmalloc(len);
 	if (!microcode) {
-		unlock_kernel();
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto out_unlock;
 	}
 	if (copy_from_user(microcode, buf, len)) {
-		vfree(microcode);
-		unlock_kernel();
-		return -EFAULT;
-	}
-	ret = do_microcode_update();
-	if (!ret) {
-		proc_microcode->size = smp_num_cpus * sizeof(struct microcode);
-		ret = (ssize_t)len;
+		ret = -EFAULT;
+		goto out_vfree;
 	}
+	if(do_microcode_update()) {
+		ret = -EIO;
+		goto out_vfree;
+	}
+	devfs_set_file_size(devfs_handle, mc_fsize);
+	ret = (ssize_t)len;
+out_vfree:
 	vfree(microcode);
+out_unlock:
 	unlock_kernel();
 	return ret;
 }
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/pci-pc.c linux/arch/i386/kernel/pci-pc.c
--- v2.3.48/linux/arch/i386/kernel/pci-pc.c	Sun Feb 13 19:29:03 2000
+++ linux/arch/i386/kernel/pci-pc.c	Mon Feb 28 14:06:08 2000
@@ -1044,6 +1044,45 @@
 			printk("PCI: Discovered primary peer bus %02x [IRQ]\n", i);
 }
 
+static void set_level_irq(unsigned irq)
+{
+	unsigned char mask = 1 << (irq & 7);
+	unsigned int port = 0x4d0 + (irq >> 3);
+	unsigned char val = inb(port);
+
+	if (val & mask) {
+		printk("PCI irq %d was level\n", irq);
+		return;
+	}
+	printk("PCI irq %d was edge, turning into level-triggered\n", irq);
+	outb(val | mask, port);
+}
+
+static int ali_set_irq(struct pci_dev *router, unsigned pirq, unsigned irq)
+{
+	if (irq < 15) {
+		static unsigned char irqmap[16] = {
+			0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15
+		};
+		unsigned char val = irqmap[irq];
+		if (val && pirq < 8) {
+			u8 byte;
+			unsigned offset = 0x48 + (pirq >> 1);
+			unsigned shift = (pirq & 1) << 2;
+			pci_read_config_byte(router, offset, &byte);
+			printk("ALI: old %04x=%02x\n", offset, byte);
+			byte &= ~(0xf << shift);
+			byte |= val << shift;
+			printk("ALI: new %04x=%02x\n", offset, byte);
+			pci_write_config_byte(router, offset, byte);
+			set_level_irq(irq);
+			return irq;
+		}
+	}
+	return 0;
+}
+		
+
 /*
  *  In case BIOS forgets to tell us about IRQ, we try to look it up in the routing
  *  table, but unfortunately we have to know the interrupt router chip.
@@ -1135,6 +1174,10 @@
 			DBG(" -> [PIIX] sink\n");
 		break;
 	case ID(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533):
+		newirq = ali_set_irq(router, pirq-1, newirq);
+		if (newirq)
+			msg = "ALI";
+		break;
 	default:
 		DBG(" -> unknown router %04x/%04x\n", rt->rtr_vendor, rt->rtr_device);
 		if (newirq && mask == (1 << newirq)) {
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
--- v2.3.48/linux/arch/i386/kernel/process.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/i386/kernel/process.c	Tue Feb 29 11:13:27 2000
@@ -693,7 +693,6 @@
 	int error;
 	char * filename;
 
-	lock_kernel();
 	filename = getname((char *) regs.ebx);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
@@ -703,7 +702,6 @@
 		current->flags &= ~PF_DTRACE;
 	putname(filename);
 out:
-	unlock_kernel();
 	return error;
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/signal.c linux/arch/i386/kernel/signal.c
--- v2.3.48/linux/arch/i386/kernel/signal.c	Fri Jan 28 15:09:06 2000
+++ linux/arch/i386/kernel/signal.c	Mon Feb 28 07:50:08 2000
@@ -419,13 +419,19 @@
 		           ? current->exec_domain->signal_invmap[sig]
 		           : sig),
 		          &frame->sig);
+	if (err)
+		goto give_sigsegv;
 
 	err |= setup_sigcontext(&frame->sc, &frame->fpstate, regs, set->sig[0]);
+	if (err)
+		goto give_sigsegv;
 
 	if (_NSIG_WORDS > 1) {
 		err |= __copy_to_user(frame->extramask, &set->sig[1],
 				      sizeof(frame->extramask));
 	}
+	if (err)
+		goto give_sigsegv;
 
 	/* Set up to return from userspace.  If provided, use a stub
 	   already in userspace.  */
@@ -486,6 +492,8 @@
 	err |= __put_user(&frame->info, &frame->pinfo);
 	err |= __put_user(&frame->uc, &frame->puc);
 	err |= __copy_to_user(&frame->info, info, sizeof(*info));
+	if (err)
+		goto give_sigsegv;
 
 	/* Create the ucontext.  */
 	err |= __put_user(0, &frame->uc.uc_flags);
@@ -497,6 +505,8 @@
 	err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate,
 			        regs, set->sig[0]);
 	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
+	if (err)
+		goto give_sigsegv;
 
 	/* Set up to return from userspace.  If provided, use a stub
 	   already in userspace.  */
diff -u --recursive --new-file v2.3.48/linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c
--- v2.3.48/linux/arch/i386/kernel/traps.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/i386/kernel/traps.c	Tue Feb 29 09:04:08 2000
@@ -21,6 +21,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
+#include <linux/interrupt.h>
 
 #ifdef CONFIG_MCA
 #include <linux/mca.h>
diff -u --recursive --new-file v2.3.48/linux/arch/i386/mm/init.c linux/arch/i386/mm/init.c
--- v2.3.48/linux/arch/i386/mm/init.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/i386/mm/init.c	Sun Feb 27 08:47:51 2000
@@ -631,13 +631,14 @@
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
+	if (start < end)
+		printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
 	for (; start < end; start += PAGE_SIZE) {
 		ClearPageReserved(mem_map + MAP_NR(start));
 		set_page_count(mem_map+MAP_NR(start), 1);
 		free_page(start);
 		totalram_pages++;
 	}
-	printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
 }
 #endif
 
diff -u --recursive --new-file v2.3.48/linux/arch/mips/arc/console.c linux/arch/mips/arc/console.c
--- v2.3.48/linux/arch/mips/arc/console.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/arc/console.c	Mon Feb 28 07:18:20 2000
@@ -6,6 +6,7 @@
  *
  * $Id: console.c,v 1.3 1999/10/09 00:00:57 ralf Exp $
  */
+#include <linux/config.h>
 #include <linux/init.h>
 #include <asm/sgialib.h>
 #include <asm/bcache.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/arc/init.c linux/arch/mips/arc/init.c
--- v2.3.48/linux/arch/mips/arc/init.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/arc/init.c	Mon Feb 28 07:18:20 2000
@@ -9,7 +9,6 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/config.h>
 
 #include <asm/sgialib.h>
 
diff -u --recursive --new-file v2.3.48/linux/arch/mips/arc/memory.c linux/arch/mips/arc/memory.c
--- v2.3.48/linux/arch/mips/arc/memory.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/arc/memory.c	Mon Feb 28 07:18:20 2000
@@ -13,7 +13,6 @@
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/swap.h>
-#include <linux/config.h>
 
 #include <asm/sgialib.h>
 #include <asm/page.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/arc/printf.c linux/arch/mips/arc/printf.c
--- v2.3.48/linux/arch/mips/arc/printf.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/arc/printf.c	Mon Feb 28 07:18:20 2000
@@ -6,6 +6,7 @@
  *
  * $Id: printf.c,v 1.3 1999/10/09 00:00:57 ralf Exp $
  */
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 
diff -u --recursive --new-file v2.3.48/linux/arch/mips/baget/balo_supp.S linux/arch/mips/baget/balo_supp.S
--- v2.3.48/linux/arch/mips/baget/balo_supp.S	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/baget/balo_supp.S	Mon Feb 28 07:18:20 2000
@@ -4,7 +4,6 @@
  * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
  */
 
-#include <linux/config.h>
 #include <asm/asm.h>
 #include <asm/regdef.h>
 #include <asm/stackframe.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/baget/prom/init.c linux/arch/mips/baget/prom/init.c
--- v2.3.48/linux/arch/mips/baget/prom/init.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/baget/prom/init.c	Mon Feb 28 07:18:20 2000
@@ -6,7 +6,6 @@
  * $Id: init.c,v 1.3 1999/10/09 00:00:57 ralf Exp $
  */
 #include <linux/init.h>
-#include <linux/config.h>
 #include <asm/bootinfo.h>
 
 char arcs_cmdline[CL_SIZE];
diff -u --recursive --new-file v2.3.48/linux/arch/mips/baget/setup.c linux/arch/mips/baget/setup.c
--- v2.3.48/linux/arch/mips/baget/setup.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/baget/setup.c	Mon Feb 28 07:18:20 2000
@@ -5,7 +5,6 @@
  * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
  *
  */
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/ddb5074/irq.c linux/arch/mips/ddb5074/irq.c
--- v2.3.48/linux/arch/mips/ddb5074/irq.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/ddb5074/irq.c	Mon Feb 28 07:18:20 2000
@@ -7,6 +7,7 @@
  *  $Id: irq.c,v 1.1 2000/01/26 00:07:44 ralf Exp $
  */
 
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/ddb5074/pci.c linux/arch/mips/ddb5074/pci.c
--- v2.3.48/linux/arch/mips/ddb5074/pci.c	Sat Feb 26 22:31:39 2000
+++ linux/arch/mips/ddb5074/pci.c	Mon Feb 28 07:18:20 2000
@@ -9,12 +9,10 @@
  */
 
 #include <linux/init.h>
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/types.h>
 #include <linux/sched.h>
-#include <linux/pci.h>
 #include <linux/ioport.h>
 #include <asm-mips/nile4.h>
 
diff -u --recursive --new-file v2.3.48/linux/arch/mips/dec/prom/cmdline.c linux/arch/mips/dec/prom/cmdline.c
--- v2.3.48/linux/arch/mips/dec/prom/cmdline.c	Sat Feb 26 22:31:40 2000
+++ linux/arch/mips/dec/prom/cmdline.c	Mon Feb 28 07:18:20 2000
@@ -7,7 +7,6 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/config.h>
 #include <linux/string.h>
 
 #include <asm/bootinfo.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/dec/prom/identify.c linux/arch/mips/dec/prom/identify.c
--- v2.3.48/linux/arch/mips/dec/prom/identify.c	Sat Feb 26 22:31:40 2000
+++ linux/arch/mips/dec/prom/identify.c	Mon Feb 28 07:18:20 2000
@@ -6,7 +6,6 @@
  * $Id: identify.c,v 1.2 1999/10/09 00:00:58 ralf Exp $
  */
 #include <linux/init.h>
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 
diff -u --recursive --new-file v2.3.48/linux/arch/mips/kernel/r2300_misc.S linux/arch/mips/kernel/r2300_misc.S
--- v2.3.48/linux/arch/mips/kernel/r2300_misc.S	Sat Feb 26 22:31:40 2000
+++ linux/arch/mips/kernel/r2300_misc.S	Mon Feb 28 07:18:20 2000
@@ -10,8 +10,6 @@
  * Copyright (c) 1998 Harald Koerfgen
  * Copyright (c) 1998, 1999 Gleb Raiko & Vladimir Roganov
  */
-#include <linux/config.h>
-
 #include <asm/asm.h>
 #include <asm/current.h>
 #include <asm/bootinfo.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/kernel/time.c linux/arch/mips/kernel/time.c
--- v2.3.48/linux/arch/mips/kernel/time.c	Sat Feb 26 22:31:40 2000
+++ linux/arch/mips/kernel/time.c	Mon Feb 28 07:18:20 2000
@@ -6,6 +6,7 @@
  * This file contains the time handling details for PC-style clocks as
  * found in some MIPS systems.
  */
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/sched.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/mm/loadmmu.c linux/arch/mips/mm/loadmmu.c
--- v2.3.48/linux/arch/mips/mm/loadmmu.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips/mm/loadmmu.c	Mon Feb 28 07:18:20 2000
@@ -5,6 +5,7 @@
  *
  * $Id: loadmmu.c,v 1.15 2000/02/24 00:12:40 ralf Exp $
  */
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips/sgi/kernel/indy_int.c linux/arch/mips/sgi/kernel/indy_int.c
--- v2.3.48/linux/arch/mips/sgi/kernel/indy_int.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips/sgi/kernel/indy_int.c	Mon Feb 28 07:18:20 2000
@@ -9,7 +9,6 @@
  *                    - Indigo2 changes
  *                    - Interrupt handling fixes
  */
-#include <linux/config.h>
 #include <linux/init.h>
 
 #include <linux/errno.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/arc/init.c linux/arch/mips64/arc/init.c
--- v2.3.48/linux/arch/mips64/arc/init.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/arc/init.c	Mon Feb 28 07:18:20 2000
@@ -10,7 +10,6 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/config.h>
 
 #include <asm/sgialib.h>
 
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/arc/memory.c linux/arch/mips64/arc/memory.c
--- v2.3.48/linux/arch/mips64/arc/memory.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/arc/memory.c	Mon Feb 28 07:18:20 2000
@@ -13,7 +13,6 @@
  * because on some machines like SGI IP27 the ARC memory configuration data
  * completly bogus and alternate easier to use mechanisms are available.
  */
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
@@ -21,7 +20,6 @@
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/swap.h>
-#include <linux/config.h>
 
 #include <asm/sgialib.h>
 #include <asm/page.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/kernel/signal32.c linux/arch/mips64/kernel/signal32.c
--- v2.3.48/linux/arch/mips64/kernel/signal32.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/kernel/signal32.c	Mon Feb 28 07:18:20 2000
@@ -8,7 +8,6 @@
  * Copyright (C) 1994 - 1999  Ralf Baechle
  * Copyright (C) 1999 Silicon Graphics, Inc.
  */
-#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/kernel/syscall.c linux/arch/mips64/kernel/syscall.c
--- v2.3.48/linux/arch/mips64/kernel/syscall.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/kernel/syscall.c	Mon Feb 28 07:18:20 2000
@@ -7,7 +7,6 @@
  * Copyright (C) 1995 - 1999 by Ralf Baechle
  * Copyright (C) 1999 Silicon Graphics, Inc.
  */
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/mm.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/sgi-ip27/ip27-init.c linux/arch/mips64/sgi-ip27/ip27-init.c
--- v2.3.48/linux/arch/mips64/sgi-ip27/ip27-init.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/sgi-ip27/ip27-init.c	Mon Feb 28 07:18:20 2000
@@ -7,7 +7,6 @@
 #include <asm/sn/klconfig.h>
 #include <asm/ioc3.h>
 #include <asm/mipsregs.h>
-#include <asm/sn/klconfig.h>
 #include <asm/sn/gda.h>
 
 typedef unsigned long cpumask_t;	/* into asm/sn/types.h */
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/sgi-ip27/ip27-irq.c linux/arch/mips64/sgi-ip27/ip27-irq.c
--- v2.3.48/linux/arch/mips64/sgi-ip27/ip27-irq.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/sgi-ip27/ip27-irq.c	Mon Feb 28 07:18:20 2000
@@ -5,7 +5,6 @@
  * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
  * Copyright (C) 1999 Silicon Graphics, Inc.
  */
-#include <linux/config.h>
 #include <linux/init.h>
 
 #include <linux/errno.h>
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/sgi-ip27/ip27-rtc.c linux/arch/mips64/sgi-ip27/ip27-rtc.c
--- v2.3.48/linux/arch/mips64/sgi-ip27/ip27-rtc.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/sgi-ip27/ip27-rtc.c	Tue Feb 29 11:08:16 2000
@@ -192,16 +192,9 @@
  */
 
 static struct file_operations rtc_fops = {
-	NULL,		/* No llseek (yet) */
-	NULL,		/* No read (yet) */
-	NULL,		/* No write */
-	NULL,		/* No readdir */
-	NULL,		/* No poll (yet) */
-	rtc_ioctl,
-	NULL,		/* No mmap */
-	rtc_open,
-	NULL,		/* flush */
-	rtc_release
+	ioctl:		rtc_ioctl,
+	open:		rtc_open,
+	release:	rtc_release,
 };
 
 static struct miscdevice rtc_dev=
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/sgi-ip27/ip27-setup.c linux/arch/mips64/sgi-ip27/ip27-setup.c
--- v2.3.48/linux/arch/mips64/sgi-ip27/ip27-setup.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/sgi-ip27/ip27-setup.c	Mon Feb 28 07:18:20 2000
@@ -19,7 +19,6 @@
 #include <asm/sn/klconfig.h>
 #include <asm/ioc3.h>
 #include <asm/mipsregs.h>
-#include <asm/sn/klconfig.h>
 
 /* Check against user dumbness.  */
 #ifdef CONFIG_VT
diff -u --recursive --new-file v2.3.48/linux/arch/mips64/sgi-ip27/ip27-timer.c linux/arch/mips64/sgi-ip27/ip27-timer.c
--- v2.3.48/linux/arch/mips64/sgi-ip27/ip27-timer.c	Sat Feb 26 22:31:41 2000
+++ linux/arch/mips64/sgi-ip27/ip27-timer.c	Mon Feb 28 07:18:20 2000
@@ -148,13 +148,10 @@
 }
 
 /* Includes for ioc3_init().  */
-#include <linux/init.h>
 #include <asm/sn/types.h>
 #include <asm/sn/sn0/addrs.h>
 #include <asm/sn/sn0/hubni.h>
 #include <asm/sn/sn0/hubio.h>
-#include <asm/sn/klconfig.h>
-#include <asm/ioc3.h>
 #include <asm/pci/bridge.h>
 
 /* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
diff -u --recursive --new-file v2.3.48/linux/arch/sparc/config.in linux/arch/sparc/config.in
--- v2.3.48/linux/arch/sparc/config.in	Thu Feb 10 17:11:05 2000
+++ linux/arch/sparc/config.in	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.86 2000/02/10 02:51:10 davem Exp $
+# $Id: config.in,v 1.87 2000/02/27 19:34:12 davem Exp $
 # For a description of the syntax of this configuration file,
 # see the Configure script.
 #
@@ -163,6 +163,7 @@
    bool 'Network device support' CONFIG_NETDEVICES
    if [ "$CONFIG_NETDEVICES" = "y" ]; then
       tristate '  Dummy net driver support' CONFIG_DUMMY
+      tristate '  Bonding driver support' CONFIG_BONDING
       tristate '  PPP (point-to-point) support' CONFIG_PPP
       if [ ! "$CONFIG_PPP" = "n" ]; then
         dep_tristate '  PPP support for async serial ports' CONFIG_PPP_ASYNC $CONFIG_PPP
diff -u --recursive --new-file v2.3.48/linux/arch/sparc/defconfig linux/arch/sparc/defconfig
--- v2.3.48/linux/arch/sparc/defconfig	Sun Feb 20 21:12:38 2000
+++ linux/arch/sparc/defconfig	Sun Feb 27 18:45:10 2000
@@ -218,6 +218,7 @@
 #
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=m
+CONFIG_BONDING=m
 CONFIG_PPP=m
 CONFIG_PPP_ASYNC=m
 CONFIG_PPP_SYNC_TTY=m
@@ -240,7 +241,7 @@
 CONFIG_UNIX98_PTY_COUNT=256
 
 #
-# Filesystems
+# File systems
 #
 # CONFIG_QUOTA is not set
 CONFIG_AUTOFS_FS=m
diff -u --recursive --new-file v2.3.48/linux/arch/sparc/kernel/ioport.c linux/arch/sparc/kernel/ioport.c
--- v2.3.48/linux/arch/sparc/kernel/ioport.c	Sat Feb 26 22:31:42 2000
+++ linux/arch/sparc/kernel/ioport.c	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-/* $Id: ioport.c,v 1.34 2000/02/18 13:48:48 davem Exp $
+/* $Id: ioport.c,v 1.35 2000/02/27 08:16:25 davem Exp $
  * ioport.c:  Simple io mapping allocator.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff -u --recursive --new-file v2.3.48/linux/arch/sparc/kernel/pcic.c linux/arch/sparc/kernel/pcic.c
--- v2.3.48/linux/arch/sparc/kernel/pcic.c	Sun Feb 13 19:29:03 2000
+++ linux/arch/sparc/kernel/pcic.c	Thu Mar  2 11:36:42 2000
@@ -1,4 +1,4 @@
-/* $Id: pcic.c,v 1.13 2000/02/12 03:05:37 zaitcev Exp $
+/* $Id: pcic.c,v 1.14 2000/03/01 02:53:28 davem Exp $
  * pcic.c: Sparc/PCI controller support
  *
  * Copyright (C) 1998 V. Roganov and G. Raiko
@@ -883,13 +883,6 @@
 void pcibios_align_resource(void *data, struct resource *res, unsigned long size)
 {
 }
-
-#if 0
-int pci_assign_resource(struct pci_dev *dev, int i)
-{
-	return -ENOSYS; /* :-)... actually implement this soon */
-}
-#endif
 
 int pcibios_enable_device(struct pci_dev *pdev)
 {
diff -u --recursive --new-file v2.3.48/linux/arch/sparc/kernel/process.c linux/arch/sparc/kernel/process.c
--- v2.3.48/linux/arch/sparc/kernel/process.c	Tue Feb  1 01:35:43 2000
+++ linux/arch/sparc/kernel/process.c	Thu Mar  2 11:36:42 2000
@@ -1,4 +1,4 @@
-/*  $Id: process.c,v 1.145 2000/01/29 01:08:56 anton Exp $
+/*  $Id: process.c,v 1.146 2000/03/01 02:53:27 davem Exp $
  *  linux/arch/sparc/kernel/process.c
  *
  *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -652,7 +652,6 @@
 	if(regs->u_regs[UREG_G1] == 0)
 		base = 1;
 
-	lock_kernel();
 	filename = getname((char *)regs->u_regs[base + UREG_I0]);
 	error = PTR_ERR(filename);
 	if(IS_ERR(filename))
@@ -661,7 +660,6 @@
 			  (char **) regs->u_regs[base + UREG_I2], regs);
 	putname(filename);
 out:
-	unlock_kernel();
 	return error;
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/config.in linux/arch/sparc64/config.in
--- v2.3.48/linux/arch/sparc64/config.in	Sun Feb 20 21:12:38 2000
+++ linux/arch/sparc64/config.in	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.95 2000/02/10 02:51:12 davem Exp $
+# $Id: config.in,v 1.99 2000/02/27 19:34:17 davem Exp $
 # For a description of the syntax of this configuration file,
 # see the Configure script.
 #
@@ -112,6 +112,7 @@
       define_bool CONFIG_IDEDMA_NEW_DRIVE_LISTINGS y
       define_bool CONFIG_BLK_DEV_NS87415 y
       define_bool CONFIG_BLK_DEV_CMD64X y
+      define_bool CONFIG_BLK_DEV_IDE_MODES y
    fi
 fi
 
@@ -200,6 +201,7 @@
    bool 'Network device support' CONFIG_NETDEVICES
    if [ "$CONFIG_NETDEVICES" = "y" ]; then
       tristate '  Dummy net driver support' CONFIG_DUMMY
+      tristate '  Bonding driver support' CONFIG_BONDING
       tristate '  PPP (point-to-point) support' CONFIG_PPP
       if [ ! "$CONFIG_PPP" = "n" ]; then
          dep_tristate '  PPP support for async serial ports' CONFIG_PPP_ASYNC $CONFIG_PPP
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/defconfig linux/arch/sparc64/defconfig
--- v2.3.48/linux/arch/sparc64/defconfig	Sat Feb 26 22:31:42 2000
+++ linux/arch/sparc64/defconfig	Sun Feb 27 18:45:10 2000
@@ -136,6 +136,7 @@
 CONFIG_IDEDMA_NEW_DRIVE_LISTINGS=y
 CONFIG_BLK_DEV_NS87415=y
 CONFIG_BLK_DEV_CMD64X=y
+CONFIG_BLK_DEV_IDE_MODES=y
 
 #
 # Networking options
@@ -254,6 +255,7 @@
 #
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=m
+CONFIG_BONDING=m
 CONFIG_PPP=m
 # CONFIG_PPP_ASYNC is not set
 # CONFIG_PPP_SYNC_TTY is not set
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/kernel/irq.c linux/arch/sparc64/kernel/irq.c
--- v2.3.48/linux/arch/sparc64/kernel/irq.c	Sat Feb 26 22:31:42 2000
+++ linux/arch/sparc64/kernel/irq.c	Thu Mar  2 10:13:16 2000
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.84 2000/02/25 05:44:41 davem Exp $
+/* $Id: irq.c,v 1.85 2000/03/02 02:00:24 davem Exp $
  * irq.c: UltraSparc IRQ handling/init/registry.
  *
  * Copyright (C) 1997  David S. Miller  (davem@caip.rutgers.edu)
@@ -955,7 +955,7 @@
 void init_timers(void (*cfunc)(int, void *, struct pt_regs *),
 		 unsigned long *clock)
 {
-	unsigned long flags;
+	unsigned long pstate;
 	extern unsigned long timer_tick_offset;
 	int node, err;
 #ifdef __SMP__
@@ -978,31 +978,57 @@
 		prom_halt();
 	}
 
-	save_and_cli(flags);
+	/* Guarentee that the following sequences execute
+	 * uninterrupted.
+	 */
+	__asm__ __volatile__("rdpr	%%pstate, %0\n\t"
+			     "wrpr	%0, %1, %%pstate"
+			     : "=r" (pstate)
+			     : "i" (PSTATE_IE));
 
 	/* Set things up so user can access tick register for profiling
-	 * purposes.
+	 * purposes.  Also workaround BB_ERRATA_1 by doing a dummy
+	 * read back of %tick after writing it.
 	 */
 	__asm__ __volatile__("
 		sethi	%%hi(0x80000000), %%g1
-		sllx	%%g1, 32, %%g1
-		rd	%%tick, %%g2
+		ba,pt	%%xcc, 1f
+		 sllx	%%g1, 32, %%g1
+		.align	64
+	1:	rd	%%tick, %%g2
 		add	%%g2, 6, %%g2
 		andn	%%g2, %%g1, %%g2
 		wrpr	%%g2, 0, %%tick
-"	: /* no outputs */
+		rdpr	%%tick, %%g0"
+	: /* no outputs */
 	: /* no inputs */
 	: "g1", "g2");
 
+	/* Workaround for Spitfire Errata (#54 I think??), I discovered
+	 * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
+	 * number 103640.
+	 *
+	 * On Blackbird writes to %tick_cmpr can fail, the
+	 * workaround seems to be to execute the wr instruction
+	 * at the start of an I-cache line, and perform a dummy
+	 * read back from %tick_cmpr right after writing to it. -DaveM
+	 */
 	__asm__ __volatile__("
 		rd	%%tick, %%g1
-		add	%%g1, %0, %%g1
-		wr	%%g1, 0x0, %%tick_cmpr"
+		ba,pt	%%xcc, 1f
+		 add	%%g1, %0, %%g1
+		.align	64
+	1:	wr	%%g1, 0x0, %%tick_cmpr
+		rd	%%tick_cmpr, %%g0"
 	: /* no outputs */
 	: "r" (timer_tick_offset)
 	: "g1");
 
-	restore_flags(flags);
+	/* Restore PSTATE_IE. */
+	__asm__ __volatile__("wrpr	%0, 0x0, %%pstate"
+			     : /* no outputs */
+			     : "r" (pstate));
+
 	sti();
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/kernel/pci.c linux/arch/sparc64/kernel/pci.c
--- v2.3.48/linux/arch/sparc64/kernel/pci.c	Thu Feb 10 17:11:06 2000
+++ linux/arch/sparc64/kernel/pci.c	Thu Mar  2 11:36:42 2000
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.15 2000/02/08 05:11:29 jj Exp $
+/* $Id: pci.c,v 1.16 2000/03/01 02:53:33 davem Exp $
  * pci.c: UltraSparc PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
@@ -216,11 +216,6 @@
 
 void pcibios_align_resource(void *data, struct resource *res, unsigned long size)
 {
-}
-
-int pci_assign_resource(struct pci_dev *dev, int i)
-{
-	return -ENOSYS; /* :-)... actually implement this soon */
 }
 
 int pcibios_enable_device(struct pci_dev *pdev)
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/kernel/process.c linux/arch/sparc64/kernel/process.c
--- v2.3.48/linux/arch/sparc64/kernel/process.c	Fri Jan 28 15:09:07 2000
+++ linux/arch/sparc64/kernel/process.c	Thu Mar  2 11:36:42 2000
@@ -1,4 +1,4 @@
-/*  $Id: process.c,v 1.103 2000/01/21 11:38:53 jj Exp $
+/*  $Id: process.c,v 1.104 2000/03/01 02:53:32 davem Exp $
  *  arch/sparc64/kernel/process.c
  *
  *  Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -779,24 +779,22 @@
 	/* User register window flush is done by entry.S */
 
 	/* Check for indirect call. */
-	if(regs->u_regs[UREG_G1] == 0)
+	if (regs->u_regs[UREG_G1] == 0)
 		base = 1;
 
-	lock_kernel();
 	filename = getname((char *)regs->u_regs[base + UREG_I0]);
 	error = PTR_ERR(filename);
-	if(IS_ERR(filename))
+	if (IS_ERR(filename))
 		goto out;
 	error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
 			  (char **) regs->u_regs[base + UREG_I2], regs);
 	putname(filename);
-	if(!error) {
+	if (!error) {
 		fprs_write(0);
 		current->thread.xfsr[0] = 0;
 		current->thread.fpsaved[0] = 0;
 		regs->tstate &= ~TSTATE_PEF;
 	}
 out:
-	unlock_kernel();
 	return error;
 }
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/kernel/smp.c linux/arch/sparc64/kernel/smp.c
--- v2.3.48/linux/arch/sparc64/kernel/smp.c	Wed Feb 16 17:03:51 2000
+++ linux/arch/sparc64/kernel/smp.c	Thu Mar  2 10:13:16 2000
@@ -119,6 +119,7 @@
 void __init smp_callin(void)
 {
 	int cpuid = hard_smp_processor_id();
+	unsigned long pstate;
 
 	inherit_locked_prom_mappings(0);
 
@@ -127,18 +128,37 @@
 
 	cpu_probe();
 
-	/* Master did this already, now is the time for us to do it. */
+	/* Guarentee that the following sequences execute
+	 * uninterrupted.
+	 */
+	__asm__ __volatile__("rdpr	%%pstate, %0\n\t"
+			     "wrpr	%0, %1, %%pstate"
+			     : "=r" (pstate)
+			     : "i" (PSTATE_IE));
+
+	/* Set things up so user can access tick register for profiling
+	 * purposes.  Also workaround BB_ERRATA_1 by doing a dummy
+	 * read back of %tick after writing it.
+	 */
 	__asm__ __volatile__("
 	sethi	%%hi(0x80000000), %%g1
-	sllx	%%g1, 32, %%g1
-	rd	%%tick, %%g2
+	ba,pt	%%xcc, 1f
+	 sllx	%%g1, 32, %%g1
+	.align	64
+1:	rd	%%tick, %%g2
 	add	%%g2, 6, %%g2
 	andn	%%g2, %%g1, %%g2
 	wrpr	%%g2, 0, %%tick
-"	: /* no outputs */
+	rdpr	%%tick, %%g0"
+	: /* no outputs */
 	: /* no inputs */
 	: "g1", "g2");
 
+	/* Restore PSTATE_IE. */
+	__asm__ __volatile__("wrpr	%0, 0x0, %%pstate"
+			     : /* no outputs */
+			     : "r" (pstate));
+
 	smp_setup_percpu_timer();
 
 	__sti();
@@ -598,7 +618,7 @@
 
 void smp_percpu_timer_interrupt(struct pt_regs *regs)
 {
-	unsigned long compare, tick;
+	unsigned long compare, tick, pstate;
 	int cpu = smp_processor_id();
 	int user = user_mode(regs);
 
@@ -664,27 +684,87 @@
 			prof_counter(cpu) = prof_multiplier(cpu);
 		}
 
+		/* Guarentee that the following sequences execute
+		 * uninterrupted.
+		 */
+		__asm__ __volatile__("rdpr	%%pstate, %0\n\t"
+				     "wrpr	%0, %1, %%pstate"
+				     : "=r" (pstate)
+				     : "i" (PSTATE_IE));
+
+		/* Workaround for Spitfire Errata (#54 I think??), I discovered
+		 * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
+		 * number 103640.
+		 *
+		 * On Blackbird writes to %tick_cmpr can fail, the
+		 * workaround seems to be to execute the wr instruction
+		 * at the start of an I-cache line, and perform a dummy
+		 * read back from %tick_cmpr right after writing to it. -DaveM
+		 *
+		 * Just to be anal we add a workaround for Spitfire
+		 * Errata 50 by preventing pipeline bypasses on the
+		 * final read of the %tick register into a compare
+		 * instruction.  The Errata 50 description states
+		 * that %tick is not prone to this bug, but I am not
+		 * taking any chances.
+		 */
 		__asm__ __volatile__("rd	%%tick_cmpr, %0\n\t"
-				     "add	%0, %2, %0\n\t"
-				     "wr	%0, 0x0, %%tick_cmpr\n\t"
-				     "rd	%%tick, %1"
+				     "ba,pt	%%xcc, 1f\n\t"
+				     " add	%0, %2, %0\n\t"
+				     ".align	64\n"
+				  "1: wr	%0, 0x0, %%tick_cmpr\n\t"
+				     "rd	%%tick_cmpr, %%g0\n\t"
+				     "rd	%%tick, %1\n\t"
+				     "mov	%1, %1"
 				     : "=&r" (compare), "=r" (tick)
 				     : "r" (current_tick_offset));
+
+		/* Restore PSTATE_IE. */
+		__asm__ __volatile__("wrpr	%0, 0x0, %%pstate"
+				     : /* no outputs */
+				     : "r" (pstate));
 	} while (tick >= compare);
 }
 
 static void __init smp_setup_percpu_timer(void)
 {
 	int cpu = smp_processor_id();
+	unsigned long pstate;
 
 	prof_counter(cpu) = prof_multiplier(cpu) = 1;
 
-	__asm__ __volatile__("rd	%%tick, %%g1\n\t"
-			     "add	%%g1, %0, %%g1\n\t"
-			     "wr	%%g1, 0x0, %%tick_cmpr"
+	/* Guarentee that the following sequences execute
+	 * uninterrupted.
+	 */
+	__asm__ __volatile__("rdpr	%%pstate, %0\n\t"
+			     "wrpr	%0, %1, %%pstate"
+			     : "=r" (pstate)
+			     : "i" (PSTATE_IE));
+
+	/* Workaround for Spitfire Errata (#54 I think??), I discovered
+	 * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
+	 * number 103640.
+	 *
+	 * On Blackbird writes to %tick_cmpr can fail, the
+	 * workaround seems to be to execute the wr instruction
+	 * at the start of an I-cache line, and perform a dummy
+	 * read back from %tick_cmpr right after writing to it. -DaveM
+	 */
+	__asm__ __volatile__("
+		rd	%%tick, %%g1
+		ba,pt	%%xcc, 1f
+		 add	%%g1, %0, %%g1
+		.align	64
+	1:	wr	%%g1, 0x0, %%tick_cmpr
+		rd	%%tick_cmpr, %%g0"
+	: /* no outputs */
+	: "r" (current_tick_offset)
+	: "g1");
+
+	/* Restore PSTATE_IE. */
+	__asm__ __volatile__("wrpr	%0, 0x0, %%pstate"
 			     : /* no outputs */
-			     : "r" (current_tick_offset)
-			     : "g1");
+			     : "r" (pstate));
 }
 
 void __init smp_tick_init(void)
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/kernel/sys_sparc32.c linux/arch/sparc64/kernel/sys_sparc32.c
--- v2.3.48/linux/arch/sparc64/kernel/sys_sparc32.c	Sun Feb 20 21:12:38 2000
+++ linux/arch/sparc64/kernel/sys_sparc32.c	Thu Mar  2 11:36:42 2000
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.132 2000/02/16 07:31:35 davem Exp $
+/* $Id: sys_sparc32.c,v 1.133 2000/03/01 02:53:33 davem Exp $
  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -3086,7 +3086,10 @@
 	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
 	memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
 
+	lock_kernel();
 	dentry = open_namei(filename, 0, 0);
+	unlock_kernel();
+
 	retval = PTR_ERR(dentry);
 	if (IS_ERR(dentry))
 		return retval;
@@ -3097,11 +3100,15 @@
 	bprm.loader = 0;
 	bprm.exec = 0;
 	if ((bprm.argc = count32(argv)) < 0) {
+		lock_kernel();
 		dput(dentry);
+		unlock_kernel();
 		return bprm.argc;
 	}
 	if ((bprm.envc = count32(envp)) < 0) {
+		lock_kernel();
 		dput(dentry);
+		unlock_kernel();
 		return bprm.envc;
 	}
 
@@ -3129,8 +3136,11 @@
 
 out:
 	/* Something went wrong, return the inode and free the argument pages*/
-	if (bprm.dentry)
+	if (bprm.dentry) {
+		lock_kernel();
 		dput(bprm.dentry);
+		unlock_kernel();
+	}
 
 	for (i=0 ; i<MAX_ARG_PAGES ; i++)
 		if (bprm.page[i])
@@ -3154,7 +3164,6 @@
         if((u32)regs->u_regs[UREG_G1] == 0)
                 base = 1;
 
-	lock_kernel();
         filename = getname32((char *)AA(regs->u_regs[base + UREG_I0]));
 	error = PTR_ERR(filename);
         if(IS_ERR(filename))
@@ -3171,7 +3180,6 @@
 		regs->tstate &= ~TSTATE_PEF;
 	}
 out:
-	unlock_kernel();
         return error;
 }
 
diff -u --recursive --new-file v2.3.48/linux/arch/sparc64/kernel/time.c linux/arch/sparc64/kernel/time.c
--- v2.3.48/linux/arch/sparc64/kernel/time.c	Wed Dec 29 13:13:14 1999
+++ linux/arch/sparc64/kernel/time.c	Thu Mar  2 10:13:16 2000
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.23 1999/09/21 14:35:27 davem Exp $
+/* $Id: time.c,v 1.24 2000/03/02 02:00:25 davem Exp $
  * time.c: UltraSparc timer and TOD clock support.
  *
  * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -69,20 +69,53 @@
 
 static void timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
-	unsigned long ticks;
+	unsigned long ticks, pstate;
 
 	write_lock(&xtime_lock);
 
 	do {
 		do_timer(regs);
 
+		/* Guarentee that the following sequences execute
+		 * uninterrupted.
+		 */
+		__asm__ __volatile__("rdpr	%%pstate, %0\n\t"
+				     "wrpr	%0, %1, %%pstate"
+				     : "=r" (pstate)
+				     : "i" (PSTATE_IE));
+
+		/* Workaround for Spitfire Errata (#54 I think??), I discovered
+		 * this via Sun BugID 4008234, mentioned in Solaris-2.5.1 patch
+		 * number 103640.
+		 *
+		 * On Blackbird writes to %tick_cmpr can fail, the
+		 * workaround seems to be to execute the wr instruction
+		 * at the start of an I-cache line, and perform a dummy
+		 * read back from %tick_cmpr right after writing to it. -DaveM
+		 *
+		 * Just to be anal we add a workaround for Spitfire
+		 * Errata 50 by preventing pipeline bypasses on the
+		 * final read of the %tick register into a compare
+		 * instruction.  The Errata 50 description states
+		 * that %tick is not prone to this bug, but I am not
+		 * taking any chances.
+		 */
 		__asm__ __volatile__("
 			rd	%%tick_cmpr, %0
-			add	%0, %2, %0
-			wr	%0, 0, %%tick_cmpr
-			rd	%%tick, %1"
+			ba,pt	%%xcc, 1f
+			 add	%0, %2, %0
+			.align	64
+		     1: wr	%0, 0, %%tick_cmpr
+		        rd	%%tick_cmpr, %%g0
+			rd	%%tick, %1
+			mov	%1, %1"
 			: "=&r" (timer_tick_compare), "=r" (ticks)
 			: "r" (timer_tick_offset));
+
+		/* Restore PSTATE_IE. */
+		__asm__ __volatile__("wrpr	%0, 0x0, %%pstate"
+				     : /* no outputs */
+				     : "r" (pstate));
 	} while (ticks >= timer_tick_compare);
 
 	timer_check_rtc();
diff -u --recursive --new-file v2.3.48/linux/drivers/acorn/block/Makefile linux/drivers/acorn/block/Makefile
--- v2.3.48/linux/drivers/acorn/block/Makefile	Fri Oct 22 13:21:47 1999
+++ linux/drivers/acorn/block/Makefile	Mon Feb 28 14:16:37 2000
@@ -9,26 +9,45 @@
 # parent makefile.
 #
 
-L_TARGET := acorn-block.a
-L_OBJS   :=
-M_OBJS   :=
-MOD_LIST_NAME := ACORN_BLOCK_MODULES
-
-ifeq ($(CONFIG_BLK_DEV_FD1772),y)
-  L_OBJS += fd1772.o fd1772dma.o
-else
-  ifeq ($(CONFIG_BLK_DEV_FD1772),m)
-    M_OBJS += fd1772_mod.o
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_MFM),y)
-  L_OBJS += mfmhd.o mfm.o
-else
-  ifeq ($(CONFIG_BLK_DEV_MFM),m)
-    M_OBJS += mfmhd_mod.o
-  endif
-endif
+L_TARGET	:= acorn-block.a
+MOD_LIST_NAME	:= ACORN_BLOCK_MODULES
+
+obj-y		:=
+obj-m		:=
+obj-n		:=
+obj-		:=
+
+export-objs	:=
+list-multi	:= fd1772_mod.o mfmhd_mod.o
+fd1772_mod-objs	:= fd1772.o fd1772dma.o
+mfmhd_mod-objs	:= mfmhd.o mfm.o
+
+obj-$(CONFIG_BLK_DEV_FD1772)	+= fd1772_mod.o
+obj-$(CONFIG_BLK_DEV_MFM)	+= mfmhd.o mfm.o
+
+# Extract lists of the multi-part drivers.
+# The 'int-*' lists are intermediate files used to build the multi's.
+
+multi-y		:= $(filter $(list-multi), $(obj-y))
+multi-m		:= $(filter $(list-multi), $(obj-m))
+int-y		:= $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
+int-m		:= $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
+
+# Files that are both resident and modular; remove from modular.
+
+obj-m		:= $(filter-out $(obj-y), $(obj-m))
+int-m		:= $(filter-out $(int-y), $(int-m))
+
+# Take multi-part drivers out of obj-y and put components in.
+
+obj-y		:= $(filter-out $(list-multi), $(obj-y)) $(int-y)
+
+# Translate to Rules.make lists.
+
+L_OBJS		:= $(filter-out $(export-objs), $(obj-y))
+LX_OBJS		:= $(filter     $(export-objs), $(obj-y))
+M_OBJS		:= $(sort $(filter-out $(export-objs), $(obj-m)))
+MX_OBJS		:= $(sort $(filter     $(export-objs), $(obj-m)))
 
 include $(TOPDIR)/Rules.make
 
diff -u --recursive --new-file v2.3.48/linux/drivers/acorn/block/mfmhd.c linux/drivers/acorn/block/mfmhd.c
--- v2.3.48/linux/drivers/acorn/block/mfmhd.c	Wed Feb 16 17:03:51 2000
+++ linux/drivers/acorn/block/mfmhd.c	Mon Feb 28 14:16:37 2000
@@ -1280,7 +1280,6 @@
  * Set the CHS from the ADFS boot block if it is present.  This is not ideal
  * since if there are any non-ADFS partitions on the disk, this won't work!
  * Hence, I want to get rid of this...
- * 	Please, do. It does seriously sucking things.
  */
 void xd_set_geometry(kdev_t dev, unsigned char secsptrack, unsigned char heads,
 		     unsigned long discsize, unsigned int secsize)
diff -u --recursive --new-file v2.3.48/linux/drivers/acorn/char/Makefile linux/drivers/acorn/char/Makefile
--- v2.3.48/linux/drivers/acorn/char/Makefile	Thu Feb 10 17:11:06 2000
+++ linux/drivers/acorn/char/Makefile	Mon Feb 28 14:16:37 2000
@@ -10,37 +10,35 @@
 #
 
 O_TARGET 	:= acorn-char.o
-M_OBJS   	:=
-O_OBJS   	:= i2c.o pcf8583.o
 
-O_OBJS_arc	:= keyb_arc.o
-O_OBJS_a5k	:= keyb_arc.o
-O_OBJS_rpc	:= keyb_ps2.o
-
-ifeq ($(CONFIG_RPCMOUSE),y)
-  OX_OBJS += mouse_rpc.o
-else
-  ifeq ($(CONFIG_RPCSMOUSE),m)
-    MX_OBJS += mouse_rpc.o
-  endif
-endif
-
-ifeq ($(CONFIG_ATOMWIDE_SERIAL),y)
-  O_OBJS += serial-atomwide.o
-else
-  ifeq ($(CONFIG_ATOMWIDE_SERIAL),m)
-    O_OBJS += serial-atomwide.o
-  endif
-endif
-
-ifeq ($(CONFIG_DUALSP_SERIAL),y)
-  O_OBJS += serial-dualsp.o
-else
-  ifeq ($(CONFIG_DUALSP_SERIAL),m)
-    M_OBJS += serial-dualsp.o
-  endif
-endif
+O_OBJS		:=
+OX_OBJS		:=
+M_OBJS		:=
+MX_OBJS		:=
 
-O_OBJS += $(O_OBJS_$(MACHINE))
+# Object file lists.
+
+obj-y   	:= i2c.o pcf8583.o
+obj-m		:=
+obj-n		:=
+obj-		:=
+
+# All the objects that export symbols.
+export-objs	:= mouse_rpc.o
+
+obj-arc		:= keyb_arc.o
+obj-a5k		:= keyb_arc.o
+obj-rpc		:= keyb_ps2.o
+
+obj-$(CONFIG_RPCMOUSE)		+= mouse_rpc.o
+obj-$(CONFIG_ATOMWIDE_SERIAL)	+= serial-atomwide.o
+obj-$(CONFIG_DUALSP_SERIAL)	+= serial-dualsp.o
+
+obj-y		+= $(obj-$(MACHINE))
+
+O_OBJS		:= $(filter-out $(export-objs), $(obj-y))
+OX_OBJS		:= $(filter     $(export-objs), $(obj-y))
+M_OBJS		:= $(sort $(filter-out $(export-objs), $(obj-m)))
+MX_OBJS		:= $(sort $(filter     $(export-objs), $(obj-m)))
 
 include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.48/linux/drivers/acorn/net/Makefile linux/drivers/acorn/net/Makefile
--- v2.3.48/linux/drivers/acorn/net/Makefile	Sun Sep  6 10:46:07 1998
+++ linux/drivers/acorn/net/Makefile	Mon Feb 28 14:16:37 2000
@@ -4,32 +4,18 @@
 #
 
 L_TARGET := acorn-net.a
-L_OBJS   :=
-M_OBJS   :=
 MOD_LIST_NAME := ACORN_NET_MODULES
 
-ifeq ($(CONFIG_ARM_ETHER1),y)
-  L_OBJS += ether1.o
-else
-  ifeq ($(CONFIG_ARM_ETHER1),m)
-    M_OBJS += ether1.o
-  endif
-endif
+obj-y	:=
+obj-m	:=
+obj-n	:=
+obj-	:=
 
-ifeq ($(CONFIG_ARM_ETHER3),y)
-  L_OBJS += ether3.o
-else
-  ifeq ($(CONFIG_ARM_ETHER3),m)
-    M_OBJS += ether3.o
-  endif
-endif
+obj-$(CONFIG_ARM_ETHER1)	+= ether1.o
+obj-$(CONFIG_ARM_ETHER3)	+= ether3.o
+obj-$(CONFIG_ARM_ETHERH)	+= etherh.o
 
-ifeq ($(CONFIG_ARM_ETHERH),y)
-  L_OBJS += etherh.o
-else
-  ifeq ($(CONFIG_ARM_ETHERH),m)
-    M_OBJS += etherh.o
-  endif
-endif
+L_OBJS	:= $(obj-y)
+M_OBJS	:= $(obj-m)
 
 include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.48/linux/drivers/acorn/scsi/Makefile linux/drivers/acorn/scsi/Makefile
--- v2.3.48/linux/drivers/acorn/scsi/Makefile	Fri Oct 22 13:21:47 1999
+++ linux/drivers/acorn/scsi/Makefile	Mon Feb 28 14:16:37 2000
@@ -2,109 +2,50 @@
 # Makefile for drivers/acorn/scsi
 #
 
-L_TARGET := acorn-scsi.a
-L_OBJS   :=
-LX_OBJS  :=
-M_OBJS   :=
-MX_OBJS  :=
-MOD_LIST_NAME := ACORN_SCSI_MODULES
-
-CONFIG_QUEUE_BUILTIN :=
-CONFIG_FAS216_BUILTIN :=
-CONFIG_QUEUE_MODULE :=
-CONFIG_FAS216_MODULE :=
-
-ifeq ($(CONFIG_SCSI_ACORNSCSI_3),y)
-  L_OBJS += acornscsi.o acornscsi-io.o
-  CONFIG_QUEUE_BUILTIN=y
-else
-  ifeq ($(CONFIG_SCSI_ACORNSCSI_3),m)
-    M_OBJS += acornscsi_mod.o
-    CONFIG_QUEUE_MODULE=y
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_ARXESCSI),y)
-  L_OBJS += arxescsi.o
-  CONFIG_FAS216_BUILTIN=y
-else
-  ifeq ($(CONFIG_SCSI_ARXESCSI),m)
-    M_OBJS += arxescsi.o
-    CONFIG_FAS216_MODULE=y
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_CUMANA_1),y)
-  L_OBJS += cumana_1.o
-else
-  ifeq ($(CONFIG_SCSI_CUMANA_1),m)
-    M_OBJS += cumana_1.o
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_CUMANA_2),y)
-  L_OBJS += cumana_2.o
-  CONFIG_FAS216_BUILTIN=y
-else
-  ifeq ($(CONFIG_SCSI_CUMANA_2),m)
-    M_OBJS += cumana_2.o
-    CONFIG_FAS216_MODULE=y
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_ECOSCSI),y)
-  L_OBJS += ecoscsi.o
-else
-  ifeq ($(CONFIG_SCSI_ECOSCSI),m)
-    M_OBJS += ecoscsi.o
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_OAK1),y)
-  L_OBJS += oak.o
-else
-  ifeq ($(CONFIG_SCSI_OAK1),m)
-    M_OBJS += oak.o
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_POWERTECSCSI),y)
-  L_OBJS += powertec.o
-  CONFIG_FAS216_BUILTIN=y
-else
-  ifeq ($(CONFIG_SCSI_POWERTECSCSI),m)
-    M_OBJS += powertec.o
-    CONFIG_FAS216_MODULE=y
-  endif
-endif
-
-ifeq ($(CONFIG_SCSI_EESOXSCSI),y)
-  L_OBJS += eesox.o
-  CONFIG_FAS216_BUILTIN=y
-else
-  ifeq ($(CONFIG_SCSI_EESOXSCSI),m)
-    M_OBJS += eesox.o
-    CONFIG_FAS216_MODULE=y
-  endif
-endif
-
-ifeq ($(CONFIG_FAS216_BUILTIN),y)
-  LX_OBJS += fas216.o
-  CONFIG_QUEUE_BUILTIN=y
-else
-  ifeq ($(CONFIG_FAS216_MODULE),y)
-    MX_OBJS += fas216.o
-    CONFIG_QUEUE_MODULE=y
-  endif
-endif
-
-ifeq ($(CONFIG_QUEUE_BUILTIN),y)
-  LX_OBJS += queue.o msgqueue.o
-else
-  ifeq ($(CONFIG_QUEUE_MODULE),y)
-    MX_OBJS += queue.o msgqueue.o
-  endif
-endif
+L_TARGET	:= acorn-scsi.a
+MOD_LIST_NAME	:= ACORN_SCSI_MODULES
+
+obj-y		:=
+obj-m		:=
+obj-n		:=
+obj-		:=
+
+export-objs		:= fas216.o queue.o msgqueue.o
+list-multi		:= acornscsi_mod.o
+acornscsi_mod-objs	:= acornscsi.o acornscsi-io.o
+
+obj-$(CONFIG_SCSI_ACORNSCSI_3)	+= acornscsi_mod.o queue.o msgqueue.o
+obj-$(CONFIG_SCSI_ARXESCSI)	+= arxescsi.o fas216.o queue.o msgqueue.o
+obj-$(CONFIG_SCSI_CUMANA_1)	+= cumana_1.o
+obj-$(CONFIG_SCSI_CUMANA_2)	+= cumana_2.o fas216.o queue.o msgqueue.o
+obj-$(CONFIG_SCSI_ECOSCSI)	+= ecoscsi.o
+obj-$(CONFIG_SCSI_OAK1)		+= oak.o
+obj-$(CONFIG_SCSI_POWERTECSCSI)	+= powertec.o fas216.o queue.o msgqueue.o
+obj-$(CONFIG_SCSI_EESOXSCSI)	+= eesox.o fas216.o queue.o msgqueue.o
+
+# Extract lists of the multi-part drivers.
+# The 'int-*' lists are intermediate files used to build the multi's.
+
+multi-y		:= $(filter $(list-multi), $(obj-y))
+multi-m		:= $(filter $(list-multi), $(obj-m))
+int-y		:= $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
+int-m		:= $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
+
+# Files that are both resident and modular; remove from modular.
+
+obj-m		:= $(filter-out $(obj-y), $(obj-m))
+int-m		:= $(filter-out $(int-y), $(int-m))
+
+# Take multi-part drivers out of obj-y and put components in.
+
+obj-y		:= $(filter-out $(list-multi), $(obj-y)) $(int-y)
+
+# Translate to Rules.make lists.
+
+L_OBJS		:= $(filter-out $(export-objs), $(obj-y))
+LX_OBJS		:= $(filter     $(export-objs), $(obj-y))
+M_OBJS		:= $(sort $(filter-out $(export-objs), $(obj-m)))
+MX_OBJS		:= $(sort $(filter     $(export-objs), $(obj-m)))
 
 include $(TOPDIR)/Rules.make
 
diff -u --recursive --new-file v2.3.48/linux/drivers/acorn/scsi/arxescsi.c linux/drivers/acorn/scsi/arxescsi.c
--- v2.3.48/linux/drivers/acorn/scsi/arxescsi.c	Thu Nov 11 20:11:32 1999
+++ linux/drivers/acorn/scsi/arxescsi.c	Mon Feb 28 07:16:54 2000
@@ -24,8 +24,8 @@
 #include <linux/proc_fs.h>
 #include <linux/unistd.h>
 #include <linux/stat.h>
+#include <linux/delay.h>
 
-#include <asm/delay.h>
 #include <asm/dma.h>
 #include <asm/io.h>
 #include <asm/irq.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/block/Config.in linux/drivers/block/Config.in
--- v2.3.48/linux/drivers/block/Config.in	Sat Feb 26 22:31:43 2000
+++ linux/drivers/block/Config.in	Thu Mar  2 11:32:37 2000
@@ -27,6 +27,7 @@
    if [ "$CONFIG_BLK_DEV_IDEDISK" != "n" ]; then
       bool '    Use multi-mode by default' CONFIG_IDEDISK_MULTI_MODE
    fi
+   dep_tristate '  PCMCIA IDE support' CONFIG_BLK_DEV_IDECS $CONFIG_BLK_DEV_IDE $CONFIG_PCMCIA
    dep_tristate '  Include IDE/ATAPI CDROM support' CONFIG_BLK_DEV_IDECD $CONFIG_BLK_DEV_IDE
    dep_tristate '  Include IDE/ATAPI TAPE support' CONFIG_BLK_DEV_IDETAPE $CONFIG_BLK_DEV_IDE
    dep_tristate '  Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
diff -u --recursive --new-file v2.3.48/linux/drivers/block/DAC960.c linux/drivers/block/DAC960.c
--- v2.3.48/linux/drivers/block/DAC960.c	Sun Feb 20 21:12:38 2000
+++ linux/drivers/block/DAC960.c	Mon Feb 28 07:16:54 2000
@@ -3583,7 +3583,7 @@
 
 int init_module(void)
 {
-  int ControllerNumber, LogicalDriveNumber;
+  int ControllerNumber;
   DAC960_Initialize();
   if (DAC960_ActiveControllerCount == 0) return -1;
   for (ControllerNumber = 0;
diff -u --recursive --new-file v2.3.48/linux/drivers/block/Makefile linux/drivers/block/Makefile
--- v2.3.48/linux/drivers/block/Makefile	Sat Feb 26 22:31:43 2000
+++ linux/drivers/block/Makefile	Thu Mar  2 11:32:37 2000
@@ -262,6 +262,14 @@
 
 ############
 
+ifeq ($(CONFIG_BLK_DEV_IDECS),y)
+L_OBJS += ide-cs.o
+else
+  ifeq ($(CONFIG_BLK_DEV_IDECS),m)
+  M_OBJS += ide-cs.o
+  endif
+endif
+
 ifeq ($(CONFIG_BLK_DEV_IDEDISK),y)
 L_OBJS += ide-disk.o
 else
diff -u --recursive --new-file v2.3.48/linux/drivers/block/amd7409.c linux/drivers/block/amd7409.c
--- v2.3.48/linux/drivers/block/amd7409.c	Sat Feb 26 22:31:43 2000
+++ linux/drivers/block/amd7409.c	Mon Feb 28 07:18:20 2000
@@ -6,6 +6,7 @@
  *
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/block/cmd64x.c linux/drivers/block/cmd64x.c
--- v2.3.48/linux/drivers/block/cmd64x.c	Sat Feb 26 22:31:43 2000
+++ linux/drivers/block/cmd64x.c	Mon Feb 28 07:18:20 2000
@@ -11,6 +11,7 @@
  * Copyright (C) 1999-2000  Andre Hedrick (andre@suse.com)
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/block/cpqarray.h linux/drivers/block/cpqarray.h
--- v2.3.48/linux/drivers/block/cpqarray.h	Tue Jul  6 10:11:40 1999
+++ linux/drivers/block/cpqarray.h	Tue Feb 29 11:46:16 2000
@@ -30,7 +30,7 @@
 #include <linux/locks.h>
 #include <linux/malloc.h>
 #include <linux/proc_fs.h>
-#include <linux/md.h>
+#include <linux/raid/md.h>
 #include <linux/timer.h>
 #endif
 
diff -u --recursive --new-file v2.3.48/linux/drivers/block/cs5530.c linux/drivers/block/cs5530.c
--- v2.3.48/linux/drivers/block/cs5530.c	Sat Feb 26 22:31:43 2000
+++ linux/drivers/block/cs5530.c	Mon Feb 28 07:18:20 2000
@@ -8,6 +8,7 @@
  * by the nice folks at National Semiconductor.
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/block/ide-cs.c linux/drivers/block/ide-cs.c
--- v2.3.48/linux/drivers/block/ide-cs.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/block/ide-cs.c	Thu Mar  2 11:32:37 2000
@@ -0,0 +1,481 @@
+/*======================================================================
+
+    A driver for PCMCIA IDE/ATA disk cards
+
+    ide_cs.c 1.26 1999/11/16 02:10:49
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is David A. Hinds
+    <dhinds@pcmcia.sourceforge.org>.  Portions created by David A. Hinds
+    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU Public License version 2 (the "GPL"), in which
+    case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+    
+======================================================================*/
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/ptrace.h>
+#include <linux/malloc.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/ioport.h>
+#include <linux/hdreg.h>
+#include <linux/major.h>
+
+#include <asm/io.h>
+#include <asm/system.h>
+
+#include <pcmcia/version.h>
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/ds.h>
+#include <pcmcia/cisreg.h>
+
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"ide_cs.c 1.26 1999/11/16 02:10:49 (David Hinds)";
+#else
+#define DEBUG(n, args...)
+#endif
+
+/*====================================================================*/
+
+/* Parameters that can be set with 'insmod' */
+
+/* Bit map of interrupts to choose from */
+static u_int irq_mask = 0xdeb8;
+static int irq_list[4] = { -1 };
+
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+
+/*====================================================================*/
+
+static const char ide_major[] = {
+    IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR,
+#ifdef IDE4_MAJOR
+    IDE4_MAJOR, IDE5_MAJOR
+#endif
+};
+
+typedef struct ide_info_t {
+    dev_link_t	link;
+    int		ndev;
+    dev_node_t	node;
+    int		hd;
+} ide_info_t;
+
+static void ide_config(dev_link_t *link);
+static void ide_release(u_long arg);
+static int ide_event(event_t event, int priority,
+		     event_callback_args_t *args);
+
+static dev_info_t dev_info = "ide_cs";
+
+static dev_link_t *ide_attach(void);
+static void ide_detach(dev_link_t *);
+
+static dev_link_t *dev_list = NULL;
+
+/*====================================================================*/
+
+static void cs_error(client_handle_t handle, int func, int ret)
+{
+    error_info_t err = { func, ret };
+    CardServices(ReportError, handle, &err);
+}
+
+/*======================================================================
+
+    ide_attach() creates an "instance" of the driver, allocating
+    local data structures for one device.  The device is registered
+    with Card Services.
+
+======================================================================*/
+
+static dev_link_t *ide_attach(void)
+{
+    ide_info_t *info;
+    dev_link_t *link;
+    client_reg_t client_reg;
+    int i, ret;
+    
+    DEBUG(0, "ide_attach()\n");
+
+    /* Create new ide device */
+    info = kmalloc(sizeof(*info), GFP_KERNEL);
+    if (!info) return NULL;
+    memset(info, 0, sizeof(*info));
+    link = &info->link; link->priv = info;
+
+    link->release.function = &ide_release;
+    link->release.data = (u_long)link;
+    link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
+    link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
+    link->io.IOAddrLines = 3;
+    link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
+    link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID;
+    if (irq_list[0] == -1)
+	link->irq.IRQInfo2 = irq_mask;
+    else
+	for (i = 0; i < 4; i++)
+	    link->irq.IRQInfo2 |= 1 << irq_list[i];
+    link->conf.Attributes = CONF_ENABLE_IRQ;
+    link->conf.Vcc = 50;
+    link->conf.IntType = INT_MEMORY_AND_IO;
+    
+    /* Register with Card Services */
+    link->next = dev_list;
+    dev_list = link;
+    client_reg.dev_info = &dev_info;
+    client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+    client_reg.EventMask =
+	CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+	CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+	CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+    client_reg.event_handler = &ide_event;
+    client_reg.Version = 0x0210;
+    client_reg.event_callback_args.client_data = link;
+    ret = CardServices(RegisterClient, &link->handle, &client_reg);
+    if (ret != CS_SUCCESS) {
+	cs_error(link->handle, RegisterClient, ret);
+	ide_detach(link);
+	return NULL;
+    }
+    
+    return link;
+} /* ide_attach */
+
+/*======================================================================
+
+    This deletes a driver "instance".  The device is de-registered
+    with Card Services.  If it has been released, all local data
+    structures are freed.  Otherwise, the structures will be freed
+    when the device is released.
+
+======================================================================*/
+
+static void ide_detach(dev_link_t *link)
+{
+    dev_link_t **linkp;
+    long flags;
+    int ret;
+
+    DEBUG(0, "ide_detach(0x%p)\n", link);
+    
+    /* Locate device structure */
+    for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+	if (*linkp == link) break;
+    if (*linkp == NULL)
+	return;
+
+    save_flags(flags);
+    cli();
+    if (link->state & DEV_RELEASE_PENDING) {
+	del_timer(&link->release);
+	link->state &= ~DEV_RELEASE_PENDING;
+    }
+    restore_flags(flags);
+    
+    if (link->state & DEV_CONFIG)
+	ide_release((u_long)link);
+    
+    if (link->handle) {
+	ret = CardServices(DeregisterClient, link->handle);
+	if (ret != CS_SUCCESS)
+	    cs_error(link->handle, DeregisterClient, ret);
+    }
+    
+    /* Unlink, free device structure */
+    *linkp = link->next;
+    kfree(link->priv);
+    
+} /* ide_detach */
+
+/*======================================================================
+
+    ide_config() is scheduled to run after a CARD_INSERTION event
+    is received, to configure the PCMCIA socket, and to make the
+    ide device available to the system.
+
+======================================================================*/
+
+#define CS_CHECK(fn, args...) \
+while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
+
+#define CFG_CHECK(fn, args...) \
+if (CardServices(fn, args) != 0) goto next_entry
+
+void ide_config(dev_link_t *link)
+{
+    client_handle_t handle = link->handle;
+    ide_info_t *info = link->priv;
+    tuple_t tuple;
+    u_short buf[128];
+    cisparse_t parse;
+    config_info_t conf;
+    cistpl_cftable_entry_t *cfg = &parse.cftable_entry;
+    cistpl_cftable_entry_t dflt = { 0 };
+    int i, pass, last_ret, last_fn, hd, io_base, ctl_base;
+
+    DEBUG(0, "ide_config(0x%p)\n", link);
+    
+    tuple.TupleData = (cisdata_t *)buf;
+    tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
+    tuple.Attributes = 0;
+    tuple.DesiredTuple = CISTPL_CONFIG;
+    CS_CHECK(GetFirstTuple, handle, &tuple);
+    CS_CHECK(GetTupleData, handle, &tuple);
+    CS_CHECK(ParseTuple, handle, &tuple, &parse);
+    link->conf.ConfigBase = parse.config.base;
+    link->conf.Present = parse.config.rmask[0];
+    
+    /* Configure card */
+    link->state |= DEV_CONFIG;
+
+    /* Not sure if this is right... look up the current Vcc */
+    CS_CHECK(GetConfigurationInfo, handle, &conf);
+    link->conf.Vcc = conf.Vcc;
+    
+    pass = io_base = ctl_base = 0;
+    tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
+    tuple.Attributes = 0;
+    CS_CHECK(GetFirstTuple, handle, &tuple);
+    while (1) {
+	CFG_CHECK(GetTupleData, handle, &tuple);
+	CFG_CHECK(ParseTuple, handle, &tuple, &parse);
+
+	/* Check for matching Vcc, unless we're desperate */
+	if (!pass) {
+	    if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
+		if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
+		    goto next_entry;
+	    } else if (dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) {
+		if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM]/10000)
+		    goto next_entry;
+	    }
+	}
+	
+	if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
+	    link->conf.Vpp1 = link->conf.Vpp2 =
+		cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
+	else if (dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
+	    link->conf.Vpp1 = link->conf.Vpp2 =
+		dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
+	
+	if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
+	    cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
+	    link->conf.ConfigIndex = cfg->index;
+	    link->io.BasePort1 = io->win[0].base;
+	    link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
+	    if (!(io->flags & CISTPL_IO_16BIT))
+		link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+	    if (io->nwin == 2) {
+		link->io.NumPorts1 = 8;
+		link->io.BasePort2 = io->win[1].base;
+		link->io.NumPorts2 = 1;
+		CFG_CHECK(RequestIO, link->handle, &link->io);
+		io_base = link->io.BasePort1;
+		ctl_base = link->io.BasePort2;
+	    } else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
+		link->io.NumPorts1 = io->win[0].len;
+		link->io.NumPorts2 = 0;
+		CFG_CHECK(RequestIO, link->handle, &link->io);
+		io_base = link->io.BasePort1;
+		ctl_base = link->io.BasePort1+0x0e;
+	    } else goto next_entry;
+	    /* If we've got this far, we're done */
+	    break;
+	}
+	
+    next_entry:
+	if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
+	if (pass) {
+	    CS_CHECK(GetNextTuple, handle, &tuple);
+	} else if (CardServices(GetNextTuple, handle, &tuple) != 0) {
+	    CS_CHECK(GetFirstTuple, handle, &tuple);
+	    memset(&dflt, 0, sizeof(dflt));
+	    pass++;
+	}
+    }
+    
+    CS_CHECK(RequestIRQ, handle, &link->irq);
+    CS_CHECK(RequestConfiguration, handle, &link->conf);
+
+    /* deal with brain dead IDE resource management */
+    release_region(link->io.BasePort1, link->io.NumPorts1);
+    if (link->io.NumPorts2)
+	release_region(link->io.BasePort2, link->io.NumPorts2);
+
+    /* retry registration in case device is still spinning up */
+    for (i = 0; i < 10; i++) {
+	hd = ide_register(io_base, ctl_base, link->irq.AssignedIRQ);
+	if (hd >= 0) break;
+	if (link->io.NumPorts1 == 0x20) {
+	    hd = ide_register(io_base+0x10, ctl_base+0x10,
+			      link->irq.AssignedIRQ);
+	    if (hd >= 0) {
+		io_base += 0x10; ctl_base += 0x10;
+		break;
+	    }
+	}
+	__set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(HZ/10);
+    }
+    
+    if (hd < 0) {
+	printk(KERN_NOTICE "ide_cs: ide_register() at 0x%3x & 0x%3x"
+	       ", irq %u failed\n", io_base, ctl_base,
+	       link->irq.AssignedIRQ);
+	goto failed;
+    }
+
+    MOD_INC_USE_COUNT;
+    info->ndev = 1;
+    sprintf(info->node.dev_name, "hd%c", 'a'+(hd*2));
+    info->node.major = ide_major[hd];
+    info->node.minor = 0;
+    info->hd = hd;
+    link->dev = &info->node;
+    printk(KERN_INFO "ide_cs: %s: Vcc = %d.%d, Vpp = %d.%d\n",
+	   info->node.dev_name, link->conf.Vcc/10, link->conf.Vcc%10,
+	   link->conf.Vpp1/10, link->conf.Vpp1%10);
+
+    link->state &= ~DEV_CONFIG_PENDING;
+    return;
+    
+cs_failed:
+    cs_error(link->handle, last_fn, last_ret);
+failed:
+    ide_release((u_long)link);
+
+} /* ide_config */
+
+/*======================================================================
+
+    After a card is removed, ide_release() will unregister the net
+    device, and release the PCMCIA configuration.  If the device is
+    still open, this will be postponed until it is closed.
+    
+======================================================================*/
+
+void ide_release(u_long arg)
+{
+    dev_link_t *link = (dev_link_t *)arg;
+    ide_info_t *info = link->priv;
+    
+    DEBUG(0, "ide_release(0x%p)\n", link);
+
+    if (info->ndev) {
+	ide_unregister(info->hd);
+	MOD_DEC_USE_COUNT;
+    }
+    info->ndev = 0;
+    link->dev = NULL;
+    
+    CardServices(ReleaseConfiguration, link->handle);
+    CardServices(ReleaseIO, link->handle, &link->io);
+    CardServices(ReleaseIRQ, link->handle, &link->irq);
+    
+    link->state &= ~DEV_CONFIG;
+
+} /* ide_release */
+
+/*======================================================================
+
+    The card status event handler.  Mostly, this schedules other
+    stuff to run after an event is received.  A CARD_REMOVAL event
+    also sets some flags to discourage the ide drivers from
+    talking to the ports.
+    
+======================================================================*/
+
+int ide_event(event_t event, int priority,
+	      event_callback_args_t *args)
+{
+    dev_link_t *link = args->client_data;
+
+    DEBUG(1, "ide_event(0x%06x)\n", event);
+    
+    switch (event) {
+    case CS_EVENT_CARD_REMOVAL:
+	link->state &= ~DEV_PRESENT;
+	if (link->state & DEV_CONFIG) {
+	    link->release.expires = jiffies + HZ/20;
+	    link->state |= DEV_RELEASE_PENDING;
+	    add_timer(&link->release);
+	}
+	break;
+    case CS_EVENT_CARD_INSERTION:
+	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+	ide_config(link);
+	break;
+    case CS_EVENT_PM_SUSPEND:
+	link->state |= DEV_SUSPEND;
+	/* Fall through... */
+    case CS_EVENT_RESET_PHYSICAL:
+	if (link->state & DEV_CONFIG)
+	    CardServices(ReleaseConfiguration, link->handle);
+	break;
+    case CS_EVENT_PM_RESUME:
+	link->state &= ~DEV_SUSPEND;
+	/* Fall through... */
+    case CS_EVENT_CARD_RESET:
+	if (DEV_OK(link))
+	    CardServices(RequestConfiguration, link->handle, &link->conf);
+	break;
+    }
+    return 0;
+} /* ide_event */
+
+/*====================================================================*/
+
+static int __init init_ide_cs(void)
+{
+    servinfo_t serv;
+    DEBUG(0, "%s\n", version);
+    CardServices(GetCardServicesInfo, &serv);
+    if (serv.Revision != CS_RELEASE_CODE) {
+	printk(KERN_NOTICE "ide_cs: Card Services release "
+	       "does not match!\n");
+	return -1;
+    }
+    register_pccard_driver(&dev_info, &ide_attach, &ide_detach);
+    return 0;
+}
+
+static void __exit exit_ide_cs(void)
+{
+    DEBUG(0, "ide_cs: unloading\n");
+    unregister_pccard_driver(&dev_info);
+    while (dev_list != NULL)
+	ide_detach(dev_list);
+}
+
+module_init(init_ide_cs);
+module_exit(exit_ide_cs);
diff -u --recursive --new-file v2.3.48/linux/drivers/block/ide-pci.c linux/drivers/block/ide-pci.c
--- v2.3.48/linux/drivers/block/ide-pci.c	Sat Feb 26 22:31:43 2000
+++ linux/drivers/block/ide-pci.c	Mon Feb 28 07:20:23 2000
@@ -243,9 +243,12 @@
 
 #ifdef CONFIG_BLK_DEV_SL82C105
 extern void ide_init_sl82c105(ide_hwif_t *);
+extern void ide_dmacapable_sl82c105(ide_hwif_t *, unsigned long);
 #define INIT_W82C105	&ide_init_sl82c105
+#define DMA_W82C105	&ide_dmacapable_sl82c105
 #else
 #define INIT_W82C105	IDE_IGNORE
+#define DMA_W82C105	NULL
 #endif
 
 #ifdef CONFIG_BLK_DEV_TRM290
@@ -316,7 +319,7 @@
 	{DEVID_TRM290,	"TRM290",	NULL,		NULL,		INIT_TRM290,	NULL,		{{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 	ON_BOARD,	0 },
 	{DEVID_NS87415,	"NS87415",	NULL,		NULL,		INIT_NS87415,	NULL,		{{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 	ON_BOARD,	0 },
 	{DEVID_AEC6210,	"AEC6210",	PCI_AEC6210,	NULL,		INIT_AEC6210,	DMA_AEC6210,	{{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 	OFF_BOARD,	0 },
-	{DEVID_W82C105,	"W82C105",	NULL,		NULL,		INIT_W82C105,	NULL,		{{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 	ON_BOARD,	0 },
+	{DEVID_W82C105,	"W82C105",	NULL,		NULL,		INIT_W82C105,	DMA_W82C105,	{{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 	ON_BOARD,	0 },
 	{DEVID_UM8673F,	"UM8673F",	NULL,		NULL,		NULL,		NULL,		{{0x00,0x00,0x00}, {0x00,0x00,0x00}},	ON_BOARD,	0 },
 	{DEVID_UM8886A,	"UM8886A",	NULL,		NULL,		NULL,		NULL,		{{0x00,0x00,0x00}, {0x00,0x00,0x00}},	ON_BOARD,	0 },
 	{DEVID_UM8886BF,"UM8886BF",	NULL,		NULL,		NULL,		NULL,		{{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 	ON_BOARD,	0 },
diff -u --recursive --new-file v2.3.48/linux/drivers/block/piix.c linux/drivers/block/piix.c
--- v2.3.48/linux/drivers/block/piix.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/block/piix.c	Mon Feb 28 07:16:54 2000
@@ -85,8 +85,8 @@
 #include <linux/pci.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
+#include <linux/delay.h>
 
-#include <asm/delay.h>
 #include <asm/io.h>
 
 #include "ide_modes.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/block/rd.c linux/drivers/block/rd.c
--- v2.3.48/linux/drivers/block/rd.c	Wed Feb 16 17:03:51 2000
+++ linux/drivers/block/rd.c	Thu Mar  2 11:33:45 2000
@@ -87,7 +87,7 @@
 static int crd_load(struct file *fp, struct file *outfp);
 
 #ifdef CONFIG_BLK_DEV_INITRD
-static int initrd_users = 0;
+static int initrd_users;
 #endif
 #endif
 
@@ -122,13 +122,13 @@
 
 #ifndef MODULE
 
-int rd_doload = 0;		/* 1 = load RAM disk, 0 = don't load */
+int rd_doload;			/* 1 = load RAM disk, 0 = don't load */
 int rd_prompt = 1;		/* 1 = prompt for RAM disk, 0 = don't prompt */
-int rd_image_start = 0;		/* starting block # of image */
+int rd_image_start;		/* starting block # of image */
 #ifdef CONFIG_BLK_DEV_INITRD
-unsigned long initrd_start,initrd_end;
+unsigned long initrd_start, initrd_end;
 int mount_initrd = 1;		/* zero if initrd should not be mounted */
-int initrd_below_start_ok = 0;
+int initrd_below_start_ok;
 
 static int __init no_initrd(char *str)
 {
@@ -293,11 +293,15 @@
 
 	switch (cmd) {
 		case BLKFLSBUF:
-			if (!capable(CAP_SYS_ADMIN)) return -EACCES;
+			if (!capable(CAP_SYS_ADMIN))
+				return -EACCES;
 			/* special: we want to release the ramdisk memory,
 			   it's not like with the other blockdevices where
 			   this ioctl only flushes away the buffer cache. */
+			if ((atomic_read(&inode->i_bdev->bd_openers) > 2))
+				return -EBUSY;
 			destroy_buffers(inode->i_rdev);
+			rd_blocksizes[minor] = 0;
 			break;
 
          	case BLKGETSIZE:   /* Return device size */
@@ -338,6 +342,8 @@
 	extern void free_initrd_mem(unsigned long, unsigned long);
 
 	if (--initrd_users) return 0;
+	blkdev_put(inode->i_bdev, BDEV_FILE);
+	iput(inode);
 	free_initrd_mem(initrd_start, initrd_end);
 	initrd_start = 0;
 	return 0;
@@ -366,7 +372,6 @@
 	if (DEVICE_NR(inode->i_rdev) >= NUM_RAMDISKS)
 		return -ENXIO;
 
-	filp->f_op = &def_blk_fops;
 	MOD_INC_USE_COUNT;
 
 	return 0;
@@ -389,12 +394,18 @@
 {
 	int i;
 
-	for (i = 0 ; i < NUM_RAMDISKS; i++)
+	for (i = 0 ; i < NUM_RAMDISKS; i++) {
+		struct block_device *bdev;
+		bdev = bdget(kdev_t_to_nr(MKDEV(MAJOR_NR,i)));
+		atomic_dec(&bdev->bd_openers);
 		destroy_buffers(MKDEV(MAJOR_NR, i));
+	}
 
 	devfs_unregister (devfs_handle);
 	unregister_blkdev( MAJOR_NR, "ramdisk" );
 	blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
+	blksize_size[MAJOR_NR] = NULL;
+	blk_size[MAJOR_NR] = NULL;
 }
 
 /* This is the registration and initialization section of the RAM disk driver */
@@ -432,16 +443,21 @@
 
 	hardsect_size[MAJOR_NR] = rd_hardsec;		/* Size of the RAM disk blocks */
 	blksize_size[MAJOR_NR] = rd_blocksizes;		/* Avoid set_blocksize() check */
-	blk_size[MAJOR_NR] = rd_kbsize;			/* Size of the RAM disk in kB  */
 
-	for (i = 0; i < NUM_RAMDISKS; i++)
+	for (i = 0; i < NUM_RAMDISKS; i++) {
+		struct block_device *bdev;
 		register_disk(NULL, MKDEV(MAJOR_NR,i), 1, &fd_fops, rd_size<<1);
+		bdev = bdget(kdev_t_to_nr(MKDEV(MAJOR_NR,i)));
+		atomic_inc(&bdev->bd_openers);  /* avoid invalidate_buffers() */
+	}
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	/* We ought to separate initrd operations here */
 	register_disk(NULL, MKDEV(MAJOR_NR,INITRD_MINOR), 1, &fd_fops, rd_size<<1);
 #endif
 
+	blk_size[MAJOR_NR] = rd_kbsize;			/* Size of the RAM disk in kB  */
+
 		/* rd_size is given in kB */
 	printk("RAMDISK driver initialized: "
 	       "%d RAM disks of %dK size %d blocksize\n",
@@ -584,26 +600,28 @@
 
 	ram_device = MKDEV(MAJOR_NR, unit);
 
+	if ((inode = get_empty_inode()) == NULL)
+		return;
 	memset(&infile, 0, sizeof(infile));
 	memset(&in_dentry, 0, sizeof(in_dentry));
-	inode = get_empty_inode();
-	inode->i_rdev = device;
-	inode->i_bdev = bdget(kdev_t_to_nr(device));
 	infile.f_mode = 1; /* read only */
 	infile.f_dentry = &in_dentry;
 	in_dentry.d_inode = inode;
+	infile.f_op = &def_blk_fops;
+	init_special_inode(inode, S_IFBLK | S_IRUSR, kdev_t_to_nr(device));
 
+	if ((out_inode = get_empty_inode()) == NULL)
+		goto free_inode;
 	memset(&outfile, 0, sizeof(outfile));
 	memset(&out_dentry, 0, sizeof(out_dentry));
-	out_inode = get_empty_inode();
-	out_inode->i_rdev = ram_device;
-	out_inode->i_bdev = bdget(kdev_t_to_nr(ram_device));
 	outfile.f_mode = 3; /* read/write */
 	outfile.f_dentry = &out_dentry;
 	out_dentry.d_inode = out_inode;
+	outfile.f_op = &def_blk_fops;
+	init_special_inode(out_inode, S_IFBLK | S_IRUSR | S_IWUSR, kdev_t_to_nr(ram_device));
 
 	if (blkdev_open(inode, &infile) != 0)
-		goto free_inodes;
+		goto free_inode;
 	if (blkdev_open(out_inode, &outfile) != 0)
 		goto free_inodes;
 
@@ -697,9 +715,12 @@
 	if (infile.f_op->release)
 		infile.f_op->release(inode, &infile);
 	set_fs(fs);
-free_inodes:
-	iput(inode);
+	return;
+free_inodes: /* free inodes on error */ 
 	iput(out_inode);
+	blkdev_put(inode->i_bdev, BDEV_FILE);
+free_inode:
+	iput(inode);
 }
 
 
diff -u --recursive --new-file v2.3.48/linux/drivers/block/sl82c105.c linux/drivers/block/sl82c105.c
--- v2.3.48/linux/drivers/block/sl82c105.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/block/sl82c105.c	Mon Feb 28 07:20:23 2000
@@ -26,6 +26,8 @@
 
 #include "ide_modes.h"
 
+extern char *ide_xfer_verbose (byte xfer_rate);
+
 #ifdef CONFIG_ARCH_NETWINDER
 /*
  * Convert a PIO mode and cycle time to the required on/off
@@ -50,42 +52,7 @@
 	if (cmd_off == 0)
 		cmd_off = 1;
 
-	return (cmd_on - 1) << 8 | (cmd_off - 1);
-}
-
-/*
- * Tell the drive to enable the specified PIO mode.
- * This should be in ide.c, maybe as a special command
- * (see do_special).
- */
-static int ide_set_drive_pio_mode(ide_drive_t *drive, byte pio)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	ide_startstop_t startstop;
-
-	if (pio > 2) {
-		/* FIXME: I don't believe that this SELECT_DRIVE is required,
-		 * since ide.c only calls tuneproc from do_special, after
-		 * the correct drive has been selected.
-		 */
-		SELECT_DRIVE(hwif, drive);
-		if (IDE_CONTROL_REG)
-			OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
-		OUT_BYTE(0x08 | pio,  IDE_NSECTOR_REG);
-		OUT_BYTE(0x03, IDE_FEATURE_REG);
-		OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
-
-		if (ide_wait_stat(&startstop, drive, DRIVE_READY,
-				  BUSY_STAT|DRQ_STAT|ERR_STAT, WAIT_CMD)) {
-			printk("%s: drive not ready for command\n",
-			       drive->name);
-			return 1;	/* return startstop; ?? */
-		}
-		if (IDE_CONTROL_REG)
-			OUT_BYTE(drive->ctl, IDE_CONTROL_REG);
-	}
-
-	return 0;	/* return startstop; ?? */
+	return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00);
 }
 
 /*
@@ -97,26 +64,48 @@
 	ide_hwif_t *hwif = HWIF(drive);
 	struct pci_dev *dev = hwif->pci_dev;
 	ide_pio_data_t p;
-	unsigned int drv_ctrl = 0x909;
+	unsigned short drv_ctrl = 0x909;
+	unsigned int xfer_mode, reg;
 
-	pio = ide_get_best_pio_mode(drive, pio, 5, &p);
+	reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
 
-	if (!ide_set_drive_pio_mode(drive, pio)) {
-		drv_ctrl = get_timing_sl82c105(&p);
+	pio = ide_get_best_pio_mode(drive, pio, 5, &p);
 
-		if (p.use_iordy)
-			drv_ctrl |= 0x40;
+	switch (pio) {
+	default:
+	case 0:		xfer_mode = XFER_PIO_0;		break;
+	case 1:		xfer_mode = XFER_PIO_1;		break;
+	case 2:		xfer_mode = XFER_PIO_2;		break;
+	case 3:		xfer_mode = XFER_PIO_3;		break;
+	case 4:		xfer_mode = XFER_PIO_4;		break;
 	}
 
-	pci_write_config_word(dev,
-			      (hwif->channel ? 0x4c : 0x44)
-			       + (drive->select.b.unit ? 4 : 0),
-			      drv_ctrl);
+	if (ide_config_drive_speed(drive, xfer_mode) == 0)
+		drv_ctrl = get_timing_sl82c105(&p);
 
-	printk("%s: selected PIO mode %d (%dns)\n",
-		drive->name, p.pio_mode, p.cycle_time);
+	pci_write_config_word(dev, reg, drv_ctrl);
+	pci_read_config_word(dev, reg, &drv_ctrl);
+
+	printk("%s: selected %s (%dns) (%04X)\n", drive->name,
+	       ide_xfer_verbose(xfer_mode), p.cycle_time, drv_ctrl);
 }
 #endif
+
+void ide_dmacapable_sl82c105(ide_hwif_t *hwif, unsigned long dmabase)
+{
+	unsigned char rev;
+
+	pci_read_config_byte(hwif->pci_dev, PCI_REVISION_ID, &rev);
+
+	if (rev <= 5) {
+		hwif->autodma = 0;
+		hwif->drives[0].autotune = 1;
+		hwif->drives[1].autotune = 1;
+		printk("    %s: revision %d, Bus-Master DMA disabled\n",
+		       hwif->name, rev);
+	}
+	ide_setup_dma(hwif, dmabase, 8);
+}
 
 void ide_init_sl82c105(ide_hwif_t *hwif)
 {
diff -u --recursive --new-file v2.3.48/linux/drivers/char/Config.in linux/drivers/char/Config.in
--- v2.3.48/linux/drivers/char/Config.in	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/Config.in	Mon Feb 28 14:56:10 2000
@@ -11,6 +11,10 @@
 tristate 'Standard/generic (dumb) serial support' CONFIG_SERIAL
 if [ "$CONFIG_SERIAL" = "y" ]; then
    bool '  Support for console on serial port' CONFIG_SERIAL_CONSOLE
+   if [ "$CONFIG_ARCH_ACORN" = "y" ]; then
+      tristate '   Atomwide serial port support' CONFIG_ATOMWIDE_SERIAL
+      tristate '   Dual serial port support' CONFIG_DUALSP_SERIAL
+   fi
 fi
 bool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED
 if [ "$CONFIG_SERIAL_EXTENDED" = "y" ]; then
@@ -116,9 +120,23 @@
    tristate '  Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG
    tristate '  Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT
    tristate '  Mixcom Watchdog' CONFIG_MIXCOMWD 
+   if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then
+      tristate '  DC21285 watchdog' CONFIG_21285_WATCHDOG
+      if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then
+         tristate '  NetWinder WB83C977 watchdog' CONFIG_977_WATCHDOG
+      fi
+   fi
 fi
 endmenu
 
+if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then
+   tristate 'NetWinder thermometer support' CONFIG_DS1620
+   tristate 'NetWinder Button' CONFIG_NWBUTTON
+   if [ "$CONFIG_NWBUTTON" != "n" ]; then
+      bool '  Reboot Using Button' CONFIG_NWBUTTON_REBOOT
+   fi
+   tristate 'NetWinder flash support' CONFIG_NWFLASH
+fi
 
 tristate '/dev/nvram support' CONFIG_NVRAM
 tristate 'Enhanced Real Time Clock Support' CONFIG_RTC
@@ -188,6 +206,7 @@
       fi
    fi
    dep_tristate '  SAA5249 Teletext processor' CONFIG_VIDEO_SAA5249 $CONFIG_VIDEO_DEV
+   dep_tristate '  SAB3036 tuner' CONFIG_TUNER_3036 $CONFIG_VIDEO_DEV
    if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
       if [ "$CONFIG_SGI" = "y" ]; then
          dep_tristate '  SGI Vino Video For Linux (EXPERIMENTAL)' CONFIG_VIDEO_VINO $CONFIG_VIDEO_DEV $CONFIG_SGI
diff -u --recursive --new-file v2.3.48/linux/drivers/char/Makefile linux/drivers/char/Makefile
--- v2.3.48/linux/drivers/char/Makefile	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/Makefile	Mon Feb 28 14:56:10 2000
@@ -251,6 +251,7 @@
 obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
 obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o
 obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
+obj-$(CONFIG_TUNER_3036) += tuner-3036.o
 obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
 
 ifeq ($(CONFIG_FTAPE),y)
diff -u --recursive --new-file v2.3.48/linux/drivers/char/README.epca linux/drivers/char/README.epca
--- v2.3.48/linux/drivers/char/README.epca	Tue Mar 16 14:21:35 1999
+++ linux/drivers/char/README.epca	Mon Feb 28 07:16:54 2000
@@ -515,3 +515,11 @@
 Files affected        : epca.c
 Release version       : 1.3.0-K 
 -----------------------------------------------------------------------
+Programmer            : Jeff Garzik
+Date                  : February 26, 2000
+Description (Verbose) : Updated driver:
+			1.  Use new kernel PCI interfaces.
+			2.  Updated list of includes.
+Files affected        : epca.c
+Release version       : 1.3.0.1-LK
+-----------------------------------------------------------------------
diff -u --recursive --new-file v2.3.48/linux/drivers/char/c-qcam.c linux/drivers/char/c-qcam.c
--- v2.3.48/linux/drivers/char/c-qcam.c	Sun Nov  7 16:37:34 1999
+++ linux/drivers/char/c-qcam.c	Sun Feb 27 09:00:17 2000
@@ -1,7 +1,20 @@
 /*
  *	Video4Linux Colour QuickCam driver
- *	Copyright 1997-1999 Philip Blundell <philb@gnu.org>
+ *	Copyright 1997-2000 Philip Blundell <philb@gnu.org>
  *
+ *    Module parameters:
+ *
+ *	parport=auto      -- probe all parports (default)
+ *	parport=0         -- parport0 becomes qcam1
+ *	parport=2,0,1     -- parports 2,0,1 are tried in that order
+ *
+ *	probe=0		  -- do no probing, assume camera is present
+ *	probe=1		  -- use IEEE-1284 autoprobe data only (default)
+ *	probe=2		  -- probe aggressively for cameras
+ *
+ * The parport parameter controls which parports will be scanned.
+ * Scanning all parports causes some printers to print a garbage page.
+ *       -- March 14, 1999  Billy Donahue <billy@escape.com> 
  */
 
 #include <linux/module.h>
@@ -32,6 +45,9 @@
 	struct semaphore lock;
 };
 
+/* cameras maximum */
+#define MAX_CAMS 4
+
 /* The three possible QuickCam modes */
 #define QC_MILLIONS	0x18
 #define QC_BILLIONS	0x10
@@ -42,6 +58,11 @@
 #define QC_DECIMATION_2		2
 #define QC_DECIMATION_4		4
 
+#define BANNER "Colour QuickCam for Video4Linux v0.05"
+
+static int parport[MAX_CAMS] = { [1 ... MAX_CAMS-1] = -1 };
+static int probe = 2;
+
 static inline void qcam_set_ack(struct qcam_device *qcam, unsigned int i)
 {
 	/* note: the QC specs refer to the PCAck pin by voltage, not
@@ -159,6 +180,22 @@
 {
 	unsigned int stat, ostat, i, count = 0;
 
+	/* The probe routine below is not very reliable.  The IEEE-1284
+	   probe takes precedence. */
+	/* XXX Currently parport provides no way to distinguish between
+	   "the IEEE probe was not done" and "the probe was done, but
+	   no device was found".  Fix this one day. */
+	if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA
+	    && qcam->pport->probe_info[0].model
+	    && !strcmp(qcam->pdev->port->probe_info[0].model, 
+		       "Color QuickCam 2.0")) {
+		printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n");
+		return 1;
+	}
+	
+	if (probe < 2)
+		return 0;
+
 	parport_write_control(qcam->pport, 0xc);
 
 	/* look for a heartbeat */
@@ -174,6 +211,26 @@
 		}
 	}
 
+	/* Reset the camera and try again */
+	parport_write_control(qcam->pport, 0xc);
+	parport_write_control(qcam->pport, 0x8);
+	mdelay(1);
+	parport_write_control(qcam->pport, 0xc);
+	mdelay(1);
+	count = 0;
+
+	ostat = stat = parport_read_status(qcam->pport);
+	for (i=0; i<250; i++) 
+	{
+		mdelay(1);
+		stat = parport_read_status(qcam->pport);
+		if (ostat != stat) 
+		{
+			if (++count >= 3) return 1;
+			ostat = stat;
+		}
+	}
+
 	/* no (or flatline) camera, give up */
 	return 0;
 }
@@ -627,7 +684,7 @@
 /* video device template */
 static struct video_device qcam_template=
 {
-	"Colour Quickcam",
+	"Colour QuickCam",
 	VID_TYPE_CAPTURE,
 	VID_HARDWARE_QCAM_C,
 	qcam_open,
@@ -681,7 +738,6 @@
 	return q;
 }
 
-#define MAX_CAMS 4
 static struct qcam_device *qcams[MAX_CAMS];
 static unsigned int num_cams = 0;
 
@@ -689,6 +745,19 @@
 {
 	struct qcam_device *qcam;
 
+	if (parport[0] != -1)
+	{
+		/* The user gave specific instructions */
+		int i, found = 0;
+		for (i = 0; i < MAX_CAMS && parport[i] != -1; i++)
+		{
+			if (parport[0] == port->number)
+				found = 1;
+		}
+		if (!found)
+			return -ENODEV;
+	}
+
 	if (num_cams == MAX_CAMS)
 		return -ENOSPC;
 
@@ -700,7 +769,7 @@
 
 	qc_reset(qcam);
 	
-	if (qc_detect(qcam)==0)
+	if (probe && qc_detect(qcam)==0)
 	{
 		parport_release(qcam->pdev);
 		parport_unregister_device(qcam->pdev);
@@ -712,16 +781,18 @@
 
 	parport_release(qcam->pdev);
 	
-	printk(KERN_INFO "Colour Quickcam found on %s\n", 
-	       qcam->pport->name);
-	
 	if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER)==-1)
 	{
+		printk(KERN_ERR "Unable to register Colour QuickCam on %s\n",
+		       qcam->pport->name);
 		parport_unregister_device(qcam->pdev);
 		kfree(qcam);
 		return -ENODEV;
 	}
 
+	printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", 
+	       qcam->vdev.minor, qcam->pport->name);
+	
 	qcams[num_cams++] = qcam;
 
 	return 0;
@@ -734,8 +805,6 @@
 	kfree(qcam);
 }
 
-#define BANNER "Connectix Colour Quickcam driver v0.03"
-
 static void cq_attach(struct parport *port)
 {
 	init_cqcam(port);
@@ -756,11 +825,16 @@
 static int __init cqcam_init (void)
 {
 	printk(BANNER "\n");
+
 	return parport_register_driver(&cqcam_driver);
 }
 
 MODULE_AUTHOR("Philip Blundell <philb@gnu.org>");
 MODULE_DESCRIPTION(BANNER);
+MODULE_PARM_DESC(parport ,"parport=<auto|n[,n]...> for port detection method \n\
+probe=<0|1|2>  # for camera detection method");
+MODULE_PARM(parport, "1-" __MODULE_STRING(MAX_CAMS) "i");
+MODULE_PARM(probe, "i");
 
 static void __exit cqcam_cleanup (void)
 {
diff -u --recursive --new-file v2.3.48/linux/drivers/char/digi1.h linux/drivers/char/digi1.h
--- v2.3.48/linux/drivers/char/digi1.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/digi1.h	Mon Feb 28 07:16:54 2000
@@ -0,0 +1,100 @@
+/*          Definitions for DigiBoard ditty(1) command.                 */
+
+#if !defined(TIOCMODG)
+#define	TIOCMODG	('d'<<8) | 250		/* get modem ctrl state	*/
+#define	TIOCMODS	('d'<<8) | 251		/* set modem ctrl state	*/
+#endif
+
+#if !defined(TIOCMSET)
+#define	TIOCMSET	('d'<<8) | 252		/* set modem ctrl state	*/
+#define	TIOCMGET	('d'<<8) | 253		/* set modem ctrl state	*/
+#endif
+
+#if !defined(TIOCMBIC)
+#define	TIOCMBIC	('d'<<8) | 254		/* set modem ctrl state */
+#define	TIOCMBIS	('d'<<8) | 255		/* set modem ctrl state */
+#endif
+
+#if !defined(TIOCSDTR)
+#define	TIOCSDTR	('e'<<8) | 0		/* set DTR		*/
+#define	TIOCCDTR	('e'<<8) | 1		/* clear DTR		*/
+#endif
+
+/************************************************************************
+ * Ioctl command arguments for DIGI parameters.
+ ************************************************************************/
+#define DIGI_GETA	('e'<<8) | 94		/* Read params		*/
+
+#define DIGI_SETA	('e'<<8) | 95		/* Set params		*/
+#define DIGI_SETAW	('e'<<8) | 96		/* Drain & set params	*/
+#define DIGI_SETAF	('e'<<8) | 97		/* Drain, flush & set params */
+
+#define	DIGI_GETFLOW	('e'<<8) | 99		/* Get startc/stopc flow */
+						/* control characters 	 */
+#define	DIGI_SETFLOW	('e'<<8) | 100		/* Set startc/stopc flow */
+						/* control characters	 */
+#define	DIGI_GETAFLOW	('e'<<8) | 101		/* Get Aux. startc/stopc */
+						/* flow control chars 	 */
+#define	DIGI_SETAFLOW	('e'<<8) | 102		/* Set Aux. startc/stopc */
+						/* flow control chars	 */
+
+#define	DIGI_GETINFO	('e'<<8) | 103		/* Fill in digi_info */
+#define	DIGI_POLLER	('e'<<8) | 104		/* Turn on/off poller */
+#define	DIGI_INIT	('e'<<8) | 105		/* Allow things to run. */
+
+struct	digiflow_struct 
+{
+	unsigned char	startc;				/* flow cntl start char	*/
+	unsigned char	stopc;				/* flow cntl stop char	*/
+};
+
+typedef struct digiflow_struct digiflow_t;
+
+
+/************************************************************************
+ * Values for digi_flags 
+ ************************************************************************/
+#define DIGI_IXON	0x0001		/* Handle IXON in the FEP	*/
+#define DIGI_FAST	0x0002		/* Fast baud rates		*/
+#define RTSPACE		0x0004		/* RTS input flow control	*/
+#define CTSPACE		0x0008		/* CTS output flow control	*/
+#define DSRPACE		0x0010		/* DSR output flow control	*/
+#define DCDPACE		0x0020		/* DCD output flow control	*/
+#define DTRPACE		0x0040		/* DTR input flow control	*/
+#define DIGI_FORCEDCD	0x0100		/* Force carrier		*/
+#define	DIGI_ALTPIN	0x0200		/* Alternate RJ-45 pin config	*/
+#define	DIGI_AIXON	0x0400		/* Aux flow control in fep	*/
+
+
+/************************************************************************
+ * Values for digiDload
+ ************************************************************************/
+#define NORMAL  0
+#define PCI_CTL 1
+
+#define SIZE8  0
+#define SIZE16 1
+#define SIZE32 2
+
+/************************************************************************
+ * Structure used with ioctl commands for DIGI parameters.
+ ************************************************************************/
+struct digi_struct 
+{
+	unsigned short	digi_flags;		/* Flags (see above)	*/
+};
+
+typedef struct digi_struct digi_t;
+
+struct digi_info 
+{
+	unsigned long board;        /* Which board is this ? */
+	unsigned char status;       /* Alive or dead */
+	unsigned char type;         /* see epca.h */
+	unsigned char subtype;      /* For future XEM, XR, etc ... */
+	unsigned short numports;    /* Number of ports configured */
+	unsigned char *port;        /* I/O Address */
+	unsigned char *membase;     /* DPR Address */
+	unsigned char *version;     /* For future ... */
+	unsigned short windowData;  /* For future ... */
+} ;
diff -u --recursive --new-file v2.3.48/linux/drivers/char/digiFep1.h linux/drivers/char/digiFep1.h
--- v2.3.48/linux/drivers/char/digiFep1.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/digiFep1.h	Mon Feb 28 07:16:54 2000
@@ -0,0 +1,136 @@
+
+#define CSTART       0x400L
+#define CMAX         0x800L
+#define ISTART       0x800L
+#define IMAX         0xC00L
+#define CIN          0xD10L
+#define GLOBAL       0xD10L
+#define EIN          0xD18L
+#define FEPSTAT      0xD20L
+#define CHANSTRUCT   0x1000L
+#define RXTXBUF      0x4000L
+
+
+struct global_data 
+{
+	volatile ushort cin;
+	volatile ushort cout;
+	volatile ushort cstart;
+	volatile ushort cmax;
+	volatile ushort ein;
+	volatile ushort eout;
+	volatile ushort istart;
+	volatile ushort imax;
+};
+
+
+struct board_chan 
+{
+	int filler1; 
+	int filler2;
+	volatile ushort tseg;
+	volatile ushort tin;
+	volatile ushort tout;
+	volatile ushort tmax;
+	
+	volatile ushort rseg;
+	volatile ushort rin;
+	volatile ushort rout;
+	volatile ushort rmax;
+	
+	volatile ushort tlow;
+	volatile ushort rlow;
+	volatile ushort rhigh;
+	volatile ushort incr;
+	
+	volatile ushort etime;
+	volatile ushort edelay;
+	volatile unchar *dev;
+	
+	volatile ushort iflag;
+	volatile ushort oflag;
+	volatile ushort cflag;
+	volatile ushort gmask;
+	
+	volatile ushort col;
+	volatile ushort delay;
+	volatile ushort imask;
+	volatile ushort tflush;
+
+	int filler3;
+	int filler4;
+	int filler5;
+	int filler6;
+	
+	volatile unchar num;
+	volatile unchar ract;
+	volatile unchar bstat;
+	volatile unchar tbusy;
+	volatile unchar iempty;
+	volatile unchar ilow;
+	volatile unchar idata;
+	volatile unchar eflag;
+	
+	volatile unchar tflag;
+	volatile unchar rflag;
+	volatile unchar xmask;
+	volatile unchar xval;
+	volatile unchar mstat;
+	volatile unchar mchange;
+	volatile unchar mint;
+	volatile unchar lstat;
+
+	volatile unchar mtran;
+	volatile unchar orun;
+	volatile unchar startca;
+	volatile unchar stopca;
+	volatile unchar startc;
+	volatile unchar stopc;
+	volatile unchar vnext;
+	volatile unchar hflow;
+
+	volatile unchar fillc;
+	volatile unchar ochar;
+	volatile unchar omask;
+
+	unchar filler7;
+	unchar filler8[28];
+}; 
+
+
+#define SRXLWATER      0xE0
+#define SRXHWATER      0xE1
+#define STOUT          0xE2
+#define PAUSETX        0xE3
+#define RESUMETX       0xE4
+#define SAUXONOFFC     0xE6
+#define SENDBREAK      0xE8
+#define SETMODEM       0xE9
+#define SETIFLAGS      0xEA
+#define SONOFFC        0xEB
+#define STXLWATER      0xEC
+#define PAUSERX        0xEE
+#define RESUMERX       0xEF
+#define SETBUFFER      0xF2
+#define SETCOOKED      0xF3
+#define SETHFLOW       0xF4
+#define SETCTRLFLAGS   0xF5
+#define SETVNEXT       0xF6
+
+
+
+#define BREAK_IND        0x01
+#define LOWTX_IND        0x02
+#define EMPTYTX_IND      0x04
+#define DATA_IND         0x08
+#define MODEMCHG_IND     0x20
+
+#define FEP_HUPCL  0002000
+#if 0
+#define RTS   0x02
+#define CD    0x08
+#define DSR   0x10
+#define CTS   0x20
+#define RI    0x40
+#define DTR   0x80
+#endif
diff -u --recursive --new-file v2.3.48/linux/drivers/char/digiPCI.h linux/drivers/char/digiPCI.h
--- v2.3.48/linux/drivers/char/digiPCI.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/digiPCI.h	Mon Feb 28 07:16:54 2000
@@ -0,0 +1,42 @@
+/*************************************************************************
+ * Defines and structure definitions for PCI BIOS Interface 
+ *************************************************************************/
+#define	PCIMAX  32		/* maximum number of PCI boards */
+
+
+#define	PCI_VENDOR_DIGI		0x114F
+#define	PCI_DEVICE_EPC		0x0002
+#define	PCI_DEVICE_RIGHTSWITCH 0x0003  /* For testing */
+#define	PCI_DEVICE_XEM		0x0004
+#define	PCI_DEVICE_XR		0x0005
+#define	PCI_DEVICE_CX		0x0006
+#define	PCI_DEVICE_XRJ		0x0009   /* Jupiter boards with */
+#define	PCI_DEVICE_EPCJ		0x000a   /* PLX 9060 chip for PCI  */
+
+
+/*
+ * On the PCI boards, there is no IO space allocated 
+ * The I/O registers will be in the first 3 bytes of the   
+ * upper 2MB of the 4MB memory space.  The board memory 
+ * will be mapped into the low 2MB of the 4MB memory space 
+ */
+
+/* Potential location of PCI Bios from E0000 to FFFFF*/
+#define PCI_BIOS_SIZE		0x00020000	
+
+/* Size of Memory and I/O for PCI (4MB) */
+#define PCI_RAM_SIZE		0x00400000	
+
+/* Size of Memory (2MB) */
+#define PCI_MEM_SIZE		0x00200000	
+
+/* Offset of I/0 in Memory (2MB) */
+#define PCI_IO_OFFSET 		0x00200000	
+
+#define MEMOUTB(basemem, pnum, setmemval)  *(caddr_t)((basemem) + ( PCI_IO_OFFSET | pnum << 4 | pnum )) = (setmemval)
+#define MEMINB(basemem, pnum)  *(caddr_t)((basemem) + (PCI_IO_OFFSET | pnum << 4 | pnum ))   /* for PCI I/O */
+
+
+
+
+
diff -u --recursive --new-file v2.3.48/linux/drivers/char/ds1620.c linux/drivers/char/ds1620.c
--- v2.3.48/linux/drivers/char/ds1620.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/ds1620.c	Tue Feb 29 11:08:16 2000
@@ -352,18 +352,10 @@
 #endif
 
 static struct file_operations ds1620_fops = {
-	NULL,			/* lseek		*/
-	ds1620_read,		/* read			*/
-	NULL,			/* write		*/
-	NULL,			/* readdir		*/
-	NULL,			/* select		*/
-	ds1620_ioctl,		/* ioctl		*/
-	NULL,			/* mmap			*/
-	ds1620_open,		/* open			*/
-	NULL,			/* flush		*/
-	ds1620_release,		/* release		*/
-	NULL,			/* fsync		*/
-	NULL,			/* fasync		*/
+	read:		ds1620_read,
+	ioctl:		ds1620_ioctl,
+	open:		ds1620_open,
+	release:	ds1620_release,
 };
 
 static struct miscdevice ds1620_miscdev = {
diff -u --recursive --new-file v2.3.48/linux/drivers/char/dz.c linux/drivers/char/dz.c
--- v2.3.48/linux/drivers/char/dz.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/dz.c	Mon Feb 28 07:18:20 2000
@@ -29,6 +29,7 @@
 #define MOD_DEC_USE_COUNT
 #endif
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/init.h> 
diff -u --recursive --new-file v2.3.48/linux/drivers/char/epca.c linux/drivers/char/epca.c
--- v2.3.48/linux/drivers/char/epca.c	Tue Aug 31 17:29:13 1999
+++ linux/drivers/char/epca.c	Mon Feb 28 07:16:54 2000
@@ -28,95 +28,38 @@
 /* See README.epca for change history --DAT*/
 
 
-#ifdef MODVERSIONS
-#ifndef MODULE
-#define MODULE
-#endif
-#endif
-
-/* -----------------------------------------------------------------------
-   This way modules should work regardless if they defined MODULE or
-   MODVERSIONS.  (MODVERSIONS is for the newer kernels ...
--------------------------------------------------------------------------- */
-
-#ifdef MODULE
 #include <linux/config.h>
-#endif /* MODULE */
-
-#include <linux/version.h>
-
-#define NEW_MODULES
-
-#ifdef NEW_MODULES
-#ifdef MODVERSIONS
-#include <linux/modversions.h>
-#endif /* MODVERSIONS */
-#endif /* NEW_MODULES */
-
-#ifdef MODULE
 #include <linux/module.h>
-#endif /* MODULE */
-
-
-#include <linux/errno.h>
-#include <linux/major.h>
-#include <linux/delay.h>
-#include <linux/tty.h>
-#include <linux/serial.h>
-#include <linux/tty_driver.h>
 #include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/malloc.h>
-#include <linux/mm.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/serial.h>
+#include <linux/delay.h>
 #include <linux/ctype.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/segment.h>
-
-
-#include <asm/bitops.h>
-
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
+#include <linux/tty.h>
 #include <linux/tty_flip.h>
-#include <linux/string.h>
-#include <linux/fcntl.h>
-#include <linux/ptrace.h>
-#include <linux/ioport.h>
-
-#ifdef MODULE
-#ifndef NEW_MODULES
-char kernel_version[]=UTS_RELEASE;
-#endif /* NEW_MODULE */ 
-#endif /* MODULE */
-
+#include <asm/uaccess.h>
 
 #ifdef CONFIG_PCI
 #define ENABLE_PCI
 #endif /* CONFIG_PCI */
 
-
-
-#include <asm/uaccess.h>
 #define putUser(arg1, arg2) put_user(arg1, (unsigned long *)arg2)
 #define getUser(arg1, arg2) get_user(arg1, (unsigned int *)arg2)
 
-
-
 #ifdef ENABLE_PCI
 #include <linux/pci.h>
-#include <linux/digiPCI.h>
+#include "digiPCI.h"
 #endif /* ENABLE_PCI */
 
-#include <linux/digi1.h>
-#include <linux/digiFep1.h>
-#include <linux/epca.h>
-#include <linux/epcaconfig.h>
+#include "digi1.h"
+#include "digiFep1.h"
+#include "epca.h"
+#include "epcaconfig.h"
 
 /* ---------------------- Begin defines ------------------------ */
 
-#define VERSION            "1.3.0-K"     
+#define VERSION            "1.3.0.1-LK"
 
 /* This major needs to be submitted to Linux to join the majors list */
 
@@ -127,6 +70,8 @@
 #define MAXCARDS 7
 #define epcaassert(x, msg)  if (!(x)) epca_error(__LINE__, msg)
 
+#define PFX "epca: "
+
 /* ----------------- Begin global definitions ------------------- */
 
 static char mesg[100];
@@ -140,7 +85,7 @@
 	MAXBOARDS is typically 12, but ISA and EISA cards are restricted to 
 	7 below.
 --------------------------------------------------------------------------*/
-static struct board_info boards[7];
+static struct board_info boards[MAXBOARDS];
 
 
 /* ------------- Begin structures used for driver registeration ---------- */
@@ -284,11 +229,7 @@
 int pc_init(void);
 
 #ifdef ENABLE_PCI
-static int init_PCI(int);
-static int get_PCI_configuration(unsigned char, unsigned char, 
-					     unsigned int *, unsigned int *,
-                                             unsigned int *, unsigned int *,
-                                             unsigned int *, unsigned int *);
+static int init_PCI(void);
 #endif /* ENABLE_PCI */
 
 
@@ -1588,7 +1529,7 @@
 
 #ifdef MODULE
 /* -------------------- Begin init_module ---------------------- */
-int init_module()
+int __init init_module()
 { /* Begin init_module */
 
 	unsigned long	flags;
@@ -1606,6 +1547,11 @@
 #endif
 #ifdef MODULE
 /* -------------------- Begin cleanup_module  ---------------------- */
+
+#ifdef ENABLE_PCI
+static struct pci_driver epca_driver;
+#endif
+
 void cleanup_module()
 { /* Begin cleanup_module */
 
@@ -1654,6 +1600,9 @@
 		} /* End for each port */
 	} /* End for each card */
 
+#ifdef ENABLE_PCI
+	pci_unregister_driver (&epca_driver);
+#endif
 
 	restore_flags(flags);
 
@@ -1662,7 +1611,7 @@
 
 /* ------------------ Begin pc_init  ---------------------- */
 
-int pc_init(void)
+int __init pc_init(void)
 { /* Begin pc_init */
 
 	/* ----------------------------------------------------------------
@@ -1748,7 +1697,7 @@
 	if (pci_present())
 	{
 		if(num_cards < MAXBOARDS)
-			pci_boards_found += init_PCI(num_cards);
+			pci_boards_found += init_PCI();
 		num_cards += pci_boards_found;
 	}
 	else 
@@ -2039,10 +1988,7 @@
 
 	epcaassert(ch <= &digi_channels[nbdevs - 1], "ch out of range");
 
-	if (bd->membase < (unsigned char *)0x100000)
-		memaddr = (unchar *) bd->membase;
-	else /* Else get special mapped memory above RAM */
-		memaddr = (unchar *)bd->re_map_membase;
+	memaddr = (unchar *)bd->re_map_membase;
 
 	/* 
 	   The below command is necessary because newer kernels (2.1.x and
@@ -2356,12 +2302,7 @@
 
 		assertgwinon(chan0);
 
-		if (bd->membase < (unsigned char *)0x100000)
-			eventbuf = (volatile unchar *)bus_to_virt((ulong)(bd->membase + tail + ISTART));
-		else
-		{
-			eventbuf = (volatile unchar *)bus_to_virt((ulong)(bd->re_map_membase + tail + ISTART));
-		}
+		eventbuf = (volatile unchar *)bus_to_virt((ulong)(bd->re_map_membase + tail + ISTART));
 
 		/* Get the channel the event occurred on */
 		channel = eventbuf[0];
@@ -2522,10 +2463,7 @@
 
 	cmdMax = (cmdStart + 4 + (ch->mailbox->cmax));
 
-	if (ch->board->membase < (unsigned char *)0x100000)
-		memaddr = ch->board->membase;
-	else
-		memaddr = ch->board->re_map_membase;
+	memaddr = ch->board->re_map_membase;
 
 	/* 
 	   The below command is necessary because newer kernels (2.1.x and
@@ -4036,231 +3974,128 @@
 
 
 #ifdef ENABLE_PCI
-/* --------------------- Begin get_PCI_configuration  ---------------------- */
-
-int get_PCI_configuration(unsigned char bus, unsigned char device_fn,
-                          unsigned int *base_addr0, unsigned int *base_addr1,
-                          unsigned int *base_addr2, unsigned int *base_addr3,
-                          unsigned int *base_addr4, unsigned int *base_addr5)
-{ /* Begin get_PCI_configuration */
-
-	struct	pci_dev *dev = pci_find_slot(bus, device_fn);
-
-	if (!dev)
-		return(0);
-
-	*base_addr0 = dev->resource[0].start;
-	*base_addr1 = dev->resource[1].start;
-	*base_addr2 = dev->resource[2].start;
-	*base_addr3 = dev->resource[3].start;
-	*base_addr4 = dev->resource[4].start;
-	*base_addr5 = dev->resource[5].start;
-
-	/* ------------------------------------------------------------------------
-			 NOTE - The code below mask out either the 2 or 4 bits dependent on the
-				space being addressed. (base_addr value reflecting io space, have their
-				first 2 bits mask out, while base_addr value reflecting mem space, have
-				their first 4 bits mask out.)  These bits are flag bits and should always
-				be 0 when used as an address.
-	---------------------------------------------------------------------------- */
-
-	return(1);
-} /* End get_PCI_configuration */
-
 /* ------------------------ Begin init_PCI  --------------------------- */
 
-int init_PCI(int boards_found)
-{ /* Begin init_PCI */
-
-	unsigned char	bus, device_fn;
-	int i, pci_count = 0;
-	unsigned int base_addr0, base_addr1, base_addr2,
-                base_addr3, base_addr4, base_addr5;
-
-	base_addr0 = base_addr1 = base_addr2 = 0;
-	base_addr3 = base_addr4 = base_addr5 = 0;
-
-	for(i = 0; i < (MAXBOARDS - boards_found); i++) 
-	{ /* Begin for each POSSIBLE remaining board */
-
-		if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_XR,
-			i, &bus, &device_fn)) 
-		{ /* Begin found XR */
-			if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1,
-                                                   &base_addr2, &base_addr3,
-                                                   &base_addr4, &base_addr5))
-			{ /* Store a PCI/XR into the boards structure */
-
-
-				boards[boards_found + pci_count].status   = ENABLED;
-				boards[boards_found + pci_count].type     = PCIXR;
-
-				boards[boards_found + pci_count].numports = 0x0;
-
-				boards[boards_found + pci_count].port     = (unsigned char *)((char *)base_addr0 + PCI_IO_OFFSET);
-				/* Most cards use base_addr0, but some use base_addr2 */
-				boards[boards_found + pci_count].membase  = (unsigned char *)base_addr0;
-
-				if (base_addr0 >= 0x100000)
-				{
-					/* ------------------------------------------------------------
-						Standard physical addresses are valid to the kernel as long 
-						as they aren't above RAM. Higher addresses (Such as are 
-						typical of a PCI system) need to be mapped in with the 
-						ioremap command.  For boards using such high addresses the
-						driver will store both addresses.  One address (The physical)
-						will be held for the apps use (And mmap) and the other (The
-						ioremapped address) will be used in the kernel.
- 
-					---------------------------------------------------------------- */
-					boards[boards_found + pci_count].re_map_port     = ioremap((base_addr0 + PCI_IO_OFFSET),0x200000);
-					boards[boards_found + pci_count].re_map_membase  = ioremap(base_addr0, 0x200000);
-				}
-
-				pci_count++;
-
-				/* --------------------------------------------------------------
-					I don't know what the below does, but the hardware guys say
-					its required on everything except PLX (In this case XRJ).
-				---------------------------------------------------------------- */
-				pcibios_write_config_byte(bus, device_fn, 0x40, 0);  
-				pcibios_write_config_byte(bus, device_fn, 0x46, 0);  
-
-			} /* End store a PCI/XR into the board structure */
-				
-		} /* End found XR */
-
-		if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_XEM,
-			i, &bus, &device_fn)) 
-		{ /* Begin found XEM */
-
-			if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1,
-			                                          &base_addr2, &base_addr3,
-			                                          &base_addr4, &base_addr5))
-			{ /* Begin store a PCI/XEM into the boards structure */
-
-				boards[boards_found + pci_count].status   = ENABLED;
-				boards[boards_found + pci_count].type     = PCIXEM;
-
-				boards[boards_found + pci_count].numports = 0x0;
-				boards[boards_found + pci_count].port     = (char *)((char *)base_addr0 + PCI_IO_OFFSET);
-				/* Most cards use base_addr0, but some use base_addr2 */
-				boards[boards_found + pci_count].membase  = (unsigned char *)base_addr0;
-
-				if (base_addr0 >= 0x100000)
-				{
-					/* ------------------------------------------------------------
-						Standard physical addresses are valid to the kernel as long 
-						as they aren't above RAM. Higher addresses (Such as are 
-						typical of a PCI system) need to be mapped in with the 
-						ioremap command.  For boards using such high addresses the
-						driver will store both addresses.  One address (The physical)
-						will be held for the apps use (And mmap) and the other (The
-						vremapped address) will be used in the kernel.
- 
-					---------------------------------------------------------------- */
-					boards[boards_found + pci_count].re_map_port     = ioremap((base_addr0 + PCI_IO_OFFSET),0x200000);
-					boards[boards_found + pci_count].re_map_membase  = ioremap(base_addr0, 0x200000);
-				}
-
-				pci_count++;
-				/* --------------------------------------------------------------
-					I don't know what the below does, but the hardware guys say
-					its required on everything except PLX (In this case XRJ).
-				---------------------------------------------------------------- */
-				pcibios_write_config_byte(bus, device_fn, 0x40, 0);  
-				pcibios_write_config_byte(bus, device_fn, 0x46, 0);  
-
-			} /* End store a PCI/XEM into the boards structure */
-
-		} /* End found XEM */
-
-
-		if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_CX,
-		                         i, &bus, &device_fn)) 
-		{ /* Begin found CX */
-
-			if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1,
-			                                          &base_addr2, &base_addr3,
-			                                          &base_addr4, &base_addr5))
-			{ /* Begin store a PCI/CX into the boards structure */
-
-				boards[boards_found + pci_count].status   = ENABLED;
-				boards[boards_found + pci_count].type     = PCICX;
-
-				boards[boards_found + pci_count].numports = 0x0;
-				boards[boards_found + pci_count].port     = (char *)((char *)base_addr0 + PCI_IO_OFFSET);
-				/* Most cards use base_addr0, but some use base_addr2 */
-				boards[boards_found + pci_count].membase  = (unsigned char *)base_addr0;
-
-				if (base_addr0 >= 0x100000)
-				{
-					/* ------------------------------------------------------------
-						Standard physical addresses are valid to the kernel as long 
-						as they aren't above RAM. Higher addresses (Such as are 
-						typical of a PCI system) need to be mapped in with the 
-						ioremap command.  For boards using such high addresses the
-						driver will store both addresses.  One address (The physical)
-						will be held for the apps use (And mmap) and the other (The
-						vremapped address) will be used in the kernel.
- 
-					---------------------------------------------------------------- */
-					boards[boards_found + pci_count].re_map_port     = ioremap((base_addr0 + PCI_IO_OFFSET),0x200000);
-					boards[boards_found + pci_count].re_map_membase  = ioremap(base_addr0, 0x200000);
-				}
-
-				pci_count++;
-				/* --------------------------------------------------------------
-					I don't know what the below does, but the hardware guys say
-					its required on everything except PLX (In this case XRJ).
-				---------------------------------------------------------------- */
-				pcibios_write_config_byte(bus, device_fn, 0x40, 0);  
-				pcibios_write_config_byte(bus, device_fn, 0x46, 0);  
-
-			} /* End store a PCI/CX into the boards structure */
-
-		} /* End found CX */
-
-		if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_XRJ,
-		                         i, &bus, &device_fn)) 
-		{ /* Begin found XRJ */
-
-			if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1,
-			                                          &base_addr2, &base_addr3,
-			                                          &base_addr4, &base_addr5))
-			{ /* Begin store a PCI/XRJ into the boards structure */
-
-				boards[boards_found + pci_count].status   = ENABLED;
-				boards[boards_found + pci_count].type     = PCIXRJ;
-
-				boards[boards_found + pci_count].numports = 0x0;
-				boards[boards_found + pci_count].port     = (unsigned char *)(base_addr2 + PCI_IO_OFFSET);
-				/* Most cards use base_addr0, but some use base_addr2 */
-				boards[boards_found + pci_count].membase  = (unsigned char *)base_addr2;
+enum epic_board_types {
+	brd_xr = 0,
+	brd_xem,
+	brd_cx,
+	brd_xrj,
+};
+
+
+/* indexed directly by epic_board_types enum */
+static struct {
+	unsigned char board_type;
+	unsigned bar_idx;		/* PCI base address region */
+} epca_info_tbl[] = {
+	{ PCIXR, 0, },
+	{ PCIXEM, 0, },
+	{ PCICX, 0, },
+	{ PCIXRJ, 2, },
+};
+
+
+static int __init epca_init_one (struct pci_dev *pdev,
+				 const struct pci_device_id *ent)
+{
+	static int board_num = -1;
+	int board_idx, info_idx = ent->driver_data;
+	unsigned long addr;
+
+	board_num++;
+	board_idx = board_num + num_cards;
+	if (board_idx >= MAXBOARDS)
+		goto err_out;
+	
+	addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx);
+	if (!addr) {
+		printk (KERN_ERR PFX "PCI region #%d not available (size 0)\n",
+			epca_info_tbl[info_idx].bar_idx);
+		goto err_out;
+	}
+
+	boards[board_idx].status = ENABLED;
+	boards[board_idx].type = epca_info_tbl[info_idx].board_type;
+	boards[board_idx].numports = 0x0;
+	boards[board_idx].port =
+		(unsigned char *)((char *) addr + PCI_IO_OFFSET);
+	boards[board_idx].membase =
+		(unsigned char *)((char *) addr);
+
+	if (!request_mem_region (addr + PCI_IO_OFFSET, 0x200000, "epca")) {
+		printk (KERN_ERR PFX "resource 0x%x @ 0x%lx unavailable\n",
+			0x200000, addr + PCI_IO_OFFSET);
+		goto err_out;
+	}
+
+	boards[board_idx].re_map_port = ioremap(addr + PCI_IO_OFFSET, 0x200000);
+	if (!boards[board_idx].re_map_port) {
+		printk (KERN_ERR PFX "cannot map 0x%x @ 0x%lx\n",
+			0x200000, addr + PCI_IO_OFFSET);
+		goto err_out_free_pciio;
+	}
+
+	if (!request_mem_region (addr, 0x200000, "epca")) {
+		printk (KERN_ERR PFX "resource 0x%x @ 0x%lx unavailable\n",
+			0x200000, addr);
+		goto err_out_free_iounmap;
+	}
+
+	boards[board_idx].re_map_membase = ioremap(addr, 0x200000);
+	if (!boards[board_idx].re_map_membase) {
+		printk (KERN_ERR PFX "cannot map 0x%x @ 0x%lx\n",
+			0x200000, addr + PCI_IO_OFFSET);
+		goto err_out_free_memregion;
+	}
+
+	/* --------------------------------------------------------------
+		I don't know what the below does, but the hardware guys say
+		its required on everything except PLX (In this case XRJ).
+	---------------------------------------------------------------- */
+	if (info_idx != brd_xrj) {
+		pci_write_config_byte(pdev, 0x40, 0);  
+		pci_write_config_byte(pdev, 0x46, 0);
+	}
+	
+	return 0;
 
-				if (base_addr2 >= 0x100000)
-				{
-					/* ------------------------------------------------------------
-						Standard physical addresses are valid to the kernel as long 
-						as they aren't above RAM. Higher addresses (Such as are 
-						typical of a PCI system) need to be mapped in with the 
-						ioremap command.  For boards using such high addresses the
-						driver will store both addresses.  One address (The physical)
-						will be held for the apps use (And mmap) and the other (The
-						vremapped address) will be used in the kernel.
- 
-					---------------------------------------------------------------- */
-					boards[boards_found + pci_count].re_map_port     = ioremap((base_addr2 + PCI_IO_OFFSET),0x200000);
-					boards[boards_found + pci_count].re_map_membase  = ioremap(base_addr2, 0x200000);
-				}
+err_out_free_memregion:
+	release_mem_region (addr, 0x200000);
+err_out_free_iounmap:
+	iounmap (boards[board_idx].re_map_port);
+err_out_free_pciio:
+	release_mem_region (addr + PCI_IO_OFFSET, 0x200000);
+err_out:
+	return -ENODEV;
+}
 
-				pci_count++;
 
-			} /* End store a PCI/XRJ into the boards structure */
+static struct pci_device_id epca_pci_tbl[] __initdata = {
+	{ PCI_VENDOR_DIGI, PCI_DEVICE_XR, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_xr },
+	{ PCI_VENDOR_DIGI, PCI_DEVICE_XEM, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_xem },
+	{ PCI_VENDOR_DIGI, PCI_DEVICE_CX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_cx },
+	{ PCI_VENDOR_DIGI, PCI_DEVICE_XRJ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_xrj },
+	{ 0, }, /* terminate list */
+};
 
-		} /* End found XRJ */
 
-	} /* End for each POSSIBLE remaining board */
+int __init init_PCI (void)
+{ /* Begin init_PCI */
+	
+	int pci_count;
+	
+	memset (&epca_driver, 0, sizeof (epca_driver));
+	epca_driver.name = "epca";
+	epca_driver.id_table = epca_pci_tbl;
+	epca_driver.probe = epca_init_one;
+
+	pci_count = pci_register_driver (&epca_driver);
+	
+	if (pci_count <= 0) {
+		pci_unregister_driver (&epca_driver);
+		pci_count = 0;
+	}
 
 	return(pci_count);
 
diff -u --recursive --new-file v2.3.48/linux/drivers/char/epca.h linux/drivers/char/epca.h
--- v2.3.48/linux/drivers/char/epca.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/epca.h	Mon Feb 28 07:16:54 2000
@@ -0,0 +1,170 @@
+#define XEMPORTS    0xC02
+#define XEPORTS     0xC22
+
+#define MAX_ALLOC   0x100
+
+#define MAXBOARDS   12
+#define FEPCODESEG  0x0200L
+#define FEPCODE     0x2000L
+#define BIOSCODE    0xf800L
+
+#define MISCGLOBAL  0x0C00L
+#define NPORT       0x0C22L
+#define MBOX        0x0C40L
+#define PORTBASE    0x0C90L
+
+/* Begin code defines used for epca_setup */
+
+#define INVALID_BOARD_TYPE   0x1
+#define INVALID_NUM_PORTS    0x2
+#define INVALID_MEM_BASE     0x4
+#define INVALID_PORT_BASE    0x8
+#define INVALID_BOARD_STATUS 0x10
+#define INVALID_ALTPIN       0x20
+
+/* End code defines used for epca_setup */
+
+
+#define FEPCLR      0x00
+#define FEPMEM      0x02
+#define FEPRST      0x04
+#define FEPINT      0x08
+#define	FEPMASK     0x0e
+#define	FEPWIN      0x80
+
+#define PCXE    0
+#define PCXEVE  1
+#define PCXEM   2   
+#define EISAXEM 3
+#define PC64XE  4
+#define PCXI    5
+#define PCIXEM  7
+#define PCICX   8
+#define PCIXR   9
+#define PCIXRJ  10
+#define EPCA_NUM_TYPES 6
+
+
+static char *board_desc[] = 
+{
+	"PC/Xe",
+	"PC/Xeve",
+	"PC/Xem",
+	"EISA/Xem",
+	"PC/64Xe",
+	"PC/Xi",
+	"unknown",
+	"PCI/Xem",
+	"PCI/CX",
+	"PCI/Xr",
+	"PCI/Xrj",
+};
+
+#define STARTC      021
+#define STOPC       023
+#define IAIXON      0x2000
+
+
+#define TXSTOPPED  0x1
+#define LOWWAIT    0x2
+#define EMPTYWAIT  0x4
+#define RXSTOPPED  0x8
+#define TXBUSY     0x10
+
+#define DISABLED   0
+#define ENABLED    1
+#define OFF        0
+#define ON         1
+
+#define FEPTIMEOUT 200000  
+#define SERIAL_TYPE_NORMAL  1
+#define SERIAL_TYPE_CALLOUT 2
+#define SERIAL_TYPE_INFO    3
+#define EPCA_EVENT_HANGUP   1
+#define EPCA_MAGIC          0x5c6df104L
+
+struct channel 
+{
+	long   magic;
+	unchar boardnum;
+	unchar channelnum;
+	unchar omodem;         /* FEP output modem status     */
+	unchar imodem;         /* FEP input modem status      */
+	unchar modemfake;      /* Modem values to be forced   */
+	unchar modem;          /* Force values                */
+	unchar hflow;
+	unchar dsr;
+	unchar dcd;
+	unchar m_rts ; 		/* The bits used in whatever FEP */
+	unchar m_dcd ;		/* is indiginous to this board to */
+	unchar m_dsr ;		/* represent each of the physical */
+	unchar m_cts ;		/* handshake lines */
+	unchar m_ri ;
+	unchar m_dtr ;
+	unchar stopc;
+	unchar startc;
+	unchar stopca;
+	unchar startca;
+	unchar fepstopc;
+	unchar fepstartc;
+	unchar fepstopca;
+	unchar fepstartca;
+	unchar txwin;
+	unchar rxwin;
+	ushort fepiflag;
+	ushort fepcflag;
+	ushort fepoflag;
+	ushort txbufhead;
+	ushort txbufsize;
+	ushort rxbufhead;
+	ushort rxbufsize;
+	int    close_delay;
+	int    count;
+	int    blocked_open;
+	int    event;
+	int    asyncflags;
+	uint   dev;
+	long   session;
+	long   pgrp;
+	ulong  statusflags;
+	ulong  c_iflag;
+	ulong  c_cflag;
+	ulong  c_lflag;
+	ulong  c_oflag;
+	unchar *txptr;
+	unchar *rxptr;
+	unchar *tmp_buf;
+	struct board_info           *board;
+	volatile struct board_chan  *brdchan;
+	struct digi_struct          digiext;
+	struct tty_struct           *tty;
+	struct termios              normal_termios;
+	struct termios              callout_termios;
+	wait_queue_head_t           open_wait;
+	wait_queue_head_t           close_wait;
+	struct tq_struct            tqueue;
+	volatile struct global_data *mailbox;
+};
+
+struct board_info	
+{
+	unchar status;
+	unchar type;
+	unchar altpin;
+	ushort numports;
+	unchar *port;
+	unchar *membase;
+	unchar *re_map_port;
+	unchar *re_map_membase;
+	ulong  memory_seg;
+	void ( * memwinon )	(struct board_info *, unsigned int) ;
+	void ( * memwinoff ) 	(struct board_info *, unsigned int) ;
+	void ( * globalwinon )	(struct channel *) ;
+	void ( * txwinon ) 	(struct channel *) ;
+	void ( * rxwinon )	(struct channel *) ;
+	void ( * memoff )	(struct channel *) ;
+	void ( * assertgwinon )	(struct channel *) ;
+	void ( * assertmemoff )	(struct channel *) ;
+	unchar poller_inhibited ;
+};
+
diff -u --recursive --new-file v2.3.48/linux/drivers/char/epcaconfig.h linux/drivers/char/epcaconfig.h
--- v2.3.48/linux/drivers/char/epcaconfig.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/epcaconfig.h	Mon Feb 28 07:16:54 2000
@@ -0,0 +1,7 @@
+#define NUMCARDS 0
+#define NBDEVS 0
+
+struct board_info static_boards[NUMCARDS]={
+};
+
+/* DO NOT HAND EDIT THIS FILE! */
diff -u --recursive --new-file v2.3.48/linux/drivers/char/mem.c linux/drivers/char/mem.c
--- v2.3.48/linux/drivers/char/mem.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/mem.c	Sun Feb 27 08:52:18 2000
@@ -84,7 +84,7 @@
 		written+=sz;
 	}
 #endif
-	if (copy_from_user(p, buf, count)) 
+	if (copy_from_user(p, buf, count))
 		return -EFAULT;
 	written += count;
 	*ppos += written;
@@ -634,12 +634,12 @@
 	misc_init();
 #ifdef CONFIG_SOUND
 	soundcore_init();
-#ifdef CONFIG_SOUND_OSS	
+#ifdef CONFIG_SOUND_OSS
 	soundcard_init();
-#endif	
+#endif
 #ifdef CONFIG_DMASOUND
 	dmasound_init();
-#endif	
+#endif
 #endif
 #ifdef CONFIG_SPARCAUDIO
 	sparcaudio_init();
diff -u --recursive --new-file v2.3.48/linux/drivers/char/nwbutton.c linux/drivers/char/nwbutton.c
--- v2.3.48/linux/drivers/char/nwbutton.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/nwbutton.c	Tue Feb 29 11:08:16 2000
@@ -207,16 +207,9 @@
  */
 
 static struct file_operations button_fops = {
-	NULL,		/* lseek */
-	button_read,
-	NULL,		/* write */
-	NULL,		/* readdir */
-	NULL,		/* select */
-	NULL,		/* ioctl */
-	NULL,		/* mmap */
-	button_open,
-	NULL,		/* flush */
-	button_release,
+	read:		button_read,
+	open:		button_open,
+	release:	button_release,
 };
 
 /* 
diff -u --recursive --new-file v2.3.48/linux/drivers/char/nwflash.c linux/drivers/char/nwflash.c
--- v2.3.48/linux/drivers/char/nwflash.c	Sat Feb 26 22:31:44 2000
+++ linux/drivers/char/nwflash.c	Tue Feb 29 11:08:16 2000
@@ -60,20 +60,12 @@
 
 static struct file_operations flash_fops =
 {
-	flash_llseek,		/* llseek			 */
-	flash_read,		/* read				 */
-	flash_write,		/* write			 */
-	NULL,			/* no special readdir            */
-	NULL,			/* no special select             */
-	flash_ioctl,
-	NULL,			/* no special mmap               */
-	open_flash,
-	NULL,			/* no special flush		 */
-	release_flash,
-	NULL,			/* no special fsync              */
-	NULL,			/* no special fasync             */
-	NULL,			/* no special check_media_change */
-	NULL			/* no special revaldate          */
+	llseek:		flash_llseek,
+	read:		flash_read,
+	write:		flash_write,
+	ioctl:		flash_ioctl,
+	open:		open_flash,
+	release:	release_flash,
 };
 
 static struct miscdevice flash_miscdev =
diff -u --recursive --new-file v2.3.48/linux/drivers/char/specialix.c linux/drivers/char/specialix.c
--- v2.3.48/linux/drivers/char/specialix.c	Mon Nov  1 13:56:26 1999
+++ linux/drivers/char/specialix.c	Thu Mar  2 10:16:45 2000
@@ -59,11 +59,14 @@
  * Revision 1.8:  Jul 1  1997
  *                port to linux-2.1.43 kernel.
  * Revision 1.9:  Oct 9  1998
- *                Added stuff for the IO8+/PCI version. . 
+ *                Added stuff for the IO8+/PCI version.
+ * Revision 1.10: Oct 22  1999 / Jan 21 2000. 
+ *                Added stuff for setserial. 
+ *                Nicolas Mailhot (Nicolas.Mailhot@email.enst.fr)
  * 
  */
 
-#define VERSION "1.8"
+#define VERSION "1.10"
 
 
 /*
@@ -1070,10 +1073,17 @@
 	/*
 	 * Now we must calculate some speed depended things 
 	 */
-	
+
 	/* Set baud rate for port */
-	tmp = (((SX_OSCFREQ + baud_table[baud]/2) / baud_table[baud] +
-		CD186x_TPC/2) / CD186x_TPC);
+	tmp = port->custom_divisor ;
+	if ( tmp )
+		printk (KERN_INFO "sx%d: Using custom baud rate divisor %ld. \n"
+		                  "This is an untested option, please be carefull.\n",
+		                  port_No (port), tmp);
+	else
+		tmp = (((SX_OSCFREQ + baud_table[baud]/2) / baud_table[baud] +
+		         CD186x_TPC/2) / CD186x_TPC);
+
 	if ((tmp < 0x10) && time_before(again, jiffies)) { 
 		again = jiffies + HZ * 60;
 		/* Page 48 of version 2.0 of the CL-CD1865 databook */
@@ -1095,9 +1105,13 @@
 	sx_out(bp, CD186x_TBPRH, (tmp >> 8) & 0xff); 
 	sx_out(bp, CD186x_RBPRL, tmp & 0xff); 
 	sx_out(bp, CD186x_TBPRL, tmp & 0xff);
-	
-	baud = (baud_table[baud] + 5) / 10;   /* Estimated CPS */
-	
+
+	if (port->custom_divisor) {
+		baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor;
+		baud = ( baud + 5 ) / 10;
+	} else 
+		baud = (baud_table[baud] + 5) / 10;   /* Estimated CPS */
+
 	/* Two timer ticks seems enough to wakeup something like SLIP driver */
 	tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO;		
 	port->wakeup_chars = (tmp < 0) ? 0 : ((tmp >= SERIAL_XMIT_SIZE) ?
@@ -1860,7 +1874,8 @@
 	if (error)
 		return error;
 
-	copy_from_user(&tmp, newinfo, sizeof(tmp));
+	if (copy_from_user(&tmp, newinfo, sizeof(tmp)))
+		return -EFAULT;
 	
 #if 0	
 	if ((tmp.irq != bp->irq) ||
@@ -1875,6 +1890,7 @@
 
 	change_speed = ((port->flags & ASYNC_SPD_MASK) !=
 			(tmp.flags & ASYNC_SPD_MASK));
+	change_speed |= (tmp.custom_divisor != port->custom_divisor);
 	
 	if (!capable(CAP_SYS_ADMIN)) {
 		if ((tmp.close_delay != port->close_delay) ||
@@ -1884,11 +1900,13 @@
 			return -EPERM;
 		port->flags = ((port->flags & ~ASYNC_USR_MASK) |
 		                  (tmp.flags & ASYNC_USR_MASK));
+		port->custom_divisor = tmp.custom_divisor;
 	} else {
 		port->flags = ((port->flags & ~ASYNC_FLAGS) |
 		                  (tmp.flags & ASYNC_FLAGS));
 		port->close_delay = tmp.close_delay;
 		port->closing_wait = tmp.closing_wait;
+		port->custom_divisor = tmp.custom_divisor;
 	}
 	if (change_speed) {
 		save_flags(flags); cli();
@@ -1919,8 +1937,10 @@
 	tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC;
 	tmp.close_delay = port->close_delay * HZ/100;
 	tmp.closing_wait = port->closing_wait * HZ/100;
+	tmp.custom_divisor =  port->custom_divisor;
 	tmp.xmit_fifo_size = CD186x_NFIFO;
-	copy_to_user(retinfo, &tmp, sizeof(tmp));
+	if (copy_to_user(retinfo, &tmp, sizeof(tmp)))
+		return -EFAULT;
 	return 0;
 }
 
diff -u --recursive --new-file v2.3.48/linux/drivers/char/tuner-3036.c linux/drivers/char/tuner-3036.c
--- v2.3.48/linux/drivers/char/tuner-3036.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/char/tuner-3036.c	Mon Feb 28 14:56:10 2000
@@ -0,0 +1,227 @@
+/*
+ * Driver for Philips SAB3036 "CITAC" tuner control chip.
+ *
+ * Author: Phil Blundell <philb@gnu.org>
+ *
+ * The SAB3036 is just about different enough from the chips that
+ * tuner.c copes with to make it not worth the effort to crowbar
+ * the support into that file.  So instead we have a separate driver. 
+ *
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/malloc.h>
+#include <linux/version.h>
+#include <linux/init.h>
+
+#include <linux/i2c.h>
+#include <linux/videodev.h>
+
+#include "tuner.h"
+
+static int debug;	/* insmod parameter */
+static int this_adap;
+
+static struct i2c_client client_template;
+
+/* Addresses to scan */
+static unsigned short normal_i2c[] = {I2C_CLIENT_END};
+static unsigned short normal_i2c_range[] = {0x60, 0x61, I2C_CLIENT_END};
+static unsigned short probe[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
+static unsigned short probe_range[2]  = { I2C_CLIENT_END, I2C_CLIENT_END };
+static unsigned short ignore[2]       = { I2C_CLIENT_END, I2C_CLIENT_END };
+static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
+static unsigned short force[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
+
+static struct i2c_client_address_data addr_data = {
+	normal_i2c, normal_i2c_range, 
+	probe, probe_range, 
+	ignore, ignore_range, 
+	force
+};
+
+/* ---------------------------------------------------------------------- */
+
+static unsigned char
+tuner_getstatus (struct i2c_client *c)
+{
+	unsigned char byte;
+	if (i2c_master_recv(c, &byte, 1) != 1)
+		printk(KERN_ERR "tuner-3036: I/O error.\n");
+	return byte;
+}
+
+#define TUNER_FL        0x80
+
+static int 
+tuner_islocked (struct i2c_client *c)
+{
+        return (tuner_getstatus(c) & TUNER_FL);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void 
+set_tv_freq(struct i2c_client *c, int freq)
+{
+	u16 div = ((freq * 20) / 16);
+	unsigned long give_up = jiffies + HZ;
+	unsigned char buffer[2];
+
+	if (debug)
+		printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div);
+	
+	/* Select high tuning current */
+	buffer[0] = 0x29;
+	buffer[1] = 0x3e;
+
+	if (i2c_master_send(c, buffer, 2) != 2)
+		printk("tuner: i2c i/o error 1\n");
+	
+	buffer[0] = 0x80 | ((div>>8) & 0x7f);
+	buffer[1] = div & 0xff;
+
+	if (i2c_master_send(c, buffer, 2) != 2)
+		printk("tuner: i2c i/o error 2\n");
+	
+	while (!tuner_islocked(c) && time_before(jiffies, give_up))
+		schedule();
+	       
+	if (!tuner_islocked(c))
+		printk(KERN_WARNING "tuner: failed to achieve PLL lock\n");
+	
+	/* Select low tuning current and engage AFC */
+	buffer[0] = 0x29;
+	buffer[1] = 0xb2;
+
+	if (i2c_master_send(c, buffer, 2) != 2)
+		printk("tuner: i2c i/o error 3\n");
+
+	if (debug)
+		printk(KERN_DEBUG "tuner: status %02x\n", tuner_getstatus(c));
+}
+
+/* ---------------------------------------------------------------------- */
+
+static int 
+tuner_attach(struct i2c_adapter *adap, int addr,
+	     unsigned short flags, int kind)
+{
+	static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 };
+
+	struct i2c_client *client;
+
+	if (this_adap > 0)
+		return -1;
+	this_adap++;
+	
+        client_template.adapter = adap;
+        client_template.addr = addr;
+
+	client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+        if (client == NULL)
+                return -ENOMEM;
+        memcpy(client, &client_template, sizeof(struct i2c_client));
+
+	printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client));
+
+        i2c_attach_client(client);
+	MOD_INC_USE_COUNT;
+
+	if (i2c_master_send(client, buffer, 2) != 2)
+		printk("tuner: i2c i/o error 1\n");
+	if (i2c_master_send(client, buffer+2, 2) != 2)
+		printk("tuner: i2c i/o error 2\n");
+	if (i2c_master_send(client, buffer+4, 2) != 2)
+		printk("tuner: i2c i/o error 3\n");
+	return 0;
+}
+
+static int 
+tuner_detach(struct i2c_client *c)
+{
+	MOD_DEC_USE_COUNT;
+	return 0;
+}
+
+static int 
+tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
+{
+	int *iarg = (int*)arg;
+
+	switch (cmd) 
+	{
+		case TUNER_SET_TVFREQ:
+			set_tv_freq(client, *iarg);
+			break;
+	    
+		default:
+			return -EINVAL;
+	}
+	return 0;
+}
+
+static int 
+tuner_probe(struct i2c_adapter *adap)
+{
+	this_adap = 0;
+	if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_LP))
+		return i2c_probe(adap, &addr_data, tuner_attach);
+	return 0;
+}
+
+/* ----------------------------------------------------------------------- */
+
+static struct i2c_driver 
+i2c_driver_tuner = 
+{
+	"sab3036",		/* name       */
+	I2C_DRIVERID_SAB3036,	/* ID         */
+        I2C_DF_NOTIFY,
+	tuner_probe,
+	tuner_detach,
+	tuner_command
+};
+
+static struct i2c_client client_template =
+{
+        "SAB3036",		/* name       */
+        -1,
+        0,
+        0,
+        NULL,
+        &i2c_driver_tuner
+};
+
+EXPORT_NO_SYMBOLS;
+
+int __init
+tuner3036_init(void)
+{
+	i2c_add_driver(&i2c_driver_tuner);
+	return 0;
+}
+
+void __exit
+tuner3036_exit(void)
+{
+	i2c_del_driver(&i2c_driver_tuner);
+}
+
+MODULE_DESCRIPTION("SAB3036 tuner driver");
+MODULE_AUTHOR("Philip Blundell <philb@gnu.org>");
+MODULE_PARM(debug,"i");
+MODULE_PARM_DESC(debug,"Enable debugging output");
+
+module_init(tuner3036_init);
+module_exit(tuner3036_exit);
diff -u --recursive --new-file v2.3.48/linux/drivers/char/vc_screen.c linux/drivers/char/vc_screen.c
--- v2.3.48/linux/drivers/char/vc_screen.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/char/vc_screen.c	Sun Feb 27 08:52:18 2000
@@ -49,7 +49,7 @@
 vcs_size(struct inode *inode)
 {
 	int size;
-   	int currcons = MINOR(inode->i_rdev) & 127;
+	int currcons = MINOR(inode->i_rdev) & 127;
 	if (currcons == 0)
 		currcons = fg_console;
 	else
diff -u --recursive --new-file v2.3.48/linux/drivers/char/vt.c linux/drivers/char/vt.c
--- v2.3.48/linux/drivers/char/vt.c	Sat Feb 26 22:31:45 2000
+++ linux/drivers/char/vt.c	Sun Feb 27 08:52:18 2000
@@ -203,7 +203,7 @@
 		if (!(key_map = key_maps[s])) {
 			int j;
 
-			if (keymap_count >= MAX_NR_OF_USER_KEYMAPS && 
+			if (keymap_count >= MAX_NR_OF_USER_KEYMAPS &&
 			    !capable(CAP_SYS_RESOURCE))
 				return -EPERM;
 
diff -u --recursive --new-file v2.3.48/linux/drivers/char/wdt285.c linux/drivers/char/wdt285.c
--- v2.3.48/linux/drivers/char/wdt285.c	Sat Feb 26 22:31:45 2000
+++ linux/drivers/char/wdt285.c	Tue Feb 29 11:08:16 2000
@@ -153,18 +153,10 @@
 
 static struct file_operations watchdog_fops=
 {
-	NULL,		/* Seek */
-	NULL,		/* Read */
-	watchdog_write,	/* Write */
-	NULL,		/* Readdir */
-	NULL,		/* Select */
-	watchdog_ioctl,	/* Ioctl */
-	NULL,		/* MMap */
-	watchdog_open,
-	NULL,		/* flush */
-	watchdog_release,
-	NULL,		
-	NULL		/* Fasync */
+	write:		watchdog_write,
+	ioctl:		watchdog_ioctl,
+	open:		watchdog_open,
+	release:	watchdog_release,
 };
 
 static struct miscdevice watchdog_miscdev=
diff -u --recursive --new-file v2.3.48/linux/drivers/char/wdt977.c linux/drivers/char/wdt977.c
--- v2.3.48/linux/drivers/char/wdt977.c	Sat Feb 26 22:31:45 2000
+++ linux/drivers/char/wdt977.c	Tue Feb 29 11:08:16 2000
@@ -162,18 +162,9 @@
 
 static struct file_operations wdt977_fops=
 {
-	NULL,		/* Seek */
-	NULL,		/* Read */
-	wdt977_write,	/* Write */
-	NULL,		/* Readdir */
-	NULL,		/* Select */
-	NULL,		/* Ioctl */
-	NULL,		/* MMap */
-	wdt977_open,
-	NULL,		/* flush */
-	wdt977_release,
-	NULL,		
-	NULL		/* Fasync */
+	write:		wdt977_write,
+	open:		wdt977_open,
+	release:	wdt977_release,
 };
 
 static struct miscdevice wdt977_miscdev=
diff -u --recursive --new-file v2.3.48/linux/drivers/i2o/i2o_lan.c linux/drivers/i2o/i2o_lan.c
--- v2.3.48/linux/drivers/i2o/i2o_lan.c	Tue Jan 11 22:31:40 2000
+++ linux/drivers/i2o/i2o_lan.c	Mon Feb 28 07:16:54 2000
@@ -131,7 +131,7 @@
 	switch (msg[1] >> 24) {
 	case LAN_RECEIVE_POST:
 	{
-		if (dev->start) {
+		if (netif_running(dev)) {
 			if (!(msg[4]>>24)) {
 				i2o_lan_receive_post_reply(dev,msg);
 				break;
@@ -162,10 +162,8 @@
 			trl_count--;
 		}
 
-		if (dev->tbusy) {
-			clear_bit(0,(void*)&dev->tbusy);
-			mark_bh(NET_BH); /* inform upper layers */
-		}
+		if (netif_queue_stopped(dev))
+			netif_wake_queue(dev);
 	
 		break;	
 	}
@@ -536,8 +534,7 @@
 		return -ENOMEM;
 	priv->i2o_fbl_tail = -1;
 
-	dev->tbusy = 0;
-	dev->start = 1;
+	netif_start_queue(dev);
 
 	i2o_set_batch_mode(dev);
 	i2o_lan_receive_post(dev);
@@ -562,8 +559,7 @@
 		printk(KERN_WARNING "%s: Unable to clear the event mask.\n",
 #endif				dev->name);
 
-	dev->tbusy = 1;
-	dev->start = 0;
+	netif_stop_queue(dev);
 	i2o_lan_suspend(dev);
 
 	if (i2o_release_device(i2o_dev, &i2o_lan_handler, I2O_CLAIM_PRIMARY))
@@ -617,15 +613,6 @@
 	u32 m, *msg;
 	u32 *sgl_elem;
 
-	/*
-	 * Keep interrupt from changing dev->tbusy from underneath us
-	 * (Do we really need to do this?)
-	 */
-
-	if (test_and_set_bit(0,(void*)&dev->tbusy) != 0) {
-        	return 1;
-        }
-
 	priv->tx_count++;
 	priv->tx_out++;
 
@@ -673,8 +660,8 @@
 	
 	/* If HDMs TxMaxPktOut reached, stay busy (don't clean tbusy) */
 
-	if (priv->tx_out < priv->tx_max_out)
-		clear_bit(0, (void *)&dev->tbusy);
+	if (priv->tx_out >= priv->tx_max_out)
+		netif_stop_queue(dev);
 	
 	return 0;
 }
diff -u --recursive --new-file v2.3.48/linux/drivers/ieee1394/aic5800.c linux/drivers/ieee1394/aic5800.c
--- v2.3.48/linux/drivers/ieee1394/aic5800.c	Fri Jan 21 18:19:16 2000
+++ linux/drivers/ieee1394/aic5800.c	Mon Feb 28 07:16:54 2000
@@ -26,11 +26,11 @@
 #include <linux/pci.h>
 #include <linux/fs.h>
 #include <linux/poll.h>
+#include <linux/delay.h>
 #include <asm/byteorder.h>
 #include <asm/atomic.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
-#include <asm/delay.h>
 
 #include "ieee1394_types.h"
 #include "hosts.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/avmb1/capi.c linux/drivers/isdn/avmb1/capi.c
--- v2.3.48/linux/drivers/isdn/avmb1/capi.c	Sat Feb 26 22:31:45 2000
+++ linux/drivers/isdn/avmb1/capi.c	Tue Feb 29 11:08:16 2000
@@ -515,18 +515,13 @@
 
 static struct file_operations capi_fops =
 {
-	capi_llseek,
-	capi_read,
-	capi_write,
-	NULL,			/* capi_readdir */
-	capi_poll,
-	capi_ioctl,
-	NULL,			/* capi_mmap */
-	capi_open,
-        NULL,                   /* capi_flush */
-	capi_release,
-	NULL,			/* capi_fsync */
-	NULL,			/* capi_fasync */
+	llseek:		capi_llseek,
+	read:		capi_read,
+	write:		capi_write,
+	poll:		capi_poll,
+	ioctl:		capi_ioctl,
+	open:		capi_open,
+	release:	capi_release,
 };
 
 /* -------- /proc functions ----------------------------------- */
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/divert/divert_procfs.c linux/drivers/isdn/divert/divert_procfs.c
--- v2.3.48/linux/drivers/isdn/divert/divert_procfs.c	Sat Feb 26 22:31:45 2000
+++ linux/drivers/isdn/divert/divert_procfs.c	Tue Feb 29 11:08:16 2000
@@ -302,17 +302,13 @@
 
 static struct file_operations isdn_fops =
 {
-	isdn_divert_lseek,
-	isdn_divert_read,
-	isdn_divert_write,
-	NULL,			/* isdn_readdir */
-	isdn_divert_poll,	/* isdn_poll */
-	isdn_divert_ioctl,	/* isdn_ioctl */
-	NULL,			/* isdn_mmap */
-	isdn_divert_open,
-	NULL,			/* flush */
-	isdn_divert_close,
-	NULL			/* fsync */
+	llseek:		isdn_divert_lseek,
+	read:		isdn_divert_read,
+	write:		isdn_divert_write,
+	poll:		isdn_divert_poll,
+	ioctl:		isdn_divert_ioctl,
+	open:		isdn_divert_open,
+	release:	isdn_divert_close,
 };
 
 /****************************/
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/hisax/hfc_sx.c linux/drivers/isdn/hisax/hfc_sx.c
--- v2.3.48/linux/drivers/isdn/hisax/hfc_sx.c	Sat Feb 26 22:31:45 2000
+++ linux/drivers/isdn/hisax/hfc_sx.c	Mon Feb 28 07:18:20 2000
@@ -41,7 +41,6 @@
  *
  */
 
-#include <linux/config.h>
 #define __NO_VERSION__
 #include "hisax.h"
 #include "hfc_sx.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/hysdn/hysdn_procconf.c linux/drivers/isdn/hysdn/hysdn_procconf.c
--- v2.3.48/linux/drivers/isdn/hysdn/hysdn_procconf.c	Sat Feb 26 22:31:46 2000
+++ linux/drivers/isdn/hysdn/hysdn_procconf.c	Tue Feb 29 11:08:16 2000
@@ -403,17 +403,11 @@
 /******************************************************/
 static struct file_operations conf_fops =
 {
-	hysdn_dummy_lseek,
-	hysdn_conf_read,
-	hysdn_conf_write,
-	NULL,			/* readdir */
-	NULL,			/* poll */
-	NULL,			/* ioctl */
-	NULL,			/* mmap */
-	hysdn_conf_open,
-	NULL,			/* flush */
-	hysdn_conf_close,
-	NULL			/* fsync */
+	llseek:		hysdn_dummy_lseek,
+	read:		hysdn_conf_read,
+	write:		hysdn_conf_write,
+	open:		hysdn_conf_open,
+	release:	hysdn_conf_close,
 };
 
 /*****************************/
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/hysdn/hysdn_procfs.c linux/drivers/isdn/hysdn/hysdn_procfs.c
--- v2.3.48/linux/drivers/isdn/hysdn/hysdn_procfs.c	Sat Feb 26 22:31:46 2000
+++ linux/drivers/isdn/hysdn/hysdn_procfs.c	Tue Feb 29 11:08:16 2000
@@ -338,17 +338,12 @@
 /**************************************************/
 static struct file_operations log_fops =
 {
-	hysdn_dummy_lseek,
-	hysdn_log_read,
-	hysdn_log_write,
-	NULL,			/* readdir */
-	hysdn_log_poll,		/* poll */
-	NULL,			/*hysdn_log_ioctl, *//* ioctl */
-	NULL,			/* mmap */
-	hysdn_log_open,
-	NULL,			/* flush */
-	hysdn_log_close,
-	NULL			/* fsync */
+	llseek:		hysdn_dummy_lseek,
+	read:		hysdn_log_read,
+	write:		hysdn_log_write,
+	poll:		hysdn_log_poll,
+	open:		hysdn_log_open,
+	release:	hysdn_log_close,
 };
 
 /*****************************************/
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/hysdn/hysdn_proclog.c linux/drivers/isdn/hysdn/hysdn_proclog.c
--- v2.3.48/linux/drivers/isdn/hysdn/hysdn_proclog.c	Sat Feb 26 22:31:46 2000
+++ linux/drivers/isdn/hysdn/hysdn_proclog.c	Tue Feb 29 11:08:16 2000
@@ -420,17 +420,12 @@
 /**************************************************/
 static struct file_operations log_fops =
 {
-	hysdn_dummy_lseek,
-	hysdn_log_read,
-	hysdn_log_write,
-	NULL,			/* readdir */
-	hysdn_log_poll,		/* poll */
-	NULL,
-	NULL,			/* mmap */
-	hysdn_log_open,
-	NULL,			/* flush */
-	hysdn_log_close,
-	NULL			/* fsync */
+	llseek:		hysdn_dummy_lseek,
+	read:		hysdn_log_read,
+	write:		hysdn_log_write,
+	poll:		hysdn_log_poll,
+	open:		hysdn_log_open,
+	release:	hysdn_log_close,
 };
 
 /***********************************************************************************/
diff -u --recursive --new-file v2.3.48/linux/drivers/isdn/isdn_common.c linux/drivers/isdn/isdn_common.c
--- v2.3.48/linux/drivers/isdn/isdn_common.c	Sat Feb 26 22:31:46 2000
+++ linux/drivers/isdn/isdn_common.c	Tue Feb 29 11:08:16 2000
@@ -2070,17 +2070,13 @@
 
 static struct file_operations isdn_fops =
 {
-	isdn_lseek,
-	isdn_read,
-	isdn_write,
-	NULL,                   /* isdn_readdir */
-	isdn_poll,              /* isdn_poll */
-	isdn_ioctl,             /* isdn_ioctl */
-	NULL,                   /* isdn_mmap */
-	isdn_open,
-	NULL,			/* flush */
-	isdn_close,
-	NULL                    /* fsync */
+	llseek:		isdn_lseek,
+	read:		isdn_read,
+	write:		isdn_write,
+	poll:		isdn_poll,
+	ioctl:		isdn_ioctl,
+	open:		isdn_open,
+	release:	isdn_close,
 };
 
 char *
diff -u --recursive --new-file v2.3.48/linux/drivers/macintosh/via-pmu68k.c linux/drivers/macintosh/via-pmu68k.c
--- v2.3.48/linux/drivers/macintosh/via-pmu68k.c	Wed Feb 16 17:03:52 2000
+++ linux/drivers/macintosh/via-pmu68k.c	Tue Feb 29 11:08:16 2000
@@ -1038,16 +1038,10 @@
 }
 
 static struct file_operations pmu_device_fops = {
-	NULL,		/* no seek */
-	pmu_read,
-	pmu_write,
-	NULL,		/* no readdir */
-	NULL,		/* no poll yet */
-	pmu_ioctl,
-	NULL,		/* no mmap */
-	pmu_open,
-	NULL,		/* flush */
-	NULL		/* no release */
+	read:		pmu_read,
+	write:		pmu_write,
+	ioctl:		pmu_ioctl,
+	open:		pmu_open,
 };
 
 static struct miscdevice pmu_device = {
diff -u --recursive --new-file v2.3.48/linux/drivers/net/3c505.c linux/drivers/net/3c505.c
--- v2.3.48/linux/drivers/net/3c505.c	Sat Feb 26 22:31:46 2000
+++ linux/drivers/net/3c505.c	Mon Feb 28 07:16:54 2000
@@ -1242,12 +1242,12 @@
 	adapter->got[CMD_CONFIGURE_82586] = 0;
 	if (!send_pcb(dev, &adapter->tx_pcb))
 	{
-		spin_unlock_irqrestore(&lp->lock, flags);
+		spin_unlock_irqrestore(&adapter->lock, flags);
 		printk("%s: couldn't send 82586 configure command\n", dev->name);
 	}
 	else {
 		int timeout = jiffies + TIMEOUT;
-		spin_unlock_irqrestore(&lp->lock, flags);
+		spin_unlock_irqrestore(&adapter->lock, flags);
 		while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout));
 		if (time_after_eq(jiffies, timeout))
 			TIMEOUT_MSG(__LINE__);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/3c515.c linux/drivers/net/3c515.c
--- v2.3.48/linux/drivers/net/3c515.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/net/3c515.c	Thu Mar  2 10:17:41 2000
@@ -11,6 +11,8 @@
 	Center of Excellence in Space Data and Information Sciences
 	   Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
 
+	2/2/00- Added support for kernel-level ISAPnP 
+		by Stephen Frost <sfrost@snowman.net> and Alessandro Zummo
 	Cleaned up for 2.3.x/softnet by Jeff Garzik and Alan Cox.
 */
 
@@ -46,6 +48,7 @@
 
 #include <linux/module.h>
 #include <linux/version.h>
+#include <linux/isapnp.h>
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -349,6 +352,21 @@
 	{ "Default", 0, 0xFF, XCVR_10baseT, 10000},
 };
 
+#ifdef CONFIG_ISAPNP
+struct corkscrew_isapnp_adapters_struct {
+	unsigned short vendor, function;
+	char *name;
+};
+struct corkscrew_isapnp_adapters_struct corkscrew_isapnp_adapters[] = {
+	{ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5051), "3Com Fast EtherLink ISA"},
+	{0, }
+};
+int corkscrew_isapnp_phys_addr[3] = {
+	0, 0, 0
+};
+#endif
+static int nopnp = 0;
+
 static int corkscrew_scan(struct net_device *dev);
 static struct net_device *corkscrew_found_device(struct net_device *dev,
 						 int ioaddr, int irq,
@@ -422,11 +440,79 @@
 static int corkscrew_scan(struct net_device *dev)
 {
 	int cards_found = 0;
-	static int ioaddr = 0x100;
+	short i;
+	static int ioaddr;
+	static int pnp_cards = 0;
+
+#ifdef CONFIG_ISAPNP
+	if(nopnp == 1)
+		goto no_pnp;
+	for(i=0; corkscrew_isapnp_adapters[i].vendor != 0; i++) {
+		struct pci_dev *idev = NULL;
+		int irq, j;
+		while((idev = isapnp_find_dev(NULL,
+						corkscrew_isapnp_adapters[i].vendor,
+						corkscrew_isapnp_adapters[i].function,
+						idev))) {
+
+			if(idev->active) idev->deactivate(idev);
+
+			if(idev->prepare(idev)<0)
+				continue;
+			if (!(idev->resource[0].flags & IORESOURCE_IO))
+				continue;
+			if(idev->activate(idev)<0) {
+				printk("isapnp configure failed (out of resources?)\n");
+				return -ENOMEM;
+			}
+			if (!idev->resource[0].start || check_region(idev->resource[0].start,16))
+				continue;
+			ioaddr = idev->resource[0].start;
+			irq = idev->irq_resource[0].start;
+			if(corkscrew_debug)
+				printk ("ISAPNP reports %s at i/o 0x%x, irq %d\n",
+					corkscrew_isapnp_adapters[i].name,ioaddr, irq);
+					
+			if ((inw(ioaddr + 0x2002) & 0x1f0) != (ioaddr & 0x1f0))
+				continue;
+			/* Verify by reading the device ID from the EEPROM. */
+			{
+				int timer;
+				outw(EEPROM_Read + 7, ioaddr + Wn0EepromCmd);
+				/* Pause for at least 162 us. for the read to take place. */
+				for (timer = 4; timer >= 0; timer--) {
+					udelay(162);
+					if ((inw(ioaddr + Wn0EepromCmd) & 0x0200)
+				    		== 0)
+							break;
+				}
+				if (inw(ioaddr + Wn0EepromData) != 0x6d50)
+					continue;
+			}
+			printk(KERN_INFO "3c515 Resource configuraiton register %#4.4x, DCR %4.4x.\n",
+		     		inl(ioaddr + 0x2002), inw(ioaddr + 0x2000));
+			/* irq = inw(ioaddr + 0x2002) & 15; */ /* Use the irq from isapnp */
+			corkscrew_isapnp_phys_addr[pnp_cards] = ioaddr;
+			corkscrew_found_device(dev, ioaddr, irq, CORKSCREW_ID, dev
+				       	&& dev->mem_start ? dev->
+				       	mem_start : options[cards_found]);
+			dev = 0;
+			pnp_cards++;
+			cards_found++;
+		}
+	}
+no_pnp:
+#endif /* not CONFIG_ISAPNP */
 
 	/* Check all locations on the ISA bus -- evil! */
-	for (; ioaddr < 0x400; ioaddr += 0x20) {
+	for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x20) {
 		int irq;
+#ifdef CONFIG_ISAPNP
+		/* Make sure this was not already picked up by isapnp */
+		if(ioaddr == corkscrew_isapnp_phys_addr[0]) continue;
+		if(ioaddr == corkscrew_isapnp_phys_addr[1]) continue;
+		if(ioaddr == corkscrew_isapnp_phys_addr[2]) continue;
+#endif
 		if (check_region(ioaddr, CORKSCREW_TOTAL_SIZE))
 			continue;
 		/* Check the resource configuration for a matching ioaddr. */
@@ -455,7 +541,6 @@
 		dev = 0;
 		cards_found++;
 	}
-
 	if (corkscrew_debug)
 		printk(KERN_INFO "%d 3c515 cards found.\n", cards_found);
 	return cards_found;
diff -u --recursive --new-file v2.3.48/linux/drivers/net/Config.in linux/drivers/net/Config.in
--- v2.3.48/linux/drivers/net/Config.in	Sat Feb 26 22:31:46 2000
+++ linux/drivers/net/Config.in	Sun Feb 27 18:45:10 2000
@@ -5,6 +5,7 @@
 source drivers/net/arcnet/Config.in
 
 tristate 'Dummy net driver support' CONFIG_DUMMY
+tristate 'Bonding driver support' CONFIG_BONDING
 tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
    if [ "$CONFIG_NETLINK" = "y" ]; then
diff -u --recursive --new-file v2.3.48/linux/drivers/net/Makefile linux/drivers/net/Makefile
--- v2.3.48/linux/drivers/net/Makefile	Sat Feb 26 22:31:46 2000
+++ linux/drivers/net/Makefile	Sun Feb 27 18:45:10 2000
@@ -228,6 +228,7 @@
 obj-$(CONFIG_DE650) += de650.o 8390.o
 obj-$(CONFIG_3C589) += 3c589.o
 obj-$(CONFIG_DUMMY) += dummy.o
+obj-$(CONFIG_BONDING) += bonding.o
 obj-$(CONFIG_DE600) += de600.o
 obj-$(CONFIG_DE620) += de620.o
 obj-$(CONFIG_AT1500) += lance.o
diff -u --recursive --new-file v2.3.48/linux/drivers/net/Space.c linux/drivers/net/Space.c
--- v2.3.48/linux/drivers/net/Space.c	Sat Feb 26 22:31:46 2000
+++ linux/drivers/net/Space.c	Sun Feb 27 18:45:10 2000
@@ -685,6 +685,15 @@
 	
 	
 	
-struct net_device *dev_base = NEXT_DEV;
+/*
+ *	The loopback device is global so it can be directly referenced
+ *	by the network code. Also, it must be first on device list.
+ */
+
+extern int loopback_init(struct net_device *dev);
+struct net_device loopback_dev = 
+	{"lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, loopback_init};
+
+struct net_device *dev_base = &loopback_dev;
 rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
 
diff -u --recursive --new-file v2.3.48/linux/drivers/net/aironet4500.h linux/drivers/net/aironet4500.h
--- v2.3.48/linux/drivers/net/aironet4500.h	Mon Dec 20 18:48:21 1999
+++ linux/drivers/net/aironet4500.h	Mon Feb 28 07:16:54 2000
@@ -19,17 +19,7 @@
 /*#include <linux/module.h>
  #include <linux/kernel.h>
 */
-#if LINUX_VERSION_CODE < 0x2030E
-#define NET_DEVICE device 
-#error bad kernel version code
-
-#else 
-#define NET_DEVICE net_device
-#endif                         
 
-#if LINUX_VERSION_CODE < 0x20300
-#define init_MUTEX(a)  *(a) = MUTEX;
-#endif
 /*
 #include <linux/types.h>
 #include <linux/netdevice.h>
@@ -63,11 +53,6 @@
 #define my_spin_unlock_irqrestore(a,b) 	spin_unlock_irqrestore(a,b)
 
 
-#if LINUX_VERSION_CODE <= 0x20100
-#define in_interrupt() intr_count
-#endif
-
-
 #define AWC_ERROR	-1
 #define AWC_SUCCESS	0
 
@@ -81,6 +66,10 @@
 };
 
 
+/* timeout for transmit watchdog timer */
+#define TX_TIMEOUT			(HZ * 3)
+
+
 
 /***************************  REGISTER OFFSETS *********************/
 #define awc_Command_register 		0x00
@@ -137,7 +126,7 @@
 struct awc_command {
 	volatile int		state;
 	volatile int		lock_state;
-	struct NET_DEVICE *		dev;
+	struct net_device *		dev;
 	struct awc_private *	priv;
 	u16			port;
 	struct awc_bap * 	bap;
@@ -1293,7 +1282,7 @@
 /*****************************     R  I  D	***************/
 
 #define AWC_NOF_RIDS	18
-extern int awc_rid_setup(struct NET_DEVICE * dev);
+extern int awc_rid_setup(struct net_device * dev);
 
 struct aironet4500_rid_selector{
 	const u16 selector;
@@ -1427,7 +1416,7 @@
 	const struct aironet4500_rid_selector *	selector;
 	const int size;
 	const struct aironet4500_RID * rids;
-	struct NET_DEVICE * dev ;
+	struct net_device * dev ;
 	void * 	buff;
 	int	bufflen; // just checking
 };
@@ -1490,8 +1479,6 @@
 	int			large_buff_mem;
 	int			small_buff_no;
 	
-	int tx_timeout;
-	
 	volatile int		mac_enabled;
 	u16			link_status;
 	u8			link_status_changed;
@@ -1533,60 +1520,59 @@
 	int 			card_type;
 };
 
-extern int 		awc_init(struct NET_DEVICE * dev);
-extern void 		awc_reset(struct NET_DEVICE *dev);
-extern int 		awc_config(struct NET_DEVICE *dev);
-extern int 		awc_open(struct NET_DEVICE *dev);
-extern void 		awc_tx_timeout(struct NET_DEVICE *dev);
-extern int 		awc_tx_done(struct awc_fid * rx_fid); 
-extern int 		awc_start_xmit(struct sk_buff *, struct NET_DEVICE *);
+extern int 		awc_init(struct net_device * dev);
+extern void 		awc_reset(struct net_device *dev);
+extern int 		awc_config(struct net_device *dev);
+extern int 		awc_open(struct net_device *dev);
+extern void 		awc_tx_timeout(struct net_device *dev);
+extern int 		awc_start_xmit(struct sk_buff *, struct net_device *);
 extern void 		awc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-extern struct enet_statistics *	awc_get_stats(struct NET_DEVICE *dev);
-extern int 		awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid);
-extern void		awc_set_multicast_list(struct NET_DEVICE *dev);
-extern int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu);  
-extern int 		awc_close(struct NET_DEVICE *dev);
-extern int		awc_private_init(struct NET_DEVICE * dev);
+extern struct enet_statistics *	awc_get_stats(struct net_device *dev);
+extern int 		awc_rx(struct net_device *dev, struct awc_fid * rx_fid);
+extern void		awc_set_multicast_list(struct net_device *dev);
+extern int awc_change_mtu(struct net_device *dev, int new_mtu);  
+extern int 		awc_close(struct net_device *dev);
+extern int		awc_private_init(struct net_device * dev);
 extern int awc_register_proc(int (*awc_proc_set_device) (int),int (*awc_proc_unset_device)(int));
 extern int awc_unregister_proc(void);
 extern int (* awc_proc_set_fun) (int) ;
 extern int (* awc_proc_unset_fun) (int) ;
-extern int	awc_interrupt_process(struct NET_DEVICE * dev);
-extern int	awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf );
-extern int 	awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf);
-extern int 	awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid );
-extern int 	awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid);
-extern int 	awc_tx_alloc(struct NET_DEVICE * dev) ;
-extern int	awc_tx_dealloc(struct NET_DEVICE * dev);
-extern struct awc_fid *awc_tx_fid_lookup(struct NET_DEVICE * dev, u16 fid);
-extern int 	awc_issue_soft_reset(struct NET_DEVICE * dev);
-extern int	awc_issue_noop(struct NET_DEVICE * dev);
-extern int 	awc_dump_registers(struct NET_DEVICE * dev);
+extern int	awc_interrupt_process(struct net_device * dev);
+extern int	awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf );
+extern int 	awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf);
+extern int 	awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid );
+extern int 	awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid);
+extern int 	awc_tx_alloc(struct net_device * dev) ;
+extern int	awc_tx_dealloc(struct net_device * dev);
+extern struct awc_fid *awc_tx_fid_lookup(struct net_device * dev, u16 fid);
+extern int 	awc_issue_soft_reset(struct net_device * dev);
+extern int	awc_issue_noop(struct net_device * dev);
+extern int 	awc_dump_registers(struct net_device * dev);
 extern unsigned short  awc_issue_command_and_block(struct awc_command * cmd);
-extern int	awc_enable_MAC(struct NET_DEVICE * dev);
-extern int	awc_disable_MAC(struct NET_DEVICE * dev);
-extern int	awc_read_all_rids(struct NET_DEVICE * dev);
-extern int	awc_write_all_rids(struct NET_DEVICE * dev);
-extern int	awc_receive_packet(struct NET_DEVICE * dev);
-extern int	awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) ;
-extern int	awc_tx_complete_check(struct NET_DEVICE * dev);
-extern int	awc_interrupt_process(struct NET_DEVICE * dev);
-extern void 	awc_bh(struct NET_DEVICE *dev);
-extern int 	awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff);
-extern void 	awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff);
-extern int 	awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, struct sk_buff * skb);
-extern void 	awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, struct awc_fid * tx_buff);
-extern void 	awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,struct awc_fid * tx_buff);
-extern void 	awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff);
-extern void 	awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff);
-extern int 	awc_tx_alloc(struct NET_DEVICE * dev) ;
-extern int 	awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid);
-extern int	awc_tx_dealloc(struct NET_DEVICE * dev);
+extern int	awc_enable_MAC(struct net_device * dev);
+extern int	awc_disable_MAC(struct net_device * dev);
+extern int	awc_read_all_rids(struct net_device * dev);
+extern int	awc_write_all_rids(struct net_device * dev);
+extern int	awc_receive_packet(struct net_device * dev);
+extern int	awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) ;
+extern int	awc_tx_complete_check(struct net_device * dev);
+extern int	awc_interrupt_process(struct net_device * dev);
+extern void 	awc_bh(struct net_device *dev);
+extern int 	awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff);
+extern void 	awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff);
+extern int 	awc_802_11_tx_find_path_and_post(struct net_device * dev, struct sk_buff * skb);
+extern void 	awc_802_11_after_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff);
+extern void 	awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,struct awc_fid * tx_buff);
+extern void 	awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff);
+extern void 	awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff);
+extern int 	awc_tx_alloc(struct net_device * dev) ;
+extern int 	awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid);
+extern int	awc_tx_dealloc(struct net_device * dev);
 extern struct awc_fid *
-	awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle);
-extern int 	awc_queues_init(struct NET_DEVICE * dev);
-extern int 	awc_queues_destroy(struct NET_DEVICE * dev);
-extern int 	awc_rids_setup(struct NET_DEVICE * dev);
+	awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle);
+extern int 	awc_queues_init(struct net_device * dev);
+extern int 	awc_queues_destroy(struct net_device * dev);
+extern int 	awc_rids_setup(struct net_device * dev);
 
 
 
@@ -1603,7 +1589,7 @@
 extern int awc_full_stats;
 
 #define MAX_AWCS	4
-extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS];
+extern struct net_device * aironet4500_devices[MAX_AWCS];
 
 #define AWC_DEBUG 1
 
@@ -1613,18 +1599,6 @@
 #else
 	#define DEBUG(a, args...)
 	#define AWC_ENTRY_EXIT_DEBUG(a)
-#endif
-
-#if LINUX_VERSION_CODE < 0x20100
-#ifndef test_and_set_bit
-          #define test_and_set_bit(a,b)           set_bit(a,b)
-#endif                         
-#endif
-
-#if LINUX_VERSION_CODE  < 0x20100
-	#define FREE_SKB(a) dev_kfree_skb(a, FREE_WRITE)
-#else
-	#define FREE_SKB(a) dev_kfree_skb(a)
 #endif
 
 #endif /* AIRONET4500_H */
diff -u --recursive --new-file v2.3.48/linux/drivers/net/aironet4500_card.c linux/drivers/net/aironet4500_card.c
--- v2.3.48/linux/drivers/net/aironet4500_card.c	Mon Dec 20 18:48:21 1999
+++ linux/drivers/net/aironet4500_card.c	Mon Feb 28 07:16:54 2000
@@ -7,11 +7,13 @@
  *
  *	Revision 0.1 ,started  30.12.1998
  *
+ *	Revision 0.2, Feb 27, 2000
+ *		Jeff Garzik - softnet, cleanups
  *
  */
 #ifdef MODULE
 static const char *awc_version =
-"aironet4500_cards.c v0.1 28/03/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+"aironet4500_cards.c v0.2  Feb 27, 2000  Elmer Joandi, elmer@ylenurme.ee.\n";
 #endif
 
 #include <linux/version.h>
@@ -36,9 +38,6 @@
 #include <linux/if_arp.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#if LINUX_VERSION_CODE < 0x20100
-#include <linux/bios32.h>
-#endif
 
 #include "aironet4500.h"
 
@@ -64,11 +63,11 @@
 static int reverse_probe =0 ;
 
 
-static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
+static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
  			int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ;
 
 
-int awc4500_pci_probe(struct NET_DEVICE *dev)
+int awc4500_pci_probe(struct net_device *dev)
 {
 	int cards_found = 0;
 	static int pci_index = 0;	/* Static, for multiple probe calls. */
@@ -77,7 +76,7 @@
 
 	unsigned char awc_pci_dev, awc_pci_bus;
 
-	if (!pcibios_present()) 
+	if (!pci_present()) 
 		return -1;
 
 	for (;pci_index < 0xff; pci_index++) {
@@ -85,10 +84,8 @@
 		u32 pci_memaddr;
 		u32 pci_ioaddr;
 		u32 pci_cisaddr;
-#if LINUX_VERSION_CODE < 0x20100
-		u16 pci_caps =0;
-		u8  pci_caps_ptr =0;
-#endif
+		struct pci_dev *pdev;
+
 		if (pcibios_find_class	(PCI_CLASS_NETWORK_OTHER << 8,
 			 reverse_probe ? 0xfe - pci_index : pci_index,
 				 &awc_pci_bus, &awc_pci_dev) != PCIBIOS_SUCCESSFUL){
@@ -98,31 +95,16 @@
 					break;
 				}
 		}
-		pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
-									 PCI_VENDOR_ID, &vendor);
-		pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
-									 PCI_DEVICE_ID, &device);
-#if LINUX_VERSION_CODE >= 0x20300
-	        pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq;
-		pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[0].start;
-                pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[1].start;
-		pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[2].start;
-#else
-#if LINUX_VERSION_CODE >= 0x20155
-	        pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq;
-		pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[0];
-                pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[1];
-		pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[2];		
-#else
-		pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_0, &pci_memaddr);
-		pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_1, &pci_cisaddr);
-		pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_2, &pci_ioaddr);
-		pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, PCI_INTERRUPT_LINE, &pci_irq_line);
-		pcibios_read_config_word(awc_pci_bus, awc_pci_dev,PCI_STATUS, &pci_caps);
-		pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, 0x34, &pci_caps_ptr);
+		pdev = pci_find_slot(awc_pci_bus, awc_pci_dev);
+		if (!pdev)
+			continue;
+		vendor = pdev->vendor;
+		device = pdev->device;
+	        pci_irq_line = pdev->irq;
+		pci_memaddr = pci_resource_start (pdev, 0);
+                pci_cisaddr = pci_resource_start (pdev, 1);
+		pci_ioaddr = pci_resource_start (pdev, 2);
 
-#endif // 2.2
-#endif // 2.3
 //		printk("\n pci capabilities %x and ptr %x \n",pci_caps,pci_caps_ptr);
 		/* Remove I/O space marker in bit 0. */
 
@@ -132,17 +114,7 @@
 				device != PCI_DEVICE_AIRONET_4800 &&
 				device != PCI_DEVICE_AIRONET_4500 )
                         continue;
-#if LINUX_VERSION_CODE < 0x20300
 
-		if (!(pci_ioaddr & 1)){
-			printk("awc4X00 ioaddr location mismatch \n");
-			return -1;
-		};
-
-		pci_ioaddr &= ~3;
-		pci_cisaddr &= ~0xf;
-		pci_memaddr &= ~0xf;
-#endif		
 //		if (check_region(pci_ioaddr, AIRONET4X00_IO_SIZE) ||
 //			check_region(pci_cisaddr, AIRONET4X00_CIS_SIZE) ||
 //			check_region(pci_memaddr, AIRONET4X00_MEM_SIZE)) {
@@ -153,33 +125,28 @@
 //		request_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
 //		request_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
 
-//		pcibios_write_config_word(awc_pci_bus, awc_pci_dev,
-//						  PCI_COMMAND, 0);
+//		pci_write_config_word(pdev, PCI_COMMAND, 0);
 		udelay(10000);
 
-		pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
-					 PCI_COMMAND, &pci_command);
+		pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
 		new_command = pci_command |0x100 | PCI_COMMAND_MEMORY|PCI_COMMAND_IO;
 		if (pci_command != new_command) {
 			printk(KERN_INFO "  The PCI BIOS has not enabled this"
 				   " device!  Updating PCI command %4.4x->%4.4x.\n",
 				   pci_command, new_command);
-			pcibios_write_config_word(awc_pci_bus, awc_pci_dev,
-						  PCI_COMMAND, new_command);
+			pci_write_config_word(pdev, PCI_COMMAND, new_command);
 		}
 
 
 /*		if (device == PCI_DEVICE_AIRONET_4800)
-			pcibios_write_config_dword(awc_pci_bus, awc_pci_dev,
-				0x40, 0x00000000);
+			pci_write_config_dword(pdev, 0x40, 0x00000000);
 
 		udelay(1000);
 */
 		if (device == PCI_DEVICE_AIRONET_4800)
-			pcibios_write_config_dword(awc_pci_bus, awc_pci_dev,
-				0x40, 0x40000000);
+			pci_write_config_dword(pdev, 0x40, 0x40000000);
 
-		if (awc_pci_init(dev, awc_pci_bus, awc_pci_dev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
+		if (awc_pci_init(dev, pdev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
 			printk(KERN_ERR "awc4800 pci init failed \n");
 			break;
 		}
@@ -191,7 +158,7 @@
 }
 
 
-static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
+static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
  			int ioaddr, int cis_addr, int mem_addr, u8 pci_irq_line) {
 
 	int i;
@@ -218,18 +185,15 @@
 	dev->init = &awc_init;
 	dev->open = &awc_open;
 	dev->stop = &awc_close;
-	dev->tbusy = 1;
-	dev->start  = 0;
-
     	dev->base_addr = ioaddr;
-
-
     	dev->irq = pci_irq_line;
-#if LINUX_VERSION_CODE > 0x20100
-	request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-#else 
+	dev->tx_timeout = &awc_tx_timeout;
+	dev->watchdog_timeo = TX_TIMEOUT;
+	
+	netif_start_queue (dev);
+
 	request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-#endif
+
 	awc_private_init( dev);
 	awc_init(dev);
 
@@ -244,17 +208,11 @@
 			awc_proc_set_fun(i);
 	}
 
-	dev->tbusy = 1;
-	dev->start = 0;
-
-	
 //	if (register_netdev(dev) != 0) {
 //		printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
 //		goto failed;
 //	}
 
-	
-
 	return 0; 
 //  failed:
 //  	return -1;
@@ -285,7 +243,7 @@
 		unregister_netdev(aironet4500_devices[i]);
 		free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
 		kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
-		kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+		kfree_s(aironet4500_devices[i], sizeof(struct net_device));
 
 		aironet4500_devices[i]=0;
 
@@ -304,14 +262,9 @@
 
 #ifdef CONFIG_AIRONET4500_PNP
 
-#if LINUX_VERSION_CODE > 0x20300
 #include <linux/isapnp.h>
-#else
-#include "isapnp.h"
-#endif
 #define AIRONET4X00_IO_SIZE 	0x40
 
-#if LINUX_VERSION_CODE > 0x20300
 #define isapnp_logdev pci_dev
 #define isapnp_dev    pci_bus
 #define isapnp_find_device isapnp_find_card
@@ -319,17 +272,11 @@
 #define PNP_BUS bus
 #define PNP_BUS_NUMBER number
 #define PNP_DEV_NUMBER devfn
-#else 
-#define PNP_BUS dev
-#define PNP_BUS_NUMBER csn
-#define PNP_DEV_NUMBER number
-#endif
 
-int awc4500_pnp_hw_reset(struct NET_DEVICE *dev){
+
+int awc4500_pnp_hw_reset(struct net_device *dev){
 	struct isapnp_logdev *logdev;
-#if LINUX_VERSION_CODE < 0x20300
-	struct isapnp_config cfg;
-#endif
+
 	DEBUG(0, "awc_pnp_reset \n");
 
 	if (!dev->priv ) {
@@ -357,30 +304,14 @@
 				dev->name, logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
 		return -EAGAIN;
 	}
-#if LINUX_VERSION_CODE < 0x20300
-	if (isapnp_config_init(&cfg, logdev)<0) {
-		printk("cfg init failed \n");
-		isapnp_cfg_end();
-		return -EAGAIN;
-	}
-	cfg.port[0] 	= dev->base_addr;
-	cfg.irq[0]	= dev->irq;
 
-	if (isapnp_configure(&cfg)<0) {
-		printk("%s hw_reset, isapnp configure failed (out of resources?)\n",dev->name);
-		isapnp_cfg_end();
-		return -ENOMEM;
-	}
-#else
-	
-#endif
 	isapnp_activate(logdev->PNP_DEV_NUMBER);	/* activate device */
 	isapnp_cfg_end();
 
 	return 0;
 }
 
-int awc4500_pnp_probe(struct NET_DEVICE *dev)
+int awc4500_pnp_probe(struct net_device *dev)
 {
 	int isa_index = 0;
 	int isa_irq_line = 0;
@@ -389,21 +320,13 @@
 	int i=0;
 	struct isapnp_dev * pnp_dev ;
 	struct isapnp_logdev *logdev;
-#if LINUX_VERSION_CODE < 0x20300
-	struct isapnp_config cfg;
-#endif
 
 	while (1) {
 
 		pnp_dev = isapnp_find_device(
 						ISAPNP_VENDOR('A','W','L'), 
 						ISAPNP_DEVICE(1),
-#if LINUX_VERSION_CODE < 0x20300						
-						 isa_index 
-#else
-						0
-#endif						 
-						 );
+						0);
 	
 		if (!pnp_dev) break;  
 		
@@ -421,28 +344,11 @@
 					logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
 			return -EAGAIN;
 		}
-#if LINUX_VERSION_CODE < 0x20300
-		if (isapnp_config_init(&cfg, logdev)<0) {
-			printk("cfg init failed \n");
-			isapnp_cfg_end();
-			return -EAGAIN;
-		}
-		if (isapnp_configure(&cfg)<0) {
-			printk("isapnp configure failed (out of resources?)\n");
-			isapnp_cfg_end();
-			return -ENOMEM;
-		}
-#endif
 		isapnp_activate(logdev->PNP_DEV_NUMBER);	/* activate device */
 		isapnp_cfg_end();
 
-#if LINUX_VERSION_CODE < 0x20300		
-		isa_ioaddr = cfg.port[0];
-		isa_irq_line = cfg.irq[0];
-#else
 		isa_irq_line = logdev->irq;
 		isa_ioaddr = logdev->resource[0].start;
-#endif
 		request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
 
 		if (!dev) {
@@ -468,18 +374,14 @@
 		dev->init = &awc_init;
 		dev->open = &awc_open;
 		dev->stop = &awc_close;
-		dev->tbusy = 1;
-		dev->start  = 0;
-		
 	    	dev->base_addr = isa_ioaddr;
-
-
 	    	dev->irq = isa_irq_line;
-#if LINUX_VERSION_CODE > 0x20100
+		dev->tx_timeout = &awc_tx_timeout;
+		dev->watchdog_timeo = TX_TIMEOUT;
+		
+		netif_start_queue (dev);
+		
 		request_irq(dev->irq,awc_interrupt , SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-#else
-		request_irq(dev->irq,awc_interrupt, SA_SHIRQ  ,"Aironet 4X00",dev);
-#endif
 
 		awc_private_init( dev);
 
@@ -512,9 +414,6 @@
 			return -1;
 		}
 
-		dev->tbusy = 1;
-		dev->start = 0;
-
 		card++;	
 	}
 
@@ -557,7 +456,7 @@
 		unregister_netdev(aironet4500_devices[i]);
 		free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
 		kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
-		kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+		kfree_s(aironet4500_devices[i], sizeof(struct net_device));
 
 		aironet4500_devices[i]=0;
 
@@ -580,16 +479,14 @@
 	EXPORT_SYMBOL(irq);
 	EXPORT_SYMBOL(io);
 */
-#if LINUX_VERSION_CODE >= 0x20100
 MODULE_PARM(irq,"i");
 MODULE_PARM_DESC(irq,"Aironet 4x00 ISA non-PNP irqs,required");
 MODULE_PARM(io,"i");
 MODULE_PARM_DESC(io,"Aironet 4x00 ISA non-PNP ioports,required");
-#endif
 
 
 
-int awc4500_isa_probe(struct NET_DEVICE *dev)
+int awc4500_isa_probe(struct net_device *dev)
 {
 //	int cards_found = 0;
 //	static int isa_index = 0;	/* Static, for multiple probe calls. */
@@ -638,19 +535,14 @@
 		dev->init = &awc_init;
 		dev->open = &awc_open;
 		dev->stop = &awc_close;
-		dev->tbusy = 1;
-		dev->start  = 0;
-		
 	    	dev->base_addr = isa_ioaddr;
-
-
 	    	dev->irq = isa_irq_line;
+		dev->tx_timeout = &awc_tx_timeout;
+		dev->watchdog_timeo = TX_TIMEOUT;
+		
+		netif_start_queue (dev);
 
-#if LINUX_VERSION_CODE > 0x20100
 		request_irq(dev->irq,awc_interrupt ,SA_INTERRUPT ,"Aironet 4X00",dev);
-#else
-		request_irq(dev->irq,awc_interrupt ,0 ,"Aironet 4X00",dev);
-#endif
 
 		awc_private_init( dev);
 		if ( awc_init(dev) ){
@@ -671,9 +563,6 @@
 				awc_proc_set_fun(i);	
 		}
 
-		dev->tbusy = 1;
-		dev->start = 0;
-
 		card++;	
 	}
 	if (card == 0 ) {
@@ -707,7 +596,7 @@
 		unregister_netdev(aironet4500_devices[i]);
 		free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
 		kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
-		kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+		kfree_s(aironet4500_devices[i], sizeof(struct net_device));
 
 		aironet4500_devices[i]=0;
 
@@ -906,7 +795,7 @@
 
 static int awc_i365_init(struct i365_socket * s) {
 
-	struct NET_DEVICE * dev;
+	struct net_device * dev;
 	int i;
 
 
@@ -923,11 +812,12 @@
 	dev->init = &awc_init;
 	dev->open = &awc_open;
 	dev->stop = &awc_close;
-	dev->tbusy = 1;
-	dev->start  = 0;
     	dev->irq = s->irq;
     	dev->base_addr = s->io;
+	dev->tx_timeout = &awc_tx_timeout;
+	dev->watchdog_timeo = TX_TIMEOUT;
 
+	netif_start_queue (dev);
 
 	awc_private_init( dev);
 
@@ -943,24 +833,18 @@
 			awc_proc_set_fun(i);
 	}
 
-	dev->tbusy = 1;
-	dev->start = 0;
-
-	
 	if (register_netdev(dev) != 0) {
 		printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
 		goto failed;
 	}
 
-	
-
 	return 0;
  
   failed:
   	return -1;
-
 }
 
+
 static void awc_i365_release(void) {
 
 //	long flags;
@@ -983,7 +867,7 @@
 		unregister_netdev(aironet4500_devices[i]);
 
 		//kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
-		kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+		kfree_s(aironet4500_devices[i], sizeof(struct net_device));
 
 		aironet4500_devices[i]=0;
 
diff -u --recursive --new-file v2.3.48/linux/drivers/net/aironet4500_core.c linux/drivers/net/aironet4500_core.c
--- v2.3.48/linux/drivers/net/aironet4500_core.c	Tue Jan  4 13:57:17 2000
+++ linux/drivers/net/aironet4500_core.c	Mon Feb 28 07:16:54 2000
@@ -72,7 +72,7 @@
 	return "UNKNOWN";
 };
 
-int awc_dump_registers(struct NET_DEVICE * dev){
+int awc_dump_registers(struct net_device * dev){
 
 #ifdef AWC_DEBUG
 	int i;
@@ -108,7 +108,7 @@
 
 
 inline 
-int	awc_command_busy_clear_wait(struct NET_DEVICE * dev){
+int	awc_command_busy_clear_wait(struct net_device * dev){
 //	long long jiff = jiffies;
         u16  active_interrupts;
         int  cnt= 0;
@@ -319,7 +319,7 @@
 
 inline 
 unsigned short 
-awc_issue_command_no_ack(struct NET_DEVICE * dev,
+awc_issue_command_no_ack(struct net_device * dev,
 			u16 com, u16 par1, u16 par2, u16 par3){
 
      struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -695,7 +695,7 @@
 
 
 int 
-awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){
+awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf ){
 	  struct awc_command cmd;
 
 	  int sleep_state ;
@@ -728,7 +728,7 @@
 }
 
 int 
-awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){
+awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf){
 
 	  struct awc_command cmd;
 	  int sleep_state ;
@@ -765,7 +765,7 @@
 }
 
 int 
-awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){
+awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid ){
 	  struct awc_command cmd;
 	  int sleep_state;
 
@@ -798,7 +798,7 @@
 }
 
 int 
-awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid){
+awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid){
 
 	  struct awc_command cmd;
 	  int sleep_state ;
@@ -847,7 +847,7 @@
 
 inline
 int
-awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){
+awc_issue_blocking_command(struct net_device * dev,u16 comm){
 
 	  struct awc_command cmd;
 //	  struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -872,7 +872,7 @@
 };
 
 int 
-awc_issue_soft_reset(struct NET_DEVICE * dev){
+awc_issue_soft_reset(struct net_device * dev){
 
 	u16 status ;
 //	int i= 0;
@@ -912,7 +912,7 @@
 };
 
 int
-awc_issue_noop(struct NET_DEVICE * dev){
+awc_issue_noop(struct net_device * dev){
 	int retval;
 	AWC_OUT(dev->base_addr + 0x28, 0);
 	AWC_OUT(dev->base_addr + 0x2A, 0);
@@ -925,7 +925,7 @@
 EXPORT_SYMBOL(awc_enable_MAC);
 
 int
-awc_enable_MAC(struct NET_DEVICE * dev){
+awc_enable_MAC(struct net_device * dev){
         
    struct awc_private * priv = (struct awc_private *)dev->priv;
      AWC_ENTRY_EXIT_DEBUG(" entry awc_enable_MAC ");
@@ -950,7 +950,7 @@
 
 EXPORT_SYMBOL(awc_disable_MAC);
 int
-awc_disable_MAC(struct NET_DEVICE * dev){
+awc_disable_MAC(struct net_device * dev){
         
    struct awc_private * priv = (struct awc_private *)dev->priv;
      AWC_ENTRY_EXIT_DEBUG(" entry awc_disable_MAC ");
@@ -973,7 +973,7 @@
 
 
 int
-awc_read_all_rids(struct NET_DEVICE * dev){
+awc_read_all_rids(struct net_device * dev){
 
 	struct awc_private * priv = (struct awc_private *)dev->priv;
 	int status,i;
@@ -992,7 +992,7 @@
 }
 
 int
-awc_write_all_rids(struct NET_DEVICE * dev){
+awc_write_all_rids(struct net_device * dev){
 
 	struct awc_private * priv = (struct awc_private *)dev->priv;
   	int i,status ;
@@ -1012,7 +1012,7 @@
 
 
 
-int  awc_tx_alloc(struct NET_DEVICE * dev) {
+int  awc_tx_alloc(struct net_device * dev) {
 
 	  struct awc_command cmd;
 	  int k=0;
@@ -1116,7 +1116,7 @@
 };
 
 int 
-awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){
+awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid){
 
 	  struct awc_command cmd;
 	  int fid_handle = 0;
@@ -1150,7 +1150,7 @@
 };
 
 int
-awc_tx_dealloc(struct NET_DEVICE * dev){
+awc_tx_dealloc(struct net_device * dev){
 
  	struct awc_private * priv = (struct awc_private *)dev->priv;
 
@@ -1177,7 +1177,7 @@
 
 
 inline struct awc_fid *
-awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle){
+awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle){
 
  	struct awc_private * priv = (struct awc_private *)dev->priv;
 //	int k = 0;
@@ -1272,7 +1272,7 @@
 
 
 int 
-awc_queues_init(struct NET_DEVICE * dev){
+awc_queues_init(struct net_device * dev){
  	struct awc_private * priv = (struct awc_private *)dev->priv;
 	struct awc_fid * fid = NULL;
 	int retv =0;
@@ -1302,7 +1302,7 @@
 
 
 int 
-awc_queues_destroy(struct NET_DEVICE * dev){
+awc_queues_destroy(struct net_device * dev){
  	struct awc_private * priv = (struct awc_private *)dev->priv;
 	struct awc_fid * fid = NULL;
 	int retv =0;
@@ -1325,7 +1325,7 @@
 
 /****************************** 	802.11router	******************/
 inline int 
-awc_802_11_copy_path_skb(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
+awc_802_11_copy_path_skb(struct net_device * dev, struct awc_fid * rx_buff){
 
 	struct awc_private * priv = (struct awc_private * )dev->priv;
 
@@ -1360,7 +1360,7 @@
 
 
 int
-awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
+awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff){
 
 //        struct awc_private * priv = (struct awc_private * )dev->priv;
 //        u8 is_802_3 = 0;
@@ -1386,7 +1386,7 @@
 int parse_not_8023= 0;
        
 void
-awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
+awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff){
 
         struct awc_private * priv = (struct awc_private * )dev->priv;
 	struct sk_buff * skb = rx_buff->skb;
@@ -1531,7 +1531,7 @@
    	DEBUG(0x200,"%s packet dropped in packet hdr parse \n ",dev->name);
 	if (rx_buff->skb && (rx_buff->type & p80211copy_path_skb)){
 
-		FREE_SKB(rx_buff->skb);		
+		dev_kfree_skb_irq(rx_buff->skb);		
 		rx_buff->skb = NULL;
 		rx_buff->u.rx.payload = NULL;
 	};
@@ -1541,13 +1541,13 @@
 };
 
 void
-awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
+awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff){
 	struct awc_private * priv = (struct awc_private * )dev->priv;
 
 
 	AWC_ENTRY_EXIT_DEBUG("awc_802_11_failed_rx_copy");
 	if (rx_buff->skb)
-                FREE_SKB(rx_buff->skb);
+                dev_kfree_skb_irq(rx_buff->skb);
         rx_buff->skb = NULL;
         rx_buff->u.rx.payload = NULL;
 	priv->stats.rx_errors++;
@@ -1566,7 +1566,7 @@
 
 
 int
-awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
+awc_802_11_tx_find_path_and_post(struct net_device * dev,
 				 struct sk_buff * skb){
 
 
@@ -1750,10 +1750,6 @@
 	udelay(1);
 	awc_transmit_packet(dev,fid);
 	UP(&priv->tx_buff_semaphore);
-	if (priv->tx_large_ready.size > 0 ){
-		dev->tbusy = 0;
-		mark_bh(NET_BH);
-	}
 	AWC_ENTRY_EXIT_DEBUG("exit\n");
 	return 0;
 
@@ -1763,7 +1759,7 @@
 	#ifdef AWC_DEBUG
 //		printk("s");
 	#endif
-   	dev->tbusy = 1; //weell, here it must be set anyway and before
+   	netif_stop_queue (dev); //weell, here it must be set anyway and before
    	//priv->stats.tx_fifo_errors++;
    	UP(&priv->tx_buff_semaphore);
 	AWC_ENTRY_EXIT_DEBUG("NoSpaceExit\n");
@@ -1771,9 +1767,7 @@
   final:
 	priv->stats.tx_errors++;
 	UP(&priv->tx_buff_semaphore);
-	dev->tbusy = 0;
-	FREE_SKB(skb);
-	mark_bh(NET_BH);
+	dev_kfree_skb(skb);
 	AWC_ENTRY_EXIT_DEBUG("BADExit\n");
 	return -1;
   
@@ -1788,7 +1782,7 @@
   
   
 void
-awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev,
+awc_802_11_after_tx_packet_to_card_write(struct net_device * dev,
 					 struct awc_fid * tx_buff){
 
 
@@ -1799,10 +1793,10 @@
 	};
 
 	if(tx_buff->skb){
-		FREE_SKB(tx_buff->skb);
+		dev_kfree_skb(tx_buff->skb);
 		tx_buff->skb = NULL;
 	}
-	mark_bh(NET_BH);
+	netif_wake_queue (dev);
 
 	AWC_ENTRY_EXIT_DEBUG("exit\n");
 };
@@ -1815,7 +1809,7 @@
 */
                         
 void
-awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,
+awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,
                                          struct awc_fid * tx_buff){
         struct awc_private * priv = (struct awc_private *)dev->priv;
 
@@ -1827,7 +1821,7 @@
 	};
 
 	if(tx_buff->skb){
-		FREE_SKB(tx_buff->skb);
+		dev_kfree_skb(tx_buff->skb);
 		tx_buff->skb = NULL;
 		tx_buff->busy =0;
 		printk(KERN_ERR "%s packet to card write failed \n",dev->name);
@@ -1845,7 +1839,7 @@
 };
                                          
 void 
-awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){
+awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff){
 
         struct awc_private * priv = (struct awc_private *)dev->priv;
 
@@ -1866,8 +1860,7 @@
 	}
 
 	tx_buff->busy = 0;
-	dev->tbusy = 0;
-	mark_bh(NET_BH);
+	netif_wake_queue (dev);
 
 	AWC_ENTRY_EXIT_DEBUG("exit\n");
 };
@@ -1880,7 +1873,7 @@
 
 
 inline int
-awc_receive_packet(struct NET_DEVICE * dev){
+awc_receive_packet(struct net_device * dev){
 	
     struct awc_command cmd;
     u16	Fid;
@@ -2010,7 +2003,7 @@
 
 
 int
-awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) {
+awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) {
 	
 	struct awc_command cmd;
 	u16 size ;
@@ -2143,7 +2136,7 @@
 
 
 inline int
-awc_tx_complete_check(struct NET_DEVICE * dev){
+awc_tx_complete_check(struct net_device * dev){
 
 	struct awc_fid	* fid;
 	struct awc_command cmd;
@@ -2197,7 +2190,7 @@
 
 
 void
-awc_bh(struct NET_DEVICE *dev){
+awc_bh(struct net_device *dev){
 
         struct awc_private * priv = (struct awc_private *)dev->priv;
       	int  active_interrupts;
@@ -2226,8 +2219,7 @@
 	if (active_interrupts == 0xffff){
 	
 		printk(KERN_CRIT "%s device ejected in interrupt, disabling\n",dev->name);
-		dev->tbusy = 1;
-		dev->start = 0;
+		netif_device_detach (dev);
 		if (priv->command_semaphore_on){
 			priv->command_semaphore_on--;
 			AWC_UNLOCK_COMMAND_ISSUING(priv);
@@ -2286,7 +2278,7 @@
 
 
 inline int
-awc_interrupt_process(struct NET_DEVICE * dev){
+awc_interrupt_process(struct net_device * dev){
 
 	struct awc_private * priv ;
       	int  active_interrupts;
@@ -2327,10 +2319,6 @@
 //	printk("ikka interruptis\n");
 
 
-        if (test_and_set_bit( 0, (void *) &dev->interrupt) ) {
-		printk("RI\n");
-		goto reenter_end_here;
-	}
 	priv->interrupt_count++;
 	if (priv->interrupt_count > 1 )
 		printk(" interrupt count on\n ");
@@ -2354,12 +2342,10 @@
 	
 		printk(KERN_CRIT "%s device ejected, got interrupt, disabling\n",dev->name);
 		//priv->
-		dev->tbusy = 1;
-		dev->start = 0;
+		netif_device_detach (dev);
 		priv->ejected = 1;
 		if (priv->bh_active || priv->bh_running){
 			priv->interrupt_count--;
-			dev->interrupt = 0;
 			goto bad_end;
 		} else if (priv->command_semaphore_on){
 			
@@ -2368,7 +2354,6 @@
 			 AWC_QUEUE_BH;    
 		}
 		priv->interrupt_count--;
-		dev->interrupt = 0;
 		goto bad_end;
 	}
 
@@ -2458,8 +2443,7 @@
     					awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
           			else
       					awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
-          			dev->tbusy = 0;
-				mark_bh(NET_BH);
+				netif_wake_queue (dev);
 			}
 		} else 
 			printk(KERN_ERR "awc fid %x not found\n",tx_fid);
@@ -2502,7 +2486,6 @@
 
  
 	priv->interrupt_count--;
-	dev->interrupt = 0;
 
 	awc_ints_enable(dev->base_addr, 0x0000);
 
@@ -2523,15 +2506,8 @@
 //  	restore_flags(flags);
 
         return 0;
-reenter_end_here:
-
-        AWC_ENTRY_EXIT_DEBUG(" reenter-bad end exit \n"); 
-//	enable_irq(dev->irq);
-//  	restore_flags(flags);
-        return 0;
 
 bad_end:
-	dev->interrupt = 0;
         AWC_ENTRY_EXIT_DEBUG(" bad_end exit \n"); 	
 //	enable_irq(dev->irq);
 //	restore_flags(flags);
@@ -2543,7 +2519,7 @@
 static const char *aironet4500_core_version =
 "aironet4500.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
 
-struct NET_DEVICE * aironet4500_devices[MAX_AWCS]  = {NULL,NULL,NULL,NULL};
+struct net_device * aironet4500_devices[MAX_AWCS]  = {NULL,NULL,NULL,NULL};
 
 static int awc_debug = 0; //  0xffffff;
 static int p802_11_send  =  0; // 1
@@ -2595,7 +2571,6 @@
 EXPORT_SYMBOL(awc_private_init);
 EXPORT_SYMBOL(awc_tx_timeout);
 EXPORT_SYMBOL(awc_start_xmit);
-EXPORT_SYMBOL(awc_tx_done);
 EXPORT_SYMBOL(awc_rx);
 EXPORT_SYMBOL(awc_interrupt);
 EXPORT_SYMBOL(awc_get_stats);
@@ -2611,7 +2586,7 @@
 /***************************  RESET INIT CONFIG ***********************/
 
 
- void awc_reset(struct NET_DEVICE *dev)
+ void awc_reset(struct net_device *dev)
 {
 
 	long long jiff;
@@ -2633,7 +2608,7 @@
 
 }
 
- int awc_config(struct NET_DEVICE *dev)
+ int awc_config(struct net_device *dev)
 {
 //	struct awc_private *priv = (struct awc_private *)dev->priv;
 
@@ -2654,7 +2629,7 @@
 
 char name[] = "ElmerLinux";
 
- int awc_init(struct NET_DEVICE *dev){
+ int awc_init(struct net_device *dev){
         struct awc_private *priv = (struct awc_private *)dev->priv;
 	int i;        
 	const char * radioType;
@@ -2785,8 +2760,6 @@
 	// here we go, bad aironet
 	memset(&priv->SSIDs,0,sizeof(priv->SSIDs));
 
-	my_spin_lock_init(&priv->queues_lock);
-
         priv->SSIDs.ridLen		=0;
         if (!SSID) {
 	        priv->SSIDs.SSID[0].SSID[0] 	='a';
@@ -2834,7 +2807,7 @@
    	
  };
 
-int awc_private_init(struct NET_DEVICE * dev){
+int awc_private_init(struct net_device * dev){
 	struct awc_private * priv = (struct awc_private *) dev->priv;
 	int i = 0;
 
@@ -2906,7 +2879,6 @@
 	
 
 	priv->ejected		=0;	
-	dev->interrupt		=0;
 	priv->interrupt_count	=0;
 	
 	return 0;
@@ -2916,7 +2888,7 @@
 /****************************	OPEN	CLOSE	**********************/
 
  
- int awc_open(struct NET_DEVICE *dev)
+ int awc_open(struct net_device *dev)
 {
 	struct awc_private *priv = (struct awc_private *)dev->priv;
 
@@ -2924,9 +2896,6 @@
 
 	DEBUG(2, "%s: awc_open \n",  dev->name);
 
-	dev->interrupt = 0; dev->tbusy = 1; dev->start = 0;
-
-
 	if( awc_queues_init(dev) )		goto final;
 	if( awc_config(dev) )		goto final;
 	
@@ -2945,24 +2914,23 @@
 	MOD_INC_USE_COUNT;
 //	kernel_thread(awc_thread,dev,0);
 
-	dev->tbusy = 0; dev->start = 1;
+	netif_start_queue (dev);
 	return 0;					/* Always succeed */
 
    final:
-   	dev->tbusy = 0; dev->start = 0;
+   	netif_device_detach (dev);
    	printk(KERN_ERR "aironet open failed \n");
    	return -1;
 }
 
 
- int awc_close(struct NET_DEVICE *dev)
+ int awc_close(struct net_device *dev)
 {
 	struct awc_private * priv = (struct awc_private *) dev->priv;
 
 	DEBUG(2, "%s: closing device.\n", dev->name);
 
-	dev->start = 0;
-	dev->tbusy=1;
+	netif_stop_queue (dev);
 	
 	awc_disable_MAC(dev);
 	awc_queues_destroy(dev);
@@ -2986,32 +2954,58 @@
 
 
 
- void awc_tx_timeout(struct NET_DEVICE *dev)
+void awc_tx_timeout (struct net_device *dev)
 {
-	struct awc_private *priv = (struct awc_private *)dev->priv;
+	struct awc_private *priv = (struct awc_private *) dev->priv;
+	struct awc_fid * fid;
+	int cnt;
+
+	DEBUG (2, "%s: awc_tx_timeout \n", dev->name);
+
+	printk (KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d  \n ",
+	     dev->name, priv->tx_small_buffs_total, priv->tx_buffs_total,
+		priv->tx_in_transmit.size, priv->tx_post_process.size,
+		priv->tx_large_ready.size, priv->tx_small_ready.size);
+	priv->stats.tx_errors++;
 
-	DEBUG(2, "%s: awc_tx_timeout \n",  dev->name);
+	// save_flags(flags);
+	// cli();
+	fid = priv->tx_in_transmit.head;
+	cnt = 0;
+	while (fid) {
+		if (jiffies - fid->transmit_start_time > (HZ)) {
+			//      printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name,
+			//              jiffies - fid->transmit_start_time );
+			awc_fid_queue_remove (&priv->tx_in_transmit, fid);
+			if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
+				awc_fid_queue_push_tail (&priv->tx_small_ready, fid);
+			else
+				awc_fid_queue_push_tail (&priv->tx_large_ready, fid);
+		}
+		fid = fid->next;
+		if (cnt++ > 200) {
+			printk ("bbb in awc_fid_queue\n");
+			//              restore_flags(flags);
+			return;
+		};
 
-	printk(KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d  \n ",
-			dev->name,priv->tx_small_buffs_total ,priv->tx_buffs_total,
-			priv->tx_in_transmit.size,priv->tx_post_process.size,
-			priv->tx_large_ready.size,priv->tx_small_ready.size);
-	priv->stats.tx_errors++;
+	}
+	//restore_flags(flags);
+	//debug =0x8;
 
 	dev->trans_start = jiffies;
-	dev->tbusy = 0;
+	netif_start_queue (dev);
 }
 
+
 long long last_tx_q_hack = 0;
 int direction = 1;
 
- int awc_start_xmit(struct sk_buff *skb, struct NET_DEVICE *dev) {
+ int awc_start_xmit(struct sk_buff *skb, struct net_device *dev) {
 
 	struct awc_private *priv = (struct awc_private *)dev->priv;
 	int retval = 0;
 //	unsigned long flags;
-	struct awc_fid * fid = NULL;
-	int cnt=0;
 
 	DEBUG(2, "%s: awc_start_xmit \n",  dev->name);
 
@@ -3021,48 +3015,13 @@
 		return -1;
 	};
 
-	/* Transmitter timeout, serious problems. */
-	if (test_and_set_bit( 0, (void *) &dev->tbusy) ) {
-		if (jiffies - dev->trans_start > 3* HZ ){
-			// save_flags(flags);
-        		// cli();
-        		fid = priv->tx_in_transmit.head;
-        		cnt = 0;
-			while (fid){
-				if (jiffies - fid->transmit_start_time > (HZ)){
-				//	printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name,
-				//		jiffies - fid->transmit_start_time );
-					awc_fid_queue_remove(&priv->tx_in_transmit, fid);
-					if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
-                				awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
-        				else
-                				awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
-					dev->tbusy = 0;
-				}
-				fid = fid->next;
-                		if (cnt++ > 200) {
-                        		printk("bbb in awc_fid_queue\n");
-                        //		restore_flags(flags);
-                        		return -1;
-                		};
-
-			}
-			//restore_flags(flags);
-			//debug =0x8;
-		};
-		if (jiffies - dev->trans_start >= (5* HZ) ) {
-			awc_tx_timeout(dev);
-		}
-		return 1;
-	}
-
 	if (!skb) {
 		DEBUG(1, " xmit skb=NULL, jiffie %ld \n",jiffies);
 		return -1;
 	};
 	
 	if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) {
-		dev->tbusy=0;
+		netif_start_queue (dev);
 		return 1;
 	}
 
@@ -3075,15 +3034,7 @@
 	return retval;
 }
 
-int awc_tx_done(struct awc_fid * rx_fid){
- 	
-// 	dev->tbusy = 0;
- 	mark_bh(NET_BH);
- 	
-	return 0;
-};
-
-int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
+int awc_rx(struct net_device *dev, struct awc_fid * rx_fid) {
 
 //	struct awc_private *lp = (struct awc_private *)dev->priv;
 
@@ -3109,7 +3060,7 @@
 
  void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-	struct NET_DEVICE *dev = (struct NET_DEVICE *)dev_id;
+	struct net_device *dev = (struct net_device *)dev_id;
 //	struct awc_private *lp;
 //	unsigned long flags;
 
@@ -3133,7 +3084,7 @@
 
 
 
- struct enet_statistics *awc_get_stats(struct NET_DEVICE *dev)
+ struct enet_statistics *awc_get_stats(struct net_device *dev)
 {
 	struct awc_private *priv = (struct awc_private *)dev->priv;
 //        unsigned long flags;
@@ -3142,7 +3093,7 @@
 	
 	DEBUG(2, "%s: awc_get_stats \n",  dev->name);
 
-	if (!dev->start) {
+	if (!netif_running(dev)) {
 		return 0;			
 	}
 //	save_flags(flags);
@@ -3175,7 +3126,7 @@
 }
 
 
-int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){
+int awc_change_mtu(struct net_device *dev, int new_mtu){
 
 //	struct awc_private *priv = (struct awc_private *)dev->priv;
 //        unsigned long flags;
@@ -3183,7 +3134,7 @@
        if ((new_mtu < 256 ) || (new_mtu > 2312) || (max_mtu && new_mtu > max_mtu) )
                 return -EINVAL;
 
-	if (dev->start) {
+	if (netif_running(dev)) {
 		printk("PLEASE, ifconfig %s down for mtu change\n",dev->name);
 
 	};
@@ -3207,7 +3158,7 @@
 
 
  void
-awc_set_multicast_list(struct NET_DEVICE *dev) {
+awc_set_multicast_list(struct net_device *dev) {
 //	int ioaddr = dev->base_addr;
 
 /*	if (dev->flags & IFF_PROMISC)
diff -u --recursive --new-file v2.3.48/linux/drivers/net/aironet4500_proc.c linux/drivers/net/aironet4500_proc.c
--- v2.3.48/linux/drivers/net/aironet4500_proc.c	Mon Dec 20 18:48:21 1999
+++ linux/drivers/net/aironet4500_proc.c	Mon Feb 28 07:16:54 2000
@@ -264,7 +264,7 @@
 
 	struct awc_rid_dir * rid_dir;
 
-	struct NET_DEVICE * dev= NULL;
+	struct net_device * dev= NULL;
 	struct aironet4500_RID * rid = (struct aironet4500_RID * ) ctl->extra2;
 	
  
diff -u --recursive --new-file v2.3.48/linux/drivers/net/aironet4500_rid.c linux/drivers/net/aironet4500_rid.c
--- v2.3.48/linux/drivers/net/aironet4500_rid.c	Wed Dec  8 14:11:26 1999
+++ linux/drivers/net/aironet4500_rid.c	Mon Feb 28 07:16:54 2000
@@ -2134,7 +2134,7 @@
 int awc_nof_rids = (sizeof(awc_rids) / sizeof(struct awc_rid_dir)) -1;
 
 
-int awc_rids_setup(struct NET_DEVICE * dev){
+int awc_rids_setup(struct net_device * dev){
 
 	struct awc_private * priv = (struct awc_private *) dev->priv;
 	int i=0;
diff -u --recursive --new-file v2.3.48/linux/drivers/net/am79c961a.c linux/drivers/net/am79c961a.c
--- v2.3.48/linux/drivers/net/am79c961a.c	Wed Aug 18 11:36:41 1999
+++ linux/drivers/net/am79c961a.c	Mon Feb 28 07:16:54 2000
@@ -20,13 +20,13 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
+#include <linux/delay.h>
 
 #include <asm/system.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/ecard.h>
-#include <asm/delay.h>
 
 #define TX_BUFFERS 15
 #define RX_BUFFERS 25
diff -u --recursive --new-file v2.3.48/linux/drivers/net/arlan.c linux/drivers/net/arlan.c
--- v2.3.48/linux/drivers/net/arlan.c	Mon Dec 20 18:48:21 1999
+++ linux/drivers/net/arlan.c	Mon Feb 28 07:16:54 2000
@@ -102,6 +102,7 @@
 static  void 	arlan_tx_done_interrupt		(struct net_device * dev, int status);
 static  void	arlan_rx_interrupt		(struct net_device * dev, u_char rxStatus, u_short, u_short);
 static  void	arlan_process_interrupt		(struct net_device * dev);
+static	void	arlan_tx_timeout		(struct net_device *dev);
 int	arlan_command(struct net_device * dev, int command);
 
 EXPORT_SYMBOL(arlan_command);
@@ -182,10 +183,7 @@
 		priv->txOffset = 0;
 		priv->bad = 0;
 		if (!priv->under_reset && !priv->under_config)
-		{
-			dev->tbusy = 0;
-			mark_bh(NET_BH);
-		}
+			netif_wake_queue (dev);
 	}
 	return 1;
 };
@@ -288,15 +286,9 @@
 		}
 	}
 	if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
-	{
 		priv->under_reset = 1;
-		dev->start = 0;
-	}
 	if (priv->waiting_command_mask & ARLAN_COMMAND_CONF)
-	{
 		priv->under_config = 1;
-		dev->start = 0;
-	}
 
 	/* Issuing command */
 	arlan_lock_card_access(dev);
@@ -341,14 +333,14 @@
 	else if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
 	{
 		priv->under_reset=1;
-		dev->tbusy = 1;
+		netif_stop_queue (dev);
 
 		arlan_drop_tx(dev);
 		if (priv->tx_command_given || priv->rx_command_given)
 		{
 			printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
 		};
-		dev->tbusy = 1;
+		netif_stop_queue (dev);
 		if (arlan_debug & ARLAN_DEBUG_RESET)
 			printk(KERN_ERR "%s: Doing chip reset\n", dev->name);
 		priv->lastReset = jiffies;
@@ -388,7 +380,6 @@
 		{
 			printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
 		}
-		dev->start = 0;
 		arlan_drop_tx(dev);
 		setInterruptEnable(dev);
 		arlan_hw_config(dev);
@@ -437,13 +428,11 @@
 	}
 	else if (priv->waiting_command_mask & ARLAN_COMMAND_TBUSY_CLEAR)
 	{
-		if ( !registrationBad(dev) && (dev->tbusy || !dev->start) )
+		if ( !registrationBad(dev) &&
+		     (netif_queue_stopped(dev) || !netif_running(dev)) )
 			{
 				priv->waiting_command_mask &= ~ARLAN_COMMAND_TBUSY_CLEAR;
-
-				dev->tbusy = 0;
-				dev->start = 1;
-				mark_bh(NET_BH);
+				netif_wake_queue (dev);
 			};
 	}
 	else if (priv->waiting_command_mask & ARLAN_COMMAND_TX)
@@ -587,8 +576,7 @@
 		else
 			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "ReTransmit buff empty");
 		priv->txOffset = 0;
-		dev->tbusy = 0;
-		mark_bh(NET_BH);
+		netif_wake_queue (dev);
 		return;
 
 	}
@@ -650,11 +638,8 @@
 		priv->registrationLastSeen = jiffies;
 		priv->registrationLostCount = 0;
 		priv->reRegisterExp = 1;
-		if (dev->start == 0)
-		{
-			dev->start = 1;
-			mark_bh(NET_BH);
-		}
+		if (!netif_running(dev))
+			netif_wake_queue(dev);
 	}
 
 
@@ -682,8 +667,7 @@
 		if (!(TXHEAD(dev).offset && TXTAIL(dev).offset))
 		{
 			priv->txOffset = 0;
-			dev->tbusy = 0;
-			mark_bh(NET_BH);
+			netif_wake_queue (dev);
 		}
 		priv->tx_done_delayed = 0;
 		bh_mark_needed = 1;
@@ -691,8 +675,7 @@
 	if (bh_mark_needed)
 	{
 		priv->txOffset = 0;
-		dev->tbusy = 0;
-		mark_bh(NET_BH);
+		netif_wake_queue (dev);
 	}
 	arlan_process_interrupt(dev);
 
@@ -788,7 +771,7 @@
 	}
 	else
 	{
-		dev->tbusy = 1;
+		netif_stop_queue (dev);
 		return -1;
 		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
 			printk(KERN_ERR "TX TAIL & HEAD full, return, tailStart %d headEnd %d\n", tailStarts, headEnds);
@@ -811,11 +794,11 @@
 	}
 	if (TXHEAD(dev).offset && TXTAIL(dev).offset)
 	{
-		dev->tbusy = 1;
+		netif_stop_queue (dev);
 		return 0;
 	}
 	else
-		dev->tbusy = 0;
+		netif_start_queue (dev);
 
 
 	IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
@@ -1161,7 +1144,7 @@
 	ARLAN_DEBUG_ENTRY("arlan_mac_addr");
 	return -EINVAL;
 
-	if (dev->start)
+	if (!netif_running(dev))
 		return -EBUSY;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
 
@@ -1223,8 +1206,8 @@
 	dev->set_multicast_list = arlan_set_multicast;
 	dev->change_mtu = arlan_change_mtu;
 	dev->set_mac_address = arlan_mac_addr;
-	dev->tbusy = 1;
-	dev->start = 0;
+	dev->tx_timeout = arlan_tx_timeout;
+	dev->watchdog_timeo = 3*HZ;
 	
 	((struct arlan_private *) dev->priv)->irq_test_done = 0;
 	arlan_device[num] = dev;
@@ -1302,14 +1285,13 @@
 	priv->open_time = jiffies;
 	memcpy_fromio(dev->dev_addr, arlan->lanCardNodeId, 6);
 	memset(dev->broadcast, 0xff, 6);
-	dev->tbusy = 1;
 	priv->txOffset = 0;
-	dev->interrupt = 0;
-	dev->start = 0;
 	dev->tx_queue_len = tx_queue_len;
 	priv->interrupt_processing_active = 0;
 	priv->command_lock = 0;
 
+	netif_start_queue (dev);
+
 	init_MUTEX(&priv->card_lock);
 	myATOMIC_INIT(priv->card_users, 1);	/* damn 2.0.33 */
 	priv->registrationLostCount = 0;
@@ -1327,7 +1309,6 @@
 	priv->Conf->writeEEPROM = 0;
 	priv->Conf->registrationInterrupts = 1;
 
-	dev->tbusy = 0;
 	init_timer(&priv->timer);
 	priv->timer.expires = jiffies + HZ / 10;
 	priv->timer.data = (unsigned long) dev;
@@ -1335,8 +1316,6 @@
 
 	arlan_command(dev, ARLAN_COMMAND_POWERUP | ARLAN_COMMAND_LONG_WAIT_NOW);
 	udelay(200000);
-	dev->tbusy = 0;
-	dev->start = 1;
 	add_timer(&priv->timer);
 
 	MOD_INC_USE_COUNT;
@@ -1351,69 +1330,43 @@
 }
 
 
+static void arlan_tx_timeout (struct net_device *dev)
+{
+	printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name);
+	/* Try to restart the adaptor. */
+	arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
+	dev->trans_start = jiffies;
+	netif_start_queue (dev);
+}
 
 
 static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
 {
 	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+	short length;
+	unsigned char *buf;
 
 	ARLAN_DEBUG_ENTRY("arlan_tx");
-
-	if (dev->tbusy)
-	{
-		/*
-		 * If we get here, some higher level has decided we are broken.
-		 * There should really be a "kick me" function call instead.
-		 */
-		int tickssofar = jiffies - dev->trans_start;
-
-		if (((tickssofar * 1000) / HZ) * 2 > conf->txTimeoutMs)
-			arlan_command(dev, ARLAN_COMMAND_TX_ABORT);
-
-		if (((tickssofar * 1000) / HZ) < conf->txTimeoutMs)
-		{
-			// up(&priv->card_lock);
-			goto bad_end;
-		}
-		printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name);
-		/* Try to restart the adaptor. */
-		arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
-		dev->trans_start = jiffies;
-		goto bad_end;
-
-	}
+	
 	/*
-	 * 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 some higher layer thinks we've missed an tx-done interrupt
+	 * we are passed NULL. Caution: dev_tint() handles the cli()/sti()
+	 * itself.
 	 */
-	if (test_and_set_bit(0, (void *) &dev->tbusy) != 0)
-	{
-		printk(KERN_ERR "%s: Transmitter access conflict.\n",
-			dev->name);
+
+	length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
+	buf = skb->data;
+
+	if (priv->txOffset + length + 0x12 > 0x800) {
+		printk(KERN_ERR "TX RING overflow \n");
+		netif_stop_queue (dev);
 	}
-	else
-	{
-		short length;
-		unsigned char *buf;
-		
-		/*
-		 * If some higher layer thinks we've missed an tx-done interrupt
-		 * we are passed NULL. Caution: dev_tint() handles the cli()/sti()
-		 * itself.
-		 */
-
-		length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
-		buf = skb->data;
 
-		if (priv->txOffset + length + 0x12 > 0x800)
-			printk(KERN_ERR "TX RING overflow \n");
+	if (arlan_hw_tx(dev, buf, length) == -1)
+		goto bad_end;
 
-		if (arlan_hw_tx(dev, buf, length) == -1)
-			goto bad_end;
+	dev->trans_start = jiffies;
 
-		dev->trans_start = jiffies;
-	}
 	dev_kfree_skb(skb);
 
 	arlan_process_interrupt(dev);
@@ -1424,6 +1377,7 @@
 bad_end:
 	arlan_process_interrupt(dev);
 	priv->tx_chain_active = 0;
+	netif_stop_queue (dev);
 	ARLAN_DEBUG_EXIT("arlan_tx");
 	return 1;
 }
@@ -1522,8 +1476,7 @@
 				if (!TXHEAD(dev).offset || !TXTAIL(dev).offset)
 				{
 					priv->txOffset = 0;
-					dev->tbusy = 0;
-					mark_bh(NET_BH);
+					netif_wake_queue (dev);
 				}
 			}
 		}
@@ -1852,15 +1805,12 @@
 			WRITESHMB(arlan->rxStatus, 0x00);
 			arlan_command(dev, ARLAN_COMMAND_RX);
 			if (registrationBad(dev))
-				dev->start = 0;
+				netif_device_detach(dev);
 			if (!registrationBad(dev))
 			{
 				priv->registrationLastSeen = jiffies;
-				if (!dev->tbusy && !priv->under_reset && !priv->under_config)
-				{
-					mark_bh(NET_BH);
-					dev->start = 1;
-				}
+				if (!netif_queue_stopped(dev) && !priv->under_reset && !priv->under_config)
+					netif_wake_queue (dev);
 			}
 			goto ends;
 		}
@@ -1900,12 +1850,10 @@
 
 	if (!rxStatus && !txStatus)
 		priv->interrupt_ack_requested++;
-	dev->interrupt++;
 
 	arlan_process_interrupt(dev);
 	
 	priv->irq_test_done = 1;
-	dev->interrupt--;
 
 	ARLAN_DEBUG_EXIT("arlan_interrupt");
 	return;
@@ -1938,8 +1886,7 @@
 		printk(KERN_NOTICE "%s: Closing device\n", dev->name);
 
 	priv->open_time = 0;
-	dev->tbusy = 1;
-	dev->start = 0;
+	netif_stop_queue(dev);
 	free_irq(dev->irq, dev);
 	MOD_DEC_USE_COUNT;
 
diff -u --recursive --new-file v2.3.48/linux/drivers/net/bonding.c linux/drivers/net/bonding.c
--- v2.3.48/linux/drivers/net/bonding.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/net/bonding.c	Mon Feb 28 07:18:20 2000
@@ -0,0 +1,350 @@
+/*
+ * originally based on the dummy device.
+ *
+ * Copyright 1999, Thomas Davis, tadavis@lbl.gov.  
+ * Licensed under the GPL. Based on dummy.c, and eql.c devices.
+ *
+ * bond.c: a bonding/etherchannel/sun trunking net driver
+ *
+ * This is useful to talk to a Cisco 5500, running Etherchannel, aka:
+ *	Linux Channel Bonding
+ *	Sun Trunking (Solaris)
+ *
+ * How it works:
+ *    ifconfig bond0 ipaddress netmask up
+ *      will setup a network device, with an ip address.  No mac address 
+ *	will be assigned at this time.  The hw mac address will come from 
+ *	the first slave bonded to the channel.  All slaves will then use 
+ *	this hw mac address.
+ *
+ *    ifconfig bond0 down
+ *         will release all slaves, marking them as down.
+ *
+ *    ifenslave bond0 eth0
+ *	will attache eth0 to bond0 as a slave.  eth0 hw mac address will either
+ *	a: be used as initial mac address
+ *	b: if a hw mac address already is there, eth0's hw mac address 
+ *	   will then  be set from bond0.
+ *
+ * v0.1 - first working version.
+ * v0.2 - changed stats to be calculated by summing slaves stats.
+ * 
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/types.h>
+#include <linux/fcntl.h>
+#include <linux/interrupt.h>
+#include <linux/ptrace.h>
+#include <linux/ioport.h>
+#include <linux/in.h>
+#include <linux/malloc.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/uaccess.h>
+#include <linux/errno.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+
+#include <linux/if_bonding.h>
+
+typedef struct slave
+{
+	struct slave *next;
+	struct slave *prev;
+	struct net_device *dev;
+} slave_t;
+
+typedef struct bonding
+{
+	slave_t *next;
+	slave_t *prev;
+	struct net_device *master;
+
+	slave_t *current_slave;
+	struct net_device_stats stats;
+} bonding_t;
+
+
+static int bond_xmit(struct sk_buff *skb, struct net_device *dev);
+static struct net_device_stats *bond_get_stats(struct net_device *dev);
+
+static struct net_device *this_bond;
+
+static int bond_open(struct net_device *dev)
+{
+	MOD_INC_USE_COUNT;
+	return 0;
+}
+
+static int bond_close(struct net_device *master)
+{
+	bonding_t *bond = master->priv;
+	slave_t *slave;
+
+	while ((slave = bond->next) != (slave_t*)bond) {
+
+		spin_lock_bh(&master->xmit_lock);
+		slave->next->prev = slave->prev;
+		slave->prev->next = slave->next;
+		bond->current_slave = (slave_t*)bond;
+		spin_unlock_bh(&master->xmit_lock);
+
+		netdev_set_master(slave->dev, NULL);
+
+		kfree(slave);
+	}
+
+	MOD_DEC_USE_COUNT;
+	return 0;
+}
+
+/* Fake multicast ability.
+
+   NB. It is possible and necessary to make it true one, otherwise
+   the device is not functional.
+ */
+static void bond_set_multicast_list(struct net_device *dev)
+{
+}
+
+static int bond_enslave(struct net_device *master, struct net_device *dev)
+{
+	int err;
+	bonding_t *bond = master->priv;
+	slave_t *slave;
+
+	if (dev->type != master->type)
+		return -ENODEV;
+
+	if ((slave = kmalloc(sizeof(slave_t), GFP_KERNEL)) == NULL)
+		return -ENOMEM;
+
+	memset(slave, 0, sizeof(slave_t));
+
+	err = netdev_set_master(dev, master);
+	if (err) {
+		kfree(slave);
+		return err;
+	}
+
+	slave->dev = dev;
+
+	spin_lock_bh(&master->xmit_lock);
+
+	dev_hold(dev);
+
+	slave->prev = bond->prev;
+	slave->next = (slave_t*)bond;
+	slave->prev->next = slave;
+	slave->next->prev = slave;
+
+	spin_unlock_bh(&master->xmit_lock);
+
+	MOD_INC_USE_COUNT;
+	return 0;
+}
+
+static int bond_release(struct net_device *master, struct net_device *dev)
+{
+	bonding_t *bond = master->priv;
+	slave_t *slave;
+
+	if (dev->master != master)
+		return -EINVAL;
+
+	netdev_set_master(dev, NULL);
+
+	for (slave = bond->next; slave != (slave_t*)bond; slave = slave->next) {
+		if (slave->dev == dev) {
+			spin_lock_bh(&master->xmit_lock);
+			if (bond->current_slave == slave)
+				bond->current_slave = slave->next;
+			slave->next->prev = slave->prev;
+			slave->prev->next = slave->next;
+			spin_unlock_bh(&master->xmit_lock);
+
+			kfree(slave);
+			dev_put(dev);
+			MOD_DEC_USE_COUNT;
+			break;
+		}
+	}
+
+	return 0;
+}
+
+/* It is pretty silly, SIOCSIFHWADDR exists to make this. */
+
+static int bond_sethwaddr(struct net_device *master, struct net_device *slave)
+{
+	memcpy(master->dev_addr, slave->dev_addr, slave->addr_len);
+	return 0;
+}
+
+static int bond_ioctl(struct net_device *master, struct ifreq *ifr, int cmd)
+{
+	struct net_device *slave = __dev_get_by_name(ifr->ifr_slave);
+
+	if (slave == NULL)
+		return -ENODEV;
+
+	switch (cmd) {
+	case BOND_ENSLAVE:
+		return bond_enslave(master, slave);
+	case BOND_RELEASE:
+		return bond_release(master, slave);
+	case BOND_SETHWADDR:
+		return bond_sethwaddr(master, slave);
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+
+static int bond_event(struct notifier_block *this, unsigned long event, void *ptr)
+{
+	struct net_device *slave = ptr;
+
+	if (this_bond == NULL ||
+	    this_bond == slave ||
+	    this_bond != slave->master)
+		return NOTIFY_DONE;
+
+	switch (event) {
+	case NETDEV_UNREGISTER:
+		bond_release(this_bond, slave);
+		break;
+	}
+
+	return NOTIFY_DONE;
+}
+
+struct notifier_block bond_netdev_notifier={
+	bond_event,
+	NULL,
+	0
+};
+
+int __init bond_init(struct net_device *dev)
+{
+	bonding_t *bond;
+
+	bond = kmalloc(sizeof(struct bonding), GFP_KERNEL);
+	if (bond == NULL)
+		return -ENOMEM;
+
+	memset(bond, 0, sizeof(struct bonding));
+	bond->next = (slave_t*)bond;
+	bond->prev = (slave_t*)bond;
+	bond->master = dev;
+	bond->current_slave = (slave_t*)bond;
+	dev->priv = bond;
+
+	/* Initialize the device structure. */
+	dev->hard_start_xmit = bond_xmit;
+	dev->get_stats	= bond_get_stats;
+	dev->open = bond_open;
+	dev->stop = bond_close;
+	dev->set_multicast_list = bond_set_multicast_list;
+	dev->do_ioctl = bond_ioctl;
+
+	/* Fill in the fields of the device structure with ethernet-generic 
+	   values. */
+	ether_setup(dev);
+	dev->tx_queue_len = 0;
+	dev->flags |= IFF_MASTER;
+
+	this_bond = dev;
+
+	register_netdevice_notifier(&bond_netdev_notifier);
+
+	return 0;
+}
+
+static int bond_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	bonding_t *bond = dev->priv;
+	slave_t *slave, *start_at;
+	int pkt_len = skb->len;
+
+	slave = start_at = bond->current_slave;
+
+	do {
+		if (slave == (slave_t*)bond)
+			continue;
+
+		if (netif_running(slave->dev) && netif_carrier_ok(dev)) {
+			bond->current_slave = slave->next;
+			skb->dev = slave->dev;
+
+			if (dev_queue_xmit(skb)) {
+				bond->stats.tx_dropped++;
+			} else {
+				bond->stats.tx_packets++;
+				bond->stats.tx_bytes += pkt_len;
+			}
+			return 0;
+		}
+	} while ((slave = slave->next) != start_at);
+
+	bond->stats.tx_dropped++;
+	kfree_skb(skb);
+	return 0;
+}
+
+static struct net_device_stats *bond_get_stats(struct net_device *dev)
+{
+	bonding_t *bond = dev->priv;
+
+	return &bond->stats;
+}
+
+#ifdef MODULE
+
+static char bond_name[16];
+
+static struct net_device dev_bond = {
+		bond_name, 	/* Needs to be writeable */
+		0, 0, 0, 0,
+	 	0x0, 0,
+	 	0, 0, 0, NULL, bond_init };
+
+int init_module(void)
+{
+	/* Find a name for this unit */
+	int err=dev_alloc_name(&dev_bond,"bond%d");
+
+	if (err<0)
+		return err;
+
+	if (register_netdev(&dev_bond) != 0)
+		return -EIO;
+
+	return 0;
+}
+
+void cleanup_module(void)
+{
+	unregister_netdevice_notifier(&bond_netdev_notifier);
+
+	unregister_netdev(&dev_bond);
+
+	kfree(dev_bond.priv);
+}
+#endif /* MODULE */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff -u --recursive --new-file v2.3.48/linux/drivers/net/fc/iph5526.c linux/drivers/net/fc/iph5526.c
--- v2.3.48/linux/drivers/net/fc/iph5526.c	Sun Feb 13 19:29:04 2000
+++ linux/drivers/net/fc/iph5526.c	Mon Feb 28 07:16:54 2000
@@ -218,6 +218,7 @@
 
 Scsi_Host_Template driver_template = IPH5526_SCSI_FC;
 
+static void iph5526_timeout(struct net_device *dev);
 
 #ifdef CONFIG_PCI
 static int iph5526_probe_pci(struct net_device *dev);
@@ -286,6 +287,8 @@
 	dev->get_stats = iph5526_get_stats;
 	dev->set_multicast_list = NULL;
 	dev->change_mtu = iph5526_change_mtu; 
+	dev->tx_timeout = iph5526_timeout;
+	dev->watchdog_timeo = 5*HZ;
 #ifndef MODULE
 	fc_setup(dev);
 #endif
diff -u --recursive --new-file v2.3.48/linux/drivers/net/hamradio/mkiss.c linux/drivers/net/hamradio/mkiss.c
--- v2.3.48/linux/drivers/net/hamradio/mkiss.c	Thu Nov 11 20:11:41 1999
+++ linux/drivers/net/hamradio/mkiss.c	Mon Feb 28 07:16:54 2000
@@ -320,16 +320,14 @@
 /* Set the "sending" flag.  This must be atomic, hence the ASM. */
 static inline void ax_lock(struct ax_disp *ax)
 {
-	if (test_and_set_bit(0, (void *)&ax->dev->tbusy))
-		printk(KERN_ERR "mkiss: %s: trying to lock already locked device!\n", ax->dev->name);
+	netif_stop_queue(ax->dev);
 }
 
 
 /* Clear the "sending" flag.  This must be atomic, hence the ASM. */
 static inline void ax_unlock(struct ax_disp *ax)
 {
-	if (!test_and_clear_bit(0, (void *)&ax->dev->tbusy))
-		printk(KERN_ERR "mkiss: %s: trying to unlock already unlocked device!\n", ax->dev->name);
+	netif_start_queue(ax->dev);
 }
 
 /* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
@@ -435,7 +433,7 @@
 	struct mkiss_channel *mkiss;
 
 	/* First make sure we're connected. */
-	if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start)
+	if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev))
 		return;
 	if (ax->xleft <= 0)  {
 		/* Now serial buffer is almost free & we can start
@@ -449,8 +447,7 @@
 				ax_unlock(ax->mkiss);
 	        }
 
-		ax_unlock(ax);
-		mark_bh(NET_BH);
+		netif_wake_queue(ax->dev);
 		return;
 	}
 
@@ -474,22 +471,22 @@
 		tmp_ax = ax->mkiss;
 	}
 
-	if (!dev->start)  {
+	if (!netif_running(dev))  {
 		printk(KERN_ERR "mkiss: %s: xmit call when iface is down\n", dev->name);
 		return 1;
 	}
 
 	if (tmp_ax != NULL)
-		if (tmp_ax->dev->tbusy)
+		if (netif_queue_stopped(tmp_ax->dev))
 			return 1;
 
 	if (tmp_ax != NULL)
-		if (dev->tbusy) {
+		if (netif_queue_stopped(dev)) {
 			printk(KERN_ERR "mkiss: dev busy while serial dev is free\n");
 			ax_unlock(ax);
 	        }
 
-	if (dev->tbusy) {
+	if (netif_queue_stopped(dev)) {
 		/*
 		 * May be we must check transmitter timeout here ?
 		 *      14 Oct 1994 Dmitry Gorodchanin.
@@ -583,9 +580,8 @@
 	ax->xleft    = 0;
 
 	ax->flags   &= (1 << AXF_INUSE);      /* Clear ESCAPE & ERROR flags */
-	dev->tbusy  = 0;
-	dev->start  = 1;
 
+	netif_start_queue(dev);
 	return 0;
 
 	/* Cleanup */
@@ -609,8 +605,7 @@
 
 	ax->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
 
-	dev->tbusy = 1;
-	dev->start = 0;
+	netif_stop_queue(dev);
 
 	return 0;
 }
@@ -630,7 +625,7 @@
 {
 	struct ax_disp *ax = (struct ax_disp *)tty->disc_data;
 
-	if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start)
+	if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev))
 		return;
 
 	/*
@@ -691,7 +686,7 @@
 	if (mkiss->magic  == MKISS_DRIVER_MAGIC) {
 		for (cnt = 1; cnt < ax25_maxdev; cnt++) {
 			if (ax25_ctrls[cnt]) {
-				if (ax25_ctrls[cnt]->dev.start) {
+				if (netif_running(&ax25_ctrls[cnt]->dev)) {
 					if (ax == &ax25_ctrls[cnt]->ctrl) {
 						cnt--;
 						tmp_ax = &ax25_ctrls[cnt]->ctrl;
@@ -802,7 +797,7 @@
 static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc, int len)
 {
 	unsigned char *ptr = d;
-	unsigned char c;
+	unsigned char c=0;
 
 	*ptr++ = END;
 	while (len > 0) {
@@ -1221,7 +1216,7 @@
 				 * VSV = if dev->start==0, then device
 				 * unregistred while close proc.
 				 */
-				if (ax25_ctrls[i]->dev.start)
+				if (netif_running(&ax25_ctrls[i]->dev))
 					unregister_netdev(&(ax25_ctrls[i]->dev));
 
 				kfree(ax25_ctrls[i]);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/ioc3-eth.c linux/drivers/net/ioc3-eth.c
--- v2.3.48/linux/drivers/net/ioc3-eth.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/net/ioc3-eth.c	Mon Feb 28 07:18:20 2000
@@ -48,7 +48,6 @@
  *  - Use hardware checksums.
  *  - Convert to using the PCI infrastructure / IOC3 meta driver.
  */
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/net/irda/nsc-ircc.c linux/drivers/net/irda/nsc-ircc.c
--- v2.3.48/linux/drivers/net/irda/nsc-ircc.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/net/irda/nsc-ircc.c	Thu Mar  2 11:41:11 2000
@@ -6,7 +6,7 @@
  * Status:        Stable.
  * Author:        Dag Brattli <dagb@cs.uit.no>
  * Created at:    Sat Nov  7 21:43:15 1998
- * Modified at:   Fri Feb 18 01:48:51 2000
+ * Modified at:   Wed Mar  1 11:29:34 2000
  * Modified by:   Dag Brattli <dagb@cs.uit.no>
  * 
  *     Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>
@@ -715,9 +715,9 @@
 	switch_bank(iobase, BANK2);
 	outb(EXCR2_RFSIZ|EXCR2_TFSIZ, iobase+EXCR2);
 
-	/* IRCR2: FEND_MD is set */
+	/* IRCR2: FEND_MD is not set */
 	switch_bank(iobase, BANK5);
- 	outb(0x2a, iobase+4);
+ 	outb(0x02, iobase+4);
 
 	/* Make sure that some defaults are OK */
 	switch_bank(iobase, BANK6);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/pcmcia/aironet4500_cs.c linux/drivers/net/pcmcia/aironet4500_cs.c
--- v2.3.48/linux/drivers/net/pcmcia/aironet4500_cs.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/net/pcmcia/aironet4500_cs.c	Mon Feb 28 07:16:54 2000
@@ -112,13 +112,13 @@
    by the net software, because we only register already-found cards.
 */
 
-static int awc_pcmcia_init(struct NET_DEVICE *dev)
+static int awc_pcmcia_init(struct net_device *dev)
 {
 	return awc_init(dev);
 
 }
 
-static int awc_pcmcia_open(struct NET_DEVICE *dev)
+static int awc_pcmcia_open(struct net_device *dev)
 {
 	dev_link_t *link;
 	int status;
@@ -136,7 +136,7 @@
 	return status;
 }
 
-static int awc_pcmcia_close(struct NET_DEVICE *dev)
+static int awc_pcmcia_close(struct net_device *dev)
 {
 //	int ioaddr = dev->base_addr;
 	dev_link_t *link;
@@ -170,7 +170,7 @@
 {
 	client_reg_t client_reg;
 	dev_link_t *link = NULL;
-	struct NET_DEVICE *dev = NULL;
+	struct net_device *dev = NULL;
 	int  ret;
 
 	PC_DEBUG(0, "awc_attach()\n");
@@ -199,8 +199,8 @@
 
 	/* Create the network device object. */
 
-	dev = kmalloc(sizeof(struct NET_DEVICE ), GFP_KERNEL);
-	memset(dev,0,sizeof(struct NET_DEVICE));
+	dev = kmalloc(sizeof(struct net_device ), GFP_KERNEL);
+	memset(dev,0,sizeof(struct net_device));
 //	dev =  init_etherdev(0, sizeof(struct awc_private) );
 	if (!dev ) {
 		printk(KERN_CRIT "out of mem on dev alloc \n");
@@ -321,10 +321,10 @@
 	}
 	
 	if (link->priv) {
-		//struct NET_DEVICE *dev = link->priv;
+		//struct net_device *dev = link->priv;
 		// dam dam damn mif (dev->priv)
 		//	kfree_s(dev->priv, sizeof(struct awc_private));
-		kfree_s(link->priv, sizeof(struct NET_DEVICE));
+		kfree_s(link->priv, sizeof(struct net_device));
 	}
 	kfree_s(link->dev, sizeof(struct dev_node_t));
 	kfree_s(link, sizeof(struct dev_link_t));
@@ -345,7 +345,7 @@
 static void awc_pcmcia_config(dev_link_t *link)
 {
 	client_handle_t handle;
-	struct NET_DEVICE *dev;
+	struct net_device *dev;
 	struct awc_private *lp;
 	tuple_t tuple;
 	int ii;
@@ -520,7 +520,7 @@
 static void awc_release(u_long arg)
 {
 	dev_link_t *link = (dev_link_t *)arg;
-	struct NET_DEVICE *dev = link->priv;
+	struct net_device *dev = link->priv;
 
 	DEBUG(0, "awc_release(0x%p)\n", link);
 
@@ -558,7 +558,7 @@
 					   event_callback_args_t *args)
 {
 	dev_link_t *link = args->client_data;
-	struct NET_DEVICE *dev = link->priv;
+	struct net_device *dev = link->priv;
 
 	PC_DEBUG(1, "awc_event(0x%06x)\n", event);
 
diff -u --recursive --new-file v2.3.48/linux/drivers/net/pcmcia/com20020_cs.c linux/drivers/net/pcmcia/com20020_cs.c
--- v2.3.48/linux/drivers/net/pcmcia/com20020_cs.c	Tue Jan  4 13:57:17 2000
+++ linux/drivers/net/pcmcia/com20020_cs.c	Mon Feb 28 07:16:54 2000
@@ -309,7 +309,7 @@
 	    {
 		DEBUG(1,"unregister...\n");
 
-		if (dev->start)
+		if (netif_running(dev))
 		    dev->stop(dev);
 	    
 		/*
@@ -501,7 +501,7 @@
     case CS_EVENT_CARD_REMOVAL:
         link->state &= ~DEV_PRESENT;
         if (link->state & DEV_CONFIG) {
-            dev->tbusy = 1; dev->start = 0;
+            netif_device_detach(dev);
             link->release.expires = jiffies + HZ/20;
             link->state |= DEV_RELEASE_PENDING;
             add_timer(&link->release);
@@ -517,7 +517,7 @@
     case CS_EVENT_RESET_PHYSICAL:
         if (link->state & DEV_CONFIG) {
             if (link->open) {
-                dev->tbusy = 1; dev->start = 0;
+                netif_device_detach(dev);
             }
             CardServices(ReleaseConfiguration, link->handle);
         }
diff -u --recursive --new-file v2.3.48/linux/drivers/net/rrunner.c linux/drivers/net/rrunner.c
--- v2.3.48/linux/drivers/net/rrunner.c	Tue Dec  7 09:32:43 1999
+++ linux/drivers/net/rrunner.c	Thu Mar  2 11:42:31 2000
@@ -1,7 +1,7 @@
 /*
  * rrunner.c: Linux driver for the Essential RoadRunner HIPPI board.
  *
- * Written 1998 by Jes Sorensen, <Jes.Sorensen@cern.ch>.
+ * Copyright (C) 1998-2000 by Jes Sorensen, <Jes.Sorensen@cern.ch>.
  *
  * Thanks to Essential Communication for providing us with hardware
  * and very comprehensive documentation without which I would not have
@@ -13,6 +13,12 @@
  * 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.
+ *
+ * Thanks to Jayaram Bhat from ODS/Essential for fixing some of the
+ * stupid bugs in my code.
+ *
+ * Softnet support and various other patches from Val Henson of
+ * ODS/Essential.
  */
 
 #define DEBUG 1
@@ -20,7 +26,7 @@
 #define PKT_COPY_THRESHOLD 512
 
 #include <linux/module.h>
-
+#include <linux/version.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
@@ -32,17 +38,53 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
-#include <linux/cache.h>
 #include <net/sock.h>
 
 #include <asm/system.h>
+#include <asm/cache.h>
 #include <asm/byteorder.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 
+#if (LINUX_VERSION_CODE < 0x02030e)
+#define net_device device
+#endif
+
+#if (LINUX_VERSION_CODE >= 0x02031b)
+#define NEW_NETINIT
+#endif
+
+#if (LINUX_VERSION_CODE < 0x02032b)
+/*
+ * SoftNet changes
+ */
+#define dev_kfree_skb_irq(a)	dev_kfree_skb(a)
+#define netif_wake_queue(dev)	clear_bit(0, &dev->tbusy)
+#define netif_stop_queue(dev)	set_bit(0, &dev->tbusy)
+
+static inline void netif_start_queue(struct net_device *dev)
+{
+	dev->tbusy = 0;
+	dev->start = 1;
+}
+
+#define rr_mark_net_bh(foo) mark_bh(foo)
+#define rr_if_busy(dev)     dev->tbusy
+#define rr_if_running(dev)  dev->start /* Currently unused. */
+#define rr_if_down(dev)     {do{dev->start = 0;}while (0);}
+#else
+#define NET_BH              0
+#define rr_mark_net_bh(foo) {do{} while(0);}
+#define rr_if_busy(dev)     test_bit(LINK_STATE_XOFF, &dev->state)
+#define rr_if_running(dev)  test_bit(LINK_STATE_START, &dev->state)
+#define rr_if_down(dev)     {do{} while(0);}
+#endif
+
 #include "rrunner.h"
 
+#define RUN_AT(x) (jiffies + (x))
+
 
 /*
  * Implementation notes:
@@ -59,7 +101,9 @@
  * stack will need to know about I/O vectors or something similar.
  */
 
-static const char __initdata *version = "rrunner.c: v0.17 03/09/99  Jes Sorensen (Jes.Sorensen@cern.ch)\n";
+static const char __initdata *version = "rrunner.c: v0.22 03/01/2000  Jes Sorensen (Jes.Sorensen@cern.ch)\n";
+
+static struct net_device *root_dev = NULL;
 
 
 /*
@@ -72,11 +116,17 @@
 
 static int probed __initdata = 0;
 
+#ifdef NEW_NETINIT
 int __init rr_hippi_probe (void)
+#else
+int __init rr_hippi_probe (struct net_device *dev)
+#endif
 {
+#ifdef NEW_NETINIT
+	struct net_device *dev;
+#endif
 	int boards_found = 0;
 	int version_disp;	/* was version info already displayed? */
-	struct net_device *dev;
 	struct pci_dev *pdev = NULL;
 	struct pci_dev *opdev = NULL;
 	u8 pci_latency;
@@ -128,10 +178,11 @@
 		dev->get_stats = &rr_get_stats;
 		dev->do_ioctl = &rr_ioctl;
 
-		/*
-		 * Dummy value.
-		 */
-		dev->base_addr = 42;
+#if (LINUX_VERSION_CODE < 0x02030d)
+		dev->base_addr = pdev->base_address[0];
+#else
+		dev->base_addr = pdev->resource[0].start;
+#endif
 
 		/* display version info if adapter is found */
 		if (!version_disp)
@@ -153,14 +204,14 @@
 
 		printk(KERN_INFO "%s: Essential RoadRunner serial HIPPI "
 		       "at 0x%08lx, irq %i, PCI latency %i\n", dev->name,
-		       pdev->resource[0].start, dev->irq, pci_latency);
+		       dev->base_addr, dev->irq, pci_latency);
 
 		/*
 		 * Remap the regs into kernel space.
 		 */
 
 		rrpriv->regs = (struct rr_regs *)
-			ioremap(pdev->resource[0].start, 0x1000);
+			ioremap(dev->base_addr, 0x1000);
 
 		if (!rrpriv->regs){
 			printk(KERN_ERR "%s:  Unable to map I/O register, "
@@ -193,10 +244,16 @@
 	 * 1 or more boards. Otherwise, return failure (-ENODEV).
 	 */
 
+#ifdef MODULE
 	return boards_found;
+#else
+	if (boards_found > 0)
+		return 0;
+	else
+		return -ENODEV;
+#endif
 }
 
-static struct net_device *root_dev = NULL;
 
 #ifdef MODULE
 #if LINUX_VERSION_CODE > 0x20118
@@ -204,10 +261,18 @@
 MODULE_DESCRIPTION("Essential RoadRunner HIPPI driver");
 #endif
 
-
 int init_module(void)
 {
-	return rr_hippi_probe()? 0 : -ENODEV;
+	int cards;
+
+	root_dev = NULL;
+
+#ifdef NEW_NETINIT
+	cards = rr_hippi_probe();
+#else
+	cards = rr_hippi_probe(NULL);
+#endif
+	return cards ? 0 : -ENODEV;
 }
 
 void cleanup_module(void)
@@ -260,11 +325,11 @@
 	idx = rrpriv->info->cmd_ctrl.pi;
 
 	writel(*(u32*)(cmd), &regs->CmdRing[idx]);
-	mb();
+	wmb();
 
 	idx = (idx - 1) % CMD_RING_ENTRIES;
 	rrpriv->info->cmd_ctrl.pi = idx;
-	mb();
+	wmb();
 
 	if (readl(&regs->Mode) & FATAL_ERR)
 		printk("error code %02x\n", readl(&regs->Fail1));
@@ -363,8 +428,8 @@
 /*
  * Why 32 ? is this not cache line size dependant?
  */
-	writel(WBURST_32, &regs->PciState);
-	mb();
+	writel(RBURST_64|WBURST_64, &regs->PciState);
+	wmb();
 
 	start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart);
 
@@ -374,11 +439,11 @@
 #endif
 
 	writel(start_pc + 0x800, &regs->Pc);
-	mb();
+	wmb();
 	udelay(5);
 
 	writel(start_pc, &regs->Pc);
-	mb();
+	wmb();
 
 	return 0;
 }
@@ -495,7 +560,9 @@
 {
 	struct rr_private *rrpriv;
 	struct rr_regs *regs;
+	struct eeprom *hw = NULL;
 	u32 sram_size, rev;
+	int i;
 
 	rrpriv = (struct rr_private *)dev->priv;
 	regs = rrpriv->regs;
@@ -519,6 +586,26 @@
 	printk("  Maximum receive rings %i\n", readl(&regs->MaxRxRng));
 #endif
 
+	/*
+	 * Read the hardware address from the eeprom.  The HW address
+	 * is not really necessary for HIPPI but awfully convenient.
+	 * The pointer arithmetic to put it in dev_addr is ugly, but
+	 * Donald Becker does it this way for the GigE version of this
+	 * card and it's shorter and more portable than any
+	 * other method I've seen.  -VAL
+	 */
+
+	*(u16 *)(dev->dev_addr) =
+	  htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA));
+	*(u32 *)(dev->dev_addr+2) =
+	  htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4]));
+	
+	printk("  MAC: ");
+
+	for (i = 0; i < 5; i++)
+		printk("%2.2x:", dev->dev_addr[i]);
+	printk("%2.2x\n", dev->dev_addr[i]);
+
 	sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
 	printk("  SRAM size 0x%06x\n", sram_size);
 
@@ -545,9 +632,10 @@
 {
 	struct rr_private *rrpriv;
 	struct rr_regs *regs;
-	u32 hostctrl;
 	unsigned long myjif, flags;
 	struct cmd cmd;
+	u32 hostctrl;
+	int ecode = 0;
 	short i;
 
 	rrpriv = (struct rr_private *)dev->priv;
@@ -557,13 +645,14 @@
 
 	hostctrl = readl(&regs->HostCtrl);
 	writel(hostctrl | HALT_NIC | RR_CLEAR_INT, &regs->HostCtrl);
-	mb();
+	wmb();
 
 	if (hostctrl & PARITY_ERR){
 		printk("%s: Parity error halting NIC - this is serious!\n",
 		       dev->name);
 		spin_unlock_irqrestore(&rrpriv->lock, flags);
-		return -EFAULT;
+		ecode = -EFAULT;
+		goto error;
 	}
 
 	set_rxaddr(regs, rrpriv->rx_ctrl);
@@ -607,45 +696,36 @@
 
 	rr_reset(dev);
 
-	writel(0x60, &regs->IntrTmr);
-	/*
-	 * These seem to have no real effect as the Firmware sets
-	 * it's own default values
-	 */
-	writel(0x10, &regs->WriteDmaThresh);
-	writel(0x20, &regs->ReadDmaThresh);
+	/* Tuning values */
+	writel(0x5000, &regs->ConRetry);
+	writel(0x100, &regs->ConRetryTmr);
+	writel(0x500000, &regs->ConTmout);
+ 	writel(0x60, &regs->IntrTmr);
+	writel(0x500000, &regs->TxDataMvTimeout);
+	writel(0x200000, &regs->RxDataMvTimeout);
+ 	writel(0x80, &regs->WriteDmaThresh);
+ 	writel(0x80, &regs->ReadDmaThresh);
 
 	rrpriv->fw_running = 0;
-	mb();
+	wmb();
 
 	hostctrl &= ~(HALT_NIC | INVALID_INST_B | PARITY_ERR);
 	writel(hostctrl, &regs->HostCtrl);
-	mb();
+	wmb();
 
 	spin_unlock_irqrestore(&rrpriv->lock, flags);
 
-	udelay(1000);
-
-	/*
-	 * Now start the FirmWare.
-	 */
-	cmd.code = C_START_FW;
-	cmd.ring = 0;
-	cmd.index = 0;
-
-	rr_issue_cmd(rrpriv, &cmd);
-
-	/*
-	 * Give the FirmWare time to chew on the `get running' command.
-	 */
-	myjif = jiffies + 5 * HZ;
-	while ((jiffies < myjif) && !rrpriv->fw_running);
-
 	for (i = 0; i < RX_RING_ENTRIES; i++) {
 		struct sk_buff *skb;
 
 		rrpriv->rx_ring[i].mode = 0;
 		skb = alloc_skb(dev->mtu + HIPPI_HLEN, GFP_ATOMIC);
+		if (!skb) {
+			printk(KERN_WARNING "%s: Unable to allocate memory "
+			       "for receive ring - halting NIC\n", dev->name);
+			ecode = -ENOMEM;
+			goto error;
+		}
 		rrpriv->rx_skbuff[i] = skb;
 		/*
 		 * Sanity test to see if we conflict with the DMA
@@ -662,28 +742,43 @@
 	rrpriv->rx_ctrl[4].entries = RX_RING_ENTRIES;
 	rrpriv->rx_ctrl[4].mode = 8;
 	rrpriv->rx_ctrl[4].pi = 0;
-	mb();
+	wmb();
 	set_rraddr(&rrpriv->rx_ctrl[4].rngptr, rrpriv->rx_ring);
 
-	cmd.code = C_NEW_RNG;
-	cmd.ring = 4;
+	udelay(1000);
+
+	/*
+	 * Now start the FirmWare.
+	 */
+	cmd.code = C_START_FW;
+	cmd.ring = 0;
 	cmd.index = 0;
+
 	rr_issue_cmd(rrpriv, &cmd);
 
-#if 0
-{
-	u32 tmp;
-	tmp = readl(&regs->ExtIo);
-	writel(0x80, &regs->ExtIo);
-	
-	i = jiffies + 1 * HZ;
-	while (jiffies < i);
-	writel(tmp, &regs->ExtIo);
-}
-#endif
-	dev->tbusy = 0;
-	dev->start = 1;
-	return 0;
+	/*
+	 * Give the FirmWare time to chew on the `get running' command.
+	 */
+	myjif = jiffies + 5 * HZ;
+	while ((jiffies < myjif) && !rrpriv->fw_running);
+
+	netif_start_queue(dev);
+
+	return ecode;
+
+ error:
+	/*
+	 * We might have gotten here because we are out of memory,
+	 * make sure we release everything we allocated before failing
+	 */
+	for (i = 0; i < RX_RING_ENTRIES; i++) {
+		if (rrpriv->rx_skbuff[i]) {
+			rrpriv->rx_ring[i].size = 0;
+			set_rraddr(&rrpriv->rx_ring[i].addr, 0);
+			dev_kfree_skb(rrpriv->rx_skbuff[i]);
+		}
+	}
+	return ecode;
 }
 
 
@@ -705,81 +800,147 @@
 		switch (rrpriv->evt_ring[eidx].code){
 		case E_NIC_UP:
 			tmp = readl(&regs->FwRev);
-			printk("%s: Firmware revision %i.%i.%i up and running\n",
-			       dev->name, (tmp >> 16), ((tmp >> 8) & 0xff),
-			       (tmp & 0xff));
+			printk(KERN_INFO "%s: Firmware revision %i.%i.%i "
+			       "up and running\n", dev->name,
+			       (tmp >> 16), ((tmp >> 8) & 0xff), (tmp & 0xff));
 			rrpriv->fw_running = 1;
-			mb();
+			writel(RX_RING_ENTRIES - 1, &regs->IpRxPi);
+			wmb();
 			break;
 		case E_LINK_ON:
-			printk("%s: Optical link ON\n", dev->name);
+			printk(KERN_INFO "%s: Optical link ON\n", dev->name);
 			break;
 		case E_LINK_OFF:
-			printk("%s: Optical link OFF\n", dev->name);
+			printk(KERN_INFO "%s: Optical link OFF\n", dev->name);
 			break;
 		case E_RX_IDLE:
-			printk("%s: RX data not moving\n", dev->name);
+			printk(KERN_WARNING "%s: RX data not moving\n",
+			       dev->name);
 			break;
 		case E_WATCHDOG:
-			printk("%s: The watchdog is here to see us\n",
+			printk(KERN_INFO "%s: The watchdog is here to see "
+			       "us\n", dev->name);
+			break;
+		case E_INTERN_ERR:
+			printk(KERN_ERR "%s: HIPPI Internal NIC error\n",
 			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
+		case E_HOST_ERR:
+			printk(KERN_ERR "%s: Host software error\n",
+			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
 			break;
 		/*
 		 * TX events.
 		 */
 		case E_CON_REJ:
-			printk("%s: Connection rejected\n", dev->name);
+			printk(KERN_WARNING "%s: Connection rejected\n",
+			       dev->name);
 			rrpriv->stats.tx_aborted_errors++;
 			break;
 		case E_CON_TMOUT:
-			printk("%s: Connection timeout\n", dev->name);
+			printk(KERN_WARNING "%s: Connection timeout\n",
+			       dev->name);
 			break;
 		case E_DISC_ERR:
-			printk("%s: HIPPI disconnect error\n", dev->name);
+			printk(KERN_WARNING "%s: HIPPI disconnect error\n",
+			       dev->name);
 			rrpriv->stats.tx_aborted_errors++;
 			break;
+		case E_INT_PRTY:
+			printk(KERN_ERR "%s: HIPPI Internal Parity error\n",
+			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
 		case E_TX_IDLE:
-			printk("%s: Transmitter idle\n", dev->name);
+			printk(KERN_WARNING "%s: Transmitter idle\n",
+			       dev->name);
 			break;
 		case E_TX_LINK_DROP:
-			printk("%s: Link lost during transmit\n", dev->name);
+			printk(KERN_WARNING "%s: Link lost during transmit\n",
+			       dev->name);
 			rrpriv->stats.tx_aborted_errors++;
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
+		case E_TX_INV_RNG:
+			printk(KERN_ERR "%s: Invalid send ring block\n",
+			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
+		case E_TX_INV_BUF:
+			printk(KERN_ERR "%s: Invalid send buffer address\n",
+			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
+		case E_TX_INV_DSC:
+			printk(KERN_ERR "%s: Invalid descriptor address\n",
+			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
 			break;
 		/*
 		 * RX events.
 		 */
-		case E_VAL_RNG:		/* Should be ignored */
-#if (DEBUG > 2)
-			printk("%s: RX ring valid event\n", dev->name);
-#endif
-			writel(RX_RING_ENTRIES - 1, &regs->IpRxPi);
-			break;
-		case E_INV_RNG:
-			printk("%s: RX ring invalid event\n", dev->name);
-			break;
 		case E_RX_RNG_OUT:
-			printk("%s: Receive ring full\n", dev->name);
+			printk(KERN_INFO "%s: Receive ring full\n", dev->name);
 			break;
 
 		case E_RX_PAR_ERR:
-			printk("%s: Receive parity error.\n", dev->name);
+			printk(KERN_WARNING "%s: Receive parity error\n",
+			       dev->name);
 			break;
 		case E_RX_LLRC_ERR:
-			printk("%s: Receive LLRC error.\n", dev->name);
+			printk(KERN_WARNING "%s: Receive LLRC error\n",
+			       dev->name);
 			break;
 		case E_PKT_LN_ERR:
-			printk("%s: Receive packet length error.\n",
+			printk(KERN_WARNING "%s: Receive packet length "
+			       "error\n", dev->name);
+			break;
+		case E_RX_INV_BUF:
+			printk(KERN_ERR "%s: Invalid receive buffer "
+			       "address\n", dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
+		case E_RX_INV_DSC:
+			printk(KERN_ERR "%s: Invalid receive descriptor "
+			       "address\n", dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
+			break;
+		case E_RNG_BLK:
+			printk(KERN_ERR "%s: Invalid ring block\n",
 			       dev->name);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			wmb();
 			break;
 		default:
-			printk("%s: Unhandled event 0x%02x\n",
+			printk(KERN_WARNING "%s: Unhandled event 0x%02x\n",
 			       dev->name, rrpriv->evt_ring[eidx].code);
 		}
 		eidx = (eidx + 1) % EVT_RING_ENTRIES;
 	}
 
 	rrpriv->info->evt_ctrl.pi = eidx;
-	mb();
+	wmb();
 	return eidx;
 }
 
@@ -787,10 +948,10 @@
 static void rx_int(struct net_device *dev, u32 rxlimit, u32 index)
 {
 	struct rr_private *rrpriv = (struct rr_private *)dev->priv;
-	u32 pkt_len;
 	struct rr_regs *regs = rrpriv->regs;
 
 	do {
+		u32 pkt_len;
 		pkt_len = rrpriv->rx_ring[index].size;
 #if (DEBUG > 2)
 		printk("index %i, rxlimit %i\n", index, rxlimit);
@@ -803,8 +964,7 @@
 			if (pkt_len < PKT_COPY_THRESHOLD) {
 				skb = alloc_skb(pkt_len, GFP_ATOMIC);
 				if (skb == NULL){
-					printk("%s: Out of memory deferring "
-					       "packet\n", dev->name);
+					printk(KERN_WARNING "%s: Unable to allocate skb (%i bytes), deferring packet\n", dev->name, pkt_len);
 					rrpriv->stats.rx_dropped++;
 					goto defer;
 				}else
@@ -847,7 +1007,7 @@
 	} while(index != rxlimit);
 
 	rrpriv->cur_rx = index;
-	mb();
+	wmb();
 }
 
 
@@ -857,7 +1017,6 @@
 	struct rr_regs *regs;
 	struct net_device *dev = (struct net_device *)dev_id;
 	u32 prodidx, rxindex, eidx, txcsmr, rxlimit, txcon;
-	unsigned long flags;
 
 	rrpriv = (struct rr_private *)dev->priv;
 	regs = rrpriv->regs;
@@ -865,7 +1024,7 @@
 	if (!(readl(&regs->HostCtrl) & RR_INT))
 		return;
 
-	spin_lock_irqsave(&rrpriv->lock, flags);
+	spin_lock(&rrpriv->lock);
 
 	prodidx = readl(&regs->EvtPrd);
 	txcsmr = (prodidx >> 8) & 0xff;
@@ -886,7 +1045,7 @@
 		do {
 			rrpriv->stats.tx_packets++;
 			rrpriv->stats.tx_bytes +=rrpriv->tx_skbuff[txcon]->len;
-			dev_kfree_skb(rrpriv->tx_skbuff[txcon]);
+			dev_kfree_skb_irq(rrpriv->tx_skbuff[txcon]);
 
 			rrpriv->tx_skbuff[txcon] = NULL;
 			rrpriv->tx_ring[txcon].size = 0;
@@ -895,15 +1054,15 @@
 
 			txcon = (txcon + 1) % TX_RING_ENTRIES;
 		} while (txcsmr != txcon);
-		mb();
+		wmb();
 
 		rrpriv->dirty_tx = txcon;
-		if (rrpriv->tx_full && dev->tbusy &&
+		if (rrpriv->tx_full && rr_if_busy(dev) &&
 		    (((rrpriv->info->tx_ctrl.pi + 1) % TX_RING_ENTRIES)
 		     != rrpriv->dirty_tx)){
 			rrpriv->tx_full = 0;
-			dev->tbusy = 0;
-			mark_bh(NET_BH);
+			netif_wake_queue(dev);
+			rr_mark_net_bh(NET_BH);
 		}
 	}
 
@@ -913,9 +1072,51 @@
 
 	eidx |= ((txcsmr << 8) | (rxlimit << 16));
 	writel(eidx, &regs->EvtCon);
-	mb();
+	wmb();
 
-	spin_unlock_irqrestore(&rrpriv->lock, flags);
+	spin_unlock(&rrpriv->lock);
+}
+
+
+static void rr_timer(unsigned long data)
+{
+	struct net_device *dev = (struct net_device *)data;
+	struct rr_private *rrpriv = (struct rr_private *)dev->priv;
+	struct rr_regs *regs = rrpriv->regs;
+	unsigned long flags;
+	int i;
+
+	if (readl(&regs->HostCtrl) & NIC_HALTED){
+		printk("%s: Restarting nic\n", dev->name);
+		memset(rrpriv->rx_ctrl, 0, 256 * sizeof(struct ring_ctrl));
+		memset(rrpriv->info, 0, sizeof(struct rr_info));
+		wmb();
+		for (i = 0; i < TX_RING_ENTRIES; i++) {
+			if (rrpriv->tx_skbuff[i]) {
+				rrpriv->tx_ring[i].size = 0;
+				set_rraddr(&rrpriv->tx_ring[i].addr, 0);
+				dev_kfree_skb(rrpriv->tx_skbuff[i]);
+				rrpriv->tx_skbuff[i] = NULL;
+			}
+		}
+
+		for (i = 0; i < RX_RING_ENTRIES; i++) {
+			if (rrpriv->rx_skbuff[i]) {
+				rrpriv->rx_ring[i].size = 0;
+				set_rraddr(&rrpriv->rx_ring[i].addr, 0);
+				dev_kfree_skb(rrpriv->rx_skbuff[i]);
+				rrpriv->rx_skbuff[i] = NULL;
+			}
+		}
+		if (rr_init1(dev)) {
+			spin_lock_irqsave(&rrpriv->lock, flags);
+			writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 
+			       &regs->HostCtrl);
+			spin_unlock_irqrestore(&rrpriv->lock, flags);
+		}
+	}
+	rrpriv->timer.expires = RUN_AT(5*HZ);
+	add_timer(&rrpriv->timer);
 }
 
 
@@ -936,22 +1137,21 @@
 		goto error;
 	}
 
-	rrpriv->rx_ctrl = kmalloc(256*sizeof(struct ring_ctrl),
-				  GFP_KERNEL | GFP_DMA);
+	rrpriv->rx_ctrl = kmalloc(256*sizeof(struct ring_ctrl), GFP_KERNEL);
 	if (!rrpriv->rx_ctrl) {
 		ecode = -ENOMEM;
 		goto error;
 	}
 
-	rrpriv->info = kmalloc(sizeof(struct rr_info), GFP_KERNEL | GFP_DMA);
+	rrpriv->info = kmalloc(sizeof(struct rr_info), GFP_KERNEL);
 	if (!rrpriv->info){
-		kfree(rrpriv->rx_ctrl);
+		rrpriv->rx_ctrl = NULL;
 		ecode = -ENOMEM;
 		goto error;
 	}
 	memset(rrpriv->rx_ctrl, 0, 256 * sizeof(struct ring_ctrl));
 	memset(rrpriv->info, 0, sizeof(struct rr_info));
-	mb();
+	wmb();
 
 	spin_lock_irqsave(&rrpriv->lock, flags);
 	writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, &regs->HostCtrl);
@@ -965,22 +1165,40 @@
 		goto error;
 	}
 
-	rr_init1(dev);
+	if ((ecode = rr_init1(dev)))
+		goto error;
 
-	dev->tbusy = 0;
-	dev->start = 1;
+	/* Set the timer to switch to check for link beat and perhaps switch
+	   to an alternate media type. */
+	init_timer(&rrpriv->timer);
+	rrpriv->timer.expires = RUN_AT(5*HZ);           /* 5 sec. watchdog */
+	rrpriv->timer.data = (unsigned long)dev;
+	rrpriv->timer.function = &rr_timer;               /* timer handler */
+	add_timer(&rrpriv->timer);
+
+	netif_start_queue(dev);
 
 	MOD_INC_USE_COUNT;
-	return 0;
+	return ecode;
 
  error:
 	spin_lock_irqsave(&rrpriv->lock, flags);
 	writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, &regs->HostCtrl);
 	spin_unlock_irqrestore(&rrpriv->lock, flags);
 
-	dev->tbusy = 1;
-	dev->start = 0;
-	return -ENOMEM;
+	if (rrpriv->info) {
+		kfree(rrpriv->info);
+		rrpriv->info = NULL;
+	}
+	if (rrpriv->rx_ctrl) {
+		kfree(rrpriv->rx_ctrl);
+		rrpriv->rx_ctrl = NULL;
+	}
+
+	netif_stop_queue(dev);
+	rr_if_down(dev);
+	
+	return ecode;
 }
 
 
@@ -1055,9 +1273,9 @@
 	u32 tmp;
 	short i;
 
-	dev->start = 0;
-	set_bit(0, (void*)&dev->tbusy);
-
+	netif_stop_queue(dev);
+	rr_if_down(dev);
+	
 	rrpriv = (struct rr_private *)dev->priv;
 	regs = rrpriv->regs;
 
@@ -1074,11 +1292,13 @@
 	}else{
 		tmp |= HALT_NIC | RR_CLEAR_INT;
 		writel(tmp, &regs->HostCtrl);
-		mb();
+		wmb();
 	}
 
 	rrpriv->fw_running = 0;
 
+	del_timer(&rrpriv->timer);
+
 	writel(0, &regs->TxPi);
 	writel(0, &regs->IpRxPi);
 
@@ -1098,6 +1318,7 @@
 			rrpriv->tx_ring[i].size = 0;
 			set_rraddr(&rrpriv->tx_ring[i].addr, 0);
 			dev_kfree_skb(rrpriv->tx_skbuff[i]);
+			rrpriv->tx_skbuff[i] = NULL;
 		}
 	}
 
@@ -1106,11 +1327,18 @@
 			rrpriv->rx_ring[i].size = 0;
 			set_rraddr(&rrpriv->rx_ring[i].addr, 0);
 			dev_kfree_skb(rrpriv->rx_skbuff[i]);
+			rrpriv->rx_skbuff[i] = NULL;
 		}
 	}
 
-	kfree(rrpriv->rx_ctrl);
-	kfree(rrpriv->info);
+	if (rrpriv->rx_ctrl) {
+		kfree(rrpriv->rx_ctrl);
+		rrpriv->rx_ctrl = NULL;
+	}
+	if (rrpriv->info) {
+		kfree(rrpriv->info);
+		rrpriv->info = NULL;
+	}
 
 	free_irq(dev->irq, dev);
 	spin_unlock(&rrpriv->lock);
@@ -1142,7 +1370,7 @@
 		printk("incoming skb too small - reallocating\n");
 		if (!(new_skb = dev_alloc_skb(len + 8))) {
 			dev_kfree_skb(skb);
-			dev->tbusy = 0;
+			netif_wake_queue(dev);
 			return -EBUSY;
 		}
 		skb_reserve(new_skb, 8);
@@ -1172,11 +1400,12 @@
 	rrpriv->tx_ring[index].size = len + 8; /* include IFIELD */
 	rrpriv->tx_ring[index].mode = PACKET_START | PACKET_END;
 	txctrl->pi = (index + 1) % TX_RING_ENTRIES;
+	wmb();
 	writel(txctrl->pi, &regs->TxPi);
 
 	if (txctrl->pi == rrpriv->dirty_tx){
 		rrpriv->tx_full = 1;
-		set_bit(0, (void*)&dev->tbusy);
+		netif_stop_queue(dev);
 	}
 
 	spin_unlock_irqrestore(&rrpriv->lock, flags);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/seeq8005.c linux/drivers/net/seeq8005.c
--- v2.3.48/linux/drivers/net/seeq8005.c	Sun Feb 13 19:29:04 2000
+++ linux/drivers/net/seeq8005.c	Mon Feb 28 07:16:54 2000
@@ -42,9 +42,9 @@
 #include <linux/malloc.h>
 #include <linux/string.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <asm/system.h>
 #include <asm/bitops.h>
-#include <asm/delay.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/errno.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/net/setup.c linux/drivers/net/setup.c
--- v2.3.48/linux/drivers/net/setup.c	Wed Feb 16 17:03:52 2000
+++ linux/drivers/net/setup.c	Sun Feb 27 18:45:10 2000
@@ -185,27 +185,6 @@
 #endif /* CONFIG_IPDDP */
 }
 
-
-/*
- *	The loopback device is global so it can be directly referenced
- *	by the network code.
- */
- 
-extern int loopback_init(struct net_device *dev);
-struct net_device loopback_dev = 
-{
-	"lo" __PAD2,		/* Software Loopback interface		*/
-	0x0,			/* recv memory end			*/
-	0x0,			/* recv memory start			*/
-	0x0,			/* memory end				*/
-	0x0,			/* memory start				*/
-	0,			/* base I/O address			*/
-	0,			/* IRQ					*/
-	0, 0, 0,		/* flags				*/
-	NULL,			/* next device				*/
-	loopback_init		/* loopback_init should set up the rest	*/
-};
-
 static void special_device_init(void)
 {
 #ifdef CONFIG_DUMMY
@@ -248,12 +227,20 @@
 		extern int sb1000_probe(struct net_device *dev);
 		static struct net_device sb1000_dev = 
 		{
-			"cm0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe 
+			"cm0 __PAD3", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe 
 		};
 		register_netdev(&sb1000_dev);
 	}
 #endif
-	register_netdev(&loopback_dev);
+#ifdef CONFIG_BONDING
+	{
+		extern int bond_init(struct net_device *dev);
+		static struct net_device bond_dev = {
+			"bond" __PAD4, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, bond_init,
+		};
+		register_netdev(&bond_dev);
+	}
+#endif	
 }
 
 /*
diff -u --recursive --new-file v2.3.48/linux/drivers/net/sunlance.c linux/drivers/net/sunlance.c
--- v2.3.48/linux/drivers/net/sunlance.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/net/sunlance.c	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-/* $Id: sunlance.c,v 1.99 2000/02/16 10:36:14 davem Exp $
+/* $Id: sunlance.c,v 1.100 2000/02/27 09:38:12 anton Exp $
  * lance.c: Linux/Sparc/Lance driver
  *
  *	Written 1995, 1996 by Miguel de Icaza
@@ -1287,8 +1287,10 @@
 static void lance_set_multicast_retry(unsigned long _opaque)
 {
 	struct net_device *dev = (struct net_device *) _opaque;
+	struct lance_private *lp = (struct lance_private *) dev->priv;
 
 	lance_set_multicast(dev);
+	timer_exit(&lp->multicast_timer);
 }
 
 static void lance_free_hwresources(struct lance_private *lp)
diff -u --recursive --new-file v2.3.48/linux/drivers/net/tokenring/ibmtr.c linux/drivers/net/tokenring/ibmtr.c
--- v2.3.48/linux/drivers/net/tokenring/ibmtr.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/net/tokenring/ibmtr.c	Thu Mar  2 10:15:30 2000
@@ -83,6 +83,11 @@
  *      Changes by Jochen Friedrich to enable RFC1469 Option 2 multicasting
  *      i.e. using functional address C0 00 00 04 00 00 to transmit and 
  *      receive multicast packets.
+ * 
+ *      Changes by Mike Sullivan (based on original sram patch by Dave Grothe
+ *      to support windowing into on adapter shared ram.
+ *      i.e. Use LANAID to setup a PnP configuration with 16K RAM. Paging
+ *      will shift this 16K window over the entire available shared RAM.
  */
 
 /* change the define of IBMTR_DEBUG_MESSAGES to a nonzero value 
@@ -102,7 +107,8 @@
 
 #define NO_AUTODETECT 1
 #undef NO_AUTODETECT
-#undef ENABLE_PAGING
+/* #undef ENABLE_PAGING */
+#define ENABLE_PAGING 1
 
 
 #define FALSE 0
@@ -119,7 +125,8 @@
 static char *version =
 "ibmtr.c: v1.3.57   8/ 7/94 Peter De Schrijver and Mark Swanson\n"
 "         v2.1.125 10/20/98 Paul Norton <pnorton@ieee.org>\n"
-"         v2.2.0   12/30/98 Joel Sloan <jjs@c-me.com>\n";
+"         v2.2.0   12/30/98 Joel Sloan <jjs@c-me.com>\n"
+"         v2.2.1   02/08/00 Mike Sullivan <sullivam@us.ibm.com>\n";
 
 static char pcchannelid[] = {
 	0x05, 0x00, 0x04, 0x09,
@@ -570,7 +577,7 @@
 		ti->mapped_ram_size = ti->avail_shared_ram;
 	} else {
 #ifdef ENABLE_PAGING
-		unsigned char pg_size;
+		unsigned char pg_size=0;
 #endif
 
 #if !TR_NEWFORMAT
@@ -590,15 +597,16 @@
 			pg_size=64;   /* 32KB page size */
 			break;
 		case 0xc:
-			ti->page_mask=(ti->mapped_ram_size==32) ? 0xc0 : 0;
-			ti->page_mask=(ti->mapped_ram_size==64) ? 0x80 : 0;
-			DPRINTK("Dual size shared RAM page (code=0xC), don't support it!\n");
-			/* nb/dwm: I did this because RRR (3,2) bits are documented as
-			   R/O and I can't find how to select which page size
-			   Also, the above conditional statement sequence is invalid
-			   as page_mask will always be set by the second stmt */
-			kfree_s(ti, sizeof(struct tok_info));
-			return -ENODEV;
+		        switch (ti->mapped_ram_size) {
+			  case 32:
+			    ti->page_mask=0xc0;
+                            pg_size=32;
+                            break;
+			  case 64:
+                            ti->page_mask=0x80;
+                            pg_size=64;
+                            break;
+                        }
 			break;
 		default:
 			DPRINTK("Unknown shared ram paging info %01X\n",ti->shared_ram_paging);
@@ -606,16 +614,22 @@
 			return -ENODEV;
 			break;
 	}
+
+ 	if (ibmtr_debug_trace & TRC_INIT)
+ 	  DPRINTK("Shared RAM paging code: "
+ 		 "%02X mapped RAM size: %dK shared RAM size: %dK page mask: %0xX\n:",
+ 		 ti->shared_ram_paging, ti->mapped_ram_size/2, ti->avail_shared_ram/2, ti->page_mask);
+
 	if (ti->page_mask) {
 		if (pg_size > ti->mapped_ram_size) {
 			DPRINTK("Page size (%d) > mapped ram window (%d), can't page.\n",
-				pg_size, ti->mapped_ram_size);
+				pg_size/2, ti->mapped_ram_size/2);
 				ti->page_mask = 0;    /* reset paging */
-		} else {
-			ti->mapped_ram_size=ti->avail_shared_ram;
-			DPRINTK("Shared RAM paging enabled. Page size : %uK\n",
-				((ti->page_mask^ 0xff)+1)>>2);
-		}
+                }
+	} else if (pg_size > ti->mapped_ram_size) {
+	                DPRINTK("Page size (%d) > mapped ram window (%d), can't page.\n",
+				pg_size/2, ti->mapped_ram_size/2);
+	}
 #endif
 	}
 	/* finish figuring the shared RAM address */
@@ -673,9 +687,17 @@
 	DPRINTK("Hardware address : %02X:%02X:%02X:%02X:%02X:%02X\n",
 		dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
 		dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
+ 	if (ti->page_mask)
+ 	  DPRINTK("Shared RAM paging enabled. Page size: %uK Shared Ram size %dK\n",
+ 		  ((ti->page_mask ^ 0xff)+1)>>2,ti->avail_shared_ram/2);
+ 	else
+ 	  DPRINTK("Shared RAM paging disabled. ti->page_mask %x\n",ti->page_mask);
 #endif
 	/* Calculate the maximum DHB we can use */
-	switch (ti->mapped_ram_size) {
+	if (!ti->page_mask) {
+	  ti->avail_shared_ram=ti->mapped_ram_size;
+	}
+	switch (ti->avail_shared_ram) {
 	case  16 : /* 8KB shared RAM */
 		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 2048);
 		ti->rbuf_len4 = 1032;
@@ -685,34 +707,34 @@
 		ti->rbuf_cnt16 = 2;
 		break;
 	case  32 : /* 16KB shared RAM */
-		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 4464);
+		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 2048);
 		ti->rbuf_len4 = 520;
 		ti->rbuf_cnt4 = 9;
-		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 4096);
+		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
 		ti->rbuf_len16 = 1032; /* 1024 usable */
 		ti->rbuf_cnt16 = 4;
 		break;
 	case  64 : /* 32KB shared RAM */
-		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 4464);
+		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 2048);
 		ti->rbuf_len4 = 1032;
 		ti->rbuf_cnt4 = 6;
-		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 10240);
+		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
 		ti->rbuf_len16 = 1032;
 		ti->rbuf_cnt16 = 10;
 		break;
 	case 127 : /* 63KB shared RAM */
-		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 4464);
+		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 2048);
 		ti->rbuf_len4 = 1032;
 		ti->rbuf_cnt4 = 6;
-		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 16384);
+		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
 		ti->rbuf_len16 = 1032;
 		ti->rbuf_cnt16 = 16;
 		break;
 	case 128 : /* 64KB shared RAM */
-		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 4464);
+		ti->dhb_size4mb  = MIN(ti->dhb_size4mb, 2048);
 		ti->rbuf_len4 = 1032;
 		ti->rbuf_cnt4 = 6;
-		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 17960);
+		ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
 		ti->rbuf_len16 = 1032;
 		ti->rbuf_cnt16 = 18;
 		break;
@@ -764,6 +786,7 @@
 {
 	struct tok_info *ti=(struct tok_info *)dev->priv;
 
+	SET_PAGE(ti->srb_page);
 	ti->open_status		= CLOSED;
 
 	dev->init		= tok_init_card;
@@ -802,7 +825,7 @@
 		address[3] |= mclist->dmi_addr[5];
 		mclist = mclist->next;
 	}
-	SET_PAGE(ti->srb);
+	SET_PAGE(ti->srb_page);
 	for (i=0; i<sizeof(struct srb_set_funct_addr); i++)
 		isa_writeb(0, ti->srb+i);
 
@@ -848,7 +871,7 @@
 	struct tok_info *ti=(struct tok_info *) dev->priv;
 
 	netif_stop_queue(dev);
-	
+	SET_PAGE(ti->srb_page);	
 	isa_writeb(DIR_CLOSE_ADAPTER,
 	       ti->srb + offsetof(struct srb_close_adapter, command));
 	isa_writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -857,6 +880,7 @@
 
 	sleep_on(&ti->wait_for_tok_int);
 
+	SET_PAGE(ti->srb_page);
 	if (isa_readb(ti->srb + offsetof(struct srb_close_adapter, ret_code)))
 		DPRINTK("close adapter failed: %02X\n",
 			(int)isa_readb(ti->srb + offsetof(struct srb_close_adapter, ret_code)));
@@ -875,6 +899,9 @@
 	unsigned char status;
 	struct tok_info *ti;
 	struct net_device *dev;
+#ifdef ENABLE_PAGING
+	unsigned char save_srpr;
+#endif
 
 	dev = dev_id;
 #if TR_VERBOSE
@@ -882,6 +909,9 @@
 #endif
 	ti  = (struct tok_info *) dev->priv;
 	spin_lock(&(ti->lock));
+#ifdef ENABLE_PAGING
+	save_srpr=isa_readb(ti->mmio+ACA_OFFSET+ACA_RW+SRPR_EVEN);
+#endif
 
       	/* Disable interrupts till processing is finished */
 	isa_writeb((~INT_ENABLE), ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN);
@@ -907,17 +937,15 @@
     		if (status == 0xFF)
        		{
 		          DPRINTK("PCMCIA card removed.\n");
-			  spin_unlock(&(ti->lock));
-         		  return;
+			  goto return_point ; 
        		}
 
     	        /* Check ISRP EVEN too. */
       	        if ( isa_readb (ti->mmio + ACA_OFFSET + ACA_RW + ISRP_EVEN) == 0xFF)
     	        {
          		 DPRINTK("PCMCIA card removed.\n");
-			 spin_unlock(&(ti->lock));
-         		 return;
-      		 }
+			 goto return_point ; 
+      		}
 #endif
 
 
@@ -925,8 +953,15 @@
 
 			int i;
 			__u32 check_reason;
+                        __u8  check_reason_page=0;
 
-			check_reason=ti->mmio + ntohs(isa_readw(ti->sram + ACA_OFFSET + ACA_RW +WWCR_EVEN));
+			check_reason=ntohs(isa_readw(ti->sram + ACA_OFFSET + ACA_RW +WWCR_EVEN));
+			if (ti->page_mask) {
+			  check_reason_page=(check_reason>>8) & ti->page_mask;
+			  check_reason &= ~(ti->page_mask << 8);
+			}
+			check_reason += ti->sram;
+			SET_PAGE(check_reason_page);
 
 			DPRINTK("Adapter check interrupt\n");
 			DPRINTK("8 reason bytes follow: ");
@@ -951,6 +986,12 @@
 			/* SRB, ASB, ARB or SSB response */
 
 			if (status & SRB_RESP_INT) { /* SRB response */
+           		        SET_PAGE(ti->srb_page);
+#if TR_VERBOSE
+ 				DPRINTK("SRB resp: cmd=%02X rsp=%02X\n",
+					isa_readb(ti->srb),
+					isa_readb(ti->srb + offsetof(struct srb_xmit, ret_code)));
+#endif
 
 				switch(isa_readb(ti->srb)) { /* SRB command check */
 
@@ -962,7 +1003,7 @@
 						      DPRINTK("error on xmit_dir_frame request: %02X\n",
 							      xmit_ret_code);
 						      if (ti->current_skb) {
-							      dev_kfree_skb(ti->current_skb);
+							      dev_kfree_skb_irq(ti->current_skb);
 							      ti->current_skb=NULL;
 						      }
 						      netif_wake_queue(dev);
@@ -979,7 +1020,7 @@
 						      DPRINTK("error on xmit_ui_frame request: %02X\n",
 							      xmit_ret_code);
 						      if (ti->current_skb) {
-							      dev_kfree_skb(ti->current_skb);
+							      dev_kfree_skb_irq(ti->current_skb);
 							      ti->current_skb=NULL;
 						      }
 						      netif_wake_queue(dev);
@@ -993,10 +1034,25 @@
 					      unsigned char open_ret_code;
 					      __u16 open_error_code;
 
-					      ti->srb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, srb_addr)));
-					      ti->ssb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, ssb_addr)));
-					      ti->arb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, arb_addr)));
-					      ti->asb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, asb_addr)));
+ 					      ti->srb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, srb_addr)));
+ 					      ti->ssb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, ssb_addr)));
+ 					      ti->arb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, arb_addr)));
+ 					      ti->asb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, asb_addr)));
+					      if (ti->page_mask) {
+						ti->srb_page=(ti->srb>>8) & ti->page_mask;
+						ti->srb &= ~(ti->page_mask<<8);
+						ti->ssb_page=(ti->ssb>>8) & ti->page_mask;
+						ti->ssb &= ~(ti->page_mask<<8);
+						ti->arb_page=(ti->arb>>8) & ti->page_mask;
+						ti->arb &= ~(ti->page_mask<<8);
+						ti->asb_page=(ti->asb>>8) & ti->page_mask;
+						ti->asb &= ~(ti->page_mask<<8);
+					      }
+					      ti->srb+=ti->sram;
+					      ti->ssb+=ti->sram;
+					      ti->arb+=ti->sram;
+					      ti->asb+=ti->sram;
+
 					      ti->current_skb=NULL;
 
 					      open_ret_code = isa_readb(ti->init_srb +offsetof(struct srb_open_response, ret_code));
@@ -1125,6 +1181,10 @@
 			} /* SRB response */
 
 			if (status & ASB_FREE_INT) { /* ASB response */
+			        SET_PAGE(ti->asb_page);
+#if TR_VERBOSE
+ 				DPRINTK("ASB resp: cmd=%02X\n", isa_readb(ti->asb));
+ #endif
 
 				switch(isa_readb(ti->asb)) { /* ASB command check */
 
@@ -1147,6 +1207,12 @@
 			} /* ASB response */
 
 			if (status & ARB_CMD_INT) { /* ARB response */
+            		        SET_PAGE(ti->arb_page);
+#if TR_VERBOSE 
+ 				DPRINTK("ARB resp: cmd=%02X rsp=%02X\n",
+ 					isa_readb(ti->arb),
+ 					isa_readb(ti->arb + offsetof(struct arb_dlc_status, status)));
+#endif
 
 				switch (isa_readb(ti->arb)) { /* ARB command check */
 
@@ -1203,6 +1269,11 @@
 
 			if (status & SSB_RESP_INT) { /* SSB response */
 				unsigned char retcode;
+ 				SET_PAGE(ti->ssb_page);
+#if TR_VERBOSE
+ 				DPRINTK("SSB resp: cmd=%02X rsp=%02X\n",
+ 					isa_readb(ti->ssb), isa_readb(ti->ssb+2));
+#endif
 				switch (isa_readb(ti->ssb)) { /* SSB command check */
 				      
 				      case XMIT_DIR_FRAME:
@@ -1216,6 +1287,7 @@
 
 				      case XMIT_XID_CMD:
 					DPRINTK("xmit xid ret_code: %02X\n", (int)isa_readb(ti->ssb+2));
+                                        break;
 
 				      default:
 					DPRINTK("Unknown command %02X in ssb\n", (int)isa_readb(ti->ssb));
@@ -1240,6 +1312,13 @@
 		DPRINTK("Unexpected interrupt from tr adapter\n");
 
 	}
+#ifdef PCMCIA
+ return_point:
+#endif
+#ifdef ENABLE_PAGING
+ 	isa_writeb(save_srpr, ti->mmio+ACA_OFFSET+ACA_RW+SRPR_EVEN);
+#endif
+
 	spin_unlock(&(ti->lock));
 }
 
@@ -1262,9 +1341,26 @@
 		isa_writeb(ti->sram_base, ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN);
 		ti->sram=((__u32)ti->sram_base << 12);
 	}
-	ti->init_srb=ti->sram
-		+ntohs((unsigned short)isa_readw(ti->mmio+ ACA_OFFSET + WRBR_EVEN));
-	SET_PAGE(ntohs((unsigned short)isa_readw(ti->mmio+ACA_OFFSET + WRBR_EVEN)));
+ 	ti->init_srb=ntohs((unsigned short)isa_readw(ti->mmio+ ACA_OFFSET + WRBR_EVEN));
+	if (ti->page_mask) {
+	  ti->init_srb_page=(ti->init_srb>>8)&ti->page_mask;
+	  ti->init_srb &= ~(ti->page_mask<<8);
+	}
+	ti->init_srb+=ti->sram;
+	
+	if (ti->avail_shared_ram == 127) {
+	  int i;
+	  int last_512=0xfe00;
+ 	  if (ti->page_mask) {
+	    last_512 &= ~(ti->page_mask<<8);
+	  }
+	  /*  initialize high section of ram (if necessary) */
+	  SET_PAGE(0xc0);
+	  for (i=0; i<512; i++) {
+	    isa_writeb(0,ti->sram+last_512+i);
+	  }
+	}  
+	SET_PAGE(ti->init_srb_page);
 
 	dev->mem_start = ti->sram;
 	dev->mem_end = ti->sram + (ti->mapped_ram_size<<9) - 1;
@@ -1272,7 +1368,7 @@
 #if TR_VERBOSE
 	{
 		int i;
-		DPRINTK("init_srb(%p):", ti->init_srb);
+		DPRINTK("init_srb(%lx):", (long)ti->init_srb);
 		for (i=0;i<17;i++) printk("%02X ", (int)isa_readb(ti->init_srb+i));
 		printk("\n");
 	}
@@ -1325,11 +1421,6 @@
 	/* Reset adapter */
 	netif_stop_queue(dev);
 
-#ifdef ENABLE_PAGING
-	if(ti->page_mask)
-		isa_writeb(SRPR_ENABLE_PAGING, ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN);
-#endif
-
 	isa_writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN);
 
 #if !TR_NEWFORMAT
@@ -1339,6 +1430,10 @@
 	outb(0, PIOaddr+ADAPTRESET);
 	for (i=jiffies+TR_RESET_INTERVAL; time_before_eq(jiffies, i);); /* wait 50ms */
 	outb(0,PIOaddr+ADAPTRESETREL);
+#ifdef ENABLE_PAGING
+	if(ti->page_mask)
+		isa_writeb(SRPR_ENABLE_PAGING, ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN);
+#endif
 
 #if !TR_NEWFORMAT
 	DPRINTK("card reset\n");
@@ -1354,7 +1449,7 @@
 	int i;
 	struct tok_info *ti=(struct tok_info *) dev->priv;
 
-	SET_PAGE(ti->srb);
+	SET_PAGE(ti->srb_page);
 	for (i=0; i<sizeof(struct dlc_open_sap); i++)
 		isa_writeb(0, ti->srb+i);
 
@@ -1417,6 +1512,12 @@
 	       ti->init_srb + offsetof(struct dir_open_adapter, dlc_max_sta));
 
 	ti->srb=ti->init_srb; /* We use this one in the interrupt handler */
+	ti->srb_page=ti->init_srb_page;
+	DPRINTK("Opend adapter: Xmit bfrs: %d X %d, Rcv bfrs: %d X %d\n",
+		isa_readb(ti->init_srb+offsetof(struct dir_open_adapter,num_dhb)),
+		ntohs(isa_readw(ti->init_srb+offsetof(struct dir_open_adapter,dhb_length))),
+		ntohs(isa_readw(ti->init_srb+offsetof(struct dir_open_adapter,num_rcv_buf))),
+		ntohs(isa_readw(ti->init_srb+offsetof(struct dir_open_adapter,rcv_buf_len))) );
 
 	isa_writeb(INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN);
 	isa_writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1432,7 +1533,11 @@
 	unsigned char xmit_command;
 	int i;
 	struct trllc	*llc;
+	struct srb_xmit  xsrb;
+	__u8  dhb_page=0;
+	__u8  llc_ssap;
 
+	SET_PAGE(ti->asb_page);
 	if (isa_readb(ti->asb + offsetof(struct asb_xmit_resp, ret_code))!=0xFF)
 		DPRINTK("ASB not free !!!\n");
 
@@ -1441,8 +1546,13 @@
 	   providing a shared memory address for us
 	   to stuff with data.  Here we compute the
 	   effective address where we will place data.*/
-	dhb=ti->sram
-		+ntohs(isa_readw(ti->arb + offsetof(struct arb_xmit_req, dhb_address)));
+        SET_PAGE(ti->arb_page);
+ 	dhb=ntohs(isa_readw(ti->arb + offsetof(struct arb_xmit_req, dhb_address)));
+        if (ti->page_mask) {
+	  dhb_page=(dhb >> 8) & ti->page_mask;
+	  dhb &= ~(ti->page_mask << 8);
+        }
+        dhb+=ti->sram;
 	
 	/* Figure out the size of the 802.5 header */
 	if (!(trhdr->saddr[0] & 0x80)) /* RIF present? */
@@ -1453,13 +1563,17 @@
 
 	llc = (struct trllc *)(ti->current_skb->data + hdr_len);
 
-	xmit_command = isa_readb(ti->srb + offsetof(struct srb_xmit, command));
-
+	llc_ssap=llc->ssap;
+ 	SET_PAGE(ti->srb_page);
+ 	isa_memcpy_fromio(&xsrb, ti->srb, sizeof(xsrb));
+ 	SET_PAGE(ti->asb_page);
+ 	xmit_command=xsrb.command;
+	
 	isa_writeb(xmit_command, ti->asb + offsetof(struct asb_xmit_resp, command));
-	isa_writew(isa_readb(ti->srb + offsetof(struct srb_xmit, station_id)),
+	isa_writew(xsrb.station_id,
 	       ti->asb + offsetof(struct asb_xmit_resp, station_id));
-	isa_writeb(llc->ssap, ti->asb + offsetof(struct asb_xmit_resp, rsap_value));
-	isa_writeb(isa_readb(ti->srb + offsetof(struct srb_xmit, cmd_corr)),
+	isa_writeb(llc_ssap, ti->asb + offsetof(struct asb_xmit_resp, rsap_value));
+ 	isa_writeb(xsrb.cmd_corr,
 	       ti->asb + offsetof(struct asb_xmit_resp, cmd_corr));
 	isa_writeb(0, ti->asb + offsetof(struct asb_xmit_resp, ret_code));
 
@@ -1468,6 +1582,7 @@
 		isa_writew(htons(0x11),
 		       ti->asb + offsetof(struct asb_xmit_resp, frame_length));
 		isa_writeb(0x0e, ti->asb + offsetof(struct asb_xmit_resp, hdr_length));
+		SET_PAGE(dhb_page);
 		isa_writeb(AC, dhb);
 		isa_writeb(LLC_FRAME, dhb+1);
 
@@ -1487,11 +1602,12 @@
 	isa_writew(htons(ti->current_skb->len),
 	       ti->asb + offsetof(struct asb_xmit_resp, frame_length));
 
+	SET_PAGE(dhb_page);
 	isa_memcpy_toio(dhb, ti->current_skb->data, ti->current_skb->len);
 
 	isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
 	ti->tr_stats.tx_bytes+=ti->current_skb->len;
-	dev_kfree_skb(ti->current_skb);
+	dev_kfree_skb_irq(ti->current_skb);
 	ti->current_skb=NULL;
 	netif_wake_queue(dev);
 	if (ti->readlog_pending) ibmtr_readlog(dev);
@@ -1501,6 +1617,7 @@
 {
 	struct tok_info *ti=(struct tok_info *) dev->priv;
 	__u32 rbuffer, rbufdata;
+	__u8  rbuffer_page=0;
 	__u32 llc;
 	unsigned char *data;
 	unsigned int rbuffer_len, lan_hdr_len, hdr_len, ip_len, length;
@@ -1509,31 +1626,40 @@
 	int	IPv4_p = 0;
 	unsigned int chksum = 0;
 	struct iphdr *iph;
+	struct arb_rec_req rarb;
 
-	rbuffer=(ti->sram
-		 +ntohs(isa_readw(ti->arb + offsetof(struct arb_rec_req, rec_buf_addr))))+2;
- 
+	SET_PAGE(ti->arb_page);
+ 	isa_memcpy_fromio(&rarb, ti->arb, sizeof(rarb));
+ 	rbuffer=ntohs(rarb.rec_buf_addr)+2;
+	if (ti->page_mask) {
+	  rbuffer_page=(rbuffer >> 8) & ti->page_mask;
+	  rbuffer &= ~(ti->page_mask<<8);
+	}
+	rbuffer += ti->sram;
+	
+	SET_PAGE(ti->asb_page);
 	if(isa_readb(ti->asb + offsetof(struct asb_rec, ret_code))!=0xFF)
 		DPRINTK("ASB not free !!!\n");
 
 	isa_writeb(REC_DATA,
 	       ti->asb + offsetof(struct asb_rec, command));
-	isa_writew(isa_readw(ti->arb + offsetof(struct arb_rec_req, station_id)),
+	isa_writew(rarb.station_id,
 	       ti->asb + offsetof(struct asb_rec, station_id));
-	isa_writew(isa_readw(ti->arb + offsetof(struct arb_rec_req, rec_buf_addr)),
+	isa_writew(rarb.rec_buf_addr,
 	       ti->asb + offsetof(struct asb_rec, rec_buf_addr));
 
-	lan_hdr_len=isa_readb(ti->arb + offsetof(struct arb_rec_req, lan_hdr_len));
+	lan_hdr_len=rarb.lan_hdr_len;
 	hdr_len = lan_hdr_len + sizeof(struct trllc) + sizeof(struct iphdr);
-	
+
+	SET_PAGE(rbuffer_page);
 	llc=(rbuffer + offsetof(struct rec_buf, data) + lan_hdr_len);
 
 #if TR_VERBOSE
 	DPRINTK("offsetof data: %02X lan_hdr_len: %02X\n",
 		(unsigned int)offsetof(struct rec_buf,data), (unsigned int)lan_hdr_len);
-	DPRINTK("llc: %08X rec_buf_addr: %04X ti->sram: %p\n", llc,
-		ntohs(isa_readw(ti->arb + offsetof(struct arb_rec_req, rec_buf_addr))),
-		ti->sram);
+	DPRINTK("llc: %08X rec_buf_addr: %04X ti->sram: %lx\n", llc,
+		ntohs(rarb.rec_buf_addr),
+		(long)ti->sram);
 	DPRINTK("dsap: %02X, ssap: %02X, llc: %02X, protid: %02X%02X%02X, "
 		"ethertype: %04X\n",
 		(int)isa_readb(llc + offsetof(struct trllc, dsap)),
@@ -1545,14 +1671,15 @@
 		(int)isa_readw(llc + offsetof(struct trllc, ethertype)));
 #endif
 	if (isa_readb(llc + offsetof(struct trllc, llc))!=UI_CMD) {
+                SET_PAGE(ti->asb_page);
 		isa_writeb(DATA_LOST, ti->asb + offsetof(struct asb_rec, ret_code));
 		ti->tr_stats.rx_dropped++;
 		isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
 		return;
 	}
 
-	length = ntohs(isa_readw(ti->arb+offsetof(struct arb_rec_req, frame_len)));
-       	if ((isa_readb(llc + offsetof(struct trllc, dsap))==EXTENDED_SAP) &&
+	length = ntohs(rarb.frame_len);
+	if ((isa_readb(llc + offsetof(struct trllc, dsap))==EXTENDED_SAP) &&
        	    (isa_readb(llc + offsetof(struct trllc, ssap))==EXTENDED_SAP) &&
 		(length>=hdr_len)) {
        		IPv4_p = 1;
@@ -1585,11 +1712,12 @@
        	}
 #endif
 
-       	skb_size = length-lan_hdr_len+sizeof(struct trh_hdr)+sizeof(struct trllc);
+       	skb_size = length;
  
        	if (!(skb=dev_alloc_skb(skb_size))) {
        		DPRINTK("out of memory. frame dropped.\n");
        		ti->tr_stats.rx_dropped++;
+		SET_PAGE(ti->asb_page);
        		isa_writeb(DATA_LOST, ti->asb + offsetof(struct asb_rec, ret_code));
        		isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
        		return;
@@ -1630,11 +1758,17 @@
 			break;
 		length -= rbuffer_len;
 		data += rbuffer_len;
+		if (ti->page_mask) {
+		  rbuffer_page=(rbuffer>>8) & ti->page_mask;
+		  rbuffer &= ~(ti->page_mask << 8);
+		}
 		rbuffer += ti->sram;
+		SET_PAGE(rbuffer_page);
 		rbuffer_len = ntohs(isa_readw(rbuffer + offsetof(struct rec_buf, buf_len)));
 		rbufdata = rbuffer + offsetof(struct rec_buf, data);
 	}
 
+	SET_PAGE(ti->asb_page);
        	isa_writeb(0, ti->asb + offsetof(struct asb_rec, ret_code));
 
        	isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1663,6 +1797,7 @@
 
 	/* Save skb; we'll need it when the adapter asks for the data */
 	ti->current_skb=skb;
+	SET_PAGE(ti->srb_page);
 	isa_writeb(XMIT_UI_FRAME, ti->srb + offsetof(struct srb_xmit, command));
 	isa_writew(ti->exsap_station_id, ti->srb
 	       +offsetof(struct srb_xmit, station_id));
@@ -1685,6 +1820,7 @@
 	 ti=(struct tok_info *) dev->priv;
 
 	 ti->readlog_pending = 0;
+	 SET_PAGE(ti->srb_page);
 	 isa_writeb(DIR_READ_LOG, ti->srb);
 	 isa_writeb(INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN);
 	 isa_writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/tokenring/ibmtr.h linux/drivers/net/tokenring/ibmtr.h
--- v2.3.48/linux/drivers/net/tokenring/ibmtr.h	Tue Dec 14 01:27:24 1999
+++ linux/drivers/net/tokenring/ibmtr.h	Thu Mar  2 10:15:30 2000
@@ -133,9 +133,9 @@
 #define TCR_ODD         0x0D
 #define TVR_EVEN        0x0E    /* Timer value registers - even and odd */
 #define TVR_ODD         0x0F
-#define SRPR_EVEN       0x10    /* Shared RAM paging registers - even and odd */
+#define SRPR_EVEN       0x18    /* Shared RAM paging registers - even and odd */
 #define SRPR_ENABLE_PAGING 0xc0
-#define SRPR_ODD        0x11 /* Not used. */
+#define SRPR_ODD        0x19 /* Not used. */
 #define TOKREAD         0x60
 #define TOKOR           0x40
 #define TOKAND          0x20
@@ -162,7 +162,7 @@
 #define ACA_RW 0x00
 
 #ifdef ENABLE_PAGING
-#define SET_PAGE(x) (isa_writeb(((x>>8)&ti.page_mask), \
+#define SET_PAGE(x) (isa_writeb((x), \
   ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN))
 #else
 #define SET_PAGE(x)
@@ -205,6 +205,11 @@
 	__u32 ssb;                        /* System Status Block address */
 	__u32 arb;                        /* Adapter Request Block address */
 	__u32 asb;                        /* Adapter Status Block address */
+        __u8  init_srb_page;
+        __u8  srb_page;
+        __u8  ssb_page;
+        __u8  arb_page;
+        __u8  asb_page;
 	unsigned short exsap_station_id;
 	unsigned short global_int_enable;
 	struct sk_buff *current_skb;
diff -u --recursive --new-file v2.3.48/linux/drivers/net/tulip/eeprom.c linux/drivers/net/tulip/eeprom.c
--- v2.3.48/linux/drivers/net/tulip/eeprom.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/net/tulip/eeprom.c	Mon Feb 28 07:16:55 2000
@@ -56,6 +56,12 @@
 								  0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
 								  0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */
    }},
+  {"NetWinder", 0x00, 0x10, 0x57,
+	/* Default media = MII
+	 * MII block, reset sequence (3) = 0x0821 0x0000 0x0001, capabilities 0x01e1
+	 */
+	{ 0x1e00, 0x0000, 0x000b, 0x8f01, 0x0103, 0x0300, 0x0821, 0x000, 0x0001, 0x0000, 0x01e1 }
+  },
   {0, 0, 0, 0, {}}};
 
 
diff -u --recursive --new-file v2.3.48/linux/drivers/net/tulip/tulip.h linux/drivers/net/tulip/tulip.h
--- v2.3.48/linux/drivers/net/tulip/tulip.h	Sat Feb 26 22:31:47 2000
+++ linux/drivers/net/tulip/tulip.h	Mon Feb 28 07:16:55 2000
@@ -50,7 +50,6 @@
 	DC21140 = 2,
 	DC21142 = 3, DC21143 = 3,
 	LC82C168,
-	NGMC169,
 	MX98713,
 	MX98715,
 	MX98725,
@@ -242,8 +241,10 @@
 struct tulip_private {
 	const char *product_name;
 	struct net_device *next_module;
-	struct tulip_rx_desc rx_ring[RX_RING_SIZE];
-	struct tulip_tx_desc tx_ring[TX_RING_SIZE];
+	struct tulip_rx_desc *rx_ring;
+	struct tulip_tx_desc *tx_ring;
+	dma_addr_t rx_ring_dma;
+	dma_addr_t tx_ring_dma;
 	/* The saved address of a sent-in-place packet/buffer, for skfree(). */
 	struct sk_buff *tx_skbuff[TX_RING_SIZE];
 	/* The addresses of receive-in-place skbuffs. */
diff -u --recursive --new-file v2.3.48/linux/drivers/net/tulip/tulip_core.c linux/drivers/net/tulip/tulip_core.c
--- v2.3.48/linux/drivers/net/tulip/tulip_core.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/net/tulip/tulip_core.c	Mon Feb 28 07:16:55 2000
@@ -19,7 +19,7 @@
 
 */
 
-static const char version[] = "Linux Tulip driver version 0.9.3 (Feb 23, 2000)\n";
+static const char version[] = "Linux Tulip driver version 0.9.4 (Feb 28, 2000)\n";
 
 #include <linux/module.h>
 #include "tulip.h"
@@ -51,7 +51,7 @@
 };
 
 /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
-#ifdef __alpha__
+#if defined(__alpha__) || defined(__arm__)
 static int rx_copybreak = 1518;
 #else
 static int rx_copybreak = 100;
@@ -74,6 +74,8 @@
 static int csr0 = 0x01A00000 | 0xE000;
 #elif defined(__i386__) || defined(__powerpc__) || defined(__sparc__)
 static int csr0 = 0x01A00000 | 0x8000;
+#elif defined(__arm__)
+static int csr0 = 0x01A00000 | 0x4800;
 #else
 #warning Processor architecture undefined!
 static int csr0 = 0x00A00000 | 0x4800;
@@ -123,8 +125,6 @@
 	t21142_timer },
   { "Lite-On 82c168 PNIC", 256, 0x0001ebef,
 	HAS_MII | HAS_PNICNWAY, pnic_timer },
-  { "NETGEAR NGMC169 MAC", 256, 0x0001ebef,
-	HAS_MII | HAS_PNICNWAY, pnic_timer },
   { "Macronix 98713 PMAC", 128, 0x0001ebef,
 	HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer },
   { "Macronix 98715 PMAC", 256, 0x0001ebef,
@@ -155,7 +155,6 @@
 	{ 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
 	{ 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 },
 	{ 0x11AD, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, LC82C168 },
-	{ 0x1385, 0xf004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NGMC169 },
 	{ 0x10d9, 0x0512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98713 },
 	{ 0x10d9, 0x0531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
 	{ 0x10d9, 0x0531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98725 },
@@ -301,8 +300,8 @@
 		tp->cur_tx++;
 	}
 
-	outl(virt_to_bus(tp->rx_ring), ioaddr + CSR3);
-	outl(virt_to_bus(tp->tx_ring), ioaddr + CSR4);
+	outl(tp->rx_ring_dma, ioaddr + CSR3);
+	outl(tp->tx_ring_dma, ioaddr + CSR4);
 
 	tp->saved_if_port = dev->if_port;
 	if (dev->if_port == 0)
@@ -569,12 +568,12 @@
 	for (i = 0; i < RX_RING_SIZE; i++) {
 		tp->rx_ring[i].status = 0x00000000;
 		tp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ);
-		tp->rx_ring[i].buffer2 = virt_to_le32desc(&tp->rx_ring[i+1]);
+		tp->rx_ring[i].buffer2 = cpu_to_le32(tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * (i + 1));
 		tp->rx_skbuff[i] = NULL;
 	}
 	/* Mark the last entry as wrapping the ring. */
 	tp->rx_ring[i-1].length = cpu_to_le32(PKT_BUF_SZ | DESC_RING_WRAP);
-	tp->rx_ring[i-1].buffer2 = virt_to_le32desc(&tp->rx_ring[0]);
+	tp->rx_ring[i-1].buffer2 = cpu_to_le32(tp->rx_ring_dma);
 
 	for (i = 0; i < RX_RING_SIZE; i++) {
 		/* Note the receive buffer must be longword aligned.
@@ -595,9 +594,9 @@
 	for (i = 0; i < TX_RING_SIZE; i++) {
 		tp->tx_skbuff[i] = 0;
 		tp->tx_ring[i].status = 0x00000000;
-		tp->tx_ring[i].buffer2 = virt_to_le32desc(&tp->tx_ring[i+1]);
+		tp->tx_ring[i].buffer2 = cpu_to_le32(tp->tx_ring_dma + sizeof(struct tulip_tx_desc) * (i + 1));
 	}
-	tp->tx_ring[i-1].buffer2 = virt_to_le32desc(&tp->tx_ring[0]);
+	tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma);
 }
 
 static int
@@ -1033,6 +1032,13 @@
 	 */
 	tp = dev->priv;
 
+	tp->rx_ring = pci_alloc_consistent(pdev,
+					   sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
+					   sizeof(struct tulip_tx_desc) * TX_RING_SIZE,
+					   &tp->rx_ring_dma);
+	tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE);
+	tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE;
+
 	tp->chip_id = chip_idx;
 	tp->flags = tulip_tbl[chip_idx].flags;
 	tp->pdev = pdev;
@@ -1352,6 +1358,11 @@
 
 	if (dev) {
 		struct tulip_private *tp = (struct tulip_private *)dev->priv;
+		pci_free_consistent(pdev,
+				    sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
+				    sizeof(struct tulip_tx_desc) * TX_RING_SIZE,
+				    tp->rx_ring,
+				    tp->rx_ring_dma);
 		unregister_netdev(dev);
 		release_region(dev->base_addr,
 			       tulip_tbl[tp->chip_id].io_size);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/wan/sdla.c linux/drivers/net/wan/sdla.c
--- v2.3.48/linux/drivers/net/wan/sdla.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/net/wan/sdla.c	Mon Feb 28 07:16:54 2000
@@ -565,7 +565,7 @@
 	flp->dlci[i] = -*(short *)(master->dev_addr);
 	master->mtu = slave->mtu;
 
-	if (netif_running(dev)) {
+	if (netif_running(slave)) {
 		if (flp->config.station == FRAD_STATION_CPE)
 			sdla_reconfig(slave);
 		else
diff -u --recursive --new-file v2.3.48/linux/drivers/net/wan/sdla_chdlc.c linux/drivers/net/wan/sdla_chdlc.c
--- v2.3.48/linux/drivers/net/wan/sdla_chdlc.c	Sun Feb 13 19:29:04 2000
+++ linux/drivers/net/wan/sdla_chdlc.c	Mon Feb 28 07:16:54 2000
@@ -11,6 +11,7 @@
 *		as published by the Free Software Foundation; either version
 *		2 of the License, or (at your option) any later version.
 * ============================================================================
+* Feb 28, 2000  Jeff Garzik	softnet updates
 * Nov 20, 1999  Nenad Corbic 	Fixed zero length API bug.
 * Sep 30, 1999  Nenad Corbic    Fixed dynamic IP and route setup.
 * Sep 23, 1999  Nenad Corbic    Added SMP support, fixed tracing 
@@ -64,6 +65,7 @@
 
 #define PORT(x)   (x == 0 ? "PRIMARY" : "SECONDARY" )
 
+#define TX_TIMEOUT	(5*HZ)
  
 /******Data Structures*****************************************************/
 
@@ -130,6 +132,7 @@
 static int if_init   (struct net_device* dev);
 static int if_open   (struct net_device* dev);
 static int if_close  (struct net_device* dev);
+static void if_tx_timeout (struct net_device *dev);
 static int if_header (struct sk_buff* skb, struct net_device* dev,
 	unsigned short type, void* daddr, void* saddr, unsigned len);
 #ifdef LINUX_2_1
@@ -441,7 +444,7 @@
 	if(test_bit(1, (void*)&card->wandev.critical))
                 return -EAGAIN;
 
-	if(!dev->start)
+	if(!netif_running(dev))
 		return -ENODEV;
 
       	flags = card->u.c.flags;
@@ -652,6 +655,8 @@
 	dev->rebuild_header	= &if_rebuild_hdr;
 	dev->hard_start_xmit	= &if_send;
 	dev->get_stats		= &if_stats;
+	dev->tx_timeout		= &if_tx_timeout;
+	dev->watchdog_timeo	= TX_TIMEOUT;
 
 	/* Initialize media-specific parameters */
 	dev->flags		|= IFF_POINTTOPOINT;
@@ -709,7 +714,7 @@
 
 	/* Only one open per interface is allowed */
 
-	if(dev->start)
+	if(netif_running(dev))
 		return -EBUSY;
 	
 	if(test_and_set_bit(1, (void*)&card->wandev.critical)) {
@@ -774,9 +779,7 @@
 	do_gettimeofday(&tv);
 	chdlc_priv_area->router_start_time = tv.tv_sec;
  
-	dev->interrupt = 0;
-	dev->tbusy = 0;
-	dev->start = 1;
+	netif_start_queue(dev);
 	dev->flags |= IFF_POINTTOPOINT;
 	wanpipe_open(card);
 
@@ -796,7 +799,7 @@
 	if(test_and_set_bit(1, (void*)&card->wandev.critical))
 		return -EAGAIN;
 
-	dev->start = 0;
+	netif_stop_queue(dev);
 	wanpipe_close(card);
 	port_set_state(card, WAN_DISCONNECTED);
 	chdlc_set_intr_mode(card, 0);
@@ -843,6 +846,30 @@
 }
 #endif
 
+
+/*============================================================================
+ * Handle transmit timeout event from netif watchdog
+ */
+static void if_tx_timeout (struct net_device *dev)
+{
+	chdlc_private_area_t *chdlc_priv_area = dev->priv;
+	sdla_t *card = chdlc_priv_area->card;
+
+	/* If our device stays busy for at least 5 seconds then we will
+	 * kick start the device by making dev->tbusy = 0.  We expect 
+	 * that our device never stays busy more than 5 seconds. So this
+	 * is only used as a last resort. 
+	 */
+	++card->wandev.stats.collisions;
+
+	printk (KERN_INFO "%s: Transmit timeout !\n",
+		card->devname);
+
+	/* unbusy the interface */
+	netif_start_queue (dev);
+}
+
+
 /*============================================================================
  * Send a packet on a network interface.
  * o set tbusy flag (marks start of the transmission) to block a timer-based
@@ -875,30 +902,10 @@
 		 */
 		printk(KERN_INFO "%s: interface %s got kicked!\n",
 			card->devname, dev->name);
-		mark_bh(NET_BH);
+		netif_wake_queue(dev);
 		return 0;
 	}
 
-	if(dev->tbusy) {
-
-		/* If our device stays busy for at least 5 seconds then we will
-		 * kick start the device by making dev->tbusy = 0.  We expect 
-		 * that our device never stays busy more than 5 seconds. So this
-		 * is only used as a last resort. 
-		 */
-                ++card->wandev.stats.collisions;
-
-		if((jiffies - chdlc_priv_area->tick_counter) < (5 * HZ)) {
-			return 1;
-		}
-
-		printk (KERN_INFO "%s: Transmit timeout !\n",
-			card->devname);
-
-		/* unbusy the interface */
-		dev->tbusy = 0;
-	}
-	
    	if(ntohs(skb->protocol) != 0x16) {
 
 		/* check the udp packet type */
@@ -977,31 +984,24 @@
 		}
 
 		if(chdlc_send(card, data, len)) {
-			dev->tbusy = 1;
+			netif_stop_queue(dev);
 			chdlc_priv_area->tick_counter = jiffies;
 			chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME;
 		}
 		else {
 			++card->wandev.stats.tx_packets;
-#ifdef LINUX_2_1
                         card->wandev.stats.tx_bytes += len;
-#endif
 		}	
 	}
 
-	if (!dev->tbusy) {
-#ifdef LINUX_2_1
+	if (!netif_queue_stopped(dev))
 		dev_kfree_skb(skb);
-#else
-                dev_kfree_skb(skb, FREE_WRITE);
-#endif
-	}
 
 	clear_bit(0, (void*)&card->wandev.critical);
 	if(card->hw.type != SDLA_S514){
 		s508_unlock(card,&smp_flags);
 	}
-	return dev->tbusy;
+	return netif_queue_stopped(dev);
 }
 
 
@@ -1521,8 +1521,7 @@
 				 ~APP_INT_ON_TX_FRAME;
 
 			chdlc_priv_area = dev->priv;
-			dev->tbusy = 0;	
-			mark_bh(NET_BH);
+			netif_wake_queue(dev);
 			break;
 
 		case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */
@@ -1606,7 +1605,7 @@
 	dev = card->wandev.dev;
 	chdlc_priv_area = dev->priv;
 
-	if(dev && dev->start) {
+	if(dev && netif_running(dev)) {
 
 		len  = rxbuf->frame_length;
 
diff -u --recursive --new-file v2.3.48/linux/drivers/net/wan/sdla_fr.c linux/drivers/net/wan/sdla_fr.c
--- v2.3.48/linux/drivers/net/wan/sdla_fr.c	Sun Feb 13 19:29:04 2000
+++ linux/drivers/net/wan/sdla_fr.c	Mon Feb 28 07:16:55 2000
@@ -11,6 +11,7 @@
 *		as published by the Free Software Foundation; either version
 *		2 of the License, or (at your option) any later version.
 * ============================================================================
+* Feb 28, 2000  Jeff Garzik	o softnet updates
 * Nov 08, 1999  Nenad Corbic    o Combined all debug UDP calls into one function
 *                               o Removed the ARP support. This has to be done
 *                                 in the next version.
@@ -108,7 +109,6 @@
 * Jan 02, 1997	Gene Kozin	Initial version.
 *****************************************************************************/
 
-#include <linux/version.h>
 #include <linux/kernel.h>	/* printk(), and other useful stuff */
 #include <linux/stddef.h>	/* offsetof(), etc. */
 #include <linux/errno.h>	/* return codes */
@@ -129,9 +129,6 @@
 #include <linux/if.h>
 
 #include <linux/sdla_fr.h>	/* frame relay firmware API definitions */
-#if LINUX_VERSION_CODE < 0x020125
-#define test_and_set_bit set_bit
-#endif
  
 /****** Defines & Macros ****************************************************/
 
@@ -157,6 +154,8 @@
 #define API     0x01
 #define FRAME_RELAY_API 1
 
+#define TX_TIMEOUT	(5*HZ)
+
 /* For handle_IPXWAN() */
 #define CVHexToAscii(b) (((unsigned char)(b) > (unsigned char)9) ? ((unsigned char)'A' + ((unsigned char)(b) - (unsigned char)10)) : ((unsigned char)'0' + (unsigned char)(b)))
  
@@ -273,6 +272,7 @@
 static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len);
 static int if_rebuild_hdr(struct sk_buff *skb);
 static int if_send(struct sk_buff *skb, struct net_device *dev);
+static void if_tx_timeout (struct net_device *dev);
 static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
                                 struct sk_buff *skb);
 static struct net_device_stats *if_stats(struct net_device *dev);
@@ -939,6 +939,8 @@
 	dev->rebuild_header	= &if_rebuild_hdr;
 	dev->hard_start_xmit	= &if_send;
 	dev->get_stats		= &if_stats;
+	dev->tx_timeout		= &if_tx_timeout;
+	dev->watchdog_timeo	= TX_TIMEOUT;
 
 	/* Initialize media-specific parameters */
 	dev->type		= ARPHRD_DLCI;	/* ARP h/w type */
@@ -993,7 +995,7 @@
 	int err = 0;
 	struct timeval tv;
 
-	if (dev->start)
+	if (netif_running(dev))
 		return -EBUSY;		/* only one open is allowed */
 
 	if (test_and_set_bit(1, (void*)&card->wandev.critical))
@@ -1034,9 +1036,7 @@
 		fr_activate_dlci(card, chan->dlci);
 	}
 
-	dev->interrupt = 0;
-	dev->tbusy = 0;
-	dev->start = 1;
+	netif_start_queue(dev);
 	wanpipe_open(card);
 	update_chan_state(dev);
 	do_gettimeofday( &tv );
@@ -1058,7 +1058,7 @@
 	if (test_and_set_bit(1, (void*)&card->wandev.critical))
 		return -EAGAIN;
 
-	dev->start = 0;
+	netif_stop_queue(dev);
 	wanpipe_close(card);
 	if (card->wandev.station == WANOPT_NODE) {
 		fr_delete_dlci (card,chan->dlci);
@@ -1113,6 +1113,30 @@
 	return 1;
 }
 
+
+/*============================================================================
+ * Handle transmit timeout event from netif watchdog
+ */
+static void if_tx_timeout (struct net_device *dev)
+{
+    	fr_channel_t* chan = dev->priv;
+
+	/* If our device stays busy for at least 5 seconds then we will
+	 * kick start the device by making dev->tbusy = 0.  We expect
+	 * that our device never stays busy more than 5 seconds. So this                 
+	 * is only used as a last resort.
+	 */
+
+	chan->drvstats_if_send.if_send_tbusy++;
+	++chan->ifstats.collisions;
+
+	printk (KERN_INFO "%s: Transmit timed out\n", chan->name);
+	chan->drvstats_if_send.if_send_tbusy_timeout++;
+	netif_start_queue (dev);
+
+}
+
+
 /*============================================================================
  * Send a packet on a network interface.
  * o set tbusy flag (marks start of the transmission) to block a timer-based
@@ -1153,7 +1177,7 @@
 		printk(KERN_INFO "%s: interface %s got kicked!\n", 
 			card->devname, dev->name);
 		chan->drvstats_if_send.if_send_skb_null ++;
-		mark_bh(NET_BH);
+		netif_wake_queue(dev);
 		return 0;
 	}
 
@@ -1164,33 +1188,13 @@
 	*/
 	set_bit(2, (void*)&card->wandev.critical);
         if(chan->transmit_length) {
-        	dev->tbusy = 1;
+		netif_stop_queue(dev);
 	        chan->tick_counter = jiffies;
  		clear_bit(2, (void*)&card->wandev.critical);
 		return 1;
 	}
        	clear_bit(2, (void*)&card->wandev.critical);
   
-    	if (dev->tbusy) {
-
-		/* If our device stays busy for at least 5 seconds then we will
-                 * kick start the device by making dev->tbusy = 0.  We expect
-                 * that our device never stays busy more than 5 seconds. So this                 
-		 * is only used as a last resort.
-                 */
-		
-		chan->drvstats_if_send.if_send_tbusy++;
-		++chan->ifstats.collisions;
-
-		if ((jiffies - chan->tick_counter) < (5 * HZ)) {
-			return 1;
-		}
-
-		printk(KERN_INFO "%s: Transmit timed out\n", chan->name);
-		chan->drvstats_if_send.if_send_tbusy_timeout ++;
-		dev->tbusy = 0;
-    	}
-
 	data = skb->data;
 	sendpacket = skb->data;
         len = skb->len;
@@ -1318,15 +1322,14 @@
 		}
 	}
 
-        if (!dev->tbusy) {
+        if (!netif_queue_stopped(dev))
 		dev_kfree_skb(skb);
-	}
 
         clear_bit(0, (void*)&card->wandev.critical);
 
 	s508_s514_unlock(card,&smp_flags);
 
-        return (dev->tbusy);
+        return (netif_queue_stopped(dev));
 }
 
 
@@ -1743,10 +1746,10 @@
 
    		skb = dev_alloc_skb(len); 
 
-		if (!dev->start || (skb == NULL)) { 
+		if (!netif_running(dev) || (skb == NULL)) { 
 			++chan->ifstats.rx_dropped;
 		
-			if(dev->start) {
+			if(netif_running(dev)) {
 
 				printk(KERN_INFO 
 				"%s: no socket buffers available!\n", 
@@ -1920,8 +1923,7 @@
 		if(!(-- card->u.f.tx_interrupts_pending))
         	        flags->imask &= ~FR_INTR_TXRDY;
 
- 		dev->tbusy = 0;
-		mark_bh(NET_BH);
+		netif_wake_queue (dev);
 	}
 }
 
@@ -2704,7 +2706,7 @@
 					"%s: DLCI %u is inactive!\n",
 					card->devname, dlci);
 
-				if (dev && dev->start)
+				if (dev && netif_running(dev))
 					set_chan_state(dev, WAN_DISCONNECTED);
 			}
 	
@@ -2714,7 +2716,7 @@
 					"%s: DLCI %u has been deleted!\n",
 					card->devname, dlci);
 
-				if (dev && dev->start) {
+				if (dev && netif_running(dev)) {
 					fr_channel_t *chan = dev->priv;
 
 					if (chan->route_flag == ROUTE_ADDED) {
@@ -2738,7 +2740,7 @@
 			 	*/ 
 				chan->dlci_configured = DLCI_CONFIG_PENDING;
 			
-				if (dev && dev->start)
+				if (dev && netif_running(dev))
 					set_chan_state(dev, WAN_CONNECTED);
 		
 			}
@@ -3004,7 +3006,7 @@
 			test_bit(2, (void*)&card->wandev.critical)) {
 			return 0;
   		}
-		if((dev->tbusy) || (card->u.f.tx_interrupts_pending)) {
+		if((netif_queue_stopped(dev)) || (card->u.f.tx_interrupts_pending)) {
 			return 0;
 		}
         }
diff -u --recursive --new-file v2.3.48/linux/drivers/net/wan/sdla_ppp.c linux/drivers/net/wan/sdla_ppp.c
--- v2.3.48/linux/drivers/net/wan/sdla_ppp.c	Sun Feb 13 19:29:04 2000
+++ linux/drivers/net/wan/sdla_ppp.c	Mon Feb 28 07:16:55 2000
@@ -142,9 +142,8 @@
 #define NUM_AUTH_REQ_WITHOUT_REPLY      10
 
 #define END_OFFSET 0x1F0
-#if LINUX_VERSION_CODE < 0x020125
-#define test_and_set_bit set_bit
-#endif
+
+#define TX_TIMEOUT (5*HZ)
 
 /******Data Structures*****************************************************/
 
@@ -213,6 +212,7 @@
 static int if_init(struct net_device *dev);
 static int if_open(struct net_device *dev);
 static int if_close(struct net_device *dev);
+static void if_tx_timeout (struct net_device *dev);
 static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 
 		     void *daddr, void *saddr, unsigned len);
 static int if_rebuild_hdr(struct sk_buff *skb);
@@ -585,7 +585,8 @@
 	dev->rebuild_header	= &if_rebuild_hdr;
 	dev->hard_start_xmit	= &if_send;
 	dev->get_stats		= &if_stats;
-
+	dev->tx_timeout		= &if_tx_timeout;
+	dev->watchdog_timeo	= TX_TIMEOUT;
 
 	/* Initialize media-specific parameters */
 	dev->type		= ARPHRD_PPP;	/* ARP h/w type */
@@ -632,7 +633,7 @@
 	struct timeval tv;
 	int err = 0;
 
-	if (dev->start)
+	if (netif_running(dev))
 		return -EBUSY;		/* only one open is allowed */
 	
 	if (test_and_set_bit(0, (void*)&card->wandev.critical))
@@ -714,13 +715,10 @@
 		return err;
 	}
 	
-	
 	wanpipe_set_state(card, WAN_CONNECTING);
 	wanpipe_open(card);
 	dev->mtu = min(dev->mtu, card->wandev.mtu);
-	dev->interrupt = 0;
-	dev->tbusy = 0;
-	dev->start = 1;
+	netif_start_queue(dev);	
 	do_gettimeofday( &tv );
 	ppp_priv_area->router_start_time = tv.tv_sec;
 	card->wandev.critical = 0;
@@ -741,7 +739,7 @@
 	if (test_and_set_bit(0, (void*)&card->wandev.critical))
 		return -EAGAIN;
 	
-	dev->start = 0;
+	netif_stop_queue(dev);
 	wanpipe_close(card);
 	wanpipe_set_state(card, WAN_DISCONNECTED);
 	ppp_set_intr_mode(card, 0);
@@ -795,6 +793,35 @@
 	return 1;
 }
 
+
+/*============================================================================
+ * Handle transmit timeout from netif watchdog
+ */
+static void if_tx_timeout (struct net_device *dev)
+{
+	ppp_private_area_t *ppp_priv_area = dev->priv;
+	sdla_t *card = ppp_priv_area->card;
+
+
+	/* If our device stays busy for at least 5 seconds then we will
+	 * kick start the device by making dev->tbusy = 0.  We expect 
+	 * that our device never stays busy more than 5 seconds. So this
+	 * is only used as a last resort. 
+	 */
+
+	++ppp_priv_area->if_send_stat.if_send_tbusy;
+	++card->wandev.stats.collisions;
+
+	printk (KERN_INFO "%s: Transmit times out\n", card->devname);
+
+	++ppp_priv_area->if_send_stat.if_send_tbusy_timeout;
+	++card->wandev.stats.collisions;
+
+	/* unbusy the card (because only one interface per card) */
+	netif_start_queue(dev);
+}
+
+
 /*============================================================================
  * Send a packet on a network interface.
  * o set tbusy flag (marks start of the transmission) to block a timer-based
@@ -835,34 +862,11 @@
 		
 		++ppp_priv_area->if_send_stat.if_send_skb_null;
 		
-		mark_bh(NET_BH);
+		netif_wake_queue(dev);
 		return 0;
 
 	}
 
-	if (dev->tbusy) {
-
-		/* If our device stays busy for at least 5 seconds then we will
-		 * kick start the device by making dev->tbusy = 0.  We expect 
-		 * that our device never stays busy more than 5 seconds. So this
-		 * is only used as a last resort. 
-		 */
-              
-		++ppp_priv_area->if_send_stat.if_send_tbusy;
-        	++card->wandev.stats.collisions;
-
-		if ((jiffies - ppp_priv_area->tick_counter) < (5*HZ)) {
-			return 1;
-		}
-
-		printk (KERN_INFO "%s: Transmit times out\n",card->devname);
-	
-		++ppp_priv_area->if_send_stat.if_send_tbusy_timeout;
-		++card->wandev.stats.collisions;
-
-		/* unbusy the card (because only one interface per card)*/
-		dev->tbusy = 0;
-	}	
 	sendpacket = skb->data;
 
 	udp_type = udp_pkt_type( skb, card );
@@ -930,7 +934,7 @@
 
 		if (ppp_send(card, skb->data, skb->len, skb->protocol)) {
 			retry = 1;
-			dev->tbusy = 1;
+			netif_stop_queue(dev);
 			++ppp_priv_area->if_send_stat.if_send_adptr_bfrs_full;
 			++ppp_priv_area->if_send_stat.if_send_tx_int_enabled;
 			ppp_priv_area->tick_counter = jiffies;
@@ -1530,7 +1534,7 @@
 		case PPP_INTR_TXRDY:	/* transmit interrupt  0x02 (bit 1)*/
 			++card->statistics.isr_tx;
 			flags->imask &= ~PPP_INTR_TXRDY;
-			dev->tbusy = 0;		
+			netif_wake_queue (dev);
 			card->buff_int_mode_unbusy = 1;
 			break;
 
@@ -1564,9 +1568,8 @@
 	flags->iflag = 0;
 	card->wandev.critical = 0;
 
-	if(card->buff_int_mode_unbusy) {	
-		mark_bh(NET_BH);
-	}
+	if(card->buff_int_mode_unbusy)
+		netif_wake_queue(dev);
 }
 
 /*============================================================================
@@ -1603,7 +1606,7 @@
 
 	}
 
-	if (dev && dev->start) {
+	if (dev && netif_running(dev)) {
 	
 		len  = rxbuf->length;
 		ppp_priv_area = dev->priv;
@@ -2006,7 +2009,7 @@
 {
 	struct net_device *dev = card->wandev.dev;
 
-	if (dev && dev->start &&
+	if (dev && netif_running(dev) &&
 	    ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) {
 	
 		wanpipe_set_state(card, WAN_CONNECTING);
diff -u --recursive --new-file v2.3.48/linux/drivers/net/wavelan.c linux/drivers/net/wavelan.c
--- v2.3.48/linux/drivers/net/wavelan.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/net/wavelan.c	Mon Feb 28 07:18:20 2000
@@ -3726,7 +3726,7 @@
 	}
 
 	/* Release spinlock here so that wv_hw_reset() can grab it */
-	spin_unlock (&lp->lock);
+	spin_unlock (&lp->spinlock);
 
 	/* Check the state of the command unit. */
 	if (((status & SCB_ST_CNA) == SCB_ST_CNA) ||
@@ -4006,7 +4006,7 @@
 	lp->mc_count = 0;
 
 	/* Init spinlock */
-	spin_lock_init(&lp->lock);
+	spin_lock_init(&lp->spinlock);
 
 	/*
 	 * Fill in the fields of the device structure
diff -u --recursive --new-file v2.3.48/linux/drivers/net/yellowfin.c linux/drivers/net/yellowfin.c
--- v2.3.48/linux/drivers/net/yellowfin.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/net/yellowfin.c	Tue Feb 29 11:09:10 2000
@@ -103,6 +103,22 @@
 #define le32desc_to_virt(addr)  bus_to_virt(le32_to_cpu(addr))
 
 
+#ifdef USE_IO_OPS
+#define YF_INB	inb
+#define YF_INW	inw
+#define YF_INL	inl
+#define YF_OUTB	outb
+#define YF_OUTW	outw
+#define YF_OUTL	outl
+#else
+#define YF_INB	readb
+#define YF_INW	readw
+#define YF_INL	readl
+#define YF_OUTB	writeb
+#define YF_OUTW	writew
+#define YF_OUTL	writel
+#endif
+
 /*
 				Theory of Operation
 
@@ -357,11 +373,11 @@
 {
 	int bogus_cnt = 10000;		/* Typical 33Mhz: 1050 ticks */
 
-	outb(location, ioaddr + EEAddr);
-	outb(0x30 | ((location >> 8) & 7), ioaddr + EECtrl);
-	while ((inb(ioaddr + EEStatus) & 0x80)  &&  --bogus_cnt > 0)
+	YF_OUTB(location, ioaddr + EEAddr);
+	YF_OUTB(0x30 | ((location >> 8) & 7), ioaddr + EECtrl);
+	while ((YF_INB(ioaddr + EEStatus) & 0x80)  &&  --bogus_cnt > 0)
 		;
-	return inb(ioaddr + EERead);
+	return YF_INB(ioaddr + EERead);
 }
 
 /* MII Managemen Data I/O accesses.
@@ -372,24 +388,24 @@
 {
 	int i;
 
-	outw((phy_id<<8) + location, ioaddr + MII_Addr);
-	outw(1, ioaddr + MII_Cmd);
+	YF_OUTW((phy_id<<8) + location, ioaddr + MII_Addr);
+	YF_OUTW(1, ioaddr + MII_Cmd);
 	for (i = 10000; i >= 0; i--)
-		if ((inw(ioaddr + MII_Status) & 1) == 0)
+		if ((YF_INW(ioaddr + MII_Status) & 1) == 0)
 			break;
-	return inw(ioaddr + MII_Rd_Data);
+	return YF_INW(ioaddr + MII_Rd_Data);
 }
 
 static void mdio_write(long ioaddr, int phy_id, int location, int value)
 {
 	int i;
 
-	outw((phy_id<<8) + location, ioaddr + MII_Addr);
-	outw(value, ioaddr + MII_Wr_Data);
+	YF_OUTW((phy_id<<8) + location, ioaddr + MII_Addr);
+	YF_OUTW(value, ioaddr + MII_Wr_Data);
 
 	/* Wait for the command to finish. */
 	for (i = 10000; i >= 0; i--)
-		if ((inw(ioaddr + MII_Status) & 1) == 0)
+		if ((YF_INW(ioaddr + MII_Status) & 1) == 0)
 			break;
 	return;
 }
@@ -402,7 +418,7 @@
 	int i;
 
 	/* Reset the chip. */
-	outl(0x80000000, ioaddr + DMACtrl);
+	YF_OUTL(0x80000000, ioaddr + DMACtrl);
 
 	if (request_irq(dev->irq, &yellowfin_interrupt, SA_SHIRQ, dev->name, dev))
 		return -EAGAIN;
@@ -415,30 +431,30 @@
 
 	yellowfin_init_ring(dev);
 
-	outl(virt_to_bus(yp->rx_ring), ioaddr + RxPtr);
-	outl(virt_to_bus(yp->tx_ring), ioaddr + TxPtr);
+	YF_OUTL(virt_to_bus(yp->rx_ring), ioaddr + RxPtr);
+	YF_OUTL(virt_to_bus(yp->tx_ring), ioaddr + TxPtr);
 
 	for (i = 0; i < 6; i++)
-		outb(dev->dev_addr[i], ioaddr + StnAddr + i);
+		YF_OUTB(dev->dev_addr[i], ioaddr + StnAddr + i);
 
 	/* Set up various condition 'select' registers.
 	   There are no options here. */
-	outl(0x00800080, ioaddr + TxIntrSel); 	/* Interrupt on Tx abort */
-	outl(0x00800080, ioaddr + TxBranchSel);	/* Branch on Tx abort */
-	outl(0x00400040, ioaddr + TxWaitSel); 	/* Wait on Tx status */
-	outl(0x00400040, ioaddr + RxIntrSel);	/* Interrupt on Rx done */
-	outl(0x00400040, ioaddr + RxBranchSel);	/* Branch on Rx error */
-	outl(0x00400040, ioaddr + RxWaitSel);	/* Wait on Rx done */
+	YF_OUTL(0x00800080, ioaddr + TxIntrSel); 	/* Interrupt on Tx abort */
+	YF_OUTL(0x00800080, ioaddr + TxBranchSel);	/* Branch on Tx abort */
+	YF_OUTL(0x00400040, ioaddr + TxWaitSel); 	/* Wait on Tx status */
+	YF_OUTL(0x00400040, ioaddr + RxIntrSel);	/* Interrupt on Rx done */
+	YF_OUTL(0x00400040, ioaddr + RxBranchSel);	/* Branch on Rx error */
+	YF_OUTL(0x00400040, ioaddr + RxWaitSel);	/* Wait on Rx done */
 
 	/* Initialize other registers: with so many this eventually this will
 	   converted to an offset/value list. */
-	outl(dma_ctrl, ioaddr + DMACtrl);
-	outw(fifo_cfg, ioaddr + FIFOcfg);
+	YF_OUTL(dma_ctrl, ioaddr + DMACtrl);
+	YF_OUTW(fifo_cfg, ioaddr + FIFOcfg);
 	/* Enable automatic generation of flow control frames, period 0xffff. */
-	outl(0x0030FFFF, ioaddr + FlowCtrl);
+	YF_OUTL(0x0030FFFF, ioaddr + FlowCtrl);
 
 	yp->tx_threshold = 32;
-	outl(yp->tx_threshold, ioaddr + TxThreshold);
+	YF_OUTL(yp->tx_threshold, ioaddr + TxThreshold);
 
 	if (dev->if_port == 0)
 		dev->if_port = yp->default_port;
@@ -449,19 +465,19 @@
 	if (yp->flags & IsGigabit) {
 		/* We are always in full-duplex mode with gigabit! */
 		yp->full_duplex = 1;
-		outw(0x01CF, ioaddr + Cnfg);
+		YF_OUTW(0x01CF, ioaddr + Cnfg);
 	} else {
-		outw(0x0018, ioaddr + FrameGap0); /* 0060/4060 for non-MII 10baseT */
-		outw(0x1018, ioaddr + FrameGap1);
-		outw(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
+		YF_OUTW(0x0018, ioaddr + FrameGap0); /* 0060/4060 for non-MII 10baseT */
+		YF_OUTW(0x1018, ioaddr + FrameGap1);
+		YF_OUTW(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
 	}
 	set_rx_mode(dev);
 
 	/* Enable interrupts by setting the interrupt mask. */
-	outw(0x81ff, ioaddr + IntrEnb);			/* See enum intr_status_bits */
-	outw(0x0000, ioaddr + EventStatus);		/* Clear non-interrupting events */
-	outl(0x80008000, ioaddr + RxCtrl);		/* Start Rx and Tx channels. */
-	outl(0x80008000, ioaddr + TxCtrl);
+	YF_OUTW(0x81ff, ioaddr + IntrEnb);			/* See enum intr_status_bits */
+	YF_OUTW(0x0000, ioaddr + EventStatus);		/* Clear non-interrupting events */
+	YF_OUTL(0x80008000, ioaddr + RxCtrl);		/* Start Rx and Tx channels. */
+	YF_OUTL(0x80008000, ioaddr + TxCtrl);
 
 	if (yellowfin_debug > 2) {
 		printk(KERN_DEBUG "%s: Done yellowfin_open().\n",
@@ -486,7 +502,7 @@
 
 	if (yellowfin_debug > 3) {
 		printk(KERN_DEBUG "%s: Yellowfin timer tick, status %8.8x.\n",
-			   dev->name, inw(ioaddr + IntrStatus));
+			   dev->name, YF_INW(ioaddr + IntrStatus));
 	}
 
 	if (yp->mii_cnt) {
@@ -503,7 +519,7 @@
 			  || (negotiated & 0x00C0) == 0x0040)) {
 			yp->full_duplex = 1;
 		}
-		outw(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
+		YF_OUTW(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
 
 		if (mii_reg1 & 0x0004)
 			next_tick = 60*HZ;
@@ -523,7 +539,7 @@
 	printk(KERN_WARNING "%s: Yellowfin transmit timed out at %d/%d Tx "
 		   "status %4.4x, Rx status %4.4x, resetting...\n",
 		   dev->name, yp->cur_tx, yp->dirty_tx,
-		   inl(ioaddr + TxStatus), inl(ioaddr + RxStatus));
+		   YF_INL(ioaddr + TxStatus), YF_INL(ioaddr + RxStatus));
 
 	/* Note: these should be KERN_DEBUG. */
 	if (yellowfin_debug) {
@@ -543,7 +559,7 @@
 	dev->if_port = 0;
 
 	/* Wake the potentially-idle transmit channel. */
-	outl(0x10001000, dev->base_addr + TxCtrl);
+	YF_OUTL(0x10001000, dev->base_addr + TxCtrl);
 	if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE)
 		netif_wake_queue (dev);		/* Typical path */
 
@@ -681,7 +697,7 @@
 	/* Non-x86 Todo: explicitly flush cache lines here. */
 
 	/* Wake the potentially-idle transmit channel. */
-	outl(0x10001000, dev->base_addr + TxCtrl);
+	YF_OUTL(0x10001000, dev->base_addr + TxCtrl);
 
 	if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE)
 		netif_start_queue (dev);		/* Typical path */
@@ -717,7 +733,7 @@
 	spin_lock (&yp->lock);
 
 	do {
-		u16 intr_status = inw(ioaddr + IntrClear);
+		u16 intr_status = YF_INW(ioaddr + IntrClear);
 
 		if (yellowfin_debug > 4)
 			printk(KERN_DEBUG "%s: Yellowfin interrupt, status %4.4x.\n",
@@ -728,7 +744,7 @@
 
 		if (intr_status & (IntrRxDone | IntrEarlyRx)) {
 			yellowfin_rx(dev);
-			outl(0x10001000, ioaddr + RxCtrl);		/* Wake Rx engine. */
+			YF_OUTL(0x10001000, ioaddr + RxCtrl);		/* Wake Rx engine. */
 		}
 
 #ifdef NO_TXSTATS
@@ -845,7 +861,7 @@
 
 	if (yellowfin_debug > 3)
 		printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
-			   dev->name, inw(ioaddr + IntrStatus));
+			   dev->name, YF_INW(ioaddr + IntrStatus));
 
 	/* Code that should never be run!  Perhaps remove after testing.. */
 	{
@@ -1023,18 +1039,19 @@
 
 	if (yellowfin_debug > 1) {
 		printk(KERN_DEBUG "%s: Shutting down ethercard, status was Tx %4.4x Rx %4.4x Int %2.2x.\n",
-			   dev->name, inw(ioaddr + TxStatus),
-			   inw(ioaddr + RxStatus), inw(ioaddr + IntrStatus));
+			   dev->name, YF_INW(ioaddr + TxStatus),
+			   YF_INW(ioaddr + RxStatus),
+			   YF_INW(ioaddr + IntrStatus));
 		printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d,  Rx %d / %d.\n",
 			   dev->name, yp->cur_tx, yp->dirty_tx, yp->cur_rx, yp->dirty_rx);
 	}
 
 	/* Disable interrupts by clearing the interrupt mask. */
-	outw(0x0000, ioaddr + IntrEnb);
+	YF_OUTW(0x0000, ioaddr + IntrEnb);
 
 	/* Stop the chip's Tx and Rx processes. */
-	outl(0x80000000, ioaddr + RxCtrl);
-	outl(0x80000000, ioaddr + TxCtrl);
+	YF_OUTL(0x80000000, ioaddr + RxCtrl);
+	YF_OUTL(0x80000000, ioaddr + TxCtrl);
 
 	del_timer(&yp->timer);
 
@@ -1043,7 +1060,7 @@
 		printk("\n"KERN_DEBUG"  Tx ring at %8.8x:\n", (int)virt_to_bus(yp->tx_ring));
 		for (i = 0; i < TX_RING_SIZE*2; i++)
 			printk(" %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n",
-				   inl(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ',
+				   YF_INL(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ',
 				   i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr,
 				   yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status);
 		printk(KERN_DEBUG "  Tx status %p:\n", yp->tx_status);
@@ -1055,7 +1072,7 @@
 		printk("\n"KERN_DEBUG "  Rx ring %8.8x:\n", (int)virt_to_bus(yp->rx_ring));
 		for (i = 0; i < RX_RING_SIZE; i++) {
 			printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n",
-				   inl(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ',
+				   YF_INL(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ',
 				   i, yp->rx_ring[i].dbdma_cmd, yp->rx_ring[i].addr,
 				   yp->rx_ring[i].result_status);
 			if (yellowfin_debug > 6) {
@@ -1134,17 +1151,17 @@
 {
 	struct yellowfin_private *yp = (struct yellowfin_private *)dev->priv;
 	long ioaddr = dev->base_addr;
-	u16 cfg_value = inw(ioaddr + Cnfg);
+	u16 cfg_value = YF_INW(ioaddr + Cnfg);
 
 	/* Stop the Rx process to change any value. */
-	outw(cfg_value & ~0x1000, ioaddr + Cnfg);
+	YF_OUTW(cfg_value & ~0x1000, ioaddr + Cnfg);
 	if (dev->flags & IFF_PROMISC) {			/* Set promiscuous. */
 		/* Unconditionally log net taps. */
 		printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
-		outw(0x000F, ioaddr + AddrMode);
+		YF_OUTW(0x000F, ioaddr + AddrMode);
 	} else if ((dev->mc_count > 64)  ||  (dev->flags & IFF_ALLMULTI)) {
 		/* Too many to filter well, or accept all multicasts. */
-		outw(0x000B, ioaddr + AddrMode);
+		YF_OUTW(0x000B, ioaddr + AddrMode);
 	} else if (dev->mc_count > 0) { /* Must use the multicast hash table. */
 		struct dev_mc_list *mclist;
 		u16 hash_table[4];
@@ -1167,13 +1184,13 @@
 		}
 		/* Copy the hash table to the chip. */
 		for (i = 0; i < 4; i++)
-			outw(hash_table[i], ioaddr + HashTbl + i*2);
-		outw(0x0003, ioaddr + AddrMode);
+			YF_OUTW(hash_table[i], ioaddr + HashTbl + i*2);
+		YF_OUTW(0x0003, ioaddr + AddrMode);
 	} else {					/* Normal, unicast/broadcast-only mode. */
-		outw(0x0001, ioaddr + AddrMode);
+		YF_OUTW(0x0001, ioaddr + AddrMode);
 	}
 	/* Restart the Rx process. */
-	outw(cfg_value | 0x1000, ioaddr + Cnfg);
+	YF_OUTW(cfg_value | 0x1000, ioaddr + Cnfg);
 }
 
 #ifdef HAVE_PRIVATE_IOCTL
@@ -1209,7 +1226,7 @@
 	int option, i, irq;
 	int flags, chip_idx;
 	static int find_cnt = 0;
-	long ioaddr;
+	long ioaddr, real_ioaddr;
 	
 	chip_idx = ent->driver_data;
 	flags = chip_info[chip_idx].flags;
@@ -1243,18 +1260,20 @@
 	pci_set_master (pdev);
 
 #ifdef USE_IO_OPS
-	ioaddr = pci_resource_start (pdev, 0);
+	real_ioaddr = ioaddr = pci_resource_start (pdev, 0);
 #else
-	ioaddr = pci_resource_start (pdev, 1);
+	real_ioaddr = ioaddr = pci_resource_start (pdev, 1);
+	ioaddr = ioremap(ioaddr, YELLOWFIN_SIZE);
 #endif
 	irq = pdev->irq;
 
 	printk(KERN_INFO "%s: %s type %8x at 0x%lx, ",
-		   dev->name, chip_info[chip_idx].name, inl(ioaddr + ChipRev), ioaddr);
+	       dev->name, chip_info[chip_idx].name,
+	       YF_INL(ioaddr + ChipRev), real_ioaddr);
 
 	if (flags & IsGigabit)
 		for (i = 0; i < 6; i++)
-			dev->dev_addr[i] = inb(ioaddr + StnAddr + i);
+			dev->dev_addr[i] = YF_INB(ioaddr + StnAddr + i);
 	else {
 		int ee_offset = (read_eeprom(ioaddr, 6) == 0xff ? 0x100 : 0);
 		for (i = 0; i < 6; i++)
@@ -1265,7 +1284,7 @@
 	printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq);
 
 	/* Reset the chip. */
-	outl(0x80000000, ioaddr + DMACtrl);
+	YF_OUTL(0x80000000, ioaddr + DMACtrl);
 
 	dev->base_addr = ioaddr;
 	dev->irq = irq;
diff -u --recursive --new-file v2.3.48/linux/drivers/parport/daisy.c linux/drivers/parport/daisy.c
--- v2.3.48/linux/drivers/parport/daisy.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/parport/daisy.c	Mon Feb 28 07:16:49 2000
@@ -160,10 +160,10 @@
 
 	while (prev) {
 		dev = prev->next;
-		if (dev && dev->port == port)
+		if (dev && dev->port == port) {
 			prev->next = dev->next;
-
-		kfree (dev);
+			kfree (dev);
+		}
 		prev = prev->next;
 	}
 
diff -u --recursive --new-file v2.3.48/linux/drivers/parport/ieee1284.c linux/drivers/parport/ieee1284.c
--- v2.3.48/linux/drivers/parport/ieee1284.c	Thu Nov 11 20:11:42 1999
+++ linux/drivers/parport/ieee1284.c	Mon Feb 28 07:19:18 2000
@@ -165,6 +165,7 @@
 /* Terminate a negotiated mode. */
 static void parport_ieee1284_terminate (struct parport *port)
 {
+	int r;
 	port = port->physport;
 
 	/* EPP terminates differently. */
@@ -199,9 +200,12 @@
 					      | PARPORT_CONTROL_AUTOFD);
 
 			/* Event 49: PError goes high */
-			parport_wait_peripheral (port,
-						 PARPORT_STATUS_PAPEROUT,
-						 PARPORT_STATUS_PAPEROUT);
+			r = parport_wait_peripheral (port,
+						     PARPORT_STATUS_PAPEROUT,
+						     PARPORT_STATUS_PAPEROUT);
+			if (r)
+				DPRINTK (KERN_INFO "%s: Timeout at event 49\n",
+					 port->name);
 
 			parport_data_forward (port);
 			DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
@@ -221,7 +225,10 @@
 				      PARPORT_CONTROL_SELECT);
 
 		/* Event 24: nAck goes low */
-		parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0);
+		r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0);
+		if (r)
+			DPRINTK (KERN_INFO "%s: Timeout at event 24\n",
+				 port->name);
 
 		/* Event 25: Set nAutoFd low */
 		parport_frob_control (port,
@@ -229,9 +236,12 @@
 				      PARPORT_CONTROL_AUTOFD);
 
 		/* Event 27: nAck goes high */
-		parport_wait_peripheral (port,
-					 PARPORT_STATUS_ACK, 
-					 PARPORT_STATUS_ACK);
+		r = parport_wait_peripheral (port,
+					     PARPORT_STATUS_ACK, 
+					     PARPORT_STATUS_ACK);
+		if (r)
+			DPRINTK (KERN_INFO "%s: Timeout at event 27\n",
+				 port->name);
 
 		/* Event 29: Set nAutoFd high */
 		parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
@@ -260,6 +270,7 @@
 	return -1;
 #else
 	int m = mode & ~IEEE1284_ADDR;
+	int r;
 	unsigned char xflag;
 
 	port = port->physport;
@@ -367,7 +378,7 @@
 	/* xflag should be high for all modes other than nibble (0). */
 	if (mode && !xflag) {
 		/* Mode not supported. */
-		DPRINTK (KERN_DEBUG "%s: Mode 0x%02x not supported\n",
+		DPRINTK (KERN_DEBUG "%s: Mode 0x%02x rejected by peripheral\n",
 			 port->name, mode);
 		parport_ieee1284_terminate (port);
 		return 1;
@@ -434,7 +445,7 @@
 	port->ieee1284.mode = mode;
 
 	/* But ECP is special */
-	if (!(mode & IEEE1284_EXT_LINK) && (mode & IEEE1284_MODE_ECP)) {
+	if (!(mode & IEEE1284_EXT_LINK) && (m & IEEE1284_MODE_ECP)) {
 		port->ieee1284.phase = IEEE1284_PH_ECP_SETUP;
 
 		/* Event 30: Set nAutoFd low */
@@ -443,10 +454,11 @@
 				      PARPORT_CONTROL_AUTOFD);
 
 		/* Event 31: PError goes high. */
-		parport_wait_peripheral (port,
-					 PARPORT_STATUS_PAPEROUT,
-					 PARPORT_STATUS_PAPEROUT);
-		/* (Should check that this works..) */
+		r = parport_wait_peripheral (port,
+					     PARPORT_STATUS_PAPEROUT,
+					     PARPORT_STATUS_PAPEROUT);
+		if (r)
+			DPRINTK (KERN_INFO "%s: Timeout at event 31\n");
 
 		port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
 		DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
diff -u --recursive --new-file v2.3.48/linux/drivers/parport/parport_pc.c linux/drivers/parport/parport_pc.c
--- v2.3.48/linux/drivers/parport/parport_pc.c	Sat Feb 26 22:31:47 2000
+++ linux/drivers/parport/parport_pc.c	Mon Feb 28 07:19:18 2000
@@ -1503,7 +1503,7 @@
 
 /* --- DMA detection -------------------------------------- */
 
-/* Only if supports ECP mode */
+/* Only if chipset conforms to ECP ISA Interface Standard */
 static int __devinit programmable_dma_support (struct parport *p)
 {
 	unsigned char oecr = inb (ECONTROL (p));
@@ -1511,8 +1511,10 @@
 
 	frob_econtrol (p, 0xe0, ECR_CNF << 5);
 	
-	dma = inb (CONFIGB(p)) & 0x03;
-	if (!dma)
+	dma = inb (CONFIGB(p)) & 0x07;
+	/* 000: Indicates jumpered 8-bit DMA if read-only.
+	   100: Indicates jumpered 16-bit DMA if read-only. */
+	if ((dma & 0x03) == 0)
 		dma = PARPORT_DMA_NONE;
 
 	outb (oecr, ECONTROL (p));
@@ -1722,6 +1724,7 @@
 }
 
 
+/* Via support maintained by Jeff Garzik <jgarzik@mandrakesoft.com> */
 static int __devinit sio_via_686a_probe (struct pci_dev *pdev)
 {
 	u8 dma, irq, tmp;
@@ -1835,6 +1838,7 @@
 
 static int __devinit parport_pc_init_superio(void)
 {
+#ifdef CONFIG_PCI
 	const struct pci_device_id *id;
 	struct pci_dev *pdev;
 	
@@ -1845,11 +1849,11 @@
 		
 		return parport_pc_superio_info[id->driver_data].probe (pdev);
 	}
+#endif /* CONFIG_PCI */
 	
 	return 0; /* zero devices found */
 }
 
-
 /* Look for PCI parallel port cards. */
 static int __init parport_pc_init_pci (int irq, int dma)
 {
@@ -1991,6 +1995,7 @@
 		}
 	}
 
+#ifdef CONFIG_PCI
 	/* Look for parallel controllers that we don't know about. */
 	pci_for_each_dev(pcidev) {
 		const int class_noprogif = pcidev->class & ~0xff;
@@ -2011,6 +2016,7 @@
 			"tim@cyberelk.demon.co.uk\n",
 			pcidev->vendor, pcidev->device);
 	}
+#endif
 
 	return count;
 }
@@ -2034,9 +2040,16 @@
 static int irqval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY };
 static const char *irq[PARPORT_PC_MAX_PORTS] = { NULL, };
 static const char *dma[PARPORT_PC_MAX_PORTS] = { NULL, };
+
+MODULE_AUTHOR("Phil Blundell, Tim Waugh, others");
+MODULE_DESCRIPTION("PC-style parallel port driver");
+MODULE_PARM_DESC(io, "Base I/O address (SPP regs)");
 MODULE_PARM(io, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "i");
+MODULE_PARM_DESC(io_hi, "Base I/O address (ECR)");
 MODULE_PARM(io_hi, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "i");
+MODULE_PARM_DESC(irq, "IRQ line");
 MODULE_PARM(irq, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
+MODULE_PARM_DESC(dma, "DMA channel");
 MODULE_PARM(dma, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
 
 int init_module(void)
diff -u --recursive --new-file v2.3.48/linux/drivers/pci/Makefile linux/drivers/pci/Makefile
--- v2.3.48/linux/drivers/pci/Makefile	Fri Jan 21 18:19:16 2000
+++ linux/drivers/pci/Makefile	Mon Feb 28 07:16:54 2000
@@ -14,11 +14,8 @@
 # Nasty trick as we need to link files with no references from the outside.
 O_TARGET := pci_core.o
 L_OBJS	 := pci_core.o
-O_OBJS   := pci.o quirks.o
-
-ifdef CONFIG_MODULES
-OX_OBJS  += pcisyms.o
-endif
+O_OBJS   := quirks.o
+OX_OBJS   := pci.o
 
 ifdef CONFIG_PROC_FS
 O_OBJS   += proc.o
diff -u --recursive --new-file v2.3.48/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
--- v2.3.48/linux/drivers/pci/pci.c	Thu Feb 10 17:11:12 2000
+++ linux/drivers/pci/pci.c	Mon Feb 28 07:16:54 2000
@@ -10,6 +10,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -19,6 +20,7 @@
 #include <linux/ioport.h>
 
 #include <asm/page.h>
+#include <asm/dma.h>	/* isa_dma_bridge_buggy */
 
 #undef DEBUG
 
@@ -987,3 +989,50 @@
 }
 
 __setup("pci=", pci_setup);
+
+
+EXPORT_SYMBOL(pci_read_config_byte);
+EXPORT_SYMBOL(pci_read_config_word);
+EXPORT_SYMBOL(pci_read_config_dword);
+EXPORT_SYMBOL(pci_write_config_byte);
+EXPORT_SYMBOL(pci_write_config_word);
+EXPORT_SYMBOL(pci_write_config_dword);
+EXPORT_SYMBOL(pci_devices);
+EXPORT_SYMBOL(pci_root_buses);
+EXPORT_SYMBOL(pci_enable_device);
+EXPORT_SYMBOL(pci_find_capability);
+EXPORT_SYMBOL(pci_find_class);
+EXPORT_SYMBOL(pci_find_device);
+EXPORT_SYMBOL(pci_find_slot);
+EXPORT_SYMBOL(pci_find_subsys);
+EXPORT_SYMBOL(pci_set_master);
+EXPORT_SYMBOL(pci_set_power_state);
+EXPORT_SYMBOL(pci_assign_resource);
+EXPORT_SYMBOL(pci_register_driver);
+EXPORT_SYMBOL(pci_unregister_driver);
+EXPORT_SYMBOL(pci_match_device);
+EXPORT_SYMBOL(pci_find_parent_resource);
+
+#ifdef CONFIG_HOTPLUG
+EXPORT_SYMBOL(pci_setup_device);
+EXPORT_SYMBOL(pci_insert_device);
+EXPORT_SYMBOL(pci_remove_device);
+#endif
+
+/* Obsolete functions */
+
+EXPORT_SYMBOL(pcibios_present);
+EXPORT_SYMBOL(pcibios_read_config_byte);
+EXPORT_SYMBOL(pcibios_read_config_word);
+EXPORT_SYMBOL(pcibios_read_config_dword);
+EXPORT_SYMBOL(pcibios_write_config_byte);
+EXPORT_SYMBOL(pcibios_write_config_word);
+EXPORT_SYMBOL(pcibios_write_config_dword);
+EXPORT_SYMBOL(pcibios_find_class);
+EXPORT_SYMBOL(pcibios_find_device);
+
+/* Quirk info */
+
+EXPORT_SYMBOL(isa_dma_bridge_buggy);
+EXPORT_SYMBOL(pci_pci_problems);
+
diff -u --recursive --new-file v2.3.48/linux/drivers/pci/pci.ids linux/drivers/pci/pci.ids
--- v2.3.48/linux/drivers/pci/pci.ids	Sat Feb 26 22:31:47 2000
+++ linux/drivers/pci/pci.ids	Tue Feb 29 14:53:08 2000
@@ -2225,6 +2225,7 @@
 1277  Comstream
 1278  Transtech Parallel Systems Ltd.
 1279  Transmeta Corporation
+	0295  Virtual Northbridge
 127a  Rockwell International
 	1002  HCF 56k V90 FaxModem
 	1003  HCF 56k V90 FaxModem
diff -u --recursive --new-file v2.3.48/linux/drivers/pci/pcisyms.c linux/drivers/pci/pcisyms.c
--- v2.3.48/linux/drivers/pci/pcisyms.c	Wed Feb 16 17:03:52 2000
+++ linux/drivers/pci/pcisyms.c	Wed Dec 31 16:00:00 1969
@@ -1,58 +0,0 @@
-/*
- *	$Id: pcisyms.c,v 1.8 1998/05/12 07:36:04 mj Exp $
- *
- *	PCI Bus Services -- Exported Symbols
- *
- *	Copyright 1998--2000 Martin Mares <mj@suse.cz>
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <asm/dma.h>	/* isa_dma_bridge_buggy */
-
-EXPORT_SYMBOL(pci_read_config_byte);
-EXPORT_SYMBOL(pci_read_config_word);
-EXPORT_SYMBOL(pci_read_config_dword);
-EXPORT_SYMBOL(pci_write_config_byte);
-EXPORT_SYMBOL(pci_write_config_word);
-EXPORT_SYMBOL(pci_write_config_dword);
-EXPORT_SYMBOL(pci_devices);
-EXPORT_SYMBOL(pci_root_buses);
-EXPORT_SYMBOL(pci_enable_device);
-EXPORT_SYMBOL(pci_find_capability);
-EXPORT_SYMBOL(pci_find_class);
-EXPORT_SYMBOL(pci_find_device);
-EXPORT_SYMBOL(pci_find_slot);
-EXPORT_SYMBOL(pci_find_subsys);
-EXPORT_SYMBOL(pci_set_master);
-EXPORT_SYMBOL(pci_set_power_state);
-EXPORT_SYMBOL(pci_assign_resource);
-EXPORT_SYMBOL(pci_register_driver);
-EXPORT_SYMBOL(pci_unregister_driver);
-EXPORT_SYMBOL(pci_match_device);
-EXPORT_SYMBOL(pci_find_parent_resource);
-
-#ifdef CONFIG_HOTPLUG
-EXPORT_SYMBOL(pci_setup_device);
-EXPORT_SYMBOL(pci_insert_device);
-EXPORT_SYMBOL(pci_remove_device);
-#endif
-
-/* Obsolete functions */
-
-EXPORT_SYMBOL(pcibios_present);
-EXPORT_SYMBOL(pcibios_read_config_byte);
-EXPORT_SYMBOL(pcibios_read_config_word);
-EXPORT_SYMBOL(pcibios_read_config_dword);
-EXPORT_SYMBOL(pcibios_write_config_byte);
-EXPORT_SYMBOL(pcibios_write_config_word);
-EXPORT_SYMBOL(pcibios_write_config_dword);
-EXPORT_SYMBOL(pcibios_find_class);
-EXPORT_SYMBOL(pcibios_find_device);
-
-/* Quirk info */
-
-EXPORT_SYMBOL(isa_dma_bridge_buggy);
-EXPORT_SYMBOL(pci_pci_problems);
-
diff -u --recursive --new-file v2.3.48/linux/drivers/pci/quirks.c linux/drivers/pci/quirks.c
--- v2.3.48/linux/drivers/pci/quirks.c	Tue Dec  7 09:32:44 1999
+++ linux/drivers/pci/quirks.c	Tue Feb 29 14:53:08 2000
@@ -113,6 +113,55 @@
 	}
 }
 
+static void __init quirk_io_region(struct pci_dev *dev, unsigned region, unsigned size, int nr)
+{
+	region &= ~(size-1);
+	if (region) {
+		struct resource *res = dev->resource + nr;
+
+		res->name = dev->name;
+		res->start = region;
+		res->end = region + size - 1;
+		res->flags = IORESOURCE_IO;
+		pci_claim_resource(dev, nr);
+	}
+}	
+
+/*
+ * Let's make the southbridge information explicit instead
+ * of having to worry about people probing the ACPI areas,
+ * for example.. (Yes, it happens, and if you read the wrong
+ * ACPI register it will put the machine to sleep with no
+ * way of waking it up again. Bummer).
+ *
+ * ALI M7101: Two IO regions pointed to by words at
+ *	0xE0 (64 bytes of ACPI registers)
+ *	0xE2 (32 bytes of SMB registers)
+ */
+static void __init quirk_ali7101(struct pci_dev *dev)
+{
+	u16 region;
+
+	pci_read_config_word(dev, 0xE0, &region);
+	quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
+	pci_read_config_word(dev, 0xE2, &region);
+	quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
+}
+
+/*
+ * PIIX4 ACPI: Two IO regions pointed to by longwords at
+ *	0x40 (64 bytes of ACPI registers)
+ *	0x90 (32 bytes of SMB registers)
+ */
+static void __init quirk_piix4acpi(struct pci_dev *dev)
+{
+	u32 region;
+
+	pci_read_config_dword(dev, 0x40, &region);
+	quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
+	pci_read_config_dword(dev, 0x90, &region);
+	quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
+}
 
 /*
  *  The main table of quirks.
@@ -143,6 +192,8 @@
 	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_INTEL, 	PCI_DEVICE_ID_INTEL_82443BX_2, 	quirk_natoma },
 	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_SI,	PCI_DEVICE_ID_SI_5597,		quirk_nopcipci },
 	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_SI,	PCI_DEVICE_ID_SI_496,		quirk_nopcipci },
+	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82371AB_3,	quirk_piix4acpi },
+	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_AL,	PCI_DEVICE_ID_AL_M7101,		quirk_ali7101 },
 	{ 0 }
 };
 
diff -u --recursive --new-file v2.3.48/linux/drivers/pcmcia/cardbus.c linux/drivers/pcmcia/cardbus.c
--- v2.3.48/linux/drivers/pcmcia/cardbus.c	Fri Jan 21 18:19:16 2000
+++ linux/drivers/pcmcia/cardbus.c	Wed Mar  1 15:30:07 2000
@@ -186,6 +186,9 @@
 
 	DEBUG(3, "cs: read_cb_mem(%d, %#x, %u)\n", space, addr, len);
 
+	if (!s->cb_config)
+		goto fail;
+
 	dev = &s->cb_config[fn].dev;
 
 	/* Config space? */
diff -u --recursive --new-file v2.3.48/linux/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c
--- v2.3.48/linux/drivers/pcmcia/cs.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/pcmcia/cs.c	Mon Feb 28 07:16:54 2000
@@ -82,14 +82,12 @@
 #else
 #define CB_OPT ""
 #endif
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) || defined(CONFIG_ACPI)
-#define APM_OPT " [apm]"
+#ifdef CONFIG_PM
+#define APM_OPT " [pm]"
 #else
 #define APM_OPT ""
 #endif
-#if !defined(CONFIG_CARDBUS) && !defined(CONFIG_PCI) && \
-    !defined(CONFIG_APM) && !defined(CONFIG_APM_MODULE) && \
-    !defined(CONFIG_ACPI)
+#if !defined(CONFIG_CARDBUS) && !defined(CONFIG_PCI) && !defined(CONFIG_PM)
 #define OPTIONS " none"
 #else
 #define OPTIONS PCI_OPT CB_OPT APM_OPT
@@ -125,7 +123,7 @@
 static int io_speed		= 0;	/* ns */
 
 /* Optional features */
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) || defined(CONFIG_ACPI)
+#ifdef CONFIG_PM
 static int do_apm		= 1;
 MODULE_PARM(do_apm, "i");
 #else
diff -u --recursive --new-file v2.3.48/linux/drivers/pcmcia/rsrc_mgr.c linux/drivers/pcmcia/rsrc_mgr.c
--- v2.3.48/linux/drivers/pcmcia/rsrc_mgr.c	Fri Jan 21 18:19:16 2000
+++ linux/drivers/pcmcia/rsrc_mgr.c	Tue Feb 29 15:28:46 2000
@@ -102,10 +102,11 @@
 /*======================================================================
 
     Linux resource management extensions
-    
+
 ======================================================================*/
 
-#define check_io_region(b,n) (0)
+#define check_io_resource(b,n)	check_resource(&ioport_resource, (b), (n))
+#define check_mem_resource(b,n)	check_resource(&iomem_resource, (b), (n))
 
 /*======================================================================
 
@@ -191,7 +192,7 @@
     b = kmalloc(256, GFP_KERNEL);
     memset(b, 0, 256);
     for (i = base, most = 0; i < base+num; i += 8) {
-	if (check_region(i, 8) || check_io_region(i, 8))
+	if (check_io_resource(i, 8))
 	    continue;
 	hole = inb(i);
 	for (j = 1; j < 8; j++)
@@ -204,7 +205,7 @@
 
     bad = any = 0;
     for (i = base; i < base+num; i += 8) {
-	if (check_region(i, 8) || check_io_region(i, 8))
+	if (check_io_resource(i, 8))
 	    continue;
 	for (j = 0; j < 8; j++)
 	    if (inb(i+j) != most) break;
@@ -255,13 +256,13 @@
     for (i = base; i < base+num; i = j + step) {
 	if (!fail) {	
 	    for (j = i; j < base+num; j += step)
-		if ((check_mem_region(j, step) == 0) && is_valid(j))
+		if ((check_mem_resource(j, step) == 0) && is_valid(j))
 		    break;
 	    fail = ((i == base) && (j == base+num));
 	}
 	if (fail) {
 	    for (j = i; j < base+num; j += 2*step)
-		if ((check_mem_region(j, 2*step) == 0) &&
+		if ((check_mem_resource(j, 2*step) == 0) &&
 		    do_cksum(j) && do_cksum(j+step))
 		    break;
 	}
@@ -375,8 +376,7 @@
 	for (try = (try >= m->base) ? try : try+align;
 	     (try >= m->base) && (try+num <= m->base+m->num);
 	     try += align) {
-	    if ((check_region(try, num) == 0) &&
-		(check_io_region(try, num) == 0)) {
+	    if (check_io_resource(try, num) == 0) {
 		*base = try;
 		request_region(try, num, name);
 		return 0;
@@ -401,7 +401,7 @@
 	    for (try = (try >= m->base) ? try : try+align;
 		 (try >= m->base) && (try+num <= m->base+m->num);
 		 try += align) {
-		if (check_mem_region(try, num) == 0) {
+		if (check_mem_resource(try, num) == 0) {
 		    request_mem_region(try, num, name);
 		    *base = try;
 		    return 0;
diff -u --recursive --new-file v2.3.48/linux/drivers/pcmcia/yenta.c linux/drivers/pcmcia/yenta.c
--- v2.3.48/linux/drivers/pcmcia/yenta.c	Sat Feb 26 22:31:48 2000
+++ linux/drivers/pcmcia/yenta.c	Mon Feb 28 14:06:08 2000
@@ -235,16 +235,18 @@
 	socket->io_irq = state->io_irq;
 	bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR);
 	if (cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) {
+		u8 intr;
 		bridge |= (state->flags & SS_RESET) ? CB_BRIDGE_CRST : 0;
 
 		/* ISA interrupt control? */
+		intr = exca_readb(socket, I365_INTCTL);
+		intr = (intr & ~0xf);
 		if (!socket->cb_irq) {
-			u8 intr = exca_readb(socket, I365_INTCTL);
-			intr = (intr & ~0xf) | state->io_irq;
-			exca_writeb(socket, I365_INTCTL, intr);
+			intr |= state->io_irq;
 			bridge |= CB_BRIDGE_INTR;
 		}
-	} else {
+		exca_writeb(socket, I365_INTCTL, intr);
+	}  else {
 		u8 reg;
 
 		bridge |= CB_BRIDGE_INTR;
diff -u --recursive --new-file v2.3.48/linux/drivers/scsi/pci2000.c linux/drivers/scsi/pci2000.c
--- v2.3.48/linux/drivers/scsi/pci2000.c	Sat Feb 26 22:31:48 2000
+++ linux/drivers/scsi/pci2000.c	Mon Feb 28 07:16:54 2000
@@ -660,7 +660,7 @@
 		padapter = HOSTDATA(pshost);
 
 #if LINUX_VERSION_CODE > LINUXVERSION(2,1,92)
-		padapter->basePort = pdev->base_address[1] & 0xFFFE;
+		padapter->basePort = pci_resource_start (pdev, 1);
 #else
 		pcibios_read_config_word (pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, &padapter->basePort);
 		padapter->basePort &= 0xFFFE;
diff -u --recursive --new-file v2.3.48/linux/drivers/scsi/pci2220i.c linux/drivers/scsi/pci2220i.c
--- v2.3.48/linux/drivers/scsi/pci2220i.c	Sat Feb 26 22:31:48 2000
+++ linux/drivers/scsi/pci2220i.c	Mon Feb 28 07:16:54 2000
@@ -2448,15 +2448,9 @@
 	memset (&DaleSetup, 0, sizeof (DaleSetup));
 	memset (DiskMirror, 0, sizeof (DiskMirror));
 
-#if LINUX_VERSION_CODE > LINUXVERSION(2,1,92)
-	zr = pcidev->base_address[1] & 0xFFFE;
-	zl = pcidev->base_address[2] & 0xFFFE;
-#else
-	pcibios_read_config_word (pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, &zr);
-	zr &= 0xFFFE;
-	pcibios_read_config_word (pci_bus, pci_device_fn, PCI_BASE_ADDRESS_2, &zl);
-	zl &= 0xFFFE;
-#endif
+	zr = pci_resource_start (pcidev, 1);
+	zl = pci_resource_start (pcidev, 2);
+
 	padapter->basePort = zr;
 	padapter->regRemap		= zr + RTR_LOCAL_REMAP;					// 32 bit local space remap
 	padapter->regDesc		= zr + RTR_REGIONS;	  					// 32 bit local region descriptor
diff -u --recursive --new-file v2.3.48/linux/drivers/scsi/scsi_scan.c linux/drivers/scsi/scsi_scan.c
--- v2.3.48/linux/drivers/scsi/scsi_scan.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/scsi/scsi_scan.c	Sun Feb 27 08:56:37 2000
@@ -108,6 +108,7 @@
 	{"YAMAHA", "CDR100", "1.00", BLIST_NOLUN},		/* Locks up if polled for lun != 0 */
 	{"YAMAHA", "CDR102", "1.00", BLIST_NOLUN},		/* Locks up if polled for lun != 0  
 								 * extra reset */
+	{"MITSUMI", "CD-R CR-2201CS", "6119", BLIST_NOLUN},	/* Locks up if polled for lun != 0 */
 	{"RELISYS", "Scorpio", "*", BLIST_NOLUN},		/* responds to all LUN */
 	{"MICROTEK", "ScanMaker II", "5.61", BLIST_NOLUN},	/* responds to all LUN */
 
diff -u --recursive --new-file v2.3.48/linux/drivers/scsi/seagate.c linux/drivers/scsi/seagate.c
--- v2.3.48/linux/drivers/scsi/seagate.c	Fri Jan 21 18:19:17 2000
+++ linux/drivers/scsi/seagate.c	Mon Feb 28 07:16:54 2000
@@ -89,7 +89,7 @@
 #include <linux/string.h>
 #include <linux/proc_fs.h>
 #include <linux/init.h>
-
+#include <linux/delay.h>
 #include <linux/blk.h>
 #include "scsi.h"
 #include "hosts.h"
@@ -99,7 +99,6 @@
 #include <asm/uaccess.h>
 #include "sd.h"
 #include <scsi/scsi_ioctl.h>
-#include <asm/delay.h>
 
 #ifdef DEBUG
 #define DPRINTK( when, msg... ) do { if ( (DEBUG & (when)) == (when) ) printk( msg ); } while (0)
diff -u --recursive --new-file v2.3.48/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
--- v2.3.48/linux/drivers/scsi/st.c	Sun Feb 20 21:12:39 2000
+++ linux/drivers/scsi/st.c	Tue Feb 29 12:11:35 2000
@@ -11,7 +11,7 @@
    Copyright 1992 - 2000 Kai Makisara
    email Kai.Makisara@metla.fi
 
-   Last modified: Sat Feb 19 17:22:34 2000 by makisara@kai.makisara.local
+   Last modified: Tue Feb 29 20:47:03 2000 by makisara@kai.makisara.local
    Some small formal changes - aeb, 950809
 
    Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
@@ -172,21 +172,22 @@
 /* Convert the result to success code */
 static int st_chk_result(Scsi_Request * SRpnt)
 {
-	int dev = TAPE_NR(SRpnt->sr_request.rq_dev);
+	int dev;
 	int result = SRpnt->sr_result;
 	unsigned char *sense = SRpnt->sr_sense_buffer, scode;
 	DEB(const char *stp;)
 
-	if (!result)
+	if (!result) {
+		sense[0] = 0;	/* We don't have sense data if this byte is zero */
 		return 0;
+	}
 
 	if (driver_byte(result) & DRIVER_SENSE)
 		scode = sense[2] & 0x0f;
-	else {
-		sense[0] = 0;	/* We don't have sense data if this byte is zero */
+	else
 		scode = 0;
-	}
 
+	dev = TAPE_NR(SRpnt->sr_request.rq_dev);
         DEB(
         if (debugging) {
                 printk(ST_DEB_MSG "st%d: Error: %x, cmd: %x %x %x %x %x %x Len: %d\n",
@@ -294,7 +295,7 @@
 {
 	unsigned char *bp;
 
-	if (SRpnt == NULL)
+	if (SRpnt == NULL) {
 		SRpnt = scsi_allocate_request(STp->device);
 		if (SRpnt == NULL) {
 			DEBC( printk(KERN_ERR "st%d: Can't get SCSI request.\n",
@@ -305,6 +306,7 @@
 				(STp->buffer)->syscall_result = (-EBUSY);
 			return NULL;
 		}
+	}
 
 	cmd[1] |= (SRpnt->sr_device->lun << 5) & 0xe0;
 	init_MUTEX_LOCKED(&STp->sem);
diff -u --recursive --new-file v2.3.48/linux/drivers/scsi/u14-34f.c linux/drivers/scsi/u14-34f.c
--- v2.3.48/linux/drivers/scsi/u14-34f.c	Thu Feb 10 17:11:13 2000
+++ linux/drivers/scsi/u14-34f.c	Mon Feb 28 07:16:55 2000
@@ -1948,7 +1948,7 @@
    if (sh[j] == NULL) panic("%s: release, invalid Scsi_Host pointer.\n",
                             driver_name);
 
-   if( sh[j]->block != NULL ) {
+   if( sh[j]->unchecked_isa_dma ) {
 	   scsi_deregister_blocked_host(sh[j]);
    }
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sgi/char/graphics_syms.c linux/drivers/sgi/char/graphics_syms.c
--- v2.3.48/linux/drivers/sgi/char/graphics_syms.c	Sat Feb 26 22:31:48 2000
+++ linux/drivers/sgi/char/graphics_syms.c	Mon Feb 28 07:18:20 2000
@@ -8,7 +8,6 @@
  */
 
 #define __NO_VERSION__
-#include <linux/config.h>
 #include <linux/module.h>
 
 /* extern int rrm_command (unsigned int cmd, void *arg);
diff -u --recursive --new-file v2.3.48/linux/drivers/sgi/char/newport.c linux/drivers/sgi/char/newport.c
--- v2.3.48/linux/drivers/sgi/char/newport.c	Sat Feb 26 22:31:48 2000
+++ linux/drivers/sgi/char/newport.c	Mon Feb 28 07:18:20 2000
@@ -12,7 +12,6 @@
 #include <asm/ng1.h>
 #include <asm/uaccess.h>
 #include <video/newport.h>
-#include <linux/config.h>
 #include <linux/module.h>
 
 struct newport_regs *npregs;
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/ac97_codec.c linux/drivers/sound/ac97_codec.c
--- v2.3.48/linux/drivers/sound/ac97_codec.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/ac97_codec.c	Mon Feb 28 07:16:55 2000
@@ -28,7 +28,10 @@
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/errno.h>
 #include <linux/ac97_codec.h>
+#include <asm/uaccess.h>
 
 static int ac97_read_mixer(struct ac97_codec *codec, int oss_channel);
 static void ac97_write_mixer(struct ac97_codec *codec, int oss_channel, 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/ad1816.c linux/drivers/sound/ad1816.c
--- v2.3.48/linux/drivers/sound/ad1816.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/ad1816.c	Mon Feb 28 07:18:20 2000
@@ -53,7 +53,6 @@
 	
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/stddef.h>
 #include "soundmodule.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/audio.c linux/drivers/sound/audio.c
--- v2.3.48/linux/drivers/sound/audio.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/audio.c	Mon Feb 28 07:18:20 2000
@@ -23,7 +23,6 @@
  * Horst von Brand:  Add missing #include <linux/string.h>
  */
 
-#include <linux/config.h>
 #include <linux/stddef.h>
 #include <linux/string.h>
 #include <linux/kmod.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/dmabuf.c linux/drivers/sound/dmabuf.c
--- v2.3.48/linux/drivers/sound/dmabuf.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/dmabuf.c	Mon Feb 28 07:18:20 2000
@@ -21,8 +21,6 @@
  *
  * Rob Riggs		Added persistent DMA buffers (1998/10/17)
  */
- 
-#include <linux/config.h>
 
 #define BE_CONSERVATIVE
 #define SAMPLE_ROUNDUP 0
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/gus_midi.c linux/drivers/sound/gus_midi.c
--- v2.3.48/linux/drivers/sound/gus_midi.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/gus_midi.c	Mon Feb 28 07:18:20 2000
@@ -10,8 +10,6 @@
  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  * for more info.
  */
-#include <linux/config.h>
-
 #include "sound_config.h"
 #include "gus_hw.h"
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/gus_vol.c linux/drivers/sound/gus_vol.c
--- v2.3.48/linux/drivers/sound/gus_vol.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/gus_vol.c	Mon Feb 28 07:18:20 2000
@@ -9,8 +9,6 @@
  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  * for more info.
  */
-#include <linux/config.h>
-
 #include "sound_config.h"
 #include "gus_linearvol.h"
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/ics2101.c linux/drivers/sound/ics2101.c
--- v2.3.48/linux/drivers/sound/ics2101.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/ics2101.c	Mon Feb 28 07:18:20 2000
@@ -13,9 +13,6 @@
 /*
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  */
-#include <linux/config.h>
-
-
 #include "sound_config.h"
 
 #include <linux/ultrasound.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/midi_synth.c linux/drivers/sound/midi_synth.c
--- v2.3.48/linux/drivers/sound/midi_synth.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/midi_synth.c	Mon Feb 28 07:18:20 2000
@@ -14,8 +14,6 @@
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  * Andrew Veliath  : fixed running status in MIDI input state machine
  */
-#include <linux/config.h>
-
 #define USE_SEQ_MACROS
 #define USE_SIMPLE_MACROS
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/midibuf.c linux/drivers/sound/midibuf.c
--- v2.3.48/linux/drivers/sound/midibuf.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/midibuf.c	Mon Feb 28 07:18:20 2000
@@ -13,7 +13,6 @@
 /*
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  */
-#include <linux/config.h>
 #include <linux/stddef.h>
 #include <linux/kmod.h>
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/mpu401.c linux/drivers/sound/mpu401.c
--- v2.3.48/linux/drivers/sound/mpu401.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/mpu401.c	Mon Feb 28 07:18:20 2000
@@ -15,7 +15,6 @@
  * Alan Cox		modularisation, use normal request_irq, use dev_id
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 
 #define USE_SEQ_MACROS
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/opl3sa.c linux/drivers/sound/opl3sa.c
--- v2.3.48/linux/drivers/sound/opl3sa.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/opl3sa.c	Mon Feb 28 07:18:20 2000
@@ -18,7 +18,6 @@
  * 	Check for install of mpu etc is wrong, should check result of the mss stuff
  */
  
-#include <linux/config.h>
 #include <linux/module.h>
 
 #undef  SB_OK
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/pas2_midi.c linux/drivers/sound/pas2_midi.c
--- v2.3.48/linux/drivers/sound/pas2_midi.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/pas2_midi.c	Mon Feb 28 07:18:20 2000
@@ -10,8 +10,6 @@
  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  * for more info.
  */
-#include <linux/config.h>
-
 #include "sound_config.h"
 
 static int      midi_busy = 0, input_opened = 0;
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/pas2_mixer.c linux/drivers/sound/pas2_mixer.c
--- v2.3.48/linux/drivers/sound/pas2_mixer.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/pas2_mixer.c	Mon Feb 28 07:18:20 2000
@@ -15,8 +15,6 @@
 /*
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  */
-#include <linux/config.h>
-
 #include "sound_config.h"
 
 #ifndef DEB
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/pas2_pcm.c linux/drivers/sound/pas2_pcm.c
--- v2.3.48/linux/drivers/sound/pas2_pcm.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/pas2_pcm.c	Mon Feb 28 07:18:20 2000
@@ -14,8 +14,6 @@
  *		     more things module options.
  */
 
-#include <linux/config.h>
-
 #include "sound_config.h"
 
 #ifndef DEB
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sb.h linux/drivers/sound/sb.h
--- v2.3.48/linux/drivers/sound/sb.h	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sb.h	Mon Feb 28 07:18:20 2000
@@ -1,5 +1,3 @@
-#include <linux/config.h>
-
 #define DSP_RESET	(devc->base + 0x6)
 #define DSP_READ	(devc->base + 0xA)
 #define DSP_WRITE	(devc->base + 0xC)
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sb_audio.c linux/drivers/sound/sb_audio.c
--- v2.3.48/linux/drivers/sound/sb_audio.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sb_audio.c	Mon Feb 28 07:18:20 2000
@@ -21,7 +21,6 @@
  *                       the same.
  */
 
-#include <linux/config.h>
 #include "sound_config.h"
 
 #include "sb_mixer.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sb_midi.c linux/drivers/sound/sb_midi.c
--- v2.3.48/linux/drivers/sound/sb_midi.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sb_midi.c	Mon Feb 28 07:18:20 2000
@@ -11,7 +11,6 @@
  * for more info.
  */
 
-#include <linux/config.h>
 #include "sound_config.h"
 
 #include "sb.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sb_mixer.c linux/drivers/sound/sb_mixer.c
--- v2.3.48/linux/drivers/sound/sb_mixer.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sb_mixer.c	Mon Feb 28 07:18:20 2000
@@ -16,7 +16,6 @@
  * Stanislav Voronyi <stas@esc.kharkov.com>	: Support for AWE 3DSE device (Jun 7 1999)
  */
 
-#include <linux/config.h>
 #include "sound_config.h"
 
 #define __SB_MIXER_C__
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sb_mixer.h linux/drivers/sound/sb_mixer.h
--- v2.3.48/linux/drivers/sound/sb_mixer.h	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sb_mixer.h	Mon Feb 28 07:18:20 2000
@@ -23,8 +23,6 @@
  *	Moved static stuff to sb_mixer.c
  *
  */
-#include <linux/config.h>
-
 /*
  * Mixer registers
  * 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sequencer.c linux/drivers/sound/sequencer.c
--- v2.3.48/linux/drivers/sound/sequencer.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sequencer.c	Mon Feb 28 07:18:20 2000
@@ -14,7 +14,6 @@
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  * Alan Cox	   : reformatted and fixed a pair of null pointer bugs
  */
-#include <linux/config.h>
 #include <linux/kmod.h>
 
 #define SEQUENCER_C
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sgalaxy.c linux/drivers/sound/sgalaxy.c
--- v2.3.48/linux/drivers/sound/sgalaxy.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/sgalaxy.c	Mon Feb 28 07:18:20 2000
@@ -18,7 +18,6 @@
  * for more info.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 
 #include "sound_config.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/softoss_rs.c linux/drivers/sound/softoss_rs.c
--- v2.3.48/linux/drivers/sound/softoss_rs.c	Sat Feb 26 22:31:49 2000
+++ linux/drivers/sound/softoss_rs.c	Mon Feb 28 07:18:20 2000
@@ -13,9 +13,6 @@
  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  * for more info.
  */
-#include <linux/config.h>
-
-
 #include "sound_config.h"
 #include "softoss.h"
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sound_timer.c linux/drivers/sound/sound_timer.c
--- v2.3.48/linux/drivers/sound/sound_timer.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/sound/sound_timer.c	Mon Feb 28 07:18:20 2000
@@ -11,7 +11,6 @@
 /*
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  */
-#include <linux/config.h>
 #include <linux/string.h>
 
 
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/sys_timer.c linux/drivers/sound/sys_timer.c
--- v2.3.48/linux/drivers/sound/sys_timer.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/sound/sys_timer.c	Mon Feb 28 07:18:20 2000
@@ -15,9 +15,6 @@
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  * Andrew Veliath  : adapted tmr2ticks from level 1 sequencer (avoid overflow)
  */
-#include <linux/config.h>
-
-
 #include "sound_config.h"
 
 static volatile int opened = 0, tmr_running = 0;
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/uart401.c linux/drivers/sound/uart401.c
--- v2.3.48/linux/drivers/sound/uart401.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/sound/uart401.c	Mon Feb 28 07:18:20 2000
@@ -19,7 +19,6 @@
  *		Untested
  */
  
-#include <linux/config.h>
 #include <linux/module.h>
 
 #include "sound_config.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/uart6850.c linux/drivers/sound/uart6850.c
--- v2.3.48/linux/drivers/sound/uart6850.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/sound/uart6850.c	Mon Feb 28 07:18:20 2000
@@ -16,7 +16,6 @@
  *	Status: Testing required
  *
  */
-#include <linux/config.h>
 #include <linux/module.h>
 
 /* Mon Nov 22 22:38:35 MET 1993 marco@driq.home.usn.nl:
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/v_midi.c linux/drivers/sound/v_midi.c
--- v2.3.48/linux/drivers/sound/v_midi.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/sound/v_midi.c	Mon Feb 28 07:18:20 2000
@@ -18,7 +18,6 @@
  *	Untested
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 
 #include "sound_config.h"
diff -u --recursive --new-file v2.3.48/linux/drivers/sound/vidc.c linux/drivers/sound/vidc.c
--- v2.3.48/linux/drivers/sound/vidc.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/sound/vidc.c	Mon Feb 28 07:18:20 2000
@@ -13,6 +13,7 @@
  * We currently support a mixer device, but it is currently non-functional.
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/Config.in linux/drivers/usb/Config.in
--- v2.3.48/linux/drivers/usb/Config.in	Wed Feb 16 17:03:52 2000
+++ linux/drivers/usb/Config.in	Thu Mar  2 10:10:24 2000
@@ -43,8 +43,10 @@
       bool '    USB Mass Storage verbose debug' CONFIG_USB_STORAGE_DEBUG
    fi
    dep_tristate '  USS720 parport driver' CONFIG_USB_USS720 $CONFIG_USB $CONFIG_PARPORT
-   dep_tristate '  DABUSB driver' CONFIG_USB_DABUSB $CONFIG_USB 
-   dep_tristate '  PLUSB Prolific USB-Network driver' CONFIG_USB_PLUSB $CONFIG_USB 
+   dep_tristate '  DABUSB driver' CONFIG_USB_DABUSB $CONFIG_USB
+   dep_tristate '  PLUSB Prolific USB-Network driver' CONFIG_USB_PLUSB $CONFIG_USB
+   dep_tristate '  USB ADMteks Pegasus based devices support' CONFIG_USB_PEGASUS $CONFIG_USB
+   dep_tristate '  USB Diamond Rio500 support' CONFIG_USB_RIO500 $CONFIG_USB
    
 comment 'USB HID'
    dep_tristate '  USB Human Interface Device (HID) support' CONFIG_USB_HID $CONFIG_USB
@@ -52,7 +54,7 @@
       dep_tristate '  USB HIDBP Keyboard support' CONFIG_USB_KBD $CONFIG_USB
       dep_tristate '  USB HIDBP Mouse support' CONFIG_USB_MOUSE $CONFIG_USB
    fi
-   dep_tristate '  Wacom Graphire tablet support' CONFIG_USB_GRAPHIRE $CONFIG_USB
+   dep_tristate '  Wacom Intuos/Graphire tablet support' CONFIG_USB_WACOM $CONFIG_USB
    dep_tristate '  Logitech WingMan Force joystick support' CONFIG_USB_WMFORCE $CONFIG_USB
    dep_tristate '  Keyboard support' CONFIG_INPUT_KEYBDEV $CONFIG_USB
    dep_tristate '  Mouse support' CONFIG_INPUT_MOUSEDEV $CONFIG_USB
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/Makefile linux/drivers/usb/Makefile
--- v2.3.48/linux/drivers/usb/Makefile	Sun Feb 20 21:12:39 2000
+++ linux/drivers/usb/Makefile	Thu Mar  2 10:10:24 2000
@@ -47,7 +47,7 @@
 obj-$(CONFIG_USB_MOUSE)		+= usbmouse.o input.o
 obj-$(CONFIG_USB_HID)		+= hid.o input.o
 obj-$(CONFIG_USB_KBD)		+= usbkbd.o input.o
-obj-$(CONFIG_USB_GRAPHIRE)	+= graphire.o input.o
+obj-$(CONFIG_USB_WACOM)		+= wacom.o input.o
 obj-$(CONFIG_USB_WMFORCE)	+= wmforce.o input.o
 obj-$(CONFIG_INPUT_KEYBDEV)	+= keybdev.o input.o
 obj-$(CONFIG_INPUT_MOUSEDEV)	+= mousedev.o input.o
@@ -67,6 +67,8 @@
 obj-$(CONFIG_USB_DABUSB)	+= dabusb.o
 obj-$(CONFIG_USB_PLUSB)		+= plusb.o
 obj-$(CONFIG_USB_OV511)		+= ov511.o
+obj-$(CONFIG_USB_PEGASUS)	+= pegasus.o
+obj-$(CONFIG_USB_RIO500)	+= rio500.o
 
 # Extract lists of the multi-part drivers.
 # The 'int-*' lists are the intermediate files used to build the multi's.
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/acm.c linux/drivers/usb/acm.c
--- v2.3.48/linux/drivers/usb/acm.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/acm.c	Mon Feb 28 14:21:15 2000
@@ -193,10 +193,13 @@
 
 			newctrl = le16_to_cpup((__u16 *) data);
 
+#if 0
+			/* Please someone tell me how to do this properly to kill pppd and not kill minicom */
 			if (acm->tty && !acm->clocal && (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
 				dbg("calling hangup");
 				tty_hangup(acm->tty);
 			}
+#endif
 
 			acm->ctrlin = newctrl;
 
@@ -428,6 +431,7 @@
 	struct acm *acm = tty->driver_data;
 	struct termios *termios = tty->termios;
 	struct acm_line newline;
+	int newctrl = acm->ctrlout;
 
 	if (!ACM_READY(acm)) return;
 
@@ -439,20 +443,20 @@
 	newline.databits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
 
 	acm->clocal = termios->c_cflag & CLOCAL;
-
-	if (!memcmp(&acm->line, &newline, sizeof(struct acm_line)))
-		return;
-
-	memcpy(&acm->line, &newline, sizeof(struct acm_line));
-
+	
 	if (!newline.speed) {
-		if (acm->ctrlout) acm_set_control(acm, acm->ctrlout = 0);
-		return;
+		newline.speed = acm->line.speed;
+		newctrl &= ~ACM_CTRL_DTR;
+	} else  newctrl |=  ACM_CTRL_DTR;
+
+	if (newctrl != acm->ctrlout)
+		acm_set_control(acm, acm->ctrlout = newctrl);
+
+	if (memcmp(&acm->line, &newline, sizeof(struct acm_line))) {
+		memcpy(&acm->line, &newline, sizeof(struct acm_line));
+		dbg("set line: %d %d %d %d", newline.speed, newline.stopbits, newline.parity, newline.databits);
+		acm_set_line(acm, &acm->line);
 	}
-
-	acm_set_line(acm, &acm->line);
-
-	dbg("set line: %d %d %d %d", newline.speed, newline.stopbits, newline.parity, newline.databits);
 }
 
 /*
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/graphire.c linux/drivers/usb/graphire.c
--- v2.3.48/linux/drivers/usb/graphire.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/graphire.c	Wed Dec 31 16:00:00 1969
@@ -1,195 +0,0 @@
-/*
- *  graphire.c  Version 0.2
- *
- *  Copyright (c) 2000 Vojtech Pavlik		<vojtech@suse.cz>
- *  Copyright (c) 2000 Andreas Bach Aaen	<abach@stofanet.dk>
- *
- *  USB Wacom Graphire tablet support
- *
- *  Sponsored by SuSE
- *
- *  ChangeLog:
- *      v0.1 (vp)  - Initial release
- *      v0.2 (aba) - Support for all buttons / combinations
- */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
- * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
- */
-
-#include <linux/kernel.h>
-#include <linux/malloc.h>
-#include <linux/input.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include "usb.h"
-
-MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
-
-/*
- * Thanks for the following information to: Andreas Bach Aaen <abach@mail1.stofanet.dk>
- *
- * The input report:
- * 
- * byte 0: report ID (2)
- * byte 1: bit7 	mouse/pen/rubber near
- *         bit5-6	0 - pen, 1 - rubber, 2 - mouse
- * 	   bit4		1 ?
- *         bit3		0 ?
- *         bit2		mouse middle button / pen button2
- *         bit1		mouse right button / pen button1
- *         bit0		mouse left button / pen tip / rubber
- * byte 2: X low bits
- * byte 3: X high bits
- * byte 4: Y low bits
- * byte 5: Y high bits
- * byte 6: pen pressure low bits / mouse wheel
- * byte 7: pen presure high bits / mouse distance
- * 
- * There are also two single-byte feature reports (2 and 3).
- *
- * Resolution:
- * X: 0 - 10206
- * Y: 0 - 7422
- * 
- * (0,0) is upper left corner
- */
-
-#define USB_VENDOR_ID_WACOM		0x056a
-#define USB_DEVICE_ID_WACOM_GRAPHIRE	0x0010
-
-struct graphire {
-	signed char data[8];
-	struct input_dev dev;
-	struct urb irq;
-};
-
-static void graphire_irq(struct urb *urb)
-{
-	struct graphire *graphire = urb->context;
-	unsigned char *data = graphire->data;
-	struct input_dev *dev = &graphire->dev;
-
-	if (urb->status) return;
-
-	if (data[0] != 2)
-		dbg("received unknown report #%d", data[0]);
-
-        if ( data[1] & 0x80 ) {
-	        input_report_abs(dev, ABS_X, data[2] | ((__u32)data[3] << 8));
-	        input_report_abs(dev, ABS_Y, 7422 - (data[4] | ((__u32)data[5] << 8)));
-	}
-
-	switch ((data[1] >> 5) & 3) {
-
-		case 0:	/* Pen */
-			input_report_key(dev, BTN_TOOL_PEN, !!(data[1] & 0x80));
-			input_report_key(dev, BTN_TOUCH, !!(data[1] & 0x01));
-			input_report_key(dev, BTN_STYLUS, !!(data[1] & 0x02));
-			input_report_key(dev, BTN_STYLUS2, !!(data[1] & 0x04));
-			input_report_abs(dev, ABS_PRESSURE, data[6] | ((__u32)data[7] << 8));
-			break;
-
-		case 1: /* Rubber */
-	                input_report_key(dev, BTN_TOOL_RUBBER, !!(data[1] & 0x80));
-			input_report_key(dev, BTN_TOUCH, !!(data[1] & 0x01));
-			input_report_key(dev, BTN_STYLUS, !!(data[1] & 0x02));
-			input_report_key(dev, BTN_STYLUS2, !!(data[1] & 0x04));
-			input_report_abs(dev, ABS_PRESSURE, data[6] | ((__u32)data[7] << 8));
-			break;
-
-		case 2: /* Mouse */
-	                input_report_key(dev, BTN_TOOL_MOUSE, data[7] > 24);
-			input_report_key(dev, BTN_LEFT, !!(data[1] & 0x01));
-			input_report_key(dev, BTN_RIGHT, !!(data[1] & 0x02));
-			input_report_key(dev, BTN_MIDDLE, !!(data[1] & 0x04));
-			input_report_abs(dev, ABS_DISTANCE, data[7]);
-			input_report_rel(dev, REL_WHEEL, (signed char) data[6]);
-			break;
-	}
-}
-
-static void *graphire_probe(struct usb_device *dev, unsigned int ifnum)
-{
-	struct usb_endpoint_descriptor *endpoint;
-	struct graphire *graphire;
-
-	if (dev->descriptor.idVendor != USB_VENDOR_ID_WACOM ||
-	    dev->descriptor.idProduct != USB_DEVICE_ID_WACOM_GRAPHIRE)
-		return NULL;
-
-	endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0;
-
-	if (!(graphire = kmalloc(sizeof(struct graphire), GFP_KERNEL))) return NULL;
-	memset(graphire, 0, sizeof(struct graphire));
-
-	graphire->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
-	graphire->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
-	graphire->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE);
-	graphire->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2);
-	graphire->dev.relbit[0] |= BIT(REL_WHEEL);
-	graphire->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_DISTANCE);
-
-	graphire->dev.absmax[ABS_X] = 10206;
-	graphire->dev.absmax[ABS_Y] = 7422;
-	graphire->dev.absmax[ABS_PRESSURE] = 511;
-	graphire->dev.absmax[ABS_DISTANCE] = 32;
-
-	FILL_INT_URB(&graphire->irq, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress),
-			graphire->data, 8, graphire_irq, graphire, endpoint->bInterval);
-
-	if (usb_submit_urb(&graphire->irq)) {
-		kfree(graphire);
-		return NULL;
-	}
-
-	input_register_device(&graphire->dev);
-
-	printk(KERN_INFO "input%d: Wacom Graphire\n", graphire->dev.number);
-
-	return graphire;
-}
-
-static void graphire_disconnect(struct usb_device *dev, void *ptr)
-{
-	struct graphire *graphire = ptr;
-	usb_unlink_urb(&graphire->irq);
-	input_unregister_device(&graphire->dev);
-	kfree(graphire);
-}
-
-static struct usb_driver graphire_driver = {
-	name:		"graphire",
-	probe:		graphire_probe,
-	disconnect:	graphire_disconnect,
-};
-
-static int __init graphire_init(void)
-{
-	usb_register(&graphire_driver);
-	return 0;
-}
-
-static void __exit graphire_exit(void)
-{
-	usb_deregister(&graphire_driver);
-}
-
-module_init(graphire_init);
-module_exit(graphire_exit);
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/hid.c linux/drivers/usb/hid.c
--- v2.3.48/linux/drivers/usb/hid.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/hid.c	Mon Feb 28 14:21:15 2000
@@ -65,14 +65,15 @@
 	 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106,
 	105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71,
 	 72, 73, 82, 83, 86,127,116,117, 85, 89, 90, 91, 92, 93, 94, 95,
-	120,121,122,123,unk,138,unk,unk,128,129,131,137,133,135,136,113,
+	120,121,122,123,134,138,130,132,128,129,131,137,133,135,136,113,
 	115,114,unk,unk,unk,unk,unk,124,unk,unk,unk,unk,unk,unk,unk,unk,
 	unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
 	unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
 	unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
-	134,130,132,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
 	unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
-	 29, 42, 56,125, 97, 54,100,126
+	unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
+	 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
+	150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk
 };
 
 static struct {
@@ -728,14 +729,16 @@
 
 		case HID_UP_KEYBOARD:
 
+			set_bit(EV_REP, input->evbit);
+			usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX;
+
 			if ((usage->hid & HID_USAGE) < 256) {
 				if (!(usage->code = hid_keyboard[usage->hid & HID_USAGE]))
 					return;
+				clear_bit(usage->code, bit);
 			} else
 				usage->code = KEY_UNKNOWN;
 
-			set_bit(EV_REP, input->evbit);
-			usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX;
 			break; 
 
 		case HID_UP_BUTTON:
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/hid.h linux/drivers/usb/hid.h
--- v2.3.48/linux/drivers/usb/hid.h	Sun Feb 20 21:12:39 2000
+++ linux/drivers/usb/hid.h	Mon Feb 28 14:21:15 2000
@@ -201,7 +201,7 @@
  * This is the local enviroment. It is resistent up the the next main-item.
  */
 
-#define MAX_USAGES 512
+#define MAX_USAGES 1024
 
 struct hid_local {
 	unsigned usage[MAX_USAGES]; /* usage array */
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/ibmcam.c linux/drivers/usb/ibmcam.c
--- v2.3.48/linux/drivers/usb/ibmcam.c	Thu Feb 10 17:11:15 2000
+++ linux/drivers/usb/ibmcam.c	Mon Feb 28 14:21:15 2000
@@ -67,9 +67,7 @@
 static const int min_imgwidth  = 8;
 static const int min_imgheight = 4;
 
-#define	LIGHTING_MIN	0 /* 0=Bright 1=Med 2=Low */
-#define	LIGHTING_MAX	2
-static int lighting = (LIGHTING_MIN + LIGHTING_MAX) / 2; /* Medium */
+static int lighting = 1; /* Medium */
 
 #define SHARPNESS_MIN	0
 #define SHARPNESS_MAX	6
@@ -82,7 +80,9 @@
 enum {
 	VIDEOSIZE_128x96 = 0,
 	VIDEOSIZE_176x144,
-	VIDEOSIZE_352x288
+	VIDEOSIZE_352x288,
+	VIDEOSIZE_320x240,
+	VIDEOSIZE_352x240,
 };
 
 static int videosize = VIDEOSIZE_352x288;
@@ -117,6 +117,12 @@
 static int init_hue = 128;
 static int hue_correction = 128;
 
+/* Settings for camera model 2 */
+static int init_model2_rg = -1;
+static int init_model2_rg2 = -1;
+static int init_model2_sat = -1;
+static int init_model2_yb = -1;
+
 MODULE_PARM(debug, "i");
 MODULE_PARM(flags, "i");
 MODULE_PARM(framerate, "i");
@@ -129,6 +135,11 @@
 MODULE_PARM(init_hue, "i");
 MODULE_PARM(hue_correction, "i");
 
+MODULE_PARM(init_model2_rg, "i");
+MODULE_PARM(init_model2_rg2, "i");
+MODULE_PARM(init_model2_sat, "i");
+MODULE_PARM(init_model2_yb, "i");
+
 MODULE_AUTHOR ("module author");
 MODULE_DESCRIPTION ("IBM/Xirlink C-it USB Camera Driver for Linux (c) 2000");
 
@@ -140,6 +151,15 @@
 static const unsigned short light_27 = 0x0027;
 static const unsigned short sharp_13 = 0x0013;
 
+/* i2c commands for Model 2 cameras */
+static const unsigned short mod2_brightness = 0x001a;		/* $5b .. $ee; default=$5a */
+static const unsigned short mod2_set_framerate = 0x001c;	/* 0 (fast).. $1F (slow) */
+static const unsigned short mod2_color_balance_rg2 = 0x001e;	/* 0 (red) .. $7F (green) */
+static const unsigned short mod2_saturation = 0x0020;		/* 0 (b/w) - $7F (full color) */
+static const unsigned short mod2_color_balance_yb = 0x0022;	/* 0..$7F, $50 is about right */
+static const unsigned short mod2_color_balance_rg = 0x0024;	/* 0..$7F, $70 is about right */
+static const unsigned short mod2_sensitivity = 0x0028;		/* 0 (min) .. $1F (max) */
+
 #define MAX_IBMCAM	4
 
 struct usb_ibmcam cams[MAX_IBMCAM];
@@ -262,6 +282,24 @@
 	vfree(mem);
 }
 
+#if ENABLE_HEXDUMP
+static void ibmcam_hexdump(const unsigned char *data, int len)
+{
+	char tmp[80];
+	int i, k;
+
+	for (i=k=0; len > 0; i++, len--) {
+		if (i > 0 && (i%16 == 0)) {
+			printk("%s\n", tmp);
+			k=0;
+		}
+		k += sprintf(&tmp[k], "%02x ", data[i]);
+	}
+	if (k > 0)
+		printk("%s\n", tmp);
+}
+#endif
+
 /*
  * usb_ibmcam_overlaychar()
  *
@@ -485,7 +523,7 @@
 	usb_ibmcam_overlaystats(ibmcam, frame);
 }
 
-static unsigned char *ibmcam_find_header(const unsigned char hdr_sig, unsigned char *data, int len)
+static unsigned char *ibmcam_model1_find_header(unsigned char hdr_sig, unsigned char *data, int len)
 {
 	while (len >= 4)
 	{
@@ -498,7 +536,7 @@
 			if (data[3] == hdr_sig) {
 				if (debug > 2)
 					printk(KERN_DEBUG "Header found.\n");
-				return data;
+				return data+4;
 			}
 		}
 		++data;
@@ -507,6 +545,38 @@
 	return NULL;
 }
 
+static unsigned char *ibmcam_model2_find_header(unsigned char hdr_sig, unsigned char *data, int len)
+{
+	int marker_len = 0;
+
+	switch (videosize) {
+	case VIDEOSIZE_176x144:
+		marker_len = 10;
+		break;
+	default:
+		marker_len = 2;
+		break;
+	}
+	while (len >= marker_len)
+	{
+		if ((data[0] == 0x00) && (data[1] == 0xFF))
+		{
+#if 0
+			/* This code helps to detect new frame markers */
+			static int pass = 0;
+			if (pass++ == 0)
+				ibmcam_hexdump(data, (len > 16) ? 16 : len);
+#endif
+			if (debug > 2)
+				printk(KERN_DEBUG "Header found.\n");
+			return data+marker_len;
+		}
+		++data;
+		--len;
+	}
+	return NULL;
+}
+
 /* How much data is left in the scratch buf? */
 #define scratch_left(x)	(ibmcam->scratchlen - (int)((char *)x - (char *)ibmcam->scratch))
 
@@ -537,7 +607,13 @@
 
 	data = ibmcam->scratch;
 	frame = &ibmcam->frame[ibmcam->curframe];
-	tmp = ibmcam_find_header(frame->hdr_sig, data, scratch_left(data));
+
+	if (ibmcam->camera_model == IBMCAM_MODEL_1)
+		tmp = ibmcam_model1_find_header(frame->hdr_sig, data, scratch_left(data));
+	else if (ibmcam->camera_model == IBMCAM_MODEL_2)
+		tmp = ibmcam_model2_find_header(frame->hdr_sig, data, scratch_left(data));
+	else
+		tmp = NULL;
 
 	if (tmp == NULL) {
 		/* No header - entire scratch buffer is useless! */
@@ -547,7 +623,7 @@
 		return scan_EndParse;
 	}
 	/* Header found */
-	data = tmp+4;
+	data = tmp;
 
 	ibmcam->has_hdr = 1;
 	ibmcam->header_count++;
@@ -623,6 +699,24 @@
 		return scan_Out;
 	}
 
+#if 0
+	{	/* This code prints beginning of the source frame */
+		static int pass = 0;
+		if ((pass++ % 3000) == 0)
+			ibmcam_hexdump(data, 16);
+	}
+#endif
+
+#if 0
+	if (frame->curline == 10 || frame->curline == 11) {
+		/* This code prints beginning of 10th (mono), 11th (chroma) line */
+		static int pass = 0;
+		if ((pass % 100) == 0)
+			ibmcam_hexdump(data, 16);
+		if (frame->curline == 11)
+			pass++;
+	}
+#endif
 	/*
 	 * Make sure that our writing into output buffer
 	 * will not exceed the buffer. Mind that we may write
@@ -674,7 +768,7 @@
 		 * each byte of multi-byte data element if it is multi-byte.
 		 */
 #if 1
-		if (scratch_left(data) >= (4+2)) {
+		if ((ibmcam->camera_model == IBMCAM_MODEL_1) && (scratch_left(data) >= (4+2))) {
 			unsigned char *dp;
 			int j;
 
@@ -711,18 +805,29 @@
 			goto make_pixel;
 		}
 
-		y = mono_plane ? data[0] : data[1];
+		if (mono_plane || frame->order_yc)
+			y = data[0];
+		else
+			y = data[1];
 
 		if (flags & FLAGS_MONOCHROME) /* Use monochrome for debugging */
 			rv = gv = bv = y;
 		else {
-			if (frame->order_uv) {
-				u = chromaLine[(i >> 1) << 2] + hue_corr;
-				v = chromaLine[((i >> 1) << 2) + 2] + hue2_corr;
-			} else {
-				v = chromaLine[(i >> 1) << 2] + hue2_corr;
-				u = chromaLine[((i >> 1) << 2) + 2] + hue_corr;
+			int off_0, off_2;
+
+			off_0 = (i >> 1) << 2;
+			off_2 = off_0 + 2;
+
+			if (frame->order_yc) {
+				off_0++;
+				off_2++;
 			}
+			if (!frame->order_uv) {
+				off_0 += 2;
+				off_2 -= 2;
+			}
+			u = chromaLine[off_0] + hue_corr;
+			v = chromaLine[off_2] + hue2_corr;
 
 			/* Apply color correction */
 			if (color_corr != 0) {
@@ -778,6 +883,162 @@
 }
 
 /*
+ * usb_ibmcam_model2_parse_lines()
+ *
+ * This procedure deals with a weird RGB format that is produced by IBM
+ * camera model 2 in modes 320x240 and above; 'x' below is 159 or 175,
+ * depending on horizontal size of the picture:
+ *
+ * <--- 160 or 176 pairs of RA,RB bytes ----->
+ * *-----------------------------------------* \
+ * | RA0 | RB0 | RA1 | RB1 | ... | RAx | RBx |  \
+ * |-----+-----+-----+-----+ ... +-----+-----|   *- This is pair of horizontal lines,
+ * | B0  | G0  | B1  | G1  | ... | Bx  | Gx  |  /   total 240 or 288 lines (120 or 144
+ * |=====+=====+=====+=====+ ... +=====+=====| /    such pairs).
+ *
+ * Each group of FOUR bytes (RAi, RBi, Bi, Gi) where i=0..frame_width/2-1
+ * defines ONE pixel. Therefore this format yields 176x144 "decoded"
+ * resolution at best. I do not know why camera sends such format - the
+ * previous model just used I420 and everyone was happy.
+ *
+ * I do not know what is the difference between RAi and RBi bytes. Both
+ * seemingly represent R component, but slightly vary in value (so that
+ * the picture looks a bit colored if one or another is used). I use
+ * them both as R component in attempt to at least partially recover the
+ * lost resolution.
+ */
+static scan_state_t usb_ibmcam_model2_parse_lines(struct usb_ibmcam *ibmcam, long *pcopylen)
+{
+	struct ibmcam_frame *frame;
+	unsigned char *data, *f, *la, *lb;
+	unsigned int len;
+	const int v4l_linesize = imgwidth * V4L_BYTES_PER_PIXEL;	/* V4L line offset */
+	int i, j, frame_done=0, color_corr;
+
+	color_corr = (ibmcam->vpic.colour) >> 8; /* 0..+255 */
+
+	data = ibmcam->scratch;
+	frame = &ibmcam->frame[ibmcam->curframe];
+
+	/* Here we deal with pairs of horizontal lines */
+
+	len = frame->frmwidth * 2; /* 2 lines */
+	/*printk(KERN_DEBUG "len=%d. left=%d.\n",len,scratch_left(data));*/
+
+	/* Make sure there's enough data for the entire line */
+	if (scratch_left(data) < (len+32)) {
+		/*printk(KERN_DEBUG "out of data, need %u.\n", len);*/
+		return scan_Out;
+	}
+
+	/*
+	 * Make sure that our writing into output buffer
+	 * will not exceed the buffer. Mind that we may write
+	 * not into current output scanline but in several after
+	 * it as well (if we enlarge image vertically.)
+	 */
+	if ((frame->curline + 1) >= V4L_FRAME_HEIGHT)
+		return scan_NextFrame;
+
+	if ((frame->curline & 1) == 0) {
+		la = data;
+		lb = data + frame->frmwidth;
+	} else {
+		la = data + frame->frmwidth;
+		lb = data;
+	}
+
+	/*
+	 * Now we are sure that entire line (representing all 'frame->frmwidth'
+	 * pixels from the camera) is available in the scratch buffer. We
+	 * start copying the line left-aligned to the V4L buffer (which
+	 * might be larger - not smaller, hopefully). If the camera
+	 * line is shorter then we should pad the V4L buffer with something
+	 * (black in this case) to complete the line.
+	 */
+	f = frame->data + (v4l_linesize * frame->curline);
+
+	/* Fill the 2-line strip */
+	for (i = 0; i < frame->frmwidth; i++) {
+		int y, rv, gv, bv;	/* RGB components */
+
+		j = i & (~1);
+
+		/* Check for various visual debugging hints (colorized pixels) */
+		if ((flags & FLAGS_DISPLAY_HINTS) && (ibmcam->has_hdr)) {
+			if (ibmcam->has_hdr == 1) {
+				bv = 0; /* Yellow marker */
+				gv = 0xFF;
+				rv = 0xFF;
+			} else {
+				bv = 0xFF; /* Cyan marker */
+				gv = 0xFF;
+				rv = 0;
+			}
+			ibmcam->has_hdr = 0;
+			goto make_pixel;
+		}
+
+		/*
+		 * Here I use RA and RB components, one per physical pixel.
+		 * This causes fine vertical grid on the picture but may improve
+		 * horizontal resolution. If you prefer replicating, use this:
+		 *   rv = la[j + 0];   ... or ... rv = la[j + 1];
+		 * then the pixel will be replicated.
+		 */
+		rv = la[i];
+		gv = lb[j + 1];
+		bv = lb[j + 0];
+
+		y = (rv + gv + bv) / 3; /* Brightness (badly calculated) */
+
+		if (flags & FLAGS_MONOCHROME) /* Use monochrome for debugging */
+			rv = gv = bv = y;
+		else if (color_corr != 128) {
+
+			/* Calculate difference between color and brightness */
+			rv -= y;
+			gv -= y;
+			bv -= y;
+
+			/* Scale differences */
+			rv = (rv * color_corr) / 128;
+			gv = (gv * color_corr) / 128;
+			bv = (bv * color_corr) / 128;
+
+			/* Reapply brightness */
+			rv += y;
+			gv += y;
+			bv += y;
+
+			/* Watch for overflows */
+			RESTRICT_TO_RANGE(rv, 0, 255);
+			RESTRICT_TO_RANGE(gv, 0, 255);
+			RESTRICT_TO_RANGE(bv, 0, 255);
+		}
+
+	make_pixel:
+		IBMCAM_PUTPIXEL(frame, i, frame->curline, rv, gv, bv);
+		IBMCAM_PUTPIXEL(frame, i, frame->curline+1, rv, gv, bv);
+	}
+	/*
+	 * Account for number of bytes that we wrote into output V4L frame.
+	 * We do it here, after we are done with the scanline, because we
+	 * may fill more than one output scanline if we do vertical
+	 * enlargement.
+	 */
+	frame->curline += 2;
+	*pcopylen += v4l_linesize * 2;
+	data += frame->frmwidth * 2;
+	usb_ibmcam_align_scratch(ibmcam, data);
+
+	if (frame_done || (frame->curline >= frame->frmheight))
+		return scan_NextFrame;
+	else
+		return scan_Continue;
+}
+
+/*
  * ibmcam_parse_data()
  *
  * Generic routine to parse the scratch buffer. It employs either
@@ -805,8 +1066,15 @@
 		if (scratch_left(data)) {
 			if (frame->scanstate == STATE_SCANNING)
 				newstate = usb_ibmcam_find_header(ibmcam);
-			else if (frame->scanstate == STATE_LINES)
-				newstate = usb_ibmcam_parse_lines(ibmcam, &copylen);
+			else if (frame->scanstate == STATE_LINES) {
+				if ((ibmcam->camera_model == IBMCAM_MODEL_2) &&
+				    (videosize >= VIDEOSIZE_352x288)) {
+					newstate = usb_ibmcam_model2_parse_lines(ibmcam, &copylen);
+				}
+				else {
+					newstate = usb_ibmcam_parse_lines(ibmcam, &copylen);
+				}
+			}
 		}
 		if (newstate == scan_Continue)
 			continue;
@@ -834,24 +1102,6 @@
 	frame->scanlength += copylen;
 }
 
-#if ENABLE_HEXDUMP
-static void ibmcam_hexdump(const unsigned char *data, int len)
-{
-	char tmp[80];
-	int i, k;
-
-	for (i=k=0; len > 0; i++, len--) {
-		if (i > 0 && (i%16 == 0)) {
-			printk("%s\n", tmp);
-			k=0;
-		}
-		k += sprintf(&tmp[k], "%02x ", data[i]);
-	}
-	if (k > 0)
-		printk("%s\n", tmp);
-}
-#endif
-
 /*
  * Make all of the blocks of data contiguous
  */
@@ -1177,6 +1427,24 @@
 	usb_ibmcam_send_x_00_05_02	(ibmcam, val);
 }
 
+static void usb_ibmcam_model2_Packet2(struct usb_ibmcam *ibmcam)
+{
+	usb_ibmcam_veio(ibmcam, 0, 0x00ff, 0x012d);
+	usb_ibmcam_veio(ibmcam, 0, 0xfea3, 0x0124);
+}
+
+static void usb_ibmcam_model2_Packet1(struct usb_ibmcam *ibmcam, unsigned short v1, unsigned short v2)
+{
+	usb_ibmcam_veio(ibmcam, 0, 0x00aa, 0x012d);
+	usb_ibmcam_veio(ibmcam, 0, 0x00ff, 0x012e);
+	usb_ibmcam_veio(ibmcam, 0, v1, 	   0x012f);
+	usb_ibmcam_veio(ibmcam, 0, 0x00ff, 0x0130);
+	usb_ibmcam_veio(ibmcam, 0, 0xc719, 0x0124);
+	usb_ibmcam_veio(ibmcam, 0, v2,     0x0127);
+
+	usb_ibmcam_model2_Packet2(ibmcam);
+}
+
 /*
  * usb_ibmcam_adjust_contrast()
  *
@@ -1198,11 +1466,15 @@
 		new_contrast = 15;
 	new_contrast = 15 - new_contrast;
 	if (new_contrast != ibmcam->vpic_old.contrast) {
-		int i;
 		ibmcam->vpic_old.contrast = new_contrast;
-		for (i=0; i < ntries; i++) {
-			usb_ibmcam_Packet_Format1(ibmcam, contrast_14, new_contrast);
-			usb_ibmcam_send_FF_04_02(ibmcam);
+		if (ibmcam->camera_model == IBMCAM_MODEL_1) {
+			int i;
+			for (i=0; i < ntries; i++) {
+				usb_ibmcam_Packet_Format1(ibmcam, contrast_14, new_contrast);
+				usb_ibmcam_send_FF_04_02(ibmcam);
+			}
+		} else {
+			/* Camera model 2 does not have this control; implemented in software. */
 		}
 	}
 }
@@ -1210,44 +1482,86 @@
 /*
  * usb_ibmcam_change_lighting_conditions()
  *
+ * Camera model 1:
  * We have 3 levels of lighting conditions: 0=Bright, 1=Medium, 2=Low.
+ *
+ * Camera model 2:
+ * We have 16 levels of lighting, 0 for bright light and up to 15 for
+ * low light. But values above 5 or so are useless because camera is
+ * not really capable to produce anything worth viewing at such light.
+ * This setting may be altered only in certain camera state.
+ *
  * Low lighting forces slower FPS. Lighting is set as a module parameter.
  *
  * History:
  * 1/5/00   Created.
+ * 2/20/00  Added support for Model 2 cameras.
  */
 static void usb_ibmcam_change_lighting_conditions(struct usb_ibmcam *ibmcam)
 {
 	static const char proc[] = "usb_ibmcam_change_lighting_conditions";
-	const int ntries = 5;
-	int i;
 
-	RESTRICT_TO_RANGE(lighting, LIGHTING_MIN, LIGHTING_MAX);
 	if (debug > 0)
 		printk(KERN_INFO "%s: Set lighting to %hu.\n", proc, lighting);
 
-	for (i=0; i < ntries; i++)
-		usb_ibmcam_Packet_Format1(ibmcam, light_27, (unsigned short) lighting);
+	if (ibmcam->camera_model == IBMCAM_MODEL_1) {
+		const int ntries = 5;
+		int i;
+		for (i=0; i < ntries; i++)
+			usb_ibmcam_Packet_Format1(ibmcam, light_27, (unsigned short) lighting);
+	} else {
+		/*
+		 * This command apparently requires camera to be stopped. My
+		 * experiments showed that it -is- possible to alter the lighting
+		 * conditions setting "on the fly", but why bother? This setting does
+		 * not work reliably in all cases, so I decided simply to leave the
+		 * setting where Xirlink put it - in the camera setup phase. This code
+		 * is commented out because it does not work at -any- moment, so its
+		 * presence makes no sense. You may use it for experiments.
+		 */
+#if 0
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x010c);	/* Stop camera */
+		usb_ibmcam_model2_Packet1(ibmcam, mod2_sensitivity, lighting);
+		usb_ibmcam_veio(ibmcam, 0, 0x00c0, 0x010c);	/* Start camera */
+#endif
+	}
 }
 
+/*
+ * usb_ibmcam_set_sharpness()
+ *
+ * Cameras model 1 have internal smoothing feature. It is controlled by value in
+ * range [0..6], where 0 is most smooth and 6 is most sharp (raw image, I guess).
+ * Recommended value is 4. Cameras model 2 do not have this feature at all.
+ */
 static void usb_ibmcam_set_sharpness(struct usb_ibmcam *ibmcam)
 {
 	static const char proc[] = "usb_ibmcam_set_sharpness";
-	static const unsigned short sa[] = { 0x11, 0x13, 0x16, 0x18, 0x1a, 0x8, 0x0a };
-	unsigned short i, sv;
 
-	RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX);
-	if (debug > 0)
-		printk(KERN_INFO "%s: Set sharpness to %hu.\n", proc, sharpness);
-
-	sv = sa[sharpness - SHARPNESS_MIN];
-	for (i=0; i < 2; i++) {
-		usb_ibmcam_send_x_01_00_05	(ibmcam, unknown_88);
-		usb_ibmcam_send_x_00_05		(ibmcam, sharp_13);
-		usb_ibmcam_send_x_00_05_02	(ibmcam, sv);
+	if (ibmcam->camera_model == IBMCAM_MODEL_1) {
+		static const unsigned short sa[] = { 0x11, 0x13, 0x16, 0x18, 0x1a, 0x8, 0x0a };
+		unsigned short i, sv;
+
+		RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX);
+		if (debug > 0)
+			printk(KERN_INFO "%s: Set sharpness to %hu.\n", proc, sharpness);
+
+		sv = sa[sharpness - SHARPNESS_MIN];
+		for (i=0; i < 2; i++) {
+			usb_ibmcam_send_x_01_00_05	(ibmcam, unknown_88);
+			usb_ibmcam_send_x_00_05		(ibmcam, sharp_13);
+			usb_ibmcam_send_x_00_05_02	(ibmcam, sv);
+		}
+	} else {
+		/* Camera model 2 does not have this control */
 	}
 }
 
+/*
+ * usb_ibmcam_set_brightness()
+ *
+ * This procedure changes brightness of the picture.
+ */
 static void usb_ibmcam_set_brightness(struct usb_ibmcam *ibmcam)
 {
 	static const char proc[] = "usb_ibmcam_set_brightness";
@@ -1263,18 +1577,41 @@
 		printk(KERN_INFO "%s: Set brightness to (%hu,%hu,%hu)\n",
 		       proc, bv[0], bv[1], bv[2]);
 
-	for (j=0; j < 3; j++)
-		for (i=0; i < n; i++)
-			usb_ibmcam_Packet_Format1(ibmcam, bright_3x[j], bv[j]);
+	if (ibmcam->camera_model == IBMCAM_MODEL_1) {
+		for (j=0; j < 3; j++)
+			for (i=0; i < n; i++)
+				usb_ibmcam_Packet_Format1(ibmcam, bright_3x[j], bv[j]);
+	} else {
+		i = ibmcam->vpic.brightness >> 12;	/* 0 .. 15 */
+		j = 0x60 + i * ((0xee - 0x60) / 16);	/* 0x60 .. 0xee or so */
+		usb_ibmcam_model2_Packet1(ibmcam, mod2_brightness, j);
+	}
+}
+
+static void usb_ibmcam_model2_set_hue(struct usb_ibmcam *ibmcam)
+{
+	unsigned short hue = ibmcam->vpic.hue >> 9; /* 0 .. 7F */
+
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_color_balance_rg, hue);
+	/* usb_ibmcam_model2_Packet1(ibmcam, mod2_saturation, sat); */
 }
 
+/*
+ * usb_ibmcam_adjust_picture()
+ *
+ * This procedure gets called from V4L interface to update picture settings.
+ * Here we change brightness and contrast.
+ */
 static void usb_ibmcam_adjust_picture(struct usb_ibmcam *ibmcam)
 {
 	usb_ibmcam_adjust_contrast(ibmcam);
 	usb_ibmcam_set_brightness(ibmcam);
+	if (ibmcam->camera_model == IBMCAM_MODEL_2) {
+		usb_ibmcam_model2_set_hue(ibmcam);
+	}
 }
 
-static int usb_ibmcam_setup(struct usb_ibmcam *ibmcam)
+static int usb_ibmcam_model1_setup(struct usb_ibmcam *ibmcam)
 {
 	const int ntries = 5;
 	int i;
@@ -1283,7 +1620,7 @@
 	usb_ibmcam_veio(ibmcam, 1, 0x00, 0x0100);
 	usb_ibmcam_veio(ibmcam, 0, 0x01, 0x0100);	/* LED On  */
 	usb_ibmcam_veio(ibmcam, 1, 0x00, 0x0100);
-	usb_ibmcam_veio(ibmcam, 0, 0x81, 0x0100);  /* LED Off */
+	usb_ibmcam_veio(ibmcam, 0, 0x81, 0x0100);	/* LED Off */
 	usb_ibmcam_veio(ibmcam, 1, 0x00, 0x0100);
 	usb_ibmcam_veio(ibmcam, 0, 0x01, 0x0100);	/* LED On  */
 	usb_ibmcam_veio(ibmcam, 0, 0x01, 0x0108);
@@ -1468,16 +1805,68 @@
 		usb_ibmcam_veio(ibmcam, 0, 0xf6, 0x0107);
 		break;
 	}
-	return 0; /* TODO: return actual completion status! */
+	return IBMCAM_IS_OPERATIONAL(ibmcam);
+}
+
+static int usb_ibmcam_model2_setup(struct usb_ibmcam *ibmcam)
+{
+	usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0100);	/* LED on */
+	usb_ibmcam_veio(ibmcam, 1, 0x0000, 0x0116);
+	usb_ibmcam_veio(ibmcam, 0, 0x0060, 0x0116);
+	usb_ibmcam_veio(ibmcam, 0, 0x0002, 0x0112);
+	usb_ibmcam_veio(ibmcam, 0, 0x00bc, 0x012c);
+	usb_ibmcam_veio(ibmcam, 0, 0x0008, 0x012b);
+	usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0108);
+	usb_ibmcam_veio(ibmcam, 0, 0x0001, 0x0133);
+	usb_ibmcam_veio(ibmcam, 0, 0x0001, 0x0102);
+	switch (videosize) {
+	case VIDEOSIZE_176x144:
+		usb_ibmcam_veio(ibmcam, 0, 0x002c, 0x0103);	/* All except 320x240 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0104);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x0024, 0x0105);	/* 176x144, 352x288 */
+		usb_ibmcam_veio(ibmcam, 0, 0x00b9, 0x010a);	/* Unique to this mode */
+		usb_ibmcam_veio(ibmcam, 0, 0x0038, 0x0119);	/* Unique to this mode */
+		usb_ibmcam_veio(ibmcam, 0, 0x0003, 0x0106);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x0090, 0x0107);	/* Unique to every mode*/
+		break;
+	case VIDEOSIZE_320x240:
+		usb_ibmcam_veio(ibmcam, 0, 0x0028, 0x0103);	/* Unique to this mode */
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0104);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x001e, 0x0105);	/* 320x240, 352x240 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0039, 0x010a);	/* All except 176x144 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0070, 0x0119);	/* All except 176x144 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0003, 0x0106);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x0098, 0x0107);	/* Unique to every mode*/
+		break;
+	case VIDEOSIZE_352x240:
+		usb_ibmcam_veio(ibmcam, 0, 0x002c, 0x0103);	/* All except 320x240 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0104);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x001e, 0x0105);	/* 320x240, 352x240 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0039, 0x010a);	/* All except 176x144 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0070, 0x0119);	/* All except 176x144 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0003, 0x0106);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x00da, 0x0107);	/* Unique to every mode*/
+		break;
+	case VIDEOSIZE_352x288:
+		usb_ibmcam_veio(ibmcam, 0, 0x002c, 0x0103);	/* All except 320x240 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0104);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x0024, 0x0105);	/* 176x144, 352x288 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0039, 0x010a);	/* All except 176x144 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0070, 0x0119);	/* All except 176x144 */
+		usb_ibmcam_veio(ibmcam, 0, 0x0003, 0x0106);	/* Same */
+		usb_ibmcam_veio(ibmcam, 0, 0x00fe, 0x0107);	/* Unique to every mode*/
+		break;
+	}
+	return IBMCAM_IS_OPERATIONAL(ibmcam);
 }
 
 /*
- * usb_ibmcam_setup_after_video_if()
+ * usb_ibmcam_model1_setup_after_video_if()
  *
  * This code adds finishing touches to the video data interface.
  * Here we configure the frame rate and turn on the LED.
  */
-static void usb_ibmcam_setup_after_video_if(struct usb_ibmcam *ibmcam)
+static void usb_ibmcam_model1_setup_after_video_if(struct usb_ibmcam *ibmcam)
 {
 	unsigned short internal_frame_rate;
 
@@ -1489,6 +1878,188 @@
 	usb_ibmcam_veio(ibmcam, 0, 0xc0, 0x010c);
 }
 
+static void usb_ibmcam_model2_setup_after_video_if(struct usb_ibmcam *ibmcam)
+{
+	unsigned short setup_model2_rg, setup_model2_rg2, setup_model2_sat, setup_model2_yb;
+
+	usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0100);	/* LED on */
+
+	switch (videosize) {
+	case VIDEOSIZE_176x144:
+		usb_ibmcam_veio(ibmcam, 0, 0x0050, 0x0111);
+		usb_ibmcam_veio(ibmcam, 0, 0x00d0, 0x0111);
+		break;
+	case VIDEOSIZE_320x240:
+	case VIDEOSIZE_352x240:
+	case VIDEOSIZE_352x288:
+		usb_ibmcam_veio(ibmcam, 0, 0x0040, 0x0111);
+		usb_ibmcam_veio(ibmcam, 0, 0x00c0, 0x0111);
+		break;
+	}
+	usb_ibmcam_veio(ibmcam, 0, 0x009b, 0x010f);
+	usb_ibmcam_veio(ibmcam, 0, 0x00bb, 0x010f);
+
+	/*
+	 * Hardware settings, may affect CMOS sensor; not user controls!
+	 * -------------------------------------------------------------
+	 * 0x0004: no effect
+	 * 0x0006: hardware effect
+	 * 0x0008: no effect
+	 * 0x000a: stops video stream, probably important h/w setting
+	 * 0x000c: changes color in hardware manner (not user setting)
+	 * 0x0012: changes number of colors (does not affect speed)
+	 * 0x002a: no effect
+	 * 0x002c: hardware setting (related to scan lines)
+	 * 0x002e: stops video stream, probably important h/w setting
+	 */
+	usb_ibmcam_model2_Packet1(ibmcam, 0x000a, 0x005c);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x0004, 0x0000);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x0006, 0x00fb);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x0008, 0x0000);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x000c, 0x0009);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x0012, 0x000a);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x002a, 0x0000);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x002c, 0x0000);
+	usb_ibmcam_model2_Packet1(ibmcam, 0x002e, 0x0008);
+
+	/*
+	 * Function 0x0030 pops up all over the place. Apparently
+	 * it is a hardware control register, with every bit assigned to
+	 * do something.
+	 */
+	usb_ibmcam_model2_Packet1(ibmcam, 0x0030, 0x0000);
+
+	/*
+	 * Magic control of CMOS sensor. Only lower values like
+	 * 0-3 work, and picture shifts left or right. Don't change.
+	 */
+	switch (videosize) {
+	case VIDEOSIZE_176x144:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0014, 0x0002);
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0016, 0x0002); /* Horizontal shift */
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0018, 0x004a); /* Another hardware setting */
+		break;
+	case VIDEOSIZE_320x240:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0014, 0x0009);
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0016, 0x0005); /* Horizontal shift */
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0018, 0x0044); /* Another hardware setting */
+		break;
+	case VIDEOSIZE_352x240:
+		/* This mode doesn't work as Windows programs it; changed to work */
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0014, 0x0009); /* Windows sets this to 8 */
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0016, 0x0003); /* Horizontal shift */
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0018, 0x0044); /* Windows sets this to 0x0045 */
+		break;
+	case VIDEOSIZE_352x288:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0014, 0x0003);
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0016, 0x0002); /* Horizontal shift */
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0018, 0x004a); /* Another hardware setting */
+		break;
+	}
+
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_brightness, 0x005a);
+
+	/*
+	 * We have our own frame rate setting varying from 0 (slowest) to 6 (fastest).
+	 * The camera model 2 allows frame rate in range [0..0x1F] where 0 is also the
+	 * slowest setting. However for all practical reasons high settings make no
+	 * sense because USB is not fast enough to support high FPS. Be aware that
+	 * the picture datastream will be severely disrupted if you ask for
+	 * frame rate faster than allowed for the video size - see below:
+	 *
+	 * Allowable ranges (obtained experimentally on OHCI, K6-3, 450 MHz):
+	 * -----------------------------------------------------------------
+	 * 176x144: [6..31]
+	 * 320x240: [8..31]
+	 * 352x240: [10..31]
+	 * 352x288: [16..31] I have to raise lower threshold for stability...
+	 *
+	 * As usual, slower FPS provides better sensitivity.
+	 */
+	{
+		short hw_fps=31, i_framerate;
+
+		RESTRICT_TO_RANGE(framerate, FRAMERATE_MIN, FRAMERATE_MAX);
+		i_framerate = FRAMERATE_MAX - framerate + FRAMERATE_MIN;
+		switch (videosize) {
+		case VIDEOSIZE_176x144:
+			hw_fps = 6 + i_framerate*4;
+			break;
+		case VIDEOSIZE_320x240:
+			hw_fps = 8 + i_framerate*3;
+			break;
+		case VIDEOSIZE_352x240:
+			hw_fps = 10 + i_framerate*2;
+			break;
+		case VIDEOSIZE_352x288:
+			hw_fps = 28 + i_framerate/2;
+			break;
+		}
+		if (debug > 0)
+			printk(KERN_DEBUG "Framerate (hardware): %hd.\n", hw_fps);
+		RESTRICT_TO_RANGE(hw_fps, 0, 31);
+		usb_ibmcam_model2_Packet1(ibmcam, mod2_set_framerate, hw_fps);
+	}
+
+	/*
+	 * This setting does not visibly affect pictures; left it here
+	 * because it was present in Windows USB data stream. This function
+	 * does not allow arbitrary values and apparently is a bit mask, to
+	 * be activated only at appropriate time. Don't change it randomly!
+	 */
+	switch (videosize) {
+	case VIDEOSIZE_176x144:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0026, 0x00c2);
+		break;
+	case VIDEOSIZE_320x240:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0026, 0x0044);
+		break;
+	case VIDEOSIZE_352x240:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0026, 0x0046);
+		break;
+	case VIDEOSIZE_352x288:
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0026, 0x0048);
+		break;
+	}
+
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_sensitivity, lighting);
+
+	if (init_model2_rg >= 0) {
+		RESTRICT_TO_RANGE(init_model2_rg, 0, 255);
+		setup_model2_rg = init_model2_rg;
+	} else
+		setup_model2_rg = 0x0070;
+
+	if (init_model2_rg2 >= 0) {
+		RESTRICT_TO_RANGE(init_model2_rg2, 0, 255);
+		setup_model2_rg2 = init_model2_rg2;
+	} else
+		setup_model2_rg2 = 0x002f;
+
+	if (init_model2_sat >= 0) {
+		RESTRICT_TO_RANGE(init_model2_sat, 0, 255);
+		setup_model2_sat = init_model2_sat;
+	} else
+		setup_model2_sat = 0x0034;
+
+	if (init_model2_yb >= 0) {
+		RESTRICT_TO_RANGE(init_model2_yb, 0, 255);
+		setup_model2_yb = init_model2_yb;
+	} else
+		setup_model2_yb = 0x00a0;
+
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_color_balance_rg2, setup_model2_rg2);
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_saturation, setup_model2_sat);
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_color_balance_yb, setup_model2_yb);
+	usb_ibmcam_model2_Packet1(ibmcam, mod2_color_balance_rg, setup_model2_rg);
+
+	/* Hardware control command */
+	usb_ibmcam_model2_Packet1(ibmcam, 0x0030, 0x0004);
+
+	usb_ibmcam_veio(ibmcam, 0, 0x00c0, 0x010c);	/* Go camera, go! */
+	usb_clear_halt(ibmcam->dev, ibmcam->video_endp);
+}
+
 /*
  * usb_ibmcam_setup_video_stop()
  *
@@ -1497,14 +2068,29 @@
  */
 static void usb_ibmcam_setup_video_stop(struct usb_ibmcam *ibmcam)
 {
-	usb_ibmcam_veio(ibmcam, 0, 0x00, 0x010c);
-	usb_ibmcam_veio(ibmcam, 0, 0x00, 0x010c);
-	usb_ibmcam_veio(ibmcam, 0, 0x01, 0x0114);
-	usb_ibmcam_veio(ibmcam, 0, 0xc0, 0x010c);
-	usb_ibmcam_veio(ibmcam, 0, 0x00, 0x010c);
-	usb_ibmcam_send_FF_04_02(ibmcam);
-	usb_ibmcam_veio(ibmcam, 1, 0x00, 0x0100);
-	usb_ibmcam_veio(ibmcam, 0, 0x81, 0x0100);	/* LED Off */
+	if (ibmcam->camera_model == IBMCAM_MODEL_1) {
+		usb_ibmcam_veio(ibmcam, 0, 0x00, 0x010c);
+		usb_ibmcam_veio(ibmcam, 0, 0x00, 0x010c);
+		usb_ibmcam_veio(ibmcam, 0, 0x01, 0x0114);
+		usb_ibmcam_veio(ibmcam, 0, 0xc0, 0x010c);
+		usb_ibmcam_veio(ibmcam, 0, 0x00, 0x010c);
+		usb_ibmcam_send_FF_04_02(ibmcam);
+		usb_ibmcam_veio(ibmcam, 1, 0x00, 0x0100);
+		usb_ibmcam_veio(ibmcam, 0, 0x81, 0x0100);	/* LED Off */
+	} else if (ibmcam->camera_model == IBMCAM_MODEL_2) {
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x010c);	/* Stop the camera */
+
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0030, 0x0004);
+
+		usb_ibmcam_veio(ibmcam, 0, 0x0080, 0x0100);	/* LED Off */
+		usb_ibmcam_veio(ibmcam, 0, 0x0020, 0x0111);
+		usb_ibmcam_veio(ibmcam, 0, 0x00a0, 0x0111);
+
+		usb_ibmcam_model2_Packet1(ibmcam, 0x0030, 0x0002);
+
+		usb_ibmcam_veio(ibmcam, 0, 0x0020, 0x0111);
+		usb_ibmcam_veio(ibmcam, 0, 0x0000, 0x0112);
+	}
 }
 
 /*
@@ -1519,13 +2105,16 @@
  */
 static void usb_ibmcam_reinit_iso(struct usb_ibmcam *ibmcam, int do_stop)
 {
-	if (do_stop)
-		usb_ibmcam_setup_video_stop(ibmcam);
-
-	usb_ibmcam_veio(ibmcam, 0, 0x0001, 0x0114);
-	usb_ibmcam_veio(ibmcam, 0, 0x00c0, 0x010c);
-	usb_clear_halt(ibmcam->dev, ibmcam->video_endp);
-	usb_ibmcam_setup_after_video_if(ibmcam);
+	if (ibmcam->camera_model == IBMCAM_MODEL_1) {
+		if (do_stop)
+			usb_ibmcam_setup_video_stop(ibmcam);
+		usb_ibmcam_veio(ibmcam, 0, 0x0001, 0x0114);
+		usb_ibmcam_veio(ibmcam, 0, 0x00c0, 0x010c);
+		usb_clear_halt(ibmcam->dev, ibmcam->video_endp);
+		usb_ibmcam_model1_setup_after_video_if(ibmcam);
+	} else if (ibmcam->camera_model == IBMCAM_MODEL_2) {
+		usb_ibmcam_model2_setup_after_video_if(ibmcam);
+	}
 }
 
 /*
@@ -1602,7 +2191,7 @@
 	}
 
 	ibmcam->streaming = 1;
-	// printk(KERN_DEBUG "streaming=1 ibmcam->video_endp=$%02x\n", ibmcam->video_endp);
+	/* printk(KERN_DEBUG "streaming=1 ibmcam->video_endp=$%02x\n", ibmcam->video_endp); */
 	return 0;
 }
 
@@ -1686,6 +2275,14 @@
 		frame->order_uv = 1;	/* U Y V Y ... */
 		frame->hdr_sig = 0x0E;	/* 00 FF 00 0E */
 		break;
+	case VIDEOSIZE_320x240:		/* For model 2 only */
+		frame->frmwidth = 320;
+		frame->frmheight = 240;
+		break;
+	case VIDEOSIZE_352x240:		/* For model 2 only */
+		frame->frmwidth = 352;
+		frame->frmheight = 240;
+		break;
 	case VIDEOSIZE_352x288:
 		frame->frmwidth = 352;
 		frame->frmheight = 288;
@@ -1693,6 +2290,7 @@
 		frame->hdr_sig = 0x00;	/* 00 FF 00 00 */
 		break;
 	}
+	frame->order_yc = (ibmcam->camera_model == IBMCAM_MODEL_2);
 
 	width = frame->width;
 	RESTRICT_TO_RANGE(width, min_imgwidth, imgwidth);
@@ -1786,9 +2384,15 @@
 		if (!err) {
 			/* Send init sequence only once, it's large! */
 			if (!ibmcam->initialized) {
-				err = usb_ibmcam_setup(ibmcam);
-				if (!err)
+				int setup_ok = 0;
+				if (ibmcam->camera_model == IBMCAM_MODEL_1)
+					setup_ok = usb_ibmcam_model1_setup(ibmcam);
+				else if (ibmcam->camera_model == IBMCAM_MODEL_2)
+					setup_ok = usb_ibmcam_model2_setup(ibmcam);
+				if (setup_ok)
 					ibmcam->initialized = 1;
+				else
+					err = -EBUSY;
 			}
 			if (!err) {
 				ibmcam->user++;
@@ -2239,7 +2843,7 @@
 
 	memset(&ibmcam->vcap, 0, sizeof(ibmcam->vcap));
 	strcpy(ibmcam->vcap.name, "IBM USB Camera");
-	ibmcam->vcap.type = VID_TYPE_CAPTURE /*| VID_TYPE_SUBCAPTURE*/;
+	ibmcam->vcap.type = VID_TYPE_CAPTURE;
 	ibmcam->vcap.channels = 1;
 	ibmcam->vcap.audios = 0;
 	ibmcam->vcap.maxwidth = imgwidth;
@@ -2267,11 +2871,20 @@
  */
 static int ibmcam_find_struct(void)
 {
-	int u;
+	int i, u;
 
 	for (u = 0; u < MAX_IBMCAM; u++) {
-		if (!cams[u].ibmcam_used) /* This one is free */
+		struct usb_ibmcam *ibmcam = &cams[u];
+		if (!ibmcam->ibmcam_used) /* This one is free */
+		{
+			ibmcam->ibmcam_used = 1;	/* In use now */
+			for (i=0; i < IBMCAM_NUMFRAMES; i++)
+				init_waitqueue_head(&ibmcam->frame[i].wq);
+			init_MUTEX(&ibmcam->lock);	/* to 1 == available */
+			ibmcam->dev = NULL;
+			memcpy(&ibmcam->vdev, &ibmcam_template, sizeof(ibmcam_template));
 			return u;
+		}
 	}
 	return -1;
 }
@@ -2289,8 +2902,10 @@
 static void *usb_ibmcam_probe(struct usb_device *dev, unsigned int ifnum)
 {
 	struct usb_ibmcam *ibmcam = NULL;
-	struct usb_interface_descriptor *interface;
-	int devnum;
+	const unsigned char *p_rev;
+	const struct usb_interface_descriptor *interface;
+	const struct usb_endpoint_descriptor *endpoint;
+	int devnum, model=0;
 
 	if (debug >= 1)
 		printk(KERN_DEBUG "ibmcam_probe(%p,%u.)\n", dev, ifnum);
@@ -2304,14 +2919,49 @@
 	    (dev->descriptor.idProduct != 0x8080))
 		return NULL;
 
-	interface = &dev->actconfig->interface[ifnum].altsetting[0];
+	/* Check the version/revision */
+	p_rev = (const unsigned char *) &dev->descriptor.bcdDevice;
+	if (p_rev[1] == 0x00 && p_rev[0] == 0x02) {
+		if (ifnum != 2)
+			return NULL;
+		printk(KERN_INFO "IBM USB camera found (model 1).\n");
+		model = IBMCAM_MODEL_1;
+	} else if (p_rev[1] == 0x03 && p_rev[0] == 0x0A) {
+		if (ifnum != 0)
+			return NULL;
+		printk(KERN_INFO "IBM USB camera found (model 2).\n");
+		model = IBMCAM_MODEL_2;
+	} else {
+		printk(KERN_ERR "IBM camera revision=%02x.%02x not supported\n",
+		       p_rev[1], p_rev[0]);
+		return NULL;
+	}
 
-	/* Camera confirmed. We claim only interface 2 (video data) */
-	if (ifnum != 2)
+	/* Validate found interface: must have one ISO endpoint */
+	interface = &dev->actconfig->interface[ifnum].altsetting[0];
+	if (interface->bNumEndpoints != 1) {
+		printk(KERN_ERR "IBM camera: interface %d. has %u. endpoints!\n",
+		       ifnum, (unsigned)(interface->bNumEndpoints));
+		return NULL;
+	}
+	endpoint = &interface->endpoint[0];
+	if ((endpoint->bmAttributes & 0x03) != 0x01) {
+		printk(KERN_ERR "IBM camera: interface %d. has non-ISO endpoint!\n", ifnum);
+		return NULL;
+	}
+	if ((endpoint->bEndpointAddress & 0x80) == 0) {
+		printk(KERN_ERR "IBM camera: interface %d. has ISO OUT endpoint!\n", ifnum);
 		return NULL;
+	}
 
-	/* We found an IBM camera */
-	printk(KERN_INFO "IBM USB camera found (interface %u.)\n", ifnum);
+	/* Validate options */
+	if (model == IBMCAM_MODEL_1) {
+		RESTRICT_TO_RANGE(lighting, 0, 2);
+		RESTRICT_TO_RANGE(videosize, VIDEOSIZE_128x96, VIDEOSIZE_352x288);
+	} else {
+		RESTRICT_TO_RANGE(lighting, 0, 15);
+		RESTRICT_TO_RANGE(videosize, VIDEOSIZE_176x144, VIDEOSIZE_352x240);
+	}
 
 	devnum = ibmcam_find_struct();
 	if (devnum == -1) {
@@ -2321,14 +2971,14 @@
 	ibmcam = &cams[devnum];
 
 	down(&ibmcam->lock);
-	ibmcam->ibmcam_used = 1;	/* In use now */
+	ibmcam->camera_model = model;
 	ibmcam->remove_pending = 0;
 	ibmcam->last_error = 0;
 	ibmcam->dev = dev;
 	ibmcam->iface = ifnum;
 	ibmcam->ifaceAltInactive = 0;
 	ibmcam->ifaceAltActive = 1;
-	ibmcam->video_endp = 0x82;
+	ibmcam->video_endp = endpoint->bEndpointAddress;
 	ibmcam->iso_packet_len = 1014;
 	ibmcam->compress = 0;
 	ibmcam->user=0; 
@@ -2425,19 +3075,12 @@
  */
 int usb_ibmcam_init(void)
 {
-	unsigned i, u;
+	unsigned u;
 
 	/* Initialize struct */
 	for (u = 0; u < MAX_IBMCAM; u++) {
 		struct usb_ibmcam *ibmcam = &cams[u];
 		memset (ibmcam, 0, sizeof(struct usb_ibmcam));
-
-		init_waitqueue_head (&ibmcam->remove_ok);
-		for (i=0; i < IBMCAM_NUMFRAMES; i++)
-			init_waitqueue_head(&ibmcam->frame[i].wq);
-		init_MUTEX(&ibmcam->lock);	/* to 1 == available */
-		ibmcam->dev = NULL;
-		memcpy(&ibmcam->vdev, &ibmcam_template, sizeof(ibmcam_template));
 	}
 	return usb_register(&ibmcam_driver);
 }
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/ibmcam.h linux/drivers/usb/ibmcam.h
--- v2.3.48/linux/drivers/usb/ibmcam.h	Thu Feb 10 17:11:15 2000
+++ linux/drivers/usb/ibmcam.h	Mon Feb 28 14:21:15 2000
@@ -153,6 +153,7 @@
 struct ibmcam_frame {
 	char *data;		/* Frame buffer */
 	int order_uv;		/* True=UV False=VU */
+	int order_yc;		/* True=Yc False=cY ('c'=either U or V) */
 	unsigned char hdr_sig;	/* "00 FF 00 ??" where 'hdr_sig' is '??' */
 
 	int width;		/* Width application is expecting */
@@ -172,6 +173,9 @@
 	wait_queue_head_t wq;	/* Processes waiting */
 };
 
+#define	IBMCAM_MODEL_1	1	/* XVP-501, 3 interfaces, rev. 0.02 */
+#define IBMCAM_MODEL_2	2	/* KSX-X9903, 2 interfaces, rev. 3.0a */
+
 struct usb_ibmcam {
 	struct video_device vdev;
 
@@ -186,6 +190,7 @@
 
 	int ibmcam_used;        /* Is this structure in use? */
 	int initialized;	/* Had we already sent init sequence? */
+	int camera_model;	/* What type of IBM camera we got? */
 	int streaming;		/* Are we streaming Isochronous? */
 	int grabbing;		/* Are we grabbing? */
 	int last_error;		/* What calamity struck us? */
@@ -201,7 +206,6 @@
 	int cursbuf;		/* Current receiving sbuf */
 	struct ibmcam_sbuf sbuf[IBMCAM_NUMSBUF];	/* Double buffering */
 	volatile int remove_pending;	/* If set then about to exit */
-	wait_queue_head_t remove_ok;	/* Wait here until removal is safe */
 
         /*
 	 * Scratch space from the Isochronous pipe.
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/inode.c linux/drivers/usb/inode.c
--- v2.3.48/linux/drivers/usb/inode.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/inode.c	Mon Feb 28 14:19:42 2000
@@ -45,9 +45,6 @@
 
 static LIST_HEAD(superlist);
 
-extern struct inode_operations usbdevfs_bus_inode_operations;
-extern struct file_operations usbdevfs_bus_file_operations;
-
 struct special {
 	const char *name;
 	struct file_operations *fops;
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/joydev.c linux/drivers/usb/joydev.c
--- v2.3.48/linux/drivers/usb/joydev.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/joydev.c	Mon Feb 28 14:21:15 2000
@@ -464,7 +464,7 @@
 	disconnect:	joydev_disconnect,
 };
 
-static int joydev_init(void)
+static int __init joydev_init(void)
 {
 	if (register_chrdev(JOYDEV_MAJOR, "js", &joydev_fops)) {
 		printk(KERN_ERR "joydev: unable to get major %d for joystick\n", JOYDEV_MAJOR);
@@ -474,7 +474,7 @@
 	return 0;
 }
 
-static void joydev_exit(void)
+static void __exit joydev_exit(void)
 {
 	input_unregister_handler(&joydev_handler);
 	if (unregister_chrdev(JOYSTICK_MAJOR, "js"))
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/pegasus.c linux/drivers/usb/pegasus.c
--- v2.3.48/linux/drivers/usb/pegasus.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/usb/pegasus.c	Tue Feb 29 11:10:09 2000
@@ -0,0 +1,579 @@
+/*
+**
+**	Pegasus: USB 10/100Mbps/HomePNA (1Mbps) Controller
+**
+**	Copyleft (L) 1999 Petko Manolov - Petkan (petkan@spct.net)
+** 	
+**	Distribute under GPL version 2 or later.
+*/
+
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/malloc.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+
+#include "usb.h"
+
+#if LINUX_VERSION_CODE<0x2032d || !defined(__KERNEL__) || !defined(__OPTIMIZE__)
+#error You can not compile this driver on this kernel with this C options!
+#endif
+
+
+#define	ADMTEK_VENDOR_ID	0x07a6
+#define	ADMTEK_HPNA_PEGASUS	0x0986
+
+#define	HPNA_MTU		1500
+#define MAX_MTU			1536
+
+#define	TX_TIMEOUT		(HZ*5)
+#define	SOMETHING		(jiffies + TX_TIMEOUT)
+
+
+static const char version[] = "pegasus.c: v0.2.27 2000/02/29 Written by Petko Manolov (petkan@spct.net)\n";
+
+
+typedef struct usb_hpna
+{
+	struct usb_device	*usb_dev;
+	struct net_device	*net_dev;
+	int			present;
+	int			active;
+	void			*irq_handler;
+	struct list_head	list;
+	struct net_device_stats	stats;
+	spinlock_t		hpna_lock;
+	struct timer_list	timer;
+
+	unsigned int		rx_pipe;
+	unsigned char *		rx_buff;
+	urb_t 			rx_urb;
+
+	unsigned int		tx_pipe;
+	unsigned char *		tx_buff;
+	urb_t 			tx_urb;
+	struct sk_buff *	tx_skbuff;
+
+	__u8			intr_ival;
+	unsigned int		intr_pipe;
+	unsigned char 		intr_buff[8];
+	urb_t 			intr_urb;
+} usb_hpna_t;
+
+
+usb_hpna_t	usb_dev_hpna;
+static int	loopback = 0;
+int		multicast_filter_limit = 32;
+static LIST_HEAD(hpna_list);
+
+
+MODULE_AUTHOR("Petko Manolov <petkan@spct.net>");
+MODULE_DESCRIPTION("ADMtek \"Pegasus\" USB Ethernet driver");
+MODULE_PARM(loopback, "i");
+
+
+
+/*** vendor specific commands ***/
+static __inline__ int	hpna_get_registers( struct usb_device *dev, __u16 indx, __u16 size, void *data )
+{
+	return	usb_control_msg(dev, usb_rcvctrlpipe(dev,0), 0xf0, 0xc0, 0,
+				indx, data, size, HZ);
+}
+
+
+static __inline__ int	hpna_set_register( struct usb_device *dev, __u16 indx, __u8 value )
+{
+	__u8	data = value;
+	return	usb_control_msg(dev, usb_sndctrlpipe(dev,0), 0xf1, 0x40,
+				data, indx, &data, 1, HZ);
+}
+
+
+static __inline__ int	hpna_set_registers( struct usb_device *dev, __u16 indx, __u16 size, void *data )
+{
+	return	usb_control_msg(dev, usb_sndctrlpipe(dev,0), 0xf1, 0x40, 0,
+				indx, data, size, HZ);
+}
+
+
+static int read_phy_word( struct usb_device *dev, __u8 index, __u16 *regdata )
+{
+	int	i;
+	__u8	data[4];
+
+	data[0] = 1;
+	data[1] = 0;
+	data[2] = 0;
+	data[3] = 0x40 + index;
+	hpna_set_registers( dev, 0x25, 4, data );
+	for ( i=0; i<100; i++ ) {
+		hpna_get_registers( dev, 0x25, 4, data );
+		if ( data[3] & 0x80 ) {
+			*regdata = *(__u16 *)(data+1);
+			return	0;
+		}
+		udelay(100);
+	}
+	warn("read_phy_word() failed");
+	return	1;
+}
+
+
+static int write_phy_word( struct usb_device *dev, __u8 index, __u16 regdata )
+{
+	int	i;
+	__u8	data[4];
+
+	data[0] = 1;
+	data[1] = regdata;
+	data[2] = regdata >> 8;
+	data[3] = 0x20 + index;
+	hpna_set_registers( dev, 0x25, 4, data );
+	for ( i=0; i<100; i++ ) {
+		hpna_get_registers( dev, 0x28, 1, data );
+		if ( data[0] & 0x80 ) {
+			return	0;
+		}
+		udelay(100);
+	}
+	warn("write_phy_word() failed");
+	return	1;
+}
+
+
+int read_srom_word( struct usb_device *dev, __u8 index, __u16 *retdata)
+{
+	int	i;
+	__u8	data[4];
+
+	data[0] = index;
+	data[1] = data[2] = 0;
+	data[3] = 0x02;
+	hpna_set_registers(dev, 0x20, 4, data);
+	for ( i=0; i<100; i++ ) {
+		hpna_get_registers(dev, 0x23, 1, data);
+		if ( data[0] & 4 ) {
+			hpna_get_registers(dev, 0x21, 2, data);
+			*retdata = *(__u16 *)data;
+			return	0;		
+		}
+	}
+	warn("read_srom_word() failed");
+	return	1;
+}
+/*** end ***/
+
+
+
+
+int get_node_id( struct usb_device *dev, __u8 *id )
+{
+	int	i;
+
+	for ( i=0; i<3; i++ ) {
+		if ( read_srom_word(dev, i, (__u16 *)&id[i*2] ) )
+			return	1;
+	}
+	return	0;
+}
+
+
+static int reset_mac( struct usb_device *dev )
+{
+	__u8	data = 0x8;
+	int	i;
+	
+	hpna_set_register( dev, 1, 0x08 );
+	for ( i=0; i<100; i++ ) {
+		hpna_get_registers( dev, 1, 1, &data);
+		if ( !(data & 0x08) ) {
+			if ( loopback & 1 )
+				return	0;
+			else if ( loopback & 2 ) {
+				write_phy_word( dev, 0, 0x4000 );
+				/*return	0;*/
+			}
+			hpna_set_register( dev, 0x7e, 0x24 );
+			hpna_set_register( dev, 0x7e, 0x27 );
+			return	0;
+		}
+	}
+	return 1;
+}
+
+
+int start_net( struct net_device *dev, struct usb_device *usb_dev )
+{
+	__u16	partmedia, temp;
+	__u8	node_id[6];
+	__u8	data[4];
+	
+	if ( get_node_id(usb_dev, node_id) )
+		return	1;
+	hpna_set_registers(usb_dev, 0x10, 6, node_id);
+	memcpy(dev->dev_addr, node_id, 6);
+	if ( read_phy_word(usb_dev, 1, &temp) )
+		return	2;
+	if ( !(temp & 4) ) {
+		if ( loopback )
+			goto ok;
+		err("link NOT established - %x", temp);
+		return	3;
+	}
+ok:
+	if ( read_phy_word(usb_dev, 5, &partmedia) )
+		return	4;
+	temp = partmedia;
+	partmedia &= 0x1f;
+	if ( partmedia != 1 ) {
+		err("party FAIL %x", temp);
+		return	5;
+	}
+	partmedia = temp;
+	if ( partmedia & 0x100 )
+		data[1] = 0x30;
+	else {
+		if ( partmedia & 0x80 )
+			data[1] = 0x10;
+		else 
+			data[1] = 0;
+	}
+	
+	data[0] = 0xc9;
+	data[2] = (loopback & 1) ? 0x08 : 0x00; 
+	
+	hpna_set_registers(usb_dev, 0, 3, data);
+	
+	return	0;
+}
+
+
+static void hpna_read_irq( purb_t urb )
+{
+	struct net_device *net_dev = urb->context;
+	usb_hpna_t *hpna = net_dev->priv;
+	int	count = urb->actual_length, res;
+	int	rx_status = *(int *)(hpna->rx_buff + count - 4);
+
+
+	if ( urb->status ) {
+		info( "%s: RX status %d\n", net_dev->name, urb->status );
+		goto goon;
+	}
+
+	if ( !count )
+		goto goon;
+/*	if ( rx_status & 0x00010000 )
+		goto goon;
+*/	
+	if ( rx_status & 0x000e0000 ) {
+		dbg("%s: error receiving packet %x",
+			net_dev->name, rx_status & 0xe0000);
+		hpna->stats.rx_errors++;
+		if(rx_status & 0x060000) hpna->stats.rx_length_errors++;
+		if(rx_status & 0x080000) hpna->stats.rx_crc_errors++;
+		if(rx_status & 0x100000) hpna->stats.rx_frame_errors++;
+	} else {
+		struct sk_buff	*skb;
+		__u16 		pkt_len = (rx_status & 0xfff) - 8;
+
+
+		if((skb = dev_alloc_skb(pkt_len+2)) != NULL ) {
+			skb->dev = net_dev;
+			skb_reserve(skb, 2);
+			eth_copy_and_sum(skb, hpna->rx_buff, pkt_len, 0);
+			skb_put(skb, pkt_len);
+		} else
+			goto	goon;
+		skb->protocol = eth_type_trans(skb, net_dev);
+		netif_rx(skb);
+		hpna->stats.rx_packets++;
+		hpna->stats.rx_bytes += pkt_len;
+	}
+goon:
+	if ( (res = usb_submit_urb( &hpna->rx_urb )) )
+		warn("failed rx_urb %d", res);
+}
+
+
+static void hpna_irq( urb_t *urb)
+{
+	if( urb->status ) {
+		__u8	*d = urb->transfer_buffer;
+		printk("txst0 %x, txst1 %x, rxst %x, rxlst0 %x, rxlst1 %x, wakest %x",
+			d[0], d[1], d[2], d[3], d[4], d[5] );
+	}
+}
+
+
+static void hpna_write_irq( purb_t urb )
+{
+	struct net_device *net_dev = urb->context;
+	usb_hpna_t *hpna = net_dev->priv;
+
+
+	spin_lock( &hpna->hpna_lock );
+	
+	if ( urb->status ) 
+		info("%s: TX status %d\n", net_dev->name, urb->status);
+	netif_wake_queue( net_dev );
+
+	spin_unlock( &hpna->hpna_lock );
+}
+
+
+static void tx_timeout( struct net_device *dev )
+{
+	usb_hpna_t	*hpna = dev->priv;
+
+	warn( "%s: Tx timed out. Reseting...", dev->name );
+	hpna->stats.tx_errors++;
+	dev->trans_start = jiffies;
+	netif_wake_queue( dev );
+}
+
+
+static int hpna_start_xmit( struct sk_buff *skb, struct net_device *net_dev )
+{
+	usb_hpna_t	*hpna = (usb_hpna_t *)net_dev->priv;
+	int		count = skb->len+2 % 64 ? skb->len+2 : skb->len+3;
+	int		res;
+
+	spin_lock( &hpna->hpna_lock );
+
+	netif_stop_queue( net_dev );
+	((__u16 *)hpna->tx_buff)[0] = skb->len;
+	memcpy(hpna->tx_buff+2, skb->data, skb->len);
+	(&hpna->tx_urb)->transfer_buffer_length = count;
+	if ( (res = usb_submit_urb( &hpna->tx_urb )) ) {
+		warn("failed tx_urb %d", res);
+		hpna->stats.tx_errors++;
+		netif_start_queue( net_dev );
+	} else {
+		hpna->stats.tx_packets++;
+		hpna->stats.tx_bytes += skb->len;
+		net_dev->trans_start = jiffies;
+	}
+	dev_kfree_skb( skb );
+	spin_unlock( &hpna->hpna_lock );
+	return	0;
+}
+
+
+static struct net_device_stats *hpna_netdev_stats( struct net_device *dev )
+{
+	return	&((usb_hpna_t *)dev->priv)->stats;
+}
+
+static int hpna_open( struct net_device *net_dev )
+{
+	usb_hpna_t *hpna = (usb_hpna_t *)net_dev->priv;
+	int	res;
+
+	if ( hpna->active )
+		return	-EBUSY;
+	else
+		hpna->active = 1;
+
+	if ( start_net(net_dev, hpna->usb_dev) ) {
+		err("can't start_net()");
+		return	-EIO;
+	}
+
+	if ( (res = usb_submit_urb( &hpna->rx_urb )) )
+		warn("failed rx_urb %d", res);
+
+/*	usb_submit_urb( &hpna->intr_urb );*/
+	netif_start_queue( net_dev );
+
+	MOD_INC_USE_COUNT;
+
+	return 0;
+}
+
+
+static int hpna_close( struct net_device *net_dev )
+{
+	usb_hpna_t	*hpna = net_dev->priv;
+
+
+	netif_stop_queue( net_dev );
+
+	usb_unlink_urb( &hpna->rx_urb );
+	usb_unlink_urb( &hpna->tx_urb );
+/*	usb_unlink_urb( hpna->intr_urb );*/
+
+	hpna->active = 0;
+
+	MOD_DEC_USE_COUNT;
+
+	return 0;
+}
+
+
+static int hpna_ioctl( struct net_device *dev, struct ifreq *rq, int cmd )
+{
+	__u16	*data = (__u16 *)&rq->ifr_data;
+	usb_hpna_t	*hpna = dev->priv;
+
+	switch( cmd ) {
+		case SIOCDEVPRIVATE: 
+			data[0] = 1;
+		case SIOCDEVPRIVATE+1:
+			read_phy_word(hpna->usb_dev, data[1] & 0x1f, &data[3]);
+			return	0;
+		case SIOCDEVPRIVATE+2:
+			if ( !capable(CAP_NET_ADMIN) )
+				return	-EPERM;
+			write_phy_word(hpna->usb_dev, data[1] & 0x1f, data[2]);
+			return	0;
+		default:
+			return	-EOPNOTSUPP;
+	}
+}
+
+
+static void set_rx_mode( struct net_device *net_dev )
+{
+	usb_hpna_t	*hpna=net_dev->priv;
+
+	netif_stop_queue( net_dev );
+	
+	if ( net_dev->flags & IFF_PROMISC ) {
+		info("%s: Promiscuous mode enabled", net_dev->name);
+		hpna_set_register( hpna->usb_dev, 2, 0x04 );
+	} else if ((net_dev->mc_count > multicast_filter_limit) ||
+			(net_dev->flags & IFF_ALLMULTI)) {
+		hpna_set_register(hpna->usb_dev, 0, 0xfa);
+		hpna_set_register(hpna->usb_dev, 2, 0);
+	} else {
+		dbg("%s: set Rx mode", net_dev->name);
+	}
+
+	netif_wake_queue( net_dev );
+}
+
+
+static void * usb_hpna_probe( struct usb_device *dev, unsigned int ifnum )
+{
+	struct net_device 		*net_dev;
+	usb_hpna_t			*hpna = &usb_dev_hpna;
+
+
+
+	if ( dev->descriptor.idVendor != ADMTEK_VENDOR_ID ||
+	     dev->descriptor.idProduct != ADMTEK_HPNA_PEGASUS ) {
+		return	NULL;
+	}
+
+	printk("USB HPNA Pegasus found\n");
+
+	if ( usb_set_configuration(dev, dev->config[0].bConfigurationValue)) {
+		err("usb_set_configuration() failed");
+		return NULL;
+	}
+
+	hpna->usb_dev = dev;
+
+	hpna->rx_pipe = usb_rcvbulkpipe(hpna->usb_dev, 1);
+	hpna->tx_pipe = usb_sndbulkpipe(hpna->usb_dev, 2);
+	hpna->intr_pipe = usb_rcvintpipe(hpna->usb_dev, 0);
+
+	if ( reset_mac(dev) ) {
+		err("can't reset MAC");
+	}
+
+	hpna->present = 1;
+
+	if(!(hpna->rx_buff=kmalloc(MAX_MTU, GFP_KERNEL))) {
+		err("not enough mem for out buff");
+		return	NULL;
+	}
+	if(!(hpna->tx_buff=kmalloc(MAX_MTU, GFP_KERNEL))) {
+		kfree_s(hpna->rx_buff, MAX_MTU);
+		err("not enough mem for out buff");
+		return	NULL;
+	}
+
+	net_dev = init_etherdev( 0, 0 );
+	hpna->net_dev = net_dev;
+	net_dev->priv = hpna;
+	net_dev->open = hpna_open;
+	net_dev->stop = hpna_close;
+	net_dev->watchdog_timeo = TX_TIMEOUT;
+	net_dev->tx_timeout = tx_timeout;
+	net_dev->do_ioctl = hpna_ioctl; 
+	net_dev->hard_start_xmit = hpna_start_xmit;
+	net_dev->set_multicast_list = set_rx_mode;
+	net_dev->get_stats = hpna_netdev_stats; 
+	net_dev->mtu = HPNA_MTU;
+	hpna->hpna_lock = SPIN_LOCK_UNLOCKED;
+	
+	FILL_BULK_URB( &hpna->rx_urb, hpna->usb_dev, hpna->rx_pipe, 
+			hpna->rx_buff, MAX_MTU, hpna_read_irq, net_dev );
+	FILL_BULK_URB( &hpna->tx_urb, hpna->usb_dev, hpna->tx_pipe, 
+			hpna->tx_buff, MAX_MTU, hpna_write_irq, net_dev );
+	FILL_INT_URB( &hpna->intr_urb, hpna->usb_dev, hpna->intr_pipe,
+			hpna->intr_buff, 8, hpna_irq, net_dev, 250 );
+	
+/*	list_add( &hpna->list, &hpna_list );*/
+	
+	return	net_dev; 
+}
+
+
+static void usb_hpna_disconnect( struct usb_device *dev, void *ptr )
+{
+	struct net_device	*net_dev = ptr;
+	struct usb_hpna		*hpna = net_dev->priv;
+
+
+	if ( net_dev->flags & IFF_UP )
+		dev_close(net_dev);
+	
+	unregister_netdev( net_dev );
+
+	if ( !hpna ) /* should never happen */
+		return;
+		
+	usb_unlink_urb( &hpna->rx_urb );
+	usb_unlink_urb( &hpna->tx_urb );
+/*	usb_unlink_urb( &hpna->intr_urb );*/
+	kfree_s(hpna->rx_buff, MAX_MTU);
+	kfree_s(hpna->tx_buff, MAX_MTU);
+
+	hpna->usb_dev = NULL;
+	hpna->present = 0;
+
+	printk("USB HPNA disconnected\n");
+}
+
+
+static struct usb_driver usb_hpna_driver = {
+	"ADMtek \"Pegasus\" USB Ethernet",
+	usb_hpna_probe,
+	usb_hpna_disconnect,
+	{NULL, NULL}
+};
+
+
+
+static int  __init start_hpna( void )
+{
+	printk( version );
+	return	usb_register( &usb_hpna_driver );
+}
+
+
+static void __exit stop_hpna( void )
+{
+	usb_deregister( &usb_hpna_driver );
+}
+
+
+module_init( start_hpna );
+module_exit( stop_hpna );
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/rio500.c linux/drivers/usb/rio500.c
--- v2.3.48/linux/drivers/usb/rio500.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/usb/rio500.c	Thu Mar  2 10:10:24 2000
@@ -0,0 +1,455 @@
+/* -*- linux-c -*- */
+
+/* 
+ * Driver for USB Rio 500
+ *
+ * Cesar Miquel (miquel@df.uba.ar)
+ * 
+ * based on hp_scanner.c by David E. Nelson (dnelson@jump.net)
+ * 
+ * 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.
+ *
+ * Based upon mouse.c (Brad Keryan) and printer.c (Michael Gee).
+ *
+ * */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/miscdevice.h>
+#include <linux/random.h>
+#include <linux/poll.h>
+#include <linux/init.h>
+#include <linux/malloc.h>
+#include <linux/spinlock.h>
+
+#include "usb.h"
+
+#include "rio500_usb.h"
+
+#define RIO_MINOR   64
+
+/* stall/wait timeout for rio */
+#define NAK_TIMEOUT (HZ)
+
+#define IBUF_SIZE 128
+
+/* Size of the rio buffer */
+#define OBUF_SIZE 0x10000
+
+struct rio_usb_data {
+        struct usb_device *rio_dev;     /* init: probe_rio */
+        unsigned int ifnum;             /* Interface number of the USB device */
+        int isopen;                     /* nz if open */
+        int present;                    /* Device is present on the bus */
+        char *obuf, *ibuf;              /* transfer buffers */
+        char bulk_in_ep, bulk_out_ep;   /* Endpoint assignments */
+        wait_queue_head_t wait_q;       /* for timeouts */
+};
+
+static struct rio_usb_data rio_instance;
+
+static int open_rio(struct inode *inode, struct file *file)
+{
+	struct rio_usb_data *rio = &rio_instance;
+
+	if (rio->isopen || !rio->present) {
+		return -EBUSY;
+	}
+	rio->isopen = 1;
+
+	init_waitqueue_head(&rio->wait_q);
+
+	MOD_INC_USE_COUNT;
+
+	info("Rio opened.");
+
+	return 0;
+}
+
+static int close_rio(struct inode *inode, struct file *file)
+{
+	struct rio_usb_data *rio = &rio_instance;
+
+	rio->isopen = 0;
+
+	MOD_DEC_USE_COUNT;
+
+	info("Rio closed.");
+	return 0;
+}
+
+static int
+ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
+	  unsigned long arg)
+{
+	struct RioCommand rio_cmd;
+	struct rio_usb_data *rio = &rio_instance;
+	void *data;
+	unsigned char *buffer;
+	int result, requesttype;
+	int retries;
+
+        /* Sanity check to make sure rio is connected, powered, etc */
+        if ( rio == NULL ||
+             rio->present == 0 ||
+             rio->rio_dev == NULL )
+          return -1;
+
+	switch (cmd) {
+	case RIO_RECV_COMMAND:
+		data = (void *) arg;
+		if (data == NULL)
+			break;
+		copy_from_user_ret(&rio_cmd, data, sizeof(struct RioCommand),
+				   -EFAULT);
+		if (rio_cmd.length > PAGE_SIZE)
+			return -EINVAL;
+		buffer = (unsigned char *) __get_free_page(GFP_KERNEL);
+		if (buffer == NULL)
+			return -ENOMEM;
+		copy_from_user_ret(buffer, rio_cmd.buffer, rio_cmd.length,
+				   -EFAULT);
+
+		requesttype = rio_cmd.requesttype | USB_DIR_IN |
+		    USB_TYPE_VENDOR | USB_RECIP_DEVICE;
+		dbg
+		    ("sending command:reqtype=%0x req=%0x value=%0x index=%0x len=%0x",
+		     requesttype, rio_cmd.request, rio_cmd.value,
+		     rio_cmd.index, rio_cmd.length);
+		/* Send rio control message */
+		retries = 3;
+		while (retries) {
+			result = usb_control_msg(rio->rio_dev,
+						 usb_rcvctrlpipe(rio-> rio_dev, 0),
+						 rio_cmd.request,
+						 requesttype,
+						 rio_cmd.value,
+						 rio_cmd.index, buffer,
+						 rio_cmd.length,
+						 rio_cmd.timeout);
+			if (result == -ETIMEDOUT)
+				retries--;
+			else if (result < 0) {
+				err("Error executing ioctrl. code = %d",
+				     le32_to_cpu(result));
+				retries = 0;
+			} else {
+				dbg("Executed ioctl. Result = %d (data=%04x)",
+				     le32_to_cpu(result),
+				     le32_to_cpu(*((long *) buffer)));
+				copy_to_user_ret(rio_cmd.buffer, buffer,
+						 rio_cmd.length, -EFAULT);
+				retries = 0;
+			}
+
+			/* rio_cmd.buffer contains a raw stream of single byte
+			   data which has been returned from rio.  Data is
+			   interpreted at application level.  For data that
+			   will be cast to data types longer than 1 byte, data
+			   will be little_endian and will potentially need to
+			   be swapped at the app level */
+
+		}
+		free_page((unsigned long) buffer);
+		break;
+
+	case RIO_SEND_COMMAND:
+		data = (void *) arg;
+		if (data == NULL)
+			break;
+		copy_from_user_ret(&rio_cmd, data, sizeof(struct RioCommand),
+				   -EFAULT);
+		if (rio_cmd.length > PAGE_SIZE)
+			return -EINVAL;
+		buffer = (unsigned char *) __get_free_page(GFP_KERNEL);
+		if (buffer == NULL)
+			return -ENOMEM;
+		copy_from_user_ret(buffer, rio_cmd.buffer, rio_cmd.length,
+				   -EFAULT);
+
+		requesttype = rio_cmd.requesttype | USB_DIR_OUT |
+		    USB_TYPE_VENDOR | USB_RECIP_DEVICE;
+		dbg("sending command: reqtype=%0x req=%0x value=%0x index=%0x len=%0x",
+		     requesttype, rio_cmd.request, rio_cmd.value,
+		     rio_cmd.index, rio_cmd.length);
+		/* Send rio control message */
+		retries = 3;
+		while (retries) {
+			result = usb_control_msg(rio->rio_dev,
+						 usb_sndctrlpipe(rio-> rio_dev, 0),
+						 rio_cmd.request,
+						 requesttype,
+						 rio_cmd.value,
+						 rio_cmd.index, buffer,
+						 rio_cmd.length,
+						 rio_cmd.timeout);
+			if (result == -ETIMEDOUT)
+				retries--;
+			else if (result < 0) {
+				err("Error executing ioctrl. code = %d",
+				     le32_to_cpu(result));
+				retries = 0;
+			} else {
+				dbg("Executed ioctl. Result = %d",
+				       le32_to_cpu(result));
+				retries = 0;
+
+			}
+
+		}
+		free_page((unsigned long) buffer);
+		break;
+
+	default:
+		return -ENOIOCTLCMD;
+		break;
+	}
+
+	return 0;
+}
+
+static ssize_t
+write_rio(struct file *file, const char *buffer,
+	  size_t count, loff_t * ppos)
+{
+	struct rio_usb_data *rio = &rio_instance;
+
+	unsigned long copy_size;
+	unsigned long bytes_written = 0;
+	unsigned int partial;
+
+	int result = 0;
+	int maxretry;
+
+        /* Sanity check to make sure rio is connected, powered, etc */
+        if ( rio == NULL ||
+             rio->present == 0 ||
+             rio->rio_dev == NULL )
+          return -1;
+
+	do {
+		unsigned long thistime;
+		char *obuf = rio->obuf;
+
+		thistime = copy_size =
+		    (count >= OBUF_SIZE) ? OBUF_SIZE : count;
+		if (copy_from_user(rio->obuf, buffer, copy_size))
+			return -EFAULT;
+		maxretry = 5;
+		while (thistime) {
+			if (!rio->rio_dev)
+				return -ENODEV;
+			if (signal_pending(current)) {
+				return bytes_written ? bytes_written : -EINTR;
+			}
+
+			result = usb_bulk_msg(rio->rio_dev,
+					 usb_sndbulkpipe(rio->rio_dev, 2),
+					 obuf, thistime, &partial, 5 * HZ);
+
+			dbg("write stats: result:%d thistime:%lu partial:%u",
+			     result, thistime, partial);
+
+			if (result == USB_ST_TIMEOUT) {	/* NAK - so hold for a while */
+				if (!maxretry--) {
+					return -ETIME;
+				}
+				interruptible_sleep_on_timeout(&rio-> wait_q, NAK_TIMEOUT);
+				continue;
+			} else if (!result & partial) {
+				obuf += partial;
+				thistime -= partial;
+			} else
+				break;
+		};
+		if (result) {
+			err("Write Whoops - %x", result);
+			return -EIO;
+		}
+		bytes_written += copy_size;
+		count -= copy_size;
+		buffer += copy_size;
+	} while (count > 0);
+
+	return bytes_written ? bytes_written : -EIO;
+}
+
+static ssize_t
+read_rio(struct file *file, char *buffer, size_t count, loff_t * ppos)
+{
+	struct rio_usb_data *rio = &rio_instance;
+	ssize_t read_count;
+	unsigned int partial;
+	int this_read;
+	int result;
+	int maxretry = 10;
+	char *ibuf = rio->ibuf;
+
+        /* Sanity check to make sure rio is connected, powered, etc */
+        if ( rio == NULL ||
+             rio->present == 0 ||
+             rio->rio_dev == NULL )
+          return -1;
+
+	read_count = 0;
+
+	while (count > 0) {
+		if (signal_pending(current)) {
+			return read_count ? read_count : -EINTR;
+		}
+		if (!rio->rio_dev)
+			return -ENODEV;
+		this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count;
+
+		result = usb_bulk_msg(rio->rio_dev,
+				      usb_rcvbulkpipe(rio->rio_dev, 1),
+				      ibuf, this_read, &partial,
+				      (int) (HZ * .1));
+
+		dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u",
+		       result, this_read, partial);
+
+		if (partial) {
+			count = this_read = partial;
+		} else if (result == USB_ST_TIMEOUT || result == 15) {	/* FIXME: 15 ??? */
+			if (!maxretry--) {
+				err("read_rio: maxretry timeout");
+				return -ETIME;
+			}
+			interruptible_sleep_on_timeout(&rio->wait_q,
+						       NAK_TIMEOUT);
+			continue;
+		} else if (result != USB_ST_DATAUNDERRUN) {
+			err("Read Whoops - result:%u partial:%u this_read:%u",
+			     result, partial, this_read);
+			return -EIO;
+		} else {
+			return (0);
+		}
+
+		if (this_read) {
+			if (copy_to_user(buffer, ibuf, this_read))
+				return -EFAULT;
+			count -= this_read;
+			read_count += this_read;
+			buffer += this_read;
+		}
+	}
+	return read_count;
+}
+
+static void *probe_rio(struct usb_device *dev, unsigned int ifnum)
+{
+	struct rio_usb_data *rio = &rio_instance;
+
+	if (dev->descriptor.idVendor != 0x841) {
+		return NULL;
+	}
+
+	if (dev->descriptor.idProduct != 0x1 /* RIO 500 */ ) {
+		warn(KERN_INFO "Rio player model not supported/tested.");
+		return NULL;
+	}
+
+	info("USB Rio found at address %d", dev->devnum);
+
+	rio->present = 1;
+	rio->rio_dev = dev;
+
+	if (!(rio->obuf = (char *) kmalloc(OBUF_SIZE, GFP_KERNEL))) {
+		err("probe_rio: Not enough memory for the output buffer");
+		return NULL;
+	}
+	dbg("probe_rio: obuf address:%p", rio->obuf);
+
+	if (!(rio->ibuf = (char *) kmalloc(IBUF_SIZE, GFP_KERNEL))) {
+		err("probe_rio: Not enough memory for the input buffer");
+		kfree(rio->obuf);
+		return NULL;
+	}
+	dbg("probe_rio: ibuf address:%p", rio->ibuf);
+
+	return rio;
+}
+
+static void disconnect_rio(struct usb_device *dev, void *ptr)
+{
+	struct rio_usb_data *rio = (struct rio_usb_data *) ptr;
+
+	if (rio->isopen) {
+		rio->isopen = 0;
+		/* better let it finish - the release will do whats needed */
+		rio->rio_dev = NULL;
+		return;
+	}
+	kfree(rio->ibuf);
+	kfree(rio->obuf);
+
+	info("USB Rio disconnected.");
+
+	rio->present = 0;
+}
+
+static struct
+file_operations usb_rio_fops = {
+	NULL,			/* seek */
+	read_rio,
+	write_rio,
+	NULL,			/* readdir */
+	NULL,			/* poll */
+	ioctl_rio,		/* ioctl */
+	NULL,			/* mmap */
+	open_rio,
+	NULL,			/* flush */
+	close_rio,
+	NULL,
+	NULL,			/* fasync */
+};
+
+static struct
+usb_driver rio_driver = {
+	"rio500",
+	probe_rio,
+	disconnect_rio,
+	{NULL, NULL},
+	&usb_rio_fops,
+	RIO_MINOR
+};
+
+int usb_rio_init(void)
+{
+	if (usb_register(&rio_driver) < 0)
+		return -1;
+
+	info("USB Rio support registered.");
+	return 0;
+}
+
+
+void usb_rio_cleanup(void)
+{
+	struct rio_usb_data *rio = &rio_instance;
+
+	rio->present = 0;
+	usb_deregister(&rio_driver);
+
+
+}
+
+module_init(usb_rio_init);
+module_exit(usb_rio_cleanup);
+
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/rio500_usb.h linux/drivers/usb/rio500_usb.h
--- v2.3.48/linux/drivers/usb/rio500_usb.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/usb/rio500_usb.h	Thu Mar  2 10:10:24 2000
@@ -0,0 +1,37 @@
+/*  ----------------------------------------------------------------------
+
+    Copyright (C) 2000  Cesar Miquel  (miquel@df.uba.ar)
+
+    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.
+
+    ---------------------------------------------------------------------- */
+
+
+
+#define RIO_SEND_COMMAND			0x1
+#define RIO_RECV_COMMAND			0x2
+
+#define RIO_DIR_OUT               	        0x0
+#define RIO_DIR_IN				0x1
+
+struct RioCommand {
+	short length;
+	int request;
+	int requesttype;
+	int value;
+	int index;
+	void *buffer;
+	int timeout;
+};
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/scanner.c linux/drivers/usb/scanner.c
--- v2.3.48/linux/drivers/usb/scanner.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/scanner.c	Tue Feb 29 11:08:16 2000
@@ -793,18 +793,11 @@
 
 static struct
 file_operations usb_scanner_fops = {
-	NULL,		/* seek */
-	read_scanner,
-	write_scanner,
-	NULL,		/* readdir */
-	NULL,		/* poll */
-	ioctl_scanner,
-	NULL,		/* mmap */
-	open_scanner,
-	NULL,		/* flush */
-	close_scanner,
-	NULL,         
-	NULL,           /* fasync */
+	read:		read_scanner,
+	write:		write_scanner,
+	ioctl:		ioctl_scanner,
+	open:		open_scanner,
+	release:	close_scanner,
 };
 
 static struct
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/usb-debug.c linux/drivers/usb/usb-debug.c
--- v2.3.48/linux/drivers/usb/usb-debug.c	Fri Jan 28 15:09:08 2000
+++ linux/drivers/usb/usb-debug.c	Mon Feb 28 14:21:58 2000
@@ -143,14 +143,17 @@
 		USB_DT_ENDPOINT_AUDIO_SIZE) ? " (Audio)" : (desc->bLength ==
 		USB_DT_ENDPOINT_SIZE) ? "" : " (!!!)";
 	char *EndpointType[4] = { "Control", "Isochronous", "Bulk", "Interrupt" };
+
 	printk("    Endpoint:\n");
-	printk("      bLength             = %4d%s\n", desc->bLength,
-		LengthCommentString);
+	printk("      bLength             = %4d%s\n",
+		desc->bLength, LengthCommentString);
 	printk("      bDescriptorType     =   %02x\n", desc->bDescriptorType);
 	printk("      bEndpointAddress    =   %02x (%s)\n", desc->bEndpointAddress,
-		(desc->bEndpointAddress & 0x80) ? "in" : "out");
+		(desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_CONTROL ? "i/o" :
+		(desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ? "in" : "out");
 	printk("      bmAttributes        =   %02x (%s)\n", desc->bmAttributes,
-		EndpointType[3 & desc->bmAttributes]);
+		EndpointType[USB_ENDPOINT_XFERTYPE_MASK & desc->bmAttributes]);
 	printk("      wMaxPacketSize      = %04x\n", desc->wMaxPacketSize);
 	printk("      bInterval           =   %02x\n", desc->bInterval);
 
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/usb.c linux/drivers/usb/usb.c
--- v2.3.48/linux/drivers/usb/usb.c	Wed Feb 16 17:03:52 2000
+++ linux/drivers/usb/usb.c	Mon Feb 28 14:21:58 2000
@@ -1375,8 +1375,13 @@
 			int e;
 
 			for (e=0; e<as->bNumEndpoints; e++) {
-				b = ep[e].bEndpointAddress & 0x0f;
-				if (usb_endpoint_out(ep[e].bEndpointAddress)) {
+				b = ep[e].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+				if ((ep[e].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+					USB_ENDPOINT_XFER_CONTROL) {	/* Control => bidirectional */
+					dev->epmaxpacketout[b] = ep[e].wMaxPacketSize;
+					dev->epmaxpacketin [b] = ep[e].wMaxPacketSize;
+					}
+				else if (usb_endpoint_out(ep[e].bEndpointAddress)) {
 					if (ep[e].wMaxPacketSize > dev->epmaxpacketout[b])
 						dev->epmaxpacketout[b] = ep[e].wMaxPacketSize;
 				}
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/usb.h linux/drivers/usb/usb.h
--- v2.3.48/linux/drivers/usb/usb.h	Tue Feb  1 01:35:44 2000
+++ linux/drivers/usb/usb.h	Mon Feb 28 14:21:58 2000
@@ -85,9 +85,22 @@
 /*
  * USB Packet IDs (PIDs)
  */
-#define USB_PID_OUT			0xe1
-#define USB_PID_IN			0x69
-#define USB_PID_SETUP			0x2d
+#define USB_PID_UNDEF_0                        0xf0
+#define USB_PID_OUT                            0xe1
+#define USB_PID_ACK                            0xd2
+#define USB_PID_DATA0                          0xc3
+#define USB_PID_UNDEF_4                        0xb4
+#define USB_PID_SOF                            0xa5
+#define USB_PID_UNDEF_6                        0x96
+#define USB_PID_UNDEF_7                        0x87
+#define USB_PID_UNDEF_8                        0x78
+#define USB_PID_IN                             0x69
+#define USB_PID_NAK                            0x5a
+#define USB_PID_DATA1                          0x4b
+#define USB_PID_PREAMBLE                       0x3c
+#define USB_PID_SETUP                          0x2d
+#define USB_PID_STALL                          0x1e
+#define USB_PID_UNDEF_F                        0x0f
 
 /*
  * Standard requests
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/usbdevice_fs.h linux/drivers/usb/usbdevice_fs.h
--- v2.3.48/linux/drivers/usb/usbdevice_fs.h	Fri Jan 28 15:09:08 2000
+++ linux/drivers/usb/usbdevice_fs.h	Mon Feb 28 14:19:42 2000
@@ -157,7 +157,10 @@
 extern struct usb_driver usbdevfs_driver;
 extern struct file_operations usbdevfs_drivers_fops;
 extern struct file_operations usbdevfs_devices_fops;
+extern struct file_operations usbdevfs_device_file_operations;
 extern struct inode_operations usbdevfs_device_inode_operations;
+extern struct inode_operations usbdevfs_bus_inode_operations;
+extern struct file_operations usbdevfs_bus_file_operations;
 extern void usbdevfs_conn_disc_event(void);
 
 
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/usbkbd.c linux/drivers/usb/usbkbd.c
--- v2.3.48/linux/drivers/usb/usbkbd.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/usb/usbkbd.c	Mon Feb 28 14:21:15 2000
@@ -45,14 +45,15 @@
 	 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106,
 	105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71,
 	 72, 73, 82, 83, 86,127,116,117, 85, 89, 90, 91, 92, 93, 94, 95,
-	120,121,122,123,  0,138,  0,  0,128,129,131,137,133,135,136,113,
+	120,121,122,123,134,138,130,132,128,129,131,137,133,135,136,113,
 	115,114,  0,  0,  0,  0,  0,124,  0,  0,  0,  0,  0,  0,  0,  0,
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	134,130,132,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	 29, 42, 56,125, 97, 54,100,126
+	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+	 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
+	150,158,159,128,136,177,178,176,142,152,173,140
 };
 
 struct usb_kbd {
diff -u --recursive --new-file v2.3.48/linux/drivers/usb/wacom.c linux/drivers/usb/wacom.c
--- v2.3.48/linux/drivers/usb/wacom.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/usb/wacom.c	Mon Feb 28 14:21:15 2000
@@ -0,0 +1,286 @@
+/*
+ *  wacom.c  Version 0.3
+ *
+ *  Copyright (c) 2000 Vojtech Pavlik		<vojtech@suse.cz>
+ *  Copyright (c) 2000 Andreas Bach Aaen	<abach@stofanet.dk>
+ *  Copyright (c) 2000 Clifford Wolf		<clifford@clifford.at>
+ *
+ *  USB Wacom Graphire and Wacom Intuos tablet support
+ *
+ *  Sponsored by SuSE
+ *
+ *  ChangeLog:
+ *      v0.1 (vp)  - Initial release
+ *      v0.2 (aba) - Support for all buttons / combinations
+ *      v0.3 (vp)  - Support for Intuos added
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or 
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * 
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <linux/kernel.h>
+#include <linux/malloc.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include "usb.h"
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+
+/*
+ * Wacom Graphire packet:
+ *
+ * The input report:
+ * 
+ * byte 0: report ID (2)
+ * byte 1: bit7 	mouse/pen/rubber near
+ *         bit5-6	0 - pen, 1 - rubber, 2 - mouse
+ * 	   bit4		1 ?
+ *         bit3		0 ?
+ *         bit2		mouse middle button / pen button2
+ *         bit1		mouse right button / pen button1
+ *         bit0		mouse left button / pen tip / rubber
+ * byte 2: X low bits
+ * byte 3: X high bits
+ * byte 4: Y low bits
+ * byte 5: Y high bits
+ * byte 6: pen pressure low bits / mouse wheel
+ * byte 7: pen presure high bits / mouse distance
+ * 
+ * There are also two single-byte feature reports (2 and 3).
+ *
+ * Resolution:
+ * X: 0 - 10206
+ * Y: 0 - 7422
+ * 
+ * (0,0) is upper left corner
+ *
+ * Wacom Intuos packet:
+ *
+ *  byte 0: report ID (2)
+ *  byte 1: bit7	1 ?
+ *          bit6	tilt (pressure?) data valid
+ *          bit5	near
+ *          bit4 	0 ?
+ *          bit3	0 ?
+ *          bit2	pen button
+ *          bit1	first packet (contains other infos)
+ *          bit0	0 ?
+ *  byte 2: X high bits
+ *  byte 3: X low bits
+ *  byte 4: Y high bits
+ *  byte 5: Y low bits
+ *  byte 6: bits 0-7:  pressure (bits 2-9)
+ *  byte 7: bits 6-7:  pressure (bits 0-1)
+ *  byte 7: bits 0-5:  X tilt  (bits 1-6)
+ *  byte 8: bit    7:  X tilt  (bit  0)
+ *  byte 8: bits 0-6:  Y tilt  (bits 0-6)
+ *  byte 9: ?
+ */
+
+#define USB_VENDOR_ID_WACOM		0x056a
+#define USB_DEVICE_ID_WACOM_GRAPHIRE	0x0010
+#define USB_DEVICE_ID_WACOM_INTUOS	0x0021
+
+struct wacom {
+	signed char data[12];
+	struct input_dev dev;
+	struct urb irq;
+};
+
+static void wacom_graphire_irq(struct urb *urb)
+{
+	struct wacom *wacom = urb->context;
+	unsigned char *data = wacom->data;
+	struct input_dev *dev = &wacom->dev;
+
+	if (urb->status) return;
+
+	if (data[0] != 2)
+		dbg("received unknown report #%d", data[0]);
+
+        if ( data[1] & 0x80 ) {
+	        input_report_abs(dev, ABS_X, data[2] | ((__u32)data[3] << 8));
+	        input_report_abs(dev, ABS_Y, 7422 - (data[4] | ((__u32)data[5] << 8)));
+	}
+
+	switch ((data[1] >> 5) & 3) {
+
+		case 0:	/* Pen */
+			input_report_btn(dev, BTN_TOOL_PEN, data[1] & 0x80);
+			input_report_btn(dev, BTN_TOUCH, data[1] & 0x01);
+			input_report_btn(dev, BTN_STYLUS, data[1] & 0x02);
+			input_report_btn(dev, BTN_STYLUS2, data[1] & 0x04);
+			input_report_abs(dev, ABS_PRESSURE, data[6] | ((__u32)data[7] << 8));
+			break;
+
+		case 1: /* Rubber */
+	                input_report_btn(dev, BTN_TOOL_RUBBER, data[1] & 0x80);
+			input_report_btn(dev, BTN_TOUCH, data[1] & 0x01);
+			input_report_btn(dev, BTN_STYLUS, data[1] & 0x02);
+			input_report_btn(dev, BTN_STYLUS2, data[1] & 0x04);
+			input_report_abs(dev, ABS_PRESSURE, data[6] | ((__u32)data[7] << 8));
+			break;
+
+		case 2: /* Mouse */
+	                input_report_btn(dev, BTN_TOOL_MOUSE, data[7] > 24);
+			input_report_btn(dev, BTN_LEFT, data[1] & 0x01);
+			input_report_btn(dev, BTN_RIGHT, data[1] & 0x02);
+			input_report_btn(dev, BTN_MIDDLE, data[1] & 0x04);
+			input_report_abs(dev, ABS_DISTANCE, data[7]);
+			input_report_rel(dev, REL_WHEEL, (signed char) data[6]);
+			break;
+	}
+}
+
+static void wacom_intuos_irq(struct urb *urb)
+{
+	struct wacom *wacom = urb->context;
+	unsigned char *data = wacom->data;
+	struct input_dev *dev = &wacom->dev;
+	unsigned int t;
+
+	if (urb->status) return;
+
+	if (data[0] != 2)
+		dbg("received unknown report #%d", data[0]);
+
+	if (data[1] & 0x02) /* First record, weird data */
+		return;
+	
+	if (data[1] & 0x20) { /* Near */
+		input_report_abs(dev, ABS_X, (((unsigned int) data[2]) << 8) | data[3]);
+		input_report_abs(dev, ABS_Y, 16240 - ((((unsigned int) data[4]) << 8) | data[5]));
+	}
+
+	input_report_btn(dev, BTN_TOOL_PEN, data[1] & 0x20);
+	input_report_btn(dev, BTN_STYLUS, data[1] & 0x04);
+
+	t = (((unsigned int) data[6]) << 2) | ((data[7] & 0xC0) >> 6);
+
+	input_report_btn(dev, BTN_TOUCH, t > 10);
+	input_report_abs(dev, ABS_PRESSURE, t);
+
+	if (data[1] & 0x40) { /* Tilt data */
+		input_report_abs(dev, ABS_TILT_X, ((((unsigned int) data[7]) & 0x3f) << 1) | ((data[8] & 0x80) >> 7));
+		input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f);
+	}
+}
+
+static void *wacom_probe(struct usb_device *dev, unsigned int ifnum)
+{
+	struct usb_endpoint_descriptor *endpoint;
+	struct wacom *wacom;
+	char *name;
+
+	if (dev->descriptor.idVendor != USB_VENDOR_ID_WACOM ||
+	   (dev->descriptor.idProduct != USB_DEVICE_ID_WACOM_GRAPHIRE &&
+	    dev->descriptor.idProduct != USB_DEVICE_ID_WACOM_INTUOS))
+		return NULL;
+
+	endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0;
+
+	if (!(wacom = kmalloc(sizeof(struct wacom), GFP_KERNEL))) return NULL;
+	memset(wacom, 0, sizeof(struct wacom));
+
+	switch (dev->descriptor.idProduct) {
+
+		case USB_DEVICE_ID_WACOM_GRAPHIRE:
+
+			wacom->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
+			wacom->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
+			wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE);
+			wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2);
+			wacom->dev.relbit[0] |= BIT(REL_WHEEL);
+			wacom->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_DISTANCE);
+
+			wacom->dev.absmax[ABS_X] = 10206;
+			wacom->dev.absmax[ABS_Y] = 7422;
+			wacom->dev.absmax[ABS_PRESSURE] = 511;
+			wacom->dev.absmax[ABS_DISTANCE] = 32;
+
+			FILL_INT_URB(&wacom->irq, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress),
+					wacom->data, 8, wacom_graphire_irq, wacom, endpoint->bInterval);
+
+			name = "Graphire";
+			break;
+
+		case USB_DEVICE_ID_WACOM_INTUOS:
+
+			wacom->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS);
+			wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS);
+			wacom->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
+			wacom->dev.absbit[0] |= BIT(ABS_TILT_X) | BIT(ABS_TILT_Y);
+
+			wacom->dev.absmax[ABS_X] = 20320;
+			wacom->dev.absmax[ABS_Y] = 16240;
+			wacom->dev.absmax[ABS_PRESSURE] = 1024;
+			wacom->dev.absmax[ABS_TILT_X] = 127;
+			wacom->dev.absmax[ABS_TILT_Y] = 127;
+
+			FILL_INT_URB(&wacom->irq, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress),
+					wacom->data, 8, wacom_intuos_irq, wacom, endpoint->bInterval);
+
+			name = "Intuos";
+			break;
+
+		default:
+			return NULL;
+	}
+
+	if (usb_submit_urb(&wacom->irq)) {
+		kfree(wacom);
+		return NULL;
+	}
+
+	input_register_device(&wacom->dev);
+
+	printk(KERN_INFO "input%d: Wacom %s\n", wacom->dev.number, name);
+
+	return wacom;
+}
+
+static void wacom_disconnect(struct usb_device *dev, void *ptr)
+{
+	struct wacom *wacom = ptr;
+	usb_unlink_urb(&wacom->irq);
+	input_unregister_device(&wacom->dev);
+	kfree(wacom);
+}
+
+static struct usb_driver wacom_driver = {
+	name:		"wacom",
+	probe:		wacom_probe,
+	disconnect:	wacom_disconnect,
+};
+
+static int __init wacom_init(void)
+{
+	usb_register(&wacom_driver);
+	return 0;
+}
+
+static void __exit wacom_exit(void)
+{
+	usb_deregister(&wacom_driver);
+}
+
+module_init(wacom_init);
+module_exit(wacom_exit);
diff -u --recursive --new-file v2.3.48/linux/drivers/video/Config.in linux/drivers/video/Config.in
--- v2.3.48/linux/drivers/video/Config.in	Sat Feb 26 22:31:50 2000
+++ linux/drivers/video/Config.in	Tue Feb 29 11:07:04 2000
@@ -11,7 +11,7 @@
    define_bool CONFIG_DUMMY_CONSOLE y
    if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
       if [ "$CONFIG_PCI" = "y" ]; then
-         bool '  nVidia Riva support (EXPERIMENTAL)' CONFIG_FB_RIVA
+         tristate '  nVidia Riva support (EXPERIMENTAL)' CONFIG_FB_RIVA
       fi
       if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_PCI" = "y" ]; then
 	 tristate '  Cirrus Logic support (EXPERIMENTAL)' CONFIG_FB_CLGEN
@@ -105,10 +105,12 @@
 	    bool '    Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM
 	    bool '    Mystique support' CONFIG_FB_MATROX_MYSTIQUE
 	    bool '    G100/G200/G400 support' CONFIG_FB_MATROX_G100
-	    dep_tristate '      Matrox I2C support' CONFIG_FB_MATROX_I2C $CONFIG_FB_MATROX $CONFIG_I2C_ALGOBIT
-	    if [ "$CONFIG_FB_MATROX_G100" = "y" ]; then
-	       dep_tristate '      G400 second head support' CONFIG_FB_MATROX_MAVEN $CONFIG_FB_MATROX_I2C
-	    fi
+            if [ "$CONFIG_I2C" != "n" ]; then
+	       dep_tristate '      Matrox I2C support' CONFIG_FB_MATROX_I2C $CONFIG_FB_MATROX $CONFIG_I2C_ALGOBIT
+	       if [ "$CONFIG_FB_MATROX_G100" = "y" ]; then
+	          dep_tristate '      G400 second head support' CONFIG_FB_MATROX_MAVEN $CONFIG_FB_MATROX_I2C
+	       fi
+            fi
 	    bool '    Multihead support' CONFIG_FB_MATROX_MULTIHEAD
 	 fi
 	 tristate '  ATI Mach64 display support (EXPERIMENTAL)' CONFIG_FB_ATY
diff -u --recursive --new-file v2.3.48/linux/drivers/video/Makefile linux/drivers/video/Makefile
--- v2.3.48/linux/drivers/video/Makefile	Sat Feb 26 22:31:50 2000
+++ linux/drivers/video/Makefile	Tue Feb 29 11:07:04 2000
@@ -5,7 +5,7 @@
 SUB_DIRS        :=
 MOD_SUB_DIRS    := $(SUB_DIRS)
 MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS    := $(SUB_DIRS) matrox
+ALL_SUB_DIRS    := $(SUB_DIRS) matrox riva
 
 O_TARGET := video.o
 O_OBJS   :=
@@ -16,11 +16,12 @@
 # All of the (potential) objects that export symbols.
 # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
 
-export-objs    :=  fbmem.o fbcmap.o fbcon.o fbcon-afb.o fbcon-ilbm.o fbcon-vga.o \
-		   fbcon-iplan2p2.o fbcon-iplan2p4.o fbcon-iplan2p8.o fbcon-vga-planes.o \
-		   fbcon-cfb16.o fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o fbcon-cfb8.o \
-		   fbcon-mac.o fbcon-mfb.o fbcon-vga8-planes.o \
-		   matrox/matroxfb.o
+export-objs    := fbmem.o fbcmap.o fbcon.o fbcon-afb.o fbcon-ilbm.o \
+		  fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \
+		  fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
+		  fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
+		  fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o fbcon-vga8-planes.o \
+		  matrox/matroxfb.o cyber2000fb.o
 
 # Object file lists.
 obj-y          :=
@@ -62,7 +63,6 @@
 obj-$(CONFIG_FB_CYBER)            += cyberfb.o
 obj-$(CONFIG_FB_CYBER2000)        += cyber2000fb.o
 obj-$(CONFIG_FB_SGIVW)            += sgivwfb.o
-obj-$(CONFIG_FB_RIVA)             += rivafb.o riva_hw.o
 obj-$(CONFIG_FB_3DFX)             += tdfxfb.o
 obj-$(CONFIG_FB_MAC)              += macfb.o macmodes.o
 obj-$(CONFIG_FB_HP300)            += hpfb.o
@@ -96,6 +96,16 @@
 else
   ifeq ($(CONFIG_FB_MATROX),m)
   MOD_SUB_DIRS			  += matrox
+  endif
+endif
+
+ifeq ($(CONFIG_FB_RIVA),y)
+SUB_DIRS			  += riva
+obj-y				  += riva/rivafb.o
+MOD_SUB_DIRS			  += riva
+else
+  ifeq ($(CONFIG_FB_RIVA),m)
+  MOD_SUB_DIRS			  += riva
   endif
 endif
 
diff -u --recursive --new-file v2.3.48/linux/drivers/video/aty128fb.c linux/drivers/video/aty128fb.c
--- v2.3.48/linux/drivers/video/aty128fb.c	Sat Feb 26 22:31:50 2000
+++ linux/drivers/video/aty128fb.c	Tue Feb 29 11:07:04 2000
@@ -1,13 +1,8 @@
 /* $Id: aty128fb.c,v 1.1.1.1.36.1 1999/12/11 09:03:05 Exp $
  *  linux/drivers/video/aty128fb.c -- Frame buffer device for ATI Rage128
  *
- *  Copyright (C) 1999-2000, Anthony Tong <atong@uiuc.edu>
- *
- *                Brad Douglas <brad@neruo.com>
- *				- x86 support
- *				- MTRR
- *				- Probe ROM for PLL
- *				- modedb
+ *  Copyright (C) 1999-2000, Brad Douglas <brad@neruo.com>
+ *  Copyright (C) 1999, Anthony Tong <atong@uiuc.edu>
  *
  *                Ani Joshi / Jeff Garzik
  *                      - Code cleanup
@@ -23,7 +18,7 @@
  *		- determine MCLK from previous setting -done for x86            
  *              - calculate XCLK, rather than probe BIOS
  *		- hardware cursor support
- *              - acceleration
+ *              - acceleration (do not use with Rage128 Pro!)
  *		- ioctl()'s
  */
 
@@ -56,7 +51,9 @@
 #if defined(CONFIG_PPC)
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
+#ifdef CONFIG_NVRAM
 #include <linux/nvram.h>
+#endif
 #include <video/macmodes.h>
 #endif
 
@@ -76,16 +73,6 @@
 
 #include "aty128.h"
 
-/* compatibility with older kernels */
-#ifndef LINUX_VERSION_CODE
-#include <linux/version.h>
-#endif
-
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(x,y,z) (((x)<<16)+(y)<<8)+(z))
-#endif
-
-
 /* Debug flag */
 #undef DEBUG
 
@@ -104,7 +91,6 @@
     0, FB_VMODE_NONINTERLACED
 };
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
 #ifndef MODULE
 /* default modedb mode */
 static struct fb_videomode defaultmode __initdata = {
@@ -113,7 +99,6 @@
     0, FB_VMODE_NONINTERLACED
 };
 #endif
-#endif
 
 /* chip description information */
 struct aty128_chip_info {
@@ -192,10 +177,15 @@
 static const char *mode_option __initdata = NULL;
 #endif
 
-#if defined(CONFIG_PPC)
+#ifdef CONFIG_PPC
+#ifdef CONFIG_NVRAM_NOT_DEFINED
+static int default_vmode __initdata = VMODE_NVRAM;
+static int default_cmode __initdata = CMODE_NVRAM;
+#else
 static int default_vmode __initdata = VMODE_CHOOSE;
 static int default_cmode __initdata = CMODE_8;
 #endif
+#endif
 
 #ifdef CONFIG_MTRR
 static int mtrr = 1;
@@ -313,10 +303,7 @@
      *  Interface to the low level console driver
      */
 
-void aty128fb_init(void);
-#ifdef CONFIG_FB_OF
-void aty128fb_of_init(struct device_node *dp);
-#endif
+int aty128fb_init(void);
 static int aty128fbcon_switch(int con, struct fb_info *info);
 static void aty128fbcon_blank(int blank, struct fb_info *info);
 
@@ -334,11 +321,8 @@
 static int aty128_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 				u_int transp, struct fb_info *info);
 static void do_install_cmap(int con, struct fb_info *info);
-#ifndef CONFIG_FB_OF
-static void aty128pci_probe(void);
 static int aty128_pci_register(struct pci_dev *pdev,
                                const struct aty128_chip_info *aci);
-#endif
 static struct fb_info_aty128 *aty128_board_list_add(struct fb_info_aty128
 				*board_list, struct fb_info_aty128 *new_node);
 #ifndef CONFIG_PPC
@@ -1444,10 +1428,16 @@
     memset(fix, 0, sizeof(struct fb_fix_screeninfo));
     
     strcpy(fix->id, aty128fb_name);
-    fix->smem_start = (long)info->frame_buffer_phys;
-    fix->smem_len = (u32)info->vram_size;
 
+#ifdef CONFIG_PPC /* why?  I don't know */
+    *fix->smem_start = (long)info->frame_buffer_phys;
+    *fix->mmio_start = (long)info->regbase_phys;
+#else
+    fix->smem_start = (long)info->frame_buffer_phys;
     fix->mmio_start = (long)info->regbase_phys;
+#endif
+
+    fix->smem_len = (u32)info->vram_size;
     fix->mmio_len = 0x1fff;
 
     fix->type = FB_TYPE_PACKED_PIXELS;
@@ -1673,7 +1663,7 @@
     int j, k;
     u8 chip_rev;
     const struct aty128_chip_info *aci = &aty128_pci_probe_list[0];
-    char *video_card = NULL;
+    char *video_card = "Rage128";
 
     if (!register_test(info)) {
 	printk(KERN_ERR "aty128fb: Can't write to video registers\n");
@@ -1712,23 +1702,29 @@
     var = default_var;
 #else
     memset(&var, 0, sizeof(var));
+#ifdef CONFIG_NVRAM
+    if (default_vmode == VMODE_NVRAM) {
+        default_vmode = nvram_read_byte(NV_VMODE);
+        if (default_vmode <= 0 || default_vmode > VMODE_MAX)
+            default_vmode = VMODE_CHOOSE;
+    }
+#endif
 #ifdef CONFIG_PPC
     if (default_vmode == VMODE_CHOOSE) {
         var = default_var;
 #endif /* CONFIG_PPC */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
 	if (!fb_find_mode(&var, &info->fb_info, mode_option, NULL, 0,
 			  &defaultmode, initdepth))
 	    var = default_var;
-#endif
 
 #ifdef CONFIG_PPC
-    } else {
-        if (mac_vmode_to_var(default_vmode, default_cmode, &var))
-            var = default_var;
+#ifdef CONFIG_NVRAM
+    if (default_cmode == CMODE_NVRAM)
+        default_cmode = nvram_read_byte(NV_CMODE);
+#endif
     }
-#endif /* CONFIG_PPC */
+#endif
 #endif /* MODULE */
 
     if (noaccel)
@@ -1737,7 +1733,7 @@
         var.accel_flags |= FB_ACCELF_TEXT;
 
     if (aty128_decode_var(&var, &info->default_par, info)) {
-	printk(KERN_ERR "Cannot set default mode.\n");
+	printk(KERN_ERR "aty128fb: Cannot set default mode.\n");
 	return 0;
     }
 
@@ -1790,21 +1786,10 @@
 }
 
 
-void __init
+int __init
 aty128fb_init(void)
 {
-#if defined(CONFIG_FB_OF)
-    /* let offb handle init */
-#elif defined (CONFIG_PCI)
-    aty128pci_probe();
-#endif
-}
-
-
-#ifndef CONFIG_FB_OF
-void __init
-aty128pci_probe(void)
-{
+#ifdef CONFIG_PCI
     struct pci_dev *pdev = NULL;
     const struct aty128_chip_info *aci = &aty128_pci_probe_list[0];
 
@@ -1812,16 +1797,18 @@
         pdev = pci_find_device(PCI_VENDOR_ID_ATI, aci->device, pdev);
         while (pdev != NULL) {
             if (aty128_pci_register(pdev, aci) == 0)
-                return;
+                return 0;
             pdev = pci_find_device(PCI_VENDOR_ID_ATI, aci->device, pdev);
         }
 	aci++;
     }
+#endif
 
-    return;
+    return 0;
 }
 
 
+#ifdef CONFIG_PCI
 /* register a card    ++ajoshi */
 static int __init
 aty128_pci_register(struct pci_dev *pdev,
@@ -1831,31 +1818,27 @@
     unsigned long fb_addr, reg_addr = 0;
     u16 tmp;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
     struct resource *rp;
 
     rp = &pdev->resource[0];
     fb_addr = rp->start;
     fb_addr &= PCI_BASE_ADDRESS_MEM_MASK;
 
-    request_mem_region(rp->start, rp->end - rp->start + 1, "aty128fb");
-
-    rp = &pdev->resource[2];
-    reg_addr = rp->start;
-    reg_addr &= PCI_BASE_ADDRESS_MEM_MASK;
-
-    if (!reg_addr) {
+    if (!request_mem_region(rp->start, rp->end - rp->start + 1,
+                            "aty128fb FB")) {
         release_mem_region(pdev->resource[0].start,
                            pdev->resource[0].end -
                            pdev->resource[0].start + 1);
         return -1;
     }
-#else
-    fb_addr = pdev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK;
-    reg_addr = pdev->base_address[2] & PCI_BASE_ADDRESS_MEM_MASK;
-    if (!reg_addr)
-        return -1;
-#endif
+
+    rp = &pdev->resource[2];
+    reg_addr = rp->start;
+    reg_addr &= PCI_BASE_ADDRESS_MEM_MASK;
+
+    if (!request_mem_region(rp->start, rp->end - rp->start + 1,
+                            "aty128fb MMIO"))
+        goto unmap_out;
 
     info = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC);
     if(!info) {
@@ -1917,18 +1900,16 @@
 err_out:
     kfree(info);
 unmap_out:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
     release_mem_region(pdev->resource[0].start,
 			pdev->resource[0].end -
 			pdev->resource[0].start + 1);
     release_mem_region(pdev->resource[2].start,
 			pdev->resource[2].end -
 			pdev->resource[2].start + 1);
-#endif
 
     return -1;
 }
-#endif /* ! CONFIG_FB_OF */
+#endif /* CONFIG_PCI */
 
 
 #ifndef CONFIG_PPC
@@ -2062,76 +2043,6 @@
 #endif /* ! CONFIG_PPC */
 
 
-#ifdef CONFIG_FB_OF
-void __init
-aty128fb_of_init(struct device_node *dp)
-{
-    unsigned long addr, reg_addr, fb_addr;
-    struct fb_info_aty128 *info;
-    u8 bus, devfn;
-    u16 cmd;
-
-    switch (dp->n_addrs) {
-    case 3:
-	fb_addr = dp->addrs[0].address;
-	reg_addr = dp->addrs[2].address;
-	break;
-    default:
-	printk(KERN_ERR "aty128fb: TODO unexpected addresses\n");
-	return;
-    }
-
-    addr = (unsigned long) ioremap(reg_addr, 0x1FFF);
-    if (!addr) {
-	printk(KERN_ERR "aty128fb: can't map memory registers\n");
-	return;
-    }
-
-    info = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC);
-    if (!info) {
-	printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n");
-	return;
-    }
-    memset((void *) info, 0, sizeof(struct fb_info_aty128));
-
-    info->regbase_phys = reg_addr;
-    info->regbase = (void *) addr;
-
-    /* enabled memory-space accesses using config-space command register */
-    if (pci_device_loc(dp, &bus, &devfn) == 0) {
-	pcibios_read_config_word(bus, devfn, PCI_COMMAND, &cmd);
-	if (!(cmd & PCI_COMMAND_MEMORY)) {
-	    cmd |= PCI_COMMAND_MEMORY;
-	    pcibios_write_config_word(bus, devfn, PCI_COMMAND, cmd);
-	}
-    }
-
-    info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
-    info->frame_buffer_phys = fb_addr;
-    info->frame_buffer = (void *) ioremap(fb_addr, info->vram_size);
-
-    if (!info->frame_buffer) {
-        printk(KERN_ERR "aty128fb: can't map frame buffer\n");
-        kfree(info);
-        return;
-    }
-
-    /* fall back to defaults */
-    aty128_timings(info);
-
-    if (!aty128_init(info, dp->full_name)) {
-	kfree(info);
-	return;
-    }
-
-#ifdef CONFIG_FB_COMPAT_XPMAC
-    if (!console_fb_info)
-	console_fb_info = &info->fb_info;
-#endif
-}
-#endif /* CONFIG_FB_OF */
-
-
 /* fill in known card constants if pll_block is not available */
 static void __init
 aty128_timings(struct fb_info_aty128 *info)
@@ -2572,7 +2483,7 @@
 int __init
 init_module(void)
 {
-    aty128pci_probe();
+    aty128fb_init();
     return 0;
 }
 
@@ -2594,14 +2505,12 @@
         iounmap(info->regbase);
         iounmap(&info->frame_buffer);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
         release_mem_region(info->pdev->resource[0].start,
                            info->pdev->resource[0].end -
                            info->pdev->resource[0].start + 1);
         release_mem_region(info->pdev->resource[2].start,
                            info->pdev->resource[2].end -
                            info->pdev->resource[2].start + 1);
-#endif
 
         kfree(info);
     }
diff -u --recursive --new-file v2.3.48/linux/drivers/video/clgenfb.c linux/drivers/video/clgenfb.c
--- v2.3.48/linux/drivers/video/clgenfb.c	Fri Jan 28 15:09:08 2000
+++ linux/drivers/video/clgenfb.c	Thu Mar  2 11:35:12 2000
@@ -31,7 +31,7 @@
  *
  */
 
-#define CLGEN_VERSION "1.9.4.4"
+#define CLGEN_VERSION "1.9.4.5"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -46,7 +46,6 @@
 #include <linux/init.h>
 #include <linux/selection.h>
 #include <asm/pgtable.h>
-#include <asm/delay.h>
 #include <asm/io.h>
 #ifdef CONFIG_ZORRO
 #include <linux/zorro.h>
diff -u --recursive --new-file v2.3.48/linux/drivers/video/cyber2000fb.c linux/drivers/video/cyber2000fb.c
--- v2.3.48/linux/drivers/video/cyber2000fb.c	Thu Feb 10 17:11:15 2000
+++ linux/drivers/video/cyber2000fb.c	Sun Feb 27 08:51:11 2000
@@ -1,6 +1,8 @@
 /*
  * linux/drivers/video/cyber2000fb.c
  *
+ * Copyright (C) 1998-2000 Russell King
+ *
  * Integraphics Cyber2000 frame buffer device
  *
  * Based on cyberfb.c
diff -u --recursive --new-file v2.3.48/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- v2.3.48/linux/drivers/video/fbmem.c	Wed Feb 16 17:03:52 2000
+++ linux/drivers/video/fbmem.c	Tue Feb 29 11:55:01 2000
@@ -247,15 +247,20 @@
 			   int len, int *eof, void *private)
 {
 	struct fb_info **fi;
+	int clen;
 
-	len = 0;
+	clen = 0;
 	for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)
 		if (*fi)
-			len += sprintf(buf + len, "%d %s\n",
-				       GET_FB_IDX((*fi)->node),
-				       (*fi)->modename);
+			clen += sprintf(buf + clen, "%d %s\n",
+				        GET_FB_IDX((*fi)->node),
+				        (*fi)->modename);
 	*start = buf + offset;
-	return len > offset ? len - offset : 0;
+	if (clen > offset)
+		clen -= offset;
+	else
+		clen = 0;
+	return clen < len ? clen : len;
 }
 
 static ssize_t
diff -u --recursive --new-file v2.3.48/linux/drivers/video/matrox/matroxfb_base.c linux/drivers/video/matrox/matroxfb_base.c
--- v2.3.48/linux/drivers/video/matrox/matroxfb_base.c	Sat Feb 26 22:31:51 2000
+++ linux/drivers/video/matrox/matroxfb_base.c	Tue Feb 29 11:56:13 2000
@@ -1954,6 +1954,7 @@
 	struct matrox_fb_info* minfo;
 	struct display* d;
 	int err;
+	u_int32_t cmd;
 #ifndef CONFIG_FB_MATROX_MULTIHEAD
 	static int registered = 0;
 #endif
@@ -1976,6 +1977,7 @@
 		dev--;
 		return -1;
 	}
+	pci_read_config_dword(pdev, PCI_COMMAND, &cmd);
 	if (pci_enable_device(pdev)) {
 		return -1;
 	}
@@ -2008,9 +2010,19 @@
 	memcpy(ACCESS_FBINFO(fbcon.fontname), fontname, sizeof(ACCESS_FBINFO(fbcon.fontname)));
 	/* DEVFLAGS */
 	ACCESS_FBINFO(devflags.inverse) = inverse;
-	ACCESS_FBINFO(devflags.novga) = novga;
-	ACCESS_FBINFO(devflags.nobios) = nobios;
-	ACCESS_FBINFO(devflags.noinit) = noinit;
+	if (cmd & PCI_COMMAND_MEMORY) {
+		ACCESS_FBINFO(devflags.novga) = novga;
+		ACCESS_FBINFO(devflags.nobios) = nobios;
+		ACCESS_FBINFO(devflags.noinit) = noinit;
+		/* subsequent heads always needs initialization and must not enable BIOS */
+		novga = 1;
+		nobios = 1;
+		noinit = 0;
+	} else {
+		ACCESS_FBINFO(devflags.novga) = 1;
+		ACCESS_FBINFO(devflags.nobios) = 1;
+		ACCESS_FBINFO(devflags.noinit) = 0;
+	}
 	ACCESS_FBINFO(devflags.nopciretry) = no_pci_retry;
 	ACCESS_FBINFO(devflags.mga_24bpp_fix) = inv24;
 	ACCESS_FBINFO(devflags.precise_width) = option_precise_width;
@@ -2033,13 +2045,11 @@
 	ACCESS_FBINFO(output.ph) = MATROXFB_OUTPUT_CONN_PRIMARY;
 	ACCESS_FBINFO(output.sh) = 0;
 
-	/* subsequent heads always needs initialization and must not enable BIOS */
-	noinit = 0;
-	nobios = 1;
-	novga = 1;
-
 	err = initMatrox2(PMINFO d, b);
 	if (!err) {
+#ifndef CONFIG_FB_MATROX_MULTIHEAD
+		registered = 1;
+#endif
 		matroxfb_register_device(MINFO);
 		return 0;
 	}
diff -u --recursive --new-file v2.3.48/linux/drivers/video/nv4ref.h linux/drivers/video/nv4ref.h
--- v2.3.48/linux/drivers/video/nv4ref.h	Sun Nov  7 16:37:34 1999
+++ linux/drivers/video/nv4ref.h	Wed Dec 31 16:00:00 1969
@@ -1,2445 +0,0 @@
- /***************************************************************************\
-|*                                                                           *|
-|*       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 <jgarzik@mandrakesoft.com>, 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.48/linux/drivers/video/nvreg.h linux/drivers/video/nvreg.h
--- v2.3.48/linux/drivers/video/nvreg.h	Sun Nov  7 16:37:34 1999
+++ linux/drivers/video/nvreg.h	Wed Dec 31 16:00:00 1969
@@ -1,188 +0,0 @@
-/* $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.48/linux/drivers/video/riva/Makefile linux/drivers/video/riva/Makefile
--- v2.3.48/linux/drivers/video/riva/Makefile	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/Makefile	Tue Feb 29 11:07:04 2000
@@ -0,0 +1,14 @@
+#
+# Makefile for the Riva framebuffer driver
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+O_TARGET := rivafb.o
+O_OBJS   := fbdev.o riva_hw.o
+M_OBJS   := $(O_TARGET)
+
+include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.48/linux/drivers/video/riva/fbdev.c linux/drivers/video/riva/fbdev.c
--- v2.3.48/linux/drivers/video/riva/fbdev.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/fbdev.c	Tue Feb 29 11:07:04 2000
@@ -0,0 +1,1705 @@
+/*
+ * linux/drivers/video/rivafb.c - nVidia RIVA 128/TNT/TNT2 fb driver
+ *
+ * Copyright 1999 Jeff Garzik <jgarzik@mandrakesoft.com>
+ *
+ * Contributors:
+ *
+ *	Ani Joshi:  Lots of debugging and cleanup work, really helped
+ *	get the driver going
+ *
+ *	Ferenc Bakonyi:  Bug fixes, cleanup, modularization
+ *
+ * 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.7.0"
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/selection.h>
+#include <linux/tty.h>
+#include <linux/malloc.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+
+#include <video/fbcon.h>
+
+#include "riva_hw.h"
+#include "nv4ref.h"
+#include "nvreg.h"
+#include "../vga.h"
+#include <video/fbcon-cfb4.h>
+#include <video/fbcon-cfb8.h>
+#include <video/fbcon-cfb16.h>
+#include <video/fbcon-cfb32.h>
+
+#ifndef CONFIG_PCI		/* sanity check */
+#error This driver requires PCI support.
+#endif
+
+/*****************************************************************
+ *
+ * various helpful macros and constants
+ *
+ */
+
+/* #define RIVAFBDEBUG */
+#ifdef RIVAFBDEBUG
+#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
+#else
+#define DPRINTK(fmt, args...)
+#endif
+
+#ifndef RIVA_NDEBUG
+#define assert(expr) \
+	if(!(expr)) { \
+        printk( "Assertion failed! %s,%s,%s,line=%d\n",\
+        #expr,__FILE__,__FUNCTION__,__LINE__); \
+	*(int*)0 = 0; \
+        }
+#else
+#define assert(expr)
+#endif
+
+/* GGI compatibility macros */
+#define io_out8			outb
+#define io_in8			inb
+#define NUM_SEQ_REGS		0x05
+#define NUM_CRT_REGS		0x41
+#define NUM_GRC_REGS		0x09
+#define NUM_ATC_REGS		0x15
+
+#define PFX "rivafb: "
+
+#define CNVT_TOHW(val,width)	((((val)<<(width))+0x7FFF-(val))>>16)
+
+/* macro that allows you to set overflow bits */
+#define SetBitField(value,from,to) SetBF(to,GetBF(value,from))
+#define SetBit(n)		(1<<(n))
+#define Set8Bits(value)		((value)&0xff)
+
+
+enum riva_chips {
+	CH_RIVA_128 = 0,
+	CH_RIVA_TNT,
+	CH_RIVA_TNT2,
+	CH_RIVA_UTNT2,	/* UTNT2 */
+	CH_RIVA_VTNT2,	/* VTNT2 */
+	CH_RIVA_ITNT2,	/* ITNT2 */
+};
+
+
+/* directly indexed by riva_chips enum, above */
+static struct riva_chip_info {
+	const char *name;
+	unsigned arch_rev;
+} riva_chip_info[] __devinitdata = {
+	{ "RIVA-128", 3 },
+	{ "RIVA-TNT", 4 },
+	{ "RIVA-TNT2", 5 },
+	{ "RIVA-UTNT2", 5 },
+	{ "RIVA-VTNT2", 5 },
+	{ "RIVA-ITNT2", 5 },
+};
+
+
+static struct pci_device_id rivafb_pci_tbl[] __devinitdata = {
+	{ PCI_VENDOR_ID_NVIDIA_SGS, PCI_DEVICE_ID_NVIDIA_SGS_RIVA128, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_128 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_TNT },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_TNT2 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_UTNT2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_UTNT2 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_VTNT2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_VTNT2 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_ITNT2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_ITNT2 },
+	{ 0, }, /* terminate list */
+};
+MODULE_DEVICE_TABLE(pci, rivafb_pci_tbl);
+
+
+/* holds the state of the VGA core and extended Riva hw state from riva_hw.c.
+ * From KGI originally. */
+struct riva_regs {
+	u8 attr[NUM_ATC_REGS];
+	u8 crtc[NUM_CRT_REGS];
+	u8 gra[NUM_GRC_REGS];
+	u8 seq[NUM_SEQ_REGS];
+	u8 misc_output;
+	RIVA_HW_STATE ext;
+};
+
+
+/*
+ * describes the state of a Riva board
+ */
+struct rivafb_par {
+	struct riva_regs state;	/* state of hw board */
+	__u32 visual;		/* FB_VISUAL_xxx */
+	unsigned depth;		/* bpp of current mode */
+};
+
+typedef struct {
+	unsigned char red, green, blue, transp;
+} riva_cfb8_cmap_t;
+
+
+
+struct rivafb_info;
+struct rivafb_info {
+	struct fb_info info;	/* kernel framebuffer info */
+
+	RIVA_HW_INST riva;	/* interface to riva_hw.c */
+
+	const char *drvr_name;	/* Riva hardware board type */
+
+	unsigned long ctrl_base_phys;	/* physical control register base addr */
+	unsigned long fb_base_phys;	/* physical framebuffer base addr */
+
+	caddr_t ctrl_base;	/* virtual control register base addr */
+	caddr_t fb_base;	/* virtual framebuffer base addr */
+
+	unsigned ram_amount;	/* amount of RAM on card, in bytes */
+	unsigned dclk_max;	/* max DCLK */
+
+	struct riva_regs initial_state;	/* initial startup video mode */
+
+	struct display disp;
+	int currcon;
+	struct display *currcon_display;
+
+	struct rivafb_info *next;
+
+	struct pci_dev *pd;	/* pointer to board's pci info */
+	unsigned base0_region_size;	/* size of control register region */
+	unsigned base1_region_size;	/* size of framebuffer region */
+
+	riva_cfb8_cmap_t palette[256];	/* VGA DAC palette cache */
+
+#if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB32)
+	union {
+#ifdef FBCON_HAS_CFB16
+		u_int16_t cfb16[16];
+#endif
+#ifdef FBCON_HAS_CFB32
+		u_int32_t cfb32[16];
+#endif
+	} con_cmap;
+#endif				/* FBCON_HAS_CFB16 | FBCON_HAS_CFB32 */
+};
+
+/* ------------------- global variables ------------------------ */
+
+
+static struct rivafb_info *riva_boards = NULL;
+
+/* command line data, set in rivafb_setup() */
+static char fontname[40] __initdata;
+#ifndef MODULE
+static char noaccel __initdata;	/* unused */
+static const char *mode_option __initdata;
+#endif
+
+static struct fb_var_screeninfo rivafb_default_var = {
+	/* 640x480-8@60, yres_virtual=2400 (fits for all Riva cards */
+	640, 480, 640, 2400, 0, 0, 8, 0,
+	{0, 6, 0}, {0, 6, 0}, {0, 6, 0}, {0, 0, 0},
+	0, 0, -1, -1, 0, 39721, 40, 24, 32, 11, 96, 2,
+	0, FB_VMODE_NONINTERLACED
+};
+
+
+/* ------------------- prototypes ------------------------------ */
+
+static int rivafb_open (struct fb_info *info, int user);
+static int rivafb_release (struct fb_info *info, int user);
+static int rivafb_get_fix (struct fb_fix_screeninfo *fix, int con,
+		    struct fb_info *info);
+static int rivafb_get_var (struct fb_var_screeninfo *var, int con,
+		    struct fb_info *info);
+static int rivafb_set_var (struct fb_var_screeninfo *var, int con,
+		    struct fb_info *info);
+static int rivafb_get_cmap (struct fb_cmap *cmap, int kspc, int con,
+		     struct fb_info *info);
+static int rivafb_set_cmap (struct fb_cmap *cmap, int kspc, int con,
+		     struct fb_info *info);
+static int rivafb_pan_display (struct fb_var_screeninfo *var, int con,
+			struct fb_info *info);
+static int rivafb_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
+		  unsigned long arg, int con, struct fb_info *info);
+static int rivafb_switch (int con, struct fb_info *info);
+static int rivafb_updatevar (int con, struct fb_info *info);
+static void rivafb_blank (int blank, struct fb_info *info);
+
+static void riva_load_video_mode (struct rivafb_info *rivainfo,
+				  struct fb_var_screeninfo *video_mode);
+static int riva_getcolreg (unsigned regno, unsigned *red, unsigned *green,
+			   unsigned *blue, unsigned *transp,
+			   struct fb_info *info);
+static int riva_setcolreg (unsigned regno, unsigned red, unsigned green,
+			   unsigned blue, unsigned transp,
+			   struct fb_info *info);
+static int riva_get_cmap_len (const struct fb_var_screeninfo *var);
+
+static int riva_pci_register (struct pci_dev *pd,
+			      const struct riva_chip_info *rci);
+static int riva_set_fbinfo (struct rivafb_info *rinfo);
+
+static void riva_save_state (struct rivafb_info *rinfo, struct riva_regs *regs);
+static void riva_load_state (struct rivafb_info *rinfo, struct riva_regs *regs);
+static struct rivafb_info *riva_board_list_add (struct rivafb_info *board_list,
+					 struct rivafb_info *new_node);
+static void riva_wclut (unsigned char regnum, unsigned char red,
+			unsigned char green, unsigned char blue);
+
+
+
+
+/* kernel interface */
+static struct fb_ops riva_fb_ops = {
+	rivafb_open,
+	rivafb_release,
+	rivafb_get_fix,
+	rivafb_get_var,
+	rivafb_set_var,
+	rivafb_get_cmap,
+	rivafb_set_cmap,
+	rivafb_pan_display,
+	rivafb_ioctl
+};
+
+
+
+
+/* from GGI */
+static const struct riva_regs reg_template = {
+	{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,	/* ATTR */
+	 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+	 0x41, 0x01, 0x0F, 0x13, 0x00},
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	/* CRT  */
+	 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
+	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3,	/* 0x10 */
+	 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	/* 0x20 */
+	 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	/* 0x30 */
+	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	 0x00,			/* 0x40 */
+	 },
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,	/* GRA  */
+	 0xFF},
+	{0x03, 0x01, 0x0F, 0x00, 0x0E},	/* SEQ  */
+	0xEB			/* MISC */
+};
+
+
+
+/* ------------------- general utility functions -------------------------- */
+
+/**
+ * riva_set_dispsw
+ * @rivainfo: pointer to internal driver struct for a given Riva card
+ *
+ * DESCRIPTION:
+ * Sets up console Low level operations depending on the current? color depth
+ * of the display
+ */
+
+static void riva_set_dispsw (struct rivafb_info *rinfo)
+{
+	struct display *disp = &rinfo->disp;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rinfo != NULL);
+
+	disp->dispsw_data = NULL;
+
+	switch (disp->var.bits_per_pixel) {
+#ifdef FBCON_HAS_MFB
+	case 1:
+		disp->dispsw = &fbcon_mfb;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB4
+	case 4:
+		disp->dispsw = &fbcon_cfb4;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB8
+	case 8:
+		disp->dispsw = &fbcon_cfb8;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB16
+	case 15:
+	case 16:
+		disp->dispsw = &fbcon_cfb16;
+		disp->dispsw_data = &rinfo->con_cmap.cfb16;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB24
+	case 24:
+		disp->dispsw = &fbcon_cfb24;
+		disp->dispsw_data = rinfo->con_cmap.cfb24;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB32
+	case 32:
+		disp->dispsw = &fbcon_cfb32;
+		disp->dispsw_data = rinfo->con_cmap.cfb32;
+		break;
+#endif
+	default:
+		DPRINTK ("Setting fbcon_dummy renderer\n");
+		disp->dispsw = &fbcon_dummy;
+	}
+
+	DPRINTK ("EXIT\n");
+}
+
+
+
+
+static int riva_init_disp_var (struct rivafb_info *rinfo)
+{
+#ifndef MODULE
+	if (mode_option)
+		fb_find_mode (&rinfo->disp.var, &rinfo->info, mode_option,
+			      NULL, 0, NULL, 8);
+	else
+		fb_find_mode (&rinfo->disp.var, &rinfo->info,
+			      "640x480-8@60", NULL, 0, NULL, 8);
+#endif				/* !MODULE */
+	return 0;
+}
+
+
+
+
+static int __devinit riva_init_disp (struct rivafb_info *rinfo)
+{
+	struct fb_info *info;
+	struct display *disp;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rinfo != NULL);
+
+	info = &rinfo->info;
+	disp = &rinfo->disp;
+
+	disp->var = rivafb_default_var;
+	info->disp = disp;
+
+#warning FIXME: assure that disp->cmap is completely filled out
+
+	disp->screen_base = rinfo->fb_base;
+	disp->visual = FB_VISUAL_PSEUDOCOLOR;
+	disp->type = FB_TYPE_PACKED_PIXELS;
+	disp->type_aux = 0;
+	disp->ypanstep = 1;
+	disp->ywrapstep = 0;
+	disp->next_line = disp->line_length =
+	    (disp->var.xres_virtual * disp->var.bits_per_pixel) >> 3;
+	disp->can_soft_blank = 1;
+	disp->inverse = 0;
+
+	riva_set_dispsw (rinfo);
+
+	disp->scrollmode = 0;
+
+	rinfo->currcon_display = disp;
+
+	if ((riva_init_disp_var (rinfo)) < 0) {	/* must be done last */
+		DPRINTK ("EXIT, returning -1\n");
+		return -1;
+	}
+
+	DPRINTK ("EXIT, returning 0\n");
+	return 0;
+
+}
+
+
+
+static int __devinit riva_set_fbinfo (struct rivafb_info *rinfo)
+{
+	struct fb_info *info;
+
+	assert (rinfo != NULL);
+
+	info = &rinfo->info;
+
+	strcpy (info->modename, rinfo->drvr_name);
+	info->node = -1;
+	info->flags = FBINFO_FLAG_DEFAULT;
+	info->fbops = &riva_fb_ops;
+
+#warning FIXME: set monspecs to what???
+
+	info->display_fg = NULL;	/* FIXME: correct? */
+	strncpy (info->fontname, fontname, sizeof (info->fontname));
+	info->fontname[sizeof (info->fontname) - 1] = 0;
+
+	info->changevar = NULL;	/* FIXME: needed? */
+	info->switch_con = rivafb_switch;
+	info->updatevar = rivafb_updatevar;
+	info->blank = rivafb_blank;
+
+	if (riva_init_disp (rinfo) < 0)	/* must be done last */
+		return -1;
+
+	return 0;
+}
+
+
+
+
+/* ----------------------------- PCI bus ----------------------------- */
+
+
+
+
+static void __devinit riva_init_clut (struct rivafb_info *fb_info)
+{
+	int j, k, red, green, blue;
+
+	for (j = 0; j < 256; j++) {
+		if (j < 16) {
+			/* use default fbcon colors for first 16 */
+			k = color_table[j];
+			red = default_red[k];
+			green = default_grn[k];
+			blue = default_blu[k];
+		} else {
+			/* grey ramp for rest of colors */
+			red = green = blue = j;
+		}
+
+		riva_wclut (j, red, green, blue);
+
+		fb_info->palette[j].red = red;
+		fb_info->palette[j].green = green;
+		fb_info->palette[j].blue = blue;
+	}
+}
+
+
+
+static int __devinit rivafb_init_one (struct pci_dev *pd,
+				      const struct pci_device_id *ent)
+{
+	struct rivafb_info *rinfo;
+	struct riva_chip_info *rci = &riva_chip_info[ent->driver_data];
+
+	assert (pd != NULL);
+	assert (rci != NULL);
+
+	rinfo = kmalloc (sizeof (struct rivafb_info), GFP_KERNEL);
+	if (!rinfo)
+		goto err_out;
+
+	memset (rinfo, 0, sizeof (struct rivafb_info));
+
+	rinfo->drvr_name = rci->name;
+	rinfo->riva.Architecture = rci->arch_rev;
+
+	rinfo->pd = pd;
+	rinfo->base0_region_size = pci_resource_start (pd, 0);
+	rinfo->base1_region_size = pci_resource_start (pd, 1);
+
+	assert (rinfo->base0_region_size >= 0x00800000);	/* from GGI */
+	assert (rinfo->base0_region_size >= 0x01000000);	/* from GGI */
+
+	rinfo->ctrl_base_phys = rinfo->pd->resource[0].start;
+	rinfo->fb_base_phys = rinfo->pd->resource[1].start;
+
+	if (!request_mem_region (rinfo->ctrl_base_phys,
+				 rinfo->base0_region_size, "rivafb")) {
+		printk (KERN_ERR PFX "cannot reserve MMIO region\n");
+		goto err_out_kfree;
+	}
+
+	if (!request_mem_region (rinfo->fb_base_phys,
+				 rinfo->base1_region_size, "rivafb")) {
+		printk (KERN_ERR PFX "cannot reserve FB region\n");
+		goto err_out_free_base0;
+	}
+
+	rinfo->ctrl_base = ioremap (rinfo->ctrl_base_phys,
+				    rinfo->base0_region_size);
+	if (!rinfo->ctrl_base) {
+		printk (KERN_ERR PFX "cannot ioremap ctrl base\n");
+		goto err_out_free_base1;
+	}
+	
+	rinfo->fb_base = ioremap (rinfo->fb_base_phys,
+				  rinfo->base1_region_size);
+	if (!rinfo->fb_base) {
+		printk (KERN_ERR PFX "cannot ioremap ctrl base\n");
+		goto err_out_iounmap_ctrl;
+	}
+	
+	rinfo->riva.EnableIRQ = 0;
+	rinfo->riva.IO = (inb (0x3CC) & 0x01) ? 0x3D0 : 0x3B0;
+	rinfo->riva.PRAMDAC = (unsigned *) (rinfo->ctrl_base + 0x00680000);
+	rinfo->riva.PFB = (unsigned *) (rinfo->ctrl_base + 0x00100000);
+	rinfo->riva.PFIFO = (unsigned *) (rinfo->ctrl_base + 0x00002000);
+	rinfo->riva.PGRAPH = (unsigned *) (rinfo->ctrl_base + 0x00400000);
+	rinfo->riva.PEXTDEV = (unsigned *) (rinfo->ctrl_base + 0x00101000);
+	rinfo->riva.PTIMER = (unsigned *) (rinfo->ctrl_base + 0x00009000);
+	rinfo->riva.PMC = (unsigned *) (rinfo->ctrl_base + 0x00000000);
+	rinfo->riva.FIFO = (unsigned *) (rinfo->ctrl_base + 0x00800000);
+
+	switch (rinfo->riva.Architecture) {
+	case 3:
+		rinfo->riva.PRAMIN =
+		    (unsigned *) (rinfo->ctrl_base + 0x00C00000);
+		break;
+	case 4:
+	case 5:
+		rinfo->riva.PCRTC =
+		    (unsigned *) (rinfo->ctrl_base + 0x00600000);
+		rinfo->riva.PRAMIN =
+		    (unsigned *) (rinfo->ctrl_base + 0x00710000);
+		break;
+	}
+
+	RivaGetConfig (&rinfo->riva);
+
+	/* back to normal */
+
+	assert (rinfo->pd != NULL);
+
+	/* unlock io */
+	vga_io_wcrt (0x11, 0xFF);	/* vgaHWunlock() + riva unlock (0x7F) */
+	outb (rinfo->riva.LockUnlockIndex, rinfo->riva.LockUnlockIO);
+	outb (0x57, rinfo->riva.LockUnlockIO + 1);
+
+	memcpy (&rinfo->initial_state, &reg_template,
+		sizeof (reg_template));
+	riva_save_state (rinfo, &rinfo->initial_state);
+
+	rinfo->ram_amount = rinfo->riva.RamAmountKBytes * 1024;
+	rinfo->dclk_max = rinfo->riva.MaxVClockFreqKHz * 1000;
+
+	riva_set_fbinfo (rinfo);
+
+	riva_init_clut (rinfo);
+
+	riva_load_video_mode (rinfo, &rinfo->disp.var);
+
+	if (register_framebuffer ((struct fb_info *) rinfo) < 0) {
+		printk (KERN_ERR PFX
+			"error registering riva framebuffer\n");
+		goto err_out_iounmap_fb;
+	}
+
+	pd->driver_data = rinfo;
+
+	printk ("PCI Riva NV%d framebuffer ver %s (%s, %dMB @ 0x%lX)\n",
+		rinfo->riva.Architecture,
+		RIVAFB_VERSION,
+		rinfo->drvr_name,
+		rinfo->ram_amount / (1024 * 1024) + 1,
+		rinfo->fb_base_phys);
+
+	return 0;
+
+err_out_iounmap_fb:
+	iounmap (rinfo->fb_base);
+err_out_iounmap_ctrl:
+	iounmap (rinfo->ctrl_base);
+err_out_free_base1:
+	release_mem_region (rinfo->fb_base_phys, rinfo->base1_region_size);
+err_out_free_base0:
+	release_mem_region (rinfo->ctrl_base_phys, rinfo->base0_region_size);
+err_out_kfree:
+	kfree (rinfo);
+err_out:
+	return -ENODEV;
+}
+
+
+static void __devexit rivafb_remove_one (struct pci_dev *pd)
+{
+	struct rivafb_info *board = pd->driver_data;
+	
+	if (!board)
+		return;
+		
+	riva_load_state (board, &board->initial_state);
+
+	unregister_framebuffer ((struct fb_info *) board);
+
+	iounmap (board->ctrl_base);
+	iounmap (board->fb_base);
+
+	release_mem_region (board->ctrl_base_phys,
+			    board->base0_region_size);
+	release_mem_region (board->fb_base_phys,
+			    board->base1_region_size);
+
+	kfree (board);
+}
+
+
+/*** riva_wclut - set CLUT entry ***/
+static void riva_wclut (unsigned char regnum, unsigned char red,
+			unsigned char green, unsigned char blue)
+{
+	unsigned int data = VGA_PEL_D;
+
+	/* address write mode register is not translated.. */
+	vga_io_w (VGA_PEL_IW, regnum);
+
+	vga_io_w (data, red);
+	vga_io_w (data, green);
+	vga_io_w (data, blue);
+}
+
+
+
+/* ------------ Hardware Independent Functions ------------ */
+
+#ifndef MODULE
+int __init rivafb_setup (char *options)
+{
+	char *this_opt;
+
+	if (!options || !*options)
+		return 0;
+
+	for (this_opt = strtok (options, ","); this_opt;
+	     this_opt = strtok (NULL, ",")) {
+		if (!strncmp (this_opt, "font:", 5)) {
+			char *p;
+			int i;
+
+			p = this_opt + 5;
+			for (i = 0; i < sizeof (fontname) - 1; i++)
+				if (!*p || *p == ' ' || *p == ',')
+					break;
+			memcpy (fontname, this_opt + 5, i);
+			fontname[i] = 0;
+		}
+
+		else if (!strncmp (this_opt, "noaccel", 7)) {
+			noaccel = 1;
+		}
+
+		else
+			mode_option = this_opt;
+	}
+	return 0;
+}
+#endif				/* !MODULE */
+
+    /*
+     *  Initialization
+     */
+
+/* ------------------------------------------------------------------------- */
+
+
+    /*
+     *  Frame buffer operations
+     */
+
+static int rivafb_open (struct fb_info *info, int user)
+{
+	/* Nothing, only a usage count for the moment */
+	MOD_INC_USE_COUNT;
+	return 0;
+}
+
+static int rivafb_release (struct fb_info *info, int user)
+{
+	MOD_DEC_USE_COUNT;
+	return 0;
+}
+
+
+static int rivafb_get_fix (struct fb_fix_screeninfo *fix, int con,
+		    struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+	struct display *p;
+
+	DPRINTK ("ENTER\n");
+
+	assert (fix != NULL);
+	assert (info != NULL);
+	assert (rivainfo->drvr_name && rivainfo->drvr_name[0]);
+	assert (rivainfo->fb_base_phys > 0);
+	assert (rivainfo->ram_amount > 0);
+
+	p = (con < 0) ? rivainfo->info.disp : &fb_display[con];
+
+	memset (fix, 0, sizeof (struct fb_fix_screeninfo));
+	sprintf (fix->id, "Riva %s", rivainfo->drvr_name);
+
+	fix->smem_start = rivainfo->fb_base_phys;
+	fix->smem_len = rivainfo->ram_amount;
+
+	fix->type = p->type;
+	fix->type_aux = p->type_aux;
+	fix->visual = p->visual;
+
+	fix->xpanstep = 1;
+	fix->ypanstep = 1;
+	fix->ywrapstep = 0;	/* FIXME: no ywrap for now */
+
+	fix->line_length = p->line_length;
+
+#warning FIXME: set up MMIO region, export via FB_ACCEL_xxx
+	fix->mmio_start = 0;
+	fix->mmio_len = 0;
+	fix->accel = FB_ACCEL_NONE;
+
+	DPRINTK ("EXIT, returning 0\n");
+
+	return 0;
+}
+
+
+static int rivafb_get_var (struct fb_var_screeninfo *var, int con,
+		    struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+
+	DPRINTK ("ENTER\n");
+
+	assert (info != NULL);
+	assert (var != NULL);
+
+	*var = (con < 0) ? rivainfo->disp.var : fb_display[con].var;
+
+	DPRINTK ("EXIT, returning 0\n");
+
+	return 0;
+}
+
+
+
+static int rivafb_set_var (struct fb_var_screeninfo *var, int con,
+		    struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+	struct display *dsp;
+	struct fb_var_screeninfo v;
+	int nom, den;		/* translating from pixels->bytes */
+	int i;
+	unsigned chgvar = 0;
+	static struct {
+		int xres, yres;
+	} modes[] = {
+		{
+		1600, 1280}, {
+		1280, 1024}, {
+		1024, 768}, {
+		800, 600}, {
+		640, 480}, {
+		-1, -1}
+	};
+
+	DPRINTK ("ENTER\n");
+
+	assert (info != NULL);
+	assert (var != NULL);
+
+	DPRINTK ("Requested: %dx%dx%d\n", var->xres, var->yres,
+		 var->bits_per_pixel);
+	DPRINTK ("  virtual: %dx%d\n", var->xres_virtual,
+		 var->yres_virtual);
+	DPRINTK ("   offset: (%d,%d)\n", var->xoffset, var->yoffset);
+	DPRINTK ("grayscale: %d\n", var->grayscale);
+
+	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
+	assert (dsp != NULL);
+
+	/* if var has changed, we should call changevar() later */
+	if (con >= 0) {
+		chgvar = ((dsp->var.xres != var->xres) ||
+			  (dsp->var.yres != var->yres) ||
+			  (dsp->var.xres_virtual != var->xres_virtual) ||
+			  (dsp->var.yres_virtual != var->yres_virtual) ||
+			  (dsp->var.bits_per_pixel != var->bits_per_pixel)
+			  || memcmp (&dsp->var.red, &var->red,
+				     sizeof (var->red))
+			  || memcmp (&dsp->var.green, &var->green,
+				     sizeof (var->green))
+			  || memcmp (&dsp->var.blue, &var->blue,
+				     sizeof (var->blue)));
+	}
+
+	memcpy (&v, var, sizeof (v));
+
+	switch (v.bits_per_pixel) {
+#ifdef FBCON_HAS_MFB
+	case 1:
+		dsp->dispsw = &fbcon_mfb;
+		dsp->line_length = v.xres_virtual / 8;
+		dsp->visual = FB_VISUAL_MONO10;
+		nom = 4;
+		den = 8;
+		break;
+#endif
+
+#ifdef FBCON_HAS_CFB8
+	case 2 ... 8:
+		v.bits_per_pixel = 8;
+		dsp->dispsw = &fbcon_cfb8;
+		nom = 1;
+		den = 1;
+		dsp->line_length = v.xres_virtual;
+		dsp->visual = FB_VISUAL_PSEUDOCOLOR;
+		v.red.offset = 0;
+		v.red.length = 6;
+		v.green.offset = 0;
+		v.green.length = 6;
+		v.blue.offset = 0;
+		v.blue.length = 6;
+		break;
+#endif
+
+#ifdef FBCON_HAS_CFB16
+	case 9 ... 16:
+		v.bits_per_pixel = 16;
+		dsp->dispsw = &fbcon_cfb16;
+		dsp->dispsw_data = &rivainfo->con_cmap.cfb16;
+		nom = 2;
+		den = 1;
+		dsp->line_length = v.xres_virtual * 2;
+		dsp->visual = FB_VISUAL_DIRECTCOLOR;
+#ifdef CONFIG_PREP
+		v.red.offset = 2;
+		v.green.offset = -3;
+		v.blue.offset = 8;
+#else
+		v.red.offset = 10;
+		v.green.offset = 5;
+		v.blue.offset = 0;
+#endif
+		v.red.length = 5;
+		v.green.length = 5;
+		v.blue.length = 5;
+		break;
+#endif
+
+#ifdef FBCON_HAS_CFB32
+	case 17 ... 32:
+		v.bits_per_pixel = 32;
+		dsp->dispsw = &fbcon_cfb32;
+		dsp->dispsw_data = rivainfo->con_cmap.cfb32;
+		nom = 4;
+		den = 1;
+		dsp->line_length = v.xres_virtual * 4;
+		dsp->visual = FB_VISUAL_DIRECTCOLOR;
+#ifdef CONFIG_PREP
+		v.red.offset = 8;
+		v.green.offset = 16;
+		v.blue.offset = 24;
+#else
+		v.red.offset = 16;
+		v.green.offset = 8;
+		v.blue.offset = 0;
+#endif
+		v.red.length = 8;
+		v.green.length = 8;
+		v.blue.length = 8;
+		break;
+#endif
+
+	default:
+		printk (KERN_ERR PFX
+			"mode %dx%dx%d rejected...color depth not supported.\n",
+			var->xres, var->yres, var->bits_per_pixel);
+		DPRINTK ("EXIT, returning -EINVAL\n");
+		return -EINVAL;
+	}
+
+	if (v.xres * nom / den * v.yres > rivainfo->ram_amount) {
+		printk (KERN_ERR PFX
+			"mode %dx%dx%d rejected...resolution too high to fit into video memory!\n",
+			var->xres, var->yres, var->bits_per_pixel);
+		DPRINTK ("EXIT - EINVAL error\n");
+		return -EINVAL;
+	}
+
+	/* use highest possible virtual resolution */
+	if (v.xres_virtual == -1 && v.yres_virtual == -1) {
+		printk (KERN_WARNING PFX
+			"using maximum available virtual resolution\n");
+		for (i = 0; modes[i].xres != -1; i++) {
+			if (modes[i].xres * nom / den * modes[i].yres <
+			    rivainfo->ram_amount / 2)
+				break;
+		}
+		if (modes[i].xres == -1) {
+			printk (KERN_ERR PFX
+				"could not find a virtual resolution that fits into video memory!!\n");
+			DPRINTK ("EXIT - EINVAL error\n");
+			return -EINVAL;
+		}
+		v.xres_virtual = modes[i].xres;
+		v.yres_virtual = modes[i].yres;
+
+		printk (KERN_INFO PFX
+			"virtual resolution set to maximum of %dx%d\n",
+			v.xres_virtual, v.yres_virtual);
+	} else if (v.xres_virtual == -1) {
+		/* FIXME: maximize X virtual resolution only */
+	} else if (v.yres_virtual == -1) {
+		/* FIXME: maximize Y virtual resolution only */
+	}
+
+	if (v.xoffset < 0)
+		v.xoffset = 0;
+	if (v.yoffset < 0)
+		v.yoffset = 0;
+
+	/* truncate xoffset and yoffset to maximum if too high */
+	if (v.xoffset > v.xres_virtual - v.xres)
+		v.xoffset = v.xres_virtual - v.xres - 1;
+
+	if (v.yoffset > v.yres_virtual - v.yres)
+		v.yoffset = v.yres_virtual - v.yres - 1;
+
+	v.red.msb_right =
+	    v.green.msb_right =
+	    v.blue.msb_right =
+	    v.transp.offset = v.transp.length = v.transp.msb_right = 0;
+
+	switch (v.activate & FB_ACTIVATE_MASK) {
+	case FB_ACTIVATE_TEST:
+		DPRINTK ("EXIT - FB_ACTIVATE_TEST\n");
+		return 0;
+	case FB_ACTIVATE_NXTOPEN:	/* ?? */
+	case FB_ACTIVATE_NOW:
+		break;		/* continue */
+	default:
+		DPRINTK ("EXIT - unknown activation type\n");
+		return -EINVAL;	/* unknown */
+	}
+
+	dsp->type = FB_TYPE_PACKED_PIXELS;
+
+#warning FIXME: verify that the above code sets dsp->* fields correctly
+
+	memcpy (&dsp->var, &v, sizeof (v));
+
+	riva_load_video_mode (rivainfo, &v);
+
+	if (chgvar && info && info->changevar)
+		info->changevar (con);
+
+	DPRINTK ("EXIT, returning 0\n");
+	return 0;
+}
+
+
+
+static int rivafb_get_cmap (struct fb_cmap *cmap, int kspc, int con,
+		     struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+	struct display *dsp;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+	assert (cmap != NULL);
+
+	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
+
+	if (con == rivainfo->currcon) {	/* current console? */
+		int rc = fb_get_cmap (cmap, kspc, riva_getcolreg, info);
+		DPRINTK ("EXIT - returning %d\n", rc);
+		return rc;
+	} else if (dsp->cmap.len)	/* non default colormap? */
+		fb_copy_cmap (&dsp->cmap, cmap, kspc ? 0 : 2);
+	else
+		fb_copy_cmap (fb_default_cmap
+			      (riva_get_cmap_len (&dsp->var)), cmap,
+			      kspc ? 0 : 2);
+
+	DPRINTK ("EXIT, returning 0\n");
+
+	return 0;
+}
+
+
+static int rivafb_set_cmap (struct fb_cmap *cmap, int kspc, int con,
+		     struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+	struct display *dsp;
+	unsigned int cmap_len;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+	assert (cmap != NULL);
+
+	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
+
+	cmap_len = riva_get_cmap_len (&dsp->var);
+	if (dsp->cmap.len != cmap_len) {
+		int err = fb_alloc_cmap (&dsp->cmap, cmap_len, 0);
+		if (err) {
+			DPRINTK ("EXIT - returning %d\n", err);
+			return err;
+		}
+	}
+	if (con == rivainfo->currcon) {	/* current console? */
+		int rc = fb_set_cmap (cmap, kspc, riva_setcolreg, info);
+		DPRINTK ("EXIT - returning %d\n", rc);
+		return rc;
+	} else
+		fb_copy_cmap (cmap, &dsp->cmap, kspc ? 0 : 1);
+
+	DPRINTK ("EXIT, returning 0\n");
+
+	return 0;
+}
+
+
+
+/**
+ * rivafb_pan_display
+ * @var: standard kernel fb changeable data
+ * @par: riva-specific hardware info about current video mode
+ * @info: pointer to rivafb_info object containing info for current riva board
+ *
+ * DESCRIPTION:
+ * Pan (or wrap, depending on the `vmode' field) the display using the
+ * `xoffset' and `yoffset' fields of the `var' structure.
+ * If the values don't fit, return -EINVAL.
+ *
+ * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
+ */
+
+static int rivafb_pan_display (struct fb_var_screeninfo *var, int con,
+			struct fb_info *info)
+{
+	unsigned int base;
+	struct display *dsp;
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+
+	if (var->xoffset > (var->xres_virtual - var->xres))
+		return -EINVAL;
+	if (var->yoffset > (var->yres_virtual - var->yres))
+		return -EINVAL;
+
+	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
+
+	if (var->vmode & FB_VMODE_YWRAP) {
+		if (var->yoffset < 0
+		    || var->yoffset >= dsp->var.yres_virtual
+		    || var->xoffset) return -EINVAL;
+	} else {
+		if (var->xoffset + dsp->var.xres > dsp->var.xres_virtual ||
+		    var->yoffset + dsp->var.yres > dsp->var.yres_virtual)
+			return -EINVAL;
+	}
+
+	base = var->yoffset * dsp->line_length + var->xoffset;
+
+	if (con == rivainfo->currcon) {
+		rivainfo->riva.SetStartAddress (&rivainfo->riva, base);
+	}
+
+	dsp->var.xoffset = var->xoffset;
+	dsp->var.yoffset = var->yoffset;
+
+	if (var->vmode & FB_VMODE_YWRAP)
+		dsp->var.vmode |= FB_VMODE_YWRAP;
+	else
+		dsp->var.vmode &= ~FB_VMODE_YWRAP;
+
+	DPRINTK ("EXIT, returning 0\n");
+
+	return 0;
+}
+
+
+static int rivafb_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
+		  unsigned long arg, int con, struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+
+	/* no rivafb-specific ioctls */
+
+	DPRINTK ("EXIT, returning -EINVAL\n");
+
+	return -EINVAL;
+}
+
+
+static int rivafb_switch (int con, struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+	struct fb_cmap *cmap;
+	struct display *dsp;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+
+	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
+
+	if (rivainfo->currcon >= 0) {
+		/* Do we have to save the colormap? */
+		cmap = &(rivainfo->currcon_display->cmap);
+		DPRINTK ("switch1: con = %d, cmap.len = %d\n",
+			 rivainfo->currcon, cmap->len);
+
+		if (cmap->len) {
+			DPRINTK ("switch1a: %p %p %p %p\n", cmap->red,
+				 cmap->green, cmap->blue, cmap->transp);
+			fb_get_cmap (cmap, 1, riva_getcolreg, info);
+#ifdef DEBUG
+			if (cmap->red) {
+				DPRINTK ("switch1r: %X\n", cmap->red[0]);
+			}
+#endif
+		}
+	}
+	rivainfo->currcon = con;
+	rivainfo->currcon_display = dsp;
+	dsp->var.activate = FB_ACTIVATE_NOW;
+
+#ifdef riva_DEBUG
+	cmap = &dsp->cmap;
+	DPRINTK ("switch2: con = %d, cmap.len = %d\n", con, cmap->len);
+	DPRINTK ("switch2a: %p %p %p %p\n", cmap->red, cmap->green,
+		 cmap->blue, cmap->transp);
+	if (dsp->cmap.red) {
+		DPRINTK ("switch2r: %X\n", cmap->red[0]);
+	}
+#endif
+
+	rivafb_set_var (&dsp->var, con, info);
+
+#ifdef riva_DEBUG
+	DPRINTK ("switch3: con = %d, cmap.len = %d\n", con, cmap->len);
+	DPRINTK ("switch3a: %p %p %p %p\n", cmap->red, cmap->green,
+		 cmap->blue, cmap->transp);
+	if (dsp->cmap.red) {
+		DPRINTK ("switch3r: %X\n", cmap->red[0]);
+	}
+#endif
+
+	DPRINTK ("EXIT, returning 0\n");
+	return 0;
+}
+
+static int rivafb_updatevar (int con, struct fb_info *info)
+{
+	int rc;
+
+	DPRINTK ("ENTER\n");
+
+	rc = (con <
+		0) ? -EINVAL : rivafb_pan_display (&fb_display[con].var,
+						   con, info);
+	DPRINTK ("EXIT, returning %d\n", rc);
+	return rc;
+}
+
+
+static void rivafb_blank (int blank, struct fb_info *info)
+{
+	unsigned char tmp;
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+
+	tmp = vga_io_rseq (VGA_SEQ_CLOCK_MODE) & ~VGA_SR01_SCREEN_OFF;
+
+	if (blank)
+		tmp |= VGA_SR01_SCREEN_OFF;
+
+	vga_io_wseq (VGA_SEQ_CLOCK_MODE, tmp);
+
+	DPRINTK ("EXIT\n");
+}
+
+
+/* -------------------------------------------------------------------------
+ *
+ * internal fb_ops helper functions
+ *
+ * -------------------------------------------------------------------------
+ */
+
+
+/**
+ * riva_get_cmap_len
+ * @var:
+ *
+ * DESCRIPTION:
+ */
+
+static int riva_get_cmap_len (const struct fb_var_screeninfo *var)
+{
+	int rc = 16;		/* reasonable default */
+
+	assert (var != NULL);
+
+	switch (var->bits_per_pixel) {
+#ifdef FBCON_HAS_CFB4
+	case 4:
+		rc = 16;	/* pseudocolor... 16 entries HW palette */
+		break;
+#endif
+#ifdef FBCON_HAS_CFB8
+	case 8:
+		rc = 256;	/* pseudocolor... 256 entries HW palette */
+		break;
+#endif
+#ifdef FBCON_HAS_CFB16
+	case 16:
+		rc = 16;	/* directcolor... 16 entries SW palette */
+		break;		/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */
+#endif
+#ifdef FBCON_HAS_CFB32
+	case 32:
+		rc = 16;	/* directcolor... 16 entries SW palette */
+		break;		/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */
+#endif
+	default:
+		assert (0);
+		/* should not occur */
+		break;
+	}
+
+	return rc;
+}
+
+
+/**
+ * riva_getcolreg
+ * @regno:
+ * @red:
+ * @green:
+ * @blue:
+ * @transp:
+ * @info: pointer to rivafb_info object containing info for current riva board
+ *
+ * DESCRIPTION:
+ * Read a single color register and split it into colors/transparent.
+ * The return values must have a 16 bit magnitude.
+ * Return != 0 for invalid regno.
+ *
+ * CALLED FROM:
+ * fbcmap.c:fb_get_cmap()
+ *	fbgen.c:fbgen_get_cmap()
+ *	fbgen.c:fbgen_switch()
+ */
+
+static int riva_getcolreg (unsigned regno, unsigned *red, unsigned *green,
+			   unsigned *blue, unsigned *transp,
+			   struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+
+	if (regno > 255)
+		return 1;
+
+	*red = rivainfo->palette[regno].red;
+	*green = rivainfo->palette[regno].green;
+	*blue = rivainfo->palette[regno].blue;
+	*transp = 0;
+
+	return 0;
+}
+
+
+/**
+ * riva_setcolreg
+ * @regno:
+ * @red:
+ * @green:
+ * @blue:
+ * @transp:
+ * @info: pointer to rivafb_info object containing info for current riva board
+ *
+ * DESCRIPTION:
+ * Set a single color register. The values supplied have a 16 bit
+ * magnitude.
+ * Return != 0 for invalid regno.
+ *
+ * CALLED FROM:
+ * fbcmap.c:fb_set_cmap()
+ *	fbgen.c:fbgen_get_cmap()
+ *	fbgen.c:fbgen_install_cmap()
+ *		fbgen.c:fbgen_set_var()
+ *		fbgen.c:fbgen_switch()
+ *		fbgen.c:fbgen_blank()
+ *	fbgen.c:fbgen_blank()
+ */
+
+static int riva_setcolreg (unsigned regno, unsigned red, unsigned green,
+			   unsigned blue, unsigned transp,
+			   struct fb_info *info)
+{
+	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
+	struct display *p;
+
+	DPRINTK ("ENTER\n");
+
+	assert (rivainfo != NULL);
+	assert (rivainfo->currcon_display != NULL);
+
+	if (regno > 255)
+		return -EINVAL;
+
+	p = rivainfo->currcon_display;
+	if (p->var.grayscale) {
+		/* gray = 0.30*R + 0.59*G + 0.11*B */
+		red = green = blue =
+		    (red * 77 + green * 151 + blue * 28) >> 8;
+	}
+#ifdef FBCON_HAS_CFB8
+	switch (p->var.bits_per_pixel) {
+	case 8:
+		/* "transparent" stuff is completely ignored. */
+		riva_wclut (regno, red >> 10, green >> 10, blue >> 10);
+		break;
+	default:
+		/* do nothing */
+		break;
+	}
+#endif				/* FBCON_HAS_CFB8 */
+
+	rivainfo->palette[regno].red = red;
+	rivainfo->palette[regno].green = green;
+	rivainfo->palette[regno].blue = blue;
+
+	if (regno >= 16)
+		return 0;
+
+	switch (p->var.bits_per_pixel) {
+
+#ifdef FBCON_HAS_CFB16
+	case 16:
+		assert (regno < 16);
+#ifdef CONFIG_PREP
+		rivainfo->con_cmap.cfb16[regno] =
+		    ((red & 0xf800) >> 9) |
+		    ((green & 0xf800) >> 14) |
+		    ((green & 0xf800) << 2) | ((blue & 0xf800) >> 3);
+#else
+		rivainfo->con_cmap.cfb16[regno] =
+		    ((red & 0xf800) >> 1) |
+		    ((green & 0xf800) >> 6) | ((blue & 0xf800) >> 11);
+#endif
+		break;
+#endif				/* FBCON_HAS_CFB16 */
+
+#ifdef FBCON_HAS_CFB32
+	case 32:
+		assert (regno < 16);
+#ifdef CONFIG_PREP
+		rivainfo->con_cmap.cfb32[regno] =
+		    ((red & 0xff00)) |
+		    ((green & 0xff00) << 8) | ((blue & 0xff00) << 16);
+#else
+		rivainfo->con_cmap.cfb32[regno] =
+		    ((red & 0xff00) << 8) |
+		    ((green & 0xff00)) | ((blue & 0xff00) >> 8);
+#endif
+		break;
+#endif				/* FBCON_HAS_CFB32 */
+
+	default:
+		/* do nothing */
+		break;
+	}
+
+	return 0;
+}
+
+
+
+/*
+ * riva_load_video_mode()
+ *
+ * calculate some timings and then send em off to riva_load_state()
+ */
+
+static void riva_load_video_mode (struct rivafb_info *rinfo,
+				  struct fb_var_screeninfo *video_mode)
+{
+	struct riva_regs newmode;
+	int bpp, width, hDisplaySize, hDisplay, hStart,
+	    hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock;
+
+	/* time to calculate */
+
+	bpp = video_mode->bits_per_pixel;
+	width = hDisplaySize = video_mode->xres;
+	hDisplay = (hDisplaySize / 8) - 1;
+	hStart = (hDisplaySize + video_mode->right_margin) / 8 + 2;
+	hEnd = (hDisplaySize + video_mode->right_margin +
+		video_mode->hsync_len) / 8 - 1;
+	hTotal = (hDisplaySize + video_mode->right_margin +
+		  video_mode->hsync_len + video_mode->left_margin) / 8 - 1;
+	height = video_mode->yres;
+	vDisplay = video_mode->yres - 1;
+	vStart = video_mode->yres + video_mode->lower_margin - 1;
+	vEnd = video_mode->yres + video_mode->lower_margin +
+	    video_mode->vsync_len - 1;
+	vTotal = video_mode->yres + video_mode->lower_margin +
+	    video_mode->vsync_len + video_mode->upper_margin + 2;
+	dotClock = 1000000000 / video_mode->pixclock;
+
+	memcpy (&newmode, &reg_template, sizeof (struct riva_regs));
+
+	newmode.crtc[0x0] = Set8Bits (hTotal - 4);
+	newmode.crtc[0x1] = Set8Bits (hDisplay);
+	newmode.crtc[0x2] = Set8Bits (hDisplay);
+      newmode.crtc[0x3] = SetBitField (hTotal, 4: 0, 4:0) | SetBit (7);
+	newmode.crtc[0x4] = Set8Bits (hStart);
+      newmode.crtc[0x5] = SetBitField (hTotal, 5: 5, 7:7)
+      | SetBitField (hEnd, 4: 0, 4:0);
+      newmode.crtc[0x6] = SetBitField (vTotal, 7: 0, 7:0);
+      newmode.crtc[0x7] = SetBitField (vTotal, 8: 8, 0:0)
+      | SetBitField (vDisplay, 8: 8, 1:1)
+      | SetBitField (vStart, 8: 8, 2:2)
+      | SetBitField (vDisplay, 8: 8, 3:3)
+	    | SetBit (4)
+      | SetBitField (vTotal, 9: 9, 5:5)
+      | SetBitField (vDisplay, 9: 9, 6:6)
+      | SetBitField (vStart, 9: 9, 7:7);
+      newmode.crtc[0x9] = SetBitField (vDisplay, 9: 9, 5:5)
+	    | SetBit (6);
+	newmode.crtc[0x10] = Set8Bits (vStart);
+      newmode.crtc[0x11] = SetBitField (vEnd, 3: 0, 3:0)
+	    | SetBit (5);
+	newmode.crtc[0x12] = Set8Bits (vDisplay);
+	newmode.crtc[0x13] = ((width / 8) * (bpp / 8)) & 0xFF;
+	newmode.crtc[0x15] = Set8Bits (vDisplay);
+	newmode.crtc[0x16] = Set8Bits (vTotal + 1);
+
+	newmode.ext.bpp = bpp;
+	newmode.ext.width = width;
+	newmode.ext.height = height;
+
+	rinfo->riva.CalcStateExt (&rinfo->riva, &newmode.ext, bpp, width,
+				  hDisplaySize, hDisplay, hStart, hEnd,
+				  hTotal, height, vDisplay, vStart, vEnd,
+				  vTotal, dotClock);
+
+	rinfo->initial_state = newmode;
+	riva_load_state (rinfo, &newmode);
+}
+
+
+/* ------------------------------------------------------------------------- */
+
+
+    /*
+     *  Modularization
+     */
+
+static struct pci_driver rivafb_driver = {
+	name:		"rivafb",
+	id_table:	rivafb_pci_tbl,
+	probe:		rivafb_init_one,
+	remove:		rivafb_remove_one,
+};
+
+
+int __init rivafb_init (void)
+{
+	return pci_module_init (&rivafb_driver);
+}
+
+
+static void __exit rivafb_exit (void)
+{
+	pci_unregister_driver (&rivafb_driver);
+}
+
+
+#ifdef MODULE
+module_init(rivafb_init);
+#endif				/* MODULE */
+module_exit(rivafb_exit);
+
+MODULE_AUTHOR("Jeff Garzik <jgarzik@mandrakesoft.com>");
+MODULE_DESCRIPTION("Framebuffer driver for nVidia Riva 128, TNT, TNT2");
+
+
+/* from GGI */
+static void riva_save_state (struct rivafb_info *rinfo, struct riva_regs *regs)
+{
+	int i;
+
+	outb (rinfo->riva.LockUnlockIndex, rinfo->riva.LockUnlockIO);
+	outb (0x57, rinfo->riva.LockUnlockIO + 1);
+
+	rinfo->riva.UnloadStateExt (&rinfo->riva, &regs->ext);
+
+	regs->misc_output = io_in8 (0x3CC);
+
+	for (i = 0; i < NUM_CRT_REGS; i++) {
+		io_out8 (i, 0x3D4);
+		regs->crtc[i] = io_in8 (0x3D5);
+	}
+
+	for (i = 0; i < NUM_ATC_REGS; i++) {
+		io_out8 (i, 0x3C0);
+		regs->attr[i] = io_in8 (0x3C1);
+	}
+
+	for (i = 0; i < NUM_GRC_REGS; i++) {
+		io_out8 (i, 0x3CE);
+		regs->gra[i] = io_in8 (0x3CF);
+	}
+
+
+	for (i = 0; i < NUM_SEQ_REGS; i++) {
+		io_out8 (i, 0x3C4);
+		regs->seq[i] = io_in8 (0x3C5);
+	}
+}
+
+
+/* from GGI */
+static
+void riva_load_state (struct rivafb_info *rinfo, struct riva_regs *regs)
+{
+	int i;
+	RIVA_HW_STATE *state = &regs->ext;
+
+	io_out8 (0x11, 0x3D4);
+	io_out8 (0x00, 0x3D5);
+
+	outb (rinfo->riva.LockUnlockIndex, rinfo->riva.LockUnlockIO);
+	outb (0x57, rinfo->riva.LockUnlockIO + 1);
+
+	rinfo->riva.LoadStateExt (&rinfo->riva, state);
+
+	io_out8 (regs->misc_output, 0x3C2);
+
+	for (i = 0; i < NUM_CRT_REGS; i++) {
+		if (i < 0x19) {
+			io_out8 (i, 0x3D4);
+			io_out8 (regs->crtc[i], 0x3D5);
+		} else {
+			switch (i) {
+			case 0x19:
+			case 0x20:
+			case 0x21:
+			case 0x22:
+			case 0x23:
+			case 0x24:
+			case 0x25:
+			case 0x26:
+			case 0x27:
+			case 0x28:
+			case 0x29:
+			case 0x2a:
+			case 0x2b:
+			case 0x2c:
+			case 0x2d:
+			case 0x2e:
+			case 0x2f:
+			case 0x30:
+			case 0x31:
+			case 0x32:
+			case 0x33:
+			case 0x34:
+			case 0x35:
+			case 0x36:
+			case 0x37:
+			case 0x38:
+			case 0x39:
+			case 0x3a:
+			case 0x3b:
+			case 0x3c:
+			case 0x3d:
+			case 0x3e:
+			case 0x3f:
+			case 0x40:
+				break;
+			default:
+				io_out8 (i, 0x3D4);
+				io_out8 (regs->crtc[i], 0x3D5);
+			}
+		}
+	}
+
+	for (i = 0; i < NUM_ATC_REGS; i++) {
+		io_out8 (i, 0x3C0);
+		io_out8 (regs->attr[i], 0x3C1);
+	}
+
+	for (i = 0; i < NUM_GRC_REGS; i++) {
+		io_out8 (i, 0x3CE);
+		io_out8 (regs->gra[i], 0x3CF);
+	}
+
+	for (i = 0; i < NUM_SEQ_REGS; i++) {
+		io_out8 (i, 0x3C4);
+		io_out8 (regs->seq[i], 0x3C5);
+	}
+}
+
+
+
+
+/**
+ * riva_board_list_add
+ * @board_list: Root node of list of boards
+ * @new_node: New node to be added
+ *
+ * DESCRIPTION:
+ * Adds @new_node to the list referenced by @board_list
+ *
+ * RETURNS:
+ * New root node
+ */
+static
+struct rivafb_info *riva_board_list_add (struct rivafb_info *board_list,
+					 struct rivafb_info *new_node)
+{
+	struct rivafb_info *i_p = board_list;
+
+	new_node->next = NULL;
+
+	if (board_list == NULL)
+		return new_node;
+
+	while (i_p->next != NULL)
+		i_p = i_p->next;
+	i_p->next = new_node;
+
+	return board_list;
+}
diff -u --recursive --new-file v2.3.48/linux/drivers/video/riva/nv4ref.h linux/drivers/video/riva/nv4ref.h
--- v2.3.48/linux/drivers/video/riva/nv4ref.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/nv4ref.h	Tue Feb 29 11:07:04 2000
@@ -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 <jgarzik@mandrakesoft.com>, 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.48/linux/drivers/video/riva/nvreg.h linux/drivers/video/riva/nvreg.h
--- v2.3.48/linux/drivers/video/riva/nvreg.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/nvreg.h	Tue Feb 29 11:07:04 2000
@@ -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.48/linux/drivers/video/riva/riva_hw.c linux/drivers/video/riva/riva_hw.c
--- v2.3.48/linux/drivers/video/riva/riva_hw.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/riva_hw.c	Tue Feb 29 11:07:04 2000
@@ -0,0 +1,1426 @@
+ /***************************************************************************\
+|*                                                                           *|
+|*       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 <jgarzik@mandrakesoft.com>, 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 <linux/kernel.h>
+#include <asm/io.h>
+#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;
+    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) 
+{
+    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;
+    
+    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, 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 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, 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.48/linux/drivers/video/riva/riva_hw.h linux/drivers/video/riva/riva_hw.h
--- v2.3.48/linux/drivers/video/riva/riva_hw.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/riva_hw.h	Tue Feb 29 11:07:04 2000
@@ -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 <jgarzik@mandrakesoft.com>, 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.48/linux/drivers/video/riva/riva_tbl.h linux/drivers/video/riva/riva_tbl.h
--- v2.3.48/linux/drivers/video/riva/riva_tbl.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/riva/riva_tbl.h	Tue Feb 29 11:07:04 2000
@@ -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 <jgarzik@mandrakesoft.com>, 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.48/linux/drivers/video/riva_hw.c linux/drivers/video/riva_hw.c
--- v2.3.48/linux/drivers/video/riva_hw.c	Sun Nov  7 16:37:34 1999
+++ linux/drivers/video/riva_hw.c	Wed Dec 31 16:00:00 1969
@@ -1,1429 +0,0 @@
- /***************************************************************************\
-|*                                                                           *|
-|*       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 <jgarzik@mandrakesoft.com>, 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 <linux/module.h>
-#include <linux/kernel.h>
-#include <asm/io.h>
-#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.48/linux/drivers/video/riva_hw.h linux/drivers/video/riva_hw.h
--- v2.3.48/linux/drivers/video/riva_hw.h	Sun Nov  7 16:37:34 1999
+++ linux/drivers/video/riva_hw.h	Wed Dec 31 16:00:00 1969
@@ -1,343 +0,0 @@
-/***************************************************************************\
-|*                                                                           *|
-|*       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 <jgarzik@mandrakesoft.com>, 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.48/linux/drivers/video/riva_tbl.h linux/drivers/video/riva_tbl.h
--- v2.3.48/linux/drivers/video/riva_tbl.h	Sun Nov  7 16:37:34 1999
+++ linux/drivers/video/riva_tbl.h	Wed Dec 31 16:00:00 1969
@@ -1,402 +0,0 @@
- /***************************************************************************\
-|*                                                                           *|
-|*       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 <jgarzik@mandrakesoft.com>, 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.48/linux/drivers/video/rivafb.c linux/drivers/video/rivafb.c
--- v2.3.48/linux/drivers/video/rivafb.c	Fri Jan 28 15:09:08 2000
+++ linux/drivers/video/rivafb.c	Wed Dec 31 16:00:00 1969
@@ -1,1891 +0,0 @@
-/*
- * linux/drivers/video/rivafb.c - nVidia RIVA 128/TNT/TNT2 fb driver
- *
- * Copyright 1999 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * 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 COPYING in the main directory of this archive
- * for more details.
- */
-
-/* version number of this driver */
-#define RIVAFB_VERSION "0.6.5"
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/selection.h>
-#include <linux/tty.h>
-#include <linux/malloc.h>
-#include <linux/delay.h>
-#include <linux/fb.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-
-#include <video/fbcon.h>
-
-#include "riva_hw.h"
-#include "nv4ref.h"
-#include "nvreg.h"
-#include "vga.h"
-#include <video/fbcon-cfb4.h>
-#include <video/fbcon-cfb8.h>
-#include <video/fbcon-cfb16.h>
-#include <video/fbcon-cfb32.h>
-
-#ifndef CONFIG_PCI /* sanity check */
-#error This driver requires PCI support.
-#endif
-
-/*****************************************************************
- *
- * various helpful macros and constants
- *
- */
-
-/* #define RIVAFBDEBUG */
-#ifdef RIVAFBDEBUG
-#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
-#else
-#define DPRINTK(fmt, args...)
-#endif
-
-#ifndef RIVA_NDEBUG
-#define assert(expr) \
-	if(!(expr)) { \
-        printk( "Assertion failed! %s,%s,%s,line=%d\n",\
-        #expr,__FILE__,__FUNCTION__,__LINE__); \
-	*(int*)0 = 0; \
-        }
-#else
-#define assert(expr)
-#endif
-
-/* GGI compatibility macros */
-#define io_out8 outb
-#define io_in8 inb
-#define FatalError panic
-#define NUM_SEQ_REGS 0x05
-#define NUM_CRT_REGS 0x41
-#define NUM_GRC_REGS 0x09
-#define NUM_ATC_REGS 0x15
-
-/* max number of VGA controllers we scan for */
-#define RIVA_MAX_VGA_CONTROLLERS 8
-
-#define PFX "rivafb: "
-
-#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
-
-/* macro that allows you to set overflow bits */
-#define SetBitField(value,from,to) SetBF(to,GetBF(value,from))
-#define SetBit(n) (1<<(n))
-#define Set8Bits(value) ((value)&0xff)
-
-struct riva_chip_info {
-	const char *name;
-	unsigned arch_rev;
-	unsigned short vendor;
-	unsigned short device;
-};
-
-
-static const struct riva_chip_info riva_pci_probe_list[] =
-{
-	{"RIVA-128", 3, PCI_VENDOR_ID_NVIDIA_SGS, PCI_DEVICE_ID_NVIDIA_SGS_RIVA128},
-	{"RIVA-TNT", 4, PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT},
-	{"RIVA-TNT2", 5, PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT2},
-	{"RIVA-TNT2", 5, PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_UTNT2},
-	{"RIVA-TNT2", 5, PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_VTNT2},
-	{"RIVA-TNT2", 5, PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_ITNT2},
-	{NULL, 0, 0, 0}
-};
-
-
-/* holds the state of the VGA core and extended Riva hw state from riva_hw.c.
- * From KGI originally. */
-struct riva_regs {
-	u8 attr[0x15];
-	u8 crtc[0x41];
-	u8 gra[0x09];
-	u8 seq[0x05];
-	u8 misc_output;
-	RIVA_HW_STATE ext;
-};
-
-
-/*
- * describes the state of a Riva board
- */
-struct rivafb_par {
-	struct riva_regs state; /* state of hw board */
-	__u32 visual;	/* FB_VISUAL_xxx */
-	unsigned depth; /* bpp of current mode */
-};
-
-typedef struct {
-	unsigned char red, green, blue, transp;
-} riva_cfb8_cmap_t;
-
-
-
-struct rivafb_info;
-struct rivafb_info {
-	struct fb_info info;	/* kernel framebuffer info */
-
-	RIVA_HW_INST riva;	/* interface to riva_hw.c */
-
-	const char *drvr_name;	/* Riva hardware board type */
-
-	unsigned long ctrl_base_phys; /* physical control register base addr */
-	unsigned long fb_base_phys; /* physical framebuffer base addr */
-
-	caddr_t ctrl_base;	/* virtual control register base addr */
-	caddr_t fb_base;	/* virtual framebuffer base addr */
-
-	unsigned ram_amount;	/* amount of RAM on card, in megabytes */
-	unsigned dclk_max;	/* max DCLK */
-
-	struct riva_regs initial_state;		/* initial startup video mode */
-
-	struct display disp;
-	int currcon;
-	struct display *currcon_display;
-
-	struct rivafb_info *next;
-
-	struct pci_dev *pd;		/* pointer to board's pci info */
-	unsigned base0_region_size;	/* size of control register region */
-	unsigned base1_region_size;	/* size of framebuffer region */
-
-#ifdef FBCON_HAS_CFB8
-	riva_cfb8_cmap_t palette[256];	/* VGA DAC palette cache */
-#endif
-
-#if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB32)
-        union {
-#ifdef FBCON_HAS_CFB16
-                u_int16_t       cfb16[16];
-#endif
-#ifdef FBCON_HAS_CFB32
-                u_int32_t       cfb32[16];
-#endif
-        } con_cmap;
-#endif /* FBCON_HAS_CFB16 | FBCON_HAS_CFB32 */
-};
-
-/* ------------------- global variables ------------------------ */
-
-
-static struct rivafb_info *riva_boards = NULL;
-
-/* command line data, set in rivafb_setup() */
-static char fontname[40] __initdata = { 0 };
-static char noaccel __initdata = 0;		/* unused */
-#ifndef MODULE
-static const char *mode_option __initdata = NULL;
-#endif
-
-
-/* ------------------- prototypes ------------------------------ */
-
-int rivafb_open (struct fb_info *info, int user);
-int rivafb_release (struct fb_info *info, int user);
-int rivafb_get_fix (struct fb_fix_screeninfo *fix, int con,
-		  struct fb_info *info);
-int rivafb_get_var (struct fb_var_screeninfo *var, int con,
-		  struct fb_info *info);
-int rivafb_set_var (struct fb_var_screeninfo *var, int con,
-		  struct fb_info *info);
-int rivafb_get_cmap (struct fb_cmap *cmap, int kspc, int con,
-		   struct fb_info *info);
-int rivafb_set_cmap (struct fb_cmap *cmap, int kspc, int con,
-		   struct fb_info *info);
-int rivafb_pan_display (struct fb_var_screeninfo *var, int con,
-		      struct fb_info *info);
-int rivafb_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
-		unsigned long arg, int con, struct fb_info *info);
-int rivafb_switch(int con, struct fb_info *info);
-void rivafb_blank (int blank, struct fb_info *info);
-
-static void riva_load_video_mode (struct rivafb_info *rivainfo,
-				struct fb_var_screeninfo *video_mode);
-static int riva_getcolreg (unsigned regno, unsigned *red, unsigned *green,
-			 unsigned *blue, unsigned *transp,
-			 struct fb_info *info);
-static int riva_setcolreg (unsigned regno, unsigned red, unsigned green,
-		    unsigned blue, unsigned transp,
-		    struct fb_info *info);
-static int riva_get_cmap_len(const struct fb_var_screeninfo *var);
-
-static u32 riva_pci_region_size (struct pci_dev *pd, unsigned baseaddr);
-
-static void riva_pci_iounmap (struct rivafb_info *rinfo);
-static int riva_pci_register (struct pci_dev *pd, const struct riva_chip_info *rci);
-static int riva_pci_register_devices (void);
-static int riva_set_fbinfo (struct rivafb_info *rinfo);
-
-static
-void riva_save_state(struct rivafb_info *rinfo, struct riva_regs *regs);
-static
-void riva_load_state(struct rivafb_info *rinfo, struct riva_regs *regs);
-static
-struct rivafb_info *riva_board_list_add(struct rivafb_info *board_list,
-				 struct rivafb_info *new_node);
-
-#if 0
-static void riva_pci_region_init (struct pci_dev *pd, struct rivafb_info *rinfo);
-#endif
-
-static void riva_wclut (unsigned char regnum, unsigned char red,
-	    		unsigned char green, unsigned char blue);
-
-
-
-
-/* kernel interface */
-static struct fb_ops riva_fb_ops =
-{
-	rivafb_open,
-	rivafb_release,
-	rivafb_get_fix,
-	rivafb_get_var,
-	rivafb_set_var,
-	rivafb_get_cmap,
-	rivafb_set_cmap,
-	rivafb_pan_display,
-	rivafb_ioctl
-};
-
-
-
-
-/* from GGI */
-static const struct riva_regs reg_template =
-{
-	{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* ATTR */
-	  0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-	  0x41, 0x01, 0x0F, 0x13, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* CRT  */
-	  0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
-	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, /* 0x10 */
-	  0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20 */
-	  0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30 */
-	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-          0x00,                                           /* 0x40 */
-	},
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, /* GRA  */
-	  0xFF },
-	{ 0x03, 0x01, 0x0F, 0x00, 0x0E},                  /* SEQ  */
-	0xEB						  /* MISC */
-};
-
-
-
-/* ------------------- general utility functions -------------------------- */
-
-/**
- * riva_set_dispsw
- * @rivainfo: pointer to internal driver struct for a given Riva card
- *
- * DESCRIPTION:
- * Sets up console Low level operations depending on the current? color depth
- * of the display
- */
-
-void riva_set_dispsw (struct rivafb_info *rinfo)
-{
-	struct display *disp = &rinfo->disp;
-
-	DPRINTK ("ENTER\n");
-
-	assert (rinfo != NULL);
-
-	disp->dispsw_data = NULL;
-
-	switch (disp->var.bits_per_pixel) {
-#ifdef FBCON_HAS_MFB
-	case 1:
-		disp->dispsw = &fbcon_mfb;
-		break;
-#endif
-#ifdef FBCON_HAS_CFB4
-	case 4:
-		disp->dispsw = &fbcon_cfb4;
-		break;
-#endif
-#ifdef FBCON_HAS_CFB8
-	case 8:
-		disp->dispsw = &fbcon_cfb8;
-		break;
-#endif
-#ifdef FBCON_HAS_CFB16
-	case 15:
-	case 16:
-		disp->dispsw = &fbcon_cfb16;
-		disp->dispsw_data = &rinfo->con_cmap.cfb16;
-		break;
-#endif
-#ifdef FBCON_HAS_CFB24
-	case 24:
-		disp->dispsw = &fbcon_cfb24;
-		disp->dispsw_data = rinfo->con_cmap.cfb24;
-		break;
-#endif
-#ifdef FBCON_HAS_CFB32
-	case 32:
-		disp->dispsw = &fbcon_cfb32;
-		disp->dispsw_data = rinfo->con_cmap.cfb32;
-		break;
-#endif
-	default:
-		DPRINTK ("Setting fbcon_dummy renderer\n");
-		disp->dispsw = &fbcon_dummy;
-	}
-
-	DPRINTK ("EXIT\n");
-}
-
-
-
-
-static int riva_init_disp_var (struct rivafb_info *rinfo)
-{
-	if (mode_option)
-		fb_find_mode(&rinfo->disp.var, &rinfo->info, mode_option,
-	    		  NULL, 0, NULL, 8);
-	else 
-		fb_find_mode(&rinfo->disp.var, &rinfo->info,
-			     "640x480-8@60", NULL, 0, NULL, 8);
-	return 0;
-}
-
-
-
-
-static int __init riva_init_disp (struct rivafb_info *rinfo)
-{
-	struct fb_info *info;
-	struct display *disp;
-
-	DPRINTK("ENTER\n");
-
-	assert (rinfo != NULL);
-
-	info = &rinfo->info;
-	disp = &rinfo->disp;
-
-	info->disp = disp;
-
-#warning FIXME: assure that disp->cmap is completely filled out
-
-	disp->screen_base = rinfo->fb_base;
-	disp->visual = FB_VISUAL_PSEUDOCOLOR;
-	disp->type = FB_TYPE_PACKED_PIXELS;
-	disp->type_aux = 0;
-	disp->ypanstep = 1;
-	disp->ywrapstep = 0;
-	disp->next_line = disp->line_length =
-		(disp->var.xres_virtual * disp->var.bits_per_pixel) >> 3;
-	disp->can_soft_blank = 1;
-	disp->inverse = 0;
-
-	riva_set_dispsw(rinfo);
-
-	rinfo->currcon_display = disp;
-
-	if ((riva_init_disp_var (rinfo)) < 0) {	/* must be done last */
-		DPRINTK("EXIT, returning -1\n");
-		return -1;
-	}
-
-	DPRINTK("EXIT, returning 0\n");
-	return 0;
-
-}
-
-
-
-static int __init riva_set_fbinfo (struct rivafb_info *rinfo)
-{
-	struct fb_info *info;
-
-	assert (rinfo != NULL);
-
-	info = &rinfo->info;
-
-	strcpy (info->modename, rinfo->drvr_name);
-	info->node = -1;
-	info->flags = FBINFO_FLAG_DEFAULT;
-	info->fbops = &riva_fb_ops;
-
-#warning FIXME: set monspecs to what???
-
-	info->display_fg = NULL; /* FIXME: correct? */
-	strncpy (info->fontname, fontname, sizeof (info->fontname));
-	info->fontname[sizeof (info->fontname) - 1] = 0;
-
-	info->changevar = NULL; /* FIXME: needed? */
-	info->switch_con = rivafb_switch;
-	info->updatevar = NULL; /* FIXME? */
-	info->blank = rivafb_blank;
-
-	if (riva_init_disp (rinfo) < 0)	/* must be done last */
-		return -1;
-
-	return 0;
-}
-
-
-
-
-/* ----------------------------- PCI bus ----------------------------- */
-
-
-
-
-/**
- * riva_pci_region_size
- * @pd: pointer to PCI device to be configured
- *
- * DESCRIPTION:
- * Obtains from the PCI bus the size of the address space allocated to
- * the given card's base address zero region.
- */
-
-static
-u32 riva_pci_region_size (struct pci_dev *pd, unsigned baseaddr)
-{
-	return pd->resource[baseaddr].end - pd->resource[baseaddr].start + 1;
-}
-
-
-
-
-#if 0
-
-/**
- * riva_pci_iomap
- * @nv:
- *
- * DESCRIPTION:
- */
-
-static
-void riva_pci_region_init (struct pci_dev *pd, struct rivafb_info *rinfo)
-{
-	unsigned long addr;
-
-	assert (rinfo != NULL);
-	assert (pd != NULL);
-
-	rinfo->pd = pd;
-	rinfo->base0_region_size = riva_pci_region_size (pd, PCI_BASE_ADDRESS_0);
-	assert(rinfo->base0_region_size >= 0x00800000); /* from GGI */
-	rinfo->base1_region_size = riva_pci_region_size (pd, PCI_BASE_ADDRESS_1);
-	assert(rinfo->base0_region_size >= 0x01000000); /* from GGI */
-	
-	/* Get the base addresses */
-	pcibios_read_config_dword(0, rinfo->pd->devfn, PCI_BASE_ADDRESS_0, 
-                                  (unsigned int*)&addr);
-#ifdef SHOULDUSETHAT
-	/* This function should return an int. */
-	if (!addr)  
-	  return -ENXIO;
-#endif
-	
-	rinfo->ctrl_base_phys = addr & PCI_BASE_ADDRESS_MEM_MASK;
-
-	pcibios_read_config_dword(0, rinfo->pd->devfn, PCI_BASE_ADDRESS_1, 
-                                  (unsigned int*)&addr);
-
-	rinfo->fb_base_phys = addr & PCI_BASE_ADDRESS_MEM_MASK;
-
-	rinfo->ctrl_base = ioremap (rinfo->ctrl_base_phys, rinfo->base0_region_size);
-	assert (rinfo->ctrl_base != NULL);
-	rinfo->fb_base = ioremap (rinfo->fb_base_phys, rinfo->base1_region_size);
-	assert (rinfo->fb_base != NULL);
-
-        rinfo->riva.EnableIRQ = 0;
-        rinfo->riva.IO      = (inb(0x3CC) & 0x01) ? 0x3D0 : 0x3B0;
-        rinfo->riva.PRAMDAC = (unsigned *)(rinfo->ctrl_base+0x00680000);
-        rinfo->riva.PFB     = (unsigned *)(rinfo->ctrl_base+0x00100000);
-        rinfo->riva.PFIFO   = (unsigned *)(rinfo->ctrl_base+0x00002000);
-        rinfo->riva.PGRAPH  = (unsigned *)(rinfo->ctrl_base+0x00400000);
-        rinfo->riva.PEXTDEV = (unsigned *)(rinfo->ctrl_base+0x00101000);
-        rinfo->riva.PTIMER  = (unsigned *)(rinfo->ctrl_base+0x00009000);
-        rinfo->riva.PMC     = (unsigned *)(rinfo->ctrl_base+0x00000000);
-        rinfo->riva.FIFO    = (unsigned *)(rinfo->ctrl_base+0x00800000);
-
-        switch (rinfo->riva.Architecture)
-        {
-        case 3:
-                rinfo->riva.PRAMIN  = (unsigned *)(rinfo->ctrl_base+0x00C00000);
-                break;
-        case 4:
-	case 5:
-                rinfo->riva.PCRTC   = (unsigned *)(rinfo->ctrl_base+0x00600000);
-                rinfo->riva.PRAMIN  = (unsigned *)(rinfo->ctrl_base+0x00710000);
-                break;
-        }
-}
-
-#endif /* 0 */
-
-
-
-/**
- * riva_pci_iounmap
- * @rinfo:
- *
- * DESCRIPTION:
- */
-
-static
-void riva_pci_iounmap (struct rivafb_info *rinfo)
-{
-	assert (rinfo != NULL);
-	assert (rinfo->ctrl_base_phys != 0x00000000);
-	assert (rinfo->ctrl_base != NULL);
-	assert (rinfo->fb_base_phys != 0x00000000);
-	assert (rinfo->fb_base != NULL);
-
-	iounmap (rinfo->ctrl_base);
-	iounmap (rinfo->fb_base);
-}
-
-
-
-
-
-static void __init riva_init_clut (struct rivafb_info *fb_info)
-{
-	int j, k;
-	
-	for (j = 0; j < 256; j++) {
-		if (j < 16) {
-			k = color_table[j];
-			fb_info->palette[j].red = default_red[k];
-			fb_info->palette[j].green = default_grn[k];
-			fb_info->palette[j].blue = default_blu[k];
-		} else {
-			fb_info->palette[j].red =
-			fb_info->palette[j].green =
-			fb_info->palette[j].blue = j;
-		}
-		
-		riva_wclut (j,
-			    fb_info->palette[j].red,
-			    fb_info->palette[j].green,
-			    fb_info->palette[j].blue);
-	}
-}
-
-
-
-static int __init riva_pci_register (struct pci_dev *pd,
-				     const struct riva_chip_info *rci)
-{
-	struct rivafb_info *rinfo;
-
-	assert (pd != NULL);
-	assert (rci != NULL);
-
-	rinfo = kmalloc (sizeof (struct rivafb_info), GFP_KERNEL);
-	assert (rinfo != NULL);
-	memset (rinfo, 0, sizeof (struct rivafb_info));
-
-	rinfo->drvr_name = rci->name;
-	rinfo->riva.Architecture = rci->arch_rev;
-
-	rinfo->pd = pd;
-	rinfo->base0_region_size = riva_pci_region_size (pd, 0);
-	rinfo->base1_region_size = riva_pci_region_size (pd, 1);
-
-	assert(rinfo->base0_region_size >= 0x00800000); /* from GGI */
-	assert(rinfo->base0_region_size >= 0x01000000); /* from GGI */
-
-	rinfo->ctrl_base_phys = rinfo->pd->resource[0].start;
-	rinfo->fb_base_phys = rinfo->pd->resource[1].start;
-
-	request_region(0x3C0, 32, "rivafb");
-
-	if (!request_mem_region(rinfo->ctrl_base_phys,
-				rinfo->base0_region_size, "rivafb") ||
-	    !request_mem_region(rinfo->fb_base_phys, rinfo->base1_region_size,
-				"rivafb")) {
-		printk (KERN_ERR PFX "cannot reserve MMIO region\n");
-		return -ENXIO;
-	}
-
-	rinfo->ctrl_base = ioremap (rinfo->ctrl_base_phys,
-				    rinfo->base0_region_size);
-	assert (rinfo->ctrl_base != NULL);
-
-	rinfo->fb_base = ioremap (rinfo->fb_base_phys,
-				  rinfo->base1_region_size);
-	assert (rinfo->fb_base != NULL);
-
-        rinfo->riva.EnableIRQ = 0;
-        rinfo->riva.IO      = (inb(0x3CC) & 0x01) ? 0x3D0 : 0x3B0;
-        rinfo->riva.PRAMDAC = (unsigned *)(rinfo->ctrl_base+0x00680000);
-        rinfo->riva.PFB     = (unsigned *)(rinfo->ctrl_base+0x00100000);
-        rinfo->riva.PFIFO   = (unsigned *)(rinfo->ctrl_base+0x00002000);
-        rinfo->riva.PGRAPH  = (unsigned *)(rinfo->ctrl_base+0x00400000);
-        rinfo->riva.PEXTDEV = (unsigned *)(rinfo->ctrl_base+0x00101000);
-        rinfo->riva.PTIMER  = (unsigned *)(rinfo->ctrl_base+0x00009000);
-        rinfo->riva.PMC     = (unsigned *)(rinfo->ctrl_base+0x00000000);
-        rinfo->riva.FIFO    = (unsigned *)(rinfo->ctrl_base+0x00800000);
-
-        switch (rinfo->riva.Architecture)
-        {
-        case 3:
-                rinfo->riva.PRAMIN  = (unsigned *)(rinfo->ctrl_base+0x00C00000);
-                break;
-        case 4:
-	case 5:
-                rinfo->riva.PCRTC   = (unsigned *)(rinfo->ctrl_base+0x00600000);
-                rinfo->riva.PRAMIN  = (unsigned *)(rinfo->ctrl_base+0x00710000);
-                break;
-        }
-
-        RivaGetConfig(&rinfo->riva);
-
-	/* back to normal */
-
-	assert (rinfo->pd != NULL);
-
-	/* unlock io */
-	vga_io_wcrt (0x11, 0xFF); /* vgaHWunlock() + riva unlock (0x7F) */
-	outb(rinfo->riva.LockUnlockIO, rinfo->riva.LockUnlockIndex);
-	outb(rinfo->riva.LockUnlockIO + 1, 0x57);
-
-	memcpy (&rinfo->initial_state, &reg_template, sizeof (reg_template));
-	riva_save_state (rinfo, &rinfo->initial_state);
-
-        rinfo->ram_amount = rinfo->riva.RamAmountKBytes * 1024;
-	rinfo->dclk_max = rinfo->riva.MaxVClockFreqKHz * 1000;
-
-	riva_set_fbinfo (rinfo);
-	
-	riva_init_clut (rinfo);
-
-	riva_load_video_mode (rinfo, &rinfo->disp.var);
-
-	if (register_framebuffer ((struct fb_info *) rinfo) < 0) {
-		printk(KERN_ERR PFX "error registering riva framebuffer\n");
-		kfree (rinfo);
-		return -1;
-	}
-
-	riva_boards = riva_board_list_add (riva_boards, rinfo);
-
-	printk("PCI Riva NV%d framebuffer ver %s (%s, %dMB @ 0x%lX)\n",
-	       rinfo->riva.Architecture,
-	       RIVAFB_VERSION,
-	       rinfo->drvr_name,
-	       rinfo->ram_amount / (1024 * 1024),
-	       rinfo->fb_base_phys);
-
-	return 0;
-}
-
-
-
-
-static int __init riva_pci_register_devices (void)
-{
-	struct pci_dev *pd;
-	const struct riva_chip_info *nci = &riva_pci_probe_list[0];
-
-	assert (nci != NULL);
-	while (nci->name != NULL) {
-		pd = pci_find_device (nci->vendor, nci->device, NULL);
-		while (pd != NULL) {
-			if (riva_pci_register (pd, nci) < 0)
-				return -1;
-
-			pd = pci_find_device (nci->vendor, nci->device, pd);
-		}
-
-		nci++;
-	}
-
-	return 0;
-}
-
-
-
-/*** riva_wclut - set CLUT entry ***/
-static void riva_wclut (unsigned char regnum, unsigned char red,
-	    		unsigned char green, unsigned char blue)
-{
-	unsigned int data = VGA_PEL_D;
-	
-	/* address write mode register is not translated.. */
-	vga_io_w (VGA_PEL_IW, regnum);
-
-	vga_io_w (data, red);
-	vga_io_w (data, green);
-	vga_io_w (data, blue);
-}
-
-
-
-/* ------------ Hardware Independent Functions ------------ */
-
-int __init rivafb_setup(char *options)
-{
-    char *this_opt;
-
-    if (!options || !*options)
-	return 0;
-
-    for (this_opt = strtok(options, ","); this_opt;
-	 this_opt = strtok(NULL, ",")) {
-	if (!strncmp(this_opt, "font:", 5)) {
-		char *p;
-		int i;
-
-		p = this_opt + 5;
-		for (i = 0; i < sizeof(fontname) - 1; i++)
-			if (!*p || *p == ' ' || *p == ',')
-				break;
-		memcpy(fontname, this_opt + 5, i);
-		fontname[i] = 0;
-	}
-	
-	else if (!strncmp(this_opt, "noaccel", 7)) {
-		noaccel = 1;
-	}
-	
-	else
-	    mode_option = this_opt;
-    }
-    return 0;
-}
-
-    /*
-     *  Initialization
-     */
-
-int __init rivafb_init (void)
-{
-	if (riva_pci_register_devices () < 0)
-	    	return -ENXIO;
-
-	if (riva_boards == NULL)
-		return -ENODEV;
-
-	return 0;
-}
-
-
-/* ------------------------------------------------------------------------- */
-    /*
-     *  Cleanup
-     */
-
-void __exit rivafb_cleanup (struct fb_info *info)
-{
-#warning FIXME: is this all we need to do?
-
-	struct rivafb_info *tmp, *board = riva_boards;
-
-	while (board != NULL) {
-		riva_load_state (board, &board->initial_state);
-		riva_pci_iounmap (board);
-
-		unregister_framebuffer ((struct fb_info *) board);
-
-		tmp = board;
-		board = board->next;
-
-		kfree_s (tmp, sizeof (struct rivafb_info));
-	}
-
-	(void) info; /* unused function arg */
-}
-
-
-
-
-    /*
-     *  Frame buffer operations
-     */
-
-int rivafb_open(struct fb_info *info, int user)
-{
-    /* Nothing, only a usage count for the moment */
-    MOD_INC_USE_COUNT;
-    return 0;
-}
-
-int rivafb_release(struct fb_info *info, int user)
-{
-    MOD_DEC_USE_COUNT;
-    return 0;
-}
-
-
-/**
- * rivafb_get_fix
- * @fix:
- * @con:
- * @info:
- *
- * DESCRIPTION:
- */
-
-int rivafb_get_fix (struct fb_fix_screeninfo *fix, int con,
-		  struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-	struct display *p;
-
-	DPRINTK ("ENTER\n");
-
-	assert (fix != NULL);
-	assert (info != NULL);
-	assert (rivainfo->drvr_name && rivainfo->drvr_name[0]);
-	assert (rivainfo->fb_base_phys > 0);
-	assert (rivainfo->ram_amount > 0);
-
-	p = (con < 0) ? rivainfo->info.disp : &fb_display[con];
-
-	memset (fix, 0, sizeof (struct fb_fix_screeninfo));
-	sprintf (fix->id, "Riva %s", rivainfo->drvr_name);
-
-	fix->smem_start = rivainfo->fb_base_phys;
-	fix->smem_len = rivainfo->ram_amount;
-
-	fix->type = p->type;
-	fix->type_aux = p->type_aux;
-	fix->visual = p->visual;
-
-	fix->xpanstep = 1;
-	fix->ypanstep = 1;
-	fix->ywrapstep = 0; /* FIXME: no ywrap for now */
-
-	fix->line_length = p->line_length;
-
-#warning FIXME: set up MMIO region
-	fix->mmio_start = 0;
-	fix->mmio_len = 0;
-
-#warning FIXME: reference riva acceleration fb.h constant here
-	fix->accel = FB_ACCEL_NONE;
-
-	DPRINTK ("EXIT, returning 0\n");
-
-	return 0;
-}
-
-
-
-/**
- * rivafb_get_var
- * @var:
- * @con:
- * @info:
- *
- * DESCRIPTION:
- */
-
-int rivafb_get_var (struct fb_var_screeninfo *var, int con,
-		  struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-
-	DPRINTK ("ENTER\n");
-
-	assert (info != NULL);
-	assert (var != NULL);
-
-	*var = (con < 0) ? rivainfo->disp.var : fb_display[con].var;
-
-	DPRINTK ("EXIT, returning 0\n");
-
-	return 0;
-}
-
-
-
-/**
- * rivafb_set_var
- * @var:
- * @con:
- * @info:
- *
- * DESCRIPTION:
- */
-
-int rivafb_set_var (struct fb_var_screeninfo *var, int con,
-		  struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-	struct display *dsp;
-	struct fb_var_screeninfo v;
-	int nom, den;		/* translating from pixels->bytes */
-	int i;
-	unsigned chgvar = 0;
-	static struct {
-		int xres, yres;
-	} modes[] = {
-		{ 1600, 1280 },
-		{ 1280, 1024 },
-		{ 1024, 768 },
-		{ 800, 600 },
-		{ 640, 480 },
-		{ -1, -1 }
-	};
-
-	DPRINTK ("ENTER\n");
-
-	assert (info != NULL);
-	assert (var != NULL);
-
-	DPRINTK ("Requested: %dx%dx%d\n", var->xres, var->yres, var->bits_per_pixel);
-	DPRINTK ("  virtual: %dx%d\n", var->xres_virtual, var->yres_virtual);
-	DPRINTK ("   offset: (%d,%d)\n", var->xoffset, var->yoffset);
-	DPRINTK ("grayscale: %d\n", var->grayscale);
-
-	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
-	assert (dsp != NULL);
-
-	/* if var has changed, we should call changevar() later */
-	if (con >= 0) {
-		chgvar = ((dsp->var.xres != var->xres) ||
-		    (dsp->var.yres != var->yres) ||
-                    (dsp->var.xres_virtual != var->xres_virtual) ||
-		    (dsp->var.yres_virtual != var->yres_virtual) ||
-		    (dsp->var.bits_per_pixel != var->bits_per_pixel) ||
-		    memcmp(&dsp->var.red, &var->red, sizeof(var->red)) ||
-		    memcmp(&dsp->var.green, &var->green, sizeof(var->green)) ||
-		    memcmp(&dsp->var.blue, &var->blue, sizeof(var->blue)));
-	}
-
-	memcpy (&v, var, sizeof (v));
-
-	switch (v.bits_per_pixel) {
-#ifdef FBCON_HAS_MFB
-	case 1:
-		dsp->dispsw = &fbcon_mfb;
-		dsp->line_length = v.xres_virtual / 8;
-		dsp->visual = FB_VISUAL_MONO10;
-		nom = 4;
-		den = 8;
-		break;
-#endif
-
-#ifdef FBCON_HAS_CFB8
-	case 2 ... 8:
-		v.bits_per_pixel = 8;
-		dsp->dispsw = &fbcon_cfb8;
-		nom = 1;
-		den = 1;
-		dsp->line_length = v.xres_virtual;
-		dsp->visual = FB_VISUAL_PSEUDOCOLOR;
-		v.red.offset = 0;
-		v.red.length = 6;
-		v.green.offset = 0;
-		v.green.length = 6;
-		v.blue.offset = 0;
-		v.blue.length = 6;
-		break;
-#endif
-
-#ifdef FBCON_HAS_CFB16
-	case 9 ... 16:
-		v.bits_per_pixel = 16;
-		dsp->dispsw = &fbcon_cfb16;
-		dsp->dispsw_data = &rivainfo->con_cmap.cfb16;
-		nom = 2;
-		den = 1;
-		dsp->line_length = v.xres_virtual * 2;
-		dsp->visual = FB_VISUAL_DIRECTCOLOR;
-#ifdef CONFIG_PREP
-		v.red.offset = 2;
-		v.green.offset = -3;
-		v.blue.offset = 8;
-#else
-		v.red.offset = 10;
-		v.green.offset = 5;
-		v.blue.offset = 0;
-#endif
-		v.red.length = 5;
-		v.green.length = 5;
-		v.blue.length = 5;
-		break;
-#endif
-
-#ifdef FBCON_HAS_CFB32
-	case 17 ... 32:
-		v.bits_per_pixel = 32;
-		dsp->dispsw = &fbcon_cfb32;
-		dsp->dispsw_data = rivainfo->con_cmap.cfb32;
-		nom = 4;
-		den = 1;
-		dsp->line_length = v.xres_virtual * 4;
-		dsp->visual = FB_VISUAL_DIRECTCOLOR;
-#ifdef CONFIG_PREP
-		v.red.offset = 8;
-		v.green.offset = 16;
-		v.blue.offset = 24;
-#else
-		v.red.offset = 16;
-		v.green.offset = 8;
-		v.blue.offset = 0;
-#endif
-		v.red.length = 8;
-		v.green.length = 8;
-		v.blue.length = 8;
-		break;
-#endif
-
-	default:
-		printk (KERN_ERR PFX "mode %dx%dx%d rejected...color depth not supported.\n",
-			var->xres, var->yres, var->bits_per_pixel);
-		DPRINTK ("EXIT, returning -EINVAL\n");
-		return -EINVAL;
-	}
-
-	if (v.xres * nom / den * v.yres > rivainfo->ram_amount) {
-		printk (KERN_ERR PFX "mode %dx%dx%d rejected...resolution too high to fit into video memory!\n",
-			var->xres, var->yres, var->bits_per_pixel);
-		DPRINTK ("EXIT - EINVAL error\n");
-		return -EINVAL;
-	}
-
-	/* use highest possible virtual resolution */
-	if (v.xres_virtual == -1 &&
-	    v.yres_virtual == -1) {
-		printk (KERN_WARNING PFX "using maximum available virtual resolution\n");
-		for (i = 0; modes[i].xres != -1; i++) {
-			if (modes[i].xres * nom / den * modes[i].yres < rivainfo->ram_amount / 2)
-				break;
-		}
-		if (modes[i].xres == -1) {
-			printk (KERN_ERR PFX "could not find a virtual resolution that fits into video memory!!\n");
-			DPRINTK ("EXIT - EINVAL error\n");
-			return -EINVAL;
-		}
-		v.xres_virtual = modes[i].xres;
-		v.yres_virtual = modes[i].yres;
-
-		printk (KERN_INFO PFX "virtual resolution set to maximum of %dx%d\n",
-			v.xres_virtual, v.yres_virtual);
-	} else if (v.xres_virtual == -1) {
-		/* FIXME: maximize X virtual resolution only */
-	} else if (v.yres_virtual == -1) {
-		/* FIXME: maximize Y virtual resolution only */
-	}
-
-	if (v.xoffset < 0)
-		v.xoffset = 0;
-	if (v.yoffset < 0)
-		v.yoffset = 0;
-
-	/* truncate xoffset and yoffset to maximum if too high */
-	if (v.xoffset > v.xres_virtual - v.xres)
-		v.xoffset = v.xres_virtual - v.xres - 1;
-
-	if (v.yoffset > v.yres_virtual - v.yres)
-		v.yoffset = v.yres_virtual - v.yres - 1;
-
-	v.red.msb_right =
-	    v.green.msb_right =
-	    v.blue.msb_right =
-	    v.transp.offset =
-	    v.transp.length =
-	    v.transp.msb_right = 0;
-
-	switch (v.activate & FB_ACTIVATE_MASK) {
-	case FB_ACTIVATE_TEST:
-		DPRINTK ("EXIT - FB_ACTIVATE_TEST\n");
-		return 0;
-	case FB_ACTIVATE_NXTOPEN:	/* ?? */
-	case FB_ACTIVATE_NOW:
-		break;		/* continue */
-	default:
-		DPRINTK ("EXIT - unknown activation type\n");
-		return -EINVAL;	/* unknown */
-	}
-
-	dsp->type = FB_TYPE_PACKED_PIXELS;
-
-#warning FIXME: verify that the above code sets dsp->* fields correctly
-
-	memcpy (&dsp->var, &v, sizeof (v));
-
-	riva_load_video_mode (rivainfo, &v);
-
-	if (chgvar && info && info->changevar)
-		info->changevar (con);
-
-	DPRINTK ("EXIT, returning 0\n");
-	return 0;
-}
-
-
-
-/**
- * rivafb_get_cmap
- * @cmap:
- * @kspc:
- * @con:
- * @info:
- *
- * DESCRIPTION:
- *
- * NOTES:
- * Copied from matroxfb::matroxfb_get_cmap()
- */
-
-int rivafb_get_cmap (struct fb_cmap *cmap, int kspc, int con,
-		   struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-	struct display *dsp;
-
-	DPRINTK ("ENTER\n");
-
-	assert (rivainfo != NULL);
-	assert (cmap != NULL);
-
-	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
-
-	if (con == rivainfo->currcon) {	/* current console? */
-		int rc = fb_get_cmap (cmap, kspc, riva_getcolreg, info);
-		DPRINTK ("EXIT - returning %d\n", rc);
-		return rc;
-	} else if (dsp->cmap.len)	/* non default colormap? */
-		fb_copy_cmap (&dsp->cmap, cmap, kspc ? 0 : 2);
-	else
-		fb_copy_cmap (fb_default_cmap (riva_get_cmap_len (&dsp->var)),
-			      cmap, kspc ? 0 : 2);
-
-	DPRINTK ("EXIT, returning 0\n");
-
-	return 0;
-}
-
-
-/**
- * rivafb_set_cmap
- * @cmap:
- * @kspc:
- * @con:
- * @info:
- *
- * DESCRIPTION:
- *
- * NOTES:
- * Copied from matroxfb::matroxfb_set_cmap()
- */
-
-int rivafb_set_cmap (struct fb_cmap *cmap, int kspc, int con,
-		   struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-	struct display *dsp;
-	unsigned int cmap_len;
-
-	DPRINTK ("ENTER\n");
-
-	assert (rivainfo != NULL);
-	assert (cmap != NULL);
-
-	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
-
-	cmap_len = riva_get_cmap_len (&dsp->var);
-	if (dsp->cmap.len != cmap_len) {
-		int err = fb_alloc_cmap (&dsp->cmap, cmap_len, 0);
-		if (err) {
-			DPRINTK ("EXIT - returning %d\n", err);
-			return err;
-		}
-	}
-	if (con == rivainfo->currcon) {	/* current console? */
-		int rc = fb_set_cmap (cmap, kspc, riva_setcolreg, info);
-		DPRINTK ("EXIT - returning %d\n", rc);
-		return rc;
-	} else
-		fb_copy_cmap (cmap, &dsp->cmap, kspc ? 0 : 1);
-
-	DPRINTK ("EXIT, returning 0\n");
-
-	return 0;
-}
-
-
-
-/**
- * rivafb_pan_display
- * @var: standard kernel fb changeable data
- * @par: riva-specific hardware info about current video mode
- * @info: pointer to rivafb_info object containing info for current riva board
- *
- * DESCRIPTION:
- * Pan (or wrap, depending on the `vmode' field) the display using the
- * `xoffset' and `yoffset' fields of the `var' structure.
- * If the values don't fit, return -EINVAL.
- *
- * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
- */
-
-int rivafb_pan_display (struct fb_var_screeninfo *var, int con,
-		      struct fb_info *info)
-{
-	unsigned int base;
-	struct display *dsp;
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-
-	DPRINTK ("ENTER\n");
-
-	assert (rivainfo != NULL);
-
-	if (var->xoffset > (var->xres_virtual - var->xres))
-		return -EINVAL;
-	if (var->yoffset > (var->yres_virtual - var->yres))
-		return -EINVAL;
-
-	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
-
-	if (var->vmode & FB_VMODE_YWRAP) {
-		if (var->yoffset < 0 || var->yoffset >= dsp->var.yres_virtual || var->xoffset)
-			return -EINVAL;
-	} else {
-		if (var->xoffset+dsp->var.xres > dsp->var.xres_virtual ||
-		    var->yoffset+dsp->var.yres > dsp->var.yres_virtual)
-			return -EINVAL;
-	}
-
-	base = var->yoffset * dsp->line_length + var->xoffset;
-
-	if (con == rivainfo->currcon) {
-		/* FIXME: do the dirty deed */
-	}
-
-	dsp->var.xoffset = var->xoffset;
-	dsp->var.yoffset = var->yoffset;
-
-	if (var->vmode & FB_VMODE_YWRAP)
-		dsp->var.vmode |= FB_VMODE_YWRAP;
-	else
-		dsp->var.vmode &= ~FB_VMODE_YWRAP;
-
-	DPRINTK ("EXIT, returning 0\n");
-
-	return 0;
-}
-
-
-
-/**
- * rivafb_ioctl
- * @inode:
- * @file:
- * @cmd:
- * @arg:
- * @con:
- * @info:
- *
- * DESCRIPTION:
- */
-
-int rivafb_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
-		unsigned long arg, int con, struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-
-	DPRINTK ("ENTER\n");
-
-	assert (rivainfo != NULL);
-
-	/* no rivafb-specific ioctls */
-
-	DPRINTK ("EXIT, returning -EINVAL\n");
-
-	return -EINVAL;
-}
-
-
-
-
-/**
- * rivafb_switch
- * @con:
- * @info:
- *
- * DESCRIPTION:
- */
-
-int rivafb_switch(int con, struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-	struct fb_cmap* cmap;
-	struct display *dsp;
-
-	DPRINTK("ENTER\n");
-
-	assert (rivainfo != NULL);
-
-	dsp = (con < 0) ? rivainfo->info.disp : &fb_display[con];
-
-	if (rivainfo->currcon >= 0) {
-		/* Do we have to save the colormap? */
-		cmap = &(rivainfo->currcon_display->cmap);
-		DPRINTK("switch1: con = %d, cmap.len = %d\n", rivainfo->currcon, cmap->len);
-
-		if (cmap->len) {
-			DPRINTK("switch1a: %p %p %p %p\n", cmap->red, cmap->green, cmap->blue, cmap->transp);
-			fb_get_cmap(cmap, 1, riva_getcolreg, info);
-#ifdef DEBUG
-			if (cmap->red) {
-				DPRINTK("switch1r: %X\n", cmap->red[0]);
-			}
-#endif
-		}
-	}
-	rivainfo->currcon = con;
-	rivainfo->currcon_display = dsp;
-	dsp->var.activate = FB_ACTIVATE_NOW;
-
-#ifdef riva_DEBUG
-	cmap = &dsp->cmap;
-	DPRINTK("switch2: con = %d, cmap.len = %d\n", con, cmap->len);
-	DPRINTK("switch2a: %p %p %p %p\n", cmap->red, cmap->green, cmap->blue, cmap->transp);
-	if (dsp->cmap.red) {
-		DPRINTK("switch2r: %X\n", cmap->red[0]);
-	}
-#endif
-
-	rivafb_set_var(&dsp->var, con, info);
-
-#ifdef riva_DEBUG
-	DPRINTK("switch3: con = %d, cmap.len = %d\n", con, cmap->len);
-	DPRINTK("switch3a: %p %p %p %p\n", cmap->red, cmap->green, cmap->blue, cmap->transp);
-	if (dsp->cmap.red) {
-		DPRINTK("switch3r: %X\n", cmap->red[0]);
-	}
-#endif
-
-	DPRINTK("EXIT, returning 0\n");
-
-	return 0;
-}
-
-
-
-void rivafb_blank (int blank, struct fb_info *info)
-{
-	unsigned char tmp;
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-
-	DPRINTK ("ENTER\n");
-
-	assert (rivainfo != NULL);
-
-	tmp = vga_io_rseq (VGA_SEQ_CLOCK_MODE) & ~VGA_SR01_SCREEN_OFF;
-
-	if (blank)
-		tmp |= VGA_SR01_SCREEN_OFF;
-
-	vga_io_wseq (VGA_SEQ_CLOCK_MODE, tmp);
-
-	DPRINTK("EXIT\n");
-}
-
-
-/* -------------------------------------------------------------------------
- *
- * internal fb_ops helper functions
- *
- * -------------------------------------------------------------------------
- */
-
-
-/**
- * riva_get_cmap_len
- * @var:
- *
- * DESCRIPTION:
- */
-
-static int riva_get_cmap_len(const struct fb_var_screeninfo *var)
-{
-	int rc = 16; /* reasonable default */
-
-	assert (var != NULL);
-
-	switch (var->bits_per_pixel) {
-#ifdef FBCON_HAS_CFB4
-		case 4:
-			rc = 16;	/* pseudocolor... 16 entries HW palette */
-			break;
-#endif
-#ifdef FBCON_HAS_CFB8
-		case 8:
-			rc = 256;	/* pseudocolor... 256 entries HW palette */
-			break;
-#endif
-#ifdef FBCON_HAS_CFB16
-		case 16:
-			rc = 16;	/* directcolor... 16 entries SW palette */
-			break;		/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */
-#endif
-#ifdef FBCON_HAS_CFB32
-		case 32:
-			rc = 16;	/* directcolor... 16 entries SW palette */
-			break;		/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */
-#endif
-		default:
-			assert (0);
-			/* should not occur */
-			break;
-	}
-
-	return rc;
-}
-
-
-/**
- * riva_getcolreg
- * @regno:
- * @red:
- * @green:
- * @blue:
- * @transp:
- * @info: pointer to rivafb_info object containing info for current riva board
- *
- * DESCRIPTION:
- * Read a single color register and split it into colors/transparent.
- * The return values must have a 16 bit magnitude.
- * Return != 0 for invalid regno.
- *
- * CALLED FROM:
- * fbcmap.c:fb_get_cmap()
- *	fbgen.c:fbgen_get_cmap()
- *	fbgen.c:fbgen_switch()
- */
-
-static int riva_getcolreg (unsigned regno, unsigned *red, unsigned *green,
-			 unsigned *blue, unsigned *transp,
-			 struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-
-    if (regno > 255)
-	return 1;
-    *red = rivainfo->palette[regno].red;
-    *green = rivainfo->palette[regno].green;
-    *blue = rivainfo->palette[regno].blue;
-    *transp = 0;
-    return 0;
-}
-
-
-/**
- * riva_setcolreg
- * @regno:
- * @red:
- * @green:
- * @blue:
- * @transp:
- * @info: pointer to rivafb_info object containing info for current riva board
- *
- * DESCRIPTION:
- * Set a single color register. The values supplied have a 16 bit
- * magnitude.
- * Return != 0 for invalid regno.
- *
- * CALLED FROM:
- * fbcmap.c:fb_set_cmap()
- *	fbgen.c:fbgen_get_cmap()
- *	fbgen.c:fbgen_install_cmap()
- *		fbgen.c:fbgen_set_var()
- *		fbgen.c:fbgen_switch()
- *		fbgen.c:fbgen_blank()
- *	fbgen.c:fbgen_blank()
- */
-
-static int riva_setcolreg (unsigned regno, unsigned red, unsigned green,
-		    unsigned blue, unsigned transp,
-		    struct fb_info *info)
-{
-	struct rivafb_info *rivainfo = (struct rivafb_info *) info;
-	struct display *p;
-
-	DPRINTK("ENTER\n");
-
-	assert (rivainfo != NULL);
-	assert (rivainfo->currcon_display != NULL);
-
-	if (regno > 255)
-		return -EINVAL;
-
-	p = rivainfo->currcon_display;
-	if (p->var.grayscale) {
-		/* gray = 0.30*R + 0.59*G + 0.11*B */
-		red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
-	}
-
-#ifdef FBCON_HAS_CFB8
-	switch (p->var.bits_per_pixel) {
-	case 8:
-		/* "transparent" stuff is completely ignored. */
-		riva_wclut (regno, red >> 10, green >> 10, blue >> 10);
-		break;
-	default:
-		/* do nothing */
-		break;
-	}
-#endif	/* FBCON_HAS_CFB8 */
-
-	rivainfo->palette[regno].red = red;
-	rivainfo->palette[regno].green = green;
-	rivainfo->palette[regno].blue = blue;
-
-	if (regno >= 16)
-		return 0;
-		
-	switch (p->var.bits_per_pixel) {
-
-#ifdef FBCON_HAS_CFB16
-	case 16:
-		assert (regno < 16);
-#ifdef CONFIG_PREP
-		rivainfo->con_cmap.cfb16[regno] =
-		    ((red & 0xf800) >> 9) |
-		    ((green & 0xf800) >> 14) |
-		    ((green & 0xf800) << 2) |
-		    ((blue & 0xf800) >> 3);
-#else
-		rivainfo->con_cmap.cfb16[regno] =
-		    ((red & 0xf800) >> 1) |
-		    ((green & 0xf800) >> 6) |
-		    ((blue & 0xf800) >> 11);
-#endif
-		break;
-#endif /* FBCON_HAS_CFB16 */
-
-#ifdef FBCON_HAS_CFB32
-	case 32:
-		assert (regno < 16);
-#ifdef CONFIG_PREP
-		rivainfo->con_cmap.cfb32[regno] =
-		    ((red & 0xff00)) |
-		    ((green & 0xff00) << 8) |
-		    ((blue & 0xff00) << 16);
-#else
-		rivainfo->con_cmap.cfb32[regno] =
-		    ((red & 0xff00) << 8) |
-		    ((green & 0xff00)) |
-		    ((blue & 0xff00) >> 8);
-#endif
-		break;
-#endif /* FBCON_HAS_CFB32 */
-
-	default:
-		/* do nothing */
-		break;
-	}
-
-	return 0;
-}
-
-
-
-/*
- * riva_load_video_mode()
- *
- * calculate some timings and then send em off to riva_load_state()
- */
-
-static void riva_load_video_mode (struct rivafb_info *rinfo,
-				struct fb_var_screeninfo *video_mode)
-{
-	struct riva_regs newmode;
-	int bpp, width, hDisplaySize, hDisplay, hStart,
-		hEnd, hTotal, height, vDisplay, vStart,
-		vEnd, vTotal, dotClock;
-
-	/* time to calculate */
-
-	bpp = video_mode->bits_per_pixel;
-	width = hDisplaySize = video_mode->xres;
-	hDisplay = (hDisplaySize/8) - 1;
-	hStart = (hDisplaySize + video_mode->right_margin)/8 + 2;
-	hEnd = (hDisplaySize + video_mode->right_margin +
-		video_mode->hsync_len)/8 - 1;
-	hTotal = (hDisplaySize + video_mode->right_margin +
-		  video_mode->hsync_len + video_mode->left_margin)/8 - 1;
-	height = video_mode->yres;
-	vDisplay = video_mode->yres - 1;
-	vStart = video_mode->yres + video_mode->lower_margin - 1;
-	vEnd = video_mode->yres + video_mode->lower_margin +
-	       video_mode->vsync_len - 1;
-	vTotal = video_mode->yres + video_mode->lower_margin +
-		 video_mode->vsync_len + video_mode->upper_margin + 2;
-	dotClock = 1000000000 / video_mode->pixclock;
-
-	memcpy(&newmode, &reg_template, sizeof(struct riva_regs));
-
-	newmode.crtc[0x0] = Set8Bits(hTotal - 4);
-	newmode.crtc[0x1] = Set8Bits(hDisplay);
-	newmode.crtc[0x2] = Set8Bits(hDisplay);
-	newmode.crtc[0x3] = SetBitField(hTotal,4:0,4:0) | SetBit(7);
-	newmode.crtc[0x4] = Set8Bits(hStart);
-	newmode.crtc[0x5] = SetBitField(hTotal,5:5,7:7)
-				| SetBitField(hEnd,4:0,4:0);
-	newmode.crtc[0x6] = SetBitField(vTotal,7:0,7:0);
-	newmode.crtc[0x7] = SetBitField(vTotal,8:8,0:0)
-				| SetBitField(vDisplay,8:8,1:1)
-				| SetBitField(vStart,8:8,2:2)
-				| SetBitField(vDisplay,8:8,3:3)
-				| SetBit(4)
-				| SetBitField(vTotal,9:9,5:5)
-				| SetBitField(vDisplay,9:9,6:6)
-				| SetBitField(vStart,9:9,7:7);
-	newmode.crtc[0x9] = SetBitField(vDisplay,9:9,5:5)
-				| SetBit(6);
-	newmode.crtc[0x10] = Set8Bits(vStart);
-	newmode.crtc[0x11] = SetBitField(vEnd,3:0,3:0)
-				| SetBit(5);
-	newmode.crtc[0x12] = Set8Bits(vDisplay);
-	newmode.crtc[0x13] = ((width/8)*(bpp/8)) & 0xFF;
-	newmode.crtc[0x15] = Set8Bits(vDisplay);
-	newmode.crtc[0x16] = Set8Bits(vTotal + 1);
-
-	newmode.ext.bpp = bpp;
-	newmode.ext.width = width;
-	newmode.ext.height = height;
-
-	rinfo->riva.CalcStateExt(&rinfo->riva,&newmode.ext,bpp,width,
-				 hDisplaySize,hDisplay,hStart,hEnd,hTotal,
-				 height,vDisplay,vStart,vEnd,vTotal,dotClock);
-
-	rinfo->initial_state = newmode;
-	riva_load_state(rinfo,&newmode);
-}
-
-
-
-
-
-/* ------------------------------------------------------------------------- */
-
-
-    /*
-     *  Modularization
-     */
-
-#ifdef MODULE
-int __init init_module(void)
-{
-    return rivafb_init();
-}
-
-void __exit cleanup_module(void)
-{
-	struct rivafb_info *tmp, *board = riva_boards;
-
-	while (board != NULL) {
-		riva_load_state (board, &board->initial_state);
-
-		unregister_framebuffer ((struct fb_info *) board);
-
-		tmp = board;
-		iounmap (tmp->ctrl_base);
-		iounmap (tmp->fb_base);
-		board = board->next;
-
-		kfree (tmp);
-	}
-}
-#endif /* MODULE */
-
-
-
-
-
-/* from GGI */
-static
-void riva_save_state(struct rivafb_info *rinfo, struct riva_regs *regs)
-{
-        int i;
-
-        io_out8(NV_CIO_SR_LOCK_INDEX, 0x3D4);
-        io_out8(NV_CIO_SR_UNLOCK_RW_VALUE, 0x3D5);
-
-        rinfo->riva.UnloadStateExt(&rinfo->riva, &regs->ext);
-
-        regs->misc_output = io_in8(0x3CC);
-
-        for (i = 0; i < NUM_CRT_REGS; i++)
-        {
-                io_out8(i, 0x3D4);
-                regs->crtc[i] = io_in8(0x3D5);
-        }
-
-        for (i = 0; i < NUM_ATC_REGS; i++)
-        {
-                io_out8(i, 0x3C0);
-                regs->attr[i] = io_in8(0x3C1);
-        }
-
-        for (i = 0; i < NUM_GRC_REGS; i++)
-        {
-                io_out8(i, 0x3CE);
-                regs->gra[i] = io_in8(0x3CF);
-        }
-
-
-        for (i = 0; i < NUM_SEQ_REGS; i++)
-        {
-                io_out8(i, 0x3C4);
-                regs->seq[i] = io_in8(0x3C5);
-        }
-}
-
-
-/* from GGI */
-static
-void riva_load_state(struct rivafb_info *rinfo, struct riva_regs *regs)
-{
-        int i;
-	RIVA_HW_STATE *state = &regs->ext;
-
-        io_out8(0x11, 0x3D4);
-        io_out8(0x00, 0x3D5);
-
-        io_out8(NV_CIO_SR_LOCK_INDEX, 0x3D4);
-        io_out8(NV_CIO_SR_UNLOCK_RW_VALUE, 0x3D5);
-
- 	rinfo->riva.LoadStateExt(&rinfo->riva,state);
-
-        io_out8(regs->misc_output, 0x3C2);
-
-        for (i = 0; i < NUM_CRT_REGS; i++)
-        {
-                if (i < 0x19)
-                {
-                        io_out8(i, 0x3D4);
-                        io_out8(regs->crtc[i], 0x3D5);
-                }
-                else
-                {
-                        switch (i)
-                        {
-                                case 0x19:
-                                case 0x20:
-                                case 0x21:
-                                case 0x22:
-                                case 0x23:
-                                case 0x24:
-                                case 0x25:
-                                case 0x26:
-                                case 0x27:
-#if 0
-                                case 0x28:
-#endif
-                                case 0x29:
-                                case 0x2a:
-                                case 0x2b:
-                                case 0x2c:
-                                case 0x2d:
-                                case 0x2e:
-                                case 0x2f:
-                                case 0x30:
-                                case 0x31:
-                                case 0x32:
-                                case 0x33:
-                                case 0x34:
-                                case 0x35:
-                                case 0x36:
-                                case 0x37:
-                                case 0x38:
-                                case 0x39:
-                                case 0x3a:
-                                case 0x3b:
-                                case 0x3c:
-                                case 0x3d:
-                                case 0x3e:
-                                case 0x3f:
-#if 0
-                                case 0x40:
-#endif
-                                break;
-                                default:
-                                io_out8(i, 0x3D4);
-                                io_out8(regs->crtc[i], 0x3D5);
-                        }
-                }
-        }
-
-        for (i = 0; i < NUM_ATC_REGS; i++)
-        {
-                io_out8(i, 0x3C0);
-                io_out8(regs->attr[i], 0x3C1);
-        }
-
-        for (i = 0; i < NUM_GRC_REGS; i++)
-        {
-                io_out8(i, 0x3CE);
-                io_out8(regs->gra[i], 0x3CF);
-        }
-
-        for (i = 0; i < NUM_SEQ_REGS; i++)
-        {
-                io_out8(i, 0x3C4);
-                io_out8(regs->seq[i], 0x3C5);
-        }
-}
-
-
-
-
-/**
- * riva_board_list_add
- * @board_list: Root node of list of boards
- * @new_node: New node to be added
- *
- * DESCRIPTION:
- * Adds @new_node to the list referenced by @board_list
- *
- * RETURNS:
- * New root node
- */
-static
-struct rivafb_info *riva_board_list_add(struct rivafb_info *board_list,
-				 struct rivafb_info *new_node)
-{
-	struct rivafb_info *i_p = board_list;
-
-	new_node->next = NULL;
-
-	if (board_list == NULL)
-		return new_node;
-
-	while (i_p->next != NULL)
-		i_p = i_p->next;
-	i_p->next = new_node;
-
-	return board_list;
-}
-
diff -u --recursive --new-file v2.3.48/linux/drivers/video/vesafb.c linux/drivers/video/vesafb.c
--- v2.3.48/linux/drivers/video/vesafb.c	Thu Jan  6 12:57:48 2000
+++ linux/drivers/video/vesafb.c	Mon Feb 28 07:16:55 2000
@@ -550,7 +550,7 @@
 
         video_vbase = ioremap(video_base, video_size);
 
-	printk(KERN_INFO "vesafb: framebuffer at 0x%lu, mapped to 0x%p, size %dk\n",
+	printk(KERN_INFO "vesafb: framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
 	       video_base, video_vbase, video_size/1024);
 	printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
 	       video_width, video_height, video_bpp, video_linelength, screen_info.pages);
diff -u --recursive --new-file v2.3.48/linux/fs/affs/inode.c linux/fs/affs/inode.c
--- v2.3.48/linux/fs/affs/inode.c	Sat Feb 26 22:31:51 2000
+++ linux/fs/affs/inode.c	Mon Feb 28 07:16:54 2000
@@ -31,6 +31,7 @@
 
 extern int *blk_size[];
 extern struct timezone sys_tz;
+extern struct inode_operations affs_symlink_inode_operations;
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
 
diff -u --recursive --new-file v2.3.48/linux/fs/affs/namei.c linux/fs/affs/namei.c
--- v2.3.48/linux/fs/affs/namei.c	Sat Feb 26 22:31:51 2000
+++ linux/fs/affs/namei.c	Mon Feb 28 07:16:54 2000
@@ -21,6 +21,8 @@
 
 #include <linux/errno.h>
 
+extern struct inode_operations affs_symlink_inode_operations;
+
 /* Simple toupper() for DOS\1 */
 
 static unsigned int
@@ -273,10 +275,10 @@
 		goto out;
 
 	pr_debug("AFFS: ino=%lu\n",inode->i_ino);
-	if (dir->i_sb->u.affs_sb.s_flags & SF_OFS)
+	if (dir->i_sb->u.affs_sb.s_flags & SF_OFS) {
 		inode->i_op = &affs_file_inode_operations;
 		inode->i_fop = &affs_file_operations_ofs;
-	else {
+	} else {
 		inode->i_op = &affs_file_inode_operations;
 		inode->i_fop = &affs_file_operations;
 		inode->i_mapping->a_ops = &affs_aops;
diff -u --recursive --new-file v2.3.48/linux/fs/attr.c linux/fs/attr.c
--- v2.3.48/linux/fs/attr.c	Sat Feb 26 22:31:51 2000
+++ linux/fs/attr.c	Thu Mar  2 11:35:12 2000
@@ -91,8 +91,7 @@
 	if (!(ia_valid & ATTR_MTIME_SET))
 		attr->ia_mtime = now;
 
-	if (inode->i_sb && inode->i_sb->s_op &&
-	    inode->i_op->setattr) 
+	if (inode && inode->i_op && inode->i_op->setattr) 
 		error = inode->i_op->setattr(dentry, attr);
 	else {
 		error = inode_change_ok(inode, attr);
diff -u --recursive --new-file v2.3.48/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
--- v2.3.48/linux/fs/binfmt_elf.c	Sat Feb 26 22:31:51 2000
+++ linux/fs/binfmt_elf.c	Tue Feb 29 11:13:27 2000
@@ -30,6 +30,7 @@
 #include <linux/elfcore.h>
 #include <linux/init.h>
 #include <linux/highuid.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -496,13 +497,19 @@
 				unsigned long old_pers = current->personality;
 					
 				current->personality = PER_SVR4;
+				lock_kernel();
 				interpreter_dentry = open_namei(elf_interpreter,
 								0, 0);
+				unlock_kernel();
 				current->personality = old_pers;
 			} else
-#endif					
+#endif
+			{
+				lock_kernel();
 				interpreter_dentry = open_namei(elf_interpreter,
 								0, 0);
+				unlock_kernel();
+			}
 			set_fs(old_fs);
 			retval = PTR_ERR(interpreter_dentry);
 			if (IS_ERR(interpreter_dentry))
@@ -670,7 +677,9 @@
 						    interpreter_dentry,
 						    &interp_load_addr);
 
+		lock_kernel();
 		dput(interpreter_dentry);
+		unlock_kernel();
 		kfree(elf_interpreter);
 
 		if (elf_entry == ~0UL) {
@@ -767,7 +776,9 @@
 
 	/* error cleanup */
 out_free_dentry:
+	lock_kernel();
 	dput(interpreter_dentry);
+	unlock_kernel();
 out_free_interp:
 	if (elf_interpreter)
 		kfree(elf_interpreter);
diff -u --recursive --new-file v2.3.48/linux/fs/binfmt_script.c linux/fs/binfmt_script.c
--- v2.3.48/linux/fs/binfmt_script.c	Sun Feb 20 21:12:39 2000
+++ linux/fs/binfmt_script.c	Tue Feb 29 11:13:27 2000
@@ -11,6 +11,7 @@
 #include <linux/malloc.h>
 #include <linux/binfmts.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs)
 {
@@ -27,7 +28,9 @@
 	 */
 
 	bprm->sh_bang++;
+	lock_kernel();
 	dput(bprm->dentry);
+	unlock_kernel();
 	bprm->dentry = NULL;
 
 	bprm->buf[127] = '\0';
@@ -78,7 +81,9 @@
 	/*
 	 * OK, now restart the process with the interpreter's dentry.
 	 */
+	lock_kernel();
 	dentry = open_namei(interp, 0, 0);
+	unlock_kernel();
 	if (IS_ERR(dentry))
 		return PTR_ERR(dentry);
 
diff -u --recursive --new-file v2.3.48/linux/fs/block_dev.c linux/fs/block_dev.c
--- v2.3.48/linux/fs/block_dev.c	Sat Feb 26 22:31:51 2000
+++ linux/fs/block_dev.c	Sun Feb 27 08:47:51 2000
@@ -630,7 +630,7 @@
 	/* syncing will go here */
 	if (kind == BDEV_FILE || kind == BDEV_FS)
 		fsync_dev(rdev);
-	if (atomic_dec_and_test(&bdev->bd_openers)) {
+	if (atomic_dec_and_test(&bdev->bd_openers) && MAJOR(rdev) != RAMDISK_MAJOR) {
 		/* invalidating buffers will go here */
 		invalidate_buffers(rdev);
 	}
diff -u --recursive --new-file v2.3.48/linux/fs/exec.c linux/fs/exec.c
--- v2.3.48/linux/fs/exec.c	Sat Feb 26 22:31:52 2000
+++ linux/fs/exec.c	Tue Feb 29 11:13:27 2000
@@ -277,13 +277,13 @@
 	pmd = pmd_alloc(pgd, address);
 	if (!pmd) {
 		__free_page(page);
-		oom(tsk);
+		force_sig(SIGKILL, tsk);
 		return;
 	}
 	pte = pte_alloc(pmd, address);
 	if (!pte) {
 		__free_page(page);
-		oom(tsk);
+		force_sig(SIGKILL, tsk);
 		return;
 	}
 	if (!pte_none(*pte)) {
@@ -738,14 +738,18 @@
 		char * dynloader[] = { "/sbin/loader" };
 		struct dentry * dentry;
 
+		lock_kernel();
 		dput(bprm->dentry);
+		unlock_kernel();
 		bprm->dentry = NULL;
 
 	        bprm_loader.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
 	        for (i = 0 ; i < MAX_ARG_PAGES ; i++)	/* clear page-table */
                     bprm_loader.page[i] = NULL;
 
+		lock_kernel();
 		dentry = open_namei(dynloader[0], 0, 0);
+		unlock_kernel();
 		retval = PTR_ERR(dentry);
 		if (IS_ERR(dentry))
 			return retval;
@@ -766,8 +770,11 @@
 				continue;
 			retval = fn(bprm, regs);
 			if (retval >= 0) {
-				if (bprm->dentry)
+				if (bprm->dentry) {
+					lock_kernel();
 					dput(bprm->dentry);
+					unlock_kernel();
+				}
 				bprm->dentry = NULL;
 				current->did_exec = 1;
 				return retval;
@@ -810,7 +817,10 @@
 	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
 	memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); 
 
+	lock_kernel();
 	dentry = open_namei(filename, 0, 0);
+	unlock_kernel();
+
 	retval = PTR_ERR(dentry);
 	if (IS_ERR(dentry))
 		return retval;
@@ -821,12 +831,16 @@
 	bprm.loader = 0;
 	bprm.exec = 0;
 	if ((bprm.argc = count(argv, bprm.p / sizeof(void *))) < 0) {
+		lock_kernel();
 		dput(dentry);
+		unlock_kernel();
 		return bprm.argc;
 	}
 
 	if ((bprm.envc = count(envp, bprm.p / sizeof(void *))) < 0) {
+		lock_kernel();
 		dput(dentry);
+		unlock_kernel();
 		return bprm.envc;
 	}
 
@@ -854,8 +868,11 @@
 
 out:
 	/* Something went wrong, return the inode and free the argument pages*/
-	if (bprm.dentry)
+	if (bprm.dentry) {
+		lock_kernel();
 		dput(bprm.dentry);
+		unlock_kernel();
+	}
 
 	/* Assumes that free_page() can take a NULL argument. */ 
 	/* I hope this is ok for all architectures */ 
diff -u --recursive --new-file v2.3.48/linux/fs/nfsd/export.c linux/fs/nfsd/export.c
--- v2.3.48/linux/fs/nfsd/export.c	Tue Feb  1 01:35:44 2000
+++ linux/fs/nfsd/export.c	Mon Feb 28 17:59:21 2000
@@ -611,7 +611,7 @@
 	{ NFSEXP_SUNSECURE, { "sunsecure", ""}},
 	{ NFSEXP_CROSSMNT, {"nohide", ""}},
 	{ NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
-	{ NFSEXP_NOAUTHNLM, {"no_auth_nlm", ""}},
+	{ NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
 	{ 0, {"", ""}}
 };
 
diff -u --recursive --new-file v2.3.48/linux/fs/nfsd/nfs3xdr.c linux/fs/nfsd/nfs3xdr.c
--- v2.3.48/linux/fs/nfsd/nfs3xdr.c	Sun Feb 20 21:12:39 2000
+++ linux/fs/nfsd/nfs3xdr.c	Mon Feb 28 17:59:21 2000
@@ -181,7 +181,11 @@
 	} else {
 		p = xdr_encode_hyper(p, (u64) inode->i_size);
 	}
-	p = xdr_encode_hyper(p, ((u64)inode->i_blocks) << 9);
+	if (inode->i_blksize == 0 && inode->i_blocks == 0)
+		/* Minix file system(?) i_size is (hopefully) close enough */
+		p = xdr_encode_hyper(p, (u64)(inode->i_size +511)& ~511);
+	else
+		p = xdr_encode_hyper(p, ((u64)inode->i_blocks) << 9);
 	*p++ = htonl((u32) MAJOR(inode->i_rdev));
 	*p++ = htonl((u32) MINOR(inode->i_rdev));
 	p = xdr_encode_hyper(p, (u64) inode->i_dev);
diff -u --recursive --new-file v2.3.48/linux/fs/nfsd/vfs.c linux/fs/nfsd/vfs.c
--- v2.3.48/linux/fs/nfsd/vfs.c	Sat Feb 26 22:31:53 2000
+++ linux/fs/nfsd/vfs.c	Mon Feb 28 18:02:45 2000
@@ -216,8 +216,10 @@
 
 	if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
 		accmode |= MAY_WRITE;
-	if (iap->ia_valid & ATTR_SIZE)
+	if (iap->ia_valid & ATTR_SIZE) {
+		accmode |= MAY_OWNER_OVERRIDE;
 		ftype = S_IFREG;
+	}
 
 	/* Get inode */
 	err = fh_verify(rqstp, fhp, ftype, accmode);
@@ -247,7 +249,7 @@
 	    if (delta<0) delta = -delta;
 	    if (delta < MAX_TOUCH_TIME_ERROR) {
 		/* turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME
-		 * this will cause notify_change to setthese times to "now"
+		 * this will cause notify_change to set these times to "now"
 		 */
 		iap->ia_valid &= ~BOTH_TIME_SET;
 		err = inode_change_ok(inode, iap);
@@ -262,7 +264,7 @@
 if (!S_ISREG(inode->i_mode))
 printk("nfsd_setattr: size change??\n");
 		if (iap->ia_size < inode->i_size) {
-			err = nfsd_permission(fhp->fh_export, dentry, MAY_TRUNC);
+			err = nfsd_permission(fhp->fh_export, dentry, MAY_TRUNC|MAY_OWNER_OVERRIDE);
 			if (err)
 				goto out;
 		}
@@ -369,7 +371,7 @@
 	struct svc_export	*export;
 	struct dentry		*dentry;
 	u32			query, result = 0;
-	int			error;
+	unsigned int		error;
 
 	error = fh_verify(rqstp, fhp, 0, MAY_NOP);
 	if (error)
@@ -378,28 +380,39 @@
 	export = fhp->fh_export;
 	dentry = fhp->fh_dentry;
 
-	if (S_ISREG(dentry->d_inode->i_mode)) {
+	if (S_ISREG(dentry->d_inode->i_mode))
 		map = nfs3_regaccess;
-	} else if (S_ISDIR(dentry->d_inode->i_mode)) {
+	else if (S_ISDIR(dentry->d_inode->i_mode))
 		map = nfs3_diraccess;
-	} else {
+	else
 		map = nfs3_anyaccess;
-	}
+
 
 	query = *access;
-	while (map->access) {
+	for  (; map->access; map++) {
 		if (map->access & query) {
-			error = nfsd_permission(export, dentry, map->how);
-			if (error == 0)
+			unsigned int err2;
+			err2 = nfsd_permission(export, dentry, map->how);
+			/* cannot use a "switch" as nfserr_* are variables, even though they are constant :-( */
+			if (err2 == 0)
 				result |= map->access;
-			else if (error != -EPERM)
+			/* the following error codes just mean the access was not allowed,
+			 * rather than an error occurred */
+			else if (err2 == nfserr_rofs ||
+				 err2 == nfserr_acces ||
+				 err2 == nfserr_perm
+				)
+				/* simply don't "or" in the access bit. */
+					;
+			else {
+				error = err2;
 				goto out;
+			}
 		}
-		map++;
 	}
 	*access = result;
 
-out:
+ out:
 	return error;
 }
 #endif
@@ -419,7 +432,10 @@
 	struct inode	*inode;
 	int		err;
 
-	err = fh_verify(rqstp, fhp, type, access);
+	/* If we get here, then the client has already done an "open", and (hopefully)
+	 * checked permission - so allow OWNER_OVERRIDE in case a chmod has now revoked
+	 * permission */
+	err = fh_verify(rqstp, fhp, type, access | MAY_OWNER_OVERRIDE);
 	if (err)
 		goto out;
 
@@ -1029,60 +1045,6 @@
 #endif /* CONFIG_NFSD_V3 */
 
 /*
- * Truncate a file.
- * The calling routines must make sure to update the ctime
- * field and call notify_change.
- *
- * XXX Nobody calls this thing? -DaveM
- * N.B. After this call fhp needs an fh_put
- */
-int
-nfsd_truncate(struct svc_rqst *rqstp, struct svc_fh *fhp, unsigned long size)
-{
-	struct dentry	*dentry;
-	struct inode	*inode;
-	struct iattr	newattrs;
-	int		err;
-	kernel_cap_t	saved_cap = 0;
-
-	err = fh_verify(rqstp, fhp, S_IFREG, MAY_WRITE | MAY_TRUNC);
-	if (err)
-		goto out;
-
-	dentry = fhp->fh_dentry;
-	inode = dentry->d_inode;
-
-	err = get_write_access(inode);
-	if (err)
-		goto out_nfserr;
-	err = locks_verify_truncate(inode, NULL, size);
-	if (err)
-		goto out_nfserr;
-
-	/* Things look sane, lock and do it. */
-	fh_lock(fhp);
-	DQUOT_INIT(inode);
-	newattrs.ia_size = size;
-	newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-	if (current->fsuid != 0) {
-		saved_cap = current->cap_effective;
-		cap_clear(current->cap_effective);
-	}
-	err = notify_change(dentry, &newattrs);
-	if (current->fsuid != 0)
-		current->cap_effective = saved_cap;
-	put_write_access(inode);
-	if (EX_ISSYNC(fhp->fh_export))
-		nfsd_sync_dir(dentry);
-	fh_unlock(fhp);
-out_nfserr:
-	if (err)
-		err = nfserrno(-err);
-out:
-	return err;
-}
-
-/*
  * Read a symlink. On entry, *lenp must contain the maximum path length that
  * fits into the buffer. On return, it contains the true length.
  * N.B. After this call fhp needs an fh_put
@@ -1627,7 +1589,7 @@
 	if (acc == MAY_NOP)
 		return 0;
 #if 0
-	dprintk("nfsd: permission 0x%x%s%s%s%s%s%s mode 0%o%s%s%s\n",
+	dprintk("nfsd: permission 0x%x%s%s%s%s%s%s%s mode 0%o%s%s%s\n",
 		acc,
 		(acc & MAY_READ)?	" read"  : "",
 		(acc & MAY_WRITE)?	" write" : "",
@@ -1635,6 +1597,7 @@
 		(acc & MAY_SATTR)?	" sattr" : "",
 		(acc & MAY_TRUNC)?	" trunc" : "",
 		(acc & MAY_LOCK)?	" lock"  : "",
+		(acc & MAY_OWNER_OVERRIDE)? " owneroverride" : "",
 		inode->i_mode,
 		IS_IMMUTABLE(inode)?	" immut" : "",
 		IS_APPEND(inode)?	" append" : "",
@@ -1654,23 +1617,30 @@
 
 	if (acc & MAY_LOCK) {
 		/* If we cannot rely on authentication in NLM requests,
-		 * just allow locks, others require read permission
+		 * just allow locks, otherwise require read permission, or
+		 * ownership
 		 */
 		if (exp->ex_flags & NFSEXP_NOAUTHNLM)
 			return 0;
 		else
-			acc = MAY_READ;
+			acc = MAY_READ | MAY_OWNER_OVERRIDE;
 	}
 	/*
-	 * The file owner always gets access permission. This is to make
+	 * The file owner always gets access permission for accesses that
+	 * would normally be checked at open time. This is to make
 	 * file access work even when the client has done a fchmod(fd, 0).
 	 *
 	 * However, `cp foo bar' should fail nevertheless when bar is
 	 * readonly. A sensible way to do this might be to reject all
 	 * attempts to truncate a read-only file, because a creat() call
 	 * always implies file truncation.
+	 * ... but this isn't really fair.  A process may reasonably call
+	 * ftruncate on an open file descriptor on a file with perm 000.
+	 * We must trust the client to do permission checking - using "ACCESS"
+	 * with NFSv3.
 	 */
-	if (inode->i_uid == current->fsuid /* && !(acc & MAY_TRUNC) */)
+	if ((acc & MAY_OWNER_OVERRIDE) &&
+	    inode->i_uid == current->fsuid)
 		return 0;
 
 	if (current->fsuid != 0) {
diff -u --recursive --new-file v2.3.48/linux/fs/ntfs/fs.c linux/fs/ntfs/fs.c
--- v2.3.48/linux/fs/ntfs/fs.c	Sat Feb 26 22:31:53 2000
+++ linux/fs/ntfs/fs.c	Sun Feb 27 08:27:54 2000
@@ -692,7 +692,7 @@
 			inode->u.ntfs_i.mmu_private = inode->i_size;
 		} else {
 			inode->i_op=&ntfs_inode_operations_nobmap;
-			inode->i_fop=&ntfs_file_operations_nommap,
+			inode->i_fop=&ntfs_file_operations_nommap;
 		}
 		inode->i_mode=S_IFREG|S_IRUGO;
 	}
diff -u --recursive --new-file v2.3.48/linux/fs/openpromfs/inode.c linux/fs/openpromfs/inode.c
--- v2.3.48/linux/fs/openpromfs/inode.c	Sat Feb 26 22:31:53 2000
+++ linux/fs/openpromfs/inode.c	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-/* $Id: inode.c,v 1.5 2000/02/10 21:16:06 davem Exp $
+/* $Id: inode.c,v 1.6 2000/02/27 08:19:47 davem Exp $
  * openpromfs.c: /proc/openprom handling routines
  *
  * Copyright (C) 1996-1999 Jakub Jelinek  (jakub@redhat.com)
diff -u --recursive --new-file v2.3.48/linux/fs/udf/balloc.c linux/fs/udf/balloc.c
--- v2.3.48/linux/fs/udf/balloc.c	Mon Dec 20 18:48:22 1999
+++ linux/fs/udf/balloc.c	Thu Mar  2 11:17:32 2000
@@ -15,7 +15,7 @@
  *		ftp://prep.ai.mit.edu/pub/gnu/GPL
  *	Each contributing author retains all rights to their own work.
  *
- *  (C) 1999 Ben Fennema
+ *  (C) 1999-2000 Ben Fennema
  *  (C) 1999 Stelias Computing Inc
  *
  * HISTORY
@@ -27,6 +27,7 @@
 #include "udfdecl.h"
 #include <linux/fs.h>
 #include <linux/locks.h>
+#include <linux/quotaops.h>
 #include <linux/udf_fs.h>
 
 #include <asm/bitops.h>
@@ -171,8 +172,8 @@
 	unsigned int block_group)
 {
 	int slot;
-    int nr_groups = (UDF_SB_PARTLEN(sb, UDF_SB_PARTITION(sb)) +
-        (sizeof(struct SpaceBitmapDesc) << 3) + (sb->s_blocksize * 8) - 1) / (sb->s_blocksize * 8);
+	int nr_groups = (UDF_SB_PARTLEN(sb, UDF_SB_PARTITION(sb)) +
+		(sizeof(struct SpaceBitmapDesc) << 3) + (sb->s_blocksize * 8) - 1) / (sb->s_blocksize * 8);
 
 	if (UDF_SB_LOADED_BLOCK_BITMAPS(sb) > 0 &&
 		UDF_SB_BLOCK_BITMAP_NUMBER(sb, 0) == block_group &&
@@ -259,10 +260,14 @@
 			udf_debug("bit %ld already set\n", bit + i);
 			udf_debug("byte=%2x\n", ((char *)bh->b_data)[(bit + i) >> 3]);
 		}
-		else if (UDF_SB_LVIDBH(sb))
+		else
 		{
-			UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)] =
-				cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)])+1);
+			DQUOT_FREE_BLOCK(sb, inode, 1);
+			if (UDF_SB_LVIDBH(sb))
+			{
+				UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)] =
+					cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)])+1);
+			}
 		}
 	}
 	mark_buffer_dirty(bh, 1);
@@ -280,7 +285,7 @@
 	return;
 }
 
-int udf_alloc_blocks(const struct inode * inode, Uint16 partition,
+int udf_prealloc_blocks(const struct inode * inode, Uint16 partition,
 	Uint32 first_block, Uint32 block_count)
 {
 	int alloc_count = 0;
@@ -318,16 +323,18 @@
 	{
 		if (!udf_test_bit(bit, bh->b_data))
 			goto out;
-		if (!udf_clear_bit(bit, bh->b_data))
+		else if (DQUOT_PREALLOC_BLOCK(sb, inode, 1))
+			goto out;
+		else if (!udf_clear_bit(bit, bh->b_data))
 		{
 			udf_debug("bit already cleared for block %d\n", bit);
+			DQUOT_FREE_BLOCK(sb, inode, 1);
 			goto out;
 		}
 		block_count --;
 		alloc_count ++;
 		bit ++;
 		block ++;
-
 	}
 	mark_buffer_dirty(bh, 1);
 	if (block_count > 0)
@@ -451,6 +458,17 @@
 	for (i=0; i<7 && bit > (group_start << 3) && udf_test_bit(bit - 1, bh->b_data); i++, bit--);
 
 got_block:
+
+	/*
+	 * Check quota for allocation of this block.
+	 */
+	if (DQUOT_ALLOC_BLOCK(sb, inode, 1))
+	{
+		unlock_super(sb);
+		*err = -EDQUOT;
+		return 0;
+	}
+
 	newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) -
 		(sizeof(struct SpaceBitmapDesc) << 3);
 
diff -u --recursive --new-file v2.3.48/linux/fs/udf/dir.c linux/fs/udf/dir.c
--- v2.3.48/linux/fs/udf/dir.c	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/dir.c	Thu Mar  2 11:17:32 2000
@@ -15,7 +15,7 @@
  *		ftp://prep.ai.mit.edu/pub/gnu/GPL
  *	Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-1999 Ben Fennema
+ *  (C) 1998-2000 Ben Fennema
  *
  * HISTORY
  *
@@ -32,7 +32,6 @@
 #include "udfdecl.h"
 
 #if defined(__linux__) && defined(__KERNEL__)
-#include <linux/config.h>
 #include <linux/version.h>
 #include "udf_i.h"
 #include "udf_sb.h"
@@ -50,10 +49,10 @@
 /* readdir and lookup functions */
 
 struct file_operations udf_dir_operations = {
-	read:		generic_read_dir,
-	readdir:	udf_readdir,
-	ioctl:		udf_ioctl,
-	fsync:		udf_sync_file,
+	read:				generic_read_dir,
+	readdir:			udf_readdir,
+	ioctl:				udf_ioctl,
+	fsync:				udf_sync_file,
 };
 
 /*
@@ -159,7 +158,7 @@
 	{
 		filp->f_pos = nf_pos;
 
-		fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &bloc, &extoffset, &offset, &bh);
+		fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh);
 
 		if (!fi)
 		{
@@ -193,13 +192,13 @@
 
 		if ( (cfi.fileCharacteristics & FILE_DELETED) != 0 )
 		{
-			if ( !IS_UNDELETE(dir->i_sb) )
+			if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
 				continue;
 		}
 		
 		if ( (cfi.fileCharacteristics & FILE_HIDDEN) != 0 )
 		{
-			if ( !IS_UNHIDE(dir->i_sb) )
+			if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )
 				continue;
 		}
 
diff -u --recursive --new-file v2.3.48/linux/fs/udf/directory.c linux/fs/udf/directory.c
--- v2.3.48/linux/fs/udf/directory.c	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/directory.c	Thu Mar  2 11:17:32 2000
@@ -88,11 +88,10 @@
 	struct udf_fileident_bh *fibh,
 	struct FileIdentDesc *cfi,
 	lb_addr *bloc, Uint32 *extoffset, 
+	lb_addr *eloc, Uint32 *elen,
 	Uint32 *offset, struct buffer_head **bh)
 {
 	struct FileIdentDesc *fi;
-	lb_addr eloc;
-	Uint32 elen;
 	int block;
 
 	fibh->soffset = fibh->eoffset;
@@ -101,17 +100,17 @@
 	{
 		int lextoffset = *extoffset;
 
-		if (udf_next_aext(dir, bloc, extoffset, &eloc, &elen, bh, 1) !=
+		if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) !=
 			EXTENT_RECORDED_ALLOCATED)
 		{
 			return NULL;
 		}
 
-		block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
+		block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset);
 
 		(*offset) ++;
 
-		if ((*offset << dir->i_sb->s_blocksize_bits) >= elen)
+		if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
 			*offset = 0;
 		else
 			*extoffset = lextoffset;
@@ -143,17 +142,17 @@
 	{
 		int lextoffset = *extoffset;
 
-		if (udf_next_aext(dir, bloc, extoffset, &eloc, &elen, bh, 1) !=
+		if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) !=
 			EXTENT_RECORDED_ALLOCATED)
 		{
 			return NULL;
 		}
 
-		block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
+		block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset);
 
 		(*offset) ++;
 
-		if ((*offset << dir->i_sb->s_blocksize_bits) >= elen)
+		if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
 			*offset = 0;
 		else
 			*extoffset = lextoffset;
diff -u --recursive --new-file v2.3.48/linux/fs/udf/file.c linux/fs/udf/file.c
--- v2.3.48/linux/fs/udf/file.c	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/file.c	Thu Mar  2 11:17:32 2000
@@ -16,8 +16,8 @@
  *  Each contributing author retains all rights to their own work.
  *
  *  (C) 1998-1999 Dave Boynton
- *  (C) 1998-1999 Ben Fennema
- *  (C) 1999 Stelias Computing Inc
+ *  (C) 1998-2000 Ben Fennema
+ *  (C) 1999-2000 Stelias Computing Inc
  *
  * HISTORY
  *
@@ -31,7 +31,6 @@
  */
 
 #include "udfdecl.h"
-#include <linux/config.h>
 #include <linux/fs.h>
 #include <linux/udf_fs.h>
 #include <asm/uaccess.h>
@@ -43,52 +42,22 @@
 #include "udf_i.h"
 #include "udf_sb.h"
 
-/*
- * Make sure the offset never goes beyond the 32-bit mark..
- */
-static loff_t udf_file_llseek(struct file * file, loff_t offset, int origin)
-{
-	struct inode * inode = file->f_dentry->d_inode;
-
-	switch (origin)
-	{
-		case 2:
-		{
-			offset += inode->i_size;
-			break;
-		}
-		case 1:
-		{
-			offset += file->f_pos;
-			break;
-		}
-	}
-	if (offset != file->f_pos)
-	{
-		file->f_pos = offset;
-		file->f_reada = 0;
-		file->f_version = ++event;
-	}
-	return offset;
-}
-
 static int udf_adinicb_readpage(struct dentry *dentry, struct page * page)
 {
-	struct inode *inode = dentry->d_inode;
+	struct inode *inode = (struct inode *)page->mapping->host;
 
 	struct buffer_head *bh;
-	unsigned long kaddr = 0;
+	int block;
+	char *kaddr;
 
 	if (!PageLocked(page))
 		PAGE_BUG(page);
 
-	kaddr = kmap(page);
-	memset((char *)kaddr, 0, PAGE_CACHE_SIZE);
-	bh = getblk (inode->i_dev, inode->i_ino, inode->i_sb->s_blocksize);
-	ll_rw_block (READ, 1, &bh);
-	wait_on_buffer(bh);
-	memcpy((char *)kaddr, bh->b_data + udf_ext0_offset(inode),
-		inode->i_size);
+	kaddr = (char *)kmap(page);
+	memset(kaddr, 0, PAGE_CACHE_SIZE);
+	block = udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0);
+	bh = bread (inode->i_dev, block, inode->i_sb->s_blocksize);
+	memcpy(kaddr, bh->b_data + udf_ext0_offset(inode), inode->i_size);
 	brelse(bh);
 	SetPageUptodate(page);
 	kunmap(page);
@@ -98,25 +67,20 @@
 
 static int udf_adinicb_writepage(struct dentry *dentry, struct page *page)
 {
-	struct inode *inode = dentry->d_inode;
+	struct inode *inode = (struct inode *)page->mapping->host;
 
 	struct buffer_head *bh;
-	unsigned long kaddr = 0;
+	int block;
+	char *kaddr;
 
 	if (!PageLocked(page))
-		BUG();
+		PAGE_BUG(page);
 
-	kaddr = kmap(page);
-	bh = getblk (inode->i_dev, inode->i_ino, inode->i_sb->s_blocksize);
-	if (!buffer_uptodate(bh))
-	{
-		ll_rw_block (READ, 1, &bh);
-		wait_on_buffer(bh);
-	}
-	memcpy(bh->b_data + udf_ext0_offset(inode), (char *)kaddr,
-		inode->i_size);
-	ll_rw_block (WRITE, 1, &bh);
-	wait_on_buffer(bh);
+	kaddr = (char *)kmap(page);
+	block = udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0);
+	bh = bread (inode->i_dev, block, inode->i_sb->s_blocksize);
+	memcpy(bh->b_data + udf_ext0_offset(inode), kaddr, inode->i_size);
+	mark_buffer_dirty(bh, 0);
 	brelse(bh);
 	SetPageUptodate(page);
 	kunmap(page);
@@ -131,20 +95,20 @@
 
 static int udf_adinicb_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
 {
-	struct inode *inode = file->f_dentry->d_inode;
+	struct inode *inode = (struct inode *)page->mapping->host;
+
 	struct buffer_head *bh;
+	int block;
 	char *kaddr = (char*)page_address(page);
-	bh = bread (inode->i_dev, inode->i_ino, inode->i_sb->s_blocksize);
-	if (!buffer_uptodate(bh)) {
-		ll_rw_block (READ, 1, &bh);
-		wait_on_buffer(bh);
-	}
+
+	block = udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0);
+	bh = bread (inode->i_dev, block, inode->i_sb->s_blocksize);
 	memcpy(bh->b_data + udf_file_entry_alloc_offset(inode) + offset,
 		kaddr + offset, to-offset);
 	mark_buffer_dirty(bh, 0);
 	brelse(bh);
-	kunmap(page);
 	SetPageUptodate(page);
+	kunmap(page);
 	/* only one page here */
 	if (to > inode->i_size)
 		inode->i_size = to;
@@ -152,10 +116,10 @@
 }
 
 struct address_space_operations udf_adinicb_aops = {
-	readpage: udf_adinicb_readpage,
-	writepage: udf_adinicb_writepage,
-	prepare_write: udf_adinicb_prepare_write,
-	commit_write: udf_adinicb_commit_write
+	readpage:			udf_adinicb_readpage,
+	writepage:			udf_adinicb_writepage,
+	prepare_write:		udf_adinicb_prepare_write,
+	commit_write:		udf_adinicb_commit_write,
 };
 
 static ssize_t udf_file_write(struct file * file, const char * buf,
@@ -165,20 +129,25 @@
 	struct inode *inode = file->f_dentry->d_inode;
 	int err, pos;
 
-	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB) {
+	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+	{
 		if (file->f_flags & O_APPEND)
 			pos = inode->i_size;
 		else
 			pos = *ppos;
 
-		if (inode->i_sb->s_blocksize <
-		    (udf_file_entry_alloc_offset(inode) + pos + count)) {
-			udf_expand_file_adinicb(file, pos + count, &err);
-			if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB) {
+		if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
+			pos + count))
+		{
+			udf_expand_file_adinicb(inode, pos + count, &err);
+			if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+			{
 				udf_debug("udf_expand_adinicb: err=%d\n", err);
 				return err;
 			}
-		} else {
+		}
+		else
+		{
 			if (pos + count > inode->i_size)
 				UDF_I_LENALLOC(inode) = pos + count;
 			else
@@ -187,7 +156,9 @@
 	}
 
 	retval = generic_file_write(file, buf, count, ppos);
-	if (retval > 0) {
+
+	if (retval > 0)
+	{
 		UDF_I_UCTIME(inode) = UDF_I_UMTIME(inode) = CURRENT_UTIME;
 		mark_inode_dirty(inode);
 	}
@@ -350,18 +321,15 @@
 }
 
 struct file_operations udf_file_operations = {
-	llseek:		udf_file_llseek,
-	read:		generic_file_read,
-	write:		udf_file_write,
-	ioctl:		udf_ioctl,
-	mmap:		generic_file_mmap,
-	open:		udf_open_file,
-	release:	udf_release_file,
-	fsync:		udf_sync_file,
+	read:				generic_file_read,
+	ioctl:				udf_ioctl,
+	open:				udf_open_file,
+	mmap:				generic_file_mmap,
+	write:				udf_file_write,
+	release:			udf_release_file,
+	fsync:				udf_sync_file,
 };
 
 struct inode_operations udf_file_inode_operations = {
-#if CONFIG_UDF_RW == 1
-	truncate:	udf_truncate,
-#endif
+	truncate:			udf_truncate,
 };
diff -u --recursive --new-file v2.3.48/linux/fs/udf/ialloc.c linux/fs/udf/ialloc.c
--- v2.3.48/linux/fs/udf/ialloc.c	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/ialloc.c	Thu Mar  2 11:17:32 2000
@@ -26,6 +26,7 @@
 #include "udfdecl.h"
 #include <linux/fs.h>
 #include <linux/locks.h>
+#include <linux/quotaops.h>
 #include <linux/udf_fs.h>
 
 #include "udf_i.h"
@@ -60,6 +61,13 @@
 
 	ino = inode->i_ino;
 
+	/*
+	 * Note: we must free any quota before locking the superblock,
+	 * as writing the quota to disk may need the lock as well.
+	 */
+	DQUOT_FREE_INODE(sb, inode);
+	DQUOT_DROP(inode);
+
 	lock_super(sb);
 
 	is_directory = S_ISDIR(inode->i_mode);
@@ -132,7 +140,9 @@
 	inode->i_nlink = 1;
 	inode->i_dev = sb->s_dev;
 	inode->i_uid = current->fsuid;
-	if (dir->i_mode & S_ISGID)
+	if (test_opt (sb, GRPID))
+		inode->i_gid = dir->i_gid;
+	else if (dir->i_mode & S_ISGID)
 	{
 		inode->i_gid = dir->i_gid;
 		if (S_ISDIR(mode))
@@ -140,6 +150,7 @@
 	}
 	else
 		inode->i_gid = current->fsgid;
+
 	UDF_I_LOCATION(inode).logicalBlockNum = block;
 	UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum;
 	inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0);
@@ -148,12 +159,35 @@
 	inode->i_size = 0;
 	UDF_I_LENEATTR(inode) = 0;
 	UDF_I_LENALLOC(inode) = 0;
-	UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_IN_ICB;
+	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE))
+	{
+		UDF_I_EXTENDED_FE(inode) = 1;
+		UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE);
+	}
+	else
+		UDF_I_EXTENDED_FE(inode) = 0;
+	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_IN_ICB;
+	else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+	else
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 	UDF_I_UMTIME(inode) = UDF_I_UATIME(inode) = UDF_I_UCTIME(inode) = CURRENT_UTIME;
+	UDF_I_NEW_INODE(inode) = 1;
 	insert_inode_hash(inode);
 	mark_inode_dirty(inode);
+
 	unlock_super(sb);
+	if (DQUOT_ALLOC_INODE(sb, inode))
+	{
+		sb->dq_op->drop(inode);
+		inode->i_nlink = 0;
+		iput(inode);
+		*err = -EDQUOT;
+		return NULL;
+	}
+
 	*err = 0;
 	return inode;
 }
diff -u --recursive --new-file v2.3.48/linux/fs/udf/inode.c linux/fs/udf/inode.c
--- v2.3.48/linux/fs/udf/inode.c	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/inode.c	Thu Mar  2 11:17:32 2000
@@ -74,7 +74,10 @@
  */
 void udf_put_inode(struct inode * inode)
 {
+	lock_kernel();
 	udf_discard_prealloc(inode);
+	write_inode_now(inode);
+	unlock_kernel();
 }
 
 /*
@@ -95,10 +98,20 @@
  */
 void udf_delete_inode(struct inode * inode)
 {
+	lock_kernel();
+
+	if (is_bad_inode(inode))
+	{
+		clear_inode(inode);
+		goto out;
+	}
+
 	inode->i_size = 0;
-	if (inode->i_blocks)
-		udf_truncate(inode);
+	udf_truncate(inode);
+	write_inode_now(inode);
 	udf_free_inode(inode);
+out:
+	unlock_kernel();
 }
 
 void udf_discard_prealloc(struct inode * inode)
@@ -107,64 +120,61 @@
 		udf_trunc(inode);
 }
 
-static int udf_alloc_block(struct inode *inode, Uint16 partition,
-	Uint32 goal, int *err)
-{
-	int result = 0;
-	wait_on_super(inode->i_sb);
-
-	result = udf_new_block(inode, partition, goal, err);
-
-	return result;
-}
-
 static int udf_writepage(struct dentry *dentry, struct page *page)
 {
-	return block_write_full_page(page,udf_get_block);
+	return block_write_full_page(page, udf_get_block);
 }
+
 static int udf_readpage(struct dentry *dentry, struct page *page)
 {
-	return block_read_full_page(page,udf_get_block);
+	return block_read_full_page(page, udf_get_block);
 }
+
 static int udf_prepare_write(struct page *page, unsigned from, unsigned to)
 {
-	return block_prepare_write(page,from,to,udf_get_block);
+	return block_prepare_write(page, from, to, udf_get_block);
 }
+
 static int udf_bmap(struct address_space *mapping, long block)
 {
 	return generic_block_bmap(mapping,block,udf_get_block);
 }
-static struct address_space_operations udf_aops = {
-	readpage: udf_readpage,
-	writepage: udf_writepage,
-	prepare_write: udf_prepare_write,
-	commit_write: generic_commit_write,
-	bmap: udf_bmap
+
+struct address_space_operations udf_aops = {
+	readpage:			udf_readpage,
+	writepage:			udf_writepage,
+	prepare_write:		udf_prepare_write,
+	commit_write:		generic_commit_write,
+	bmap:				udf_bmap,
 };
 
-void udf_expand_file_adinicb(struct file * filp, int newsize, int * err)
+void udf_expand_file_adinicb(struct inode * inode, int newsize, int * err)
 {
-	struct inode * inode = filp->f_dentry->d_inode;
 	struct buffer_head *bh = NULL;
 	struct page *page;
 	unsigned long kaddr = 0;
+	int block;
 
 	/* from now on we have normal address_space methods */
 	inode->i_data.a_ops = &udf_aops;
 
 	if (!UDF_I_LENALLOC(inode))
 	{
-		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+		if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+			UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+		else
+			UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
 		mark_inode_dirty(inode);
 		return;
 	}
 
-	bh = udf_tread(inode->i_sb, inode->i_ino, inode->i_sb->s_blocksize);
+	block = udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0);
+	bh = udf_tread(inode->i_sb, block, inode->i_sb->s_blocksize);
 	if (!bh)
 		return;
-	page = grab_cache_page(&inode->i_data, 0);
+	page = grab_cache_page(inode->i_mapping, 0);
 	if (!PageLocked(page))
-		BUG();
+		PAGE_BUG(page);
 	if (!Page_Uptodate(page))
 	{
 		kaddr = kmap(page);
@@ -172,17 +182,21 @@
 			PAGE_CACHE_SIZE - UDF_I_LENALLOC(inode));
 		memcpy((char *)kaddr, bh->b_data + udf_file_entry_alloc_offset(inode),
 			UDF_I_LENALLOC(inode));
+		SetPageUptodate(page);
 		kunmap(page);
 	}
 	memset(bh->b_data + udf_file_entry_alloc_offset(inode),
 		0, UDF_I_LENALLOC(inode));
 	UDF_I_LENALLOC(inode) = 0;
-	UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+	else
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
 	inode->i_blocks = inode->i_sb->s_blocksize / 512;
 	mark_buffer_dirty(bh, 1);
 	udf_release_data(bh);
 
-	inode->i_data.a_ops->writepage(filp->f_dentry, page);
+	inode->i_data.a_ops->writepage(NULL, page);
 	UnlockPage(page);
 	page_cache_release(page);
 
@@ -192,9 +206,10 @@
 
 struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int *err)
 {
-	long_ad newad;
 	int newblock;
 	struct buffer_head *sbh = NULL, *dbh = NULL;
+	lb_addr bloc, eloc;
+	Uint32 elen, extoffset;
 
 	struct udf_fileident_bh sfibh, dfibh;
 	loff_t f_pos = udf_ext0_offset(inode) >> 2;
@@ -203,13 +218,16 @@
 
 	if (!inode->i_size)
 	{
-		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+		if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+			UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+		else
+			UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
 		mark_inode_dirty(inode);
 		return NULL;
 	}
 
 	/* alloc block, and copy data to it */
-	*block = udf_alloc_block(inode,
+	*block = udf_new_block(inode,
 		UDF_I_LOCATION(inode).partitionReferenceNum,
 		UDF_I_LOCATION(inode).logicalBlockNum, err);
 
@@ -232,7 +250,7 @@
 	dfibh.sbh = dfibh.ebh = dbh;
 	while ( (f_pos < size) )
 	{
-		sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, NULL, NULL, NULL);
+		sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, NULL, NULL, NULL, NULL, NULL);
 		if (!sfi)
 		{
 			udf_release_data(sbh);
@@ -256,17 +274,19 @@
 	memset(sbh->b_data + udf_file_entry_alloc_offset(inode),
 		0, UDF_I_LENALLOC(inode));
 
-	memset(&newad, 0x00, sizeof(long_ad));
-	newad.extLength = inode->i_size;
-	newad.extLocation.logicalBlockNum = *block;
-	newad.extLocation.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;
+	UDF_I_LENALLOC(inode) = 0;
+	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+	else
+		UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+	bloc = UDF_I_LOCATION(inode);
+	eloc.logicalBlockNum = *block;
+	eloc.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;
+	elen = inode->i_size;
+	extoffset = udf_file_entry_alloc_offset(inode);
+	udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &sbh, 0);
 	/* UniqueID stuff */
 
-	memcpy(sbh->b_data + udf_file_entry_alloc_offset(inode),
-		&newad, sizeof(newad));
-
-	UDF_I_LENALLOC(inode) = sizeof(newad);
-	UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
 	inode->i_blocks = inode->i_sb->s_blocksize / 512;
 	mark_buffer_dirty(sbh, 1);
 	udf_release_data(sbh);
@@ -438,6 +458,14 @@
 	if (etype == -1)
 	{
 		endnum = startnum = ((count > 1) ? 1 : count);
+		if (laarr[c].extLength & (inode->i_sb->s_blocksize - 1))
+		{
+			laarr[c].extLength =
+				(laarr[c].extLength & UDF_EXTENT_FLAG_MASK) |
+				(((laarr[c].extLength & UDF_EXTENT_LENGTH_MASK) +
+					inode->i_sb->s_blocksize - 1) &
+				~(inode->i_sb->s_blocksize - 1));
+		}
 		c = !c;
 		laarr[c].extLength = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
 			((offset + 1) << inode->i_sb->s_blocksize_bits);
@@ -506,7 +534,7 @@
 				goal = UDF_I_LOCATION(inode).logicalBlockNum + 1;
 		}
 
-		if (!(newblocknum = udf_alloc_block(inode,
+		if (!(newblocknum = udf_new_block(inode,
 			UDF_I_LOCATION(inode).partitionReferenceNum, goal, err)))
 		{
 			udf_release_data(pbh);
@@ -613,7 +641,7 @@
 {
 	int start, length = 0, currlength = 0, i;
 
-	if (*endnum == (c+1) && !lastblock)
+	if (*endnum >= (c+1) && !lastblock)
 		return;
 
 	if ((laarr[c+1].extLength >> 30) == EXTENT_NOT_RECORDED_ALLOCATED)
@@ -644,7 +672,7 @@
 		int next = laarr[start].extLocation.logicalBlockNum +
 			(((laarr[start].extLength & UDF_EXTENT_LENGTH_MASK) +
 			inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits);
-		int numalloc = udf_alloc_blocks(inode,
+		int numalloc = udf_prealloc_blocks(inode,
 			laarr[start].extLocation.partitionReferenceNum,
 			next, (UDF_DEFAULT_PREALLOC_BLOCKS > length ? length :
 				UDF_DEFAULT_PREALLOC_BLOCKS) - currlength);
@@ -864,7 +892,6 @@
 	 */
 
 	inode->i_blksize = PAGE_SIZE;
-	inode->i_version = 1;
 
 	bh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 0, &ident);
 
@@ -948,6 +975,9 @@
 	long convtime_usec;
 	int offset, alen;
 
+	inode->i_version = ++event;
+	UDF_I_NEW_INODE(inode) = 0;
+
 	fe = (struct FileEntry *)bh->b_data;
 	efe = (struct ExtendedFileEntry *)bh->b_data;
 
@@ -1183,7 +1213,9 @@
 
 void udf_write_inode(struct inode * inode)
 {
+	lock_kernel();
 	udf_update_inode(inode, 0);
+	unlock_kernel();
 }
 
 int udf_sync_inode(struct inode * inode)
@@ -1214,6 +1246,17 @@
 	}
 	fe = (struct FileEntry *)bh->b_data;
 	efe = (struct ExtendedFileEntry *)bh->b_data;
+	if (UDF_I_NEW_INODE(inode) == 1)
+	{
+		if (UDF_I_EXTENDED_FE(inode) == 0)
+			memset(bh->b_data, 0x0, sizeof(struct FileEntry));
+		else
+			memset(bh->b_data, 0x00, sizeof(struct ExtendedFileEntry));
+		memset(bh->b_data + udf_file_entry_alloc_offset(inode) +
+			UDF_I_LENALLOC(inode), 0x0, inode->i_sb->s_blocksize -
+			udf_file_entry_alloc_offset(inode) - UDF_I_LENALLOC(inode));
+		UDF_I_NEW_INODE(inode) = 0;
+	}
 
 	if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid)
 		fe->uid = cpu_to_le32(inode->i_uid);
@@ -1236,7 +1279,6 @@
 	else
 		fe->fileLinkCount = cpu_to_le16(inode->i_nlink);
 
-
 	fe->informationLength = cpu_to_le64(inode->i_size);
 
 	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
@@ -1312,8 +1354,17 @@
 		efe->descTag.tagIdent = le16_to_cpu(TID_EXTENDED_FILE_ENTRY);
 		crclen = sizeof(struct ExtendedFileEntry);
 	}
-	fe->icbTag.strategyType = UDF_I_STRAT4096(inode) ? cpu_to_le16(4096) :
-		cpu_to_le16(4);
+	if (UDF_I_STRAT4096(inode))
+	{
+		fe->icbTag.strategyType = cpu_to_le16(4096);
+		fe->icbTag.strategyParameter = cpu_to_le16(1);
+		fe->icbTag.numEntries = cpu_to_le16(2);
+	}
+	else
+	{
+		fe->icbTag.strategyType = cpu_to_le16(4);
+		fe->icbTag.numEntries = cpu_to_le16(1);
+	}
 
 	if (S_ISDIR(inode->i_mode))
 		fe->icbTag.fileType = FILE_TYPE_DIRECTORY;
@@ -1454,11 +1505,10 @@
 		char *sptr, *dptr;
 		struct buffer_head *nbh;
 		int err, loffset;
-		Uint32	lblock = bloc->logicalBlockNum;
-		Uint16  lpart = bloc->partitionReferenceNum;
+		lb_addr obloc = *bloc;
 
 		if (!(bloc->logicalBlockNum = udf_new_block(inode,
-			lpart, lblock, &err)))
+			obloc.partitionReferenceNum, obloc.logicalBlockNum, &err)))
 		{
 			return -1;
 		}
@@ -1468,7 +1518,7 @@
 			return -1;
 		}
 		aed = (struct AllocExtDesc *)(nbh->b_data);
-		aed->previousAllocExtLocation = cpu_to_le32(lblock);
+		aed->previousAllocExtLocation = cpu_to_le32(obloc.logicalBlockNum);
 		if (*extoffset + adsize > inode->i_sb->s_blocksize)
 		{
 			loffset = *extoffset;
@@ -1485,14 +1535,17 @@
 			sptr = (*bh)->b_data + *extoffset;
 			*extoffset = sizeof(struct AllocExtDesc);
 
-			if (UDF_I_LOCATION(inode).logicalBlockNum == lblock)
-				UDF_I_LENALLOC(inode) += adsize;
-			else
+			if (memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr)))
 			{
 				aed = (struct AllocExtDesc *)(*bh)->b_data;
 				aed->lengthAllocDescs =
 					cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
 			}
+			else
+			{
+				UDF_I_LENALLOC(inode) += adsize;
+				mark_inode_dirty(inode);
+			}
 		}
 		udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
 			bloc->logicalBlockNum, sizeof(tag));
@@ -1547,7 +1600,7 @@
 	short_ad *sad = NULL;
 	long_ad *lad = NULL;
 
-    if (!(*bh))
+	if (!(*bh))
 	{
 		if (!(*bh = udf_tread(inode->i_sb,
 			udf_get_lb_pblock(inode->i_sb, bloc, 0),
@@ -1590,6 +1643,8 @@
 		udf_update_tag((*bh)->b_data,
 			le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct AllocExtDesc));
 	}
+	else
+		mark_inode_dirty(inode);
 
 	mark_buffer_dirty(*bh, 1);
 
@@ -1681,10 +1736,11 @@
 		}
 		case ICB_FLAG_AD_IN_ICB:
 		{
-			*bloc = *eloc = UDF_I_LOCATION(inode);
-			*elen = UDF_I_LENALLOC(inode);
-			*extoffset = udf_file_entry_alloc_offset(inode);
+			if (UDF_I_LENALLOC(inode) == 0)
+				return -1;
 			etype = EXTENT_RECORDED_ALLOCATED;
+			*eloc = UDF_I_LOCATION(inode);
+			*elen = UDF_I_LENALLOC(inode);
 			break;
 		}
 		default:
@@ -1696,8 +1752,8 @@
 	if (*elen)
 		return etype;
 
-	udf_debug("Empty Extent, inode=%ld, alloctype=%d, elen=%d, etype=%d, extoffset=%d\n",
-		inode->i_ino, UDF_I_ALLOCTYPE(inode), *elen, etype, *extoffset);
+	udf_debug("Empty Extent, inode=%ld, alloctype=%d, eloc=%d, elen=%d, etype=%d, extoffset=%d\n",
+		inode->i_ino, UDF_I_ALLOCTYPE(inode), eloc->logicalBlockNum, *elen, etype, *extoffset);
 	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
 		*extoffset -= sizeof(short_ad);
 	else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
@@ -1917,7 +1973,7 @@
 int inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffset,
 	lb_addr *eloc, Uint32 *elen, Uint32 *offset, struct buffer_head **bh)
 {
-	int etype, lbcount = 0, b_off;
+	int etype, lbcount = 0;
 
 	if (block < 0)
 	{
@@ -1930,23 +1986,23 @@
 		return -1;
 	}
 
-	*extoffset = udf_file_entry_alloc_offset(inode);
+	*extoffset = 0;
 	*elen = 0;
-	b_off = block << inode->i_sb->s_blocksize_bits;
 	*bloc = UDF_I_LOCATION(inode);
 
 	do
 	{
-		lbcount += *elen;
-
 		if ((etype = udf_next_aext(inode, bloc, extoffset, eloc, elen, bh, 1)) == -1)
 		{
-			*offset = (b_off - lbcount) >> inode->i_sb->s_blocksize_bits;
+			*offset = block - lbcount;
 			return -1;
 		}
-	} while (lbcount + *elen <= b_off);
+		lbcount += ((*elen + inode->i_sb->s_blocksize - 1) >>
+			inode->i_sb->s_blocksize_bits);
+	} while (lbcount <= block);
 
-	*offset = (b_off - lbcount) >> inode->i_sb->s_blocksize_bits;
+	*offset = block + ((*elen + inode->i_sb->s_blocksize - 1) >>
+		inode->i_sb->s_blocksize_bits) - lbcount;
 
 	return etype;
 }
@@ -1966,7 +2022,7 @@
 	if (bh)
 		udf_release_data(bh);
 
-    if (UDF_SB(inode->i_sb)->s_flags & UDF_FLAG_VARCONV)
+	if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_VARCONV))
 		return udf_fixed_to_variable(ret);
 	else
 		return ret;
diff -u --recursive --new-file v2.3.48/linux/fs/udf/lowlevel.c linux/fs/udf/lowlevel.c
--- v2.3.48/linux/fs/udf/lowlevel.c	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/lowlevel.c	Thu Mar  2 11:17:32 2000
@@ -68,39 +68,40 @@
 }
 
 unsigned int
-udf_get_last_block(struct super_block *sb, int *flags)
+udf_get_last_block(struct super_block *sb)
 {
 	extern int *blksize_size[];
 	kdev_t dev = sb->s_dev;
 	struct block_device *bdev = sb->s_bdev;
 	int ret;
-	unsigned long lblock;
-	unsigned int hbsize = get_hardblocksize(dev);
-	unsigned int secsize = 512;
-	unsigned int mult = 0;
-	unsigned int div = 0;
-
-	if (!hbsize)
-		hbsize = blksize_size[MAJOR(dev)][MINOR(dev)];
-
-	if (secsize > hbsize)
-		mult = secsize / hbsize;
-	else if (hbsize > secsize)
-		div = hbsize / secsize;
+	unsigned long lblock = 0;
 
-	lblock = 0;
-	ret = ioctl_by_bdev(bdev, BLKGETSIZE, (unsigned long) &lblock);
+	ret = ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock);
 
-	if (!ret && lblock != 0x7FFFFFFF) /* Hard Disk */
+	if (ret) /* Hard Disk */
 	{
-		if (mult)
-			lblock *= mult;
-		else if (div)
-			lblock /= div;
-	}
-	else /* CDROM */
-	{
-		ret = ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock);
+		unsigned int hbsize = get_hardblocksize(dev);
+		unsigned int blocksize = sb->s_blocksize;
+		unsigned int mult = 0;
+		unsigned int div = 0;
+
+		if (!hbsize)
+			hbsize = blksize_size[MAJOR(dev)][MINOR(dev)];
+
+		if (hbsize > blocksize)
+			mult = hbsize / blocksize;
+		else if (blocksize > hbsize)
+			div = blocksize / hbsize;
+
+		ret = ioctl_by_bdev(bdev, BLKGETSIZE, (unsigned long) &lblock);
+
+		if (!ret && lblock != 0x7FFFFFFF)
+		{
+			if (mult)
+				lblock *= mult;
+			else if (div)
+				lblock /= div;
+		}
 	}
 
 	if (!ret && lblock)
diff -u --recursive --new-file v2.3.48/linux/fs/udf/misc.c linux/fs/udf/misc.c
--- v2.3.48/linux/fs/udf/misc.c	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/misc.c	Thu Mar  2 11:17:32 2000
@@ -69,7 +69,7 @@
 extern struct buffer_head *
 udf_tread(struct super_block *sb, int block, int size)
 {
-	if (UDF_SB(sb)->s_flags & UDF_FLAG_VARCONV)
+	if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
 		return bread(sb->s_dev, udf_fixed_to_variable(block), size);
 	else
 		return bread(sb->s_dev, block, size);
diff -u --recursive --new-file v2.3.48/linux/fs/udf/namei.c linux/fs/udf/namei.c
--- v2.3.48/linux/fs/udf/namei.c	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/namei.c	Thu Mar  2 11:17:32 2000
@@ -26,16 +26,14 @@
 
 #include "udfdecl.h"
 
-#if defined(__linux__) && defined(__KERNEL__)
-#include <linux/version.h>
 #include "udf_i.h"
 #include "udf_sb.h"
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/malloc.h>
+#include <linux/quotaops.h>
 #include <linux/udf_fs.h>
-#endif
 
 static inline int udf_match(int len, const char * const name, struct qstr *qs)
 {
@@ -185,14 +183,13 @@
 
 	if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block, dir->i_sb->s_blocksize)))
 	{
-		udf_debug("udf_tread failed: block=%d\n", block);
 		udf_release_data(bh);
 		return NULL;
 	}
 
 	while ( (f_pos < size) )
 	{
-		fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &bloc, &extoffset, &offset, &bh);
+		fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh);
 
 		if (!fi)
 		{
@@ -228,13 +225,13 @@
 
 		if ( (cfi->fileCharacteristics & FILE_DELETED) != 0 )
 		{
-			if ( !IS_UNDELETE(dir->i_sb) )
+			if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
 				continue;
 		}
 	    
 		if ( (cfi->fileCharacteristics & FILE_HIDDEN) != 0 )
 		{
-			if ( !IS_UNHIDE(dir->i_sb) )
+			if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )
 				continue;
 		}
 
@@ -352,23 +349,27 @@
 		return NULL;
 	sb = dir->i_sb;
 
-	if (!dentry->d_name.len)
-		return NULL;
-
-	if (dir->i_size == 0)
+	if (dentry->d_name.len)
 	{
-		*err = -ENOENT;
-		return NULL;
-	}
+		if ( !(udf_char_to_ustr(&unifilename, dentry->d_name.name, dentry->d_name.len)) )
+		{
+			*err = -ENAMETOOLONG;
+			return NULL;
+		}
 
-	if ( !(udf_char_to_ustr(&unifilename, dentry->d_name.name, dentry->d_name.len)) )
+		if ( !(namelen = udf_UTF8toCS0(name, &unifilename, UDF_NAME_LEN)) )
+		{
+			*err = -ENAMETOOLONG;
+			return NULL;
+		}
+	}
+	else if (dir->i_size != 0)
 	{
-		*err = -ENAMETOOLONG;
+		*err = -ENOENT;
 		return NULL;
 	}
-
-	if ( !(namelen = udf_UTF8toCS0(name, &unifilename, UDF_NAME_LEN)) )
-		return 0;
+	else /* .. */
+		namelen = 0;
 
 	nfidlen = (sizeof(struct FileIdentDesc) + 0 + namelen + 3) & ~3;
 
@@ -388,83 +389,95 @@
 		}
 		else
 			offset = 0;
-	}
-	else
-	{
-		udf_release_data(bh);
-		return NULL;
-	}
 
-	if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block, dir->i_sb->s_blocksize)))
-		return NULL;
-
-	block = UDF_I_LOCATION(dir).logicalBlockNum;
-
-	while ( (f_pos < size) )
-	{
-		fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &bloc, &extoffset, &offset, &bh);
-
-		if (!fi)
+		if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block, dir->i_sb->s_blocksize)))
 		{
-			if (fibh->sbh != fibh->ebh)
-				udf_release_data(fibh->ebh);
-			udf_release_data(fibh->sbh);
 			udf_release_data(bh);
 			return NULL;
 		}
-
-		liu = le16_to_cpu(cfi->lengthOfImpUse);
-		lfi = cfi->lengthFileIdent;
-
-		if (fibh->sbh == fibh->ebh)
-			nameptr = fi->fileIdent + liu;
-		else
-		{
-			int poffset;	/* Unpaded ending offset */
-
-			poffset = fibh->soffset + sizeof(struct FileIdentDesc) + liu + lfi;
-
-			if (poffset >= lfi)
-				nameptr = (char *)(fibh->ebh->b_data + poffset - lfi);
-			else
+	
+		block = UDF_I_LOCATION(dir).logicalBlockNum;
+	
+		while ( (f_pos < size) )
+		{
+			fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh);
+	
+			if (!fi)
 			{
-				nameptr = fname;
-				memcpy(nameptr, fi->fileIdent + liu, lfi - poffset);
-				memcpy(nameptr + lfi - poffset, fibh->ebh->b_data, poffset);
+				if (fibh->sbh != fibh->ebh)
+					udf_release_data(fibh->ebh);
+				udf_release_data(fibh->sbh);
+				udf_release_data(bh);
+				return NULL;
 			}
-		}
-
-		if ( (cfi->fileCharacteristics & FILE_DELETED) != 0 )
-		{
-			if (((sizeof(struct FileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen)
+	
+			liu = le16_to_cpu(cfi->lengthOfImpUse);
+			lfi = cfi->lengthFileIdent;
+	
+			if (fibh->sbh == fibh->ebh)
+				nameptr = fi->fileIdent + liu;
+			else
 			{
-				udf_release_data(bh);
-				cfi->descTag.tagSerialNum = cpu_to_le16(1);
-				cfi->fileVersionNum = cpu_to_le16(1);
-				cfi->fileCharacteristics = 0;
-				cfi->lengthFileIdent = namelen;
-				cfi->lengthOfImpUse = cpu_to_le16(0);
-				if (!udf_write_fi(cfi, fi, fibh, NULL, name))
-					return fi;
+				int poffset;	/* Unpaded ending offset */
+	
+				poffset = fibh->soffset + sizeof(struct FileIdentDesc) + liu + lfi;
+	
+				if (poffset >= lfi)
+					nameptr = (char *)(fibh->ebh->b_data + poffset - lfi);
 				else
+				{
+					nameptr = fname;
+					memcpy(nameptr, fi->fileIdent + liu, lfi - poffset);
+					memcpy(nameptr + lfi - poffset, fibh->ebh->b_data, poffset);
+				}
+			}
+	
+			if ( (cfi->fileCharacteristics & FILE_DELETED) != 0 )
+			{
+				if (((sizeof(struct FileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen)
+				{
+					udf_release_data(bh);
+					cfi->descTag.tagSerialNum = cpu_to_le16(1);
+					cfi->fileVersionNum = cpu_to_le16(1);
+					cfi->fileCharacteristics = 0;
+					cfi->lengthFileIdent = namelen;
+					cfi->lengthOfImpUse = cpu_to_le16(0);
+					if (!udf_write_fi(cfi, fi, fibh, NULL, name))
+						return fi;
+					else
+						return NULL;
+				}
+			}
+	
+			if (!lfi)
+				continue;
+	
+			if ((flen = udf_get_filename(nameptr, fname, lfi)))
+			{
+				if (udf_match(flen, fname, &(dentry->d_name)))
+				{
+					if (fibh->sbh != fibh->ebh)
+						udf_release_data(fibh->ebh);
+					udf_release_data(fibh->sbh);
+					udf_release_data(bh);
+					*err = -EEXIST;
 					return NULL;
+				}
 			}
 		}
-
-		if (!lfi)
-			continue;
-
-		if ((flen = udf_get_filename(nameptr, fname, lfi)))
+	}
+	else
+	{
+		block = udf_get_lb_pblock(dir->i_sb, UDF_I_LOCATION(dir), 0);
+		if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
 		{
-			if (udf_match(flen, fname, &(dentry->d_name)))
-			{
-				if (fibh->sbh != fibh->ebh)
-					udf_release_data(fibh->ebh);
-				udf_release_data(fibh->sbh);
-				udf_release_data(bh);
-				*err = -EEXIST;
-				return NULL;
-			}
+			fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block, dir->i_sb->s_blocksize);
+			fibh->soffset = fibh->eoffset = udf_file_entry_alloc_offset(dir);
+		}
+		else
+		{
+			fibh->sbh = fibh->ebh = NULL;
+			fibh->soffset = fibh->eoffset = sb->s_blocksize;
 		}
 	}
 
@@ -484,14 +497,14 @@
 		if (!(fibh->sbh = fibh->ebh = udf_expand_dir_adinicb(dir, &block, err)))
 			return NULL;
 		bloc = UDF_I_LOCATION(dir);
+		eloc.logicalBlockNum = block;
+		eloc.partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum;
+		elen = dir->i_sb->s_blocksize;
 		extoffset = udf_file_entry_alloc_offset(dir);
-	}
-	else
-	{
 		if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT)
-			extoffset -= sizeof(short_ad);
+			extoffset += sizeof(short_ad);
 		else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG)
-			extoffset -= sizeof(long_ad);
+			extoffset += sizeof(long_ad);
 	}
 
 	if (sb->s_blocksize - fibh->eoffset >= nfidlen)
@@ -505,25 +518,8 @@
 		}
 
 		if (UDF_I_ALLOCTYPE(dir) != ICB_FLAG_AD_IN_ICB)
-		{
-			Uint32 lextoffset = extoffset;
-			if (udf_next_aext(dir, &bloc, &extoffset, &eloc, &elen, &bh, 1) !=
-				EXTENT_RECORDED_ALLOCATED)
-			{
-				udf_release_data(bh);
-				udf_release_data(fibh->sbh);
-				return NULL;
-			}
-			else
-			{
-				if (elen & (sb->s_blocksize - 1))
-					elen += nfidlen;
-				block = eloc.logicalBlockNum + ((elen - 1) >>
-					dir->i_sb->s_blocksize_bits);
-				elen = (EXTENT_RECORDED_ALLOCATED << 30) | elen;
-				udf_write_aext(dir, bloc, &lextoffset, eloc, elen, &bh, 1);
-			}
-		}
+			block = eloc.logicalBlockNum + ((elen - 1) >>
+				dir->i_sb->s_blocksize_bits);
 		else
 			block = UDF_I_LOCATION(dir).logicalBlockNum;
 				
@@ -531,8 +527,6 @@
 	}
 	else
 	{
-		Uint32 lextoffset = extoffset;
-
 		fibh->soffset = fibh->eoffset - sb->s_blocksize;
 		fibh->eoffset += nfidlen - sb->s_blocksize;
 		if (fibh->sbh != fibh->ebh)
@@ -541,21 +535,8 @@
 			fibh->sbh = fibh->ebh;
 		}
 
-		if (udf_next_aext(dir, &bloc, &extoffset, &eloc, &elen, &bh, 1) !=
-			EXTENT_RECORDED_ALLOCATED)
-		{
-			udf_release_data(bh);
-			udf_release_data(fibh->sbh);
-			return NULL;
-		}
-		else
-		{
-			elen = ((elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1));
-			block = eloc.logicalBlockNum +
-				((elen - 1) >> dir->i_sb->s_blocksize_bits);
-			elen = (EXTENT_RECORDED_ALLOCATED << 30) | elen;
-			udf_write_aext(dir, bloc, &lextoffset, eloc, elen, &bh, 0);
-		}
+		block = eloc.logicalBlockNum + ((elen - 1) >>
+			dir->i_sb->s_blocksize_bits);
 
 		*err = -ENOSPC;
 		if (!(fibh->ebh = udf_bread(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), 1, err)))
@@ -564,38 +545,27 @@
 			udf_release_data(fibh->sbh);
 			return NULL;
 		}
+
 		if (!(fibh->soffset))
 		{
-			if (udf_next_aext(dir, &bloc, &lextoffset, &eloc, &elen, &bh, 1) ==
+			if (udf_next_aext(dir, &bloc, &extoffset, &eloc, &elen, &bh, 1) ==
 				EXTENT_RECORDED_ALLOCATED)
 			{
-				if (block == (eloc.logicalBlockNum +
-					((elen - 1) >> dir->i_sb->s_blocksize_bits)))
-				{
-					if (udf_next_aext(dir, &bloc, &lextoffset, &eloc, &elen, &bh, 1) !=
-						EXTENT_RECORDED_ALLOCATED)
-					{
-						udf_release_data(bh);
-						udf_release_data(fibh->sbh);
-						udf_release_data(fibh->ebh);
-						udf_debug("next extent not recorded and allocated\n");
-						return NULL;
-					}
-				}
+				block = eloc.logicalBlockNum + ((elen - 1) >>
+					dir->i_sb->s_blocksize_bits);
 			}
 			else
-			{
-				udf_release_data(bh);
-				udf_release_data(fibh->sbh);
-				udf_release_data(fibh->ebh);
-				udf_debug("next extent not recorded and allocated\n");
-				return NULL;
-			}
-			block = eloc.logicalBlockNum + ((elen - 1) >>
-				dir->i_sb->s_blocksize_bits);
-		}
+				block ++;
 
-		fi = (struct FileIdentDesc *)(fibh->sbh->b_data + sb->s_blocksize + fibh->soffset);
+			udf_release_data(fibh->sbh);
+			fibh->sbh = fibh->ebh;
+			fi = (struct FileIdentDesc *)(fibh->sbh->b_data);
+		}
+		else
+		{
+			fi = (struct FileIdentDesc *)
+				(fibh->sbh->b_data + sb->s_blocksize + fibh->soffset);
+		}
 	}
 
 	memset(cfi, 0, sizeof(struct FileIdentDesc));
@@ -642,7 +612,10 @@
 	if (!inode)
 		return err;
 
-	inode->i_data.a_ops = &udf_adinicb_aops;
+	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+		inode->i_data.a_ops = &udf_adinicb_aops;
+	else
+		inode->i_data.a_ops = &udf_aops;
 	inode->i_op = &udf_file_inode_operations;
 	inode->i_fop = &udf_file_operations;
 	inode->i_mode = mode;
@@ -650,7 +623,6 @@
 
 	if (!(fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err)))
 	{
-		udf_debug("udf_add_entry failure!\n");
 		inode->i_nlink --;
 		mark_inode_dirty(inode);
 		iput(inode);
@@ -689,7 +661,6 @@
 	init_special_inode(inode, mode, rdev);
 	if (!(fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err)))
 	{
-		udf_debug("udf_add_entry failure!\n");
 		inode->i_nlink --;
 		mark_inode_dirty(inode);
 		iput(inode);
@@ -721,9 +692,8 @@
 	struct inode * inode;
 	struct udf_fileident_bh fibh;
 	int err;
-	struct FileEntry *fe;
 	struct FileIdentDesc cfi, *fi;
-	Uint32 loc;
+	struct dentry parent;
 
 	err = -EMLINK;
 	if (dir->i_nlink >= (256<<sizeof(dir->i_nlink))-1)
@@ -736,12 +706,10 @@
 
 	inode->i_op = &udf_dir_inode_operations;
 	inode->i_fop = &udf_dir_operations;
-	inode->i_size = (sizeof(struct FileIdentDesc) + 3) & ~3;
-	UDF_I_LENALLOC(inode) = inode->i_size;
-	loc = UDF_I_LOCATION(inode).logicalBlockNum;
-	fibh.sbh = udf_tread(inode->i_sb, inode->i_ino, inode->i_sb->s_blocksize);
-
-	if (!fibh.sbh)
+	parent.d_name.len = 0;
+	parent.d_name.name = NULL;
+	inode->i_size = 0;
+	if (!(fi = udf_add_entry(inode, &parent, &fibh, &cfi, &err)))
 	{
 		inode->i_nlink--;
 		mark_inode_dirty(inode);
@@ -749,21 +717,11 @@
 		goto out;
 	}
 	inode->i_nlink = 2;
-	fe = (struct FileEntry *)fibh.sbh->b_data;
-	fi = (struct FileIdentDesc *)&(fe->extendedAttr[UDF_I_LENEATTR(inode)]);
-	udf_new_tag((char *)&cfi, TID_FILE_IDENT_DESC, 2, 1, loc,
-		sizeof(struct FileIdentDesc));
-	cfi.fileVersionNum = cpu_to_le16(1);
-	cfi.fileCharacteristics = FILE_DIRECTORY | FILE_PARENT;
-	cfi.lengthFileIdent = 0;
 	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(dir));
 	*(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
 		cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL);
-	cfi.lengthOfImpUse = cpu_to_le16(0);
-	fibh.ebh = fibh.sbh;
-	fibh.soffset = sizeof(struct FileEntry);
-	fibh.eoffset = sizeof(struct FileEntry) + inode->i_size;
+	cfi.fileCharacteristics = FILE_DIRECTORY | FILE_PARENT;
 	udf_write_fi(&cfi, fi, &fibh, NULL, NULL);
 	udf_release_data(fibh.sbh);
 	inode->i_mode = S_IFDIR | (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask);
@@ -773,7 +731,6 @@
 
 	if (!(fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err)))
 	{
-		udf_debug("udf_add_entry failure!\n");
 		inode->i_nlink = 0;
 		mark_inode_dirty(inode);
 		iput(inode);
@@ -836,7 +793,7 @@
 
 	while ( (f_pos < size) )
 	{
-		fi = udf_fileident_read(dir, &f_pos, &fibh, &cfi, &bloc, &extoffset, &offset, &bh);
+		fi = udf_fileident_read(dir, &f_pos, &fibh, &cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh);
 
 		if (!fi)
 		{
@@ -873,6 +830,7 @@
 		goto out;
 
 	inode = dentry->d_inode;
+	DQUOT_INIT(inode);
 
 	retval = -EIO;
 	if (udf_get_lb_pblock(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation), 0) != inode->i_ino)
@@ -920,6 +878,7 @@
 		goto out;
 
 	inode = dentry->d_inode;
+	DQUOT_INIT(inode);
 
 	retval = -EIO;
 
@@ -959,6 +918,7 @@
 {
 	struct inode * inode;
 	struct PathComponent *pc;
+	char *compstart;
 	struct udf_fileident_bh fibh;
 	struct buffer_head *bh = NULL;
 	int eoffset, elen = 0;
@@ -966,6 +926,7 @@
 	struct FileIdentDesc cfi;
 	char *ea;
 	int err;
+	int block;
 
 	if (!(inode = udf_new_inode(dir, S_IFLNK, &err)))
 		goto out;
@@ -974,8 +935,34 @@
 	inode->i_data.a_ops = &udf_symlink_aops;
 	inode->i_op = &page_symlink_inode_operations;
 
-	bh = udf_tread(inode->i_sb, inode->i_ino, inode->i_sb->s_blocksize);
-	ea = bh->b_data + udf_file_entry_alloc_offset(inode);
+	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+	{
+		struct buffer_head *bh = NULL;
+		lb_addr bloc, eloc;
+		Uint32 elen, extoffset;
+
+		block = udf_new_block(inode,
+			UDF_I_LOCATION(inode).partitionReferenceNum,
+			UDF_I_LOCATION(inode).logicalBlockNum, &err);
+		if (!block)
+			goto out_no_entry;
+		bloc = UDF_I_LOCATION(inode);
+		eloc.logicalBlockNum = block;
+		eloc.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;
+		elen = inode->i_sb->s_blocksize;
+		extoffset = udf_file_entry_alloc_offset(inode);
+		udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 0);
+		udf_release_data(bh);
+
+		inode->i_blocks = inode->i_sb->s_blocksize / 512;
+		block = udf_get_pblock(inode->i_sb, block,
+			UDF_I_LOCATION(inode).partitionReferenceNum, 0);
+	}
+	else
+		block = udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0);
+
+	bh = udf_tread(inode->i_sb, block, inode->i_sb->s_blocksize);
+	ea = bh->b_data + udf_ext0_offset(inode);
 
 	eoffset = inode->i_sb->s_blocksize - (ea - bh->b_data);
 	pc = (struct PathComponent *)ea;
@@ -994,9 +981,13 @@
 		elen += sizeof(struct PathComponent);
 	}
 
-	while (*symname && eoffset > elen + sizeof(struct PathComponent))
+	err = -ENAMETOOLONG;
+
+	while (*symname)
 	{
-		char *compstart;
+		if (elen + sizeof(struct PathComponent) > eoffset)
+			goto out_no_entry;
+
 		pc = (struct PathComponent *)(ea + elen);
 
 		compstart = (char *)symname;
@@ -1020,7 +1011,7 @@
 		if (pc->componentType == 5)
 		{
 			if (elen + sizeof(struct PathComponent) + symname - compstart > eoffset)
-				pc->lengthComponentIdent = eoffset - elen - sizeof(struct PathComponent);
+				goto out_no_entry;
 			else
 				pc->lengthComponentIdent = symname - compstart;
 
@@ -1039,25 +1030,27 @@
 	}
 
 	udf_release_data(bh);
-	UDF_I_LENALLOC(inode) = inode->i_size = elen;
+	inode->i_size = elen;
+	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+		UDF_I_LENALLOC(inode) = inode->i_size;
 	mark_inode_dirty(inode);
 
 	if (!(fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err)))
-		goto out;
+		goto out_no_entry;
 	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
-    if (UDF_SB_LVIDBH(inode->i_sb))
-    {
-        struct LogicalVolHeaderDesc *lvhd;
-        Uint64 uniqueID;
-        lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
-        uniqueID = le64_to_cpu(lvhd->uniqueID);
+	if (UDF_SB_LVIDBH(inode->i_sb))
+	{
+		struct LogicalVolHeaderDesc *lvhd;
+		Uint64 uniqueID;
+		lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
+		uniqueID = le64_to_cpu(lvhd->uniqueID);
 		*(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
-			le32_to_cpu(uniqueID & 0x00000000FFFFFFFFUL);
-        if (!(++uniqueID & 0x00000000FFFFFFFFUL))
-            uniqueID += 16;
-        lvhd->uniqueID = cpu_to_le64(uniqueID);
-        mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb), 1);
+			cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL);
+		if (!(++uniqueID & 0x00000000FFFFFFFFUL))
+			uniqueID += 16;
+		lvhd->uniqueID = cpu_to_le64(uniqueID);
+		mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb), 1);
 	}
 	udf_write_fi(&cfi, fi, &fibh, NULL, NULL);
 	if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
@@ -1073,6 +1066,12 @@
 
 out:
 	return err;
+
+out_no_entry:
+	inode->i_nlink--;
+	mark_inode_dirty(inode);
+	iput(inode);
+	goto out;
 }
 
 static int udf_link(struct dentry * old_dentry, struct inode * dir,
@@ -1093,18 +1092,18 @@
 		return err;
 	cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
 	cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
-    if (UDF_SB_LVIDBH(inode->i_sb))
-    {
-        struct LogicalVolHeaderDesc *lvhd;
-        Uint64 uniqueID;
-        lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
-        uniqueID = le64_to_cpu(lvhd->uniqueID);
+	if (UDF_SB_LVIDBH(inode->i_sb))
+	{
+		struct LogicalVolHeaderDesc *lvhd;
+		Uint64 uniqueID;
+		lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
+		uniqueID = le64_to_cpu(lvhd->uniqueID);
 		*(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
 			cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL);
-        if (!(++uniqueID & 0x00000000FFFFFFFFUL))
-            uniqueID += 16;
-        lvhd->uniqueID = cpu_to_le64(uniqueID);
-        mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb), 1);
+		if (!(++uniqueID & 0x00000000FFFFFFFFUL))
+			uniqueID += 16;
+		lvhd->uniqueID = cpu_to_le64(uniqueID);
+		mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb), 1);
 	}
 	udf_write_fi(&cfi, fi, &fibh, NULL, NULL);
 	if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
@@ -1157,9 +1156,7 @@
 		}
 		else
 		{
-/*
 			DQUOT_INIT(new_inode);
-*/
 		}
 	}
 	if (S_ISDIR(old_inode->i_mode))
@@ -1272,15 +1269,13 @@
 }
 
 struct inode_operations udf_dir_inode_operations = {
-	lookup:		udf_lookup,
-#if CONFIG_UDF_RW == 1
-	create:		udf_create,
-	link:		udf_link,
-	unlink:		udf_unlink,
-	symlink:	udf_symlink,
-	mkdir:		udf_mkdir,
-	rmdir:		udf_rmdir,
-	mknod:		udf_mknod,
-	rename:		udf_rename,
-#endif
+	lookup:				udf_lookup,
+	create:				udf_create,
+	link:				udf_link,
+	unlink:				udf_unlink,
+	symlink:			udf_symlink,
+	mkdir:				udf_mkdir,
+	rmdir:				udf_rmdir,
+	mknod:				udf_mknod,
+	rename:				udf_rename,
 };
diff -u --recursive --new-file v2.3.48/linux/fs/udf/partition.c linux/fs/udf/partition.c
--- v2.3.48/linux/fs/udf/partition.c	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/partition.c	Thu Mar  2 11:17:32 2000
@@ -15,7 +15,7 @@
  *              ftp://prep.ai.mit.edu/pub/gnu/GPL
  *      Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-1999 Ben Fennema
+ *  (C) 1998-2000 Ben Fennema
  *
  * HISTORY
  *
diff -u --recursive --new-file v2.3.48/linux/fs/udf/super.c linux/fs/udf/super.c
--- v2.3.48/linux/fs/udf/super.c	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/super.c	Thu Mar  2 11:17:32 2000
@@ -78,6 +78,7 @@
 /* These are the "meat" - everything else is stuffing */
 static struct super_block *udf_read_super(struct super_block *, void *, int);
 static void udf_put_super(struct super_block *);
+static void udf_write_super(struct super_block *);
 static int udf_remount_fs(struct super_block *, int *, char *);
 static int udf_check_valid(struct super_block *, int, int);
 static int udf_vrs(struct super_block *sb, int silent);
@@ -96,24 +97,21 @@
 
 /* UDF filesystem type */
 static struct file_system_type udf_fstype = {
-	"udf",				/* name */
-	FS_REQUIRES_DEV,	/* fs_flags */
-	udf_read_super,		/* read_super */
-	NULL				/* next */
+	name:				"udf",
+	fs_flags:			FS_REQUIRES_DEV,
+	read_super:			udf_read_super,
 };
 
 /* Superblock operations */
-static struct super_operations udf_sb_ops =
-{
-	read_inode:	udf_read_inode,
-	put_inode:	udf_put_inode,
-	put_super:	udf_put_super,
-	statfs:		udf_statfs,
-	remount_fs:	udf_remount_fs,
-#if CONFIG_UDF_RW == 1
-	write_inode:	udf_write_inode,
-	delete_inode:	udf_delete_inode,
-#endif
+static struct super_operations udf_sb_ops = {
+	read_inode:			udf_read_inode,
+	write_inode:		udf_write_inode,
+	put_inode:			udf_put_inode,
+	delete_inode:		udf_delete_inode,
+	put_super:			udf_put_super,
+	write_super:		udf_write_super,
+	statfs:				udf_statfs,
+	remount_fs:			udf_remount_fs,
 };
 
 struct udf_options
@@ -201,14 +199,18 @@
  *	gid=		Set the default group.
  *	umask=		Set the default umask.
  *	uid=		Set the default user.
+ *	bs=			Set the block size.
  *	unhide		Show otherwise hidden files.
  *	undelete	Show deleted files in lists.
+ *	adinicb		Embed data in the inode (default)
+ *	noadinicb	Don't embed data in the inode
+ *	shortad		Use short ad's
+ *	longad		Use long ad's (default)
  *	strict		Set strict conformance (unused)
  *
  *	The remaining are for debugging and disaster recovery:
  *
- *	bs=		Set the block size. (may not work unless 2048)
- *	novrs           Skip volume sequence recognition 
+ *	novrs		Skip volume sequence recognition 
  *
  *	The following expect a offset from 0.
  *
@@ -244,7 +246,7 @@
 	char *opt, *val;
 
 	uopt->novrs = 0;
-	uopt->blocksize = 2048;
+	uopt->blocksize = 512;
 	uopt->partition = 0xFFFF;
 	uopt->session = 0xFFFFFFFF;
 	uopt->lastblock = 0xFFFFFFFF;
@@ -256,7 +258,7 @@
 	if (!options)
 		return 1;
 
-        for (opt = strtok(options, ","); opt; opt = strtok(NULL, ","))
+	for (opt = strtok(options, ","); opt; opt = strtok(NULL, ","))
 	{
 		/* Make "opt=val" into two strings */
 		val = strchr(opt, '=');
@@ -267,15 +269,23 @@
 		else if (!strcmp(opt, "bs") && val)
 			uopt->blocksize = simple_strtoul(val, NULL, 0);
 		else if (!strcmp(opt, "unhide") && !val)
-			uopt->flags |= UDF_FLAG_UNHIDE;
+			uopt->flags |= (1 << UDF_FLAG_UNHIDE);
 		else if (!strcmp(opt, "undelete") && !val)
-			uopt->flags |= UDF_FLAG_UNDELETE;
+			uopt->flags |= (1 << UDF_FLAG_UNDELETE);
+		else if (!strcmp(opt, "noadinicb") && !val)
+			uopt->flags &= ~(1 << UDF_FLAG_USE_AD_IN_ICB);
+		else if (!strcmp(opt, "adinicb") && !val)
+			uopt->flags |= (1 << UDF_FLAG_USE_AD_IN_ICB);
+		else if (!strcmp(opt, "shortad") && !val)
+			uopt->flags |= (1 << UDF_FLAG_USE_SHORT_AD);
+		else if (!strcmp(opt, "longad") && !val)
+			uopt->flags &= ~(1 << UDF_FLAG_USE_SHORT_AD);
 		else if (!strcmp(opt, "gid") && val)
 			uopt->gid = simple_strtoul(val, NULL, 0);
 		else if (!strcmp(opt, "umask") && val)
 			uopt->umask = simple_strtoul(val, NULL, 0);
 		else if (!strcmp(opt, "strict") && !val)
-			uopt->flags |= UDF_FLAG_STRICT;
+			uopt->flags |= (1 << UDF_FLAG_STRICT);
 		else if (!strcmp(opt, "uid") && val)
 			uopt->uid = simple_strtoul(val, NULL, 0);
 		else if (!strcmp(opt, "session") && val)
@@ -308,23 +318,35 @@
 	return 1;
 }
 
+void
+udf_write_super(struct super_block *sb)
+{
+	if (!(sb->s_flags & MS_RDONLY))
+		udf_open_lvid(sb);
+	sb->s_dirt = 0;
+}
+		
 static int
 udf_remount_fs(struct super_block *sb, int *flags, char *options)
 {
 	struct udf_options uopt;
 
-	uopt.flags =    UDF_SB(sb)->s_flags ;
-	uopt.uid =      UDF_SB(sb)->s_uid ;
-	uopt.gid =      UDF_SB(sb)->s_gid ;
-	uopt.umask =    UDF_SB(sb)->s_umask ;
+	uopt.flags = UDF_SB(sb)->s_flags ;
+	uopt.uid   = UDF_SB(sb)->s_uid ;
+	uopt.gid   = UDF_SB(sb)->s_gid ;
+	uopt.umask = UDF_SB(sb)->s_umask ;
 
 	if ( !udf_parse_options(options, &uopt) )
 		return -EINVAL;
 
-	UDF_SB(sb)->s_flags =   uopt.flags;
-	UDF_SB(sb)->s_uid =     uopt.uid;
-	UDF_SB(sb)->s_gid =     uopt.gid;
-	UDF_SB(sb)->s_umask =   uopt.umask;
+	UDF_SB(sb)->s_flags = uopt.flags;
+	UDF_SB(sb)->s_uid   = uopt.uid;
+	UDF_SB(sb)->s_gid   = uopt.gid;
+	UDF_SB(sb)->s_umask = uopt.umask;
+
+#if CONFIG_UDF_RW != 1
+	*flags |= MS_RDONLY;
+#endif
 
 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
 		return 0;
@@ -367,8 +389,8 @@
 udf_set_blocksize(struct super_block *sb, int bsize)
 {
 	/* Use specified block size if specified */
-	sb->s_blocksize = get_hardblocksize(sb->s_dev);
-	sb->s_blocksize = sb->s_blocksize ? sb->s_blocksize : 2048;
+	if (!(sb->s_blocksize = get_hardblocksize(sb->s_dev)))
+		sb->s_blocksize = 2048;
 	if (bsize > sb->s_blocksize)
 		sb->s_blocksize = bsize;
 
@@ -414,7 +436,7 @@
 	for (;!nsr02 && !nsr03; sector += 2048)
 	{
 		/* Read a block */
-		bh = udf_tread(sb, sector >> sb->s_blocksize_bits, 2048);
+		bh = udf_tread(sb, sector >> sb->s_blocksize_bits, sb->s_blocksize);
 		if (!bh)
 			break;
 
@@ -548,7 +570,7 @@
 			}
 			else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb))
 			{
-				UDF_SB(sb)->s_flags |= UDF_FLAG_VARCONV;
+				UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
 				lastblock = UDF_SB_ANCHOR(sb)[0] = udf_variable_to_fixed(last[i]);
 				UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
 			}
@@ -597,7 +619,7 @@
 				if (ident == TID_ANCHOR_VOL_DESC_PTR &&
 					location == udf_variable_to_fixed(last[i]) - 256)
 				{
-					UDF_SB(sb)->s_flags |= UDF_FLAG_VARCONV;
+					UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
 					lastblock = udf_variable_to_fixed(last[i]);
 					UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
 				}
@@ -615,7 +637,7 @@
 			udf_release_data(bh);
 
 			if (ident == TID_ANCHOR_VOL_DESC_PTR && location == 256)
-				UDF_SB(sb)->s_flags |= UDF_FLAG_VARCONV;
+				UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
 		}
 	}
 
@@ -755,17 +777,17 @@
 	if ( udf_stamp_to_time(&recording, &recording_usec,
 		lets_to_cpu(pvoldesc->recordingDateAndTime)) )
 	{
-	    timestamp ts;
-	    ts = lets_to_cpu(pvoldesc->recordingDateAndTime);
+		timestamp ts;
+		ts = lets_to_cpu(pvoldesc->recordingDateAndTime);
 		udf_debug("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n",
 			recording, recording_usec,
 			ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.typeAndTimezone);
-	    UDF_SB_RECORDTIME(sb) = recording;
+		UDF_SB_RECORDTIME(sb) = recording;
 	}
 
 	if ( !udf_build_ustr(&instr, pvoldesc->volIdent, 32) )
 	{
-		if (!udf_CS0toUTF8(&outstr, &instr))
+		if (udf_CS0toUTF8(&outstr, &instr))
 		{
 			udf_debug("volIdent[] = '%s'\n", outstr.u_name);
 			strncpy( UDF_SB_VOLIDENT(sb), outstr.u_name, outstr.u_len);
@@ -774,7 +796,7 @@
 
 	if ( !udf_build_ustr(&instr, pvoldesc->volSetIdent, 128) )
 	{
-		if (!udf_CS0toUTF8(&outstr, &instr))
+		if (udf_CS0toUTF8(&outstr, &instr))
 			udf_debug("volSetIdent[] = '%s'\n", outstr.u_name);
 	}
 }
@@ -1107,10 +1129,10 @@
 	Uint16 ident;
 	struct buffer_head *bh;
 	long main_s, main_e, reserve_s, reserve_e;
-	int i;
+	int i, j;
 
 	if (!sb)
-	    return 1;
+		return 1;
 
 	for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++)
 	{
@@ -1166,12 +1188,21 @@
 					return 1;
 				}
 
-				if (i == 0)
-					ino.partitionReferenceNum = i+1;
-				else
-					ino.partitionReferenceNum = i-1;
+				for (j=0; j<UDF_SB_NUMPARTS(sb); j++)
+				{
+					if (j != i &&
+						UDF_SB_PARTVSN(sb,i) == UDF_SB_PARTVSN(sb,j) &&
+						UDF_SB_PARTNUM(sb,i) == UDF_SB_PARTNUM(sb,j))
+					{
+							ino.partitionReferenceNum = j;
+							ino.logicalBlockNum = UDF_SB_LASTBLOCK(sb) -
+								UDF_SB_PARTROOT(sb,j);
+							break;
+					}
+				}
 
-				ino.logicalBlockNum = UDF_SB_LASTBLOCK(sb) - UDF_SB_PARTROOT(sb,ino.partitionReferenceNum);
+				if (j == UDF_SB_NUMPARTS(sb))
+					return 1;
 
 				if (!(UDF_SB_VAT(sb) = udf_iget(sb, ino)))
 					return 1;
@@ -1206,7 +1237,6 @@
 
 static void udf_open_lvid(struct super_block *sb)
 {
-#if CONFIG_UDF_RW == 1
 	if (UDF_SB_LVIDBH(sb))
 	{
 		int i;
@@ -1229,13 +1259,12 @@
 					((Uint8 *)&(UDF_SB_LVID(sb)->descTag))[i];
 
 		mark_buffer_dirty(UDF_SB_LVIDBH(sb), 1);
+		sb->s_dirt = 0;
 	}
-#endif
 }
 
 static void udf_close_lvid(struct super_block *sb)
 {
-#if CONFIG_UDF_RW == 1
 	if (UDF_SB_LVIDBH(sb) &&
 		UDF_SB_LVID(sb)->integrityType == INTEGRITY_TYPE_OPEN)
 	{
@@ -1246,7 +1275,12 @@
 		UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
 		if (udf_time_to_stamp(&cpu_time, CURRENT_TIME, CURRENT_UTIME))
 			UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time);
-		
+		if (UDF_MAX_WRITE_VERSION > le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev))
+			UDF_SB_LVIDIU(sb)->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION);
+		if (UDF_SB_UDFREV(sb) > le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev))
+			UDF_SB_LVIDIU(sb)->minUDFReadRev = cpu_to_le16(UDF_SB_UDFREV(sb));
+		if (UDF_SB_UDFREV(sb) > le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev))
+			UDF_SB_LVIDIU(sb)->minUDFWriteRev = cpu_to_le16(UDF_SB_UDFREV(sb));
 		UDF_SB_LVID(sb)->integrityType = INTEGRITY_TYPE_CLOSE;
 
 		UDF_SB_LVID(sb)->descTag.descCRC =
@@ -1261,7 +1295,6 @@
 
 		mark_buffer_dirty(UDF_SB_LVIDBH(sb), 1);
 	}
-#endif
 }
 
 /*
@@ -1288,7 +1321,7 @@
 	lb_addr rootdir, fileset;
 	int i;
 
-	uopt.flags = 0;
+	uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB);
 	uopt.uid = -1;
 	uopt.gid = -1;
 	uopt.umask = 0;
@@ -1297,19 +1330,17 @@
 	MOD_INC_USE_COUNT;
 
 	lock_super(sb);
+	memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info));
 
-	UDF_SB_PARTMAPS(sb) = NULL;
-	UDF_SB_LVIDBH(sb) = NULL;
-	UDF_SB_VAT(sb) = NULL;
+#if CONFIG_UDF_RW != 1
+	sb->s_flags |= MS_RDONLY;
+#endif
 
 	if (!udf_parse_options((char *)options, &uopt))
 		goto error_out;
 
-	memset(UDF_SB_ANCHOR(sb), 0x00, sizeof(UDF_SB_ANCHOR(sb)));
 	fileset.logicalBlockNum = 0xFFFFFFFF;
 	fileset.partitionReferenceNum = 0xFFFF;
-	UDF_SB_RECORDTIME(sb)=0;
-	UDF_SB_VOLIDENT(sb)[0]=0;
 
 	UDF_SB(sb)->s_flags = uopt.flags;
 	UDF_SB(sb)->s_uid = uopt.uid;
@@ -1328,7 +1359,7 @@
 	udf_debug("Multi-session=%d\n", UDF_SB_SESSION(sb));
 
 	if ( uopt.lastblock == 0xFFFFFFFF )
-		UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb, &(UDF_SB(sb)->s_flags));
+		UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb);
 	else
 		UDF_SB_LASTBLOCK(sb) = uopt.lastblock;
 
@@ -1338,7 +1369,7 @@
 
 	if (udf_check_valid(sb, uopt.novrs, silent)) /* read volume recognition sequences */
 	{
-		udf_debug("No VRS found\n");
+		printk("UDF-fs: No VRS found\n");
  		goto error_out;
 	}
 
@@ -1357,19 +1388,42 @@
 
 	if (udf_load_partition(sb, &fileset))
 	{
-		udf_debug("No partition found (1)\n");
+		printk("UDF-fs: No partition found (1)\n");
 		goto error_out;
 	}
 
+	if ( UDF_SB_LVIDBH(sb) )
+	{
+		Uint16 minUDFReadRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev);
+		Uint16 minUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev);
+		/* Uint16 maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */
+
+		if (minUDFReadRev > UDF_MAX_READ_VERSION)
+		{
+			printk("UDF-fs: minUDFReadRev=%x (max is %x)\n",
+				UDF_SB_LVIDIU(sb)->minUDFReadRev, UDF_MAX_READ_VERSION);
+			goto error_out;
+		}
+		else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION)
+		{
+			sb->s_flags |= MS_RDONLY;
+		}
+
+		if (minUDFReadRev >= UDF_VERS_USE_EXTENDED_FE)
+			UDF_SET_FLAG(sb, UDF_FLAG_USE_EXTENDED_FE);
+		if (minUDFReadRev >= UDF_VERS_USE_STREAMS)
+			UDF_SET_FLAG(sb, UDF_FLAG_USE_STREAMS);
+	}
+
 	if ( !UDF_SB_NUMPARTS(sb) )
 	{
-		udf_debug("No partition found (2)\n");
+		printk("UDF-fs: No partition found (2)\n");
 		goto error_out;
 	}
 
 	if ( udf_find_fileset(sb, &fileset, &rootdir) )
 	{
-		udf_debug("No fileset found\n");
+		printk("UDF-fs: No fileset found\n");
 		goto error_out;
 	}
 
@@ -1392,7 +1446,7 @@
 	inode = udf_iget(sb, rootdir); 
 	if (!inode)
 	{
-		udf_debug("Error in udf_iget, block=%d, partition=%d\n",
+		printk("UDF-fs: Error in udf_iget, block=%d, partition=%d\n",
 			rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
 		goto error_out;
 	}
@@ -1401,8 +1455,8 @@
 	sb->s_root = d_alloc_root(inode);
 	if (!sb->s_root)
 	{
+		printk("UDF-fs: Couldn't allocate root dentry\n");
 		iput(inode);
-		udf_debug("Couldn't allocate root dentry\n");
 		goto error_out;
 	}
 
diff -u --recursive --new-file v2.3.48/linux/fs/udf/symlink.c linux/fs/udf/symlink.c
--- v2.3.48/linux/fs/udf/symlink.c	Thu Feb 10 17:11:19 2000
+++ linux/fs/udf/symlink.c	Thu Mar  2 11:17:32 2000
@@ -122,5 +122,5 @@
  * symlinks can't do much...
  */
 struct address_space_operations udf_symlink_aops = {
-	readpage:	udf_symlink_filler,
+	readpage:			udf_symlink_filler,
 };
diff -u --recursive --new-file v2.3.48/linux/fs/udf/truncate.c linux/fs/udf/truncate.c
--- v2.3.48/linux/fs/udf/truncate.c	Thu Feb 10 17:11:19 2000
+++ linux/fs/udf/truncate.c	Thu Mar  2 11:17:32 2000
@@ -32,27 +32,34 @@
 #include "udf_i.h"
 #include "udf_sb.h"
 
-static void extent_trunc(struct inode * inode, lb_addr bloc, int *extoffset,
-	lb_addr eloc, Uint8 etype, Uint32 elen, struct buffer_head **bh, Uint32 offset)
+static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
+	lb_addr eloc, Uint8 etype, Uint32 elen, struct buffer_head **bh, Uint32 nelen)
 {
 	lb_addr neloc = { 0, 0 };
-	int nelen = 0; 
 	int blocks = inode->i_sb->s_blocksize / 512;
 	int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
+	int first_block = (nelen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
 
-	if (offset)
+	if (nelen)
 	{
-		nelen = (etype << 30) |
-			(((offset - 1) << inode->i_sb->s_blocksize_bits) +
-			(inode->i_size & (inode->i_sb->s_blocksize - 1)));
 		neloc = eloc;
+		nelen = (etype << 30) | nelen;
+	}
+
+	if (elen != nelen)
+	{
+		udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 0);
+		if (last_block - first_block > 0)
+		{
+			if (etype == EXTENT_RECORDED_ALLOCATED)
+			{
+				inode->i_blocks -= (blocks * (last_block - first_block));
+				mark_inode_dirty(inode);
+			}
+			if (etype != EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+				udf_free_blocks(inode, eloc, first_block, last_block - first_block);
+		}
 	}
-	if (etype == EXTENT_RECORDED_ALLOCATED)
-		inode->i_blocks -= (blocks * (last_block - offset));
-	udf_write_aext(inode, bloc, extoffset, neloc, nelen, bh, 1);
-	mark_inode_dirty(inode);
-	if (etype != EXTENT_NOT_RECORDED_NOT_ALLOCATED)
-		udf_free_blocks(inode, eloc, offset, last_block - offset);
 }
 
 void udf_trunc(struct inode * inode)
@@ -60,7 +67,7 @@
 	lb_addr bloc, eloc, neloc = { 0, 0 };
 	Uint32 extoffset, elen, offset, nelen = 0, lelen = 0, lenalloc;
 	int etype;
-	int first_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
+	int first_block = inode->i_size >> inode->i_sb->s_blocksize_bits;
 	struct buffer_head *bh = NULL;
 	int adsize;
 
@@ -71,10 +78,14 @@
 	else
 		adsize = 0;
 
-	if ((etype = inode_bmap(inode, first_block, &bloc, &extoffset, &eloc, &elen, &offset, &bh)) != -1)
+	etype = inode_bmap(inode, first_block, &bloc, &extoffset, &eloc, &elen, &offset, &bh);
+	offset = (offset << inode->i_sb->s_blocksize_bits) |
+		(inode->i_size & (inode->i_sb->s_blocksize - 1));
+	if (etype != -1)
 	{
 		extoffset -= adsize;
-		extent_trunc(inode, bloc, &extoffset, eloc, etype, elen, &bh, offset);
+		extent_trunc(inode, bloc, extoffset, eloc, etype, elen, &bh, offset);
+		extoffset += adsize;
 
 		if (offset)
 			lenalloc = extoffset;
@@ -103,11 +114,17 @@
 				else
 				{
 					if (!memcmp(&UDF_I_LOCATION(inode), &bloc, sizeof(lb_addr)))
+					{
 						UDF_I_LENALLOC(inode) = lenalloc;
+						mark_inode_dirty(inode);
+					}
 					else
 					{
 						struct AllocExtDesc *aed = (struct AllocExtDesc *)(bh->b_data);
 						aed->lengthAllocDescs = cpu_to_le32(lenalloc);
+						udf_update_tag(bh->b_data, lenalloc +
+							sizeof(struct AllocExtDesc));
+						mark_buffer_dirty(bh, 1);
 					}
 				}
 
@@ -122,7 +139,10 @@
 					lelen = 1;
 			}
 			else
-				extent_trunc(inode, bloc, &extoffset, eloc, etype, elen, &bh, 0);
+			{
+				extent_trunc(inode, bloc, extoffset, eloc, etype, elen, &bh, 0);
+				extoffset += adsize;
+			}
 		}
 
 		if (lelen)
@@ -136,29 +156,42 @@
 		else
 		{
 			if (!memcmp(&UDF_I_LOCATION(inode), &bloc, sizeof(lb_addr)))
+			{
 				UDF_I_LENALLOC(inode) = lenalloc;
+				mark_inode_dirty(inode);
+			}
 			else
 			{
 				struct AllocExtDesc *aed = (struct AllocExtDesc *)(bh->b_data);
 				aed->lengthAllocDescs = cpu_to_le32(lenalloc);
+				udf_update_tag(bh->b_data, lenalloc +
+					sizeof(struct AllocExtDesc));
+				mark_buffer_dirty(bh, 1);
 			}
 		}
 	}
 	else if (inode->i_size)
 	{
-		char tetype;
-
 		if (offset)
 		{
 			extoffset -= adsize;
-			tetype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1);
-			if (tetype == EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+			etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1);
+			if (etype == EXTENT_NOT_RECORDED_NOT_ALLOCATED)
 			{
 				extoffset -= adsize;
-				elen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
-					(elen + (offset << inode->i_sb->s_blocksize_bits));
+				elen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) | (elen + offset);
 				udf_write_aext(inode, bloc, &extoffset, eloc, elen, &bh, 0);
 			}
+			else if (etype == EXTENT_NOT_RECORDED_ALLOCATED)
+			{
+				lb_addr neloc = { 0, 0 };
+				extoffset -= adsize;
+				nelen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
+					((elen + offset + inode->i_sb->s_blocksize - 1) &
+					~(inode->i_sb->s_blocksize - 1));
+				udf_write_aext(inode, bloc, &extoffset, neloc, nelen, &bh, 1);
+				udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1);
+			}
 			else
 			{
 				if (elen & (inode->i_sb->s_blocksize - 1))
@@ -170,8 +203,7 @@
 					udf_write_aext(inode, bloc, &extoffset, eloc, elen, &bh, 1);
 				}
 				memset(&eloc, 0x00, sizeof(lb_addr));
-				elen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
-					(offset << inode->i_sb->s_blocksize_bits);
+				elen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) | offset;
 				udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1);
 			}
 		}
@@ -182,6 +214,8 @@
 
 void udf_truncate(struct inode * inode)
 {
+	int err;
+
 	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
 			S_ISLNK(inode->i_mode)))
 		return;
@@ -189,7 +223,22 @@
 		return;
 
 	if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
-		UDF_I_LENALLOC(inode) = inode->i_size;
+	{
+		if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
+			inode->i_size))
+		{
+			udf_expand_file_adinicb(inode, inode->i_size, &err);
+			if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+			{
+				inode->i_size = UDF_I_LENALLOC(inode);
+				return;
+			}
+			else
+				udf_trunc(inode);
+		}
+		else
+			UDF_I_LENALLOC(inode) = inode->i_size;
+	}
 	else
 		udf_trunc(inode);
 
diff -u --recursive --new-file v2.3.48/linux/fs/udf/udf_i.h linux/fs/udf/udf_i.h
--- v2.3.48/linux/fs/udf/udf_i.h	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/udf_i.h	Thu Mar  2 11:17:32 2000
@@ -10,6 +10,7 @@
 #define UDF_I_ALLOCTYPE(X)	( UDF_I(X)->i_alloc_type )
 #define UDF_I_EXTENDED_FE(X)( UDF_I(X)->i_extended_fe )
 #define UDF_I_STRAT4096(X)	( UDF_I(X)->i_strat_4096 )
+#define UDF_I_NEW_INODE(X)	( UDF_I(X)->i_new_inode )
 #define UDF_I_NEXT_ALLOC_BLOCK(X)	( UDF_I(X)->i_next_alloc_block )
 #define UDF_I_NEXT_ALLOC_GOAL(X)	( UDF_I(X)->i_next_alloc_goal )
 #define UDF_I_UATIME(X)		( UDF_I(X)->i_uatime )
diff -u --recursive --new-file v2.3.48/linux/fs/udf/udf_sb.h linux/fs/udf/udf_sb.h
--- v2.3.48/linux/fs/udf/udf_sb.h	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/udf_sb.h	Thu Mar  2 11:17:32 2000
@@ -2,13 +2,23 @@
 #define __LINUX_UDF_SB_H
 
 /* Since UDF 1.50 is ISO 13346 based... */
-#define UDF_SUPER_MAGIC	0x15013346
+#define UDF_SUPER_MAGIC				0x15013346
 
-#define UDF_FLAG_STRICT		0x00000001U
-#define UDF_FLAG_UNDELETE	0x00000002U
-#define UDF_FLAG_UNHIDE		0x00000004U
-#define UDF_FLAG_VARCONV	0x00000008U
+#define UDF_MAX_READ_VERSION		0x0200
+#define UDF_MAX_WRITE_VERSION		0x0200
 
+#define UDF_FLAG_USE_EXTENDED_FE	0
+#define UDF_VERS_USE_EXTENDED_FE	0x0200
+#define UDF_FLAG_USE_STREAMS		1
+#define UDF_VERS_USE_STREAMS		0x0200
+#define UDF_FLAG_USE_SHORT_AD		2
+#define UDF_FLAG_USE_AD_IN_ICB		3
+#define UDF_FLAG_USE_FILE_CTIME_EA	4
+#define UDF_FLAG_STRICT				5
+#define UDF_FLAG_UNDELETE			6
+#define UDF_FLAG_UNHIDE				7
+#define UDF_FLAG_VARCONV			8
+	
 #define UDF_SB_FREE(X)\
 {\
 	if (UDF_SB(X))\
@@ -27,37 +37,42 @@
 	memset(UDF_SB_PARTMAPS(X), 0x00, sizeof(struct udf_part_map) * Y);\
 }
 
-#define IS_STRICT(X)			( UDF_SB(X)->s_flags & UDF_FLAG_STRICT )
-#define IS_UNDELETE(X)			( UDF_SB(X)->s_flags & UDF_FLAG_UNDELETE )
-#define IS_UNHIDE(X)			( UDF_SB(X)->s_flags & UDF_FLAG_UNHIDE )
-
-#define UDF_SB_SESSION(X)		( UDF_SB(X)->s_session )
-#define UDF_SB_ANCHOR(X)		( UDF_SB(X)->s_anchor )
-#define UDF_SB_NUMPARTS(X)		( UDF_SB(X)->s_partitions )
-#define UDF_SB_VOLUME(X)		( UDF_SB(X)->s_thisvolume )
-#define UDF_SB_LASTBLOCK(X)		( UDF_SB(X)->s_lastblock )
-#define UDF_SB_VOLDESC(X)		( UDF_SB(X)->s_voldesc )
-#define UDF_SB_LVIDBH(X)		( UDF_SB(X)->s_lvidbh )
-#define UDF_SB_LVID(X)			( (struct LogicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
-#define UDF_SB_LVIDIU(X)		( (struct LogicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(sb)->impUse[UDF_SB_LVID(sb)->numOfPartitions * 2 * sizeof(Uint32)/sizeof(Uint8)]) )
-#define UDF_SB_PARTITION(X)		( UDF_SB(X)->s_partition )
-#define UDF_SB_RECORDTIME(X)	( UDF_SB(X)->s_recordtime )
-#define UDF_SB_VOLIDENT(X)		( UDF_SB(X)->s_volident )
-#define UDF_SB_PARTMAPS(X)		( UDF_SB(X)->s_partmaps )
-#define UDF_SB_SERIALNUM(X)		( UDF_SB(X)->s_serialnum )
-#define UDF_SB_VAT(X)			( UDF_SB(X)->s_vat )
+#define UDF_QUERY_FLAG(X,Y)				( UDF_SB(X)->s_flags & ( 1 << (Y) ) )
+#define UDF_SET_FLAG(X,Y)				( UDF_SB(X)->s_flags |= ( 1 << (Y) ) )
+#define UDF_CLEAR_FLAG(X,Y)				( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) )
+
+#define UDF_UPDATE_UDFREV(X,Y)			( ((Y) > UDF_SB_UDFREV(X)) ? UDF_SB_UDFREV(X) = (Y) : UDF_SB_UDFREV(X) )
+
+#define UDF_SB_PARTMAPS(X)				( UDF_SB(X)->s_partmaps )
+#define UDF_SB_PARTTYPE(X,Y)			( UDF_SB_PARTMAPS(X)[(Y)].s_partition_type )
+#define UDF_SB_PARTROOT(X,Y)			( UDF_SB_PARTMAPS(X)[(Y)].s_partition_root )
+#define UDF_SB_PARTLEN(X,Y)				( UDF_SB_PARTMAPS(X)[(Y)].s_partition_len )
+#define UDF_SB_PARTVSN(X,Y)				( UDF_SB_PARTMAPS(X)[(Y)].s_volumeseqnum )
+#define UDF_SB_PARTNUM(X,Y)				( UDF_SB_PARTMAPS(X)[(Y)].s_partition_num )
+#define UDF_SB_TYPESPAR(X,Y)			( UDF_SB_PARTMAPS(X)[(Y)].s_type_specific.s_sparing )
+#define UDF_SB_TYPEVIRT(X,Y)			( UDF_SB_PARTMAPS(X)[(Y)].s_type_specific.s_virtual )
+#define UDF_SB_PARTFUNC(X,Y)			( UDF_SB_PARTMAPS(X)[(Y)].s_partition_func )
+
+#define UDF_SB_VOLIDENT(X)				( UDF_SB(X)->s_volident )
+#define UDF_SB_NUMPARTS(X)				( UDF_SB(X)->s_partitions )
+#define UDF_SB_PARTITION(X)				( UDF_SB(X)->s_partition )
+#define UDF_SB_SESSION(X)				( UDF_SB(X)->s_session )
+#define UDF_SB_ANCHOR(X)				( UDF_SB(X)->s_anchor )
+#define UDF_SB_LASTBLOCK(X)				( UDF_SB(X)->s_lastblock )
+#define UDF_SB_LVIDBH(X)				( UDF_SB(X)->s_lvidbh )
+#define UDF_SB_LVID(X)					( (struct LogicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
+#define UDF_SB_LVIDIU(X)				( (struct LogicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[UDF_SB_LVID(X)->numOfPartitions * 2 * sizeof(Uint32)/sizeof(Uint8)]) )
 
-#define UDF_SB_BLOCK_BITMAP_NUMBER(X,Y) ( UDF_SB(X)->s_block_bitmap_number[Y] )
-#define UDF_SB_BLOCK_BITMAP(X,Y)		( UDF_SB(X)->s_block_bitmap[Y] )
 #define UDF_SB_LOADED_BLOCK_BITMAPS(X)	( UDF_SB(X)->s_loaded_block_bitmaps )
-
-#define UDF_SB_PARTTYPE(X,Y)	( UDF_SB_PARTMAPS(X)[Y].s_partition_type )
-#define UDF_SB_PARTROOT(X,Y)	( UDF_SB_PARTMAPS(X)[Y].s_partition_root )
-#define UDF_SB_PARTLEN(X,Y)		( UDF_SB_PARTMAPS(X)[Y].s_partition_len )
-#define UDF_SB_PARTVSN(X,Y)		( UDF_SB_PARTMAPS(X)[Y].s_volumeseqnum )
-#define UDF_SB_PARTNUM(X,Y)		( UDF_SB_PARTMAPS(X)[Y].s_partition_num )
-#define UDF_SB_TYPESPAR(X,Y)	( UDF_SB_PARTMAPS(X)[Y].s_type_specific.s_sparing )
-#define UDF_SB_TYPEVIRT(X,Y)	( UDF_SB_PARTMAPS(X)[Y].s_type_specific.s_virtual )
-#define UDF_SB_PARTFUNC(X,Y)	( UDF_SB_PARTMAPS(X)[Y].s_partition_func )
+#define UDF_SB_BLOCK_BITMAP_NUMBER(X,Y) ( UDF_SB(X)->s_block_bitmap_number[(Y)] )
+#define UDF_SB_BLOCK_BITMAP(X,Y)		( UDF_SB(X)->s_block_bitmap[(Y)] )
+#define UDF_SB_UMASK(X)					( UDF_SB(X)->s_umask )
+#define UDF_SB_GID(X)					( UDF_SB(X)->s_gid )
+#define UDF_SB_UID(X)					( UDF_SB(X)->s_uid )
+#define UDF_SB_RECORDTIME(X)			( UDF_SB(X)->s_recordtime )
+#define UDF_SB_SERIALNUM(X)				( UDF_SB(X)->s_serialnum )
+#define UDF_SB_UDFREV(X)				( UDF_SB(X)->s_udfrev )
+#define UDF_SB_FLAGS(X)					( UDF_SB(X)->s_flags )
+#define UDF_SB_VAT(X)					( UDF_SB(X)->s_vat )
 
 #endif /* __LINUX_UDF_SB_H */
diff -u --recursive --new-file v2.3.48/linux/fs/udf/udfdecl.h linux/fs/udf/udfdecl.h
--- v2.3.48/linux/fs/udf/udfdecl.h	Sat Feb 26 22:31:54 2000
+++ linux/fs/udf/udfdecl.h	Thu Mar  2 11:17:32 2000
@@ -1,17 +1,15 @@
 #ifndef __UDF_DECL_H
 #define __UDF_DECL_H
 
-#define UDF_VERSION_NOTICE "v0.9.0"
-
 #include <linux/udf_167.h>
 #include <linux/udf_udf.h>
 #include "udfend.h"
 
+#include <linux/udf_fs.h>
+
 #ifdef __KERNEL__
 
 #include <linux/types.h>
-#include <linux/udf_fs.h>
-#include <linux/config.h>
 
 #ifndef LINUX_VERSION_CODE
 #include <linux/version.h>
@@ -62,9 +60,10 @@
 struct super_block;
 
 extern struct inode_operations udf_dir_inode_operations;
-extern struct inode_operations udf_file_inode_operations;
 extern struct file_operations udf_dir_operations;
+extern struct inode_operations udf_file_inode_operations;
 extern struct file_operations udf_file_operations;
+extern struct address_space_operations udf_aops;
 extern struct address_space_operations udf_adinicb_aops;
 extern struct address_space_operations udf_symlink_aops;
 
@@ -127,7 +126,7 @@
 /* inode.c */
 extern struct inode *udf_iget(struct super_block *, lb_addr);
 extern int udf_sync_inode(struct inode *);
-extern void udf_expand_file_adinicb(struct file *, int, int *);
+extern void udf_expand_file_adinicb(struct inode *, int, int *);
 extern struct buffer_head * udf_expand_dir_adinicb(struct inode *, int *, int *);
 extern struct buffer_head * udf_getblk(struct inode *, long, int, int *);
 extern struct buffer_head * udf_bread(struct inode *, int, int, int *);
@@ -158,7 +157,7 @@
 
 /* lowlevel.c */
 extern unsigned int udf_get_last_session(struct super_block *);
-extern unsigned int udf_get_last_block(struct super_block *, int *);
+extern unsigned int udf_get_last_block(struct super_block *);
 
 /* partition.c */
 extern Uint32 udf_get_pblock(struct super_block *, Uint32, Uint16, Uint32);
@@ -180,13 +179,13 @@
 
 /* balloc.c */
 extern void udf_free_blocks(const struct inode *, lb_addr, Uint32, Uint32);
-extern int udf_alloc_blocks(const struct inode *, Uint16, Uint32, Uint32);
+extern int udf_prealloc_blocks(const struct inode *, Uint16, Uint32, Uint32);
 extern int udf_new_block(const struct inode *, Uint16, Uint32, int *);
 extern int udf_sync_file(struct file *, struct dentry *);
 
 /* directory.c */
 extern Uint8 * udf_filead_read(struct inode *, Uint8 *, Uint8, lb_addr, int *, int *, struct buffer_head **, int *);
-extern struct FileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct FileIdentDesc *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **);
+extern struct FileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct FileIdentDesc *, lb_addr *, Uint32 *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **);
 
 #endif /* __KERNEL__ */
 
diff -u --recursive --new-file v2.3.48/linux/fs/udf/udftime.c linux/fs/udf/udftime.c
--- v2.3.48/linux/fs/udf/udftime.c	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/udftime.c	Thu Mar  2 11:17:32 2000
@@ -54,12 +54,12 @@
 
 /* How many days come before each month (0-12).  */
 const unsigned short int __mon_yday[2][13] =
-  {
-    /* Normal years.  */
-    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
-    /* Leap years.  */
-    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
-  };
+{
+	/* Normal years.  */
+	{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+	/* Leap years.  */
+	{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
 
 #define MAX_YEAR_SECONDS	69
 #define SPD 0x15180 /*3600*24*/
@@ -90,8 +90,8 @@
 extern struct timezone sys_tz;
 #endif
 
-#define SECS_PER_HOUR   (60 * 60)
-#define SECS_PER_DAY    (SECS_PER_HOUR * 24)
+#define SECS_PER_HOUR	(60 * 60)
+#define SECS_PER_DAY	(SECS_PER_HOUR * 24)
 
 time_t *
 udf_stamp_to_time(time_t *dest, long *dest_usec, timestamp src)
@@ -139,10 +139,10 @@
 
 	gettimeofday(&tv, &sys_tz);
 #endif
-	offset = (-sys_tz.tz_minuteswest);
+	offset = -sys_tz.tz_minuteswest;
 
-    if (!dest)
-        return NULL;
+	if (!dest)
+		return NULL;
 
 	dest->typeAndTimezone = 0x1000 | (offset & 0x0FFF);
 
@@ -180,7 +180,7 @@
 	dest->hundredsOfMicroseconds = (tv_usec - dest->centiseconds * 10000) / 100;
 	dest->microseconds = (tv_usec - dest->centiseconds * 10000 -
 		dest->hundredsOfMicroseconds * 100);
-    return dest;
+	return dest;
 }
 
 /* EOF */
diff -u --recursive --new-file v2.3.48/linux/fs/udf/unicode.c linux/fs/udf/unicode.c
--- v2.3.48/linux/fs/udf/unicode.c	Fri Jan 28 15:09:09 2000
+++ linux/fs/udf/unicode.c	Thu Mar  2 11:17:32 2000
@@ -26,7 +26,7 @@
 
 #ifdef __KERNEL__
 #include <linux/kernel.h>
-#include <linux/string.h>       /* for memset */
+#include <linux/string.h>	/* for memset */
 #include <linux/udf_fs.h>
 #else
 #include <string.h>
@@ -98,7 +98,7 @@
  */
 int udf_build_ustr(struct ustr *dest, dstring *ptr, int size)
 {
-    int usesize;
+	int usesize;
 
 	if ( (!dest) || (!ptr) || (!size) )
 		return -1;
@@ -116,14 +116,14 @@
  */
 int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
 {
-    if ( (!dest) || (!ptr) || (!exactsize) )
-	return -1;
+	if ( (!dest) || (!ptr) || (!exactsize) )
+		return -1;
 
-    memset(dest, 0, sizeof(struct ustr));
-    dest->u_cmpID=ptr[0];
-    dest->u_len=exactsize-1;
-    memcpy(dest->u_name, ptr+1, exactsize-1);
-    return 0;
+	memset(dest, 0, sizeof(struct ustr));
+	dest->u_cmpID=ptr[0];
+	dest->u_len=exactsize-1;
+	memcpy(dest->u_name, ptr+1, exactsize-1);
+	return 0;
 }
 
 /*
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/hardirq.h linux/include/asm-alpha/hardirq.h
--- v2.3.48/linux/include/asm-alpha/hardirq.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-alpha/hardirq.h	Sun Feb 27 13:28:01 2000
@@ -46,7 +46,16 @@
 
 extern int global_irq_holder;
 extern spinlock_t global_irq_lock;
-extern atomic_t global_irq_count;
+
+static inline int irqs_running (void)
+{
+	int i;
+
+	for (i = 0; i < smp_num_cpus; i++)
+		if (local_irq_count(i))
+			return 1;
+	return 0;
+}
 
 static inline void release_irqlock(int cpu)
 {
@@ -60,7 +69,6 @@
 static inline void irq_enter(int cpu, int irq)
 {
 	++local_irq_count(cpu);
-        atomic_inc(&global_irq_count);
 
 	while (spin_is_locked(&global_irq_lock))
 		barrier();
@@ -68,7 +76,6 @@
 
 static inline void irq_exit(int cpu, int irq)
 {
-	atomic_dec(&global_irq_count);
         --local_irq_count(cpu);
 }
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/hw_irq.h linux/include/asm-alpha/hw_irq.h
--- v2.3.48/linux/include/asm-alpha/hw_irq.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-alpha/hw_irq.h	Mon Feb 28 07:18:20 2000
@@ -1,5 +1,14 @@
-/* This exists merely to satisfy <linux/irq.h>.  There is
-   nothing that would go here of general interest.
+#ifndef _ALPHA_HW_IRQ_H
+#define _ALPHA_HW_IRQ_H
 
-   Everything of consequence is in arch/alpha/kernel/irq_impl.h,
-   to be used only in arch/alpha/kernel/.  */
+#include <linux/config.h>
+
+static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
+
+#ifdef CONFIG_ALPHA_GENERIC
+#define ACTUAL_NR_IRQS	alpha_mv.nr_irqs
+#else
+#define ACTUAL_NR_IRQS	NR_IRQS
+#endif
+
+#endif
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/machvec.h linux/include/asm-alpha/machvec.h
--- v2.3.48/linux/include/asm-alpha/machvec.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-alpha/machvec.h	Thu Mar  2 11:35:17 2000
@@ -22,7 +22,6 @@
 struct pci_dev;
 struct pci_ops;
 struct pci_controler;
-struct irqaction;
 
 struct alpha_machine_vector
 {
@@ -67,10 +66,9 @@
 
 	void (*mv_switch_mm)(struct mm_struct *, struct mm_struct *,
 			     struct task_struct *, long);
-	void (*mv_activate_mm)(struct mm_struct *, struct mm_struct *, long);
+	void (*mv_activate_mm)(struct mm_struct *, struct mm_struct *);
 
 	void (*mv_flush_tlb_current)(struct mm_struct *);
-	void (*mv_flush_tlb_other)(struct mm_struct *);
 	void (*mv_flush_tlb_current_page)(struct mm_struct * mm,
 					  struct vm_area_struct *vma,
 					  unsigned long addr);
@@ -82,7 +80,7 @@
 
 	void (*init_arch)(void);
 	void (*init_irq)(void);
-	void (*init_rtc)(struct irqaction *);
+	void (*init_rtc)(void);
 	void (*init_pci)(void);
 	void (*kill_arch)(int);
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/mmu_context.h linux/include/asm-alpha/mmu_context.h
--- v2.3.48/linux/include/asm-alpha/mmu_context.h	Thu Feb 10 17:11:19 2000
+++ linux/include/asm-alpha/mmu_context.h	Thu Mar  2 11:35:17 2000
@@ -22,7 +22,8 @@
 #include <asm/io.h>
 #endif
 
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
+static inline void
+enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
 {
 }
 
@@ -58,8 +59,7 @@
  * in use) and the Valid bit set, then entries can also effectively be
  * made coherent by assigning a new, unused ASN to the currently
  * running process and not reusing the previous ASN before calling the
- * appropriate PALcode routine to invalidate the translation buffer
- * (TB)". 
+ * appropriate PALcode routine to invalidate the translation buffer (TB)". 
  *
  * In short, the EV4 has a "kind of" ASN capability, but it doesn't actually
  * work correctly and can thus not be used (explaining the lack of PAL-code
@@ -123,8 +123,6 @@
 #define __MMU_EXTERN_INLINE
 #endif
 
-extern void get_new_mm_context(struct task_struct *p, struct mm_struct *mm);
-
 static inline unsigned long
 __get_new_mm_context(struct mm_struct *mm, long cpu)
 {
@@ -133,6 +131,7 @@
 
 	if ((asn & HARDWARE_ASN_MASK) >= MAX_ASN) {
 		tbiap();
+		imb();
 		next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION;
 	}
 	cpu_last_asn(cpu) = next;
@@ -140,35 +139,6 @@
 }
 
 __EXTERN_INLINE void
-ev4_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
-	      struct task_struct *next, long cpu)
-{
-	/* As described, ASN's are broken.  But we can optimize for
-	   switching between threads -- if the mm is unchanged from
-	   current we needn't flush.  */
-	/* ??? May not be needed because EV4 PALcode recognizes that
-	   ASN's are broken and does a tbiap itself on swpctx, under
-	   the "Must set ASN or flush" rule.  At least this is true
-	   for a 1992 SRM, reports Joseph Martin (jmartin@hlo.dec.com).
-	   I'm going to leave this here anyway, just to Be Sure.  -- r~  */
-
-	if (prev_mm != next_mm)
-		tbiap();
-}
-
-__EXTERN_INLINE void
-ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, long cpu)
-{
-	/* This is only called after changing mm on current.  */
-	tbiap();
-
-        current->thread.ptbr
-	  = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
-
-	__reload_thread(&current->thread);
-}
-
-__EXTERN_INLINE void
 ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
 	      struct task_struct *next, long cpu)
 {
@@ -193,28 +163,50 @@
 }
 
 __EXTERN_INLINE void
-ev5_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, long cpu)
+ev4_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
+	      struct task_struct *next, long cpu)
 {
-	unsigned long mmc = __get_new_mm_context(next_mm, cpu);
-	next_mm->context = mmc;
-	current->thread.asn = mmc & HARDWARE_ASN_MASK;
-        current->thread.ptbr
-	  = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
+	/* As described, ASN's are broken for TLB usage.  But we can
+	   optimize for switching between threads -- if the mm is
+	   unchanged from current we needn't flush.  */
+	/* ??? May not be needed because EV4 PALcode recognizes that
+	   ASN's are broken and does a tbiap itself on swpctx, under
+	   the "Must set ASN or flush" rule.  At least this is true
+	   for a 1992 SRM, reports Joseph Martin (jmartin@hlo.dec.com).
+	   I'm going to leave this here anyway, just to Be Sure.  -- r~  */
+	if (prev_mm != next_mm)
+		tbiap();
+
+	/* Do continue to allocate ASNs, because we can still use them
+	   to avoid flushing the icache.  */
+	ev5_switch_mm(prev_mm, next_mm, next, cpu);
+}
 
-	__reload_thread(&current->thread);
+extern void __load_new_mm_context(struct mm_struct *);
+
+__EXTERN_INLINE void
+ev5_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
+{
+	__load_new_mm_context(next_mm);
 }
 
+__EXTERN_INLINE void
+ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
+{
+	__load_new_mm_context(next_mm);
+	tbiap();
+}
 
 #ifdef CONFIG_ALPHA_GENERIC
-# define switch_mm			alpha_mv.mv_switch_mm
-# define activate_mm(x,y)		alpha_mv.mv_activate_mm((x),(y),smp_processor_id())
+# define switch_mm(a,b,c,d)	alpha_mv.mv_switch_mm((a),(b),(c),(d))
+# define activate_mm(x,y)	alpha_mv.mv_activate_mm((x),(y))
 #else
 # ifdef CONFIG_ALPHA_EV4
-#  define switch_mm			ev4_switch_mm
-#  define activate_mm(x,y)		ev4_activate_mm((x),(y),smp_processor_id())
+#  define switch_mm(a,b,c,d)	ev4_switch_mm((a),(b),(c),(d))
+#  define activate_mm(x,y)	ev4_activate_mm((x),(y))
 # else
-#  define switch_mm			ev5_switch_mm
-#  define activate_mm(x,y)		ev5_activate_mm((x),(y),smp_processor_id())
+#  define switch_mm(a,b,c,d)	ev5_switch_mm((a),(b),(c),(d))
+#  define activate_mm(x,y)	ev5_activate_mm((x),(y))
 # endif
 #endif
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/pci.h linux/include/asm-alpha/pci.h
--- v2.3.48/linux/include/asm-alpha/pci.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-alpha/pci.h	Thu Mar  2 11:35:12 2000
@@ -12,22 +12,7 @@
 struct pci_dev;
 struct pci_bus;
 struct resource;
-
-/* A PCI IOMMU allocation arena.  There are typically two of these
-   regions per bus.  */
-/* ??? The 8400 has a 32-byte pte entry, and the entire table apparently
-   lives directly on the host bridge (no tlb?).  We don't support this
-   machine, but if we ever did, we'd need to parameterize all this quite
-   a bit further.  Probably with per-bus operation tables.  */
-
-struct pci_iommu_arena
-{
-	spinlock_t lock;
-	unsigned long *ptes;
-	dma_addr_t dma_base;
-	unsigned int size;
-	unsigned int alloc_hint;
-};
+struct pci_iommu_arena;
 
 /* A controler.  Used to manage multiple PCI busses.  */
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/pgalloc.h linux/include/asm-alpha/pgalloc.h
--- v2.3.48/linux/include/asm-alpha/pgalloc.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-alpha/pgalloc.h	Thu Mar  2 11:35:17 2000
@@ -3,50 +3,84 @@
 
 #include <linux/config.h>
 
+#ifndef __EXTERN_INLINE
+#define __EXTERN_INLINE extern inline
+#define __MMU_EXTERN_INLINE
+#endif
+
+extern void __load_new_mm_context(struct mm_struct *);
+
+
 /* Caches aren't brain-dead on the Alpha. */
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(mm, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_page_to_ram(page)			do { } while (0)
-/*
- * The icache is not coherent with the dcache on alpha, thus before
- * running self modified code like kernel modules we must always run
- * an imb().
- */
+
+/* Note that the following two definitions are _highly_ dependent
+   on the contexts in which they are used in the kernel.  I personally
+   think it is criminal how loosely defined these macros are.  */
+
+/* We need to flush the kernel's icache after loading modules.  The
+   only other use of this macro is in load_aout_interp which is not
+   used on Alpha. 
+
+   Note that this definition should *not* be used for userspace
+   icache flushing.  While functional, it is _way_ overkill.  The
+   icache is tagged with ASNs and it suffices to allocate a new ASN
+   for the process.  */
 #ifndef __SMP__
 #define flush_icache_range(start, end)		imb()
 #else
 #define flush_icache_range(start, end)		smp_imb()
 extern void smp_imb(void);
 #endif
-#define flush_icache_page(vma, page)		do { } while (0)
+
+/* We need to flush the userspace icache after setting breakpoints in
+   ptrace.  I don't think it's needed in do_swap_page, or do_no_page,
+   but I don't know how to get rid of it either.
+
+   Instead of indiscriminately using imb, take advantage of the fact
+   that icache entries are tagged with the ASN and load a new mm context.  */
+/* ??? Ought to use this in arch/alpha/kernel/signal.c too.  */
+
+#ifndef __SMP__
+static inline void
+flush_icache_page(struct vm_area_struct *vma, struct page *page)
+{
+	if (vma->vm_flags & VM_EXEC) {
+		struct mm_struct *mm = vma->vm_mm;
+		mm->context = 0;
+		if (current->active_mm == mm)
+			__load_new_mm_context(mm);
+	}
+}
+#else
+extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
+#endif
+
 
 /*
  * Use a few helper functions to hide the ugly broken ASN
  * numbers on early Alphas (ev4 and ev45)
  */
 
-#ifndef __EXTERN_INLINE
-#define __EXTERN_INLINE extern inline
-#define __MMU_EXTERN_INLINE
-#endif
-
 __EXTERN_INLINE void
 ev4_flush_tlb_current(struct mm_struct *mm)
 {
+	__load_new_mm_context(mm);
 	tbiap();
 }
 
 __EXTERN_INLINE void
-ev4_flush_tlb_other(struct mm_struct *mm)
+ev5_flush_tlb_current(struct mm_struct *mm)
 {
+	__load_new_mm_context(mm);
 }
 
-extern void ev5_flush_tlb_current(struct mm_struct *mm);
-
-__EXTERN_INLINE void
-ev5_flush_tlb_other(struct mm_struct *mm)
+extern inline void
+flush_tlb_other(struct mm_struct *mm)
 {
 	mm->context = 0;
 }
@@ -62,7 +96,12 @@
 			   struct vm_area_struct *vma,
 			   unsigned long addr)
 {
-	tbi(2 + ((vma->vm_flags & VM_EXEC) != 0), addr);
+	int tbi_flag = 2;
+	if (vma->vm_flags & VM_EXEC) {
+		__load_new_mm_context(mm);
+		tbi_flag = 3;
+	}
+	tbi(tbi_flag, addr);
 }
 
 __EXTERN_INLINE void
@@ -71,7 +110,7 @@
 			   unsigned long addr)
 {
 	if (vma->vm_flags & VM_EXEC)
-		ev5_flush_tlb_current(mm);
+		__load_new_mm_context(mm);
 	else
 		tbi(2, addr);
 }
@@ -79,16 +118,13 @@
 
 #ifdef CONFIG_ALPHA_GENERIC
 # define flush_tlb_current		alpha_mv.mv_flush_tlb_current
-# define flush_tlb_other		alpha_mv.mv_flush_tlb_other
 # define flush_tlb_current_page		alpha_mv.mv_flush_tlb_current_page
 #else
 # ifdef CONFIG_ALPHA_EV4
 #  define flush_tlb_current		ev4_flush_tlb_current
-#  define flush_tlb_other		ev4_flush_tlb_other
 #  define flush_tlb_current_page	ev4_flush_tlb_current_page
 # else
 #  define flush_tlb_current		ev5_flush_tlb_current
-#  define flush_tlb_other		ev5_flush_tlb_other
 #  define flush_tlb_current_page	ev5_flush_tlb_current_page
 # endif
 #endif
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/pgtable.h linux/include/asm-alpha/pgtable.h
--- v2.3.48/linux/include/asm-alpha/pgtable.h	Sun Feb 13 19:29:04 2000
+++ linux/include/asm-alpha/pgtable.h	Thu Mar  2 10:18:49 2000
@@ -40,6 +40,7 @@
 #define PTRS_PER_PMD	(1UL << (PAGE_SHIFT-3))
 #define PTRS_PER_PGD	((1UL << (PAGE_SHIFT-3))-1)
 #define USER_PTRS_PER_PGD	(TASK_SIZE / PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	0
 
 /* Number of pointers that fit on a page:  this will go away. */
 #define PTRS_PER_PAGE	(1UL << (PAGE_SHIFT-3))
@@ -305,5 +306,7 @@
 	printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
 #define pgd_ERROR(e) \
 	printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
+
+extern void paging_init(void);
 
 #endif /* _ALPHA_PGTABLE_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/smp.h linux/include/asm-alpha/smp.h
--- v2.3.48/linux/include/asm-alpha/smp.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-alpha/smp.h	Sun Feb 27 13:28:01 2000
@@ -55,6 +55,8 @@
 #define hard_smp_processor_id()	__hard_smp_processor_id()
 #define smp_processor_id()	(current->processor)
 
+extern unsigned long cpu_present_mask;
+
 #endif /* __SMP__ */
 
 #define NO_PROC_ID	(-1)
diff -u --recursive --new-file v2.3.48/linux/include/asm-alpha/socket.h linux/include/asm-alpha/socket.h
--- v2.3.48/linux/include/asm-alpha/socket.h	Sun Dec 21 17:41:24 1997
+++ linux/include/asm-alpha/socket.h	Sun Feb 27 18:45:10 2000
@@ -43,6 +43,8 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME		28
+
 /* Security levels - as per NRL IPv6 - don't actually do anything */
 #define SO_SECURITY_AUTHENTICATION		19
 #define SO_SECURITY_ENCRYPTION_TRANSPORT	20
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/hardware.h linux/include/asm-arm/arch-cl7500/hardware.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/hardware.h	Tue Nov 23 22:42:21 1999
+++ linux/include/asm-arm/arch-cl7500/hardware.h	Mon Feb 28 14:16:37 2000
@@ -52,7 +52,7 @@
 #define FLUSH_BASE		0xdf000000
 
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 
 /*
  * for use with inb/outb
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/memory.h linux/include/asm-arm/arch-cl7500/memory.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/memory.h	Tue Nov 23 22:42:21 1999
+++ linux/include/asm-arm/arch-cl7500/memory.h	Mon Feb 28 14:16:37 2000
@@ -18,16 +18,18 @@
  * Task size: 3GB
  */
 #define TASK_SIZE	(0xc0000000UL)
+#define TASK_SIZE_26	(0x04000000UL)
 
 /*
  * Page offset: 3GB
  */
 #define PAGE_OFFSET	(0xc0000000UL)
+#define PHYS_OFFSET	(0x10000000UL)
 
-#ifndef __ASSEMBLY__
-extern unsigned long __virt_to_phys(unsigned long vpage);
-extern unsigned long __phys_to_virt(unsigned long ppage);
-#endif
+#define __virt_to_phys__is_a_macro
+#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
+#define __phys_to_virt__is_a_macro
+#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
 
 /*
  * These are exactly the same on the RiscPC as the
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/param.h linux/include/asm-arm/arch-cl7500/param.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/param.h	Tue Nov 23 22:42:21 1999
+++ linux/include/asm-arm/arch-cl7500/param.h	Mon Feb 28 14:16:37 2000
@@ -3,3 +3,5 @@
  *
  * Copyright (C) 1999 Nexus Electronics Ltd
  */
+
+#define HZ 100
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/processor.h linux/include/asm-arm/arch-cl7500/processor.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/processor.h	Tue Nov 23 22:42:21 1999
+++ linux/include/asm-arm/arch-cl7500/processor.h	Mon Feb 28 14:16:37 2000
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_PROCESSOR_H
 #define __ASM_ARCH_PROCESSOR_H
 
-#include <asm/arch/memory.h>
-
 /*
  * Bus types
  */
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/serial.h linux/include/asm-arm/arch-cl7500/serial.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/serial.h	Tue Nov 23 22:42:21 1999
+++ linux/include/asm-arm/arch-cl7500/serial.h	Mon Feb 28 14:16:37 2000
@@ -20,10 +20,12 @@
  */
 #define BASE_BAUD (1843200 / 16)
 
+#define RS_TABLE_SIZE	16
+
 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
 
      /* UART CLK        PORT  IRQ     FLAGS        */
-#define SERIAL_PORT_DFNS \
+#define STD_SERIAL_PORT_DEFNS \
 	{ 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS },	/* ttyS0 */	\
 	{ 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS },	/* ttyS1 */	\
 	{ 0, BASE_BAUD, 0x804002e8,  41, STD_COM_FLAGS },	/* ttyS2 */	\
@@ -38,5 +40,7 @@
 	{ 0, BASE_BAUD, 0    ,  0, STD_COM_FLAGS },	/* ttyS11 */	\
 	{ 0, BASE_BAUD, 0    ,  0, STD_COM_FLAGS },	/* ttyS12 */	\
 	{ 0, BASE_BAUD, 0    ,  0, STD_COM_FLAGS },	/* ttyS13 */
+
+#define EXTRA_SERIAL_PORT_DEFNS
 
 #endif
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/system.h linux/include/asm-arm/arch-cl7500/system.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/system.h	Fri Jan 21 18:19:17 2000
+++ linux/include/asm-arm/arch-cl7500/system.h	Mon Feb 28 14:16:37 2000
@@ -8,21 +8,20 @@
 
 #include <asm/iomd.h>
 
-#define arch_reset(mode) {			\
-	outb (0, IOMD_ROMCR0);			\
-	cli();					\
-	__asm__ __volatile__(			\
-		"mcr	p15, 0, %0, c1, c0, 0;"	\
-		"mov	pc, #0"			\
-	 : 					\
-	 : "r" (cpu_reset()));			\
+#define arch_do_idle()							\
+	outb(0, IOMD_SUSMODE)
+
+#define arch_reset(mode) {						\
+	outb (0, IOMD_ROMCR0);						\
+	cli();								\
+	__asm__ __volatile__("msr  spsr, r1;"				\
+			     "mcr  p15, 0, %0, c1, c0, 0;"		\
+			     "movs pc, #0"				\
+			 : 						\
+			 : "r" (cpu_reset()));				\
 	}
 
-/*
- * We can wait for an interrupt...
- */
-#define arch_do_idle()				\
-	outb(0, IOMD_SUSMODE)
+#define arch_power_off()	do { } while (0)
 
 #define arch_power_off()	do { } while (0)
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-cl7500/time.h linux/include/asm-arm/arch-cl7500/time.h
--- v2.3.48/linux/include/asm-arm/arch-cl7500/time.h	Thu Feb 10 17:11:20 2000
+++ linux/include/asm-arm/arch-cl7500/time.h	Mon Feb 28 14:16:37 2000
@@ -17,12 +17,11 @@
 
 	{
 		/* Twinkle the lights. */
-		static int count, bit = 8, dir = 1;
+		static int count, state = 0xff;
 		if (count-- == 0) {
-			bit += dir;
-			if (bit == 8 || bit == 15) dir = -dir;
-			count = 5;
-			*((volatile unsigned int *)(0xe002ba00)) = 1 << bit;
+			state ^= 1;
+			count = 25;
+			*((volatile unsigned int *)(0xe002ba00)) = state;
 		}
 	}
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/dma.h linux/include/asm-arm/arch-nexuspci/dma.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/dma.h	Thu Jan  7 15:51:33 1999
+++ linux/include/asm-arm/arch-nexuspci/dma.h	Mon Feb 28 14:16:37 2000
@@ -1,9 +1,12 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/dma.h
  *
- * Architecture DMA routines - NexusPCI has no DMA, so this file is very
- * simple. :-)
+ * Architecture DMA routines
  *
- * Copyright (C) 1998 Philip Blundell
+ * Copyright (C) 1998, 1999 Philip Blundell
  */
 
+/*
+ * This is the maximum DMA address that can be DMAd to.
+ */
+#define MAX_DMA_ADDRESS		0xffffffff
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/hardware.h linux/include/asm-arm/arch-nexuspci/hardware.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/hardware.h	Sat May  8 11:06:57 1999
+++ linux/include/asm-arm/arch-nexuspci/hardware.h	Mon Feb 28 14:16:37 2000
@@ -1,31 +1,66 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/hardware.h
  *
- * Copyright (C) 1998-1999 Philip Blundell
+ * Copyright (C) 1998, 1999, 2000 FutureTV Labs Ltd.
  *
- * This file contains the hardware definitions of the Nexus PCI card.
+ * This file contains the hardware definitions of the FTV PCI card.
  */
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
 /*    Logical    Physical
- * 0xfff00000	0x10000000	SCC2691 DUART
  * 0xffe00000	0x20000000	INTCONT
  * 0xffd00000	0x30000000	Status
  * 0xffc00000	0x60000000	PLX registers
- * 0xfe000000	0x70000000	PCI I/O
+ * 0xfe000000	0xC0000000	PCI I/O
+ * 0xfd000000	0x70000000	cache flush
+ * 0xfc000000	0x80000000	PCI/ISA memory
+ * 0xe0000000	0x10000000	SCC2691 DUART
  */
 
 /*
  * Mapping areas
  */
+#define INTCONT_BASE		0xffe00000
+#define STATUS_BASE		0xffd00000
+#define PLX_BASE		0xffc00000
 #define PCIO_BASE		0xfe000000
-#define FLUSH_BASE		0xdf000000
+#define FLUSH_BASE		0xfd000000
+#define DUART_BASE		0xe0000000
+#define PCIMEM_BASE		0xfc000000
+
+#define PLX_IO_START		0xC0000000
+#define PLX_MEM_START		0x80000000
+#define PLX_START		0x60000000
+#define STATUS_START		0x30000000
+#define INTCONT_START		0x20000000
+#define DUART_START		0x10000000
 
 /*
  * RAM definitions
  */
 #define RAM_BASE		0x40000000
-#define FLUSH_BASE_PHYS		0x40000000
+#define FLUSH_BASE_PHYS		0x70000000
+
+/*
+ * Miscellaneous INTCONT bits
+ */
+#define INTCONT_FIQ_PLX		0x00
+#define INTCONT_FIQ_D		0x02
+#define INTCONT_FIQ_C		0x04
+#define INTCONT_FIQ_B		0x06
+#define INTCONT_FIQ_A		0x08
+#define INTCONT_FIQ_SYSERR	0x0a
+#define INTCONT_IRQ_DUART	0x0c
+#define INTCONT_IRQ_PLX		0x0e
+#define INTCONT_IRQ_D		0x10
+#define INTCONT_IRQ_C		0x12
+#define INTCONT_IRQ_B		0x14
+#define INTCONT_IRQ_A		0x16
+#define INTCONT_IRQ_SYSERR	0x1e
+
+#define INTCONT_WATCHDOG	0x18
+#define INTCONT_LED		0x1a
+#define INTCONT_PCI_RESET	0x1c
 
 #endif
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/ide.h linux/include/asm-arm/arch-nexuspci/ide.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/ide.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-arm/arch-nexuspci/ide.h	Mon Feb 28 14:16:37 2000
@@ -0,0 +1,36 @@
+/*
+ * linux/include/asm-arm/arch-nexuspci/ide.h
+ *
+ * Copyright (c) 1998 Russell King
+ *
+ * Modifications:
+ *  29-07-1998	RMK	Major re-work of IDE architecture specific code
+ */
+#include <asm/irq.h>
+
+/*
+ * Set up a hw structure for a specified data port, control port and IRQ.
+ * This should follow whatever the default interface uses.
+ */
+static __inline__ void
+ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq)
+{
+	ide_ioreg_t reg = (ide_ioreg_t) data_port;
+	int i;
+
+	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
+		hw->io_ports[i] = reg;
+		reg += 1;
+	}
+	hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
+	hw->irq = irq;
+}
+
+/*
+ * This registers the standard ports for this architecture with the IDE
+ * driver.
+ */
+static __inline__ void ide_init_default_hwifs(void)
+{
+	/* There are no standard ports */
+}
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/io.h linux/include/asm-arm/arch-nexuspci/io.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/io.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-arm/arch-nexuspci/io.h	Mon Feb 28 14:16:37 2000
@@ -1,147 +1,96 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/io.h
  *
- * Copyright (C) 1997,1998 Russell King
- *
- * Modifications:
- *  06-Dec-1997	RMK	Created.
+ * Copyright (C) 1997-1999 Russell King
+ * Copyright (C) 2000 FutureTV Labs Ltd.
  */
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffffffff
+#define IO_SPACE_LIMIT 0xffff
 
 /*
- * Dynamic IO functions - let the compiler
- * optimize the expressions
+ * Translation of various region addresses to virtual addresses
  */
-#define DECLARE_DYN_OUT(fnsuffix,instr,typ)					\
-extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port)	\
-{										\
-	__asm__ __volatile__(							\
-	"str" ##instr## "	%0, [%1, %2]"					\
-	: 									\
-	: "r" (value), "r" (PCIO_BASE), typ (port));				\
+#define __io_pci(a)		(PCIO_BASE + (a))
+#if 1
+#define __mem_pci(a)		((unsigned long)(a))
+#define __mem_isa(a)		(PCIMEM_BASE + (unsigned long)(a))
+#else
+
+extern __inline__ unsigned long ___mem_pci(unsigned long a)
+{
+	/* PCI addresses must have been ioremapped */
+	if (a <= 0xc0000000 || a >= 0xe0000000)
+		*((int *)0) = 0;
+	return a;
 }
 
-#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ)					\
-extern __inline__ unsigned sz __in##fnsuffix (unsigned int port)		\
-{										\
-	unsigned long value;							\
-	__asm__ __volatile__(							\
-	"ldr" ##instr## "	%0, [%1, %2]"					\
-	: "=&r" (value)								\
-	: "r" (PCIO_BASE), typ (port));						\
-	return (unsigned sz)value;						\
+extern __inline__ unsigned long ___mem_isa(unsigned long a)
+{
+	if (a >= 16*1048576)
+		BUG();
+	return PCIMEM_BASE + a;
 }
+#define __mem_pci(a)		___mem_pci((unsigned long)(a))
+#define __mem_isa(a)		___mem_isa((unsigned long)(a))
+#endif
 
-extern __inline__ unsigned int __ioaddr (unsigned int port)			\
-{										\
-	return (unsigned int)(PCIO_BASE + port);				\
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr,typ)	\
-	DECLARE_DYN_OUT(fnsuffix,instr,typ)	\
-	DECLARE_DYN_IN(sz,fnsuffix,instr,typ)
-
-DECLARE_IO(char,b,"b","Jr")
-DECLARE_IO(short,w,"h","r")
-DECLARE_IO(int,l,"","Jr")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_OUT
-#undef DECLARE_DYN_IN
+/* the following macro is depreciated */
+#define __ioaddr(p)		__io_pci(p)
 
 /*
- * Constant address IO functions
- *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
+ * Generic virtual read/write
  */
-#define __outbc(value,port)							\
-({										\
-	__asm__ __volatile__(							\
-	"strb	%0, [%1, %2]"							\
-	:									\
-	: "r" (value), "r" (PCIO_BASE), "Jr" (port));				\
-})
-
-#define __inbc(port)								\
-({										\
-	unsigned char result;							\
-	__asm__ __volatile__(							\
-	"ldrb	%0, [%1, %2]"							\
-	: "=r" (result)								\
-	: "r" (PCIO_BASE), "Jr" (port));					\
-	result;									\
-})
+#define __arch_getb(a)		(*(volatile unsigned char *)(a))
+#define __arch_getl(a)		(*(volatile unsigned int *)(a))
 
-#define __outwc(value,port)							\
-({										\
-	__asm__ __volatile__(							\
-	"strh	%0, [%1, %2]"							\
-	:									\
-	: "r" (value), "r" (PCIO_BASE), "r" (port));				\
-})
-
-#define __inwc(port)								\
-({										\
-	unsigned short result;							\
-	__asm__ __volatile__(							\
-	"ldrh	%0, [%1, %2]"							\
-	: "=r" (result)								\
-	: "r" (PCIO_BASE), "r" (port));						\
-	result & 0xffff;							\
-})
+extern __inline__ unsigned int __arch_getw(unsigned long a)
+{
+	unsigned int value;
+	__asm__ __volatile__("ldr%?h	%0, [%1, #0]	@ getw"
+		: "=&r" (value)
+		: "r" (a));
+	return value;
+}
 
-#define __outlc(value,port)							\
-({										\
-	__asm__ __volatile__(							\
-	"str	%0, [%1, %2]"							\
-	:									\
-	: "r" (value), "r" (PCIO_BASE), "Jr" (port));				\
-})
 
-#define __inlc(port)								\
-({										\
-	unsigned long result;							\
-	__asm__ __volatile__(							\
-	"ldr	%0, [%1, %2]"							\
-	: "=r" (result)								\
-	: "r" (PCIO_BASE), "Jr" (port));					\
-	result;									\
-})
+#define __arch_putb(v,a)	(*(volatile unsigned char *)(a) = (v))
+#define __arch_putl(v,a)	(*(volatile unsigned int *)(a) = (v))
 
-#define __ioaddrc(port)								\
-({										\
-	unsigned long addr;							\
-	addr = PCIO_BASE + port;						\
-	addr;									\
-})
+extern __inline__ void __arch_putw(unsigned int value, unsigned long a)
+{
+	__asm__ __volatile__("str%?h	%0, [%1, #0]	@ putw"
+		: : "r" (value), "r" (a));
+}
 
-#define inb(p)	 	(__builtin_constant_p((p)) ? __inbc(p)    : __inb(p))
-#define inw(p)	 	(__builtin_constant_p((p)) ? __inwc(p)    : __inw(p))
-#define inl(p)	 	(__builtin_constant_p((p)) ? __inlc(p)    : __inl(p))
-#define outb(v,p)	(__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
-#define outw(v,p)	(__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
-#define outl(v,p)	(__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
-#define __ioaddr(p)	(__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
+#define inb(p)			__arch_getb(__io_pci(p))
+#define inw(p)			__arch_getw(__io_pci(p))
+#define inl(p)			__arch_getl(__io_pci(p))
+
+#define outb(v,p)		__arch_putb(v,__io_pci(p))
+#define outw(v,p)		__arch_putw(v,__io_pci(p))
+#define outl(v,p)		__arch_putl(v,__io_pci(p))
 
 /*
- * Translated address IO functions
- *
- * IO address has already been translated to a virtual address
+ * ioremap support - validate a PCI memory address,
+ * and convert a PCI memory address to a physical
+ * address for the page tables.
  */
-#define outb_t(v,p)								\
-	(*(volatile unsigned char *)(p) = (v))
-
-#define inb_t(p)								\
-	(*(volatile unsigned char *)(p))
+#define valid_ioaddr(off,sz)	((off) < 0x80000000 && (off) + (sz) <= 0x80000000)
+#define io_to_phys(off)		((off) + PLX_MEM_START)
 
-#define outl_t(v,p)								\
-	(*(volatile unsigned long *)(p) = (v))
-
-#define inl_t(p)								\
-	(*(volatile unsigned long *)(p))
+/*
+ * ioremap takes a PCI memory address, as specified in
+ * linux/Documentation/IO-mapping.txt
+ */
+#define __arch_ioremap(off,size,nocache)			\
+({								\
+	unsigned long _off = (off), _size = (size);		\
+	void *_ret = (void *)0;					\
+	if (valid_ioaddr(_off, _size))				\
+		_ret = __ioremap(io_to_phys(_off), _size, 0);	\
+	_ret;							\
+})
 
 #endif
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/irq.h linux/include/asm-arm/arch-nexuspci/irq.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/irq.h	Sat May  8 11:06:57 1999
+++ linux/include/asm-arm/arch-nexuspci/irq.h	Mon Feb 28 14:16:37 2000
@@ -1,42 +1,62 @@
 /*
  * include/asm-arm/arch-nexuspci/irq.h
  *
- * Copyright (C) 1998 Philip Blundell
- *
- * Changelog:
- *   22-08-1998	RMK	Restructured IRQ routines
+ * Copyright (C) 1998, 1999, 2000 Philip Blundell
  */
 
 #include <asm/io.h>
 
 #define fixup_irq(x) (x)
 
-#define INTCONT		0xffe00000
-
 extern unsigned long soft_irq_mask;
 
-static void nexuspci_mask_irq(unsigned int irq)
+static const unsigned char irq_cmd[] =
+{
+	INTCONT_IRQ_DUART,
+	INTCONT_IRQ_PLX,
+	INTCONT_IRQ_D,
+	INTCONT_IRQ_C,
+	INTCONT_IRQ_B,
+	INTCONT_IRQ_A,
+	INTCONT_IRQ_SYSERR
+};
+
+static void ftvpci_mask_irq(unsigned int irq)
 {
-	writel((irq << 1), INTCONT);
+	__raw_writel(irq_cmd[irq], INTCONT_BASE);
 	soft_irq_mask &= ~(1<<irq);
 }
 
-static void nexuspci_unmask_irq(unsigned int irq)
+static void ftvpci_unmask_irq(unsigned int irq)
 {
-	writel((irq << 1) + 1, INTCONT);
 	soft_irq_mask |= (1<<irq);
+	__raw_writel(irq_cmd[irq] | 1, INTCONT_BASE);
 }
  
 static __inline__ void irq_init_irq(void)
 {
 	unsigned int i;
+
+	/* Mask all FIQs */
+	__raw_writel(INTCONT_FIQ_PLX, INTCONT_BASE);
+	__raw_writel(INTCONT_FIQ_D, INTCONT_BASE);
+	__raw_writel(INTCONT_FIQ_C, INTCONT_BASE);
+	__raw_writel(INTCONT_FIQ_B, INTCONT_BASE);
+	__raw_writel(INTCONT_FIQ_A, INTCONT_BASE);
+	__raw_writel(INTCONT_FIQ_SYSERR, INTCONT_BASE);
+
 	/* Disable all interrupts initially. */
 	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc[i].valid	= 1;
-		irq_desc[i].probe_ok	= 1;
-		irq_desc[i].mask_ack	= nexuspci_mask_irq;
-		irq_desc[i].mask	= nexuspci_mask_irq;
-		irq_desc[i].unmask	= nexuspci_unmask_irq;
-		mask_irq(i);
-	}
+		if (i >= FIRST_IRQ && i <= LAST_IRQ) {
+			irq_desc[i].valid	= 1;
+			irq_desc[i].probe_ok	= 1;
+			irq_desc[i].mask_ack	= ftvpci_mask_irq;
+			irq_desc[i].mask	= ftvpci_mask_irq;
+			irq_desc[i].unmask	= ftvpci_unmask_irq;
+			ftvpci_mask_irq(i);
+		} else {
+			irq_desc[i].valid	= 0;
+			irq_desc[i].probe_ok	= 0;
+		}	
+	}		
 }
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/irqs.h linux/include/asm-arm/arch-nexuspci/irqs.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/irqs.h	Sat Jul 18 11:55:25 1998
+++ linux/include/asm-arm/arch-nexuspci/irqs.h	Mon Feb 28 14:16:37 2000
@@ -1,30 +1,23 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/irqs.h
  *
- * Copyright (C) 1997, 1998 Philip Blundell
+ * Copyright (C) 1997, 1998, 2000 Philip Blundell
  */
 
-/* Most of the IRQ sources can generate both FIQs and IRQs.
-   The exceptions to this are the DUART, which can only generate IRQs,
-   and the PLX SYSERR output, which can only generate FIQs.  We route
-   both FIQs and IRQs through the generic IRQ handling system and the
-   choice by the driver of which to use is basically an arbitrary one.  */
+/* The hardware is capable of routing any interrupt source (except the
+   DUART) to either IRQ or FIQ.  We ignore FIQ and use IRQ exclusively
+   for simplicity.  */
 
-#define TREAT_FIQS_AS_IRQS
+#define IRQ_DUART		0
+#define IRQ_PLX 		1
+#define IRQ_PCI_D		2
+#define IRQ_PCI_C		3
+#define IRQ_PCI_B		4
+#define IRQ_PCI_A	        5
+#define IRQ_SYSERR		6	/* only from IOSLAVE rev B */
 
-#define FIQ_PLX			0
-#define FIQ_PCI_D		1
-#define FIQ_PCI_C		2
-#define FIQ_PCI_B		3
-#define FIQ_PCI_A		4
-#define FIQ_SYSERR		5
-
-#define IRQ_DUART		6
-#define IRQ_PLX 		7
-#define IRQ_PCI_D		8
-#define IRQ_PCI_C		9
-#define IRQ_PCI_B		10
-#define IRQ_PCI_A	        11
+#define FIRST_IRQ		IRQ_DUART
+#define LAST_IRQ		IRQ_SYSERR
 
 /* timer is part of the DUART */
 #define IRQ_TIMER		IRQ_DUART
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/keyboard.h linux/include/asm-arm/arch-nexuspci/keyboard.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/keyboard.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-arm/arch-nexuspci/keyboard.h	Mon Feb 28 14:16:37 2000
@@ -0,0 +1,29 @@
+/*
+ * linux/include/asm-arm/arch-nexuspci/keyboard.h
+ *
+ * Driver definitions for PCI card dummy keyboard.
+ *
+ * Copyright (C) 1998 Russell King
+ * Copyright (C) 1998 Philip Blundell
+ */
+
+#define NR_SCANCODES 128
+
+#define kbd_setkeycode(sc,kc)		(-EINVAL)
+#define kbd_getkeycode(sc)		(-EINVAL)
+
+/* Prototype: int kbd_pretranslate(scancode, raw_mode)
+ * Returns  : 0 to ignore scancode
+ */
+#define kbd_pretranslate(sc,rm)	(1)
+
+/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode)
+ * Returns  : 0 to ignore scancode, *keycode set to keycode, *up_flag
+ *            set to 0200 if scancode indicates release
+ */
+#define kbd_translate(sc, kcp, rm) 0
+#define kbd_unexpected_up(kc)		(0200)
+#define kbd_leds(leds)			do { } while (0)
+#define kbd_init_hw()			do { } while (0)
+#define kbd_disable_irq()		do { } while (0)
+#define kbd_enable_irq()		do { } while (0)
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/memory.h linux/include/asm-arm/arch-nexuspci/memory.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/memory.h	Mon Nov  1 13:56:27 1999
+++ linux/include/asm-arm/arch-nexuspci/memory.h	Mon Feb 28 14:16:37 2000
@@ -1,7 +1,7 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/memory.h
  *
- * Copyright (c) 1997, 1998 Philip Blundell.
+ * Copyright (c) 1997, 1998, 2000 FutureTV Labs Ltd.
  * Copyright (c) 1999 Russell King
  *
  */
@@ -19,21 +19,22 @@
  */
 #define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x40000000UL)
+#define BUS_OFFSET	(0xe0000000UL)
 
 /*
- * On NexusPCI, the DRAM is contiguous
+ * DRAM is contiguous
  */
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
+#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET + PHYS_OFFSET)
+#define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET - PHYS_OFFSET)
 #define __virt_to_phys__is_a_macro
 #define __phys_to_virt__is_a_macro
 
 /*
- * On the PCI bus the DRAM appears at address 0
+ * On the PCI bus the DRAM appears at address 0xe0000000
  */
 #define __virt_to_bus__is_a_macro
-#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
+#define __virt_to_bus(x) ((unsigned long)(x) - PAGE_OFFSET + BUS_OFFSET)
 #define __bus_to_virt__is_a_macro
-#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
+#define __bus_to_virt(x) ((unsigned long)(x) + PAGE_OFFSET - BUS_OFFSET)
 
 #endif
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/system.h linux/include/asm-arm/arch-nexuspci/system.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/system.h	Fri Jan 21 18:19:17 2000
+++ linux/include/asm-arm/arch-nexuspci/system.h	Mon Feb 28 14:16:37 2000
@@ -1,12 +1,12 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/system.h
  *
- * Copyright (c) 1996-1999 Russell King.
+ * Copyright (c) 1996, 97, 98, 99, 2000 FutureTV Labs Ltd.
  */
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#define arch_do_idle()		do { } while (0)
+#define arch_do_idle()		cpu_do_idle()
 #define arch_reset(mode)	do { } while (0)
 #define arch_power_off()	do { } while (0)
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/time.h linux/include/asm-arm/arch-nexuspci/time.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/time.h	Thu Feb 10 17:11:20 2000
+++ linux/include/asm-arm/arch-nexuspci/time.h	Mon Feb 28 14:16:37 2000
@@ -1,34 +1,37 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/time.h
  *
- * Copyright (c) 1997 Phil Blundell.
+ * Copyright (c) 1997, 1998, 1999, 2000 FutureTV Labs Ltd.
  *
- * Nexus PCI card has no real-time clock.  We get timer ticks from the
+ * The FTV PCI card has no real-time clock.  We get timer ticks from the
  * SCC chip.
  */
 
-#define UART_BASE		0xfff00000
-#define INTCONT			0xffe00000
-
 static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-	static int count = 50;
+	static int count = 25;
+	unsigned char stat = __raw_readb(DUART_BASE + 0x14);
+	if (!(stat & 0x10))
+		return;		/* Not for us */
 
-	writeb(0x90, UART_BASE + 8);
+	/* Reset counter */
+	__raw_writeb(0x90, DUART_BASE + 8);
 
 	if (--count == 0) {
 		static int state = 1;
 		state ^= 1;
-		writeb(0x1a + state, INTCONT);
+		__raw_writeb(0x1a + state, INTCONT_BASE);
+		__raw_writeb(0x18 + state, INTCONT_BASE);
 		count = 50;
 	}
 
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
+	/* Wait for slow rise time */
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
 
 	do_timer(regs);	
 }
@@ -37,10 +40,10 @@
 {
 	int tick = 3686400 / 16 / 2 / 100;
 
-	writeb(tick & 0xff, UART_BASE + 0x1c);
-	writeb(tick >> 8, UART_BASE + 0x18);
-	writeb(0x80, UART_BASE + 8);
-	writeb(0x10, UART_BASE + 0x14);
+	__raw_writeb(tick & 0xff, DUART_BASE + 0x1c);
+	__raw_writeb(tick >> 8, DUART_BASE + 0x18);
+	__raw_writeb(0x80, DUART_BASE + 8);
+	__raw_writeb(0x10, DUART_BASE + 0x14);
 
 	timer_irq.handler = timer_interrupt;
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/uncompress.h linux/include/asm-arm/arch-nexuspci/uncompress.h
--- v2.3.48/linux/include/asm-arm/arch-nexuspci/uncompress.h	Sun Apr 12 11:42:15 1998
+++ linux/include/asm-arm/arch-nexuspci/uncompress.h	Mon Feb 28 14:16:37 2000
@@ -1,18 +1,56 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/uncompress.h
- *  from linux/include/asm-arm/arch-ebsa110/uncompress.h
  *
- * Copyright (C) 1996,1997,1998 Russell King
+ * Copyright (C) 1998, 1999, 2000 Philip Blundell
  */
 
+#include <asm/hardware.h>
+#include <asm/io.h>
+
+/*
+ * Write a character to the UART
+ */
+void _ll_write_char(char c)
+{
+	while (!(__raw_readb(DUART_START + 0x4) & 0x4))
+		;
+	__raw_writeb(c, DUART_START + 0xc);
+}
+
 /*
  * This does not append a newline
  */
 static void puts(const char *s)
 {
+	while (*s)
+		_ll_write_char(*(s++));
+}
+
+/*
+ * Set up for decompression
+ */
+static void arch_decomp_setup(void)
+{
+	/* LED off */
+	__raw_writel(INTCONT_LED, INTCONT_START);
+
+	/* Set up SCC */
+	__raw_writeb(42, DUART_START + 8);
+	__raw_writeb(48, DUART_START + 8);
+	__raw_writeb(16, DUART_START + 8);
+	__raw_writeb(0x93, DUART_START);
+	__raw_writeb(0x17, DUART_START);
+	__raw_writeb(0xbb, DUART_START + 4);
+	__raw_writeb(0x78, DUART_START + 16);
+	__raw_writeb(0xa0, DUART_START + 8);
+	__raw_writeb(5, DUART_START + 8);
 }
 
 /*
- * nothing to do
+ * Stroke the watchdog so we don't get reset during decompression.
  */
-#define arch_decomp_setup()
+static inline void arch_decomp_wdog(void)
+{
+	__raw_writel(INTCONT_WATCHDOG, INTCONT_START);
+	__raw_writel(INTCONT_WATCHDOG | 1, INTCONT_START);
+}
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-sa1100/uncompress.h linux/include/asm-arm/arch-sa1100/uncompress.h
--- v2.3.48/linux/include/asm-arm/arch-sa1100/uncompress.h	Fri Jan 21 18:19:17 2000
+++ linux/include/asm-arm/arch-sa1100/uncompress.h	Mon Feb 28 14:16:37 2000
@@ -6,14 +6,21 @@
 
 #include <linux/config.h>
 
-#if defined(CONFIG_SA1100_EMPEG) || \
-    defined(CONFIG_SA1100_VICTOR) || \
-    defined(CONFIG_SA1100_LART)
+#if	defined(CONFIG_SA1100_EMPEG) || \
+	defined(CONFIG_SA1100_VICTOR) || \
+	defined(CONFIG_SA1100_LART)
+#define SERBASE _Ser3UTCR0;
+#elif	defined(CONFIG_SA1100_BRUTUS)
+#define SERBASE _Ser1UTCR0;
+#endif
+
+
+#ifdef SERBASE
 
 #include "hardware.h"
 #include "serial_reg.h"
 
-static volatile unsigned long* serial_port = (unsigned long*)_Ser3UTCR0;
+static volatile unsigned long* serial_port = (unsigned long*)SERBASE;
 
 /*
  * The following code assumes the serial port has already been
@@ -41,7 +48,7 @@
 
 #else
 
-#define puts( x )
+static inline void puts( const char *s ) {}
 
 #endif
 
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/parport.h linux/include/asm-arm/parport.h
--- v2.3.48/linux/include/asm-arm/parport.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-arm/parport.h	Mon Feb 28 14:16:37 2000
@@ -6,8 +6,8 @@
  * This file should only be included by drivers/parport/parport_pc.c.
  */
 
-#ifndef __ASM_ARM_PARPORT_H
-#define __ASM_ARM_PARPORT_H
+#ifndef __ASMARM_PARPORT_H
+#define __ASMARM_PARPORT_H
 
 #include <linux/config.h>
 
@@ -26,8 +26,11 @@
 #endif
 
 static int __maybe_init parport_pc_init_pci(int irq, int dma);
+static int __devinit parport_pc_init_superio(void);
 
 static int user_specified __maybe_initdata = 0;
+
+
 int __init
 parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
 {
@@ -43,7 +46,9 @@
 				count++;
 		} while (*io && (++i < PARPORT_PC_MAX_PORTS));
 	} else {
+#ifdef CONFIG_PCI
 		count += parport_pc_init_superio ();
+#endif
 
 		/* Probe all the likely ports. */
 		if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0], NULL))
@@ -52,10 +57,12 @@
 			count++;
 		if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0], NULL))
 			count++;
+#ifdef CONFIG_PCI
 		count += parport_pc_init_pci (irq[0], dma[0]);
+#endif
 	}
 
         return count;
 }
 
-#endif /* !(_ASM_I386_PARPORT_H) */
+#endif /* !(_ASMARM_PARPORT_H) */
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/pci.h linux/include/asm-arm/pci.h
--- v2.3.48/linux/include/asm-arm/pci.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-arm/pci.h	Mon Feb 28 14:16:37 2000
@@ -20,19 +20,7 @@
  * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
  * is undefined.
  */
-#define pci_alloc_consistent(hwdev,size,handle)		\
-	({						\
-		void *__ret;				\
-		int __gfp = GFP_KERNEL;			\
-							\
-		if ((hwdev) == NULL ||			\
-		    (hwdev)->dma_mask != 0xffffffff)	\
-			__gfp |= GFP_DMA;		\
-							\
-		__ret = consistent_alloc(__gfp, (size),	\
-					 (handle));	\
-		__ret;					\
-	})
+extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *handle);
 
 /* Free and unmap a consistent DMA buffer.
  * cpu_addr is what was returned from pci_alloc_consistent,
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/pgtable.h linux/include/asm-arm/pgtable.h
--- v2.3.48/linux/include/asm-arm/pgtable.h	Sun Feb 13 19:29:04 2000
+++ linux/include/asm-arm/pgtable.h	Thu Mar  2 10:18:49 2000
@@ -32,7 +32,8 @@
 #define PGDIR_SIZE		(1UL << PGDIR_SHIFT)
 #define PGDIR_MASK		(~(PGDIR_SIZE-1))
 
-#define USER_PTRS_PER_PGD	(TASK_SIZE/PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	1
+#define USER_PTRS_PER_PGD	((TASK_SIZE/PGDIR_SIZE) - FIRST_USER_PGD_NR)
 
 /*
  * The table below defines the page protection levels that we insert into our
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/socket.h linux/include/asm-arm/socket.h
--- v2.3.48/linux/include/asm-arm/socket.h	Thu Dec 17 09:05:43 1998
+++ linux/include/asm-arm/socket.h	Sun Feb 27 18:45:10 2000
@@ -39,4 +39,6 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME             28
+
 #endif /* _ASM_SOCKET_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/system.h linux/include/asm-arm/system.h
--- v2.3.48/linux/include/asm-arm/system.h	Fri Jan 21 18:19:17 2000
+++ linux/include/asm-arm/system.h	Sun Feb 27 08:51:11 2000
@@ -7,17 +7,6 @@
 
 #include <linux/config.h>
 
-#define __ebsa285_data		__attribute__((__section__(".data.ebsa285")))
-#define __netwinder_data	__attribute__((__section__(".data.netwinder")))
-
-#ifdef CONFIG_TEXT_SECTIONS
-#define __ebsa285_text		__attribute__((__section__(".text.ebsa285")))
-#define __netwinder_text	__attribute__((__section__(".text.netwinder")))
-#else
-#define __ebsa285_text
-#define __netwinder_text
-#endif
-
 /* information about the system we're running on */
 extern unsigned int system_rev;
 extern unsigned int system_serial_low;
diff -u --recursive --new-file v2.3.48/linux/include/asm-i386/hardirq.h linux/include/asm-i386/hardirq.h
--- v2.3.48/linux/include/asm-i386/hardirq.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-i386/hardirq.h	Thu Mar  2 14:01:21 2000
@@ -4,6 +4,22 @@
 #include <linux/threads.h>
 #include <linux/irq.h>
 
+typedef struct {
+	unsigned int __local_irq_count;
+	unsigned int __local_bh_count;
+	atomic_t __nmi_counter;
+	unsigned int __pad[5];
+} ____cacheline_aligned irq_cpustat_t;
+
+extern irq_cpustat_t irq_stat [NR_CPUS];
+
+/*
+ * Simple wrappers reducing source bloat
+ */
+#define local_irq_count(cpu) (irq_stat[(cpu)].__local_irq_count)
+#define local_bh_count(cpu) (irq_stat[(cpu)].__local_bh_count)
+#define nmi_counter(cpu) (irq_stat[(cpu)].__nmi_counter)
+
 /*
  * Are we in an interrupt context? Either doing bottom half
  * or hardware interrupt processing?
diff -u --recursive --new-file v2.3.48/linux/include/asm-i386/hw_irq.h linux/include/asm-i386/hw_irq.h
--- v2.3.48/linux/include/asm-i386/hw_irq.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-i386/hw_irq.h	Thu Mar  2 14:01:19 2000
@@ -68,7 +68,6 @@
  * Interrupt entry/exit code at both C and assembly level
  */
 
-extern void no_action(int cpl, void *dev_id, struct pt_regs *regs);
 extern void mask_irq(unsigned int irq);
 extern void unmask_irq(unsigned int irq);
 extern void disable_8259A_irq(unsigned int irq);
diff -u --recursive --new-file v2.3.48/linux/include/asm-i386/parport.h linux/include/asm-i386/parport.h
--- v2.3.48/linux/include/asm-i386/parport.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-i386/parport.h	Mon Feb 28 07:18:20 2000
@@ -9,8 +9,6 @@
 #ifndef _ASM_I386_PARPORT_H
 #define _ASM_I386_PARPORT_H 1
 
-#include <linux/config.h>
-
 /* Maximum number of ports to support.  It is useless to set this greater
    than PARPORT_MAX (in <linux/parport.h>).  */
 #define PARPORT_PC_MAX_PORTS  8
diff -u --recursive --new-file v2.3.48/linux/include/asm-i386/pgtable.h linux/include/asm-i386/pgtable.h
--- v2.3.48/linux/include/asm-i386/pgtable.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-i386/pgtable.h	Thu Mar  2 14:01:21 2000
@@ -113,6 +113,7 @@
 #define PGDIR_MASK	(~(PGDIR_SIZE-1))
 
 #define USER_PTRS_PER_PGD	(TASK_SIZE/PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	0
 
 #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
 #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
diff -u --recursive --new-file v2.3.48/linux/include/asm-i386/socket.h linux/include/asm-i386/socket.h
--- v2.3.48/linux/include/asm-i386/socket.h	Sun Dec 21 17:41:24 1997
+++ linux/include/asm-i386/socket.h	Sun Feb 27 18:45:10 2000
@@ -39,4 +39,6 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME		28
+
 #endif /* _ASM_SOCKET_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-i386/spinlock.h linux/include/asm-i386/spinlock.h
--- v2.3.48/linux/include/asm-i386/spinlock.h	Thu Feb 10 17:11:20 2000
+++ linux/include/asm-i386/spinlock.h	Thu Mar  2 14:01:17 2000
@@ -53,6 +53,7 @@
 	".section .text.lock,\"ax\"\n" \
 	"2:\t" \
 	"testb $1,%0\n\t" \
+	"rep;nop\n\t" \
 	"jne 2b\n\t" \
 	"jmp 1b\n" \
 	".previous"
diff -u --recursive --new-file v2.3.48/linux/include/asm-ia64/pgtable.h linux/include/asm-ia64/pgtable.h
--- v2.3.48/linux/include/asm-ia64/pgtable.h	Sat Feb 26 22:31:55 2000
+++ linux/include/asm-ia64/pgtable.h	Thu Mar  2 10:18:49 2000
@@ -87,6 +87,7 @@
 #define PGDIR_MASK		(~(PGDIR_SIZE-1))
 #define PTRS_PER_PGD		(__IA64_UL(1) << (PAGE_SHIFT-3))
 #define USER_PTRS_PER_PGD	PTRS_PER_PGD
+#define FIRST_USER_PGD_NR	0
 
 /*
  * Definitions for second level:
diff -u --recursive --new-file v2.3.48/linux/include/asm-ia64/socket.h linux/include/asm-ia64/socket.h
--- v2.3.48/linux/include/asm-ia64/socket.h	Thu Feb 10 17:11:20 2000
+++ linux/include/asm-ia64/socket.h	Sun Feb 27 18:45:10 2000
@@ -46,4 +46,6 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME             28
+
 #endif /* _ASM_IA64_SOCKET_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-m68k/pgtable.h linux/include/asm-m68k/pgtable.h
--- v2.3.48/linux/include/asm-m68k/pgtable.h	Sun Feb 13 19:29:04 2000
+++ linux/include/asm-m68k/pgtable.h	Thu Mar  2 10:18:50 2000
@@ -43,6 +43,7 @@
 #define PTRS_PER_PMD	8
 #define PTRS_PER_PGD	128
 #define USER_PTRS_PER_PGD	(TASK_SIZE/PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	0
 
 /* Virtual address region for use by kernel_map() */
 #define	KMAP_START	0xd0000000
diff -u --recursive --new-file v2.3.48/linux/include/asm-m68k/socket.h linux/include/asm-m68k/socket.h
--- v2.3.48/linux/include/asm-m68k/socket.h	Thu Feb 12 16:30:13 1998
+++ linux/include/asm-m68k/socket.h	Sun Feb 27 18:45:10 2000
@@ -39,4 +39,6 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME             28
+
 #endif /* _ASM_SOCKET_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips/bitops.h linux/include/asm-mips/bitops.h
--- v2.3.48/linux/include/asm-mips/bitops.h	Sat Feb 26 22:31:56 2000
+++ linux/include/asm-mips/bitops.h	Mon Feb 28 07:18:20 2000
@@ -54,13 +54,14 @@
 extern __inline__ int find_next_zero_bit (void * addr, int size, int offset);
 extern __inline__ unsigned long ffz(unsigned long word);
 
+#include <asm/mipsregs.h>
+
 #if defined(CONFIG_CPU_HAS_LLSC)
 
 /*
  * These functions for MIPS ISA > 1 are interrupt and SMP proof and
  * interrupt friendly
  */
-#include <asm/mipsregs.h>
 
 /*
  * The following functions will only work for the R4000!
@@ -144,8 +145,6 @@
 }
 
 #else /* MIPS I */
-
-#include <asm/mipsregs.h>
 
 extern __inline__ void set_bit(int nr, void * addr)
 {
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips/bootinfo.h linux/include/asm-mips/bootinfo.h
--- v2.3.48/linux/include/asm-mips/bootinfo.h	Sat Feb 26 22:31:56 2000
+++ linux/include/asm-mips/bootinfo.h	Mon Feb 28 07:18:20 2000
@@ -12,9 +12,6 @@
 #ifndef __ASM_MIPS_BOOTINFO_H
 #define __ASM_MIPS_BOOTINFO_H
 
-/* XXX */
-#include <linux/config.h>
-
 /*
  * Values for machgroup
  */
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips/io.h linux/include/asm-mips/io.h
--- v2.3.48/linux/include/asm-mips/io.h	Sat Feb 26 22:31:56 2000
+++ linux/include/asm-mips/io.h	Mon Feb 28 07:18:20 2000
@@ -16,8 +16,6 @@
  */
 #undef CONF_SLOWDOWN_IO
 
-#include <linux/config.h>
-
 #include <asm/addrspace.h>
 
 /*
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips/keyboard.h linux/include/asm-mips/keyboard.h
--- v2.3.48/linux/include/asm-mips/keyboard.h	Sat Feb 26 22:31:56 2000
+++ linux/include/asm-mips/keyboard.h	Mon Feb 28 07:18:20 2000
@@ -11,7 +11,6 @@
 
 #ifdef __KERNEL__
 
-#include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <asm/bootinfo.h>
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips/pgtable.h linux/include/asm-mips/pgtable.h
--- v2.3.48/linux/include/asm-mips/pgtable.h	Sat Feb 26 22:31:56 2000
+++ linux/include/asm-mips/pgtable.h	Thu Mar  2 10:18:50 2000
@@ -79,6 +79,7 @@
 #define PTRS_PER_PMD	1
 #define PTRS_PER_PGD	1024
 #define USER_PTRS_PER_PGD	(TASK_SIZE/PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	0
 
 #define VMALLOC_START     KSEG2
 #define VMALLOC_VMADDR(x) ((unsigned long)(x))
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips/socket.h linux/include/asm-mips/socket.h
--- v2.3.48/linux/include/asm-mips/socket.h	Sat Feb 26 22:31:56 2000
+++ linux/include/asm-mips/socket.h	Sun Feb 27 18:45:10 2000
@@ -56,6 +56,8 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME             28
+
 /* Types of sockets.  */
 #define SOCK_DGRAM 1		/* Connectionless, unreliable datagrams
 				   of fixed maximum length.  */
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips64/dma.h linux/include/asm-mips64/dma.h
--- v2.3.48/linux/include/asm-mips64/dma.h	Sat Feb 26 22:31:57 2000
+++ linux/include/asm-mips64/dma.h	Mon Feb 28 07:18:20 2000
@@ -13,7 +13,6 @@
 #ifndef _ASM_DMA_H
 #define _ASM_DMA_H
 
-#include <linux/config.h>
 #include <asm/io.h>			/* need byte IO */
 #include <linux/spinlock.h>		/* And spinlocks */
 #include <linux/delay.h>
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips64/keyboard.h linux/include/asm-mips64/keyboard.h
--- v2.3.48/linux/include/asm-mips64/keyboard.h	Sat Feb 26 22:31:57 2000
+++ linux/include/asm-mips64/keyboard.h	Mon Feb 28 07:18:20 2000
@@ -11,7 +11,6 @@
 
 #ifdef __KERNEL__
 
-#include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <asm/bootinfo.h>
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips64/mmu_context.h linux/include/asm-mips64/mmu_context.h
--- v2.3.48/linux/include/asm-mips64/mmu_context.h	Sat Feb 26 22:31:57 2000
+++ linux/include/asm-mips64/mmu_context.h	Mon Feb 28 07:18:20 2000
@@ -12,7 +12,6 @@
 #ifndef _ASM_MMU_CONTEXT_H
 #define _ASM_MMU_CONTEXT_H
 
-#include <linux/config.h>
 #include <asm/pgalloc.h>
 
 /* Fuck.  The f-word is here so you can grep for it :-)  */
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips64/mmzone.h linux/include/asm-mips64/mmzone.h
--- v2.3.48/linux/include/asm-mips64/mmzone.h	Sat Feb 26 22:31:57 2000
+++ linux/include/asm-mips64/mmzone.h	Mon Feb 28 07:18:20 2000
@@ -4,6 +4,7 @@
 #ifndef _ASM_MMZONE_H_
 #define _ASM_MMZONE_H_
 
+#include <linux/config.h>
 #include <asm/sn/types.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/arch.h>
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips64/sn/sn0/hubmd.h linux/include/asm-mips64/sn/sn0/hubmd.h
--- v2.3.48/linux/include/asm-mips64/sn/sn0/hubmd.h	Sat Feb 26 22:31:57 2000
+++ linux/include/asm-mips64/sn/sn0/hubmd.h	Mon Feb 28 07:18:20 2000
@@ -12,6 +12,8 @@
 #ifndef	_ASM_SN_SN0_HUBMD_H
 #define	_ASM_SN_SN0_HUBMD_H
 
+#include <linux/config.h>
+
 /*
  * Hub Memory/Directory interface registers
  */
diff -u --recursive --new-file v2.3.48/linux/include/asm-mips64/socket.h linux/include/asm-mips64/socket.h
--- v2.3.48/linux/include/asm-mips64/socket.h	Sat Feb 26 22:31:57 2000
+++ linux/include/asm-mips64/socket.h	Sun Feb 27 18:45:10 2000
@@ -61,6 +61,8 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME             28
+
 /* Types of sockets.  */
 #define SOCK_DGRAM 1		/* Connectionless, unreliable datagrams
 				   of fixed maximum length.  */
diff -u --recursive --new-file v2.3.48/linux/include/asm-ppc/pgtable.h linux/include/asm-ppc/pgtable.h
--- v2.3.48/linux/include/asm-ppc/pgtable.h	Wed Feb 16 17:03:52 2000
+++ linux/include/asm-ppc/pgtable.h	Thu Mar  2 10:18:50 2000
@@ -138,6 +138,7 @@
 #define PTRS_PER_PMD	1
 #define PTRS_PER_PGD	1024
 #define USER_PTRS_PER_PGD	(TASK_SIZE / PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	0
 
 #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
 #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
diff -u --recursive --new-file v2.3.48/linux/include/asm-ppc/socket.h linux/include/asm-ppc/socket.h
--- v2.3.48/linux/include/asm-ppc/socket.h	Tue Apr 14 17:34:00 1998
+++ linux/include/asm-ppc/socket.h	Sun Feb 27 18:45:10 2000
@@ -45,4 +45,6 @@
 #define SO_ATTACH_FILTER	26
 #define SO_DETACH_FILTER	27
 
+#define SO_PEERNAME		28
+
 #endif /* _ASM_SOCKET_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-sh/pgtable.h linux/include/asm-sh/pgtable.h
--- v2.3.48/linux/include/asm-sh/pgtable.h	Sun Feb 13 19:29:04 2000
+++ linux/include/asm-sh/pgtable.h	Thu Mar  2 10:18:50 2000
@@ -91,6 +91,7 @@
 #define PGDIR_MASK	(~(PGDIR_SIZE-1))
 
 #define USER_PTRS_PER_PGD	(TASK_SIZE/PGDIR_SIZE)
+#define FIRST_USER_PGD_NR	0
 
 #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
 #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
diff -u --recursive --new-file v2.3.48/linux/include/asm-sh/socket.h linux/include/asm-sh/socket.h
--- v2.3.48/linux/include/asm-sh/socket.h	Fri Oct 22 13:21:54 1999
+++ linux/include/asm-sh/socket.h	Sun Feb 27 18:45:10 2000
@@ -39,4 +39,6 @@
 #define SO_ATTACH_FILTER        26
 #define SO_DETACH_FILTER        27
 
+#define SO_PEERNAME             28
+
 #endif /* __ASM_SH_SOCKET_H */
diff -u --recursive --new-file v2.3.48/linux/include/asm-sparc/pgtable.h linux/include/asm-sparc/pgtable.h
--- v2.3.48/linux/include/asm-sparc/pgtable.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-sparc/pgtable.h	Thu Mar  2 10:18:50 2000
@@ -118,6 +118,7 @@
 #define PTRS_PER_PMD    	BTFIXUP_SIMM13(ptrs_per_pmd)
 #define PTRS_PER_PGD    	BTFIXUP_SIMM13(ptrs_per_pgd)
 #define USER_PTRS_PER_PGD	BTFIXUP_SIMM13(user_ptrs_per_pgd)
+#define FIRST_USER_PGD_NR	0
 
 #define PAGE_NONE      __pgprot(BTFIXUP_INT(page_none))
 #define PAGE_SHARED    __pgprot(BTFIXUP_INT(page_shared))
diff -u --recursive --new-file v2.3.48/linux/include/asm-sparc/socket.h linux/include/asm-sparc/socket.h
--- v2.3.48/linux/include/asm-sparc/socket.h	Tue Aug  4 16:03:35 1998
+++ linux/include/asm-sparc/socket.h	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-/* $Id: socket.h,v 1.12 1998/07/22 22:06:48 davem Exp $ */
+/* $Id: socket.h,v 1.13 2000/02/27 19:47:43 davem Exp $ */
 #ifndef _ASM_SOCKET_H
 #define _ASM_SOCKET_H
 
@@ -39,6 +39,8 @@
 
 #define SO_ATTACH_FILTER	0x001a
 #define SO_DETACH_FILTER        0x001b
+
+#define SO_PEERNAME		0x001c
 
 /* Security levels - as per NRL IPv6 - don't actually do anything */
 #define SO_SECURITY_AUTHENTICATION		0x5001
diff -u --recursive --new-file v2.3.48/linux/include/asm-sparc/spinlock.h linux/include/asm-sparc/spinlock.h
--- v2.3.48/linux/include/asm-sparc/spinlock.h	Wed Dec 29 13:13:21 1999
+++ linux/include/asm-sparc/spinlock.h	Sun Feb 27 18:45:10 2000
@@ -12,7 +12,12 @@
 
 #include <asm/psr.h>
 
-/* Define this to use the verbose/debugging versions in arch/sparc/lib/debuglocks.c */
+/*
+ * Define this to use the verbose/debugging versions in
+ * arch/sparc/lib/debuglocks.c
+ *
+ * Be sure to make check_asm whenever changing this option.
+ */
 #define SPIN_LOCK_DEBUG
 
 #ifdef SPIN_LOCK_DEBUG
@@ -82,9 +87,13 @@
 typedef unsigned char spinlock_t;
 #define SPIN_LOCK_UNLOCKED	0
 
-#define spin_lock_init(lock)	(*(lock) = 0)
+#define spin_lock_init(lock)   (*((unsigned char *)(lock)) = 0)
 #define spin_is_locked(lock)    (*((volatile unsigned char *)(lock)) != 0)
-#define spin_unlock_wait(lock)	do { barrier(); } while(*(volatile unsigned char *)lock)
+
+#define spin_unlock_wait(lock) \
+do { \
+	barrier(); \
+} while(*((volatile unsigned char *)lock))
 
 extern __inline__ void spin_lock(spinlock_t *lock)
 {
@@ -93,7 +102,7 @@
 	orcc	%%g2, 0x0, %%g0
 	bne,a	2f
 	 ldub	[%0], %%g2
-	.text	2
+	.subsection	2
 2:	orcc	%%g2, 0x0, %%g0
 	bne,a	2b
 	 ldub	[%0], %%g2
@@ -159,7 +168,7 @@
 	 ldstub	[%%g1 + 3], %%g2
 "	: /* no outputs */
 	: "r" (lp)
-	: "g2", "g4", "g7", "memory", "cc");
+	: "g2", "g4", "memory", "cc");
 }
 
 #define read_lock(lock) \
@@ -179,7 +188,7 @@
 	 ldstub	[%%g1 + 3], %%g2
 "	: /* no outputs */
 	: "r" (lp)
-	: "g2", "g4", "g7", "memory", "cc");
+	: "g2", "g4", "memory", "cc");
 }
 
 #define read_unlock(lock) \
@@ -199,7 +208,7 @@
 	 ldstub	[%%g1 + 3], %%g2
 "	: /* no outputs */
 	: "r" (lp)
-	: "g2", "g4", "g7", "memory", "cc");
+	: "g2", "g4", "memory", "cc");
 }
 
 #define write_unlock(rw)	do { (rw)->lock = 0; } while(0)
diff -u --recursive --new-file v2.3.48/linux/include/asm-sparc64/pgtable.h linux/include/asm-sparc64/pgtable.h
--- v2.3.48/linux/include/asm-sparc64/pgtable.h	Sun Feb 20 21:12:39 2000
+++ linux/include/asm-sparc64/pgtable.h	Thu Mar  2 10:18:50 2000
@@ -51,6 +51,7 @@
 /* Kernel has a separate 44bit address space. */
 #define USER_PTRS_PER_PGD	((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
 				 (1) : (PTRS_PER_PGD)))
+#define FIRST_USER_PGD_NR	0
 
 #define PTE_TABLE_SIZE	0x2000	/* 1024 entries 8 bytes each */
 #define PMD_TABLE_SIZE	0x2000	/* 2048 entries 4 bytes each */
diff -u --recursive --new-file v2.3.48/linux/include/asm-sparc64/socket.h linux/include/asm-sparc64/socket.h
--- v2.3.48/linux/include/asm-sparc64/socket.h	Tue Aug  4 16:03:35 1998
+++ linux/include/asm-sparc64/socket.h	Sun Feb 27 18:45:10 2000
@@ -1,4 +1,4 @@
-/* $Id: socket.h,v 1.5 1998/07/22 22:06:49 davem Exp $ */
+/* $Id: socket.h,v 1.6 2000/02/27 19:47:58 davem Exp $ */
 #ifndef _ASM_SOCKET_H
 #define _ASM_SOCKET_H
 
@@ -39,6 +39,8 @@
 
 #define SO_ATTACH_FILTER	0x001a
 #define SO_DETACH_FILTER        0x001b
+
+#define SO_PEERNAME		0x001c
 
 /* Security levels - as per NRL IPv6 - don't actually do anything */
 #define SO_SECURITY_AUTHENTICATION		0x5001
diff -u --recursive --new-file v2.3.48/linux/include/linux/ac97_codec.h linux/include/linux/ac97_codec.h
--- v2.3.48/linux/include/linux/ac97_codec.h	Sat Feb 26 22:32:01 2000
+++ linux/include/linux/ac97_codec.h	Mon Feb 28 07:16:55 2000
@@ -1,6 +1,8 @@
 #ifndef _AC97_CODEC_H_
 #define _AC97_CODEC_H_
 
+#include <linux/types.h>
+#include <linux/soundcard.h>
 
 /* AC97 1.0 */
 #define  AC97_RESET               0x0000      //
diff -u --recursive --new-file v2.3.48/linux/include/linux/affs_fs.h linux/include/linux/affs_fs.h
--- v2.3.48/linux/include/linux/affs_fs.h	Sat Feb 26 22:32:02 2000
+++ linux/include/linux/affs_fs.h	Thu Mar  2 14:03:41 2000
@@ -104,6 +104,7 @@
 
 extern struct inode_operations	 affs_file_inode_operations;
 extern struct inode_operations	 affs_dir_inode_operations;
+extern struct inode_operations   affs_symlink_inode_operations;
 extern struct file_operations	 affs_file_operations;
 extern struct file_operations	 affs_file_operations_ofs;
 extern struct file_operations	 affs_dir_operations;
diff -u --recursive --new-file v2.3.48/linux/include/linux/brlock.h linux/include/linux/brlock.h
--- v2.3.48/linux/include/linux/brlock.h	Wed Dec 31 16:00:00 1969
+++ linux/include/linux/brlock.h	Thu Mar  2 14:01:19 2000
@@ -0,0 +1,207 @@
+#ifndef __LINUX_BRLOCK_H
+#define __LINUX_BRLOCK_H
+
+/*
+ * 'Big Reader' read-write spinlocks.
+ *
+ * super-fast read/write locks, with write-side penalty. The point
+ * is to have a per-CPU read/write lock. Readers lock their CPU-local
+ * readlock, writers must lock all locks to get write access. These
+ * CPU-read-write locks are semantically identical to normal rwlocks.
+ * Memory usage is higher as well. (NR_CPUS*L1_CACHE_BYTES bytes)
+ *
+ * The most important feature is that these spinlocks do not cause
+ * cacheline ping-pong in the 'most readonly data' case.
+ *
+ * Copyright 2000, Ingo Molnar <mingo@redhat.com>
+ *
+ * Registry idea and naming [ crutial! :-) ] by:
+ *
+ *                 David S. Miller <davem@redhat.com>
+ *
+ * David has an implementation that doesnt use atomic operations in
+ * the read branch via memory ordering tricks - i guess we need to
+ * split this up into a per-arch thing? The atomicity issue is a
+ * secondary item in profiles, at least on x86 platforms.
+ *
+ * The atomic op version overhead is indeed a big deal on
+ * load-locked/store-conditional cpus (ALPHA/MIPS/PPC) and
+ * compare-and-swap cpus (Sparc64).  So we control which
+ * implementation to use with a __BRLOCK_USE_ATOMICS define. -DaveM
+ */
+
+/* Register bigreader lock indices here. */
+enum brlock_indices {
+	BR_GLOBALIRQ_LOCK,
+	BR_NETPROTO_LOCK,
+
+	__BR_END
+};
+
+#include <linux/config.h>
+
+#ifdef CONFIG_SMP
+
+#include <linux/cache.h>
+#include <linux/spinlock.h>
+
+#if defined(__i386__)
+#define __BRLOCK_USE_ATOMICS
+#else
+#undef __BRLOCK_USE_ATOMICS
+#endif
+
+#ifdef __BRLOCK_USE_ATOMICS
+typedef rwlock_t	brlock_read_lock_t;
+#else
+typedef unsigned int	brlock_read_lock_t;
+#endif
+
+/*
+ * align last allocated index to the next cacheline:
+ */
+#define __BR_IDX_MAX \
+	(((sizeof(brlock_read_lock_t)*__BR_END + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1)) / sizeof(brlock_read_lock_t))
+
+extern brlock_read_lock_t __brlock_array[NR_CPUS][__BR_IDX_MAX];
+
+#ifndef __BRLOCK_USE_ATOMICS
+struct br_wrlock {
+	spinlock_t lock;
+} __attribute__ ((__aligned__(SMP_CACHE_BYTES)));
+
+extern struct br_wrlock __br_write_locks[__BR_IDX_MAX];
+#endif
+
+extern void __br_lock_usage_bug (void);
+
+#ifdef __BRLOCK_USE_ATOMICS
+
+extern inline void br_read_lock (enum brlock_indices idx)
+{
+	/*
+	 * This causes a link-time bug message if an
+	 * invalid index is used:
+	 */
+	if (idx >= __BR_END)
+		__br_lock_usage_bug();
+
+	read_lock(&__brlock_array[smp_processor_id()][idx]);
+}
+
+extern inline void br_read_unlock (enum brlock_indices idx)
+{
+	if (idx >= __BR_END)
+		__br_lock_usage_bug();
+
+	read_unlock(&__brlock_array[smp_processor_id()][idx]);
+}
+
+#else /* ! __BRLOCK_USE_ATOMICS */
+extern inline void br_read_lock (enum brlock_indices idx)
+{
+	unsigned int *ctr;
+	spinlock_t *lock;
+
+	/*
+	 * This causes a link-time bug message if an
+	 * invalid index is used:
+	 */
+	if (idx >= __BR_END)
+		__br_lock_usage_bug();
+
+	ctr = &__brlock_array[smp_processor_id()][idx];
+	lock = &__br_write_locks[idx].lock;
+again:
+	(*ctr)++;
+	rmb();
+	if (spin_is_locked(lock)) {
+		(*ctr)--;
+		rmb();
+		while (spin_is_locked(lock))
+			barrier();
+		goto again;
+	}
+}
+
+extern inline void br_read_unlock (enum brlock_indices idx)
+{
+	unsigned int *ctr;
+
+	if (idx >= __BR_END)
+		__br_lock_usage_bug();
+
+	ctr = &__brlock_array[smp_processor_id()][idx];
+
+	wmb();
+	(*ctr)--;
+}
+#endif /* __BRLOCK_USE_ATOMICS */
+
+/* write path not inlined - it's rare and larger */
+
+extern void FASTCALL(__br_write_lock (enum brlock_indices idx));
+extern void FASTCALL(__br_write_unlock (enum brlock_indices idx));
+
+extern inline void br_write_lock (enum brlock_indices idx)
+{
+	if (idx >= __BR_END)
+		__br_lock_usage_bug();
+	__br_write_lock(idx);
+}
+
+extern inline void br_write_unlock (enum brlock_indices idx)
+{
+	if (idx >= __BR_END)
+		__br_lock_usage_bug();
+	__br_write_unlock(idx);
+}
+
+#else
+# define br_read_lock(idx)	((void)(idx))
+# define br_read_unlock(idx)	((void)(idx))
+# define br_write_lock(idx)	((void)(idx))
+# define br_write_unlock(idx)	((void)(idx))
+#endif
+
+/*
+ * Now enumerate all of the possible sw/hw IRQ protected
+ * versions of the interfaces.
+ */
+#define br_read_lock_irqsave(idx, flags) \
+	do { local_irq_save(flags); br_read_lock(idx); } while (0)
+
+#define br_read_lock_irq(idx) \
+	do { local_irq_disable(); br_read_lock(idx); } while (0)
+
+#define br_read_lock_bh(idx) \
+	do { local_bh_disable(); br_read_lock(idx); } while (0)
+
+#define br_write_lock_irqsave(idx, flags) \
+	do { local_irq_save(flags); br_write_lock(idx); } while (0)
+
+#define br_write_lock_irq(idx) \
+	do { local_irq_disable(); br_write_lock(idx); } while (0)
+
+#define br_write_lock_bh(idx) \
+	do { local_bh_disable(); br_write_lock(idx); } while (0)
+
+#define br_read_unlock_irqrestore(idx, flags) \
+	do { br_read_unlock(irx); local_irq_restore(flags); } while (0)
+
+#define br_read_unlock_irq(idx) \
+	do { br_read_unlock(idx); local_irq_enable(); } while (0)
+
+#define br_read_unlock_bh(idx) \
+	do { br_read_unlock(idx); local_bh_enable(); } while (0)
+
+#define br_write_unlock_irqrestore(idx, flags) \
+	do { br_write_unlock(irx); local_irq_restore(flags); } while (0)
+
+#define br_write_unlock_irq(idx) \
+	do { br_write_unlock(idx); local_irq_enable(); } while (0)
+
+#define br_write_unlock_bh(idx) \
+	do { br_write_unlock(idx); local_bh_enable(); } while (0)
+
+#endif /* __LINUX_BRLOCK_H */
diff -u --recursive --new-file v2.3.48/linux/include/linux/digi1.h linux/include/linux/digi1.h
--- v2.3.48/linux/include/linux/digi1.h	Tue May 13 22:41:18 1997
+++ linux/include/linux/digi1.h	Wed Dec 31 16:00:00 1969
@@ -1,100 +0,0 @@
-/*          Definitions for DigiBoard ditty(1) command.                 */
-
-#if !defined(TIOCMODG)
-#define	TIOCMODG	('d'<<8) | 250		/* get modem ctrl state	*/
-#define	TIOCMODS	('d'<<8) | 251		/* set modem ctrl state	*/
-#endif
-
-#if !defined(TIOCMSET)
-#define	TIOCMSET	('d'<<8) | 252		/* set modem ctrl state	*/
-#define	TIOCMGET	('d'<<8) | 253		/* set modem ctrl state	*/
-#endif
-
-#if !defined(TIOCMBIC)
-#define	TIOCMBIC	('d'<<8) | 254		/* set modem ctrl state */
-#define	TIOCMBIS	('d'<<8) | 255		/* set modem ctrl state */
-#endif
-
-#if !defined(TIOCSDTR)
-#define	TIOCSDTR	('e'<<8) | 0		/* set DTR		*/
-#define	TIOCCDTR	('e'<<8) | 1		/* clear DTR		*/
-#endif
-
-/************************************************************************
- * Ioctl command arguments for DIGI parameters.
- ************************************************************************/
-#define DIGI_GETA	('e'<<8) | 94		/* Read params		*/
-
-#define DIGI_SETA	('e'<<8) | 95		/* Set params		*/
-#define DIGI_SETAW	('e'<<8) | 96		/* Drain & set params	*/
-#define DIGI_SETAF	('e'<<8) | 97		/* Drain, flush & set params */
-
-#define	DIGI_GETFLOW	('e'<<8) | 99		/* Get startc/stopc flow */
-						/* control characters 	 */
-#define	DIGI_SETFLOW	('e'<<8) | 100		/* Set startc/stopc flow */
-						/* control characters	 */
-#define	DIGI_GETAFLOW	('e'<<8) | 101		/* Get Aux. startc/stopc */
-						/* flow control chars 	 */
-#define	DIGI_SETAFLOW	('e'<<8) | 102		/* Set Aux. startc/stopc */
-						/* flow control chars	 */
-
-#define	DIGI_GETINFO	('e'<<8) | 103		/* Fill in digi_info */
-#define	DIGI_POLLER	('e'<<8) | 104		/* Turn on/off poller */
-#define	DIGI_INIT	('e'<<8) | 105		/* Allow things to run. */
-
-struct	digiflow_struct 
-{
-	unsigned char	startc;				/* flow cntl start char	*/
-	unsigned char	stopc;				/* flow cntl stop char	*/
-};
-
-typedef struct digiflow_struct digiflow_t;
-
-
-/************************************************************************
- * Values for digi_flags 
- ************************************************************************/
-#define DIGI_IXON	0x0001		/* Handle IXON in the FEP	*/
-#define DIGI_FAST	0x0002		/* Fast baud rates		*/
-#define RTSPACE		0x0004		/* RTS input flow control	*/
-#define CTSPACE		0x0008		/* CTS output flow control	*/
-#define DSRPACE		0x0010		/* DSR output flow control	*/
-#define DCDPACE		0x0020		/* DCD output flow control	*/
-#define DTRPACE		0x0040		/* DTR input flow control	*/
-#define DIGI_FORCEDCD	0x0100		/* Force carrier		*/
-#define	DIGI_ALTPIN	0x0200		/* Alternate RJ-45 pin config	*/
-#define	DIGI_AIXON	0x0400		/* Aux flow control in fep	*/
-
-
-/************************************************************************
- * Values for digiDload
- ************************************************************************/
-#define NORMAL  0
-#define PCI_CTL 1
-
-#define SIZE8  0
-#define SIZE16 1
-#define SIZE32 2
-
-/************************************************************************
- * Structure used with ioctl commands for DIGI parameters.
- ************************************************************************/
-struct digi_struct 
-{
-	unsigned short	digi_flags;		/* Flags (see above)	*/
-};
-
-typedef struct digi_struct digi_t;
-
-struct digi_info 
-{
-	unsigned long board;        /* Which board is this ? */
-	unsigned char status;       /* Alive or dead */
-	unsigned char type;         /* see epca.h */
-	unsigned char subtype;      /* For future XEM, XR, etc ... */
-	unsigned short numports;    /* Number of ports configured */
-	unsigned char *port;        /* I/O Address */
-	unsigned char *membase;     /* DPR Address */
-	unsigned char *version;     /* For future ... */
-	unsigned short windowData;  /* For future ... */
-} ;
diff -u --recursive --new-file v2.3.48/linux/include/linux/digiFep1.h linux/include/linux/digiFep1.h
--- v2.3.48/linux/include/linux/digiFep1.h	Tue May 13 22:41:18 1997
+++ linux/include/linux/digiFep1.h	Wed Dec 31 16:00:00 1969
@@ -1,136 +0,0 @@
-
-#define CSTART       0x400L
-#define CMAX         0x800L
-#define ISTART       0x800L
-#define IMAX         0xC00L
-#define CIN          0xD10L
-#define GLOBAL       0xD10L
-#define EIN          0xD18L
-#define FEPSTAT      0xD20L
-#define CHANSTRUCT   0x1000L
-#define RXTXBUF      0x4000L
-
-
-struct global_data 
-{
-	volatile ushort cin;
-	volatile ushort cout;
-	volatile ushort cstart;
-	volatile ushort cmax;
-	volatile ushort ein;
-	volatile ushort eout;
-	volatile ushort istart;
-	volatile ushort imax;
-};
-
-
-struct board_chan 
-{
-	int filler1; 
-	int filler2;
-	volatile ushort tseg;
-	volatile ushort tin;
-	volatile ushort tout;
-	volatile ushort tmax;
-	
-	volatile ushort rseg;
-	volatile ushort rin;
-	volatile ushort rout;
-	volatile ushort rmax;
-	
-	volatile ushort tlow;
-	volatile ushort rlow;
-	volatile ushort rhigh;
-	volatile ushort incr;
-	
-	volatile ushort etime;
-	volatile ushort edelay;
-	volatile unchar *dev;
-	
-	volatile ushort iflag;
-	volatile ushort oflag;
-	volatile ushort cflag;
-	volatile ushort gmask;
-	
-	volatile ushort col;
-	volatile ushort delay;
-	volatile ushort imask;
-	volatile ushort tflush;
-
-	int filler3;
-	int filler4;
-	int filler5;
-	int filler6;
-	
-	volatile unchar num;
-	volatile unchar ract;
-	volatile unchar bstat;
-	volatile unchar tbusy;
-	volatile unchar iempty;
-	volatile unchar ilow;
-	volatile unchar idata;
-	volatile unchar eflag;
-	
-	volatile unchar tflag;
-	volatile unchar rflag;
-	volatile unchar xmask;
-	volatile unchar xval;
-	volatile unchar mstat;
-	volatile unchar mchange;
-	volatile unchar mint;
-	volatile unchar lstat;
-
-	volatile unchar mtran;
-	volatile unchar orun;
-	volatile unchar startca;
-	volatile unchar stopca;
-	volatile unchar startc;
-	volatile unchar stopc;
-	volatile unchar vnext;
-	volatile unchar hflow;
-
-	volatile unchar fillc;
-	volatile unchar ochar;
-	volatile unchar omask;
-
-	unchar filler7;
-	unchar filler8[28];
-}; 
-
-
-#define SRXLWATER      0xE0
-#define SRXHWATER      0xE1
-#define STOUT          0xE2
-#define PAUSETX        0xE3
-#define RESUMETX       0xE4
-#define SAUXONOFFC     0xE6
-#define SENDBREAK      0xE8
-#define SETMODEM       0xE9
-#define SETIFLAGS      0xEA
-#define SONOFFC        0xEB
-#define STXLWATER      0xEC
-#define PAUSERX        0xEE
-#define RESUMERX       0xEF
-#define SETBUFFER      0xF2
-#define SETCOOKED      0xF3
-#define SETHFLOW       0xF4
-#define SETCTRLFLAGS   0xF5
-#define SETVNEXT       0xF6
-
-
-
-#define BREAK_IND        0x01
-#define LOWTX_IND        0x02
-#define EMPTYTX_IND      0x04
-#define DATA_IND         0x08
-#define MODEMCHG_IND     0x20
-
-#define FEP_HUPCL  0002000
-#if 0
-#define RTS   0x02
-#define CD    0x08
-#define DSR   0x10
-#define CTS   0x20
-#define RI    0x40
-#define DTR   0x80
-#endif
diff -u --recursive --new-file v2.3.48/linux/include/linux/digiPCI.h linux/include/linux/digiPCI.h
--- v2.3.48/linux/include/linux/digiPCI.h	Tue May 13 22:41:18 1997
+++ linux/include/linux/digiPCI.h	Wed Dec 31 16:00:00 1969
@@ -1,42 +0,0 @@
-/*************************************************************************
- * Defines and structure definitions for PCI BIOS Interface 
- *************************************************************************/
-#define	PCIMAX  32		/* maximum number of PCI boards */
-
-
-#define	PCI_VENDOR_DIGI		0x114F
-#define	PCI_DEVICE_EPC		0x0002
-#define	PCI_DEVICE_RIGHTSWITCH 0x0003  /* For testing */
-#define	PCI_DEVICE_XEM		0x0004
-#define	PCI_DEVICE_XR		0x0005
-#define	PCI_DEVICE_CX		0x0006
-#define	PCI_DEVICE_XRJ		0x0009   /* Jupiter boards with */
-#define	PCI_DEVICE_EPCJ		0x000a   /* PLX 9060 chip for PCI  */
-
-
-/*
- * On the PCI boards, there is no IO space allocated 
- * The I/O registers will be in the first 3 bytes of the   
- * upper 2MB of the 4MB memory space.  The board memory 
- * will be mapped into the low 2MB of the 4MB memory space 
- */
-
-/* Potential location of PCI Bios from E0000 to FFFFF*/
-#define PCI_BIOS_SIZE		0x00020000	
-
-/* Size of Memory and I/O for PCI (4MB) */
-#define PCI_RAM_SIZE		0x00400000	
-
-/* Size of Memory (2MB) */
-#define PCI_MEM_SIZE		0x00200000	
-
-/* Offset of I/0 in Memory (2MB) */
-#define PCI_IO_OFFSET 		0x00200000	
-
-#define MEMOUTB(basemem, pnum, setmemval)  *(caddr_t)((basemem) + ( PCI_IO_OFFSET | pnum << 4 | pnum )) = (setmemval)
-#define MEMINB(basemem, pnum)  *(caddr_t)((basemem) + (PCI_IO_OFFSET | pnum << 4 | pnum ))   /* for PCI I/O */
-
-
-
-
-
diff -u --recursive --new-file v2.3.48/linux/include/linux/epca.h linux/include/linux/epca.h
--- v2.3.48/linux/include/linux/epca.h	Wed May 12 13:27:37 1999
+++ linux/include/linux/epca.h	Wed Dec 31 16:00:00 1969
@@ -1,170 +0,0 @@
-#define XEMPORTS    0xC02
-#define XEPORTS     0xC22
-
-#define MAX_ALLOC   0x100
-
-#define MAXBOARDS   12
-#define FEPCODESEG  0x0200L
-#define FEPCODE     0x2000L
-#define BIOSCODE    0xf800L
-
-#define MISCGLOBAL  0x0C00L
-#define NPORT       0x0C22L
-#define MBOX        0x0C40L
-#define PORTBASE    0x0C90L
-
-/* Begin code defines used for epca_setup */
-
-#define INVALID_BOARD_TYPE   0x1
-#define INVALID_NUM_PORTS    0x2
-#define INVALID_MEM_BASE     0x4
-#define INVALID_PORT_BASE    0x8
-#define INVALID_BOARD_STATUS 0x10
-#define INVALID_ALTPIN       0x20
-
-/* End code defines used for epca_setup */
-
-
-#define FEPCLR      0x00
-#define FEPMEM      0x02
-#define FEPRST      0x04
-#define FEPINT      0x08
-#define	FEPMASK     0x0e
-#define	FEPWIN      0x80
-
-#define PCXE    0
-#define PCXEVE  1
-#define PCXEM   2   
-#define EISAXEM 3
-#define PC64XE  4
-#define PCXI    5
-#define PCIXEM  7
-#define PCICX   8
-#define PCIXR   9
-#define PCIXRJ  10
-#define EPCA_NUM_TYPES 6
-
-
-static char *board_desc[] = 
-{
-	"PC/Xe",
-	"PC/Xeve",
-	"PC/Xem",
-	"EISA/Xem",
-	"PC/64Xe",
-	"PC/Xi",
-	"unknown",
-	"PCI/Xem",
-	"PCI/CX",
-	"PCI/Xr",
-	"PCI/Xrj",
-};
-
-#define STARTC      021
-#define STOPC       023
-#define IAIXON      0x2000
-
-
-#define TXSTOPPED  0x1
-#define LOWWAIT    0x2
-#define EMPTYWAIT  0x4
-#define RXSTOPPED  0x8
-#define TXBUSY     0x10
-
-#define DISABLED   0
-#define ENABLED    1
-#define OFF        0
-#define ON         1
-
-#define FEPTIMEOUT 200000  
-#define SERIAL_TYPE_NORMAL  1
-#define SERIAL_TYPE_CALLOUT 2
-#define SERIAL_TYPE_INFO    3
-#define EPCA_EVENT_HANGUP   1
-#define EPCA_MAGIC          0x5c6df104L
-
-struct channel 
-{
-	long   magic;
-	unchar boardnum;
-	unchar channelnum;
-	unchar omodem;         /* FEP output modem status     */
-	unchar imodem;         /* FEP input modem status      */
-	unchar modemfake;      /* Modem values to be forced   */
-	unchar modem;          /* Force values                */
-	unchar hflow;
-	unchar dsr;
-	unchar dcd;
-	unchar m_rts ; 		/* The bits used in whatever FEP */
-	unchar m_dcd ;		/* is indiginous to this board to */
-	unchar m_dsr ;		/* represent each of the physical */
-	unchar m_cts ;		/* handshake lines */
-	unchar m_ri ;
-	unchar m_dtr ;
-	unchar stopc;
-	unchar startc;
-	unchar stopca;
-	unchar startca;
-	unchar fepstopc;
-	unchar fepstartc;
-	unchar fepstopca;
-	unchar fepstartca;
-	unchar txwin;
-	unchar rxwin;
-	ushort fepiflag;
-	ushort fepcflag;
-	ushort fepoflag;
-	ushort txbufhead;
-	ushort txbufsize;
-	ushort rxbufhead;
-	ushort rxbufsize;
-	int    close_delay;
-	int    count;
-	int    blocked_open;
-	int    event;
-	int    asyncflags;
-	uint   dev;
-	long   session;
-	long   pgrp;
-	ulong  statusflags;
-	ulong  c_iflag;
-	ulong  c_cflag;
-	ulong  c_lflag;
-	ulong  c_oflag;
-	unchar *txptr;
-	unchar *rxptr;
-	unchar *tmp_buf;
-	struct board_info           *board;
-	volatile struct board_chan  *brdchan;
-	struct digi_struct          digiext;
-	struct tty_struct           *tty;
-	struct termios              normal_termios;
-	struct termios              callout_termios;
-	wait_queue_head_t           open_wait;
-	wait_queue_head_t           close_wait;
-	struct tq_struct            tqueue;
-	volatile struct global_data *mailbox;
-};
-
-struct board_info	
-{
-	unchar status;
-	unchar type;
-	unchar altpin;
-	ushort numports;
-	unchar *port;
-	unchar *membase;
-	unchar *re_map_port;
-	unchar *re_map_membase;
-	ulong  memory_seg;
-	void ( * memwinon )	(struct board_info *, unsigned int) ;
-	void ( * memwinoff ) 	(struct board_info *, unsigned int) ;
-	void ( * globalwinon )	(struct channel *) ;
-	void ( * txwinon ) 	(struct channel *) ;
-	void ( * rxwinon )	(struct channel *) ;
-	void ( * memoff )	(struct channel *) ;
-	void ( * assertgwinon )	(struct channel *) ;
-	void ( * assertmemoff )	(struct channel *) ;
-	unchar poller_inhibited ;
-};
-
diff -u --recursive --new-file v2.3.48/linux/include/linux/epcaconfig.h linux/include/linux/epcaconfig.h
--- v2.3.48/linux/include/linux/epcaconfig.h	Thu Jun 24 12:04:12 1999
+++ linux/include/linux/epcaconfig.h	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#define NUMCARDS 0
-#define NBDEVS 0
-
-struct board_info static_boards[NUMCARDS]={
-};
-
-/* DO NOT HAND EDIT THIS FILE! */
diff -u --recursive --new-file v2.3.48/linux/include/linux/if_bonding.h linux/include/linux/if_bonding.h
--- v2.3.48/linux/include/linux/if_bonding.h	Wed Dec 31 16:00:00 1969
+++ linux/include/linux/if_bonding.h	Sun Feb 27 18:45:10 2000
@@ -0,0 +1,33 @@
+/*
+ * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
+ *
+ * 
+ * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
+ * NCM: Network and Communications Management, Inc.
+ *
+ * BUT, I'm the one who modified it for ethernet, so:
+ * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
+ *
+ *	This software may be used and distributed according to the terms
+ *	of the GNU Public License, incorporated herein by reference.
+ * 
+ */
+
+#ifndef _LINUX_IF_BONDING_H
+#define _LINUX_IF_BONDING_H
+
+#define BOND_ENSLAVE     (SIOCDEVPRIVATE)
+#define BOND_RELEASE     (SIOCDEVPRIVATE + 1)
+#define BOND_SETHWADDR   (SIOCDEVPRIVATE + 2)
+
+#endif /* _LINUX_BOND_H */
+
+/*
+ * Local variables:
+ *  version-control: t
+ *  kept-new-versions: 5
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff -u --recursive --new-file v2.3.48/linux/include/linux/in6.h linux/include/linux/in6.h
--- v2.3.48/linux/include/linux/in6.h	Thu Aug 26 13:05:41 1999
+++ linux/include/linux/in6.h	Thu Mar  2 14:01:19 2000
@@ -56,9 +56,9 @@
 	__u16			sin6_port;      /* Transport layer port # */
 	__u32			sin6_flowinfo;  /* IPv6 flow information */
 	struct in6_addr		sin6_addr;      /* IPv6 address */
+	__u32			sin6_scope_id;  /* scope id (new in RFC2553) */
 };
 
-
 struct ipv6_mreq {
 	/* IPv6 multicast address of group */
 	struct in6_addr ipv6mr_multiaddr;
@@ -156,18 +156,6 @@
 #define IPV6_NEXTHOP		9
 #define IPV6_AUTHHDR		10
 #define IPV6_FLOWINFO		11
-
-#if 0
-/* Aliases for obsolete names */
-#define IPV6_RXHOPOPTS		IPV6_HOPOPTS
-#define IPV6_RXDSTOPTS		IPV6_DSTOPTS
-#define IPV6_RXSRCRT		IPV6_RTHDR
-#endif
-
-/*
- *	Alternative names
- */
-#define SCM_SRCRT		IPV6_RXSRCRT
 
 #define IPV6_UNICAST_HOPS	16
 #define IPV6_MULTICAST_IF	17
diff -u --recursive --new-file v2.3.48/linux/include/linux/input.h linux/include/linux/input.h
--- v2.3.48/linux/include/linux/input.h	Sun Feb 20 21:12:40 2000
+++ linux/include/linux/input.h	Mon Feb 28 14:21:15 2000
@@ -234,11 +234,15 @@
 #define KEY_RECORD		167		
 #define KEY_REWIND		168		
 #define KEY_PHONE		169
+
 #define KEY_CONFIG		171
 #define KEY_HOMEPAGE		172
 #define KEY_REFRESH		173
 #define KEY_EXIT		174
 #define KEY_MOVE		175
+#define KEY_EDIT		176
+#define KEY_SCROLLUP		177
+#define KEY_SCROLLDOWN		178
 
 #define KEY_UNKNOWN		180
 
@@ -339,7 +343,9 @@
 #define ABS_HAT3Y		0x17
 #define ABS_PRESSURE		0x18
 #define ABS_DISTANCE		0x19
-#define ABS_MISC		0x1a
+#define ABS_TILT_X		0x1a
+#define ABS_TILT_Y		0x1b
+#define ABS_MISC		0x1c
 #define ABS_MAX			0x1f
 
 /*
@@ -442,11 +448,6 @@
 	struct input_handle *hnext;
 };
 
-int keybdev_init(void);
-int mousedev_init(void);
-int joydev_init(void);
-int evdev_init(void);
-
 void input_register_device(struct input_dev *);
 void input_unregister_device(struct input_dev *);
 
@@ -459,6 +460,7 @@
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
 
 #define input_report_key(a,b,c) input_event(a, EV_KEY, b, c)
+#define input_report_btn(a,b,c) input_event(a, EV_KEY, b, !!(c))
 #define input_report_rel(a,b,c) input_event(a, EV_REL, b, c)
 #define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c)
 
diff -u --recursive --new-file v2.3.48/linux/include/linux/ioport.h linux/include/linux/ioport.h
--- v2.3.48/linux/include/linux/ioport.h	Tue Dec  7 09:32:51 1999
+++ linux/include/linux/ioport.h	Tue Feb 29 15:28:46 2000
@@ -78,6 +78,7 @@
 
 extern int get_resource_list(struct resource *, char *buf, int size);
 
+extern int check_resource(struct resource *root, unsigned long, unsigned long);
 extern int request_resource(struct resource *root, struct resource *new);
 extern int release_resource(struct resource *new);
 extern int allocate_resource(struct resource *root, struct resource *new,
diff -u --recursive --new-file v2.3.48/linux/include/linux/irq.h linux/include/linux/irq.h
--- v2.3.48/linux/include/linux/irq.h	Sat Feb 26 22:32:06 2000
+++ linux/include/linux/irq.h	Thu Mar  2 14:01:19 2000
@@ -26,7 +26,7 @@
 	void (*disable)(unsigned int irq);
 	void (*ack)(unsigned int irq);
 	void (*end)(unsigned int irq);
-	void (*set_affinity)(unsigned int irq, unsigned int mask);
+	void (*set_affinity)(unsigned int irq, unsigned long mask);
 };
 
 typedef struct hw_interrupt_type  hw_irq_controller;
@@ -44,34 +44,19 @@
 	struct irqaction *action;	/* IRQ action list */
 	unsigned int depth;		/* nested irq disables */
 	spinlock_t lock;
-	unsigned int __pad[3];
 } ____cacheline_aligned irq_desc_t;
 
 extern irq_desc_t irq_desc [NR_IRQS];
 
-typedef struct {
-	unsigned int __local_irq_count;
-	unsigned int __local_bh_count;
-	atomic_t __nmi_counter;
-	unsigned int __pad[5];
-} ____cacheline_aligned irq_cpustat_t;
-
-extern irq_cpustat_t irq_stat [NR_CPUS];
-
-/*
- * Simple wrappers reducing source bloat
- */
-#define local_irq_count(cpu) (irq_stat[(cpu)].__local_irq_count)
-#define local_bh_count(cpu) (irq_stat[(cpu)].__local_bh_count)
-#define nmi_counter(cpu) (irq_stat[(cpu)].__nmi_counter)
-
 #include <asm/hw_irq.h> /* the arch dependent stuff */
 
 extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
-extern spinlock_t irq_controller_lock;
 extern int setup_irq(unsigned int , struct irqaction * );
 
 extern hw_irq_controller no_irq_type;  /* needed in every arch ? */
+extern void no_action(int cpl, void *dev_id, struct pt_regs *regs);
+
+extern volatile unsigned long irq_err_count;
 
 #endif /* __asm_h */
 
diff -u --recursive --new-file v2.3.48/linux/include/linux/mm.h linux/include/linux/mm.h
--- v2.3.48/linux/include/linux/mm.h	Sat Feb 26 22:32:06 2000
+++ linux/include/linux/mm.h	Thu Mar  2 14:01:34 2000
@@ -400,7 +400,6 @@
 		unsigned long * zones_size, unsigned long zone_start_paddr);
 extern void mem_init(void);
 extern void show_mem(void);
-extern void oom(struct task_struct * tsk);
 extern void si_meminfo(struct sysinfo * val);
 extern void swapin_readahead(swp_entry_t);
 
diff -u --recursive --new-file v2.3.48/linux/include/linux/netdevice.h linux/include/linux/netdevice.h
--- v2.3.48/linux/include/linux/netdevice.h	Sat Feb 26 22:32:06 2000
+++ linux/include/linux/netdevice.h	Thu Mar  2 14:02:45 2000
@@ -184,7 +184,8 @@
 	__LINK_STATE_XOFF=0,
 	__LINK_STATE_START,
 	__LINK_STATE_PRESENT,
-	__LINK_STATE_SCHED
+	__LINK_STATE_SCHED,
+	__LINK_STATE_NOCARRIER
 };
 
 
@@ -287,6 +288,7 @@
 	void			*ip_ptr;	/* IPv4 specific data	*/  
 	void                    *dn_ptr;        /* DECnet specific data */
 	void                    *ip6_ptr;       /* IPv6 specific data */
+	void			*ec_ptr;	/* Econet specific data	*/
 
 	struct Qdisc		*qdisc;
 	struct Qdisc		*qdisc_sleeping;
@@ -533,6 +535,30 @@
 #define __dev_put(dev) atomic_dec(&(dev)->refcnt)
 #define dev_hold(dev) atomic_inc(&(dev)->refcnt)
 
+/* Carrier loss detection, dial on demand. The functions netif_carrier_on
+ * and _off may be called from IRQ context, but it is caller
+ * who is responsible for serialization of these calls.
+ */
+
+extern __inline__ int netif_carrier_ok(struct net_device *dev)
+{
+	return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
+}
+
+extern void __netdev_watchdog_up(struct net_device *dev);
+
+extern __inline__ void netif_carrier_on(struct net_device *dev)
+{
+	clear_bit(__LINK_STATE_NOCARRIER, &dev->state);
+	if (netif_running(dev))
+		__netdev_watchdog_up(dev);
+}
+
+extern __inline__ void netif_carrier_off(struct net_device *dev)
+{
+	set_bit(__LINK_STATE_NOCARRIER, &dev->state);
+}
+
 /* Hot-plugging. */
 extern __inline__ int netif_device_present(struct net_device *dev)
 {
@@ -544,22 +570,15 @@
 	if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) &&
 	    netif_running(dev)) {
 		netif_stop_queue(dev);
-		if (dev->tx_timeout &&
-		    del_timer(&dev->watchdog_timer))
-			__dev_put(dev);
 	}
 }
 
 extern __inline__ void netif_device_attach(struct net_device *dev)
 {
-	if (test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
+	if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
 	    netif_running(dev)) {
 		netif_wake_queue(dev);
-		if (dev->tx_timeout) {
-			dev->watchdog_timer.expires = jiffies + dev->watchdog_timeo;
-			add_timer(&dev->watchdog_timer);
-			dev_hold(dev);
-		}
+ 		__netdev_watchdog_up(dev);
 	}
 }
 
diff -u --recursive --new-file v2.3.48/linux/include/linux/netfilter.h linux/include/linux/netfilter.h
--- v2.3.48/linux/include/linux/netfilter.h	Mon Dec 20 18:48:22 1999
+++ linux/include/linux/netfilter.h	Thu Mar  2 14:03:00 2000
@@ -6,6 +6,7 @@
 #include <linux/types.h>
 #include <linux/skbuff.h>
 #include <linux/net.h>
+#include <linux/if.h>
 #include <linux/wait.h>
 #include <linux/list.h>
 #endif
@@ -28,7 +29,7 @@
 extern void netfilter_init(void);
 
 /* Largest hook number + 1 */
-#define NF_MAX_HOOKS 5
+#define NF_MAX_HOOKS 8
 
 struct sk_buff;
 struct net_device;
@@ -39,19 +40,12 @@
 			       const struct net_device *out,
 			       int (*okfn)(struct sk_buff *));
 
-typedef unsigned int nf_cacheflushfn(const void *packet,
-				     const struct net_device *in,
-				     const struct net_device *out,
-				     u_int32_t packetcount,
-				     u_int32_t bytecount);
-
 struct nf_hook_ops
 {
 	struct list_head list;
 
 	/* User fills in from here down. */
 	nf_hookfn *hook;
-	nf_cacheflushfn *flush;
 	int pf;
 	int hooknum;
 	/* Hooks are ordered in ascending priority. */
@@ -74,6 +68,19 @@
 	int (*get)(struct sock *sk, int optval, void *user, int *len);
 };
 
+/* Each queued (to userspace) skbuff has one of these. */
+struct nf_info
+{
+	/* The ops struct which sent us to userspace. */
+	struct nf_hook_ops *elem;
+	
+	/* If we're sent to userspace, this keeps housekeeping info */
+	int pf;
+	unsigned int hook;
+	struct net_device *indev, *outdev;
+	int (*okfn)(struct sk_buff *);
+};
+                                                                                
 /* Function to register/unregister hook points. */
 int nf_register_hook(struct nf_hook_ops *reg);
 void nf_unregister_hook(struct nf_hook_ops *reg);
@@ -85,7 +92,7 @@
 
 extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
 
-/* Activate hook/flush; either okfn or kfree_skb called, unless a hook
+/* Activate hook; either okfn or kfree_skb called, unless a hook
    returns NF_STOLEN (in which case, it's up to the hook to deal with
    the consequences).
 
@@ -117,47 +124,20 @@
 		 struct net_device *indev, struct net_device *outdev,
 		 int (*okfn)(struct sk_buff *));
 
-void nf_cacheflush(int pf, unsigned int hook, const void *packet,
-		   const struct net_device *indev, const struct net_device *outdev,
-		   __u32 packetcount, __u32 bytecount);
-
 /* Call setsockopt() */
 int nf_setsockopt(struct sock *sk, int pf, int optval, char *opt, 
 		  int len);
 int nf_getsockopt(struct sock *sk, int pf, int optval, char *opt,
 		  int *len);
 
-struct nf_wakeme
-{
-	wait_queue_head_t sleep;
-	struct sk_buff_head skbq;
-};
-
-/* For netfilter device. */
-struct nf_interest
-{
-	struct list_head list;
-
-	int pf;
-	/* Bitmask of hook numbers to match (1 << hooknum). */
-	unsigned int hookmask;
-	/* If non-zero, only catch packets with this mark. */
-	unsigned int mark;
-	/* If non-zero, only catch packets of this reason. */
-	unsigned int reason;
-
-	struct nf_wakeme *wake;
-};
-
-/* For asynchronous packet handling. */
-extern void nf_register_interest(struct nf_interest *interest);
-extern void nf_unregister_interest(struct nf_interest *interest);
-extern void nf_getinfo(const struct sk_buff *skb,
-		       struct net_device **indev,
-		       struct net_device **outdev,
-		       unsigned long *mark);
+/* Packet queuing */
+typedef int (*nf_queue_outfn_t)(struct sk_buff *skb, 
+                                struct nf_info *info, void *data);
+extern int nf_register_queue_handler(int pf, 
+                                     nf_queue_outfn_t outfn, void *data);
+extern int nf_unregister_queue_handler(int pf);
 extern void nf_reinject(struct sk_buff *skb,
-			unsigned long mark,
+			struct nf_info *info,
 			unsigned int verdict);
 
 #ifdef CONFIG_NETFILTER_DEBUG
diff -u --recursive --new-file v2.3.48/linux/include/linux/netfilter_decnet.h linux/include/linux/netfilter_decnet.h
--- v2.3.48/linux/include/linux/netfilter_decnet.h	Thu Aug 26 13:05:41 1999
+++ linux/include/linux/netfilter_decnet.h	Thu Mar  2 10:13:16 2000
@@ -30,6 +30,10 @@
 #define NF_DN_LOCAL_OUT		3
 /* Packets about to hit the wire. */
 #define NF_DN_POST_ROUTING	4
-#define NF_DN_NUMHOOKS		5
+/* Input Hello Packets */
+#define NF_DN_HELLO		5
+/* Input Routing Packets */
+#define NF_DN_ROUTE		6
+#define NF_DN_NUMHOOKS		7
 
 #endif /*__LINUX_DECNET_NETFILTER_H*/
diff -u --recursive --new-file v2.3.48/linux/include/linux/netfilter_ipv4.h linux/include/linux/netfilter_ipv4.h
--- v2.3.48/linux/include/linux/netfilter_ipv4.h	Sat Oct  9 11:47:50 1999
+++ linux/include/linux/netfilter_ipv4.h	Thu Mar  2 14:03:10 2000
@@ -51,7 +51,6 @@
 
 #ifdef CONFIG_NETFILTER_DEBUG
 #ifdef __KERNEL__
-void debug_print_hooks_ip(unsigned int nf_debug);
 void nf_debug_ip_local_deliver(struct sk_buff *skb);
 void nf_debug_ip_loopback_xmit(struct sk_buff *newskb);
 void nf_debug_ip_finish_output2(struct sk_buff *skb);
diff -u --recursive --new-file v2.3.48/linux/include/linux/netfilter_ipv6.h linux/include/linux/netfilter_ipv6.h
--- v2.3.48/linux/include/linux/netfilter_ipv6.h	Wed Dec 31 16:00:00 1969
+++ linux/include/linux/netfilter_ipv6.h	Mon Feb 28 07:18:20 2000
@@ -0,0 +1,57 @@
+#ifndef __LINUX_IP6_NETFILTER_H
+#define __LINUX_IP6_NETFILTER_H
+
+/* IPv6-specific defines for netfilter. 
+ * (C)1998 Rusty Russell -- This code is GPL.
+ * (C)1999 David Jeffery
+ *   this header was blatantly ripped from netfilter_ipv4.h 
+ *   it's amazing what adding a bunch of 6s can do =8^)
+ */
+
+#include <linux/netfilter.h>
+
+/* IP Cache bits. */
+/* Src IP address. */
+#define NFC_IP6_SRC              0x0001
+/* Dest IP address. */
+#define NFC_IP6_DST              0x0002
+/* Input device. */
+#define NFC_IP6_IF_IN            0x0004
+/* Output device. */
+#define NFC_IP6_IF_OUT           0x0008
+/* TOS. */
+#define NFC_IP6_TOS              0x0010
+/* Protocol. */
+#define NFC_IP6_PROTO            0x0020
+/* IP options. */
+#define NFC_IP6_OPTIONS          0x0040
+/* Frag & flags. */
+#define NFC_IP6_FRAG             0x0080
+
+
+/* Per-protocol information: only matters if proto match. */
+/* TCP flags. */
+#define NFC_IP6_TCPFLAGS         0x0100
+/* Source port. */
+#define NFC_IP6_SRC_PT           0x0200
+/* Dest port. */
+#define NFC_IP6_DST_PT           0x0400
+/* Something else about the proto */
+#define NFC_IP6_PROTO_UNKNOWN    0x2000
+
+
+/* IP6 Hooks */
+/* After promisc drops, checksum checks. */
+#define NF_IP6_PRE_ROUTING	0
+/* If the packet is destined for this box. */
+#define NF_IP6_LOCAL_IN		1
+/* If the packet is destined for another interface. */
+#define NF_IP6_FORWARD		2
+/* Packets coming from a local process. */
+#define NF_IP6_LOCAL_OUT		3
+/* Packets about to hit the wire. */
+#define NF_IP6_POST_ROUTING	4
+#define NF_IP6_NUMHOOKS		5
+
+
+#endif /*__LINUX_IP6_NETFILTER_H*/
diff -u --recursive --new-file v2.3.48/linux/include/linux/nfsd/nfsd.h linux/include/linux/nfsd/nfsd.h
--- v2.3.48/linux/include/linux/nfsd/nfsd.h	Wed Feb 16 17:03:52 2000
+++ linux/include/linux/nfsd/nfsd.h	Thu Mar  2 14:01:53 2000
@@ -36,8 +36,9 @@
 #define MAY_SATTR		8
 #define MAY_TRUNC		16
 #define MAY_LOCK		32
-#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK) & (MAY_READ | MAY_WRITE | MAY_EXEC)
-# error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK."
+#define MAY_OWNER_OVERRIDE	64
+#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAX_OWNER_OVERRIDE) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
+# error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_OWNER_OVERRIDE."
 #endif
 #define MAY_CREATE		(MAY_EXEC|MAY_WRITE)
 #define MAY_REMOVE		(MAY_EXEC|MAY_WRITE|MAY_TRUNC)
diff -u --recursive --new-file v2.3.48/linux/include/linux/nfsd/nfsfh.h linux/include/linux/nfsd/nfsfh.h
--- v2.3.48/linux/include/linux/nfsd/nfsfh.h	Tue Dec 14 01:27:24 1999
+++ linux/include/linux/nfsd/nfsfh.h	Thu Mar  2 14:01:53 2000
@@ -161,16 +161,16 @@
 static inline void
 fill_pre_wcc(struct svc_fh *fhp)
 {
-        struct inode    *inode;
+	struct inode    *inode;
 
-        inode = fhp->fh_dentry->d_inode;
-        if (!fhp->fh_pre_saved) {
-                fhp->fh_pre_mtime = inode->i_mtime;
-                        fhp->fh_pre_ctime = inode->i_ctime;
-                        fhp->fh_pre_size  = inode->i_size;
-                        fhp->fh_pre_saved = 1;
-        }
-        fhp->fh_locked = 1;
+	inode = fhp->fh_dentry->d_inode;
+	if (!fhp->fh_pre_saved) {
+		fhp->fh_pre_mtime = inode->i_mtime;
+			fhp->fh_pre_ctime = inode->i_ctime;
+			fhp->fh_pre_size  = inode->i_size;
+			fhp->fh_pre_saved = 1;
+	}
+	fhp->fh_locked = 1;
 }
 
 /*
@@ -179,24 +179,30 @@
 static inline void
 fill_post_wcc(struct svc_fh *fhp)
 {
-        struct inode    *inode = fhp->fh_dentry->d_inode;
+	struct inode    *inode = fhp->fh_dentry->d_inode;
 
-        if (fhp->fh_post_saved)
-                printk("nfsd: inode locked twice during operation.\n");
+	if (fhp->fh_post_saved)
+		printk("nfsd: inode locked twice during operation.\n");
 
-        fhp->fh_post_mode       = inode->i_mode;
-        fhp->fh_post_nlink      = inode->i_nlink;
-        fhp->fh_post_uid        = inode->i_uid;
-        fhp->fh_post_gid        = inode->i_gid;
-        fhp->fh_post_size       = inode->i_size;
-        fhp->fh_post_blksize    = inode->i_blksize;
-        fhp->fh_post_blocks     = inode->i_blocks;
-        fhp->fh_post_rdev       = inode->i_rdev;
-        fhp->fh_post_atime      = inode->i_atime;
-        fhp->fh_post_mtime      = inode->i_mtime;
-        fhp->fh_post_ctime      = inode->i_ctime;
-        fhp->fh_post_saved      = 1;
-        fhp->fh_locked          = 0;
+	fhp->fh_post_mode       = inode->i_mode;
+	fhp->fh_post_nlink      = inode->i_nlink;
+	fhp->fh_post_uid	= inode->i_uid;
+	fhp->fh_post_gid	= inode->i_gid;
+	fhp->fh_post_size       = inode->i_size;
+	if (inode->i_blksize) {
+		fhp->fh_post_blksize    = inode->i_blksize;
+		fhp->fh_post_blocks     = inode->i_blocks;
+	} else {
+		fhp->fh_post_blksize    = BLOCK_SIZE;
+		/* how much do we care for accuracy with MinixFS? */
+		fhp->fh_post_blocks     = (inode->i_size+511) >> 9;
+	}
+	fhp->fh_post_rdev       = inode->i_rdev;
+	fhp->fh_post_atime      = inode->i_atime;
+	fhp->fh_post_mtime      = inode->i_mtime;
+	fhp->fh_post_ctime      = inode->i_ctime;
+	fhp->fh_post_saved      = 1;
+	fhp->fh_locked	  = 0;
 }
 #endif /* CONFIG_NFSD_V3 */
 
diff -u --recursive --new-file v2.3.48/linux/include/linux/pkt_sched.h linux/include/linux/pkt_sched.h
--- v2.3.48/linux/include/linux/pkt_sched.h	Fri Jan  7 19:13:23 2000
+++ linux/include/linux/pkt_sched.h	Sun Feb 27 18:45:10 2000
@@ -192,6 +192,16 @@
 	unsigned char   Wlog;		/* log(W)		*/
 	unsigned char   Plog;		/* log(P_max/(qth_max-qth_min))	*/
 	unsigned char   Scell_log;	/* cell size for idle damping */
+	unsigned char	flags;
+#define TC_RED_ECN	1
+};
+
+struct tc_red_xstats
+{
+	__u32           early;          /* Early drops */
+	__u32           pdrop;          /* Drops due to queue limits */
+	__u32           other;          /* Drops due to drop() calls */
+	__u32           marked;         /* Marked packets */
 };
 
 /* GRED section */
diff -u --recursive --new-file v2.3.48/linux/include/linux/pm.h linux/include/linux/pm.h
--- v2.3.48/linux/include/linux/pm.h	Sat Feb 26 22:32:07 2000
+++ linux/include/linux/pm.h	Thu Mar  2 14:01:19 2000
@@ -106,7 +106,7 @@
 	struct list_head entry;
 };
 
-#if defined(CONFIG_ACPI) || defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
+#ifdef CONFIG_PM
 
 extern int pm_active;
 
@@ -147,7 +147,7 @@
 extern inline void pm_access(struct pm_dev *dev) {}
 extern inline void pm_dev_idle(struct pm_dev *dev) {}
 
-#else /* CONFIG_ACPI || CONFIG_APM || CONFIG_APM_MODULE */
+#else /* CONFIG_PM */
 
 #define PM_IS_ACTIVE() 0
 
@@ -180,7 +180,7 @@
 extern inline void pm_access(struct pm_dev *dev) {}
 extern inline void pm_dev_idle(struct pm_dev *dev) {}
 
-#endif /* CONFIG_ACPI || CONFIG_APM || CONFIG_APM_MODULE */
+#endif /* CONFIG_PM */
 
 extern void (*pm_idle)(void);
 extern void (*pm_power_off)(void);
diff -u --recursive --new-file v2.3.48/linux/include/linux/udf_167.h linux/include/linux/udf_167.h
--- v2.3.48/linux/include/linux/udf_167.h	Thu Feb 10 17:11:22 2000
+++ linux/include/linux/udf_167.h	Thu Mar  2 11:17:32 2000
@@ -390,13 +390,10 @@
 #define INTEGRITY_TYPE_CLOSE	1
 
 /* Recorded Address (ECMA 167 4/7.1) */
-#ifndef _LINUX_UDF_FS_I_H
-/* Declared in udf_fs_i.h */
 typedef struct {
 	Uint32 logicalBlockNum;
 	Uint16 partitionReferenceNum;
 } lb_addr;
-#endif
 
 /* Extent interpretation (ECMA 167 4/14.14.1.1) */
 #define EXTENT_RECORDED_ALLOCATED               0x00
diff -u --recursive --new-file v2.3.48/linux/include/linux/udf_fs.h linux/include/linux/udf_fs.h
--- v2.3.48/linux/include/linux/udf_fs.h	Fri Jan 28 15:09:09 2000
+++ linux/include/linux/udf_fs.h	Thu Mar  2 11:17:32 2000
@@ -29,10 +29,6 @@
  *
  * HISTORY
  *
- * 10/02/98 dgb	rearranged all headers
- * 11/26/98 blf	added byte order macros
- * 12/05/98 dgb	removed other includes to reduce kernel namespace pollution.
- *		This should only be included by the kernel now!
  */
 
 #if !defined(_LINUX_UDF_FS_H)
@@ -40,10 +36,10 @@
 
 #define UDF_PREALLOCATE
 #define UDF_DEFAULT_PREALLOC_BLOCKS		8
-#define UDF_DEFAULT_PREALLOC_DIR_BLOCKS	0
 
-#define UDFFS_DATE		"2000/01/17"
-#define UDFFS_VERSION	"0.9.0"
+#define UDFFS_DATE		"2000/02/29"
+#define UDFFS_VERSION	"0.9.1"
+
 #define UDFFS_DEBUG
 
 #ifdef UDFFS_DEBUG
@@ -60,7 +56,12 @@
 #define udf_info(f, a...) \
 		printk (KERN_INFO "UDF-fs INFO " ## f, ## a);
 
-/* Prototype for fs/filesystem.c (the only thing really required in this file) */
+#ifdef __KERNEL__
+/*
+ * Function prototypes (all other prototypes included in udfdecl.h)
+ */
 extern int init_udf_fs(void);
+
+#endif /* __KERNEL__ */
 
 #endif /* !defined(_LINUX_UDF_FS_H) */
diff -u --recursive --new-file v2.3.48/linux/include/linux/udf_fs_i.h linux/include/linux/udf_fs_i.h
--- v2.3.48/linux/include/linux/udf_fs_i.h	Fri Jan 28 15:09:09 2000
+++ linux/include/linux/udf_fs_i.h	Thu Mar  2 11:17:32 2000
@@ -43,7 +43,8 @@
 	unsigned i_alloc_type : 3;
 	unsigned i_extended_fe : 1;
 	unsigned i_strat_4096 : 1;
-	unsigned reserved : 27;
+	unsigned i_new_inode : 1;
+	unsigned reserved : 26;
 };
 
 #endif
diff -u --recursive --new-file v2.3.48/linux/include/linux/udf_fs_sb.h linux/include/linux/udf_fs_sb.h
--- v2.3.48/linux/include/linux/udf_fs_sb.h	Fri Jan 28 15:09:09 2000
+++ linux/include/linux/udf_fs_sb.h	Thu Mar  2 11:17:32 2000
@@ -96,6 +96,9 @@
 	/* Fileset Info */
 	__u16 s_serialnum;
 
+	/* highest UDF revision we have recorded to this media */
+	__u16 s_udfrev;
+
 	/* Miscellaneous flags */
 	__u32 s_flags;
 
diff -u --recursive --new-file v2.3.48/linux/include/net/dn_neigh.h linux/include/net/dn_neigh.h
--- v2.3.48/linux/include/net/dn_neigh.h	Thu Aug 26 13:05:41 1999
+++ linux/include/net/dn_neigh.h	Thu Mar  2 10:13:16 2000
@@ -19,8 +19,8 @@
 extern void dn_neigh_init(void);
 extern void dn_neigh_cleanup(void);
 extern struct neighbour *dn_neigh_lookup(struct neigh_table *tbl, void *ptr);
-extern void dn_neigh_router_hello(struct sk_buff *skb);
-extern void dn_neigh_endnode_hello(struct sk_buff *skb);
+extern int dn_neigh_router_hello(struct sk_buff *skb);
+extern int dn_neigh_endnode_hello(struct sk_buff *skb);
 extern void dn_neigh_pointopoint_hello(struct sk_buff *skb);
 extern int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
 
diff -u --recursive --new-file v2.3.48/linux/include/net/ip.h linux/include/net/ip.h
--- v2.3.48/linux/include/net/ip.h	Sat Feb 12 11:22:11 2000
+++ linux/include/net/ip.h	Thu Mar  2 14:02:52 2000
@@ -170,11 +170,9 @@
 extern __inline__
 int ip_decrease_ttl(struct iphdr *iph)
 {
-	u16 check = iph->check;
-	check = ntohs(check) + 0x0100;
-	if ((check & 0xFF00) == 0)
-		check++;		/* carry overflow */
-	iph->check = htons(check);
+	u32 check = iph->check;
+	check += __constant_htons(0x0100);
+	iph->check = check + (check>>16);
 	return --iph->ttl;
 }
 
diff -u --recursive --new-file v2.3.48/linux/include/net/ipv6.h linux/include/net/ipv6.h
--- v2.3.48/linux/include/net/ipv6.h	Tue Jan 11 22:31:45 2000
+++ linux/include/net/ipv6.h	Thu Mar  2 14:03:50 2000
@@ -4,7 +4,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>
  *
- *	$Id: ipv6.h,v 1.19 2000/01/09 02:19:26 davem Exp $
+ *	$Id: ipv6.h,v 1.20 2000/02/27 19:51:38 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -19,6 +19,8 @@
 #include <asm/hardirq.h>
 #include <net/ndisc.h>
 #include <net/flow.h>
+
+#define SIN6_LEN_RFC2133	24
 
 /*
  *	NextHeader field of IPv6 header
diff -u --recursive --new-file v2.3.48/linux/include/net/protocol.h linux/include/net/protocol.h
--- v2.3.48/linux/include/net/protocol.h	Thu Aug 26 13:05:41 1999
+++ linux/include/net/protocol.h	Thu Mar  2 14:01:20 2000
@@ -45,9 +45,6 @@
 	const char		*name;
 };
 
-extern rwlock_t inet_protocol_lock;
-
-
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 struct inet6_protocol 
 {
@@ -65,7 +62,6 @@
 	const char	*name;
 };
 
-extern rwlock_t inet6_protocol_lock;
 #endif
 
 extern struct inet_protocol *inet_protocol_base;
diff -u --recursive --new-file v2.3.48/linux/include/net/sock.h linux/include/net/sock.h
--- v2.3.48/linux/include/net/sock.h	Sat Feb 12 11:22:11 2000
+++ linux/include/net/sock.h	Thu Mar  2 14:02:52 2000
@@ -894,7 +894,7 @@
  *   socket is looked up by one cpu and unhasing is made by another CPU.
  *   It is true for udp/raw, netlink (leak to receive and error queues), tcp
  *   (leak to backlog). Packet socket does all the processing inside
- *   ptype_lock, so that it has not this race condition. UNIX sockets
+ *   BR_NETPROTO_LOCK, so that it has not this race condition. UNIX sockets
  *   use separate SMP lock, so that they are prone too.
  */
 
diff -u --recursive --new-file v2.3.48/linux/kernel/Makefile linux/kernel/Makefile
--- v2.3.48/linux/kernel/Makefile	Thu Feb 10 17:11:23 2000
+++ linux/kernel/Makefile	Mon Feb 28 07:16:54 2000
@@ -29,12 +29,8 @@
 OX_OBJS  += ksyms.o
 endif
 
-ifdef CONFIG_ACPI
+ifdef CONFIG_PM
 OX_OBJS += pm.o
-else
-  ifdef CONFIG_APM
-  OX_OBJS += pm.o
-  endif
 endif
 
 CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
diff -u --recursive --new-file v2.3.48/linux/kernel/ksyms.c linux/kernel/ksyms.c
--- v2.3.48/linux/kernel/ksyms.c	Sat Feb 26 22:32:07 2000
+++ linux/kernel/ksyms.c	Sat Feb 26 22:34:27 2000
@@ -43,6 +43,7 @@
 #include <linux/mm.h>
 #include <linux/capability.h>
 #include <linux/highuid.h>
+#include <linux/brlock.h>
 
 #if defined(CONFIG_PROC_FS)
 #include <linux/proc_fs.h>
@@ -340,6 +341,14 @@
 #ifdef __SMP__
 /* Various random spinlocks we want to export */
 EXPORT_SYMBOL(tqueue_lock);
+
+/* Big-Reader lock implementation */
+EXPORT_SYMBOL(__brlock_array);
+#ifndef __BRLOCK_USE_ATOMICS
+EXPORT_SYMBOL(__br_write_locks);
+#endif
+EXPORT_SYMBOL(__br_write_lock);
+EXPORT_SYMBOL(__br_write_unlock);
 #endif
 
 /* autoirq from  drivers/net/auto_irq.c */
diff -u --recursive --new-file v2.3.48/linux/kernel/resource.c linux/kernel/resource.c
--- v2.3.48/linux/kernel/resource.c	Wed Dec 15 10:43:17 1999
+++ linux/kernel/resource.c	Tue Feb 29 15:28:46 2000
@@ -92,17 +92,7 @@
 	}
 }
 
-int request_resource(struct resource *root, struct resource *new)
-{
-	struct resource *conflict;
-
-	write_lock(&resource_lock);
-	conflict = __request_resource(root, new);
-	write_unlock(&resource_lock);
-	return conflict ? -EBUSY : 0;
-}
-
-int release_resource(struct resource *old)
+static int __release_resource(struct resource *old)
 {
 	struct resource *tmp, **p;
 
@@ -119,6 +109,40 @@
 		p = &tmp->sibling;
 	}
 	return -EINVAL;
+}
+
+int request_resource(struct resource *root, struct resource *new)
+{
+	struct resource *conflict;
+
+	write_lock(&resource_lock);
+	conflict = __request_resource(root, new);
+	write_unlock(&resource_lock);
+	return conflict ? -EBUSY : 0;
+}
+
+int release_resource(struct resource *old)
+{
+	int retval;
+
+	write_lock(&resource_lock);
+	retval = __release_resource(old);
+	write_unlock(&resource_lock);
+	return retval;
+}
+
+int check_resource(struct resource *root, unsigned long start, unsigned long len)
+{
+	struct resource *conflict, tmp;
+
+	tmp.start = start;
+	tmp.end = start + len - 1;
+	write_lock(&resource_lock);
+	conflict = __request_resource(root, &tmp);
+	if (!conflict)
+		__release_resource(&tmp);
+	write_unlock(&resource_lock);
+	return conflict ? -EBUSY : 0;
 }
 
 /*
diff -u --recursive --new-file v2.3.48/linux/kernel/sched.c linux/kernel/sched.c
--- v2.3.48/linux/kernel/sched.c	Sat Feb 26 22:32:07 2000
+++ linux/kernel/sched.c	Mon Feb 28 07:41:14 2000
@@ -228,13 +228,11 @@
 	/*
 	 * We will get here often - or in the high CPU contention
 	 * case. No CPU is idle and this process is either lowprio or
-	 * the preferred CPU is highprio. Try to preemt some other CPU
+	 * the preferred CPU is highprio. Try to preempt some other CPU
 	 * only if it's RT or if it's iteractive and the preferred
 	 * cpu won't reschedule shortly.
 	 */
-	if ((p->avg_slice < cacheflush_time && cpu_curr(best_cpu)->avg_slice > cacheflush_time) ||
-	    p->policy != SCHED_OTHER)
-	{
+	if (p->avg_slice < cacheflush_time || (p->policy & ~SCHED_YIELD) != SCHED_OTHER) {
 		for (i = smp_num_cpus - 1; i >= 0; i--) {
 			cpu = cpu_logical_map(i);
 			if (cpu == best_cpu)
diff -u --recursive --new-file v2.3.48/linux/lib/Makefile linux/lib/Makefile
--- v2.3.48/linux/lib/Makefile	Mon Nov 27 05:54:00 1995
+++ linux/lib/Makefile	Sat Feb 26 22:34:27 2000
@@ -7,6 +7,6 @@
 #
 
 L_TARGET := lib.a
-L_OBJS   := errno.o ctype.o string.o vsprintf.o
+L_OBJS   := errno.o ctype.o string.o vsprintf.o brlock.o
 
 include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v2.3.48/linux/lib/brlock.c linux/lib/brlock.c
--- v2.3.48/linux/lib/brlock.c	Wed Dec 31 16:00:00 1969
+++ linux/lib/brlock.c	Sat Feb 26 22:34:27 2000
@@ -0,0 +1,65 @@
+/*
+ *
+ * linux/lib/brlock.c
+ *
+ * 'Big Reader' read-write spinlocks.  See linux/brlock.h for details.
+ *
+ * Copyright 2000, Ingo Molnar <mingo@redhat.com>
+ * Copyright 2000, David S. Miller <davem@redhat.com>
+ */
+
+#include <linux/config.h>
+
+#ifdef CONFIG_SMP
+
+#include <linux/sched.h>
+#include <linux/brlock.h>
+
+#ifdef __BRLOCK_USE_ATOMICS
+
+brlock_read_lock_t __brlock_array[NR_CPUS][__BR_IDX_MAX] =
+   { [0 ... NR_CPUS-1] = { [0 ... __BR_IDX_MAX-1] = RW_LOCK_UNLOCKED } };
+
+void __br_write_lock (enum brlock_indices idx)
+{
+	int i;
+
+	for (i = 0; i < smp_num_cpus; i++)
+		write_lock(__brlock_array[idx] + i);
+}
+
+void __br_write_unlock (enum brlock_indices idx)
+{
+	int i;
+
+	for (i = 0; i < smp_num_cpus; i++)
+		write_unlock(__brlock_array[idx] + i);
+}
+
+#else /* ! __BRLOCK_USE_ATOMICS */
+
+brlock_read_lock_t __brlock_array[NR_CPUS][__BR_IDX_MAX] =
+   { [0 ... NR_CPUS-1] = { [0 ... __BR_IDX_MAX-1] = 0 } };
+
+struct br_wrlock __br_write_locks[__BR_IDX_MAX] =
+   { [0 ... __BR_IDX_MAX-1] = { SPIN_LOCK_UNLOCKED } };
+
+void __br_write_lock (enum brlock_indices idx)
+{
+	int i;
+
+	spin_lock(&__br_write_locks[idx].lock);
+again:
+	for (i = 0; i < smp_num_cpus; i++)
+		if (__brlock_array[i][idx] != 0)
+			goto again;
+}
+
+void __br_write_unlock (enum brlock_indices idx)
+{
+	spin_unlock(&__br_write_locks[idx].lock);
+}
+
+#endif /* __BRLOCK_USE_ATOMICS */
+
+#endif /* CONFIG_SMP */
diff -u --recursive --new-file v2.3.48/linux/mm/memory.c linux/mm/memory.c
--- v2.3.48/linux/mm/memory.c	Sat Feb 26 22:32:07 2000
+++ linux/mm/memory.c	Mon Feb 28 07:50:08 2000
@@ -70,16 +70,6 @@
 mem_map_t * mem_map = NULL;
 
 /*
- * oom() prints a message (so that the user knows why the process died),
- * and gives the process an untrappable SIGKILL.
- */
-void oom(struct task_struct * task)
-{
-	printk("\nOut of memory for %s.\n", task->comm);
-	force_sig(SIGKILL, task);
-}
-
-/*
  * Note: this doesn't free the actual pages themselves. That
  * has been handled earlier when unmapping all the memory regions.
  */
diff -u --recursive --new-file v2.3.48/linux/mm/mmap.c linux/mm/mmap.c
--- v2.3.48/linux/mm/mmap.c	Wed Feb 16 17:03:52 2000
+++ linux/mm/mmap.c	Thu Mar  2 10:18:50 2000
@@ -860,7 +860,7 @@
 	if (mm->map_count)
 		printk("exit_mmap: map count is %d\n", mm->map_count);
 
-	clear_page_tables(mm, 0, USER_PTRS_PER_PGD);
+	clear_page_tables(mm, FIRST_USER_PGD_NR, USER_PTRS_PER_PGD);
 }
 
 /* Insert vm structure into process list sorted by address
diff -u --recursive --new-file v2.3.48/linux/mm/page_alloc.c linux/mm/page_alloc.c
--- v2.3.48/linux/mm/page_alloc.c	Sat Feb 26 22:32:07 2000
+++ linux/mm/page_alloc.c	Thu Mar  2 11:51:29 2000
@@ -337,7 +337,7 @@
 	zone_t *zone;
 	int i;
 
-	sum = nr_lru_pages - atomic_read(&page_cache_size);
+	sum = nr_lru_pages;
 	for (i = 0; i < NUMNODES; i++)
 		for (zone = NODE_DATA(i)->node_zones; zone <= NODE_DATA(i)->node_zones+ZONE_NORMAL; zone++)
 			sum += zone->free_pages;
diff -u --recursive --new-file v2.3.48/linux/mm/vmscan.c linux/mm/vmscan.c
--- v2.3.48/linux/mm/vmscan.c	Sat Feb 26 22:32:07 2000
+++ linux/mm/vmscan.c	Mon Feb 28 07:44:22 2000
@@ -326,6 +326,7 @@
 	struct task_struct * p;
 	int counter;
 	int __ret = 0;
+	int assign = 0;
 
 	lock_kernel();
 	/* 
@@ -345,12 +346,9 @@
 	counter = nr_threads / (priority+1);
 	if (counter < 1)
 		counter = 1;
-	if (counter > nr_threads)
-		counter = nr_threads;
 
 	for (; counter >= 0; counter--) {
-		int assign = 0;
-		int max_cnt = 0;
+		unsigned long max_cnt = 0;
 		struct mm_struct *best = NULL;
 		int pid = 0;
 	select:
@@ -363,7 +361,7 @@
 	 		if (mm->rss <= 0)
 				continue;
 			/* Refresh swap_cnt? */
-			if (assign)
+			if (assign == 1)
 				mm->swap_cnt = mm->rss;
 			if (mm->swap_cnt > max_cnt) {
 				max_cnt = mm->swap_cnt;
@@ -372,6 +370,8 @@
 			}
 		}
 		read_unlock(&tasklist_lock);
+		if (assign == 1)
+			assign = 2;
 		if (!best) {
 			if (!assign) {
 				assign = 1;
diff -u --recursive --new-file v2.3.48/linux/net/bridge/br_device.c linux/net/bridge/br_device.c
--- v2.3.48/linux/net/bridge/br_device.c	Sat Feb 26 22:32:08 2000
+++ linux/net/bridge/br_device.c	Thu Mar  2 11:41:11 2000
@@ -5,7 +5,7 @@
  *	Authors:
  *	Lennert Buytenhek		<buytenh@gnu.org>
  *
- *	$Id: br_device.c,v 1.2 2000/02/24 19:48:06 davem Exp $
+ *	$Id: br_device.c,v 1.3 2000/03/01 02:58:09 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU General Public License
@@ -13,7 +13,6 @@
  *	2 of the License, or (at your option) any later version.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/if_bridge.h>
diff -u --recursive --new-file v2.3.48/linux/net/core/dev.c linux/net/core/dev.c
--- v2.3.48/linux/net/core/dev.c	Sat Feb 26 22:32:08 2000
+++ linux/net/core/dev.c	Thu Mar  2 10:13:17 2000
@@ -76,6 +76,7 @@
 #include <linux/etherdevice.h>
 #include <linux/notifier.h>
 #include <linux/skbuff.h>
+#include <linux/brlock.h>
 #include <net/sock.h>
 #include <linux/rtnetlink.h>
 #include <net/slhc.h>
@@ -129,7 +130,6 @@
 
 static struct packet_type *ptype_base[16];		/* 16 way hashed list */
 static struct packet_type *ptype_all = NULL;		/* Taps */
-static rwlock_t ptype_lock = RW_LOCK_UNLOCKED;
 
 /*
  *	Our notifier list
@@ -181,7 +181,7 @@
 {
 	int hash;
 
-	write_lock_bh(&ptype_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 
 #ifdef CONFIG_NET_FASTROUTE
 	/* Hack to detect packet socket */
@@ -199,7 +199,7 @@
 		pt->next = ptype_base[hash];
 		ptype_base[hash] = pt;
 	}
-	write_unlock_bh(&ptype_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 }
 
 
@@ -211,7 +211,7 @@
 {
 	struct packet_type **pt1;
 
-	write_lock_bh(&ptype_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 
 	if (pt->type == htons(ETH_P_ALL)) {
 		netdev_nit--;
@@ -227,11 +227,11 @@
 			if (pt->data)
 				netdev_fastroute_obstacles--;
 #endif
-			write_unlock_bh(&ptype_lock);
+			br_write_unlock_bh(BR_NETPROTO_LOCK);
 			return;
 		}
 	}
-	write_unlock_bh(&ptype_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 	printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt);
 }
 
@@ -581,7 +581,7 @@
 	struct packet_type *ptype;
 	get_fast_time(&skb->stamp);
 
-	read_lock(&ptype_lock);
+	br_read_lock(BR_NETPROTO_LOCK);
 	for (ptype = ptype_all; ptype!=NULL; ptype = ptype->next) 
 	{
 		/* Never send packets back to the socket
@@ -615,7 +615,7 @@
 			ptype->func(skb2, skb->dev, ptype);
 		}
 	}
-	read_unlock(&ptype_lock);
+	br_read_unlock(BR_NETPROTO_LOCK);
 }
 
 /*
@@ -863,8 +863,8 @@
 }
 
 /* Reparent skb to master device. This function is called
- * only from net_rx_action under ptype_lock. It is misuse
- * of ptype_lock, but it is OK for now.
+ * only from net_rx_action under BR_NETPROTO_LOCK. It is misuse
+ * of BR_NETPROTO_LOCK, but it is OK for now.
  */
 static __inline__ void skb_bond(struct sk_buff *skb)
 {
@@ -924,9 +924,9 @@
 
 void net_call_rx_atomic(void (*fn)(void))
 {
-	write_lock_bh(&ptype_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	fn();
-	write_unlock_bh(&ptype_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 }
 
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
@@ -936,11 +936,13 @@
 static void __inline__ handle_bridge(struct sk_buff *skb,
 				     struct packet_type *pt_prev)
 {
-	if (pt_prev)
-		deliver_to_old_ones(pt_prev, skb, 0);
-	else {
-		atomic_inc(&skb->users);
-		pt_prev->func(skb, skb->dev, pt_prev);
+	if (pt_prev) {
+		if (!pt_prev->data)
+			deliver_to_old_ones(pt_prev, skb, 0);
+		else {
+			atomic_inc(&skb->users);
+			pt_prev->func(skb, skb->dev, pt_prev);
+		}
 	}
 
 	br_handle_frame_hook(skb);
@@ -954,7 +956,7 @@
 	unsigned long start_time = jiffies;
 	int bugdet = netdev_max_backlog;
 
-	read_lock(&ptype_lock);
+	br_read_lock(BR_NETPROTO_LOCK);
 
 	for (;;) {
 		struct sk_buff *skb;
@@ -1034,7 +1036,7 @@
 		if (bugdet-- < 0 || jiffies - start_time > 1)
 			goto softnet_break;
 	}
-	read_unlock(&ptype_lock);
+	br_read_unlock(BR_NETPROTO_LOCK);
 
 	local_irq_disable();
 	if (queue->throttle) {
@@ -1050,7 +1052,7 @@
 	return;
 
 softnet_break:
-	read_unlock(&ptype_lock);
+	br_read_unlock(BR_NETPROTO_LOCK);
 
 	local_irq_disable();
 	netdev_rx_stat[this_cpu].time_squeeze++;
@@ -1391,9 +1393,9 @@
 		dev_hold(master);
 	}
 
-	write_lock_bh(&ptype_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	slave->master = master;
-	write_unlock_bh(&ptype_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 
 	if (old)
 		dev_put(old);
@@ -1516,7 +1518,7 @@
 		case SIOCGIFFLAGS:	/* Get interface flags */
 			ifr->ifr_flags = (dev->flags&~(IFF_PROMISC|IFF_ALLMULTI|IFF_RUNNING))
 				|(dev->gflags&(IFF_PROMISC|IFF_ALLMULTI));
-			if (netif_running(dev))
+			if (netif_running(dev) && netif_carrier_ok(dev))
 				ifr->ifr_flags |= IFF_RUNNING;
 			return 0;
 
@@ -2129,6 +2131,7 @@
 			if (dev->rebuild_header == NULL)
 				dev->rebuild_header = default_rebuild_header;
 			dev_init_scheduler(dev);
+			set_bit(__LINK_STATE_PRESENT, &dev->state);
 		}
 	}
 
diff -u --recursive --new-file v2.3.48/linux/net/core/netfilter.c linux/net/core/netfilter.c
--- v2.3.48/linux/net/core/netfilter.c	Mon Dec 20 18:48:22 1999
+++ linux/net/core/netfilter.c	Thu Mar  2 11:41:11 2000
@@ -5,6 +5,8 @@
  * way.
  *
  * Rusty Russell (C)1998 -- This code is GPL.
+ *
+ * February 2000: Modified by James Morris to have 1 queue per protocol.
  */
 #include <linux/config.h>
 #include <linux/netfilter.h>
@@ -16,7 +18,7 @@
 #include <linux/interrupt.h>
 #include <linux/if.h>
 #include <linux/netdevice.h>
-#include <linux/spinlock.h>
+#include <linux/brlock.h>
 
 #define __KERNEL_SYSCALLS__
 #include <linux/unistd.h>
@@ -32,41 +34,31 @@
 #define NFDEBUG(format, args...)
 #endif
 
-/* Each queued (to userspace) skbuff has one of these. */
-struct nf_info
-{
-	/* The ops struct which sent us to userspace. */
-	struct nf_hook_ops *elem;
-
-	/* If we're sent to userspace, this keeps housekeeping info */
-	int pf;
-	unsigned long mark;
-	unsigned int hook;
-	struct net_device *indev, *outdev;
-	int (*okfn)(struct sk_buff *);
-};
-
-static rwlock_t nf_lock = RW_LOCK_UNLOCKED;
+/* Sockopts only registered and called from user context, so
+   BR_NETPROTO_LOCK would be overkill.  Also, [gs]etsockopt calls may
+   sleep. */
 static DECLARE_MUTEX(nf_sockopt_mutex);
 
 struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
 static LIST_HEAD(nf_sockopts);
-static LIST_HEAD(nf_interested);
+
+/* 
+ * A queue handler may be registered for each protocol.  Each is protected by
+ * long term mutex.  The handler must provide an an outfn() to accept packets
+ * for queueing and must reinject all packets it receives, no matter what.
+ */
+static struct nf_queue_handler_t {
+	nf_queue_outfn_t outfn;
+	void *data;
+} queue_handler[NPROTO];
 
 int nf_register_hook(struct nf_hook_ops *reg)
 {
 	struct list_head *i;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-	if (reg->pf<0 || reg->pf>=NPROTO || reg->hooknum >= NF_MAX_HOOKS) {
-		NFDEBUG("nf_register_hook: bad vals: pf=%i, hooknum=%u.\n",
-			reg->pf, reg->hooknum);
-		return -EINVAL;
-	}
-#endif
 	NFDEBUG("nf_register_hook: pf=%i hook=%u.\n", reg->pf, reg->hooknum);
-	
-	write_lock_bh(&nf_lock);
+
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	for (i = nf_hooks[reg->pf][reg->hooknum].next; 
 	     i != &nf_hooks[reg->pf][reg->hooknum]; 
 	     i = i->next) {
@@ -74,22 +66,15 @@
 			break;
 	}
 	list_add(&reg->list, i->prev);
-	write_unlock_bh(&nf_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 	return 0;
 }
 
 void nf_unregister_hook(struct nf_hook_ops *reg)
 {
-#ifdef CONFIG_NETFILTER_DEBUG
-	if (reg->pf<0 || reg->pf>=NPROTO || reg->hooknum >= NF_MAX_HOOKS) {
-		NFDEBUG("nf_unregister_hook: bad vals: pf=%i, hooknum=%u.\n",
-			reg->pf, reg->hooknum);
-		return;
-	}
-#endif
-	write_lock_bh(&nf_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	list_del(&reg->list);
-	write_unlock_bh(&nf_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 }
 
 /* Do exclusive ranges overlap? */
@@ -105,22 +90,6 @@
 	struct list_head *i;
 	int ret = 0;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-	if (reg->pf<0 || reg->pf>=NPROTO) {
-		NFDEBUG("nf_register_sockopt: bad val: pf=%i.\n", reg->pf);
-		return -EINVAL;
-	}
-	if (reg->set_optmin > reg->set_optmax) {
-		NFDEBUG("nf_register_sockopt: bad set val: min=%i max=%i.\n", 
-			reg->set_optmin, reg->set_optmax);
-		return -EINVAL;
-	}
-	if (reg->get_optmin > reg->get_optmax) {
-		NFDEBUG("nf_register_sockopt: bad get val: min=%i max=%i.\n", 
-			reg->get_optmin, reg->get_optmax);
-		return -EINVAL;
-	}
-#endif
 	if (down_interruptible(&nf_sockopt_mutex) != 0)
 		return -EINTR;
 
@@ -149,12 +118,6 @@
 
 void nf_unregister_sockopt(struct nf_sockopt_ops *reg)
 {
-#ifdef CONFIG_NETFILTER_DEBUG
-	if (reg->pf<0 || reg->pf>=NPROTO) {
-		NFDEBUG("nf_register_sockopt: bad val: pf=%i.\n", reg->pf);
-		return;
-	}
-#endif
 	/* No point being interruptible: we're probably in cleanup_module() */
 	down(&nf_sockopt_mutex);
 	list_del(&reg->list);
@@ -167,6 +130,33 @@
 #include <net/tcp.h>
 #include <linux/netfilter_ipv4.h>
 
+static void debug_print_hooks_ip(unsigned int nf_debug)
+{
+	if (nf_debug & (1 << NF_IP_PRE_ROUTING)) {
+		printk("PRE_ROUTING ");
+		nf_debug ^= (1 << NF_IP_PRE_ROUTING);
+	}
+	if (nf_debug & (1 << NF_IP_LOCAL_IN)) {
+		printk("LOCAL_IN ");
+		nf_debug ^= (1 << NF_IP_LOCAL_IN);
+	}
+	if (nf_debug & (1 << NF_IP_FORWARD)) {
+		printk("FORWARD ");
+		nf_debug ^= (1 << NF_IP_FORWARD);
+	}
+	if (nf_debug & (1 << NF_IP_LOCAL_OUT)) {
+		printk("LOCAL_OUT ");
+		nf_debug ^= (1 << NF_IP_LOCAL_OUT);
+	}
+	if (nf_debug & (1 << NF_IP_POST_ROUTING)) {
+		printk("POST_ROUTING ");
+		nf_debug ^= (1 << NF_IP_POST_ROUTING);
+	}
+	if (nf_debug)
+		printk("Crap bits: 0x%04X", nf_debug);
+	printk("\n");
+}
+
 void nf_dump_skb(int pf, struct sk_buff *skb)
 {
 	printk("skb: pf=%i %s dev=%s len=%u\n", 
@@ -257,7 +247,7 @@
 {
 	/* If it's owned, it must have gone through the
 	 * NF_IP_LOCAL_OUT and NF_IP_POST_ROUTING.
-	 * Otherwise, must have gone through NF_IP_RAW_INPUT,
+	 * Otherwise, must have gone through
 	 * NF_IP_PRE_ROUTING, NF_IP_FORWARD and NF_IP_POST_ROUTING.
 	 */
 	if (skb->sk) {
@@ -269,9 +259,6 @@
 		}
 	} else {
 		if (skb->nf_debug != ((1 << NF_IP_PRE_ROUTING)
-#ifdef CONFIG_IP_NETFILTER_RAW_INPUT
-				      | (1 << NF_IP_RAW_INPUT)
-#endif
 				      | (1 << NF_IP_FORWARD)
 				      | (1 << NF_IP_POST_ROUTING))) {
 			printk("ip_finish_output: bad unowned skb = %p: ",skb);
@@ -280,29 +267,8 @@
 		}
 	}
 }
-
-
 #endif /*CONFIG_NETFILTER_DEBUG*/
 
-void nf_cacheflush(int pf, unsigned int hook, const void *packet,
-		   const struct net_device *indev, const struct net_device *outdev,
-		   __u32 packetcount, __u32 bytecount)
-{
-	struct list_head *i;
-
-	read_lock_bh(&nf_lock);
-	for (i = nf_hooks[pf][hook].next; 
-	     i != &nf_hooks[pf][hook]; 
-	     i = i->next) {
-		if (((struct nf_hook_ops *)i)->flush)
-			((struct nf_hook_ops *)i)->flush(packet, indev,
-							 outdev,
-							 packetcount,
-							 bytecount);
-	}
-	read_unlock_bh(&nf_lock);
-}
-
 /* Call get/setsockopt() */
 static int nf_sockopt(struct sock *sk, int pf, int val, 
 		      char *opt, int *len, int get)
@@ -360,15 +326,12 @@
 		struct nf_hook_ops *elem = (struct nf_hook_ops *)*i;
 		switch (elem->hook(hook, skb, indev, outdev, okfn)) {
 		case NF_QUEUE:
-			NFDEBUG("nf_iterate: NF_QUEUE for %p.\n", *skb);
 			return NF_QUEUE;
 
 		case NF_STOLEN:
-			NFDEBUG("nf_iterate: NF_STOLEN for %p.\n", *skb);
 			return NF_STOLEN;
 
 		case NF_DROP:
-			NFDEBUG("nf_iterate: NF_DROP for %p.\n", *skb);
 			return NF_DROP;
 
 #ifdef CONFIG_NETFILTER_DEBUG
@@ -384,6 +347,38 @@
 	return NF_ACCEPT;
 }
 
+int nf_register_queue_handler(int pf, nf_queue_outfn_t outfn, void *data)
+{      
+	int ret;
+
+	br_write_lock_bh(BR_NETPROTO_LOCK);
+	if (queue_handler[pf].outfn)
+		ret = -EBUSY;
+	else {
+		queue_handler[pf].outfn = outfn;
+		queue_handler[pf].data = data;
+		ret = 0;
+	}
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
+
+	return ret;
+}
+
+/* The caller must flush their queue before this */
+int nf_unregister_queue_handler(int pf)
+{
+	NFDEBUG("Unregistering Netfilter queue handler for pf=%d\n", pf);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
+	queue_handler[pf].outfn = NULL;
+	queue_handler[pf].data = NULL;
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
+	return 0;
+}
+
+/* 
+ * Any packet that leaves via this function must come back 
+ * through nf_reinject().
+ */
 static void nf_queue(struct sk_buff *skb, 
 		     struct list_head *elem, 
 		     int pf, unsigned int hook,
@@ -391,61 +386,43 @@
 		     struct net_device *outdev,
 		     int (*okfn)(struct sk_buff *))
 {
-	struct list_head *i;
+	int status;
+	struct nf_info *info;
 
-	struct nf_info *info = kmalloc(sizeof(*info), GFP_ATOMIC);
+	if (!queue_handler[pf].outfn) {
+		NFDEBUG("nf_queue: noone wants the packet, dropping it.\n");
+		kfree_skb(skb);
+		return;
+	}
+
+	info = kmalloc(sizeof(*info), GFP_ATOMIC);
 	if (!info) {
-		NFDEBUG("nf_hook: OOM.\n");
+		if (net_ratelimit())
+			printk(KERN_ERR "OOM queueing packet %p\n",
+			       skb);
 		kfree_skb(skb);
 		return;
 	}
 
-	/* Can't do struct assignments with arrays in them.  Damn. */
-	info->elem = (struct nf_hook_ops *)elem;
-	info->mark = skb->nfmark;
-	info->pf = pf;
-	info->hook = hook;
-	info->okfn = okfn;
-	info->indev = indev;
-	info->outdev = outdev;
-	skb->nfmark = (unsigned long)info;
+	*info = (struct nf_info) { 
+		(struct nf_hook_ops *)elem, pf, hook, indev, outdev, okfn };
 
 	/* Bump dev refs so they don't vanish while packet is out */
 	if (indev) dev_hold(indev);
 	if (outdev) dev_hold(outdev);
 
-	for (i = nf_interested.next; i != &nf_interested; i = i->next) {
-		struct nf_interest *recip = (struct nf_interest *)i;
-
-		if ((recip->hookmask & (1 << info->hook))
-		    && info->pf == recip->pf
-		    && (!recip->mark || info->mark == recip->mark)
-		    && (!recip->reason || skb->nfreason == recip->reason)) {
-			/* FIXME: Andi says: use netlink.  Hmmm... --RR */
-			if (skb_queue_len(&recip->wake->skbq) >= 100) {
-				NFDEBUG("nf_hook: queue to long.\n");
-				goto free_discard;
-			}
-			/* Hand it to userspace for collection */
-			skb_queue_tail(&recip->wake->skbq, skb);
-			NFDEBUG("Waking up pf=%i hook=%u mark=%lu reason=%u\n",
-				pf, hook, skb->nfmark, skb->nfreason);
-			wake_up_interruptible(&recip->wake->sleep);
-
-			return;
-		}
+	status = queue_handler[pf].outfn(skb, info, queue_handler[pf].data);
+	if (status < 0) {
+		/* James M doesn't say fuck enough. */
+		if (indev) dev_put(indev);
+		if (outdev) dev_put(outdev);
+		kfree_s(info, sizeof(*info));
+		kfree_skb(skb);
+		return;
 	}
-	NFDEBUG("nf_hook: noone wants the packet.\n");
-
- free_discard: 
-	if (indev) dev_put(indev);
-	if (outdev) dev_put(outdev);
-
-	kfree_s(info, sizeof(*info));
-	kfree_skb(skb);
 }
 
-/* nf_hook() doesn't have lock, so may give false positive. */
+/* We have BR_NETPROTO_LOCK here */
 int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
 		 struct net_device *indev,
 		 struct net_device *outdev,
@@ -455,21 +432,6 @@
 	unsigned int verdict;
 	int ret = 0;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-	if (pf < 0 || pf >= NPROTO || hook >= NF_MAX_HOOKS) {
-		NFDEBUG("nf_hook: bad vals: pf=%i, hook=%u.\n",
-			pf, hook);
-		kfree_skb(skb);
-		return -EINVAL; /* -ECODERFUCKEDUP ?*/
-	}
-
-	if (skb->nf_debug & (1 << hook)) {
-		NFDEBUG("nf_hook: hook %i already set.\n", hook);
-		nf_dump_skb(pf, skb);
-	}
-	skb->nf_debug |= (1 << hook);
-#endif
-	read_lock_bh(&nf_lock);
 	elem = &nf_hooks[pf][hook];
 	verdict = nf_iterate(&nf_hooks[pf][hook], &skb, hook, indev,
 			     outdev, &elem, okfn);
@@ -477,7 +439,6 @@
 		NFDEBUG("nf_hook: Verdict = QUEUE.\n");
 		nf_queue(skb, elem, pf, hook, indev, outdev, okfn);
 	}
-	read_unlock_bh(&nf_lock);
 
 	switch (verdict) {
 	case NF_ACCEPT:
@@ -493,84 +454,41 @@
 	return ret;
 }
 
-struct nf_waitinfo {
-	unsigned int verdict;
-	struct task_struct *owner;
-};
-
-/* For netfilter device. */
-void nf_register_interest(struct nf_interest *interest)
+void nf_reinject(struct sk_buff *skb, struct nf_info *info,
+		 unsigned int verdict)
 {
-	/* First in, best dressed. */
-	write_lock_bh(&nf_lock);
-	list_add(&interest->list, &nf_interested);
-	write_unlock_bh(&nf_lock);
-}
-
-void nf_unregister_interest(struct nf_interest *interest)
-{
-	struct sk_buff *skb;
-
-	write_lock_bh(&nf_lock);
-	list_del(&interest->list);
-	write_unlock_bh(&nf_lock);
-
-	/* Blow away any queued skbs; this is overzealous. */
-	while ((skb = skb_dequeue(&interest->wake->skbq)) != NULL)
-		nf_reinject(skb, 0, NF_DROP);
-}
-
-void nf_getinfo(const struct sk_buff *skb, 
-		struct net_device **indev,
-		struct net_device **outdev,
-		unsigned long *mark)
-{
-	const struct nf_info *info = (const struct nf_info *)skb->nfmark;
-
-	*indev = info->indev;
-	*outdev = info->outdev;
-	*mark = info->mark;
-}
-
-void nf_reinject(struct sk_buff *skb, unsigned long mark, unsigned int verdict)
-{
-	struct nf_info *info = (struct nf_info *)skb->nfmark;
 	struct list_head *elem = &info->elem->list;
 	struct list_head *i;
 
-	read_lock_bh(&nf_lock);
-
+	/* We don't have BR_NETPROTO_LOCK here */
+	br_read_lock_bh(BR_NETPROTO_LOCK);
 	for (i = nf_hooks[info->pf][info->hook].next; i != elem; i = i->next) {
 		if (i == &nf_hooks[info->pf][info->hook]) {
 			/* The module which sent it to userspace is gone. */
+			NFDEBUG("%s: module disappeared, dropping packet.\n",
+			         __FUNCTION__);
 			verdict = NF_DROP;
 			break;
 		}
 	}
 
-	/* Continue traversal iff userspace said ok, and devices still
-           exist... */
+	/* Continue traversal iff userspace said ok... */
 	if (verdict == NF_ACCEPT) {
-		skb->nfmark = mark;
 		verdict = nf_iterate(&nf_hooks[info->pf][info->hook],
 				     &skb, info->hook, 
 				     info->indev, info->outdev, &elem,
 				     info->okfn);
 	}
 
-	if (verdict == NF_QUEUE) {
-		nf_queue(skb, elem, info->pf, info->hook, 
-			 info->indev, info->outdev, info->okfn);
-	}
-	read_unlock_bh(&nf_lock);
-
 	switch (verdict) {
 	case NF_ACCEPT:
-		local_bh_disable();
 		info->okfn(skb);
-		local_bh_enable();
 		break;
 
+	case NF_QUEUE:
+		nf_queue(skb, elem, info->pf, info->hook, 
+			 info->indev, info->outdev, info->okfn);
+
 	case NF_DROP:
 		kfree_skb(skb);
 		break;
@@ -579,51 +497,17 @@
 	/* Release those devices we held, or Alexey will kill me. */
 	if (info->indev) dev_put(info->indev);
 	if (info->outdev) dev_put(info->outdev);
-
+	
 	kfree_s(info, sizeof(*info));
 	return;
 }
 
-/* FIXME: Before cache is ever used, this must be implemented for real. */
-void nf_invalidate_cache(int pf)
-{
-}
-
-#ifdef CONFIG_NETFILTER_DEBUG
-
-void debug_print_hooks_ip(unsigned int nf_debug)
-{
-	if (nf_debug & (1 << NF_IP_PRE_ROUTING)) {
-		printk("PRE_ROUTING ");
-		nf_debug ^= (1 << NF_IP_PRE_ROUTING);
-	}
-	if (nf_debug & (1 << NF_IP_LOCAL_IN)) {
-		printk("LOCAL_IN ");
-		nf_debug ^= (1 << NF_IP_LOCAL_IN);
-	}
-	if (nf_debug & (1 << NF_IP_FORWARD)) {
-		printk("FORWARD ");
-		nf_debug ^= (1 << NF_IP_FORWARD);
-	}
-	if (nf_debug & (1 << NF_IP_LOCAL_OUT)) {
-		printk("LOCAL_OUT ");
-		nf_debug ^= (1 << NF_IP_LOCAL_OUT);
-	}
-	if (nf_debug & (1 << NF_IP_POST_ROUTING)) {
-		printk("POST_ROUTING ");
-		nf_debug ^= (1 << NF_IP_POST_ROUTING);
-	}
-	if (nf_debug)
-		printk("Crap bits: 0x%04X", nf_debug);
-	printk("\n");
-}
-#endif /* CONFIG_NETFILTER_DEBUG */
-
 void __init netfilter_init(void)
 {
 	int i, h;
 
-	for (i = 0; i < NPROTO; i++)
+	for (i = 0; i < NPROTO; i++) {
 		for (h = 0; h < NF_MAX_HOOKS; h++)
 			INIT_LIST_HEAD(&nf_hooks[i][h]);
+	}
 }
diff -u --recursive --new-file v2.3.48/linux/net/core/rtnetlink.c linux/net/core/rtnetlink.c
--- v2.3.48/linux/net/core/rtnetlink.c	Sun Feb 20 21:12:40 2000
+++ linux/net/core/rtnetlink.c	Sun Feb 27 18:45:10 2000
@@ -171,7 +171,7 @@
 	r->ifi_flags = dev->flags;
 	r->ifi_change = change;
 
-	if (! netif_running(dev))
+	if (!netif_running(dev) || !netif_carrier_ok(dev))
 		r->ifi_flags &= ~IFF_RUNNING;
 	else
 		r->ifi_flags |= IFF_RUNNING;
diff -u --recursive --new-file v2.3.48/linux/net/core/sock.c linux/net/core/sock.c
--- v2.3.48/linux/net/core/sock.c	Fri Jan 28 15:09:09 2000
+++ linux/net/core/sock.c	Sun Feb 27 18:45:10 2000
@@ -7,7 +7,7 @@
  *		handler for protocols to use and generic option handler.
  *
  *
- * Version:	$Id: sock.c,v 1.89 2000/01/18 08:24:13 davem Exp $
+ * Version:	$Id: sock.c,v 1.90 2000/02/27 19:48:11 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -526,7 +526,20 @@
 			if(copy_to_user((void*)optval, &sk->peercred, len))
 				return -EFAULT;
 			goto lenout;
-			
+
+		case SO_PEERNAME:
+		{
+			char address[128];
+
+			if (sock->ops->getname(sock, (struct sockaddr *)address, &lv, 2))
+				return -ENOTCONN;
+			if (lv < len)
+				return -EINVAL;
+			if(copy_to_user((void*)optval, address, len))
+				return -EFAULT;
+			goto lenout;
+		}
+
 		default:
 			return(-ENOPROTOOPT);
 	}
diff -u --recursive --new-file v2.3.48/linux/net/decnet/TODO linux/net/decnet/TODO
--- v2.3.48/linux/net/decnet/TODO	Thu Feb 10 17:11:24 2000
+++ linux/net/decnet/TODO	Thu Mar  2 10:13:17 2000
@@ -16,10 +16,6 @@
 
  o sendmsg() in the raw socket layer (yes, its for sending routing messages)
 
- o Better filtering of traffic in raw sockets. Aside from receiving routing
-   messages, there really doesn't seem to be a lot else that raw sockets
-   could be useful for... suggestions on a postcard please :-)
-
  o Fix /proc for raw sockets
 
  o Lots of testing with real applications
diff -u --recursive --new-file v2.3.48/linux/net/decnet/af_decnet.c linux/net/decnet/af_decnet.c
--- v2.3.48/linux/net/decnet/af_decnet.c	Sat Feb 26 22:32:08 2000
+++ linux/net/decnet/af_decnet.c	Thu Mar  2 10:13:17 2000
@@ -106,6 +106,7 @@
 #include <linux/netdevice.h>
 #include <linux/inet.h>
 #include <linux/route.h>
+#include <linux/netfilter.h>
 #include <net/sock.h>
 #include <asm/segment.h>
 #include <asm/system.h>
@@ -1005,6 +1006,12 @@
 
 	memcpy(&newsk->protinfo.dn.addr, &sk->protinfo.dn.addr, sizeof(struct sockaddr_dn));
 
+	/*
+	 * If we are listening on a wild socket, we don't want
+	 * the newly created socket on the wrong hash queue.
+	 */
+	newsk->protinfo.dn.addr.sdn_flags &= ~SDF_WILD;
+
 	skb_pull(skb, dn_username2sockaddr(skb->data, skb->len, &newsk->protinfo.dn.addr, &type));
 	skb_pull(skb, dn_username2sockaddr(skb->data, skb->len, &newsk->protinfo.dn.peer, &type));
 	*(dn_address *)newsk->protinfo.dn.peer.sdn_add.a_addr = cb->src;
@@ -1300,9 +1307,6 @@
 	struct dn_scp *scp = &sk->protinfo.dn;
 	struct optdata_dn opt;
 	struct accessdata_dn acc;
-#ifdef CONFIG_DECNET_FW
-	char tmp_fw[MAX(sizeof(struct dn_fwtest),sizeof(struct dn_fwnew))];
-#endif
 	int err;
 
 	if (optlen && !optval)
@@ -1404,34 +1408,15 @@
 			dn_nsp_send_disc(sk, 0x38, 0, GFP_KERNEL);
 			break;
 
-#ifdef CONFIG_DECNET_FW
-                case DN_FW_APPEND:
-                case DN_FW_REPLACE:
-                case DN_FW_DELETE:
-                case DN_FW_DELETE_NUM:
-                case DN_FW_INSERT:
-                case DN_FW_FLUSH:
-                case DN_FW_ZERO:
-                case DN_FW_CHECK:
-                case DN_FW_CREATECHAIN:
-                case DN_FW_DELETECHAIN:
-                case DN_FW_POLICY:
-
-                        if (!capable(CAP_NET_ADMIN))
-                                return -EACCES;
-                        if ((optlen > sizeof(tmp_fw)) || (optlen < 1))
-                                return -EINVAL;
-                        if (copy_from_user(&tmp_fw, optval, optlen))
-                                return -EFAULT;
-                        err = dn_fw_ctl(optname, &tmp_fw, optlen);
-                        return err;
-#endif
 		default:
+#ifdef CONFIG_NETFILTER
+		return nf_setsockopt(sk, PF_DECnet, optname, optval, optlen);
+#endif
 		case DSO_LINKINFO:
 		case DSO_STREAM:
 		case DSO_SEQPACKET:
 
-			return -EOPNOTSUPP;
+			return -ENOPROTOOPT;
 	}
 
 	return 0;
@@ -1511,12 +1496,22 @@
 				return -EFAULT;
 			break;
 
+		default:
+#ifdef CONFIG_NETFILTER
+		{
+			int val, len = *optlen;
+			val = nf_getsockopt(sk, PF_DECnet, optname, 
+							optval, &len);
+			if (val >= 0)
+				val = put_user(len, optlen);
+			return val;
+		}
+#endif
 		case DSO_STREAM:
 		case DSO_SEQPACKET:
 		case DSO_CONACCEPT:
 		case DSO_CONREJECT:
-		default:
-        		return -EOPNOTSUPP;
+        		return -ENOPROTOOPT;
 	}
 
 	return 0;
@@ -1975,7 +1970,7 @@
 	__constant_htons(ETH_P_DNA_RT),
 	NULL,		/* All devices */
 	dn_route_rcv,
-	NULL,
+	(void*)1,
 	NULL,
 };
 
diff -u --recursive --new-file v2.3.48/linux/net/decnet/dn_neigh.c linux/net/decnet/dn_neigh.c
--- v2.3.48/linux/net/decnet/dn_neigh.c	Tue Jan 11 22:31:46 2000
+++ linux/net/decnet/dn_neigh.c	Thu Mar  2 10:13:17 2000
@@ -432,7 +432,7 @@
 /*
  * Ethernet router hello message received
  */
-void dn_neigh_router_hello(struct sk_buff *skb)
+int dn_neigh_router_hello(struct sk_buff *skb)
 {
 	struct rtnode_hello_message *msg = (struct rtnode_hello_message *)skb->data;
 
@@ -485,12 +485,13 @@
 	}
 
 	kfree_skb(skb);
+	return 0;
 }
 
 /*
  * Endnode hello message received
  */
-void dn_neigh_endnode_hello(struct sk_buff *skb)
+int dn_neigh_endnode_hello(struct sk_buff *skb)
 {
 	struct endnode_hello_message *msg = (struct endnode_hello_message *)skb->data;
 	struct neighbour *neigh;
@@ -523,6 +524,7 @@
 	}
 
 	kfree_skb(skb);
+	return 0;
 }
 
 
diff -u --recursive --new-file v2.3.48/linux/net/decnet/dn_nsp_in.c linux/net/decnet/dn_nsp_in.c
--- v2.3.48/linux/net/decnet/dn_nsp_in.c	Thu Feb 10 17:11:24 2000
+++ linux/net/decnet/dn_nsp_in.c	Thu Mar  2 10:13:17 2000
@@ -320,7 +320,7 @@
 	struct dn_scp *scp = &sk->protinfo.dn;
 	unsigned short reason;
 
-	if (skb->len != 2)
+	if (skb->len < 2)
 		goto out;
 
 	reason = dn_ntohs(*(__u16 *)skb->data);
diff -u --recursive --new-file v2.3.48/linux/net/decnet/dn_nsp_out.c linux/net/decnet/dn_nsp_out.c
--- v2.3.48/linux/net/decnet/dn_nsp_out.c	Tue Jan 11 22:31:46 2000
+++ linux/net/decnet/dn_nsp_out.c	Thu Mar  2 10:13:17 2000
@@ -19,6 +19,7 @@
  *                       Moved output state machine into one function
  *    Steve Whitehouse:  New output state machine
  *         Paul Koning:  Connect Confirm message fix.
+ *      Eduardo Serrat:  Fix to stop dn_nsp_do_disc() sending malformed packets.
  */
 
 /******************************************************************************
@@ -510,7 +511,7 @@
 			int ddl, unsigned char *dd, __u16 rem, __u16 loc)
 {
 	struct sk_buff *skb = NULL;
-	int size = 7 + (ddl ? (ddl + 1) : 0);
+	int size = 8 + ddl;
 	unsigned char *msg;
 
 	if ((dst == NULL) || (rem == 0)) {
@@ -530,9 +531,9 @@
 	msg += 2;
 	*(__u16 *)msg = dn_htons(reason);
 	msg += 2;
+	*msg++ = ddl;
 
 	if (ddl) {
-		*msg++ = ddl;
 		memcpy(msg, dd, ddl);
 	}
 
diff -u --recursive --new-file v2.3.48/linux/net/decnet/dn_route.c linux/net/decnet/dn_route.c
--- v2.3.48/linux/net/decnet/dn_route.c	Thu Feb 10 17:11:24 2000
+++ linux/net/decnet/dn_route.c	Thu Mar  2 10:13:17 2000
@@ -30,6 +30,9 @@
  *                                 my copying the IPv4 routing code. The
  *                                 hooks here are modified and will continue
  *                                 to evolve for a while.
+ *              Steve Whitehouse : Real SMP at last :-) Also new netfilter
+ *                                 stuff. Look out raw sockets your days
+ *                                 are numbered!
  */
 
 /******************************************************************************
@@ -359,9 +362,22 @@
         return 0;
 }
 
+static int dn_route_discard(struct sk_buff *skb)
+{
+	kfree_skb(skb);
+	return 0;
+}
+
+static int dn_route_ptp_hello(struct sk_buff *skb)
+{
+	dn_dev_hello(skb);
+	dn_neigh_pointopoint_hello(skb);
+	return 0;
+}
+
 int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
 {
-	struct dn_skb_cb *cb = (struct dn_skb_cb *)skb->cb;
+	struct dn_skb_cb *cb;
 	unsigned char flags = 0;
 	int padlen = 0;
 	__u16 len = dn_ntohs(*(__u16 *)skb->data);
@@ -370,8 +386,8 @@
 	if (dn == NULL)
 		goto dump_it;
 
-	cb->stamp = jiffies;
-	cb->iif = dev->ifindex;
+	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
+		goto out;
 
 	skb_pull(skb, 2);
 
@@ -382,6 +398,10 @@
 
 	flags = *skb->data;
 
+	cb = (struct dn_skb_cb *)skb->cb;
+	cb->stamp = jiffies;
+	cb->iif = dev->ifindex;
+
 	/*
 	 * If we have padding, remove it.
 	 */
@@ -426,24 +446,20 @@
 
 		switch(flags & DN_RT_CNTL_MSK) {
                 	case DN_RT_PKT_HELO:
-				dn_dev_hello(skb);
-				dn_neigh_pointopoint_hello(skb);
-				return 0;
+				NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_route_ptp_hello);
+				goto out;
 
                 	case DN_RT_PKT_L1RT:
                 	case DN_RT_PKT_L2RT:
-#ifdef CONFIG_DECNET_ROUTER
-				return dn_fib_rt_message(skb);
-#else
-                      		break;
-#endif /* CONFIG_DECNET_ROUTER */
+                                NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard);
+                      		goto out;
                 	case DN_RT_PKT_ERTH:
-				dn_neigh_router_hello(skb);
-                        	return 0;
+				NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_router_hello);
+                        	goto out;
 
                 	case DN_RT_PKT_EEDH:
-				dn_neigh_endnode_hello(skb);
-                        	return 0;
+				NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_endnode_hello);
+                        	goto out;
                 }
         } else {
 		if (dn->parms.state != DN_DEV_S_RU)
@@ -461,6 +477,7 @@
 
 dump_it:
 	kfree_skb(skb);
+out:
 	return 0;
 }
 
diff -u --recursive --new-file v2.3.48/linux/net/ipv4/icmp.c linux/net/ipv4/icmp.c
--- v2.3.48/linux/net/ipv4/icmp.c	Thu Feb 10 17:11:24 2000
+++ linux/net/ipv4/icmp.c	Sat Feb 26 22:34:27 2000
@@ -3,7 +3,7 @@
  *	
  *		Alan Cox, <alan@redhat.com>
  *
- *	Version: $Id: icmp.c,v 1.64 2000/02/09 11:16:40 davem Exp $
+ *	Version: $Id: icmp.c,v 1.65 2000/02/22 23:54:25 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU General Public License
@@ -801,9 +801,10 @@
 
 	/*
 	 *	This can't change while we are doing it. 
+	 *	Callers have obtained BR_NETPROTO_LOCK so
+	 *	we are OK.
 	 */
 
-	read_lock(&inet_protocol_lock);
 	ipprot = (struct inet_protocol *) inet_protos[hash];
 	while(ipprot != NULL) {
 		struct inet_protocol *nextip;
@@ -822,7 +823,6 @@
 
 		ipprot = nextip;
   	}
-	read_unlock(&inet_protocol_lock);
 }
 
 
diff -u --recursive --new-file v2.3.48/linux/net/ipv4/ip_input.c linux/net/ipv4/ip_input.c
--- v2.3.48/linux/net/ipv4/ip_input.c	Fri Jan 28 15:09:09 2000
+++ linux/net/ipv4/ip_input.c	Sat Feb 26 22:34:27 2000
@@ -5,7 +5,7 @@
  *
  *		The Internet Protocol (IP) module.
  *
- * Version:	$Id: ip_input.c,v 1.45 2000/01/16 05:11:22 davem Exp $
+ * Version:	$Id: ip_input.c,v 1.46 2000/02/22 23:54:26 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -241,7 +241,6 @@
 		if(raw_sk != NULL)
 			raw_sk = raw_v4_input(skb, iph, hash);
 
-		read_lock(&inet_protocol_lock);
 		ipprot = (struct inet_protocol *) inet_protos[hash];
 		flag = 0;
 		if(ipprot != NULL) {
@@ -254,13 +253,11 @@
 				ret = ipprot->handler(skb, (ntohs(iph->tot_len) -
 							    (iph->ihl * 4)));
 
-				read_unlock(&inet_protocol_lock);
 				return ret;
 			} else {
 				flag = ip_run_ipprot(skb, iph, ipprot, (raw_sk != NULL));
 			}
 		}
-		read_unlock(&inet_protocol_lock);
 
 		/* All protocols checked.
 		 * If this packet was a broadcast, we may *not* reply to it, since that
diff -u --recursive --new-file v2.3.48/linux/net/ipv4/protocol.c linux/net/ipv4/protocol.c
--- v2.3.48/linux/net/ipv4/protocol.c	Thu Aug 26 13:05:46 1999
+++ linux/net/ipv4/protocol.c	Sat Feb 26 22:34:27 2000
@@ -5,7 +5,7 @@
  *
  *		INET protocol dispatch tables.
  *
- * Version:	$Id: protocol.c,v 1.10 1999/08/20 11:05:55 davem Exp $
+ * Version:	$Id: protocol.c,v 1.11 2000/02/22 23:54:26 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -35,6 +35,7 @@
 #include <linux/inet.h>
 #include <linux/netdevice.h>
 #include <linux/timer.h>
+#include <linux/brlock.h>
 #include <net/ip.h>
 #include <net/protocol.h>
 #include <net/tcp.h>
@@ -116,8 +117,6 @@
 	NULL
 };
 
-rwlock_t inet_protocol_lock = RW_LOCK_UNLOCKED;
-
 /*
  *	Add a protocol handler to the hash tables
  */
@@ -128,7 +127,7 @@
 	struct inet_protocol *p2;
 
 	hash = prot->protocol & (MAX_INET_PROTOS - 1);
-	write_lock_bh(&inet_protocol_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	prot ->next = inet_protos[hash];
 	inet_protos[hash] = prot;
 	prot->copy = 0;
@@ -147,7 +146,7 @@
 		}
 		p2 = (struct inet_protocol *) p2->next;
 	}
-	write_unlock_bh(&inet_protocol_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 }
 
 /*
@@ -161,11 +160,11 @@
 	unsigned char hash;
 
 	hash = prot->protocol & (MAX_INET_PROTOS - 1);
-	write_lock_bh(&inet_protocol_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	if (prot == inet_protos[hash]) 
 	{
 		inet_protos[hash] = (struct inet_protocol *) inet_protos[hash]->next;
-		write_unlock_bh(&inet_protocol_lock);
+		br_write_unlock_bh(BR_NETPROTO_LOCK);
 		return(0);
 	}
 
@@ -186,7 +185,7 @@
 			if (p->copy == 0 && lp != NULL) 
 				lp->copy = 0;
 			p->next = prot->next;
-			write_unlock_bh(&inet_protocol_lock);
+			br_write_unlock_bh(BR_NETPROTO_LOCK);
 			return(0);
 		}
 		if (p->next != NULL && p->next->protocol == prot->protocol) 
@@ -194,6 +193,6 @@
 
 		p = (struct inet_protocol *) p->next;
 	}
-	write_unlock_bh(&inet_protocol_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 	return(-1);
 }
diff -u --recursive --new-file v2.3.48/linux/net/ipv4/tcp_input.c linux/net/ipv4/tcp_input.c
--- v2.3.48/linux/net/ipv4/tcp_input.c	Thu Feb 10 17:11:24 2000
+++ linux/net/ipv4/tcp_input.c	Sun Feb 27 18:45:10 2000
@@ -5,7 +5,7 @@
  *
  *		Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:	$Id: tcp_input.c,v 1.188 2000/02/08 21:27:14 davem Exp $
+ * Version:	$Id: tcp_input.c,v 1.189 2000/02/27 19:52:55 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -534,6 +534,9 @@
 			sk->err = ECONNRESET;
 	}
 
+	if (!sk->dead)
+		sk->error_report(sk);
+
 	tcp_done(sk);
 }
 
@@ -1660,7 +1663,12 @@
 
 	if (!sk->dead) {
 		sk->state_change(sk);
-		sock_wake_async(sk->socket, 1, POLL_HUP);
+
+		/* Do not send POLL_HUP for half duplex close. */
+		if (sk->shutdown == SHUTDOWN_MASK || sk->state == TCP_CLOSE)
+			sock_wake_async(sk->socket, 1, POLL_HUP);
+		else
+			sock_wake_async(sk->socket, 1, POLL_IN);
 	}
 }
 
diff -u --recursive --new-file v2.3.48/linux/net/ipv4/udp.c linux/net/ipv4/udp.c
--- v2.3.48/linux/net/ipv4/udp.c	Fri Jan 28 15:09:09 2000
+++ linux/net/ipv4/udp.c	Sun Feb 27 18:45:10 2000
@@ -5,7 +5,7 @@
  *
  *		The User Datagram Protocol (UDP).
  *
- * Version:	$Id: udp.c,v 1.79 2000/01/18 08:24:20 davem Exp $
+ * Version:	$Id: udp.c,v 1.80 2000/02/27 19:51:43 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -798,6 +798,7 @@
 	sk->rcv_saddr = 0;
 	sk->daddr = 0;
 	sk->dport = 0;
+	sk->bound_dev_if = 0;
 	sk_dst_reset(sk);
 	return 0;
 }
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c
--- v2.3.48/linux/net/ipv6/af_inet6.c	Sun Feb 13 19:29:04 2000
+++ linux/net/ipv6/af_inet6.c	Sun Feb 27 18:45:10 2000
@@ -7,7 +7,10 @@
  *
  *	Adapted from linux/net/ipv4/af_inet.c
  *
- *	$Id: af_inet6.c,v 1.54 2000/02/12 23:34:45 davem Exp $
+ *	$Id: af_inet6.c,v 1.55 2000/02/27 19:51:47 davem Exp $
+ *
+ * 	Fixes:
+ * 	Hideaki YOSHIFUJI	:	sin6_scope_id support
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -220,9 +223,8 @@
 	if(sk->prot->bind)
 		return sk->prot->bind(sk, uaddr, addr_len);
 
-	if (addr_len < sizeof(struct sockaddr_in6))
+	if (addr_len < SIN6_LEN_RFC2133)
 		return -EINVAL;
-
 	addr_type = ipv6_addr_type(&addr->sin6_addr);
 	if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
 		return -EINVAL;
@@ -258,6 +260,22 @@
 		return -EINVAL;
 	}
 
+	if (addr_type & IPV6_ADDR_LINKLOCAL) {
+		if (addr_len >= sizeof(struct sockaddr_in6) &&
+		    addr->sin6_scope_id) {
+			/* Override any existing binding, if another one
+			 * is supplied by user.
+			 */
+			sk->bound_dev_if = addr->sin6_scope_id;
+		}
+
+		/* Binding to link-local address requires an interface */
+		if (sk->bound_dev_if == 0) {
+			release_sock(sk);
+			return -EINVAL;
+		}
+	}
+
 	sk->rcv_saddr = v4addr;
 	sk->saddr = v4addr;
 
@@ -338,6 +356,7 @@
   
 	sin->sin6_family = AF_INET6;
 	sin->sin6_flowinfo = 0;
+	sin->sin6_scope_id = 0;
 	if (peer) {
 		if (!sk->dport)
 			return -ENOTCONN;
@@ -360,7 +379,9 @@
 
 		sin->sin6_port = sk->sport;
 	}
-	*uaddr_len = sizeof(*sin);	
+	if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
+		sin->sin6_scope_id = sk->bound_dev_if;
+	*uaddr_len = sizeof(*sin);
 	return(0);
 }
 
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/datagram.c linux/net/ipv6/datagram.c
--- v2.3.48/linux/net/ipv6/datagram.c	Thu Aug 26 13:05:46 1999
+++ linux/net/ipv6/datagram.c	Sun Feb 27 18:45:10 2000
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: datagram.c,v 1.18 1999/08/20 11:06:17 davem Exp $
+ *	$Id: datagram.c,v 1.19 2000/02/27 19:51:47 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -134,14 +134,20 @@
 		sin->sin6_family = AF_INET6;
 		sin->sin6_flowinfo = 0;
 		sin->sin6_port = serr->port; 
+		sin->sin6_scope_id = 0;
 		if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
 			memcpy(&sin->sin6_addr, skb->nh.raw + serr->addr_offset, 16);
 			if (sk->net_pinfo.af_inet6.sndflow)
 				sin->sin6_flowinfo = *(u32*)(skb->nh.raw + serr->addr_offset - 24) & IPV6_FLOWINFO_MASK;
-		} else
+			if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
+				struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
+				sin->sin6_scope_id = opt->iif;
+			}
+		} else {
 			ipv6_addr_set(&sin->sin6_addr, 0, 0,
 				      __constant_htonl(0xffff),
 				      *(u32*)(skb->nh.raw + serr->addr_offset));
+		}
 	}
 
 	memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err));
@@ -154,6 +160,10 @@
 			memcpy(&sin->sin6_addr, &skb->nh.ipv6h->saddr, 16);
 			if (sk->net_pinfo.af_inet6.rxopt.all)
 				datagram_recv_ctl(sk, msg, skb);
+			if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
+				struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
+				sin->sin6_scope_id = opt->iif;
+			}
 		} else {
 			ipv6_addr_set(&sin->sin6_addr, 0, 0,
 				      __constant_htonl(0xffff),
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/icmp.c linux/net/ipv6/icmp.c
--- v2.3.48/linux/net/ipv6/icmp.c	Fri Jan 28 15:09:09 2000
+++ linux/net/ipv6/icmp.c	Sat Feb 26 22:34:27 2000
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>
  *
- *	$Id: icmp.c,v 1.26 2000/01/19 04:06:19 davem Exp $
+ *	$Id: icmp.c,v 1.27 2000/02/22 23:54:28 davem Exp $
  *
  *	Based on net/ipv4/icmp.c
  *
@@ -477,7 +477,6 @@
 
 	hash = nexthdr & (MAX_INET_PROTOS - 1);
 
-	read_lock(&inet6_protocol_lock);
 	for (ipprot = (struct inet6_protocol *) inet6_protos[hash]; 
 	     ipprot != NULL; 
 	     ipprot=(struct inet6_protocol *)ipprot->next) {
@@ -487,7 +486,6 @@
 		if (ipprot->err_handler)
 			ipprot->err_handler(skb, hdr, NULL, type, code, pb, info);
 	}
-	read_unlock(&inet6_protocol_lock);
 
 	read_lock(&raw_v6_lock);
 	if ((sk = raw_v6_htable[hash]) != NULL) {
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/ip6_input.c linux/net/ipv6/ip6_input.c
--- v2.3.48/linux/net/ipv6/ip6_input.c	Tue Jan 11 22:31:46 2000
+++ linux/net/ipv6/ip6_input.c	Sun Feb 27 18:45:10 2000
@@ -6,7 +6,7 @@
  *	Pedro Roque		<roque@di.fc.ul.pt>
  *	Ian P. Morris		<I.P.Morris@soton.ac.uk>
  *
- *	$Id: ip6_input.c,v 1.15 2000/01/09 02:19:54 davem Exp $
+ *	$Id: ip6_input.c,v 1.17 2000/02/27 19:42:53 davem Exp $
  *
  *	Based in linux/net/ipv4/ip_input.c
  *
@@ -26,6 +26,9 @@
 #include <linux/in6.h>
 #include <linux/icmpv6.h>
 
+#include <linux/netfilter.h>
+#include <linux/netfilter_ipv6.h>
+
 #include <net/sock.h>
 #include <net/snmp.h>
 
@@ -38,6 +41,16 @@
 #include <net/addrconf.h>
 
 
+
+static inline int ip6_rcv_finish( struct sk_buff *skb) 
+{
+
+	if (skb->dst == NULL)
+		ip6_route_input(skb);
+
+	return skb->dst->input(skb);
+}
+
 int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
 {
 	struct ipv6hdr *hdr;
@@ -77,12 +90,7 @@
 			return 0;
 		}
 	}
-
-	if (skb->dst == NULL)
-		ip6_route_input(skb);
-
-	return skb->dst->input(skb);
-
+	return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
 truncated:
 	IP6_INC_STATS_BH(Ip6InTruncatedPkts);
 err:
@@ -97,7 +105,8 @@
  *	Deliver the packet to the host
  */
 
-int ip6_input(struct sk_buff *skb)
+
+static inline int ip6_input_finish(struct sk_buff *skb)
 {
 	struct ipv6hdr *hdr = skb->nh.ipv6h;
 	struct inet6_protocol *ipprot;
@@ -147,7 +156,6 @@
 		raw_sk = ipv6_raw_deliver(skb, nexthdr, len);
 
 	hash = nexthdr & (MAX_INET_PROTOS - 1);
-	read_lock(&inet6_protocol_lock);
 	for (ipprot = (struct inet6_protocol *) inet6_protos[hash]; 
 	     ipprot != NULL; 
 	     ipprot = (struct inet6_protocol *) ipprot->next) {
@@ -163,7 +171,6 @@
 			ipprot->handler(buff, len);
 		found = 1;
 	}
-	read_unlock(&inet6_protocol_lock);
 
 	if (raw_sk) {
 		rawv6_rcv(raw_sk, skb, len);
@@ -180,6 +187,12 @@
 	}
 
 	return 0;
+}
+
+
+int ip6_input(struct sk_buff *skb)
+{
+	return NF_HOOK(PF_INET6,NF_IP6_LOCAL_IN, skb, skb->dev, NULL, ip6_input_finish);
 }
 
 int ip6_mc_input(struct sk_buff *skb)
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/ip6_output.c linux/net/ipv6/ip6_output.c
--- v2.3.48/linux/net/ipv6/ip6_output.c	Tue Jan 11 22:31:46 2000
+++ linux/net/ipv6/ip6_output.c	Thu Mar  2 11:41:11 2000
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: ip6_output.c,v 1.24 2000/01/09 02:19:49 davem Exp $
+ *	$Id: ip6_output.c,v 1.26 2000/03/01 02:58:12 davem Exp $
  *
  *	Based on linux/net/ipv4/ip_output.c
  *
@@ -24,6 +24,7 @@
  *      H. von Brand    :       Added missing #include <linux/string.h>
  */
 
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/string.h>
@@ -34,6 +35,9 @@
 #include <linux/in6.h>
 #include <linux/route.h>
 
+#include <linux/netfilter.h>
+#include <linux/netfilter_ipv6.h>
+
 #include <net/sock.h>
 #include <net/snmp.h>
 
@@ -57,11 +61,44 @@
 	spin_unlock_bh(&ip6_id_lock);
 }
 
+static inline int ip6_output_finish(struct sk_buff *skb)
+{
+
+	struct dst_entry *dst = skb->dst;
+	struct hh_cache *hh = dst->hh;
+
+	if (hh) {
+		read_lock_bh(&hh->hh_lock);
+		memcpy(skb->data - 16, hh->hh_data, 16);
+		read_unlock_bh(&hh->hh_lock);
+	        skb_push(skb, hh->hh_len);
+		return hh->hh_output(skb);
+	} else if (dst->neighbour)
+		return dst->neighbour->output(skb);
+
+	kfree_skb(skb);
+	return -EINVAL;
+
+}
+
+/* dev_loopback_xmit for use with netfilter. */
+static int ip6_dev_loopback_xmit(struct sk_buff *newskb)
+{
+	newskb->mac.raw = newskb->data;
+	skb_pull(newskb, newskb->nh.raw - newskb->data);
+	newskb->pkt_type = PACKET_LOOPBACK;
+	newskb->ip_summed = CHECKSUM_UNNECESSARY;
+	BUG_TRAP(newskb->dst);
+
+	netif_rx(newskb);
+	return 0;
+}
+
+
 int ip6_output(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
 	struct net_device *dev = dst->dev;
-	struct hh_cache *hh = dst->hh;
 
 	skb->protocol = __constant_htons(ETH_P_IPV6);
 	skb->dev = dev;
@@ -70,10 +107,15 @@
 		if (!(dev->flags&IFF_LOOPBACK) &&
 		    (skb->sk == NULL || skb->sk->net_pinfo.af_inet6.mc_loop) &&
 		    ipv6_chk_mcast_addr(dev, &skb->nh.ipv6h->daddr)) {
+			struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
+
 			/* Do not check for IFF_ALLMULTI; multicast routing
 			   is not supported in any case.
 			 */
-			dev_loopback_xmit(skb);
+			if (newskb)
+				NF_HOOK(PF_INET, NF_IP6_POST_ROUTING, newskb, NULL,
+					newskb->dev,
+					ip6_dev_loopback_xmit);
 
 			if (skb->nh.ipv6h->hop_limit == 0) {
 				kfree_skb(skb);
@@ -84,17 +126,51 @@
 		IP6_INC_STATS(Ip6OutMcastPkts);
 	}
 
-	if (hh) {
-		read_lock_bh(&hh->hh_lock);
-		memcpy(skb->data - 16, hh->hh_data, 16);
-		read_unlock_bh(&hh->hh_lock);
-	        skb_push(skb, hh->hh_len);
-		return hh->hh_output(skb);
-	} else if (dst->neighbour)
-		return dst->neighbour->output(skb);
+	return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb,NULL, skb->dev,ip6_output_finish);
+}
 
-	kfree_skb(skb);
-	return -EINVAL;
+
+#ifdef CONFIG_NETFILTER
+static int route6_me_harder(struct sk_buff *skb)
+{
+	struct ipv6hdr *iph = skb->nh.ipv6h;
+	struct dst_entry *dst;
+	struct flowi fl;
+
+	fl.proto = iph->nexthdr;
+	fl.fl6_dst = &iph->daddr;
+	fl.fl6_src = &iph->saddr;
+	fl.oif = skb->sk ? skb->sk->bound_dev_if : 0;
+	fl.fl6_flowlabel = 0;
+	fl.uli_u.ports.dport = 0;
+	fl.uli_u.ports.sport = 0;
+
+	dst = ip6_route_output(skb->sk, &fl);
+
+	if (dst->error) {
+		printk(KERN_DEBUG "route6_me_harder: No more route.\n");
+		return -EINVAL;
+	}
+
+	/* Drop old route. */
+	dst_release(skb->dst);
+
+	skb->dst = dst;
+	return 0;
+}
+#endif
+
+static inline int ip6_maybe_reroute(struct sk_buff *skb)
+{
+#ifdef CONFIG_NETFILTER
+	if (skb->nfcache & NFC_ALTERED){
+		if (route6_me_harder(skb) != 0){
+			kfree_skb(skb);
+			return -EINVAL;
+		}
+	}
+#endif /* CONFIG_NETFILTER */
+	return skb->dst->output(skb);
 }
 
 /*
@@ -159,7 +235,7 @@
 
 	if (skb->len <= dst->pmtu) {
 		IP6_INC_STATS(Ip6OutRequests);
-		return dst->output(skb);
+		return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute);
 	}
 
 	printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
@@ -388,7 +464,7 @@
 
 			IP6_INC_STATS(Ip6FragCreates);
 			IP6_INC_STATS(Ip6OutRequests);
-			err = dst->output(skb);
+			err = NF_HOOK(PF_INET6,NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute);
 			if (err) {
 				kfree_skb(last_skb);
 				return err;
@@ -414,7 +490,7 @@
 	IP6_INC_STATS(Ip6FragCreates);
 	IP6_INC_STATS(Ip6FragOKs);
 	IP6_INC_STATS(Ip6OutRequests);
-	return dst->output(last_skb);
+	return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, last_skb, NULL,dst->dev, ip6_maybe_reroute);
 }
 
 int ip6_build_xmit(struct sock *sk, inet_getfrag_t getfrag, const void *data,
@@ -582,7 +658,7 @@
 
 		if (!err) {
 			IP6_INC_STATS(Ip6OutRequests);
-			err = dst->output(skb);
+			err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute);
 		} else {
 			err = -EFAULT;
 			kfree_skb(skb);
@@ -636,6 +712,11 @@
 	return 0;
 }
 
+static inline int ip6_forward_finish(struct sk_buff *skb)
+{
+	return skb->dst->output(skb);
+}
+
 int ip6_forward(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
@@ -726,7 +807,7 @@
 	hdr->hop_limit--;
 
 	IP6_INC_STATS_BH(Ip6OutForwDatagrams);
-	return dst->output(skb);
+	return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish);
 
 drop:
 	IP6_INC_STATS_BH(Ip6InAddrErrors);
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/ipv6_sockglue.c linux/net/ipv6/ipv6_sockglue.c
--- v2.3.48/linux/net/ipv6/ipv6_sockglue.c	Tue Feb  1 01:35:44 2000
+++ linux/net/ipv6/ipv6_sockglue.c	Sun Feb 27 18:45:10 2000
@@ -7,7 +7,7 @@
  *
  *	Based on linux/net/ipv4/ip_sockglue.c
  *
- *	$Id: ipv6_sockglue.c,v 1.32 2000/01/31 01:21:25 davem Exp $
+ *	$Id: ipv6_sockglue.c,v 1.33 2000/02/27 19:42:54 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -35,6 +35,7 @@
 #include <linux/if_arp.h>
 #include <linux/init.h>
 #include <linux/sysctl.h>
+#include <linux/netfilter.h>
 
 #include <net/sock.h>
 #include <net/snmp.h>
@@ -371,6 +372,14 @@
 	case IPV6_FLOWLABEL_MGR:
 		retv = ipv6_flowlabel_opt(sk, optval, optlen);
 		break;
+
+#ifdef CONFIG_NETFILTER
+	default:
+		retv = nf_setsockopt(sk, PF_INET6, optname, optval, 
+					    optlen);
+		break;
+#endif
+
 	}
 	release_sock(sk);
 
@@ -450,7 +459,17 @@
 		break;
 	}
 	default:
+#ifdef CONFIG_NETFILTER
+		lock_sock(sk);
+		val = nf_getsockopt(sk, PF_INET6, optname, optval, 
+				    &len);
+		release_sock(sk);
+		if (val >= 0)
+			val = put_user(len, optlen);
+		return val;
+#else
 		return -EINVAL;
+#endif
 	}
 	len=min(sizeof(int),len);
 	if(put_user(len, optlen))
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/protocol.c linux/net/ipv6/protocol.c
--- v2.3.48/linux/net/ipv6/protocol.c	Thu Aug 26 13:05:46 1999
+++ linux/net/ipv6/protocol.c	Sat Feb 26 22:34:27 2000
@@ -5,7 +5,7 @@
  *
  *		PF_INET6 protocol dispatch tables.
  *
- * Version:	$Id: protocol.c,v 1.7 1999/08/20 11:06:26 davem Exp $
+ * Version:	$Id: protocol.c,v 1.8 2000/02/22 23:54:29 davem Exp $
  *
  * Authors:	Pedro Roque	<roque@di.fc.ul.pt>
  *
@@ -24,6 +24,7 @@
 #include <linux/in6.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
+#include <linux/brlock.h>
 
 #include <net/sock.h>
 #include <net/snmp.h>
@@ -37,15 +38,13 @@
 	NULL
 };
 
-rwlock_t inet6_protocol_lock = RW_LOCK_UNLOCKED;
-
 void inet6_add_protocol(struct inet6_protocol *prot)
 {
 	unsigned char hash;
 	struct inet6_protocol *p2;
 
 	hash = prot->protocol & (MAX_INET_PROTOS - 1);
-	write_lock_bh(&inet6_protocol_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	prot->next = inet6_protos[hash];
 	inet6_protos[hash] = prot;
 	prot->copy = 0;
@@ -62,7 +61,7 @@
 		}
 		p2 = (struct inet6_protocol *) p2->next;
 	}
-	write_unlock_bh(&inet6_protocol_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 }
 
 /*
@@ -76,10 +75,10 @@
 	unsigned char hash;
 
 	hash = prot->protocol & (MAX_INET_PROTOS - 1);
-	write_lock_bh(&inet6_protocol_lock);
+	br_write_lock_bh(BR_NETPROTO_LOCK);
 	if (prot == inet6_protos[hash]) {
 		inet6_protos[hash] = (struct inet6_protocol *) inet6_protos[hash]->next;
-		write_unlock_bh(&inet6_protocol_lock);
+		br_write_unlock_bh(BR_NETPROTO_LOCK);
 		return(0);
 	}
 
@@ -98,7 +97,7 @@
 			if (p->copy == 0 && lp != NULL) 
 				lp->copy = 0;
 			p->next = prot->next;
-			write_unlock_bh(&inet6_protocol_lock);
+			br_write_unlock_bh(BR_NETPROTO_LOCK);
 			return(0);
 		}
 		if (p->next != NULL && p->next->protocol == prot->protocol) 
@@ -106,6 +105,6 @@
 
 		p = (struct inet6_protocol *) p->next;
 	}
-	write_unlock_bh(&inet6_protocol_lock);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
 	return(-1);
 }
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/raw.c linux/net/ipv6/raw.c
--- v2.3.48/linux/net/ipv6/raw.c	Fri Jan 28 15:09:09 2000
+++ linux/net/ipv6/raw.c	Sun Feb 27 18:45:10 2000
@@ -7,7 +7,10 @@
  *
  *	Adapted from linux/net/ipv4/raw.c
  *
- *	$Id: raw.c,v 1.33 2000/01/18 08:24:22 davem Exp $
+ *	$Id: raw.c,v 1.34 2000/02/27 19:51:48 davem Exp $
+ *
+ *	Fixes:
+ *	Hideaki YOSHIFUJI	:	sin6_scope_id support
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -183,9 +186,8 @@
 	int addr_type;
 	int err;
 
-	if (addr_len < sizeof(struct sockaddr_in6))
+	if (addr_len < SIN6_LEN_RFC2133)
 		return -EINVAL;
-
 	addr_type = ipv6_addr_type(&addr->sin6_addr);
 
 	/* Raw sockets are IPv6 only */
@@ -198,6 +200,20 @@
 	if (sk->state != TCP_CLOSE)
 		goto out;
 
+	if (addr_type & IPV6_ADDR_LINKLOCAL) {
+		if (addr_len >= sizeof(struct sockaddr_in6) &&
+		    addr->sin6_scope_id) {
+			/* Override any existing binding, if another one
+			 * is supplied by user.
+			 */
+			sk->bound_dev_if = addr->sin6_scope_id;
+		}
+
+		/* Binding to link-local address requires an interface */
+		if (sk->bound_dev_if == 0)
+			goto out;
+	}
+
 	/* Check if the address belongs to the host. */
 	if (addr_type != IPV6_ADDR_ANY) {
 		/* ipv4 addr of the socket is invalid.  Only the
@@ -325,6 +341,11 @@
 		memcpy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr, 
 		       sizeof(struct in6_addr));
 		sin6->sin6_flowinfo = 0;
+		sin6->sin6_scope_id = 0;
+		if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
+			struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
+			sin6->sin6_scope_id = opt->iif;
+		}
 	}
 
 	if (sk->net_pinfo.af_inet6.rxopt.all)
@@ -429,14 +450,15 @@
 	 */
 
 	fl.fl6_flowlabel = 0;
+	fl.oif = 0;
 
 	if (sin6) {
-		if (addr_len < sizeof(struct sockaddr_in6)) 
-			return(-EINVAL);
+		if (addr_len < SIN6_LEN_RFC2133) 
+			return -EINVAL;
 
 		if (sin6->sin6_family && sin6->sin6_family != AF_INET6) 
 			return(-EINVAL);
-		
+
 		/* port is the proto value [0..255] carried in nexthdr */
 		proto = ntohs(sin6->sin6_port);
 
@@ -457,11 +479,15 @@
 			}
 		}
 
-
 		/* Otherwise it will be difficult to maintain sk->dst_cache. */
 		if (sk->state == TCP_ESTABLISHED &&
 		    !ipv6_addr_cmp(daddr, &sk->net_pinfo.af_inet6.daddr))
 			daddr = &sk->net_pinfo.af_inet6.daddr;
+
+		if (addr_len >= sizeof(struct sockaddr_in6) &&
+		    sin6->sin6_scope_id &&
+		    ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
+			fl.oif = sin6->sin6_scope_id;
 	} else {
 		if (sk->state != TCP_ESTABLISHED) 
 			return(-EINVAL);
@@ -479,7 +505,8 @@
 		return(-EINVAL);
 	}
 
-	fl.oif = sk->bound_dev_if;
+	if (fl.oif == 0)
+		fl.oif = sk->bound_dev_if;
 	fl.fl6_src = NULL;
 
 	if (msg->msg_controllen) {
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c
--- v2.3.48/linux/net/ipv6/tcp_ipv6.c	Tue Feb  1 01:35:44 2000
+++ linux/net/ipv6/tcp_ipv6.c	Sun Feb 27 18:45:10 2000
@@ -5,13 +5,16 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: tcp_ipv6.c,v 1.119 2000/01/31 01:21:26 davem Exp $
+ *	$Id: tcp_ipv6.c,v 1.120 2000/02/27 19:51:49 davem Exp $
  *
  *	Based on: 
  *	linux/net/ipv4/tcp.c
  *	linux/net/ipv4/tcp_input.c
  *	linux/net/ipv4/tcp_output.c
  *
+ *	Fixes:
+ *	Hideaki YOSHIFUJI	:	sin6_scope_id support
+ *
  *	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
@@ -509,8 +512,8 @@
 	int addr_type;
 	int err;
 
-	if (addr_len < sizeof(struct sockaddr_in6)) 
-		return(-EINVAL);
+	if (addr_len < SIN6_LEN_RFC2133) 
+		return -EINVAL;
 
 	if (usin->sin6_family != AF_INET6) 
 		return(-EAFNOSUPPORT);
@@ -540,6 +543,24 @@
 	if(addr_type & IPV6_ADDR_MULTICAST)
 		return -ENETUNREACH;
 
+	if (addr_type&IPV6_ADDR_LINKLOCAL) {
+		if (addr_len >= sizeof(struct sockaddr_in6) &&
+		    usin->sin6_scope_id) {
+			/* If interface is set while binding, indices
+			 * must coincide.
+			 */
+			if (sk->bound_dev_if &&
+			    sk->bound_dev_if != usin->sin6_scope_id)
+				return -EINVAL;
+
+			sk->bound_dev_if = usin->sin6_scope_id;
+		}
+
+		/* Connect to link-local address requires an interface */
+		if (sk->bound_dev_if == 0)
+			return -EINVAL;
+	}
+
 	if (tp->ts_recent_stamp && ipv6_addr_cmp(&np->daddr, &usin->sin6_addr)) {
 		tp->ts_recent = 0;
 		tp->ts_recent_stamp = 0;
@@ -605,15 +626,6 @@
 		goto failure;
 	}
 
-	if (fl.oif == 0 && addr_type&IPV6_ADDR_LINKLOCAL) {
-		/* Ough! This guy tries to connect to link local
-		 * address and did not specify interface.
-		 * Actually we should kick him out, but
-		 * we will be patient :) --ANK
-		 */
-		sk->bound_dev_if = dst->dev->ifindex;
-	}
-
 	ip6_dst_store(sk, dst, NULL);
 
 	if (saddr == NULL) {
@@ -1723,6 +1735,9 @@
 	sin6->sin6_port	= sk->dport;
 	/* We do not store received flowlabel for TCP */
 	sin6->sin6_flowinfo = 0;
+	sin6->sin6_scope_id = 0;
+	if (sk->bound_dev_if && ipv6_addr_type(&sin6->sin6_addr)&IPV6_ADDR_LINKLOCAL)
+		sin6->sin6_scope_id = sk->bound_dev_if;
 }
 
 static int tcp_v6_remember_stamp(struct sock *sk)
diff -u --recursive --new-file v2.3.48/linux/net/ipv6/udp.c linux/net/ipv6/udp.c
--- v2.3.48/linux/net/ipv6/udp.c	Fri Jan 28 15:09:09 2000
+++ linux/net/ipv6/udp.c	Sun Feb 27 18:45:10 2000
@@ -7,7 +7,10 @@
  *
  *	Based on linux/ipv4/udp.c
  *
- *	$Id: udp.c,v 1.50 2000/01/18 08:24:24 davem Exp $
+ *	$Id: udp.c,v 1.51 2000/02/27 19:51:51 davem Exp $
+ *
+ *	Fixes:
+ *	Hideaki YOSHIFUJI	:	sin6_scope_id support
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -218,7 +221,7 @@
 		goto ipv4_connected;
 	}
 
-	if (addr_len < sizeof(*usin)) 
+	if (addr_len < SIN6_LEN_RFC2133)
 	  	return -EINVAL;
 
 	if (usin->sin6_family != AF_INET6) 
@@ -278,6 +281,21 @@
 		return 0;
 	}
 
+	if (addr_type&IPV6_ADDR_LINKLOCAL) {
+		if (addr_len >= sizeof(struct sockaddr_in6) &&
+		    usin->sin6_scope_id) {
+			if (sk->bound_dev_if && sk->bound_dev_if != usin->sin6_scope_id) {
+				fl6_sock_release(flowlabel);
+				return -EINVAL;
+			}
+			sk->bound_dev_if = usin->sin6_scope_id;
+		}
+
+		/* Connect to link-local address requires an interface */
+		if (sk->bound_dev_if == 0)
+			return -EINVAL;
+	}
+
 	ipv6_addr_copy(&np->daddr, daddr);
 	np->flow_label = fl.fl6_flowlabel;
 
@@ -392,6 +410,7 @@
 		sin6->sin6_family = AF_INET6;
 		sin6->sin6_port = skb->h.uh->source;
 		sin6->sin6_flowinfo = 0;
+		sin6->sin6_scope_id = 0;
 
 		if (skb->protocol == __constant_htons(ETH_P_IP)) {
 			ipv6_addr_set(&sin6->sin6_addr, 0, 0,
@@ -404,6 +423,10 @@
 
 			if (sk->net_pinfo.af_inet6.rxopt.all)
 				datagram_recv_ctl(sk, msg, skb);
+			if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
+				struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
+				sin6->sin6_scope_id = opt->iif;
+			}
 		}
   	}
 	err = copied;
@@ -746,12 +769,13 @@
 		return -EMSGSIZE;
 	
 	fl.fl6_flowlabel = 0;
+	fl.oif = 0;
 
 	if (sin6) {
 		if (sin6->sin6_family == AF_INET)
 			return udp_sendmsg(sk, msg, ulen);
 
-		if (addr_len < sizeof(*sin6))
+		if (addr_len < SIN6_LEN_RFC2133)
 			return -EINVAL;
 
 		if (sin6->sin6_family && sin6->sin6_family != AF_INET6)
@@ -777,6 +801,11 @@
 		if (sk->state == TCP_ESTABLISHED &&
 		    !ipv6_addr_cmp(daddr, &sk->net_pinfo.af_inet6.daddr))
 			daddr = &sk->net_pinfo.af_inet6.daddr;
+
+		if (addr_len >= sizeof(struct sockaddr_in6) &&
+		    sin6->sin6_scope_id &&
+		    ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
+			fl.oif = sin6->sin6_scope_id;
 	} else {
 		if (sk->state != TCP_ESTABLISHED)
 			return -ENOTCONN;
@@ -802,7 +831,8 @@
 	}
 
 	udh.daddr = NULL;
-	fl.oif = sk->bound_dev_if;
+	if (!fl.oif)
+		fl.oif = sk->bound_dev_if;
 	fl.fl6_src = NULL;
 
 	if (msg->msg_controllen) {
diff -u --recursive --new-file v2.3.48/linux/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c
--- v2.3.48/linux/net/ipx/af_ipx.c	Tue Nov 23 22:42:21 1999
+++ linux/net/ipx/af_ipx.c	Thu Mar  2 10:13:17 2000
@@ -2352,13 +2352,10 @@
 #include <linux/smp_lock.h>
 SOCKOPS_WRAP(ipx_dgram, PF_IPX);
 
-
-/* Called by protocol.c on kernel start up */
-
 static struct packet_type ipx_8023_packet_type =
 
 {
-	0,	/* MUTTER ntohs(ETH_P_802_3),*/
+	__constant_htons(ETH_P_802_3),
 	NULL,		/* All devices */
 	ipx_rcv,
 	NULL,
@@ -2367,7 +2364,7 @@
 
 static struct packet_type ipx_dix_packet_type =
 {
-	0,	/* MUTTER ntohs(ETH_P_IPX),*/
+	__constant_htons(ETH_P_IPX),
 	NULL,		/* All devices */
 	ipx_rcv,
 	NULL,
@@ -2389,16 +2386,18 @@
 static unsigned char ipx_8022_type = 0xE0;
 static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 };
 
+
+
+/* Called by protocols.c on kernel start up */
+
 void ipx_proto_init(struct net_proto *pro)
 {
 	(void) sock_register(&ipx_family_ops);
 
 	pEII_datalink = make_EII_client();
-	ipx_dix_packet_type.type = htons(ETH_P_IPX);
 	dev_add_pack(&ipx_dix_packet_type);
 
 	p8023_datalink = make_8023_client();
-	ipx_8023_packet_type.type = htons(ETH_P_802_3);
 	dev_add_pack(&ipx_8023_packet_type);
 
 	if((p8022_datalink = register_8022_client(ipx_8022_type,ipx_rcv)) == NULL)
diff -u --recursive --new-file v2.3.48/linux/net/irda/irda_device.c linux/net/irda/irda_device.c
--- v2.3.48/linux/net/irda/irda_device.c	Sun Feb 13 19:29:04 2000
+++ linux/net/irda/irda_device.c	Thu Mar  2 11:41:11 2000
@@ -46,6 +46,7 @@
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <asm/dma.h>
+#include <asm/io.h>
 
 #include <net/pkt_sched.h>
 
diff -u --recursive --new-file v2.3.48/linux/net/irda/iriap_event.c linux/net/irda/iriap_event.c
--- v2.3.48/linux/net/irda/iriap_event.c	Fri Jan  7 19:13:23 2000
+++ linux/net/irda/iriap_event.c	Thu Mar  2 11:41:11 2000
@@ -6,10 +6,10 @@
  * Status:        Experimental.
  * Author:        Dag Brattli <dagb@cs.uit.no>
  * Created at:    Thu Aug 21 00:02:07 1997
- * Modified at:   Sat Dec 25 21:09:47 1999
+ * Modified at:   Wed Mar  1 11:28:34 2000
  * Modified by:   Dag Brattli <dagb@cs.uit.no>
  * 
- *     Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, 
+ *     Copyright (c) 1997, 1999-2000 Dag Brattli <dagb@cs.uit.no>, 
  *     All Rights Reserved.
  *     
  *     This program is free software; you can redistribute it and/or 
@@ -294,7 +294,7 @@
 
 	switch (event) {
 	case IAP_RECV_F_LST:
-		iriap_send_ack(self);
+		/*iriap_send_ack(self);*/
 		/*LM_Idle_request(idle); */
 
 		iriap_next_call_state(self, S_WAIT_FOR_CALL);
diff -u --recursive --new-file v2.3.48/linux/net/irda/parameters.c linux/net/irda/parameters.c
--- v2.3.48/linux/net/irda/parameters.c	Wed Dec 29 13:13:21 1999
+++ linux/net/irda/parameters.c	Thu Mar  2 11:41:11 2000
@@ -356,21 +356,23 @@
 	for (p = fmt; *p != '\0'; p++) {
 		switch (*p) {
 		case 'b':  /* 8 bits unsigned byte */
-			buf[n++] = va_arg(args, __u8);
+			buf[n++] = (__u8)va_arg(args, int);
 			break;
 		case 's':  /* 16 bits unsigned short */
-			arg.s = va_arg(args, __u16);
+			arg.s = (__u16)va_arg(args, int);
 			put_unaligned(arg.s, (__u16 *)(buf+n)); n+=2;
 			break;
 		case 'i':  /* 32 bits unsigned integer */
 			arg.i = va_arg(args, __u32);
 			put_unaligned(arg.i, (__u32 *)(buf+n)); n+=4;
 			break;
+#if 0
 		case 'c': /* \0 terminated string */
 			arg.c = va_arg(args, char *);
 			strcpy(buf+n, arg.c);
 			n += strlen(arg.c) + 1;
 			break;
+#endif
 		default:
 			va_end(args);
 			return -1;
diff -u --recursive --new-file v2.3.48/linux/net/netsyms.c linux/net/netsyms.c
--- v2.3.48/linux/net/netsyms.c	Sat Feb 26 22:32:08 2000
+++ linux/net/netsyms.c	Thu Mar  2 11:41:11 2000
@@ -502,6 +502,7 @@
 EXPORT_SYMBOL(dev_get);
 EXPORT_SYMBOL(dev_alloc);
 EXPORT_SYMBOL(dev_alloc_name);
+EXPORT_SYMBOL(__netdev_watchdog_up);
 #ifdef CONFIG_KMOD
 EXPORT_SYMBOL(dev_load);
 #endif
@@ -580,10 +581,9 @@
 EXPORT_SYMBOL(nf_unregister_hook);
 EXPORT_SYMBOL(nf_register_sockopt);
 EXPORT_SYMBOL(nf_unregister_sockopt);
-EXPORT_SYMBOL(nf_getinfo);
 EXPORT_SYMBOL(nf_reinject);
-EXPORT_SYMBOL(nf_register_interest);
-EXPORT_SYMBOL(nf_unregister_interest);
+EXPORT_SYMBOL(nf_register_queue_handler);
+EXPORT_SYMBOL(nf_unregister_queue_handler);
 EXPORT_SYMBOL(nf_hook_slow);
 EXPORT_SYMBOL(nf_hooks);
 #endif
diff -u --recursive --new-file v2.3.48/linux/net/sched/sch_generic.c linux/net/sched/sch_generic.c
--- v2.3.48/linux/net/sched/sch_generic.c	Sun Feb 20 21:12:40 2000
+++ linux/net/sched/sch_generic.c	Sun Feb 27 18:45:10 2000
@@ -146,16 +146,17 @@
 
 	spin_lock(&dev->xmit_lock);
 	if (dev->qdisc != &noop_qdisc) {
-		if (netif_queue_stopped(dev) &&
-		    (jiffies - dev->trans_start) > dev->watchdog_timeo) {
-			printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name);
-			dev->tx_timeout(dev);
+		if (netif_device_present(dev) &&
+		    netif_running(dev) &&
+		    netif_carrier_ok(dev)) {
+			if (netif_queue_stopped(dev) &&
+			    (jiffies - dev->trans_start) > dev->watchdog_timeo) {
+				printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name);
+				dev->tx_timeout(dev);
+			}
+			if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo))
+				dev_hold(dev);
 		}
-		if (!del_timer(&dev->watchdog_timer))
-			dev_hold(dev);
-
-		dev->watchdog_timer.expires = jiffies + dev->watchdog_timeo;
-		add_timer(&dev->watchdog_timer);
 	}
 	spin_unlock(&dev->xmit_lock);
 
@@ -169,32 +170,30 @@
 	dev->watchdog_timer.function = dev_watchdog;
 }
 
-static void dev_watchdog_up(struct net_device *dev)
+void __netdev_watchdog_up(struct net_device *dev)
 {
-	spin_lock_bh(&dev->xmit_lock);
-
 	if (dev->tx_timeout) {
 		if (dev->watchdog_timeo <= 0)
 			dev->watchdog_timeo = 5*HZ;
-		if (!del_timer(&dev->watchdog_timer))
+		if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo))
 			dev_hold(dev);
-		dev->watchdog_timer.expires = jiffies + dev->watchdog_timeo;
-		add_timer(&dev->watchdog_timer);
 	}
+}
+
+static void dev_watchdog_up(struct net_device *dev)
+{
+	spin_lock_bh(&dev->xmit_lock);
+	__netdev_watchdog_up(dev);
 	spin_unlock_bh(&dev->xmit_lock);
 }
 
 static void dev_watchdog_down(struct net_device *dev)
 {
 	spin_lock_bh(&dev->xmit_lock);
-
-	if (dev->tx_timeout) {
-		if (del_timer(&dev->watchdog_timer))
-			__dev_put(dev);
-	}
+	if (del_timer(&dev->watchdog_timer))
+		__dev_put(dev);
 	spin_unlock_bh(&dev->xmit_lock);
 }
-
 
 /* "NOOP" scheduler: the best scheduler, recommended for all interfaces
    under all circumstances. It is difficult to invent anything faster or
diff -u --recursive --new-file v2.3.48/linux/net/sched/sch_red.c linux/net/sched/sch_red.c
--- v2.3.48/linux/net/sched/sch_red.c	Thu Aug 26 13:05:46 1999
+++ linux/net/sched/sch_red.c	Sun Feb 27 18:45:10 2000
@@ -11,6 +11,7 @@
  * Changes:
  * J Hadi Salim <hadi@nortel.com> 980914:	computation fixes
  * Alexey Makarenko <makar@phoenix.kharkov.ua> 990814: qave on idle link was calculated incorrectly.
+ * J Hadi Salim <hadi@nortelnetworks.com> 980816:  ECN support	
  */
 
 #include <linux/config.h>
@@ -39,6 +40,9 @@
 #include <net/sock.h>
 #include <net/pkt_sched.h>
 
+#define RED_ECN_ECT  0x02
+#define RED_ECN_CE   0x01
+
 
 /*	Random Early Detection (RED) algorithm.
 	=======================================
@@ -138,6 +142,7 @@
 	u32		qth_max;	/* Max average length threshold: A scaled */
 	u32		Rmask;
 	u32		Scell_max;
+	unsigned char	flags;
 	char		Wlog;		/* log(W)		*/
 	char		Plog;		/* random number bits	*/
 	char		Scell_log;
@@ -149,8 +154,48 @@
 	u32		qR;		/* Cached random number */
 
 	psched_time_t	qidlestart;	/* Start of idle period		*/
+	struct tc_red_xstats st;
 };
 
+static int red_ecn_mark(struct sk_buff *skb)
+{
+	if (skb->nh.raw + 20 < skb->tail)
+		return 0;
+
+	switch (skb->protocol) {
+	case __constant_htons(ETH_P_IP):
+	{
+		u8 tos = skb->nh.iph->tos;
+
+		if (!(tos & RED_ECN_ECT))
+			return 0;
+
+		if (!(tos & RED_ECN_CE)) {
+			u32 check = skb->nh.iph->check;
+
+			check += __constant_htons(0xFFFE);
+			skb->nh.iph->check = check + (check>>16);
+
+			skb->nh.iph->tos = tos | RED_ECN_CE;
+		}
+		return 1;
+	}
+
+	case __constant_htons(ETH_P_IPV6):
+	{
+		u32 label = *(u32*)skb->nh.raw;
+
+		if (!(label & __constant_htonl(RED_ECN_ECT<<20)))
+			return 0;
+		label |= __constant_htonl(RED_ECN_CE<<20);
+		return 1;
+	}
+
+	default:
+		return 0;
+	}
+}
+
 static int
 red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
@@ -221,7 +266,9 @@
 			sch->stats.backlog += skb->len;
 			sch->stats.bytes += skb->len;
 			sch->stats.packets++;
-			return 0;
+			return NET_XMIT_SUCCESS;
+		} else {
+			q->st.pdrop++;
 		}
 		kfree_skb(skb);
 		sch->stats.drops++;
@@ -231,10 +278,14 @@
 		q->qcount = -1;
 		sch->stats.overlimits++;
 mark:
-		kfree_skb(skb);
-		sch->stats.drops++;
-		return NET_XMIT_CN;
+		if  (!(q->flags&TC_RED_ECN) || !red_ecn_mark(skb)) {
+			q->st.early++;
+			goto drop;
+		}
+		q->st.marked++;
+		goto enqueue;
 	}
+
 	if (++q->qcount) {
 		/* The formula used below causes questions.
 
@@ -261,6 +312,11 @@
 	}
 	q->qR = net_random()&q->Rmask;
 	goto enqueue;
+
+drop:
+	kfree_skb(skb);
+	sch->stats.drops++;
+	return NET_XMIT_CN;
 }
 
 static int
@@ -300,6 +356,7 @@
 	if (skb) {
 		sch->stats.backlog -= skb->len;
 		sch->stats.drops++;
+		q->st.other++;
 		kfree_skb(skb);
 		return 1;
 	}
@@ -336,6 +393,7 @@
 	ctl = RTA_DATA(tb[TCA_RED_PARMS-1]);
 
 	sch_tree_lock(sch);
+	q->flags = ctl->flags;
 	q->Wlog = ctl->Wlog;
 	q->Plog = ctl->Plog;
 	q->Rmask = ctl->Plog < 32 ? ((1<<ctl->Plog) - 1) : ~0UL;
@@ -367,6 +425,15 @@
 
 
 #ifdef CONFIG_RTNETLINK
+int red_copy_xstats(struct sk_buff *skb, struct tc_red_xstats *st)
+{
+        RTA_PUT(skb, TCA_XSTATS, sizeof(*st), st);
+        return 0;
+
+rtattr_failure:
+        return 1;
+}
+
 static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
 	struct red_sched_data *q = (struct red_sched_data *)sch->data;
@@ -382,8 +449,12 @@
 	opt.Wlog = q->Wlog;
 	opt.Plog = q->Plog;
 	opt.Scell_log = q->Scell_log;
+	opt.flags = q->flags;
 	RTA_PUT(skb, TCA_RED_PARMS, sizeof(opt), &opt);
 	rta->rta_len = skb->tail - b;
+
+	if (red_copy_xstats(skb, &q->st))
+		goto rtattr_failure;
 
 	return skb->len;
 
diff -u --recursive --new-file v2.3.48/linux/net/unix/af_unix.c linux/net/unix/af_unix.c
--- v2.3.48/linux/net/unix/af_unix.c	Fri Jan 28 15:09:09 2000
+++ linux/net/unix/af_unix.c	Sun Feb 27 18:45:10 2000
@@ -8,7 +8,7 @@
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
  *
- * Version:	$Id: af_unix.c,v 1.88 2000/01/18 08:24:28 davem Exp $
+ * Version:	$Id: af_unix.c,v 1.89 2000/02/27 19:52:50 davem Exp $
  *
  * Fixes:
  *		Linus Torvalds	:	Assorted bug cures.
@@ -1556,8 +1556,10 @@
 			other->shutdown |= peer_mode;
 			unix_state_wunlock(other);
 			other->state_change(other);
-			if (peer_mode&RCV_SHUTDOWN)
-				sock_wake_async(sk->socket,1,POLL_HUP);
+			if (peer_mode == SHUTDOWN_MASK)
+				sock_wake_async(other->socket,1,POLL_HUP);
+			else if (peer_mode & RCV_SHUTDOWN)
+				sock_wake_async(other->socket,1,POLL_IN);
 		}
 		if (other)
 			sock_put(other);
